@@ -44,6 +44,7 @@ public class TypeHandler
4444 * the value of <code>str</code>.
4545 */
4646 public static Object createValue (String str , Object obj )
47+ throws ParseException
4748 {
4849 return createValue (str , (Class ) obj );
4950 }
@@ -58,6 +59,7 @@ public static Object createValue(String str, Object obj)
5859 * the value of <code>str</code>.
5960 */
6061 public static Object createValue (String str , Class clazz )
62+ throws ParseException
6163 {
6264 if (PatternOptionBuilder .STRING_VALUE == clazz )
6365 {
@@ -109,6 +111,7 @@ else if (PatternOptionBuilder.URL_VALUE == clazz)
109111 * the Object.
110112 */
111113 public static Object createObject (String classname )
114+ throws ParseException
112115 {
113116 Class cl = null ;
114117
@@ -118,9 +121,7 @@ public static Object createObject(String classname)
118121 }
119122 catch (ClassNotFoundException cnfe )
120123 {
121- System .err .println ("Unable to find the class: " + classname );
122-
123- return null ;
124+ throw new ParseException ("Unable to find the class: " + classname );
124125 }
125126
126127 Object instance = null ;
@@ -131,7 +132,7 @@ public static Object createObject(String classname)
131132 }
132133 catch (Exception e )
133134 {
134- System . err . println (e .getClass ().getName () + "; Unable to create an instance of: " + classname );
135+ throw new ParseException (e .getClass ().getName () + "; Unable to create an instance of: " + classname );
135136 }
136137
137138 return instance ;
@@ -146,6 +147,7 @@ public static Object createObject(String classname)
146147 * is not a number, null is returned.
147148 */
148149 public static Number createNumber (String str )
150+ throws ParseException
149151 {
150152 try
151153 {
@@ -160,10 +162,8 @@ public static Number createNumber(String str)
160162 }
161163 catch (NumberFormatException e )
162164 {
163- System . err . println (e .getMessage ());
165+ throw new ParseException (e .getMessage ());
164166 }
165-
166- return null ;
167167 }
168168
169169 /**
@@ -173,16 +173,15 @@ public static Number createNumber(String str)
173173 * @return The class if it is found, otherwise return null
174174 */
175175 public static Class createClass (String classname )
176+ throws ParseException
176177 {
177178 try
178179 {
179180 return Class .forName (classname );
180181 }
181182 catch (ClassNotFoundException e )
182183 {
183- System .err .println ("Unable to find the class: " + classname );
184-
185- return null ;
184+ throw new ParseException ("Unable to find the class: " + classname );
186185 }
187186 }
188187
@@ -194,6 +193,7 @@ public static Class createClass(String classname)
194193 * otherwise return null.
195194 */
196195 public static Date createDate (String str )
196+ throws ParseException
197197 {
198198 throw new UnsupportedOperationException ("Not yet implemented" );
199199 }
@@ -206,16 +206,15 @@ public static Date createDate(String str)
206206 * return null.
207207 */
208208 public static URL createURL (String str )
209+ throws ParseException
209210 {
210211 try
211212 {
212213 return new URL (str );
213214 }
214215 catch (MalformedURLException e )
215216 {
216- System .err .println ("Unable to parse the URL: " + str );
217-
218- return null ;
217+ throw new ParseException ("Unable to parse the URL: " + str );
219218 }
220219 }
221220
@@ -226,6 +225,7 @@ public static URL createURL(String str)
226225 * @return The file represented by <code>str</code>.
227226 */
228227 public static File createFile (String str )
228+ throws ParseException
229229 {
230230 return new File (str );
231231 }
@@ -237,6 +237,7 @@ public static File createFile(String str)
237237 * @return The File[] represented by <code>str</code>.
238238 */
239239 public static File [] createFiles (String str )
240+ throws ParseException
240241 {
241242 // to implement/port:
242243 // return FileW.findFiles(str);
0 commit comments