Changeset 2141 for trunk/java-client


Ignore:
Timestamp:
2001-03-09T11:49:24+13:00 (23 years ago)
Author:
say1
Message:

bug fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/java-client/org/nzdl/gsdl/util/NzdlIORs.java

    r2140 r2141  
    142142    }
    143143      } catch (ClassNotFoundException exception) {
    144     System.err.println("Error locking class:" + exception);
    145       }
    146      
    147      
     144    System.err.println("Exception locking class:" + exception);
     145      }
     146     
     147     
     148      try {
    148149      File file = new File(propertiesFileName);
    149       try {
    150150    if (file.exists()) {
    151151      knownIORs.load(new FileInputStream(file));
    152152    }
    153153      } catch (IOException exception) {
    154     System.err.println("Error reading properties file:" + exception);
     154    System.err.println("Exception reading properties file:" + exception);
    155155      }
    156156    }
     
    254254    }
    255255      } catch (ClassNotFoundException exception) {
    256     System.err.println("Error locking class:" + exception);
     256    System.err.println("Exception locking class:" + exception);
    257257      }
    258258      checkSave();
     
    269269  {
    270270    checkLoaded();   
    271     synchronized (knownIORs) {
    272       knownIORs.put(str,"");
    273     }
     271    if (str != null)
     272      synchronized (knownIORs) {
     273    knownIORs.put(str,"");
     274      }
    274275    checkSave();
    275276    return str;
     
    295296      ior = dhis.readLine();
    296297
    297       synchronized (knownIORs) {
    298     knownIORs.put(ior,"");
    299       }     
     298      if (ior != null)
     299    synchronized (knownIORs) {
     300      knownIORs.put(ior,"");
     301    }     
    300302      checkSave();
    301303      return ior;
     
    326328      System.err.println("Error reading IOR file:\n" + e);
    327329    }
    328     synchronized (knownIORs) {
    329       knownIORs.put(ior,"");
    330     }
     330    if (ior != null)
     331      synchronized (knownIORs) {
     332    knownIORs.put(ior,"");
     333      }
    331334    checkSave();
    332335    return ior;
     
    343346  public static void  writeToFile(String file) {
    344347    checkLoaded();
    345     synchronized (knownIORs) {
    346       String ior = null;
    347       file = file.trim();
    348       try  {
    349     BufferedWriter output
    350       = new BufferedWriter(new FileWriter(file));
    351     Enumeration e = knownIORs.keys();
    352     while (e.hasMoreElements()) {
    353       String IOR = (String) e.nextElement();
    354       output.write(IOR);
    355       output.newLine();
    356     }
    357       } catch (java.io.IOException e) {
    358     System.err.println("Error reading IOR file:\n" + e);
    359       }
    360     }
     348    if (file != null)
     349      synchronized (knownIORs) {
     350    String ior = null;
     351    file = file.trim();
     352    try  {
     353      BufferedWriter output
     354        = new BufferedWriter(new FileWriter(file));
     355      Enumeration e = knownIORs.keys();
     356      while (e.hasMoreElements()) {
     357        String IOR = (String) e.nextElement();
     358        output.write(IOR);
     359        output.newLine();
     360      }
     361    } catch (java.io.IOException e) {
     362      System.err.println("Error reading IOR file:\n" + e);
     363    }
     364      }
    361365  }   // end of getIorKey
    362 
     366 
    363367
    364368  /**
Note: See TracChangeset for help on using the changeset viewer.