commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1518802 - in /commons/proper/csv/trunk/src: main/java/org/apache/commons/csv/ test/java/org/apache/commons/csv/
Date Fri, 30 Aug 2013 10:19:00 GMT
On 29 August 2013 21:18,  <britter@apache.org> wrote:
> Author: britter
> Date: Thu Aug 29 20:18:13 2013
> New Revision: 1518802
>
> URL: http://svn.apache.org/r1518802
> Log:
> Make methods that create parsers or printers fail early and provide an expressive error
messages. Document new behavior in JavaDoc
>
> Added:
>     commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Assertions.java   (with
props)
>     commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/AssertionsTest.java
  (with props)
> Modified:
>     commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVParser.java
>     commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
>     commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
>     commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
>
> Added: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Assertions.java
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Assertions.java?rev=1518802&view=auto
> ==============================================================================
> --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Assertions.java (added)
> +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/Assertions.java Thu
Aug 29 20:18:13 2013
> @@ -0,0 +1,19 @@
> +package org.apache.commons.csv;
> +
> +/**
> + * Utility class for input parameter validation
> + *
> + * @version $Id$
> + */
> +final class Assertions {
> +
> +    private Assertions() {
> +        // can not be instantiated
> +    }
> +
> +    public static <T> void notNull(T parameter, String parameterName) {

Not sure this needs to be generic. Surely could just use the following
method sig?

public static void notNull(Object parameter, String parameterName) {

> +        if (parameter == null) {
> +            throw new IllegalArgumentException("Parameter '" + parameterName + "' must
not be null!");
> +        }
> +    }
> +}

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


Mime
View raw message