aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Walter <cedricwalter@apache.org>2014-03-31 16:01:39 +0000
committerCédric Walter <cedricwalter@apache.org>2014-03-31 16:01:39 +0000
commitb9a9ac8556e8970b10b4e9a77341619991be55f2 (patch)
treea9cf535c5eb23473e4303ddbee22b27936500b78
parente684262ca6c2aba6ca58283e81376de7f98debc1 (diff)
downloadpoi-b9a9ac8556e8970b10b4e9a77341619991be55f2.tar.gz
poi-b9a9ac8556e8970b10b4e9a77341619991be55f2.zip
performance issue: call toString() on a String object. This is entirely redundant.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1583358 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/poi/hssf/record/WriteAccessRecord.java2
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java2
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java2
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java2
-rw-r--r--src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java10
-rw-r--r--src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java8
6 files changed, 13 insertions, 13 deletions
diff --git a/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java b/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java
index f87373b1ab..130f266c39 100644
--- a/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java
+++ b/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java
@@ -122,7 +122,7 @@ public final class WriteAccessRecord extends StandardRecord {
StringBuffer buffer = new StringBuffer();
buffer.append("[WRITEACCESS]\n");
- buffer.append(" .name = ").append(field_1_username.toString()).append("\n");
+ buffer.append(" .name = ").append(field_1_username).append("\n");
buffer.append("[/WRITEACCESS]\n");
return buffer.toString();
}
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
index 4e325f5101..755adb6792 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
@@ -1622,7 +1622,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
HSSFSheet s = wb.getSheetAt(0);
HSSFCell cell1 = s.getRow(0).getCell(0);
- assertEquals("test ", cell1.getStringCellValue().toString());
+ assertEquals("test ", cell1.getStringCellValue());
HSSFCell cell2 = s.getRow(0).getCell(1);
assertEquals(1.0, cell2.getNumericCellValue(), 0.0);
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java b/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
index a7ecbe53cf..afeee14eda 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
@@ -91,7 +91,7 @@ public final class TestEscherGraphics extends TestCase {
public void testDrawString() {
graphics.drawString("This is a test", 10, 10);
HSSFTextbox t = (HSSFTextbox) escherGroupA.getChildren().get(0);
- assertEquals("This is a test", t.getString().getString().toString());
+ assertEquals("This is a test", t.getString().getString());
}
public void testGetDataBackAgain() throws Exception {
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java b/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
index ea098aff71..a16033efb3 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
@@ -44,7 +44,7 @@ public final class TestEscherGraphics2d extends TestCase {
public void testDrawString() {
graphics.drawString("This is a test", 10, 10);
HSSFTextbox t = (HSSFTextbox) escherGroup.getChildren().get(0);
- assertEquals("This is a test", t.getString().getString().toString());
+ assertEquals("This is a test", t.getString());
// Check that with a valid font, it's still ok
Font font = new Font("Forte", Font.PLAIN, 12);
diff --git a/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java b/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java
index 8e9e7366c5..594926fe24 100644
--- a/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java
+++ b/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java
@@ -78,24 +78,24 @@ public class TestNetworkdaysFunction extends TestCase {
}
public void testFailWhenStartDateAfterEndDate() {
- assertEquals(NAME_INVALID, NetworkdaysFunction.instance.evaluate(new ValueEval[]{ new StringEval(END_DATE.toString()),
- new StringEval(STARTING_DATE.toString()) }, EC));
+ assertEquals(NAME_INVALID, NetworkdaysFunction.instance.evaluate(new ValueEval[]{ new StringEval(END_DATE),
+ new StringEval(STARTING_DATE) }, EC));
}
public void testReturnNetworkdays() {
assertEquals(108, (int) ((NumericValueEval) NetworkdaysFunction.instance.evaluate(new ValueEval[]{
- new StringEval(STARTING_DATE.toString()), new StringEval(END_DATE.toString()) }, EC)).getNumberValue());
+ new StringEval(STARTING_DATE), new StringEval(END_DATE) }, EC)).getNumberValue());
}
public void testReturnNetworkdaysWithAHoliday() {
assertEquals(107, (int) ((NumericValueEval) NetworkdaysFunction.instance.evaluate(new ValueEval[]{
- new StringEval(STARTING_DATE.toString()), new StringEval(END_DATE.toString()), new StringEval(FIRST_HOLIDAY.toString()) },
+ new StringEval(STARTING_DATE), new StringEval(END_DATE), new StringEval(FIRST_HOLIDAY) },
EC)).getNumberValue());
}
public void testReturnNetworkdaysWithManyHolidays() {
assertEquals(105, (int) ((NumericValueEval) NetworkdaysFunction.instance.evaluate(new ValueEval[]{
- new StringEval(STARTING_DATE.toString()), new StringEval(END_DATE.toString()),
+ new StringEval(STARTING_DATE), new StringEval(END_DATE),
new MockAreaEval(FIRST_HOLIDAY, SECOND_HOLIDAY, THIRD_HOLIDAY) }, EC)).getNumberValue());
}
diff --git a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java
index b71e0c312c..77f2d9ed9c 100644
--- a/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java
+++ b/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java
@@ -82,7 +82,7 @@ public class TestWorkdayFunction extends TestCase {
public void testReturnWorkdays() {
assertEquals(new Date(109, APRIL, 30), DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
- new StringEval(STARTING_DATE.toString()), new NumberEval(151) }, EC)).getNumberValue()));
+ new StringEval(STARTING_DATE), new NumberEval(151) }, EC)).getNumberValue()));
}
public void testReturnWorkdaysSpanningAWeekendSubtractingDays() {
@@ -127,18 +127,18 @@ public class TestWorkdayFunction extends TestCase {
public void testReturnWorkdaysWithDaysTruncated() {
assertEquals(new Date(109, APRIL, 30), DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
- new StringEval(STARTING_DATE.toString()), new NumberEval(151.99999) }, EC)).getNumberValue()));
+ new StringEval(STARTING_DATE), new NumberEval(151.99999) }, EC)).getNumberValue()));
}
public void testReturnRetroativeWorkday() {
assertEquals(new Date(108, SEPTEMBER, 23), DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
- new StringEval(STARTING_DATE.toString()), new NumberEval(-5), new StringEval(RETROATIVE_HOLIDAY.toString()) }, EC))
+ new StringEval(STARTING_DATE), new NumberEval(-5), new StringEval(RETROATIVE_HOLIDAY) }, EC))
.getNumberValue()));
}
public void testReturnNetworkdaysWithManyHolidays() {
assertEquals(new Date(109, MAY, 5), DateUtil.getJavaDate(((NumberEval) WorkdayFunction.instance.evaluate(new ValueEval[]{
- new StringEval(STARTING_DATE.toString()), new NumberEval(151),
+ new StringEval(STARTING_DATE), new NumberEval(151),
new MockAreaEval(FIRST_HOLIDAY, SECOND_HOLIDAY, THIRD_HOLIDAY) }, EC)).getNumberValue()));
}