Changeset 6716


Ignore:
Timestamp:
07/20/10 14:51:16 (9 years ago)
Author:
curtis
Message:

More fixes to LWF license code handling.

Location:
trunk/components
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/services/LuraWaveServiceImpl.java

    r6602 r6716  
    7575   */ 
    7676  public LuraWaveServiceImpl() throws DependencyException { 
    77     license = System.getProperty(LICENSE_PROPERTY); 
    7877    checkClassDependency(com.luratech.lwf.lwfDecoder.class); 
    7978    try { 
     
    105104  public void initialize(InputStream stream) 
    106105    throws IOException, DependencyException, ServiceException { 
    107     if (license == null) { 
    108       throw new DependencyException(NO_LICENSE_MSG); 
    109     } 
     106    initLicense(); 
    110107    try { 
    111108      delegate = new lwfDecoder(stream, null, license); 
     
    160157  } 
    161158 
     159  private void initLicense() throws DependencyException { 
     160    if (license != null) return; // license already initialized 
     161    license = System.getProperty(LICENSE_PROPERTY); 
     162    if (license == null) throw new DependencyException(NO_LICENSE_MSG); 
     163  } 
     164 
    162165} 
  • trunk/components/loci-plugins/src/loci/plugins/in/ImagePlusReader.java

    r6714 r6716  
    376376 
    377377    boolean first = true; 
    378     for (int i=0; i<LuraWave.MAX_ATTEMPTS; i++) { 
     378    for (int i=0; i<LuraWave.MAX_TRIES; i++) { 
    379379      String code = LuraWave.initLicenseCode(); 
    380380      try { 
     
    391391      } 
    392392    } 
    393     throw new FormatException(LuraWave.TOO_MANY_ATTEMPTS); 
     393    throw new FormatException(LuraWave.TOO_MANY_TRIES); 
    394394  } 
    395395 
  • trunk/components/loci-plugins/src/loci/plugins/in/ImportProcess.java

    r6714 r6716  
    605605  private void setId() throws FormatException, IOException { 
    606606    boolean first = true; 
    607     for (int i=0; i<LuraWave.MAX_ATTEMPTS; i++) { 
     607    for (int i=0; i<LuraWave.MAX_TRIES; i++) { 
    608608      String code = LuraWave.initLicenseCode(); 
    609609      try { 
     
    619619        if (code == null) throw exc; 
    620620        if (first) first = false; 
    621       } 
    622     } 
    623     throw new FormatException(LuraWave.TOO_MANY_ATTEMPTS); 
     621        reader.close(); 
     622      } 
     623    } 
     624    throw new FormatException(LuraWave.TOO_MANY_TRIES); 
    624625  } 
    625626 
  • trunk/components/loci-plugins/src/loci/plugins/util/LuraWave.java

    r6714 r6716  
    4242  // -- Constants -- 
    4343 
    44   public static final int MAX_ATTEMPTS = 5; 
    45   public static final String TOO_MANY_ATTEMPTS = 
     44  public static final int MAX_TRIES = 5; 
     45  public static final String TOO_MANY_TRIES = 
    4646    "Too many LuraWave license code attempts; giving up."; 
    4747 
Note: See TracChangeset for help on using the changeset viewer.