You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2016/04/10 06:18:37 UTC

[21/46] commons-compress git commit: Refactor magic string.

Refactor magic string.

Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/ac6b5f3a
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/ac6b5f3a
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/ac6b5f3a

Branch: refs/heads/COMPRESS-207
Commit: ac6b5f3a7e1dc36c9ec4f2d34a20f311ee760900
Parents: e21728c
Author: ggregory <gg...@apache.org>
Authored: Sat Apr 9 08:55:27 2016 -0700
Committer: ggregory <gg...@apache.org>
Committed: Sat Apr 9 08:55:27 2016 -0700

----------------------------------------------------------------------
 .../compress/archivers/ArchiveStreamFactoryTest.java    | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ac6b5f3a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
index a64b9a6..338df54 100644
--- a/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/ArchiveStreamFactoryTest.java
@@ -42,6 +42,8 @@ import org.junit.Test;
 
 public class ArchiveStreamFactoryTest {
 
+    private static final String UNKNOWN = "??";
+
     /**
      * see https://issues.apache.org/jira/browse/COMPRESS-171
      */
@@ -228,7 +230,7 @@ public class ArchiveStreamFactoryTest {
 
     static {
         String dflt;
-        dflt = "??";
+        dflt = UNKNOWN;
         try {
             dflt = getField(new ArjArchiveInputStream(new FileInputStream(getFile("bla.arj"))), "charsetName");
         } catch (ArchiveException e) {
@@ -237,7 +239,7 @@ public class ArchiveStreamFactoryTest {
             e.printStackTrace();
         }
         ARJ_DEFAULT = dflt;
-        dflt = "??";
+        dflt = UNKNOWN;
         try {
             dflt = getField(new DumpArchiveInputStream(new FileInputStream(getFile("bla.dump"))), "encoding");
         } catch (ArchiveException e) {
@@ -357,7 +359,7 @@ public class ArchiveStreamFactoryTest {
                     fld = cls.getSuperclass().getDeclaredField(name);
                 } catch (NoSuchFieldException e) {
                     System.out.println("Cannot find " + name + " in class " + instance.getClass().getSimpleName());
-                    return "??";
+                    return UNKNOWN;
                 }                
         }
         boolean isAccessible = fld.isAccessible();
@@ -370,10 +372,10 @@ public class ArchiveStreamFactoryTest {
                 return (String) object;
             }
             System.out.println("Wrong type: " + object.getClass().getCanonicalName() + " for " + name + " in class " + instance.getClass().getSimpleName());
-            return "??";
+            return UNKNOWN;
         } catch (Exception e) {
             e.printStackTrace();
-            return "??";
+            return UNKNOWN;
         } finally {
             if (!isAccessible) {
                 fld.setAccessible(isAccessible);