Ignore:
Timestamp:
06/07/13 16:27:45 (11 years ago)
Author:
davidb
Message:

When adding in support for a third attribute for an arrow head (nibb thickness) the 'extra parameter' mechnanism was found to be faulty. The 3rd param for arrow head was not seen as it's strongly type value, but treated as an extra param of type string. This code change is to more carefully test for when there is evidence of extra parameters supplied to an action/agent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Actions.java

    r463 r479  
    510510                                        String[] paramStrings = parameters.split("\\s+");
    511511                                        /**
    512                                          * Any extra parametres will be treated as the rest of the
     512                                         * Any extra parameters will be treated as the rest of the
    513513                                         * string if the last param is a string
    514514                                         */
    515                                         if (paramCount > paramStrings.length)
     515                                        if (paramCount > paramStrings.length) {
    516516                                                continue;
     517                                        }
     518                                       
    517519                                        /**
    518                                          * If there are extra parametres the last param must be a
     520                                         * If there are extra parameters the last param must be a
    519521                                         * String
    520522                                         */
    521523                                        int lastParam = paramTypes.length - 1;
    522524
    523                                         if (paramCount < paramStrings.length
    524                                                         && !paramTypes[lastParam].equals(String.class))
     525                                        if (paramCount < paramStrings.length && !paramTypes[lastParam].equals(String.class)) {
    525526                                                continue;
     527                                        }
     528                                       
    526529                                        try {
    527530                                                for (int i = 0; i < paramCount; i++) {
     
    553556                                                        }
    554557                                                }
    555                                         } catch (Exception e) {
     558                                        }
     559                                        catch (Exception e) {
    556560                                                continue;
    557561                                        }
    558                                         /** Append extra params on the end of the last string param */
    559                                         String s = params[lastParam].toString();
    560                                         for (int i = paramCount; i < paramStrings.length; i++) {
    561                                                 s += ' ' + paramStrings[i];
     562                                       
     563
     564                                        if (paramCount < paramStrings.length) {
     565                                                       
     566                                                /** Append extra params on the end of the last string param */
     567                                                String s = params[lastParam].toString();
     568                                                for (int i = paramCount; i < paramStrings.length; i++) {
     569                                                        s += ' ' + paramStrings[i];
     570                                                }
     571                                                params[lastParam] = s;
    562572                                        }
    563                                         params[lastParam] = s;
    564 
     573                                       
    565574                                        con = c;
    566575                                        break;
     
    587596                                        + "' is not an action or agent.");
    588597                }
     598        }
     599
     600       
     601        public static void LaunchAgent(String name, String parameters,Frame source) throws Exception
     602        {
     603                LaunchAgent(name,parameters,source,null);
    589604        }
    590605
Note: See TracChangeset for help on using the changeset viewer.