Kaydet (Commit) 3757c03f authored tarafından Noel Grandin's avatar Noel Grandin

java: simplify array creation

and remove the need to worry about keeping indexes correct

Change-Id: I9a5fc00f7e28f305279b41099274c96daebebb95
üst 8912e6da
......@@ -496,10 +496,9 @@ public class TypeDetection extends ComplexTestCase {
*
*/
log.println("### checkStreamLoader() ###");
String[] urls = new String[2];
urls[0] = helper.getClassURLString("TypeDetection.props");
urls[1] = helper.getClassURLString("files.csv");
String[] urls = new String[] {
helper.getClassURLString("TypeDetection.props"),
helper.getClassURLString("files.csv") };
for (int j=0; j<urls.length; j++){
String fileURL = urls[j];
......
......@@ -259,8 +259,7 @@ public class Interceptor implements XDispatch,
{
if (m_lURLs4InterceptionInfo == null)
{
m_lURLs4InterceptionInfo = new String[1];
m_lURLs4InterceptionInfo[0] = "*";
m_lURLs4InterceptionInfo = new String[] { "*" };
}
return m_lURLs4InterceptionInfo;
......@@ -276,8 +275,7 @@ public class Interceptor implements XDispatch,
{
if (m_lURLs4Blocking == null)
{
m_lURLs4Blocking = new String[1];
m_lURLs4Blocking[0] = "*";
m_lURLs4Blocking = new String[] { "*" };
}
return m_lURLs4Blocking;
......
......@@ -251,8 +251,7 @@ public class checkdispatchapi
public void checkInterception()
{
String[] lDisabledURLs = new String[1];
lDisabledURLs[0] = ".uno:Open";
String[] lDisabledURLs = new String[] { ".uno:Open" };
System.out.println("create and initialize interceptor ...");
Interceptor aInterceptor = new Interceptor();
......
......@@ -270,13 +270,13 @@ public class Bootstrap {
Long.toString( (new Random()).nextLong() & 0x7fffffffffffffffL );
// create call with arguments
String[] cmdArray = new String[6];
cmdArray[0] = fOffice.getPath();
cmdArray[1] = "--nologo";
cmdArray[2] = "--nodefault";
cmdArray[3] = "--norestore";
cmdArray[4] = "--nolockcheck";
cmdArray[5] = "--accept=pipe,name=" + sPipeName + ";urp;";
String[] cmdArray = new String[] {
fOffice.getPath(),
"--nologo",
"--nodefault",
"--norestore",
"--nolockcheck",
"--accept=pipe,name=" + sPipeName + ";urp;" };
// start office process
Process p = Runtime.getRuntime().exec( cmdArray );
......
......@@ -245,9 +245,9 @@ XComponent xDoc = DesktopTools.loadDoc(xMSF, FileToLoad,
}
private String[] getLeftAndRight(int counter, XSpreadsheet xSpreadsheet) {
String[] re = new String[2];
re[0] = getCell(0, counter, xSpreadsheet).getFormula().trim();
re[1] = getCell(1, counter, xSpreadsheet).getFormula().trim();
String[] re = new String[] {
getCell(0, counter, xSpreadsheet).getFormula().trim(),
getCell(1, counter, xSpreadsheet).getFormula().trim() };
return re;
}
......
......@@ -190,10 +190,10 @@ public class DialogComponent {
}
public String[] getSupportedMethodNames() {
String[] retValue= new String[3];
retValue[0]= aHandlerMethod1;
retValue[1]= aHandlerMethod2;
retValue[2]= aHandlerMethod3;
String[] retValue= new String[] {
aHandlerMethod1,
aHandlerMethod2,
aHandlerMethod3 };
return retValue;
}
......
......@@ -401,10 +401,7 @@ public class ConfigExamples
UnoRuntime.queryInterface(XMultiPropertySet.class, xSubdivision);
// variables for multi-element access
String[] aElementNames = new String[2];
aElementNames[0] = "XAxis";
aElementNames[1] = "YAxis";
String[] aElementNames = new String[] { "XAxis", "YAxis" };
Object[] aElementValues = xSubdivProperties.getPropertyValues(aElementNames);
......@@ -869,9 +866,7 @@ public class ConfigExamples
aSettings[0] = new com.sun.star.beans.NamedValue("HeaderLine",Boolean.TRUE);
aSettings[1] = new com.sun.star.beans.NamedValue("FieldDelimiter",";");
String [] aTableFilter = new String[2];
aTableFilter[0] = "table.txt";
aTableFilter[1] = "othertable.txt";
String [] aTableFilter = new String[] { "table.txt", "othertable.txt" };
storeDataSource(sSampleDataSourceName,sSampleDataSourceURL,"",false,0,aSettings,aTableFilter);
}
......
......@@ -291,9 +291,7 @@ final class InstallationFinder {
String path = null;
// start the which process
String[] cmdArray = new String[2];
cmdArray[0] = WHICH;
cmdArray[1] = SOFFICE;
String[] cmdArray = new String[] { WHICH, SOFFICE };
Process proc = null;
Runtime rt = Runtime.getRuntime();
try {
......
......@@ -67,9 +67,9 @@ public class _XMultiLayerStratum extends MultiMethodTest {
boolean res = true;
try {
String[] LayerIds = new String[2];
LayerIds[0] = "1 /org/openoffice/Office/Jobs.xcu";
LayerIds[1] = "2 /org/openoffice/Office/Linguistic.xcu";
String[] LayerIds = new String[] {
"1 /org/openoffice/Office/Jobs.xcu",
"2 /org/openoffice/Office/Linguistic.xcu" };
XLayer[] Layers = oObj.getLayers(LayerIds, "");
res = Layers.length == 2;
......@@ -93,12 +93,10 @@ public class _XMultiLayerStratum extends MultiMethodTest {
boolean res = true;
try {
String[] LayerIds = new String[2];
LayerIds[0] = "1 /org/openoffice/Office/Jobs.xcu";
LayerIds[1] = "2 /org/openoffice/Office/Linguistic.xcu";
String[] Times = new String[2];
Times[0] = "";
Times[1] = "";
String[] LayerIds = new String[] {
"1 /org/openoffice/Office/Jobs.xcu",
"2 /org/openoffice/Office/Linguistic.xcu" };
String[] Times = new String[] { "", "" };
XLayer[] Layers = oObj.getMultipleLayers(LayerIds, Times);
res = Layers.length == 2;
......
......@@ -105,9 +105,7 @@ public class CallFormWizard
*/
public java.lang.String[] getSupportedServiceNames()
{
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[0] = __serviceName;
String[] stringSupportedServiceNames = new String[] { __serviceName };
return (stringSupportedServiceNames);
}
......
......@@ -111,9 +111,7 @@ public class CallQueryWizard
*/
public java.lang.String[] getSupportedServiceNames()
{
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[0] = __serviceName;
String[] stringSupportedServiceNames = new String[] { __serviceName };
return (stringSupportedServiceNames);
}
......
......@@ -137,9 +137,7 @@ public class CallReportWizard
*/
public java.lang.String[] getSupportedServiceNames()
{
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[ 0] = __serviceName;
String[] stringSupportedServiceNames = new String[] { __serviceName };
return (stringSupportedServiceNames);
}
......
......@@ -653,10 +653,8 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
catch (com.sun.star.wizards.common.NoValidPathException e)
{
ContentFiles = new String[2][];
String[] a = new String[1];
String[] b = new String[1];
a[0] = "DefaultLayoutOfData";
b[0] = "default";
String[] a = new String[] { "DefaultLayoutOfData" };
String[] b = new String[] { "default" };
ContentFiles[1] = a;
ContentFiles[0] = b;
}
......@@ -674,10 +672,8 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
catch (com.sun.star.wizards.common.NoValidPathException e)
{
LayoutFiles = new String[2][];
String[] a = new String[1];
String[] b = new String[1];
a[0] = "DefaultLayoutOfHeaders";
b[0] = "default";
String[] a = new String[] { "DefaultLayoutOfHeaders" };
String[] b = new String[] { "default" };
LayoutFiles[1] = a;
LayoutFiles[0] = b;
}
......
......@@ -612,10 +612,8 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
{
// if there are problems, don't show anything is a little bit hard.
LayoutFiles = new String[2][];
String[] a = new String[1];
String[] b = new String[1];
a[0] = "DefaultLayoutOfHeaders";
b[0] = "default";
String[] a = new String[] { "DefaultLayoutOfHeaders" };
String[] b = new String[] { "default" };
LayoutFiles[1] = a;
LayoutFiles[0] = b;
}
......
......@@ -110,9 +110,7 @@ public class CallTableWizard
*/
public java.lang.String[] getSupportedServiceNames()
{
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[0] = __serviceName;
String[] stringSupportedServiceNames = new String[] { __serviceName };
return (stringSupportedServiceNames);
}
......
......@@ -355,9 +355,9 @@ public class AggregateComponent extends ControlScroller
short[] iselfunction = (short[]) AnyConverter.toArray(currowproperties[0].Value);
if ((iselfield.length > 0) && (iselfunction.length > 0))
{
String[] curaggregatename = new String[2];
curaggregatename[0] = CurDBMetaData.NumericFieldNames[iselfield[0]];
curaggregatename[1] = this.sFunctionOperators[iselfunction[0]];
String[] curaggregatename = new String[] {
CurDBMetaData.NumericFieldNames[iselfield[0]],
this.sFunctionOperators[iselfunction[0]] };
aggregatevector.add(curaggregatename);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment