james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [10/34] james-project git commit: JAMES-2085 Avoid rethrowing an exception in AbstractFileRepository
Date Wed, 05 Jul 2017 13:59:17 GMT
JAMES-2085 Avoid rethrowing an exception in AbstractFileRepository


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/3f97dd75
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/3f97dd75
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/3f97dd75

Branch: refs/heads/master
Commit: 3f97dd75ba01006713038b77da0076f447bde4fc
Parents: abf61ef
Author: benwa <btellier@linagora.com>
Authored: Mon Jul 3 15:54:48 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Wed Jul 5 17:13:47 2017 +0700

----------------------------------------------------------------------
 .../repository/file/AbstractFileRepository.java | 39 +++++++++-----------
 1 file changed, 17 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/3f97dd75/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
----------------------------------------------------------------------
diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
b/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
index 8531c69..7ceb96d 100644
--- a/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
@@ -118,29 +118,24 @@ public abstract class AbstractFileRepository implements Repository,
Configurable
         FilenameFilter num_filter = new NumberedRepositoryFileFilter(getExtensionDecorator());
         final String[] names = directory.list(num_filter);
 
-        try {
-            for (String origFilename : names) {
-                // This needs to handle (skip over) the possible repository
-                // numbers
-                int pos = origFilename.length() - m_postfix.length();
-                while (pos >= 1 && Character.isDigit(origFilename.charAt(pos -
1))) {
-                    pos--;
-                }
-                pos -= ".".length() + m_name.length();
-                String newFilename = origFilename.substring(0, pos) + m_extension;
-
-                File origFile = new File(directory, origFilename);
-                File newFile = new File(directory, newFilename);
-
-                if (origFile.renameTo(newFile)) {
-                    getLogger().info("Renamed " + origFile + " to " + newFile);
-                } else {
-                    getLogger().info("Unable to rename " + origFile + " to " + newFile);
-                }
+        for (String origFilename : names) {
+            // This needs to handle (skip over) the possible repository
+            // numbers
+            int pos = origFilename.length() - m_postfix.length();
+            while (pos >= 1 && Character.isDigit(origFilename.charAt(pos - 1)))
{
+                pos--;
+            }
+            pos -= ".".length() + m_name.length();
+            String newFilename = origFilename.substring(0, pos) + m_extension;
+
+            File origFile = new File(directory, origFilename);
+            File newFile = new File(directory, newFilename);
+
+            if (origFile.renameTo(newFile)) {
+                getLogger().info("Renamed " + origFile + " to " + newFile);
+            } else {
+                getLogger().info("Unable to rename " + origFile + " to " + newFile);
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw e;
         }
 
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message