You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by li...@apache.org on 2010/09/29 17:36:12 UTC

svn commit: r1002682 - in /db/derby/code/trunk/java: testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java tools/org/apache/derby/impl/tools/sysinfo/Main.java

Author: lilywei
Date: Wed Sep 29 15:36:11 2010
New Revision: 1002682

URL: http://svn.apache.org/viewvc?rev=1002682&view=rev
Log:
DERBY-4806 DERBY-4597 removes references to IBM jcc driver on Main.java, fixing extracting derbyTesting.jar information when it is not in the same directory as derbyrun.jar

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java?rev=1002682&r1=1002681&r2=1002682&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoCPCheckTest.java Wed Sep 29 15:36:11 2010
@@ -91,16 +91,16 @@ public class SysinfoCPCheckTest extends 
                 {null, "0", "Testing for presence of all Derby-related " +
                     "libraries; typically, only some are needed.", null},
                 // incorrect syntax, or 'args' - should return usage
-                {"a", "0", "USAGE: java org.apache.derby.tools.sysinfo -cp [" +
-                    " [ embedded ][ server ][ client] [ db2driver ] [ tools ]" +
-                    " [  anyClass.class ] ]", null},
+                {
+                        "a",
+                        "0",
+                        "USAGE: java org.apache.derby.tools.sysinfo -cp ["
+                                + " [ embedded ][ server ][ client] [ tools ]"
+                                + " [ anyClass.class ] ]", null },
                 {"embedded", "6", Success, "derby.jar"}, 
                 {"server", "10", Success, "derbynet.jar"},
                 {"tools", "6", Success, "derbytools.jar"},
                 {"client", "6", Success, "derbyclient.jar"},
-                // let's not test the following valid value, it will 
-                // fail if db2jcc.jar is not on CLASSPATH
-                //{"db2driver", "6", Success, "db2jcc.jar"},
                 {thisclass, "6", Success, "SysinfoCPCheckTest"},
                 // neg tst, hope this doesn't exist
                 {"nonexist.class", "6", "    (nonexist not found.)", null}

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java?rev=1002682&r1=1002681&r2=1002682&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java Wed Sep 29 15:36:11 2010
@@ -139,9 +139,9 @@ public static void getMainInfo (java.io.
     reportJavaInfo (aw);
     aw.println (jbmsSep);
     reportDerby (aw);
-
     aw.println (sep);
 
+
     // Locales info
     try {
       reportLocales (aw);
@@ -512,13 +512,14 @@ public static void getMainInfo (java.io.
 
 	private static final String NET = "server";
 	private static final String CLIENT = "client";
-	private static final String DB2DRIVER = "db2driver";
 
 	/* you can add this if you like */
 
 	private static final String MAINUSAGESTRING = "java org.apache.derby.tools.sysinfo -cp";
 
-	private static final String USAGESTRINGPARTA = MAINUSAGESTRING + " [ [ " + EMBEDDED + " ][ " + NET + " ][ " + CLIENT + "] [ " + DB2DRIVER + " ] [ " + TOOLS + " ] [ ";
+    private static final String USAGESTRINGPARTA = MAINUSAGESTRING + " [ [ "
+            + EMBEDDED + " ][ " + NET + " ][ " + CLIENT + "] [ " + TOOLS
+            + " ] [";
     private static final String USAGESTRINGPARTB = ".class ] ]";
 
   static  void useMe(String[] args, java.io.PrintWriter pw) {
@@ -566,7 +567,6 @@ public static void getMainInfo (java.io.
 		  tryCoreClasspath(successes, failures);
 		  tryNetClasspath(successes, failures);
 		  tryClientClasspath(successes, failures);
-		  tryDB2DriverClasspath(successes, failures);
 		  tryUtilsClasspath(successes, failures);
 		  localPW.println(successes.toString());
 		  if (!failures.toString().equals(crLf() + Main.getTextMessage("SIF08.E") + crLf())) {
@@ -602,10 +602,6 @@ public static void getMainInfo (java.io.
 			seenArg =true;
 
 		}
-		if (argumentsContain(args,DB2DRIVER)) {
-			tryDB2DriverClasspath(successes, failures);
-			seenArg =true;
-		}
 
 		if (argumentsContain(args,TOOLS) || argumentsContain(args,"utils")) {
 		  tryUtilsClasspath(successes, failures);
@@ -650,13 +646,6 @@ public static void getMainInfo (java.io.
 	private static void tryClientClasspath(StringBuffer successes, StringBuffer failures) {
 		tryMyClasspath("org.apache.derby.jdbc.ClientDriver", Main.getTextMessage("SIF08.L", "derbyclient.jar"), successes, failures);
 	}
-    private static void tryDB2DriverClasspath(StringBuffer successes,
-            StringBuffer failures)
-    {
-        tryMyClasspath("com.ibm.db2.jcc.DB2Driver",
-                Main.getTextMessage("SIF08.L", "db2jcc.jar"),
-                successes, failures);
-    }
 
 	private static void tryUtilsClasspath(StringBuffer successes, StringBuffer failures) {
 		tryMyClasspath("org.apache.derby.tools.ij", Main.getTextMessage("SIF08.Q", "derbytools.jar"), successes, failures);
@@ -1021,14 +1010,12 @@ public static void getMainInfo (java.io.
     }
 
     /**
-     *  Check inside a jar file for the presence of a Derby info properties
-     *  file. There is a special case for db2jcc, which does not have a Derby
-     *  info propeties file. If db2jcc is in the filename, acquire DB2Driver
-     *  via reflection and get the version number from it.
-     *
-     *  @param filename the jar file to check
-     *  @return ZipInfoProperties with the jar file set as the location
-     *          or null if not found.
+     * Check inside a jar file for the presence of a Derby info properties file.
+     * 
+     * @param filename
+     *            the jar file to check
+     * @return ZipInfoProperties with the jar file set as the location or null
+     *         if not found.
      */
     private static ZipInfoProperties checkFile(String filename)
     {
@@ -1126,8 +1113,16 @@ public static void getMainInfo (java.io.
                     return null;        
      
                 URL result = cs.getLocation ();
-     
-                return formatURL(result);
+
+                try {
+                    // DERBY-4806 Should use UTF-8 according to
+                    // http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars
+                    // to get the string of the file name
+                    return URLDecoder.decode(result.toString(), "UTF-8");
+                } catch (UnsupportedEncodingException e) {
+                    // All JVMs are required to support UTF-8.
+                    return e.getMessage();
+                }
             }
         });
     }
@@ -1228,7 +1223,7 @@ public static void getMainInfo (java.io.
         try {
             result = new File(filename).getCanonicalPath().replace('/', File.separatorChar);
         } catch (IOException e) {
-            result = "IOException";
+            result = e.getMessage();
         }
         return result;
     }