Changeset 6367


Ignore:
Timestamp:
05/24/10 11:57:48 (9 years ago)
Author:
melissa
Message:

Prevent StringIndexOutOfBoundsException.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2/components/bio-formats/src/loci/formats/in/MetamorphReader.java

    r6358 r6367  
    297297 
    298298      for (String line : lines) { 
    299         String key = line.substring(1, line.indexOf(",") - 1).trim(); 
    300         String value = line.substring(line.indexOf(",") + 1).trim(); 
     299        int comma = line.indexOf(","); 
     300        if (comma <= 0) continue; 
     301        String key = line.substring(1, comma - 1).trim(); 
     302        String value = line.substring(comma + 1).trim(); 
    301303 
    302304        addGlobalMeta(key, value); 
  • trunk/components/bio-formats/src/loci/formats/in/MetamorphReader.java

    r6358 r6367  
    297297 
    298298      for (String line : lines) { 
    299         String key = line.substring(1, line.indexOf(",") - 1).trim(); 
    300         String value = line.substring(line.indexOf(",") + 1).trim(); 
     299        int comma = line.indexOf(","); 
     300        if (comma <= 0) continue; 
     301        String key = line.substring(1, comma - 1).trim(); 
     302        String value = line.substring(comma + 1).trim(); 
    301303 
    302304        addGlobalMeta(key, value); 
Note: See TracChangeset for help on using the changeset viewer.