Skip to content

Commit

Permalink
Fixed an ArrayIndexOutOfBoundsException
Browse files Browse the repository at this point in the history
  • Loading branch information
KlasJoensson committed Sep 4, 2012
1 parent 5bb7917 commit d7a5785
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Expand Up @@ -109,13 +109,13 @@ public void start(BundleContext context) throws Exception {
//This way we have the list openToxServices synced with the prefs
// List<String[]> toPrefs = new ArrayList<String[]>();
for (OpenToxService eps : epservices){
String[] entry = new String[3];
entry[0]=eps.getName();
entry[1]=eps.getService();
entry[2]=eps.getServiceSPARQL();
if (!listContains( toPrefs, entry ))
toPrefs.add(entry);
String[] entry = new String[3];
entry[0]=eps.getName();
entry[1]=eps.getService();
entry[2]=eps.getServiceSPARQL();

if (!listContains( toPrefs, entry ))
toPrefs.add(entry);
}

String toPrefsString = ServicesPreferencePage.convertToPreferenceString(toPrefs);
Expand Down
Expand Up @@ -210,7 +210,16 @@ public void mouseUp(MouseEvent e) {
}

String[] chosen = (String[]) obj;

/* TODO Fix this in a better way. Without the if-statement below
* we'll get an unexpected ArrayIndexOutOfBoundsException in
* some cases, 'cos the last element is missing in the selection */
if (chosen.length < 3) {
String[] temp = {"NA", "NA", "NA"};
for (int i = 0; i < chosen.length; i++)
temp[i] = chosen[i];
chosen = temp;
}

ServicesEditDialog dlg=new ServicesEditDialog(getShell(), chosen[0], chosen[1], chosen[2]);

dlg.open();
Expand Down

0 comments on commit d7a5785

Please sign in to comment.