Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 11636 invoked from network); 26 Feb 2007 17:13:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Feb 2007 17:13:03 -0000 Received: (qmail 17508 invoked by uid 500); 26 Feb 2007 17:13:08 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 17400 invoked by uid 500); 26 Feb 2007 17:13:08 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 17389 invoked by uid 500); 26 Feb 2007 17:13:08 -0000 Received: (qmail 17386 invoked by uid 99); 26 Feb 2007 17:13:08 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Feb 2007 09:13:08 -0800 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Feb 2007 09:12:59 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 0733D1A981A; Mon, 26 Feb 2007 09:12:39 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commons-cvs@jakarta.apache.org From: niallp@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070226171239.0733D1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 (TestSuite) 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 ValidatorResources 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 @@ + + Null-Stream input to ValidatorResources leads to MalformedURLExceptions + validatorUtilities.js - replace colon characters in the function name (JSF/Shale) --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org