Changeset 86 for trunk/src/org/expeditee/actions/Actions.java
- Timestamp:
- 06/05/08 10:11:18 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Actions.java
r80 r86 46 46 public class Actions { 47 47 48 private static final String INVALID_PARAMETERS_ERROR = "Invalid parameters for agent: "; //$NON-NLS-1$ 49 48 50 // the currently running agent (if there is one) 49 51 private static Agent _Agent = null; … … 164 166 * Clears out the Action and JAG Hashtables and refills them. Normally this 165 167 * is only called once when the system starts. 166 * @return a warning message if there were any problems loading agents or actions. 168 * 169 * @return a warning message if there were any problems loading agents or 170 * actions. 167 171 */ 168 172 public static Collection<String> Init() { 169 173 Collection<String> warnings = new LinkedList<String>(); 170 174 Class[] classes; 171 175 172 176 try { 173 177 classes = getClasses(AGENTS_PACKAGE); … … 327 331 328 332 for (Method possible : possibles) { 329 330 333 // try first with the launching item as a parameter 331 334 … … 346 349 e.printStackTrace(); 347 350 } 351 } 352 if (possibles.size() > 0) { 353 FrameGraphics.ErrorMessage("Incorrect parameters for " + mname); 354 } else { 355 assert(false); 356 FrameGraphics.ErrorMessage(mname + " action not found"); 348 357 } 349 358 } … … 386 395 // get the constructor for the JAG class 387 396 Constructor con = null; 388 Constructor constructors[]= agentClass.getConstructors();397 Constructor[] constructors = agentClass.getConstructors(); 389 398 Object[] params = null; 390 399 … … 397 406 params[0] = parameters; 398 407 break; 399 } else if (c.getParameterTypes().length == 0 && con == null) 408 } else if (c.getParameterTypes().length == 0 && con == null) { 400 409 con = c; 410 } 401 411 } 402 412 403 413 // if there is no constructor, return 404 414 if (con == null) { 405 FrameGraphics.DisplayMessage( "Invalid parametres for agent: "415 FrameGraphics.DisplayMessage(INVALID_PARAMETERS_ERROR 406 416 + nameWithCorrectCase); 407 417 // System.out.println("Constructor not found..."); … … 433 443 434 444 } catch (ClassNotFoundException cnf) { 435 FrameGraphics.ErrorMessage( "Error: '" +nameWithCorrectCase445 FrameGraphics.ErrorMessage(nameWithCorrectCase 436 446 + "' is not an action or agent."); 437 447 } catch (Exception e) { … … 540 550 } 541 551 // convert the value to an object 542 Object o = Conversion.Convert(paramTypes[ind], param); 543 if (o == null) 552 try { 553 Object o = Conversion.Convert(paramTypes[ind], param); 554 if (o == null) 555 return null; 556 objects[ind] = o; 557 } catch (Exception e) { 544 558 return null; 545 objects[ind] = o;559 } 546 560 } 547 561
Note:
See TracChangeset
for help on using the changeset viewer.