mirror of https://github.com/apache/poi.git
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:
parent
e684262ca6
commit
b9a9ac8556
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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()));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue