harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r462699 - in /incubator/harmony/enhanced/classlib/trunk/modules/tools: ./ src/main/java/org/apache/harmony/tools/toolutils/ src/test/java/org/apache/harmony/tools/ src/test/java/org/apache/harmony/tools/toolutils/ src/test/java/org/apache/h...
Date Wed, 11 Oct 2006 05:24:18 GMT
Author: smishura
Date: Tue Oct 10 22:24:18 2006
New Revision: 462699

URL: http://svn.apache.org/viewvc?view=rev&rev=462699
Log:
Apply patch for HARMONY-1794 ([classlib][tools] KeyStoreLoaderSaver throws unhandled IllegalArgumentException)

update classpath for tests

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/tools/src/test/java/org/apache/harmony/tools/
    incubator/harmony/enhanced/classlib/trunk/modules/tools/src/test/java/org/apache/harmony/tools/toolutils/
    incubator/harmony/enhanced/classlib/trunk/modules/tools/src/test/java/org/apache/harmony/tools/toolutils/tests/
    incubator/harmony/enhanced/classlib/trunk/modules/tools/src/test/java/org/apache/harmony/tools/toolutils/tests/KeyStoreLoaderSaverTest.java
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/tools/build.xml
    incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/toolutils/KeyStoreLoaderSaver.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/tools/build.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/tools/build.xml?view=diff&rev=462699&r1=462698&r2=462699
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/tools/build.xml (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/tools/build.xml Tue Oct 10 22:24:18
2006
@@ -138,6 +138,7 @@
 
             <classpath>
                 <pathelement path="${hy.tools.bin.test}"/>
+                <pathelement path="${hy.jdk}/lib/tools.jar"/>
             </classpath>
             <classpath location="../../build/tests" />
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/toolutils/KeyStoreLoaderSaver.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/toolutils/KeyStoreLoaderSaver.java?view=diff&rev=462699&r1=462698&r2=462699
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/toolutils/KeyStoreLoaderSaver.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/toolutils/KeyStoreLoaderSaver.java
Tue Oct 10 22:24:18 2006
@@ -76,8 +76,13 @@
                 ksFile = new File(uri);
             } catch (URISyntaxException e) {
                 ksFile = new File(path);
+            } catch (IllegalArgumentException e){
+                ksFile = new File(path);
             }
             
+            if (!ksFile.exists()) {
+                throw new IOException("Keystore file does not exist");
+            }
             if (ksFile.length() == 0) {
                 throw new IOException("Keystore file exists but is empty");
             }

Added: incubator/harmony/enhanced/classlib/trunk/modules/tools/src/test/java/org/apache/harmony/tools/toolutils/tests/KeyStoreLoaderSaverTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/tools/src/test/java/org/apache/harmony/tools/toolutils/tests/KeyStoreLoaderSaverTest.java?view=auto&rev=462699
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/tools/src/test/java/org/apache/harmony/tools/toolutils/tests/KeyStoreLoaderSaverTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/tools/src/test/java/org/apache/harmony/tools/toolutils/tests/KeyStoreLoaderSaverTest.java
Tue Oct 10 22:24:18 2006
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.harmony.tools.toolutils.tests;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.harmony.tools.toolutils.KeyStoreLoaderSaver;
+
+public class KeyStoreLoaderSaverTest extends TestCase {
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(KeyStoreLoaderSaver.class);
+    }
+
+    /**
+     * @tests 'KeyStoreLoaderSaver.loadStore(String, String, char[], String)'
+     */
+    public void testLoadStore() throws Exception {
+        
+        // Regression for HARMONY-1794
+        try {
+            KeyStoreLoaderSaver.loadStore("there_is_no_such_file", "BKS", "pwd"
+                    .toCharArray(), null);
+
+            // IOException must be thrown, because file does not exist
+            fail("No expected IOException");
+        } catch (IOException ok) {
+        }
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/tools/src/test/java/org/apache/harmony/tools/toolutils/tests/KeyStoreLoaderSaverTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message