Changeset 4669


Ignore:
Timestamp:
12/03/08 10:31:14 (11 years ago)
Author:
melissa
Message:

Fixed IndexOutOfBounds if objective string is set to "unknown".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/DeltavisionReader.java

    r4668 r4669  
    455455        if (key.equals("Objective")) { 
    456456          // assume first word is the manufacturer's name 
    457           String manufacturer = value.substring(0, value.indexOf(" ")); 
    458           String extra = value.substring(value.indexOf(" ") + 1); 
    459  
    460           String[] tokens = extra.split(","); 
    461  
    462           store.setObjectiveManufacturer(manufacturer, 0, 0); 
    463  
    464           String magnification = tokens[0].substring(0, tokens[0].indexOf("X")); 
    465           String na = tokens[0].substring(tokens[0].indexOf("/") + 1); 
    466  
    467           store.setObjectiveNominalMagnification(new Integer(magnification), 
    468             0, 0); 
    469           store.setObjectiveLensNA(new Float(na), 0, 0); 
    470           store.setObjectiveCorrection(tokens[1], 0, 0); 
    471           // TODO:  Token #2 is the microscope model name. 
    472           if (tokens.length > 3) store.setObjectiveModel(tokens[3], 0, 0); 
     457          int space = value.indexOf(" "); 
     458          if (space != -1) { 
     459            String manufacturer = value.substring(0, space); 
     460            String extra = value.substring(space + 1); 
     461 
     462            String[] tokens = extra.split(","); 
     463 
     464            store.setObjectiveManufacturer(manufacturer, 0, 0); 
     465 
     466            String magnification = 
     467              tokens[0].substring(0, tokens[0].indexOf("X")); 
     468            String na = tokens[0].substring(tokens[0].indexOf("/") + 1); 
     469 
     470            store.setObjectiveNominalMagnification(new Integer(magnification), 
     471              0, 0); 
     472            store.setObjectiveLensNA(new Float(na), 0, 0); 
     473            store.setObjectiveCorrection(tokens[1], 0, 0); 
     474            // TODO:  Token #2 is the microscope model name. 
     475            if (tokens.length > 3) store.setObjectiveModel(tokens[3], 0, 0); 
     476          } 
    473477        } 
    474478        else if (key.equals("Lens ID")) { 
Note: See TracChangeset for help on using the changeset viewer.