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
This commit is contained in:
Cédric Walter 2014-03-31 16:01:39 +00:00
parent a0d1ab5add
commit 730deb782b
6 changed files with 13 additions and 13 deletions

View 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();
}

View 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);

View 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 {

View 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);

View 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());
}

View 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()));
}