Skip to content

Commit 363f8ab

Browse files
committed
Slightly improved error message for classes not found
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/branches/cli-1.x@695236 13f79535-47bb-0310-9956-ffa450edef68
1 parent d66d5cb commit 363f8ab

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/java/org/apache/commons/cli/TypeHandler.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,21 @@ else if (PatternOptionBuilder.URL_VALUE == clazz)
105105
/**
106106
* Create an Object from the classname and empty constructor.
107107
*
108-
* @param str the argument value
108+
* @param classname the argument value
109109
* @return the initialised object, or null if it couldn't create
110110
* the Object.
111111
*/
112-
public static Object createObject(String str)
112+
public static Object createObject(String classname)
113113
{
114114
Class cl = null;
115115

116116
try
117117
{
118-
cl = Class.forName(str);
118+
cl = Class.forName(classname);
119119
}
120120
catch (ClassNotFoundException cnfe)
121121
{
122-
System.err.println("Unable to find the class: " + str);
122+
System.err.println("Unable to find the class: " + classname);
123123

124124
return null;
125125
}
@@ -132,7 +132,7 @@ public static Object createObject(String str)
132132
}
133133
catch (Exception e)
134134
{
135-
System.err.println(e.getClass().getName() + "; Unable to create an instance of: " + str);
135+
System.err.println(e.getClass().getName() + "; Unable to create an instance of: " + classname);
136136
}
137137

138138
return instance;
@@ -159,29 +159,29 @@ public static Number createNumber(String str)
159159
return Long.valueOf(str);
160160
}
161161
}
162-
catch (NumberFormatException nfe)
162+
catch (NumberFormatException e)
163163
{
164-
System.err.println(nfe.getMessage());
164+
System.err.println(e.getMessage());
165165
}
166166

167167
return null;
168168
}
169169

170170
/**
171-
* Returns the class whose name is <code>str</code>.
171+
* Returns the class whose name is <code>classname</code>.
172172
*
173-
* @param str the class name
173+
* @param classname the class name
174174
* @return The class if it is found, otherwise return null
175175
*/
176-
public static Class createClass(String str)
176+
public static Class createClass(String classname)
177177
{
178178
try
179179
{
180-
return Class.forName(str);
180+
return Class.forName(classname);
181181
}
182-
catch (ClassNotFoundException cnfe)
182+
catch (ClassNotFoundException e)
183183
{
184-
System.err.println("Unable to find: " + str);
184+
System.err.println("Unable to find the class: " + classname);
185185

186186
return null;
187187
}

0 commit comments

Comments
 (0)