mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

kenneth_suter
26.03.2007 8636196599847e5fa861942f382353b90eae517e
opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
@@ -768,11 +768,12 @@
  private byte[] calculateConfigDigest()
          throws DirectoryException
  {
    InputStream inputStream = null;
    try
    {
      MessageDigest sha1Digest =
           MessageDigest.getInstance(MESSAGE_DIGEST_ALGORITHM_SHA_1);
      FileInputStream inputStream = new FileInputStream(configFile);
      inputStream = new FileInputStream(configFile);
      byte[] buffer = new byte[8192];
      while (true)
      {
@@ -784,7 +785,6 @@
        sha1Digest.update(buffer, 0, bytesRead);
      }
      return sha1Digest.digest();
    }
    catch (Exception e)
@@ -795,6 +795,19 @@
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
                                   message, msgID, e);
    }
    finally
    {
      if (inputStream != null)
      {
        try
        {
          inputStream.close();
        }
        catch (IOException e) {
          // ignore;
        }
      }
    }
  }
@@ -2030,9 +2043,9 @@
    // Delete the previous version of the configuration and rename the new one.
    try
    {
      File f = new File(configFile);
      f.delete();
      new File(tempConfig).renameTo(f);
      File actualConfig = new File(configFile);
      File tmpConfig = new File(tempConfig);
      renameFile(tmpConfig, actualConfig);
    }
    catch (Exception e)
    {