From 666f3a315c30738141341a4718381a730e344a96 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 26 Oct 2015 08:18:05 +0000
Subject: [PATCH] Minor code clean up: try-with-resources, etc.
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ID2Entry.java | 29 ++++++++++++++---------------
1 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ID2Entry.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ID2Entry.java
index b46ec46..7b70fb1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ID2Entry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ID2Entry.java
@@ -219,7 +219,6 @@
* @param name The name of the entry tree.
* @param dataConfig The desired compression and encryption options for data
* stored in the entry tree.
- * @param entryContainer The entryContainer of the entry tree.
* @throws StorageRuntimeException If an error occurs in the storage.
*/
ID2Entry(TreeName name, DataConfig dataConfig) throws StorageRuntimeException
@@ -364,7 +363,15 @@
public Entry get(ReadableTransaction txn, EntryID entryID)
throws DirectoryException, StorageRuntimeException
{
- return get0(entryID, txn.read(getName(), entryID.toByteString()));
+ try
+ {
+ return get0(txn.read(getName(), entryID.toByteString()));
+ }
+ catch (Exception e)
+ {
+ throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), ERR_ENTRY_DATABASE_CORRUPT.get(entryID));
+ }
+ }
}
/**
@@ -384,23 +391,15 @@
}
}
- private Entry get0(EntryID entryID, ByteString value) throws DirectoryException
+ private Entry get0(ByteString value) throws Exception
{
if (value == null)
{
return null;
}
-
- try
- {
- Entry entry = entryFromDatabase(value, dataConfig.getEntryEncodeConfig().getCompressedSchema());
- entry.processVirtualAttributes();
- return entry;
- }
- catch (Exception e)
- {
- throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), ERR_ENTRY_DATABASE_CORRUPT.get(entryID));
- }
+ final Entry entry = entryFromDatabase(value, dataConfig.getEntryEncodeConfig().getCompressedSchema());
+ entry.processVirtualAttributes();
+ return entry;
}
/**
@@ -426,7 +425,7 @@
{
try
{
- return "\n" + get0(new EntryID(-1), value).toString();
+ return "\n" + get0(value).toString();
}
catch (Exception e)
{
--
Gitblit v1.10.0