commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r511908 - in /jakarta/commons/proper/validator/trunk: src/main/java/org/apache/commons/validator/ src/test/java/org/apache/commons/validator/ xdocs/
Date Mon, 26 Feb 2007 17:12:38 GMT
Author: niallp
Date: Mon Feb 26 09:12:37 2007
New Revision: 511908

URL: http://svn.apache.org/viewvc?view=rev&rev=511908
Log:
Fix for VALIDATOR-226 - Null-Stream input to ValidatorResources leads to MalformedURLExceptions
- thanks to Lian Ort

Added:
    jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorResourcesTest.java
  (with props)
Modified:
    jakarta/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/ValidatorResources.java
    jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorTestSuite.java
    jakarta/commons/proper/validator/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/ValidatorResources.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/ValidatorResources.java?view=diff&rev=511908&r1=511907&r2=511908
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/ValidatorResources.java
(original)
+++ jakarta/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/ValidatorResources.java
Mon Feb 26 09:12:37 2007
@@ -152,6 +152,9 @@
 
         Digester digester = initDigester();
         for (int i = 0; i < streams.length; i++) {
+            if (streams[i] == null) {
+                throw new IllegalArgumentException("Stream[" + i + "] is null");
+            }
             digester.push(this);
             digester.parse(streams[i]);
         }

Added: jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorResourcesTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorResourcesTest.java?view=auto&rev=511908
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorResourcesTest.java
(added)
+++ jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorResourcesTest.java
Mon Feb 26 09:12:37 2007
@@ -0,0 +1,81 @@
+/*
+ * 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.commons.validator;
+
+import java.io.InputStream;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestCase;
+
+/**
+ * Test ValidatorResources.
+ *
+ * @version $Revision$
+ */
+public class ValidatorResourcesTest extends TestCase {
+
+    /**
+     * Constructor.
+     */
+    public ValidatorResourcesTest(String name) {
+        super(name);
+    }
+
+    /**
+     * Start the tests.
+     *
+     * @param theArgs the arguments. Not used
+     */
+    public static void main(String[] theArgs) {
+        junit.awtui.TestRunner.main(new String[] {ValidatorResourcesTest.class.getName()});
+    }
+
+    /**
+     * @return a test suite (<code>TestSuite</code>) that includes all methods
+     *         starting with "test"
+     */
+    public static Test suite() {
+        // All methods starting with "test" will be executed in the test suite.
+        return new TestSuite(ValidatorResourcesTest.class);
+    }
+
+    /**
+     * Load <code>ValidatorResources</code> from
+     * ValidatorResultsTest-config.xml.
+     */
+    protected void setUp() throws Exception {
+    }
+
+    protected void tearDown() {
+    }
+
+    /**
+     * Test null Input Stream for Validator Resources.
+     */
+    public void testNullInputStream() throws Exception {
+
+        try {
+            new ValidatorResources((InputStream)null);
+            fail("Expected IllegalArgumentException");
+        } catch(IllegalArgumentException e) {
+            // expected result
+            // System.out.println("Exception: " + e);
+        }
+
+    }
+
+}

Propchange: jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorResourcesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorResourcesTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorTestSuite.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorTestSuite.java?view=diff&rev=511908&r1=511907&r2=511908
==============================================================================
--- jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorTestSuite.java
(original)
+++ jakarta/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/ValidatorTestSuite.java
Mon Feb 26 09:12:37 2007
@@ -66,6 +66,7 @@
        suite.addTest(UrlTest.suite());
        suite.addTest(ValidatorResultsTest.suite());
        suite.addTest(ValidatorTest.suite());
+       suite.addTest(ValidatorResourcesTest.suite());
        suite.addTest(VarTest.suite());
 
        return suite;

Modified: jakarta/commons/proper/validator/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/validator/trunk/xdocs/changes.xml?view=diff&rev=511908&r1=511907&r2=511908
==============================================================================
--- jakarta/commons/proper/validator/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/validator/trunk/xdocs/changes.xml Mon Feb 26 09:12:37 2007
@@ -40,6 +40,9 @@
   <body>
 
     <release version="1.4-SNAPSHOT" date="in SVN" description="JDK 1.4 (minimum)">
+      <action dev="niallp" type="fix" issue="VALIDATOR-226" due-to="Lian Ort">
+          Null-Stream input to ValidatorResources leads to MalformedURLExceptions
+      </action>
       <action dev="niallp" type="update" issue="VALIDATOR-224" due-to="Hasan Turksoy">
           validatorUtilities.js - replace colon characters in the function name (JSF/Shale)
       </action>



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


Mime
View raw message