diff --git a/src/java/org/apache/poi/ss/formula/eval/BoolEval.java b/src/java/org/apache/poi/ss/formula/eval/BoolEval.java
index cab4105d0..77a25a361 100644
--- a/src/java/org/apache/poi/ss/formula/eval/BoolEval.java
+++ b/src/java/org/apache/poi/ss/formula/eval/BoolEval.java
@@ -34,7 +34,7 @@ public final class BoolEval implements NumericValueEval, StringValueEval {
*
* @return the BoolEval instance representing b.
*/
- public static final BoolEval valueOf(boolean b) {
+ public static BoolEval valueOf(boolean b) {
return b ? TRUE : FALSE;
}
@@ -55,10 +55,8 @@ public final class BoolEval implements NumericValueEval, StringValueEval {
}
public String toString() {
- StringBuilder sb = new StringBuilder(64);
- sb.append(getClass().getName()).append(" [");
- sb.append(getStringValue());
- sb.append("]");
- return sb.toString();
+ return getClass().getName() + " [" +
+ getStringValue() +
+ "]";
}
}
diff --git a/src/java/org/apache/poi/ss/formula/eval/ErrorEval.java b/src/java/org/apache/poi/ss/formula/eval/ErrorEval.java
index 8e119ea03..e9c228975 100644
--- a/src/java/org/apache/poi/ss/formula/eval/ErrorEval.java
+++ b/src/java/org/apache/poi/ss/formula/eval/ErrorEval.java
@@ -51,7 +51,8 @@ public final class ErrorEval implements ValueEval {
/**
* Translates an Excel internal error code into the corresponding POI ErrorEval instance
- * @param errorCode
+ * @param errorCode An error code listed in {@link FormulaError}
+ * @throws RuntimeException If an unknown errorCode is specified
*/
public static ErrorEval valueOf(int errorCode) {
FormulaError error = FormulaError.forInt(errorCode);
@@ -89,10 +90,8 @@ public final class ErrorEval implements ValueEval {
return _error.getString();
}
public String toString() {
- StringBuffer sb = new StringBuffer(64);
- sb.append(getClass().getName()).append(" [");
- sb.append(_error.getString());
- sb.append("]");
- return sb.toString();
+ return getClass().getName() + " [" +
+ _error.getString() +
+ "]";
}
}
diff --git a/src/java/org/apache/poi/ss/formula/eval/ExternalNameEval.java b/src/java/org/apache/poi/ss/formula/eval/ExternalNameEval.java
index f65a3f83d..cd813fb96 100644
--- a/src/java/org/apache/poi/ss/formula/eval/ExternalNameEval.java
+++ b/src/java/org/apache/poi/ss/formula/eval/ExternalNameEval.java
@@ -34,10 +34,8 @@ public final class ExternalNameEval implements ValueEval {
}
public String toString() {
- StringBuffer sb = new StringBuffer(64);
- sb.append(getClass().getName()).append(" [");
- sb.append(_name.getNameText());
- sb.append("]");
- return sb.toString();
+ return getClass().getName() + " [" +
+ _name.getNameText() +
+ "]";
}
}
diff --git a/src/java/org/apache/poi/ss/formula/eval/FunctionNameEval.java b/src/java/org/apache/poi/ss/formula/eval/FunctionNameEval.java
index 8a9e48042..82e029639 100644
--- a/src/java/org/apache/poi/ss/formula/eval/FunctionNameEval.java
+++ b/src/java/org/apache/poi/ss/formula/eval/FunctionNameEval.java
@@ -37,10 +37,8 @@ public final class FunctionNameEval implements ValueEval {
}
public String toString() {
- StringBuffer sb = new StringBuffer(64);
- sb.append(getClass().getName()).append(" [");
- sb.append(_functionName);
- sb.append("]");
- return sb.toString();
+ return getClass().getName() + " [" +
+ _functionName +
+ "]";
}
}
diff --git a/src/java/org/apache/poi/ss/formula/eval/StringEval.java b/src/java/org/apache/poi/ss/formula/eval/StringEval.java
index 5d3976137..0e35e9dea 100644
--- a/src/java/org/apache/poi/ss/formula/eval/StringEval.java
+++ b/src/java/org/apache/poi/ss/formula/eval/StringEval.java
@@ -45,10 +45,8 @@ public final class StringEval implements StringValueEval {
}
public String toString() {
- StringBuilder sb = new StringBuilder(64);
- sb.append(getClass().getName()).append(" [");
- sb.append(_value);
- sb.append("]");
- return sb.toString();
+ return getClass().getName() + " [" +
+ _value +
+ "]";
}
}
diff --git a/src/java/org/apache/poi/ss/formula/functions/LookupUtils.java b/src/java/org/apache/poi/ss/formula/functions/LookupUtils.java
index fce264245..e0bdbedf0 100644
--- a/src/java/org/apache/poi/ss/formula/functions/LookupUtils.java
+++ b/src/java/org/apache/poi/ss/formula/functions/LookupUtils.java
@@ -184,7 +184,7 @@ final class LookupUtils {
public static final CompareResult EQUAL = new CompareResult(false, 0);
public static final CompareResult GREATER_THAN = new CompareResult(false, +1);
- public static final CompareResult valueOf(int simpleCompareResult) {
+ public static CompareResult valueOf(int simpleCompareResult) {
if(simpleCompareResult < 0) {
return LESS_THAN;
}
@@ -194,7 +194,7 @@ final class LookupUtils {
return EQUAL;
}
- public static final CompareResult valueOf(boolean matches) {
+ public static CompareResult valueOf(boolean matches) {
if(matches) {
return EQUAL ;
}
@@ -215,11 +215,9 @@ final class LookupUtils {
return _isGreaterThan;
}
public String toString() {
- StringBuffer sb = new StringBuffer(64);
- sb.append(getClass().getName()).append(" [");
- sb.append(formatAsString());
- sb.append("]");
- return sb.toString();
+ return getClass().getName() + " [" +
+ formatAsString() +
+ "]";
}
private String formatAsString() {
@@ -267,11 +265,9 @@ final class LookupUtils {
return compareSameType(other);
}
public String toString() {
- StringBuffer sb = new StringBuffer(64);
- sb.append(getClass().getName()).append(" [");
- sb.append(getValueAsString());
- sb.append("]");
- return sb.toString();
+ return getClass().getName() + " [" +
+ getValueAsString() +
+ "]";
}
protected abstract CompareResult compareSameType(ValueEval other);
/** used only for debug purposes */
@@ -475,7 +471,7 @@ final class LookupUtils {
// zero is FALSE, everything else is TRUE
return 0.0 != nve.getNumberValue();
}
- throw new RuntimeException("Unexpected eval type (" + valEval.getClass().getName() + ")");
+ throw new RuntimeException("Unexpected eval type (" + valEval + ")");
}
public static int lookupIndexOfValue(ValueEval lookupValue, ValueVector vector, boolean isRangeLookup) throws EvaluationException {
diff --git a/src/java/org/apache/poi/ss/formula/functions/Match.java b/src/java/org/apache/poi/ss/formula/functions/Match.java
index 589079e05..9cf38b2e0 100644
--- a/src/java/org/apache/poi/ss/formula/functions/Match.java
+++ b/src/java/org/apache/poi/ss/formula/functions/Match.java
@@ -153,7 +153,7 @@ public final class Match extends Var2or3ArgFunction {
// else looks like a number
throw new EvaluationException(ErrorEval.NA);
}
- throw new RuntimeException("Unexpected eval type (" + eval.getClass().getName() + ")");
+ throw new RuntimeException("Unexpected eval type (" + eval + ")");
}