[Libreoffice-commits] core.git: filter/qa framework/qa javaunohelper/com linguistic/qa odk/examples odk/source qadevOOo/tests wizards/com

Noel Grandin noel at peralex.com
Fri Jan 9 05:11:51 PST 2015


 filter/qa/complex/filter/detection/typeDetection/TypeDetection.java          |    7 +---
 framework/qa/complex/dispatches/Interceptor.java                             |    6 +--
 framework/qa/complex/dispatches/checkdispatchapi.java                        |    3 -
 javaunohelper/com/sun/star/comp/helper/Bootstrap.java                        |   14 ++++----
 linguistic/qa/complex/linguistic/HangulHanjaConversion.java                  |    6 +--
 odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java |    8 ++---
 odk/examples/DevelopersGuide/Config/ConfigExamples.java                      |    9 +----
 odk/source/com/sun/star/lib/loader/InstallationFinder.java                   |    4 --
 qadevOOo/tests/java/ifc/configuration/backend/_XMultiLayerStratum.java       |   16 ++++------
 wizards/com/sun/star/wizards/form/CallFormWizard.java                        |    4 --
 wizards/com/sun/star/wizards/query/CallQueryWizard.java                      |    4 --
 wizards/com/sun/star/wizards/report/CallReportWizard.java                    |    4 --
 wizards/com/sun/star/wizards/report/ReportTextImplementation.java            |   12 ++-----
 wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java  |    6 +--
 wizards/com/sun/star/wizards/table/CallTableWizard.java                      |    4 --
 wizards/com/sun/star/wizards/ui/AggregateComponent.java                      |    6 +--
 16 files changed, 43 insertions(+), 70 deletions(-)

New commits:
commit 3757c03fc8f138427e21c41ef5e66e8c5a98159c
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jan 9 14:51:38 2015 +0200

    java: simplify array creation
    
    and remove the need to worry about keeping indexes correct
    
    Change-Id: I9a5fc00f7e28f305279b41099274c96daebebb95

diff --git a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
index 57558c4..72fb166 100644
--- a/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
+++ b/filter/qa/complex/filter/detection/typeDetection/TypeDetection.java
@@ -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];
diff --git a/framework/qa/complex/dispatches/Interceptor.java b/framework/qa/complex/dispatches/Interceptor.java
index a6653d1..44ba2a2 100644
--- a/framework/qa/complex/dispatches/Interceptor.java
+++ b/framework/qa/complex/dispatches/Interceptor.java
@@ -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;
diff --git a/framework/qa/complex/dispatches/checkdispatchapi.java b/framework/qa/complex/dispatches/checkdispatchapi.java
index b234223..c227be2 100644
--- a/framework/qa/complex/dispatches/checkdispatchapi.java
+++ b/framework/qa/complex/dispatches/checkdispatchapi.java
@@ -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();
diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
index 6e677e6..537959b 100644
--- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
+++ b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java
@@ -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 );
diff --git a/linguistic/qa/complex/linguistic/HangulHanjaConversion.java b/linguistic/qa/complex/linguistic/HangulHanjaConversion.java
index 4b59d52..b7e479d2 100644
--- a/linguistic/qa/complex/linguistic/HangulHanjaConversion.java
+++ b/linguistic/qa/complex/linguistic/HangulHanjaConversion.java
@@ -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;
     }
diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java
index 253ca60..2c1aa7c 100644
--- a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java
+++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java
@@ -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;
         }
 
diff --git a/odk/examples/DevelopersGuide/Config/ConfigExamples.java b/odk/examples/DevelopersGuide/Config/ConfigExamples.java
index 510425d..e197fd5 100644
--- a/odk/examples/DevelopersGuide/Config/ConfigExamples.java
+++ b/odk/examples/DevelopersGuide/Config/ConfigExamples.java
@@ -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);
     }
diff --git a/odk/source/com/sun/star/lib/loader/InstallationFinder.java b/odk/source/com/sun/star/lib/loader/InstallationFinder.java
index 05ba219..d1f8738 100644
--- a/odk/source/com/sun/star/lib/loader/InstallationFinder.java
+++ b/odk/source/com/sun/star/lib/loader/InstallationFinder.java
@@ -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 {
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XMultiLayerStratum.java b/qadevOOo/tests/java/ifc/configuration/backend/_XMultiLayerStratum.java
index 55af96b..0bbadd2 100644
--- a/qadevOOo/tests/java/ifc/configuration/backend/_XMultiLayerStratum.java
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XMultiLayerStratum.java
@@ -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;
diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java
index 8adbfe3..0cfec7b 100644
--- a/wizards/com/sun/star/wizards/form/CallFormWizard.java
+++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java
@@ -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);
         }
diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
index 9424566..3b5a2a1 100644
--- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
@@ -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);
         }
diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java
index 52839fe..8d86ad9 100644
--- a/wizards/com/sun/star/wizards/report/CallReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java
@@ -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);
         }
diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
index be20228..a7f38d4 100644
--- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
+++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
@@ -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;
         }
diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
index ef07f83..d9e4e50 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
@@ -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;
         }
diff --git a/wizards/com/sun/star/wizards/table/CallTableWizard.java b/wizards/com/sun/star/wizards/table/CallTableWizard.java
index e25f006..2d126a3 100644
--- a/wizards/com/sun/star/wizards/table/CallTableWizard.java
+++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java
@@ -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);
         }
diff --git a/wizards/com/sun/star/wizards/ui/AggregateComponent.java b/wizards/com/sun/star/wizards/ui/AggregateComponent.java
index 6957bdb2..759e2f4 100644
--- a/wizards/com/sun/star/wizards/ui/AggregateComponent.java
+++ b/wizards/com/sun/star/wizards/ui/AggregateComponent.java
@@ -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);
                             }
                         }


More information about the Libreoffice-commits mailing list