From 24a59808a15d20c81962616aebd883e43ad4f659 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 19 May 2011 09:02:00 +0000
Subject: [PATCH] Use Exception.getMessage() instead of Exception.toString() where possible in order to avoid including the Exception type in error messages.
---
opendj3/opendj-sdk/src/main/java/org/opends/sdk/schema/SchemaBuilder.java | 25 ++++++++++++++-----------
opendj3/opendj-sdk/src/main/java/org/opends/sdk/Matcher.java | 30 +++++++++++++++---------------
opendj3/opendj-sdk/src/main/java/org/opends/sdk/schema/DistinguishedNameEqualityMatchingRuleImpl.java | 4 ----
3 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/opendj3/opendj-sdk/src/main/java/org/opends/sdk/Matcher.java b/opendj3/opendj-sdk/src/main/java/org/opends/sdk/Matcher.java
index 4c9b6fb..5a4d0a9 100644
--- a/opendj3/opendj-sdk/src/main/java/org/opends/sdk/Matcher.java
+++ b/opendj3/opendj-sdk/src/main/java/org/opends/sdk/Matcher.java
@@ -346,7 +346,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("Attribute description " + attributeDescription
- + " is not recognized: " + e.toString());
+ + " is not recognized: " + e.getMessage());
}
return UNDEFINED;
}
@@ -370,7 +370,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("The assertion value " + assertionValue
- + " is invalid: " + de.toString());
+ + " is invalid: " + de.getMessage());
}
return UNDEFINED;
}
@@ -395,7 +395,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("Attribute description " + attributeDescription
- + " is not recognized: " + e.toString());
+ + " is not recognized: " + e.getMessage());
}
return UNDEFINED;
}
@@ -419,7 +419,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("The assertion value " + assertionValue
- + " is invalid: " + de.toString());
+ + " is invalid: " + de.getMessage());
}
return UNDEFINED;
}
@@ -448,7 +448,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("Matching rule " + matchingRule
- + " is not recognized: " + e.toString());
+ + " is not recognized: " + e.getMessage());
}
return UNDEFINED;
}
@@ -465,7 +465,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("Attribute description " + attributeDescription
- + " is not recognized: " + e.toString());
+ + " is not recognized: " + e.getMessage());
}
return UNDEFINED;
}
@@ -534,7 +534,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("The assertion value " + assertionValue
- + " is invalid: " + de.toString());
+ + " is invalid: " + de.getMessage());
}
return UNDEFINED;
}
@@ -560,7 +560,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("Attribute description " + attributeDescription
- + " is not recognized: " + e.toString());
+ + " is not recognized: " + e.getMessage());
}
return UNDEFINED;
}
@@ -584,7 +584,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("The assertion value " + assertionValue
- + " is invalid: " + de.toString());
+ + " is invalid: " + de.getMessage());
}
return UNDEFINED;
}
@@ -609,7 +609,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("Attribute description " + attributeDescription
- + " is not recognized: " + e.toString());
+ + " is not recognized: " + e.getMessage());
}
return UNDEFINED;
}
@@ -633,7 +633,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("The assertion value " + assertionValue
- + " is invalid: " + de.toString());
+ + " is invalid: " + de.getMessage());
}
return UNDEFINED;
}
@@ -688,7 +688,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("Attribute description " + attributeDescription
- + " is not recognized: " + e.toString());
+ + " is not recognized: " + e.getMessage());
}
return UNDEFINED;
}
@@ -715,7 +715,7 @@
if (DEBUG_LOG.isLoggable(Level.WARNING))
{
DEBUG_LOG.warning("Attribute description " + attributeDescription
- + " is not recognized: " + e.toString());
+ + " is not recognized: " + e.getMessage());
}
return UNDEFINED;
}
@@ -741,7 +741,7 @@
{
DEBUG_LOG
.warning("The substring assertion values contain an invalid value: "
- + de.toString());
+ + de.getMessage());
}
return UNDEFINED;
}
@@ -811,7 +811,7 @@
{
DEBUG_LOG.warning("The attribute value " + v.toString() + " is "
+ "invalid for matching rule " + rule.getNameOrOID()
- + ". Possible schema error? : " + de.toString());
+ + ". Possible schema error? : " + de.getMessage());
}
return ConditionResult.UNDEFINED;
}
diff --git a/opendj3/opendj-sdk/src/main/java/org/opends/sdk/schema/DistinguishedNameEqualityMatchingRuleImpl.java b/opendj3/opendj-sdk/src/main/java/org/opends/sdk/schema/DistinguishedNameEqualityMatchingRuleImpl.java
index f881d38..a4c7a8a 100644
--- a/opendj3/opendj-sdk/src/main/java/org/opends/sdk/schema/DistinguishedNameEqualityMatchingRuleImpl.java
+++ b/opendj3/opendj-sdk/src/main/java/org/opends/sdk/schema/DistinguishedNameEqualityMatchingRuleImpl.java
@@ -63,10 +63,6 @@
{
throw DecodeException.error(e.getMessageObject());
}
- catch (final Exception e)
- {
- throw DecodeException.error(LocalizableMessage.raw(e.toString()));
- }
}
/**
diff --git a/opendj3/opendj-sdk/src/main/java/org/opends/sdk/schema/SchemaBuilder.java b/opendj3/opendj-sdk/src/main/java/org/opends/sdk/schema/SchemaBuilder.java
index b83846a..fbf8078 100644
--- a/opendj3/opendj-sdk/src/main/java/org/opends/sdk/schema/SchemaBuilder.java
+++ b/opendj3/opendj-sdk/src/main/java/org/opends/sdk/schema/SchemaBuilder.java
@@ -2992,8 +2992,8 @@
catch (final SchemaException e)
{
removeSyntax(syntax);
- warnings.add(ERR_SYNTAX_VALIDATION_FAIL.get(syntax.toString(), e
- .toString()));
+ warnings.add(ERR_SYNTAX_VALIDATION_FAIL.get(
+ syntax.toString(), e.getMessageObject()));
}
}
@@ -3007,7 +3007,8 @@
catch (final SchemaException e)
{
removeMatchingRule(rule);
- warnings.add(ERR_MR_VALIDATION_FAIL.get(rule.toString(), e.toString()));
+ warnings.add(ERR_MR_VALIDATION_FAIL.get(rule.toString(),
+ e.getMessageObject()));
}
}
@@ -3022,7 +3023,7 @@
{
removeAttributeType(attribute);
warnings.add(ERR_ATTR_TYPE_VALIDATION_FAIL.get(attribute.toString(), e
- .toString()));
+ .getMessageObject()));
}
}
@@ -3036,7 +3037,8 @@
catch (final SchemaException e)
{
removeObjectClass(oc);
- warnings.add(ERR_OC_VALIDATION_FAIL.get(oc.toString(), e.toString()));
+ warnings.add(ERR_OC_VALIDATION_FAIL.get(oc.toString(),
+ e.getMessageObject()));
}
}
@@ -3051,7 +3053,8 @@
catch (final SchemaException e)
{
removeMatchingRuleUse(use);
- warnings.add(ERR_MRU_VALIDATION_FAIL.get(use.toString(), e.toString()));
+ warnings.add(ERR_MRU_VALIDATION_FAIL.get(use.toString(),
+ e.getMessageObject()));
}
}
@@ -3084,7 +3087,7 @@
{
removeNameForm(form);
warnings.add(ERR_NAMEFORM_VALIDATION_FAIL.get(form.toString(), e
- .toString()));
+ .getMessageObject()));
}
}
@@ -3098,8 +3101,8 @@
catch (final SchemaException e)
{
removeDITContentRule(rule);
- warnings
- .add(ERR_DCR_VALIDATION_FAIL.get(rule.toString(), e.toString()));
+ warnings.add(ERR_DCR_VALIDATION_FAIL.get(rule.toString(),
+ e.getMessageObject()));
}
}
@@ -3131,8 +3134,8 @@
catch (final SchemaException e)
{
removeDITStructureRule(rule);
- warnings
- .add(ERR_DSR_VALIDATION_FAIL.get(rule.toString(), e.toString()));
+ warnings.add(ERR_DSR_VALIDATION_FAIL.get(rule.toString(),
+ e.getMessageObject()));
}
}
}
--
Gitblit v1.10.0