]> source.dussan.org Git - poi.git/commitdiff
performance issue: call toString() on a String object. This is entirely redundant.
authorCédric Walter <cedricwalter@apache.org>
Mon, 31 Mar 2014 16:01:39 +0000 (16:01 +0000)
committerCédric Walter <cedricwalter@apache.org>
Mon, 31 Mar 2014 16:01:39 +0000 (16:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1583358 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/record/WriteAccessRecord.java
src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java
src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java

index f87373b1ab5165c10e9ac8b401747261473bc16c..130f266c395a61987e123c5794ab938943d5df66 100644 (file)
@@ -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();
        }
index 4e325f510103bbd3cde90bb2074b08384731d674..755adb67928572212dd5ea8c87fb522df1e8f0db 100644 (file)
@@ -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);
index a7ecbe53cfb491988af00fea6dc2a0e0388a56c4..afeee14eda79649fa11082397fe19f425ce49c03 100644 (file)
@@ -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 {
index ea098aff71153385fc1eac29ef1614b5a1af59f8..a16033efb3994b22d9230f498b856a7433eef090 100644 (file)
@@ -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);
index 8e9e7366c5db70df661250f4d2abbf7bc8638a0e..594926fe242c5cdeac2f34ac127e231a059a9aa6 100644 (file)
@@ -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());
     }
 
index b71e0c312cc55ad51f0050ceab12c6a569c9f4f9..77f2d9ed9c4de7b99b3efda98698c83920581d50 100644 (file)
@@ -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()));
     }