poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cedricwal...@apache.org
Subject svn commit: r1583358 - in /poi/trunk/src: java/org/apache/poi/hssf/record/ testcases/org/apache/poi/hssf/usermodel/ testcases/org/apache/poi/ss/formula/atp/
Date Mon, 31 Mar 2014 16:01:39 GMT
Author: cedricwalter
Date: Mon Mar 31 16:01:39 2014
New Revision: 1583358

URL: http://svn.apache.org/r1583358
Log:
performance issue: call toString() on a String object. This is entirely redundant.

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

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java?rev=1583358&r1=1583357&r2=1583358&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/WriteAccessRecord.java Mon Mar 31 16:01:39
2014
@@ -122,7 +122,7 @@ public final class WriteAccessRecord ext
 		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();
 	}

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=1583358&r1=1583357&r2=1583358&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Mon Mar 31 16:01:39
2014
@@ -1622,7 +1622,7 @@ public final class TestBugs extends Base
 
     	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);

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java?rev=1583358&r1=1583357&r2=1583358&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java Mon Mar
31 16:01:39 2014
@@ -91,7 +91,7 @@ public final class TestEscherGraphics ex
     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 {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java?rev=1583358&r1=1583357&r2=1583358&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java Mon Mar
31 16:01:39 2014
@@ -44,7 +44,7 @@ public final class TestEscherGraphics2d 
 	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);

Modified: poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java?rev=1583358&r1=1583357&r2=1583358&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestNetworkdaysFunction.java Mon
Mar 31 16:01:39 2014
@@ -78,24 +78,24 @@ public class TestNetworkdaysFunction ext
     }
 
     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());
     }
 

Modified: poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java?rev=1583358&r1=1583357&r2=1583358&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/formula/atp/TestWorkdayFunction.java Mon Mar
31 16:01:39 2014
@@ -82,7 +82,7 @@ public class TestWorkdayFunction extends
 
     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
 
     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()));
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message