Changeset 6308


Ignore:
Timestamp:
05/13/10 13:04:16 (10 years ago)
Author:
curtis
Message:

Add fake filename parameter checks.

File:
1 edited

Legend:

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

    r6305 r6308  
    3434import loci.formats.MetadataTools; 
    3535import loci.formats.meta.MetadataStore; 
     36 
     37import ome.xml.r201004.enums.DimensionOrder; 
     38import ome.xml.r201004.enums.EnumerationException; 
    3639 
    3740/** 
     
    234237    } 
    235238 
     239    // do some sanity checks 
     240    if (sizeX < 1) throw new FormatException("Invalid sizeX: " + sizeX); 
     241    if (sizeY < 1) throw new FormatException("Invalid sizeY: " + sizeY); 
     242    if (sizeZ < 1) throw new FormatException("Invalid sizeZ: " + sizeZ); 
     243    if (sizeC < 1) throw new FormatException("Invalid sizeC: " + sizeC); 
     244    if (sizeT < 1) throw new FormatException("Invalid sizeT: " + sizeT); 
     245    if (thumbSizeX < 0) { 
     246      throw new FormatException("Invalid thumbSizeX: " + thumbSizeX); 
     247    } 
     248    if (thumbSizeY < 0) { 
     249      throw new FormatException("Invalid thumbSizeY: " + thumbSizeY); 
     250    } 
     251    if (rgb < 1 || rgb > sizeC || sizeC % rgb != 0) { 
     252      throw new FormatException("Invalid sizeC/rgb combination: " + 
     253        sizeC + "/" + rgb); 
     254    } 
     255    try { 
     256      DimensionOrder.fromString(dimOrder); 
     257    } 
     258    catch (EnumerationException exc) { 
     259      throw new FormatException("Invalid dimOrder: " + dimOrder, exc); 
     260    } 
     261    if (falseColor && !indexed) { 
     262      throw new FormatException("False color images must be indexed"); 
     263    } 
     264    if (seriesCount < 1) { 
     265      throw new FormatException("Invalid seriesCount: " + seriesCount); 
     266    } 
     267 
    236268    // populate core metadata 
    237269    int effSizeC = sizeC / rgb; 
Note: See TracChangeset for help on using the changeset viewer.