java: no need to call String.valueOf to append to a String

Change-Id: I5ef45b971d24dde814ab8cbb2e9503d9da4f0d73
This commit is contained in:
Noel Grandin
2014-10-16 12:51:54 +02:00
parent 3beae0f05d
commit 12b01b920f
24 changed files with 54 additions and 56 deletions

View File

@@ -445,7 +445,7 @@ public class LocalOfficeConnection
// empty string as bridge name into createBridge. Then we should always get // empty string as bridge name into createBridge. Then we should always get
// a new bridge. This does not work because of (i51323). Therefore we // a new bridge. This does not work because of (i51323). Therefore we
// create unique bridge names for the current process. // create unique bridge names for the current process.
String sBridgeName = "OOoBean_private_bridge_" + String.valueOf(m_nBridgeCounter++); String sBridgeName = "OOoBean_private_bridge_" + (m_nBridgeCounter++);
try { try {
mBridge = xBridgeFactory.createBridge(sBridgeName, protDcp, xConnection, null); mBridge = xBridgeFactory.createBridge(sBridgeName, protDcp, xConnection, null);
} catch (com.sun.star.bridge.BridgeExistsException e) { } catch (com.sun.star.bridge.BridgeExistsException e) {

View File

@@ -680,8 +680,8 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
if ( currentValue != requiredValue ) if ( currentValue != requiredValue )
{ {
log.println( "wrong value of the " + fieldName + " field!" ); log.println( "wrong value of the " + fieldName + " field!" );
log.println( " expected: " + String.valueOf( requiredValue ) ); log.println( " expected: " + requiredValue );
log.println( " found : " + String.valueOf( currentValue ) ); log.println( " found : " + currentValue );
} }
else else
return true; return true;
@@ -704,8 +704,8 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
if ( currentValue != requiredValue ) if ( currentValue != requiredValue )
{ {
log.println( "wrong value of the " + fieldName + " field!" ); log.println( "wrong value of the " + fieldName + " field!" );
log.println( " expected: " + String.valueOf( requiredValue ) ); log.println( " expected: " + requiredValue );
log.println( " found : " + String.valueOf( currentValue ) ); log.println( " found : " + currentValue );
} }
else else
return true; return true;
@@ -726,8 +726,8 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
if ( currentValue != requiredValue ) if ( currentValue != requiredValue )
{ {
log.println( "wrong value of the " + fieldName + " field!" ); log.println( "wrong value of the " + fieldName + " field!" );
log.println( " expected: " + String.valueOf( requiredValue ) ); log.println( " expected: " + requiredValue );
log.println( " found : " + String.valueOf( currentValue ) ); log.println( " found : " + currentValue );
} }
else else
return true; return true;

View File

@@ -49,7 +49,7 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult
{ {
com.sun.star.sheet.ResultEvent aEvent = com.sun.star.sheet.ResultEvent aEvent =
new com.sun.star.sheet.ResultEvent(); new com.sun.star.sheet.ResultEvent();
aEvent.Value = aName + " " + String.valueOf( nValue ); aEvent.Value = aName + " " + nValue;
aEvent.Source = this; aEvent.Source = this;
return aEvent; return aEvent;
} }

View File

@@ -222,8 +222,8 @@ public class NotesAccess implements Runnable {
// Inserting the total value. // Inserting the total value.
insertIntoCell(intColumn + 3, intRow, "=B" insertIntoCell(intColumn + 3, intRow, "=B"
+ String.valueOf( intRow + 1 ) + ( intRow + 1 )
+ "*C" + String.valueOf(intRow + 1), + "*C" + (intRow + 1),
xSpreadsheet, ""); xSpreadsheet, "");
// Increasing the current row. // Increasing the current row.
@@ -235,8 +235,8 @@ public class NotesAccess implements Runnable {
// Summing all specific amounts. // Summing all specific amounts.
insertIntoCell(intColumn + 3, intRow, "=sum(D" insertIntoCell(intColumn + 3, intRow, "=sum(D"
+ String.valueOf( intRowToStart + 1 ) + ":D" + ( intRowToStart + 1 ) + ":D"
+ String.valueOf( intRow ), + intRow,
xSpreadsheet, ""); xSpreadsheet, "");
xContext = null; xContext = null;

View File

@@ -217,7 +217,7 @@ public class ConvWatch
boolean bResultIsOk = true; // result over all pages boolean bResultIsOk = true; // result over all pages
for (int i=0;i<aList.length; i++) for (int i=0;i<aList.length; i++)
{ {
INIoutput.writeSection("page" + String.valueOf(i + 1)); // list start at point 0, but this is page 1 and so on... current_page = (i + 1) INIoutput.writeSection("page" + (i + 1)); // list start at point 0, but this is page 1 and so on... current_page = (i + 1)
aList[i].printStatus(); aList[i].printStatus();
boolean bCurrentResult = true; // result over exact one page boolean bCurrentResult = true; // result over exact one page
@@ -276,7 +276,7 @@ public class ConvWatch
for (int i=0;i<aDiffDiffList.length; i++) for (int i=0;i<aDiffDiffList.length; i++)
{ {
INIoutput.writeSection("page" + String.valueOf(i + 1)); // list start at point 0, but this is page 1 and so on... current_page = (i + 1) INIoutput.writeSection("page" + (i + 1)); // list start at point 0, but this is page 1 and so on... current_page = (i + 1)
boolean bCurrentResult = (aDiffDiffList[i].nDiffStatus == StatusHelper.DIFF_NO_DIFFERENCES); // logic: nDiff==0 = true if there is no difference boolean bCurrentResult = (aDiffDiffList[i].nDiffStatus == StatusHelper.DIFF_NO_DIFFERENCES); // logic: nDiff==0 = true if there is no difference
INIoutput.checkDiffDiffLine(aDiffDiffList[i], bCurrentResult); INIoutput.checkDiffDiffLine(aDiffDiffList[i], bCurrentResult);

View File

@@ -120,7 +120,7 @@ public class INIOutputter
m_aOut.write( "newgfx=" + _aStatus.m_sNewGfx + ls); m_aOut.write( "newgfx=" + _aStatus.m_sNewGfx + ls);
m_aOut.write( "diffgfx=" + _aStatus.m_sDiffGfx + ls); m_aOut.write( "diffgfx=" + _aStatus.m_sDiffGfx + ls);
String sPercent = String.valueOf(_aStatus.nPercent) + "%"; String sPercent = _aStatus.nPercent + "%";
if (_aStatus.nPercent > 0 && _aStatus.nPercent < 5) if (_aStatus.nPercent > 0 && _aStatus.nPercent < 5)
{ {
sPercent += " (less 5% is ok)"; sPercent += " (less 5% is ok)";
@@ -138,7 +138,7 @@ public class INIOutputter
m_aOut.write( "new_BM_gfx=" + _aStatus.m_sNew_BM_Gfx + ls); m_aOut.write( "new_BM_gfx=" + _aStatus.m_sNew_BM_Gfx + ls);
m_aOut.write( "diff_BM_gfx=" + _aStatus.m_sDiff_BM_Gfx + ls); m_aOut.write( "diff_BM_gfx=" + _aStatus.m_sDiff_BM_Gfx + ls);
String sPercent2 = String.valueOf(_aStatus.nPercent2) + "%"; String sPercent2 = _aStatus.nPercent2 + "%";
if (_aStatus.nPercent2 > 0 && _aStatus.nPercent2 < 5) if (_aStatus.nPercent2 > 0 && _aStatus.nPercent2 < 5)
{ {
sPercent2 += " (less 5% is ok)"; sPercent2 += " (less 5% is ok)";
@@ -175,7 +175,7 @@ public class INIOutputter
m_aOut.write( "newgfx=" + _aStatus.m_sNewGfx + ls); m_aOut.write( "newgfx=" + _aStatus.m_sNewGfx + ls);
m_aOut.write( "diffgfx=" + _aStatus.m_sDiffGfx + ls); m_aOut.write( "diffgfx=" + _aStatus.m_sDiffGfx + ls);
String sPercent = String.valueOf(_aStatus.nPercent) + "%"; String sPercent = _aStatus.nPercent + "%";
m_aOut.write("percent=" + sPercent + ls); m_aOut.write("percent=" + sPercent + ls);
// is the check positiv, in a defined range // is the check positiv, in a defined range

View File

@@ -545,7 +545,7 @@ public class OfficePrint {
String sPages = ""; String sPages = "";
if (_aGTA.getMaxPages() > 0) if (_aGTA.getMaxPages() > 0)
{ {
sPages = "1-" + String.valueOf(_aGTA.getMaxPages()); sPages = "1-" + _aGTA.getMaxPages();
} }
if (_aGTA.getOnlyPages().length() != 0) if (_aGTA.getOnlyPages().length() != 0)
{ {

View File

@@ -167,7 +167,7 @@ public class PRNCompare
"-dNOPROMPT", "-dNOPROMPT",
"-dBATCH", "-dBATCH",
"-sDEVICE=jpeg", "-sDEVICE=jpeg",
"-r" + String.valueOf(_nResolutionInDPI), "-r" + _nResolutionInDPI,
"-dNOPAUSE", "-dNOPAUSE",
"-sOutputFile=" + sJPGFilename, "-sOutputFile=" + sJPGFilename,
sOriginalFile sOriginalFile
@@ -497,7 +497,7 @@ public class PRNCompare
} }
int nPercent = Math.abs(nNotBlackCount_DiffGraphic * 100 / nMinNotWhiteCount); int nPercent = Math.abs(nNotBlackCount_DiffGraphic * 100 / nMinNotWhiteCount);
GlobalLogWriter.get().println( "Graphics check, pixel based:" + String.valueOf(nPercent) + "% pixel differ "); GlobalLogWriter.get().println( "Graphics check, pixel based:" + nPercent + "% pixel differ ");
return nPercent; return nPercent;
} }

View File

@@ -107,11 +107,11 @@ public class PerformanceContainer /* extends *//* implements */ {
{ {
String ls = System.getProperty("line.separator"); String ls = System.getProperty("line.separator");
out.write("loadtime=" + String.valueOf(m_nTime[ Load ]) + ls); out.write("loadtime=" + (m_nTime[ Load ]) + ls);
out.write("storetime=" + String.valueOf(m_nTime[ Store ]) + ls); out.write("storetime=" + (m_nTime[ Store ]) + ls);
out.write("printtime=" + String.valueOf(m_nTime[ Print ]) + ls); out.write("printtime=" + (m_nTime[ Print ]) + ls);
out.write("officestarttime=" + String.valueOf(m_nTime[ OfficeStart ]) + ls); out.write("officestarttime=" + (m_nTime[ OfficeStart ]) + ls);
out.write("storeaspdftime=" + String.valueOf(m_nTime[ StoreAsPDF ]) + ls); out.write("storeaspdftime=" + (m_nTime[ StoreAsPDF ]) + ls);
} }
private static double stringToDouble(String _sStr) private static double stringToDouble(String _sStr)

View File

@@ -69,7 +69,7 @@ public class StatusHelper
} }
else if (nDiffStatus == DIFF_DIFFERENCES_FOUND) else if (nDiffStatus == DIFF_DIFFERENCES_FOUND)
{ {
GlobalLogWriter.get().println("Files differ by " + String.valueOf(nPercent) + "%"); GlobalLogWriter.get().println("Files differ by " + nPercent + "%");
} }
else if (nDiffStatus == DIFF_AFTER_MOVE_DONE_NO_PROBLEMS) else if (nDiffStatus == DIFF_AFTER_MOVE_DONE_NO_PROBLEMS)
{ {
@@ -77,7 +77,7 @@ public class StatusHelper
} }
else if (nDiffStatus == DIFF_AFTER_MOVE_DONE_DIFFERENCES_FOUND) else if (nDiffStatus == DIFF_AFTER_MOVE_DONE_DIFFERENCES_FOUND)
{ {
GlobalLogWriter.get().println("A picture move is done, the files differ by " + String.valueOf(nPercent2) + " old was " + String.valueOf(nPercent) + "%"); GlobalLogWriter.get().println("A picture move is done, the files differ by " + nPercent2 + " old was " + nPercent + "%");
} }
else else
{ {

View File

@@ -27,7 +27,7 @@ public class TimeHelper
*/ */
static void waitInSeconds(int _nSeconds, String _sReason) static void waitInSeconds(int _nSeconds, String _sReason)
{ {
GlobalLogWriter.get().println("Wait " + String.valueOf(_nSeconds) + " sec. Reason: " + _sReason); GlobalLogWriter.get().println("Wait " + _nSeconds + " sec. Reason: " + _sReason);
try { try {
java.lang.Thread.sleep(_nSeconds * 1000); java.lang.Thread.sleep(_nSeconds * 1000);
} catch (InterruptedException e2) {} } catch (InterruptedException e2) {}

View File

@@ -243,7 +243,7 @@ public class JPEGComparator extends EnhancedComplexTestCase
int nPages = aResultIniFile.getIntValue("global", "pages", 0); int nPages = aResultIniFile.getIntValue("global", "pages", 0);
for (int i = 0; i < nPages; i++) for (int i = 0; i < nPages; i++)
{ {
String sCurrentPage = "page" + String.valueOf(i + 1); String sCurrentPage = "page" + (i + 1);
int nPercent = aResultIniFile.getIntValue(sCurrentPage, "percent", -1); int nPercent = aResultIniFile.getIntValue(sCurrentPage, "percent", -1);
if (nPercent == 0) if (nPercent == 0)
{ {
@@ -484,7 +484,7 @@ public class JPEGComparator extends EnhancedComplexTestCase
aResultIni.insertValue("global", "dpi", aNameDPIPage.DPI); aResultIni.insertValue("global", "dpi", aNameDPIPage.DPI);
// write down flags for each page // write down flags for each page
String sSection = "page" + String.valueOf(nPage); String sSection = "page" + nPage;
aResultIni.insertValue(sSection, "oldgfx", sSource); aResultIni.insertValue(sSection, "oldgfx", sSource);
aResultIni.insertValue(sSection, "newgfx", sDestination); aResultIni.insertValue(sSection, "newgfx", sDestination);
@@ -548,7 +548,7 @@ public class JPEGComparator extends EnhancedComplexTestCase
} }
int nPercent = Math.abs(nNotBlackCount_DiffGraphic * 100 / nMinNotWhiteCount); int nPercent = Math.abs(nNotBlackCount_DiffGraphic * 100 / nMinNotWhiteCount);
GlobalLogWriter.println("Graphics check, pixel based:" + String.valueOf(nPercent) + "% pixel differ "); GlobalLogWriter.println("Graphics check, pixel based:" + nPercent + "% pixel differ ");
return nPercent; return nPercent;
} }

View File

@@ -237,7 +237,7 @@ private static void convertToWidth340(String _sFrom, String _To)
private String getJPEGName(String _sOutputPath, String _sBasename, int _nResolutionInDPI, String _sGS_PageOutput) private String getJPEGName(String _sOutputPath, String _sBasename, int _nResolutionInDPI, String _sGS_PageOutput)
{ {
String sName = _sBasename + "_" + String.valueOf(_nResolutionInDPI) + "DPI_" + _sGS_PageOutput + ".jpg"; String sName = _sBasename + "_" + _nResolutionInDPI + "DPI_" + _sGS_PageOutput + ".jpg";
String sJPEGName = FileHelper.appendPath(_sOutputPath, sName); String sJPEGName = FileHelper.appendPath(_sOutputPath, sName);
return sJPEGName; return sJPEGName;
} }
@@ -281,7 +281,7 @@ private static void convertToWidth340(String _sFrom, String _To)
"-dNOPROMPT", "-dNOPROMPT",
"-dBATCH", "-dBATCH",
"-sDEVICE=jpeg", "-sDEVICE=jpeg",
"-r" + String.valueOf(_nResolutionInDPI), "-r" + _nResolutionInDPI,
"-dNOPAUSE", "-dNOPAUSE",
"-sOutputFile=" + sJPEGNameSchema, "-sOutputFile=" + sJPEGNameSchema,
sPostscriptOrPDFFile sPostscriptOrPDFFile

View File

@@ -495,7 +495,7 @@ public class OpenOfficePostscriptCreator implements IOffice
String sPages = ""; String sPages = "";
if (_aGTA.getMaxPages() > 0) if (_aGTA.getMaxPages() > 0)
{ {
sPages = "1-" + String.valueOf(_aGTA.getMaxPages()); sPages = "1-" + _aGTA.getMaxPages();
} }
if (_aGTA.getOnlyPages().length() != 0) if (_aGTA.getOnlyPages().length() != 0)
{ {

View File

@@ -110,13 +110,13 @@ public class PerformanceContainer /* extends *//* implements */ {
public void print(PrintStream out) public void print(PrintStream out)
{ {
out.println("loadtime=" + String.valueOf(m_nTime[ Load ])); out.println("loadtime=" + m_nTime[ Load ]);
out.println("storetime=" + String.valueOf(m_nTime[ Store ])); out.println("storetime=" + m_nTime[ Store ]);
out.println("printtime=" + String.valueOf(m_nTime[ Print ])); out.println("printtime=" + m_nTime[ Print ]);
out.println("officestarttime=" + String.valueOf(m_nTime[ OfficeStart ])); out.println("officestarttime=" + m_nTime[ OfficeStart ]);
out.println("officestoptime=" + String.valueOf(m_nTime[ OfficeStop ])); out.println("officestoptime=" + m_nTime[ OfficeStop ]);
out.println("storeaspdftime=" + String.valueOf(m_nTime[ StoreAsPDF ])); out.println("storeaspdftime=" + m_nTime[ StoreAsPDF ]);
out.println("alltime=" + String.valueOf(m_nTime[ AllTime ])); out.println("alltime=" + m_nTime[ AllTime ]);
} }
public void print(IniFile _aIniFile, String _sSection) public void print(IniFile _aIniFile, String _sSection)

View File

@@ -29,7 +29,7 @@ public class TimeHelper
*/ */
static void waitInSeconds(int _nSeconds, String _sReason) static void waitInSeconds(int _nSeconds, String _sReason)
{ {
GlobalLogWriter.println("Wait 0.25 * " + String.valueOf(_nSeconds) + " sec. Reason: " + _sReason); GlobalLogWriter.println("Wait 0.25 * " + _nSeconds + " sec. Reason: " + _sReason);
try { try {
java.lang.Thread.sleep(_nSeconds * 250); java.lang.Thread.sleep(_nSeconds * 250);
} catch (InterruptedException e2) {} } catch (InterruptedException e2) {}

View File

@@ -174,7 +174,7 @@ public class XMLStylesImporter extends TestCase {
boolean hasStyle = boolean hasStyle =
StyleFamilyName.hasByName(impStyleName); StyleFamilyName.hasByName(impStyleName);
logF.println("Does style with name '" + impStyleName logF.println("Does style with name '" + impStyleName
+ "' exist? " + String.valueOf(hasStyle) ); + "' exist? " + hasStyle );
return hasStyle; return hasStyle;
} catch (com.sun.star.uno.Exception e) { } catch (com.sun.star.uno.Exception e) {
logF.println("Exception while checking import :") ; logF.println("Exception while checking import :") ;

View File

@@ -241,8 +241,7 @@ class ScriptImpl implements XScript {
Class<?> c = scriptLoader.loadClass(className); Class<?> c = scriptLoader.loadClass(className);
long end = new java.util.Date().getTime(); long end = new java.util.Date().getTime();
LogUtils.DEBUG("loadClass took: " + String.valueOf(end - start) LogUtils.DEBUG("loadClass took: " + (end - start) + "milliseconds");
+ "milliseconds");
try { try {
LogUtils.DEBUG("class loaded ... "); LogUtils.DEBUG("class loaded ... ");
@@ -272,8 +271,7 @@ class ScriptImpl implements XScript {
long start = new java.util.Date().getTime(); long start = new java.util.Date().getTime();
result = script.invoke(invocationArgs); result = script.invoke(invocationArgs);
long end = new java.util.Date().getTime(); long end = new java.util.Date().getTime();
LogUtils.DEBUG("invoke took: " + String.valueOf(end - start) LogUtils.DEBUG("invoke took: " + (end - start) + "milliseconds");
+ "milliseconds");
} catch (java.lang.IllegalArgumentException iae) { } catch (java.lang.IllegalArgumentException iae) {
ScriptFrameworkErrorException e2 = new ScriptFrameworkErrorException( ScriptFrameworkErrorException e2 = new ScriptFrameworkErrorException(
iae.getMessage(), null, metaData.getLanguageName(), iae.getMessage(), null, metaData.getLanguageName(),

View File

@@ -4107,7 +4107,7 @@ public class TextPortionEnumerationTest
private String mkName(String prefix) private String mkName(String prefix)
{ {
return prefix + String.valueOf(m_Count++); return prefix + (m_Count++);
} }
private StringPair mkId(String prefix) private StringPair mkId(String prefix)

View File

@@ -79,7 +79,7 @@ public class Resource
} }
catch (Exception exception) catch (Exception exception)
{ {
throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found", exception); throw new java.lang.IllegalArgumentException("Resource with ID not " + nID + "not found", exception);
} }
} }
@@ -91,7 +91,7 @@ public class Resource
} }
catch (Exception exception) catch (Exception exception)
{ {
throw new java.lang.IllegalArgumentException("Resource with ID not " + String.valueOf(nID) + "not found", exception); throw new java.lang.IllegalArgumentException("Resource with ID not " + nID + "not found", exception);
} }
} }
@@ -108,7 +108,7 @@ public class Resource
} }
catch (Exception exception) catch (Exception exception)
{ {
throw new java.lang.IllegalArgumentException("Resource with ID not" + String.valueOf(nID) + "not found", exception); throw new java.lang.IllegalArgumentException("Resource with ID not" + nID + "not found", exception);
} }
} }

View File

@@ -389,7 +389,7 @@ public class SQLQueryComposer
if (bAliasNameexists) if (bAliasNameexists)
{ {
a++; a++;
locAliasName = _TableName + "_" + String.valueOf(a); locAliasName = _TableName + "_" + a;
} }
else else
{ {

View File

@@ -480,13 +480,13 @@ public class AggregateComponent extends ControlScroller
private String getFunctionControlName(int _index) private String getFunctionControlName(int _index)
{ {
String namesuffix = "_" + String.valueOf(_index + 1); String namesuffix = "_" + (_index + 1);
return "lstfunctions" + namesuffix; return "lstfunctions" + namesuffix;
} }
private String getFieldsControlName(int _index) private String getFieldsControlName(int _index)
{ {
String namesuffix = "_" + String.valueOf(_index + 1); String namesuffix = "_" + (_index + 1);
return "lstFieldnames" + namesuffix; return "lstFieldnames" + namesuffix;
} }

View File

@@ -536,7 +536,7 @@ public class FilterComponent
try try
{ {
String sCompSuffix = sIncSuffix + "_" + String.valueOf(Index + 1); String sCompSuffix = sIncSuffix + "_" + (Index + 1);
m_bEnabled = _bEnabled; m_bEnabled = _bEnabled;
// Label Field // Label Field

View File

@@ -700,7 +700,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
for (int i = 0; i < sRightPaneHeaders.length; i++) for (int i = 0; i < sRightPaneHeaders.length; i++)
{ {
insertLabel("lblQueryTitle" + String.valueOf(i), insertLabel("lblQueryTitle" + i,
new String[] new String[]
{ {
PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH