You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by il...@apache.org on 2012/06/07 17:45:55 UTC
svn commit: r1347689 - in /cocoon/cocoon3/trunk:
cocoon-cli/src/main/java/org/apache/cocoon/cli/
cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/csv/
cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/
Author: ilgrosso
Date: Thu Jun 7 15:45:54 2012
New Revision: 1347689
URL: http://svn.apache.org/viewvc?rev=1347689&view=rev
Log:
When applicable, avoid throwing / cathing NullPointerException in favor of IllegalArgumentException
Modified:
cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/CliCommand.java
cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/csv/CSVGenerator.java
cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/InvalidCacheKey.java
Modified: cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/CliCommand.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/CliCommand.java?rev=1347689&r1=1347688&r2=1347689&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/CliCommand.java (original)
+++ cocoon/cocoon3/trunk/cocoon-cli/src/main/java/org/apache/cocoon/cli/CliCommand.java Thu Jun 7 15:45:54 2012
@@ -174,7 +174,7 @@ public final class CliCommand
if ( pipeline == null )
{
- throw new NullPointerException( format( "Pipeline '%s' not found!", id ) );
+ throw new IllegalArgumentException( format( "Pipeline '%s' not found!", id ) );
}
pipeline.setup( System.out );
@@ -187,7 +187,7 @@ public final class CliCommand
{
if ( registry.getDefaultId() == null )
{
- throw new NullPointerException( "Default pipeline not specified, no pipeline executed!" );
+ throw new IllegalArgumentException( "Default pipeline not specified, no pipeline executed!" );
}
logger.info( "Executing default Pipeline '{}'", registry.getDefaultId() );
@@ -196,7 +196,7 @@ public final class CliCommand
if ( pipeline == null )
{
- throw new NullPointerException( format( "Default pipeline '%s' not found!", registry.getDefaultId() ) );
+ throw new IllegalArgumentException( format( "Default pipeline '%s' not found!", registry.getDefaultId() ) );
}
pipeline.setup( System.out );
Modified: cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/csv/CSVGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/csv/CSVGenerator.java?rev=1347689&r1=1347688&r2=1347689&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/csv/CSVGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/csv/CSVGenerator.java Thu Jun 7 15:45:54 2012
@@ -429,7 +429,7 @@ public class CSVGenerator extends Abstra
private void startElement(String name, Attributes atts) throws SAXException {
if (name == null)
- throw new NullPointerException("Null name");
+ throw new IllegalArgumentException("Null name");
if (atts == null)
atts = new AttributesImpl();
String qual = NAMESPACE_PREFIX + ':' + name;
@@ -499,7 +499,7 @@ public class CSVGenerator extends Abstra
public int read(char b[], int o, int l) throws IOException {
if (b == null)
- throw new NullPointerException();
+ throw new IllegalArgumentException();
if ((o < 0) || (o > b.length) || (l < 0) || ((o + l) > b.length)
|| ((o + l) < 0)) {
throw new IndexOutOfBoundsException();
Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/InvalidCacheKey.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/InvalidCacheKey.java?rev=1347689&r1=1347688&r2=1347689&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/InvalidCacheKey.java (original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/caching/InvalidCacheKey.java Thu Jun 7 15:45:54 2012
@@ -27,7 +27,7 @@ public class InvalidCacheKey extends Abs
public InvalidCacheKey(Serializable expiresCacheKey) {
if (expiresCacheKey == null) {
- throw new NullPointerException("An explicit cache key has to be provided.");
+ throw new IllegalArgumentException("An explicit cache key has to be provided.");
}
this.expiresCacheKey = expiresCacheKey;