Author: ebourg
Date: Sun Sep 14 08:29:32 2008
New Revision: 695236
URL: http://svn.apache.org/viewvc?rev=695236&view=rev
Log:
Slightly improved error message for classes not found
Modified:
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/TypeHandler.java
Modified:
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/TypeHandler.java
URL:
http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/TypeHandler.java?rev=695236&r1=695235&r2=695236&view=diff
==============================================================================
---
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/TypeHandler.java
(original)
+++
commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/TypeHandler.java
Sun Sep 14 08:29:32 2008
@@ -105,21 +105,21 @@
/**
* Create an Object from the classname and empty constructor.
*
- * @param str the argument value
+ * @param classname the argument value
* @return the initialised object, or null if it couldn't create
* the Object.
*/
- public static Object createObject(String str)
+ public static Object createObject(String classname)
{
Class cl = null;
try
{
- cl = Class.forName(str);
+ cl = Class.forName(classname);
}
catch (ClassNotFoundException cnfe)
{
- System.err.println("Unable to find the class: " + str);
+ System.err.println("Unable to find the class: " + classname);
return null;
}
@@ -132,7 +132,7 @@
}
catch (Exception e)
{
- System.err.println(e.getClass().getName() + "; Unable to create an
instance of: " + str);
+ System.err.println(e.getClass().getName() + "; Unable to create an
instance of: " + classname);
}
return instance;
@@ -159,29 +159,29 @@
return Long.valueOf(str);
}
}
- catch (NumberFormatException nfe)
+ catch (NumberFormatException e)
{
- System.err.println(nfe.getMessage());
+ System.err.println(e.getMessage());
}
return null;
}
/**
- * Returns the class whose name is <code>str</code>.
+ * Returns the class whose name is <code>classname</code>.
*
- * @param str the class name
+ * @param classname the class name
* @return The class if it is found, otherwise return null
*/
- public static Class createClass(String str)
+ public static Class createClass(String classname)
{
try
{
- return Class.forName(str);
+ return Class.forName(classname);
}
- catch (ClassNotFoundException cnfe)
+ catch (ClassNotFoundException e)
{
- System.err.println("Unable to find: " + str);
+ System.err.println("Unable to find the class: " + classname);
return null;
}