Skip to content

Commit b106dee

Browse files
committed
Document and cleanup throws clauses.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@1439976 13f79535-47bb-0310-9956-ffa450edef68
1 parent b445290 commit b106dee

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class TypeHandler
4242
* @param obj the type of argument
4343
* @return The instance of <code>obj</code> initialised with
4444
* the value of <code>str</code>.
45+
* @throws ParseException if the value creation for the given object type failed
4546
*/
4647
public static Object createValue(String str, Object obj) throws ParseException
4748
{
@@ -56,6 +57,7 @@ public static Object createValue(String str, Object obj) throws ParseException
5657
* @param clazz the type of argument
5758
* @return The instance of <code>clazz</code> initialised with
5859
* the value of <code>str</code>.
60+
* @throws ParseException if the value creation for the given class failed
5961
*/
6062
public static Object createValue(String str, Class clazz) throws ParseException
6163
{
@@ -105,8 +107,8 @@ else if (PatternOptionBuilder.URL_VALUE == clazz)
105107
* Create an Object from the classname and empty constructor.
106108
*
107109
* @param classname the argument value
108-
* @return the initialised object, or null if it couldn't create
109-
* the Object.
110+
* @return the initialised object
111+
* @throws ParseException if the class could not be found or the object could not be created
110112
*/
111113
public static Object createObject(String classname) throws ParseException
112114
{
@@ -136,8 +138,8 @@ public static Object createObject(String classname) throws ParseException
136138
* Double, otherwise a Long.
137139
*
138140
* @param str the value
139-
* @return the number represented by <code>str</code>, if <code>str</code>
140-
* is not a number, null is returned.
141+
* @return the number represented by <code>str</code>
142+
* @throws ParseException if <code>str</code> is not a number
141143
*/
142144
public static Number createNumber(String str) throws ParseException
143145
{
@@ -162,7 +164,8 @@ public static Number createNumber(String str) throws ParseException
162164
* Returns the class whose name is <code>classname</code>.
163165
*
164166
* @param classname the class name
165-
* @return The class if it is found, otherwise return null
167+
* @return The class if it is found
168+
* @throws ParseException if the class could not be found
166169
*/
167170
public static Class createClass(String classname) throws ParseException
168171
{
@@ -187,7 +190,7 @@ public static Class createClass(String classname) throws ParseException
187190
* otherwise return null.
188191
* @throws UnsupportedOperationException always
189192
*/
190-
public static Date createDate(String str) throws ParseException
193+
public static Date createDate(String str)
191194
{
192195
throw new UnsupportedOperationException("Not yet implemented");
193196
}
@@ -196,8 +199,8 @@ public static Date createDate(String str) throws ParseException
196199
* Returns the URL represented by <code>str</code>.
197200
*
198201
* @param str the URL string
199-
* @return The URL is <code>str</code> is well-formed, otherwise
200-
* return null.
202+
* @return The URL in <code>str</code> is well-formed
203+
* @throws ParseException if the URL in <code>str</code> is not well-formed
201204
*/
202205
public static URL createURL(String str) throws ParseException
203206
{
@@ -217,7 +220,7 @@ public static URL createURL(String str) throws ParseException
217220
* @param str the File location
218221
* @return The file represented by <code>str</code>.
219222
*/
220-
public static File createFile(String str) throws ParseException
223+
public static File createFile(String str)
221224
{
222225
return new File(str);
223226
}
@@ -232,7 +235,7 @@ public static File createFile(String str) throws ParseException
232235
* @return The File[] represented by <code>str</code>.
233236
* @throws UnsupportedOperationException always
234237
*/
235-
public static File[] createFiles(String str) throws ParseException
238+
public static File[] createFiles(String str)
236239
{
237240
// to implement/port:
238241
// return FileW.findFiles(str);

0 commit comments

Comments
 (0)