Save some object creations in the ldap parser
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@555615 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/util/ldap/Parser.java b/framework/src/main/java/org/apache/felix/framework/util/ldap/Parser.java
index 46151d0..335d604 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/ldap/Parser.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/ldap/Parser.java
@@ -1075,7 +1075,7 @@
}
}
- operands.push((result) ? Boolean.TRUE : Boolean.FALSE);
+ operands.push(result ? Boolean.TRUE : Boolean.FALSE);
}
else
{
@@ -1292,16 +1292,16 @@
}
// Determine class of LHS.
- Class lhsClass = null;
+ Class lhsClass = lhs.getClass();
// If LHS is an array, then call compare() on each element
// of the array until a match is found.
- if (lhs.getClass().isArray())
+ if (lhsClass.isArray())
{
// First, if this is an array of primitives, then convert
// the entire array to an array of the associated
// primitive wrapper class instances.
- if (lhs.getClass().getComponentType().isPrimitive())
+ if (lhsClass.getComponentType().isPrimitive())
{
lhs = convertPrimitiveArray(lhs);
}
@@ -1330,9 +1330,6 @@
}
else
{
- // Get the class of LHS.
- lhsClass = lhs.getClass();
-
// At this point we are expecting the LHS to be a comparable,
// but Boolean is a special case since it is the only primitive
// wrapper class that does not implement comparable; deal with
@@ -1349,7 +1346,7 @@
try
{
Object rhsObject = lhsClass
- .getConstructor(new Class[] { String.class })
+ .getConstructor(STRING_CLASS)
.newInstance(new Object[] { rhs });
return lhs.equals(rhsObject);
}