Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 81984 invoked from network); 12 Oct 2007 22:27:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Oct 2007 22:27:23 -0000 Received: (qmail 74564 invoked by uid 500); 12 Oct 2007 22:27:09 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 74488 invoked by uid 500); 12 Oct 2007 22:27:09 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 74479 invoked by uid 99); 12 Oct 2007 22:27:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Oct 2007 15:27:09 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED 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; Fri, 12 Oct 2007 22:27:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3FBC01A9832; Fri, 12 Oct 2007 15:26:30 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r584302 - in /commons/proper/io/trunk/src: java/org/apache/commons/io/filefilter/RegexFilter.java test/org/apache/commons/io/filefilter/FileFilterTestCase.java Date: Fri, 12 Oct 2007 22:26:27 -0000 To: commits@commons.apache.org From: niallp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071012222630.3FBC01A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: niallp Date: Fri Oct 12 15:26:24 2007 New Revision: 584302 URL: http://svn.apache.org/viewvc?rev=584302&view=rev Log: Add messages to IllegalArgumentExceptions, add tests for thrown expections Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/RegexFilter.java commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/RegexFilter.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/RegexFilter.java?rev=584302&r1=584301&r2=584302&view=diff ============================================================================== --- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/RegexFilter.java (original) +++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/RegexFilter.java Fri Oct 12 15:26:24 2007 @@ -54,7 +54,7 @@ */ public RegexFilter(String pattern) { if (pattern == null) { - throw new java.lang.IllegalArgumentException(); + throw new IllegalArgumentException("Pattern is missing"); } this.pattern = Pattern.compile(pattern); @@ -69,7 +69,7 @@ */ public RegexFilter(String pattern, IOCase caseSensitivity) { if (pattern == null) { - throw new java.lang.IllegalArgumentException(); + throw new IllegalArgumentException("Pattern is missing"); } int flags = 0; if (caseSensitivity != null && !caseSensitivity.isCaseSensitive()) { @@ -87,7 +87,7 @@ */ public RegexFilter(String pattern, int flags) { if (pattern == null) { - throw new java.lang.IllegalArgumentException(); + throw new IllegalArgumentException("Pattern is missing"); } this.pattern = Pattern.compile(pattern, flags); } @@ -100,7 +100,7 @@ */ public RegexFilter(Pattern pattern) { if (pattern == null) { - throw new java.lang.IllegalArgumentException(); + throw new IllegalArgumentException("Pattern is missing"); } this.pattern = pattern; Modified: commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java?rev=584302&r1=584301&r2=584302&view=diff ============================================================================== --- commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java (original) +++ commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java Fri Oct 12 15:26:24 2007 @@ -847,6 +847,34 @@ assertFiltering(filter, new File("Test.java"), true); assertFiltering(filter, new File("test.java"), true); assertFiltering(filter, new File("tEST.java"), true); + + try { + FileFilterUtils.regex((String)null); + fail(); + } catch (IllegalArgumentException ex) { + // expected + } + + try { + FileFilterUtils.regex((String)null, Pattern.CASE_INSENSITIVE); + fail(); + } catch (IllegalArgumentException ex) { + // expected + } + + try { + FileFilterUtils.regex((String)null, IOCase.INSENSITIVE); + fail(); + } catch (IllegalArgumentException ex) { + // expected + } + + try { + new RegexFilter((java.util.regex.Pattern)null); + fail(); + } catch (IllegalArgumentException ex) { + // expected + } } //-----------------------------------------------------------------------