From 75a1355c310f68cf93ab91a14e1f9cc8bf726cd6 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Sun, 08 Oct 2006 23:35:31 +0000
Subject: [PATCH] Update the LDAPCompare tool to fail with an appropriate error message if the assertion value is to be read from a file but that file does not exist or is not readable.
---
opends/src/server/org/opends/server/tools/LDAPCompare.java | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/LDAPCompare.java b/opends/src/server/org/opends/server/tools/LDAPCompare.java
index 709ac39..4973675 100644
--- a/opends/src/server/org/opends/server/tools/LDAPCompare.java
+++ b/opends/src/server/org/opends/server/tools/LDAPCompare.java
@@ -545,8 +545,17 @@
}
} else if(nextChar == '<')
{
- String filePath = remainder.substring(1, remainder.length());
- attributeVal = LDAPToolUtils.readBytesFromFile(filePath);
+ try
+ {
+ String filePath = remainder.substring(1, remainder.length());
+ attributeVal = LDAPToolUtils.readBytesFromFile(filePath);
+ }
+ catch (Exception e)
+ {
+ int msgID = MSGID_COMPARE_CANNOT_READ_ASSERTION_VALUE_FROM_FILE;
+ err.println(getMessage(msgID, String.valueOf(e)));
+ return 1;
+ }
} else
{
attributeVal = remainder.getBytes();
--
Gitblit v1.10.0