[Libreoffice-commits] core.git: 2 commits - bean/qa comphelper/qa connectivity/qa dbaccess/qa extensions/qa forms/qa framework/qa qadevOOo/tests wizards/com

Noel Grandin noel at peralex.com
Thu Nov 5 03:43:32 PST 2015


 bean/qa/complex/bean/OOoBeanTest.java                             |    3 -
 comphelper/qa/complex/comphelper/Map.java                         |    4 -
 connectivity/qa/complex/connectivity/FlatFileAccess.java          |    8 +-
 dbaccess/qa/complex/dbaccess/CopyTableWizard.java                 |    2 
 extensions/qa/integration/extensions/ServicesHandler.java         |    2 
 forms/qa/complex/forms/CheckOGroupBoxModel.java                   |    2 
 framework/qa/complex/XUserInputInterception/EventTest.java        |    2 
 framework/qa/complex/framework/autosave/AutoSave.java             |    2 
 framework/qa/complex/imageManager/CheckImageManager.java          |    2 
 framework/qa/complex/path_substitution/PathSubstitutionTest.java  |    2 
 qadevOOo/tests/java/ifc/beans/_XHierarchicalPropertySet.java      |    3 -
 qadevOOo/tests/java/ifc/beans/_XMultiHierarchicalPropertySet.java |    3 -
 qadevOOo/tests/java/ifc/i18n/_XCalendar.java                      |   21 ++-----
 qadevOOo/tests/java/ifc/io/_XDataOutputStream.java                |   30 ++++------
 qadevOOo/tests/java/ifc/sheet/_XCellRangeMovement.java            |    4 -
 qadevOOo/tests/java/ifc/xml/sax/_XDocumentHandler.java            |    4 -
 wizards/com/sun/star/wizards/report/ReportWizard.java             |    3 -
 17 files changed, 38 insertions(+), 59 deletions(-)

New commits:
commit eda52500c72c56149c10f2ef73474b4ac1ae0552
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Nov 5 13:36:36 2015 +0200

    java:avoid empty if statements
    
    Change-Id: I9c66dd5331f422d8d6271157fece2b346d8b3756

diff --git a/bean/qa/complex/bean/OOoBeanTest.java b/bean/qa/complex/bean/OOoBeanTest.java
index 22c5fb4..eebf372 100644
--- a/bean/qa/complex/bean/OOoBeanTest.java
+++ b/bean/qa/complex/bean/OOoBeanTest.java
@@ -541,9 +541,6 @@ public class OOoBeanTest
                         break;
                     }
                 }
-                else
-                {
-                }
 
             } finally {
                 bean.stopOOoConnection();
diff --git a/qadevOOo/tests/java/ifc/beans/_XHierarchicalPropertySet.java b/qadevOOo/tests/java/ifc/beans/_XHierarchicalPropertySet.java
index dd19cf8..16ce506 100644
--- a/qadevOOo/tests/java/ifc/beans/_XHierarchicalPropertySet.java
+++ b/qadevOOo/tests/java/ifc/beans/_XHierarchicalPropertySet.java
@@ -33,8 +33,7 @@ public class _XHierarchicalPropertySet extends MultiMethodTest {
         XHierarchicalPropertySetInfo hpsi = oObj.getHierarchicalPropertySetInfo();
         boolean res = true;
 
-        if (hpsi != null) {
-        } else {
+        if (hpsi == null) {
             log.println(
                     "The component doesn't provide HierarchicalPropertySetInfo");
             tRes.tested("getHierarchicalPropertySetInfo()",
diff --git a/qadevOOo/tests/java/ifc/beans/_XMultiHierarchicalPropertySet.java b/qadevOOo/tests/java/ifc/beans/_XMultiHierarchicalPropertySet.java
index 9bcc343..10b1c8c 100644
--- a/qadevOOo/tests/java/ifc/beans/_XMultiHierarchicalPropertySet.java
+++ b/qadevOOo/tests/java/ifc/beans/_XMultiHierarchicalPropertySet.java
@@ -33,8 +33,7 @@ public class _XMultiHierarchicalPropertySet extends MultiMethodTest {
         XHierarchicalPropertySetInfo hpsi = oObj.getHierarchicalPropertySetInfo();
         boolean res = true;
 
-        if (hpsi != null) {
-        } else {
+        if (hpsi == null) {
             log.println(
                     "The component doesn't provide HierarchicalPropertySetInfo");
             tRes.tested("getHierarchicalPropertySetInfo()",
diff --git a/qadevOOo/tests/java/ifc/i18n/_XCalendar.java b/qadevOOo/tests/java/ifc/i18n/_XCalendar.java
index 46a0b15..102bf7f 100644
--- a/qadevOOo/tests/java/ifc/i18n/_XCalendar.java
+++ b/qadevOOo/tests/java/ifc/i18n/_XCalendar.java
@@ -111,8 +111,7 @@ public class _XCalendar extends MultiMethodTest {
                           ", Country: "+ installed_locales[i].Country +
                           ", Variant: "+ installed_locales[i].Country;
             oObj.loadDefaultCalendar(installed_locales[i]);
-            if (oObj.getLoadedCalendar().Default) {
-            } else {
+            if (!oObj.getLoadedCalendar().Default) {
                 log.println(lang + " ... FAILED");
             }
             res &= oObj.getLoadedCalendar().Default;
@@ -135,8 +134,7 @@ public class _XCalendar extends MultiMethodTest {
                           ", Variant: "+ installed_locales[i].Country;
             calendars[i] = oObj.getAllCalendars(installed_locales[i]);
             count[i] = calendars[i].length-1;
-            if (calendars[i].length > 0) {
-            } else {
+            if (calendars[i].length <= 0) {
                 log.println(lang + " ... FAILED");
             }
             res &= (calendars[i].length > 0);
@@ -163,8 +161,7 @@ public class _XCalendar extends MultiMethodTest {
                           ", Country: "+ installed_locales[i].Country +
                           ", Variant: "+ installed_locales[i].Country;
             oObj.loadCalendar(calendars[i][0], installed_locales[i]);
-            if (calendars[i][0].equals(oObj.getLoadedCalendar().Name)) {
-            } else {
+            if (!calendars[i][0].equals(oObj.getLoadedCalendar().Name)) {
                 log.println(lang + " ... FAILED");
             }
             res &= calendars[i][0].equals(oObj.getLoadedCalendar().Name);
@@ -192,8 +189,7 @@ public class _XCalendar extends MultiMethodTest {
                           ", Country: "+ installed_locales[i].Country +
                           ", Variant: "+ installed_locales[i].Country;
             oObj.loadCalendar(calendars[i][0], installed_locales[i]);
-            if (calendars[i][0].equals(oObj.getLoadedCalendar().Name)) {
-            } else {
+            if (!calendars[i][0].equals(oObj.getLoadedCalendar().Name)) {
                 log.println(lang + " ... FAILED");
             }
             res &= calendars[i][0].equals(oObj.getLoadedCalendar().Name);
@@ -219,8 +215,7 @@ public class _XCalendar extends MultiMethodTest {
                           ", Variant: "+ installed_locales[i].Country;
             oObj.loadCalendar(calendars[i][0], installed_locales[i]);
             String uID = oObj.getUniqueID();
-            if (uID.equals(calendars[i][0])) {
-            } else {
+            if (!uID.equals(calendars[i][0])) {
                 log.println(lang + " ... FAILED");
             }
             res &= uID.equals(calendars[i][0]);
@@ -244,8 +239,7 @@ public class _XCalendar extends MultiMethodTest {
                           ", Variant: "+ installed_locales[i].Country;
             oObj.setDateTime(newDTime);
             double aDTime = oObj.getDateTime();
-            if (aDTime == newDTime) {
-            } else {
+            if (aDTime != newDTime) {
                 log.println(lang + " ... FAILED");
             }
             res &= (aDTime == newDTime);
@@ -269,8 +263,7 @@ public class _XCalendar extends MultiMethodTest {
                           ", Variant: "+ installed_locales[i].Country;
             oObj.setDateTime(newDTime);
             double aDTime = oObj.getDateTime();
-            if (aDTime == newDTime) {
-            } else {
+            if (aDTime != newDTime) {
                 log.println(lang + " ... FAILED");
             }
             res &= (aDTime == newDTime);
diff --git a/qadevOOo/tests/java/ifc/io/_XDataOutputStream.java b/qadevOOo/tests/java/ifc/io/_XDataOutputStream.java
index 51dcff4..3643c06 100644
--- a/qadevOOo/tests/java/ifc/io/_XDataOutputStream.java
+++ b/qadevOOo/tests/java/ifc/io/_XDataOutputStream.java
@@ -71,29 +71,27 @@ public class _XDataOutputStream extends MultiMethodTest {
 
             if (dataElem instanceof Boolean) {
                 ((Boolean)dataElem).booleanValue();
-            } else
-            if (dataElem instanceof Byte) {
+            }
+            else if (dataElem instanceof Byte) {
                 ((Byte)dataElem).byteValue();
-            } else
-            if (dataElem instanceof Character) {
+            }
+            else if (dataElem instanceof Character) {
                 ((Character)dataElem).charValue();
-            } else
-            if (dataElem instanceof Short) {
+            }
+            else if (dataElem instanceof Short) {
                 ((Short)dataElem).shortValue();
-            } else
-            if (dataElem instanceof Integer) {
+            }
+            else if (dataElem instanceof Integer) {
                 ((Integer)dataElem).intValue();
-            } else
-            if (dataElem instanceof Long) {
+            }
+            else if (dataElem instanceof Long) {
                 ((Long)dataElem).longValue();
-            } else
-            if (dataElem instanceof Float) {
+            }
+            else if (dataElem instanceof Float) {
                 ((Float)dataElem).floatValue();
-            } else
-            if (dataElem instanceof Double) {
+            }
+            else if (dataElem instanceof Double) {
                 ((Double)dataElem).doubleValue();
-            } else
-            if (dataElem instanceof String) {
             }
         }
     }
diff --git a/qadevOOo/tests/java/ifc/sheet/_XCellRangeMovement.java b/qadevOOo/tests/java/ifc/sheet/_XCellRangeMovement.java
index ebd7c80..1d0d33c 100644
--- a/qadevOOo/tests/java/ifc/sheet/_XCellRangeMovement.java
+++ b/qadevOOo/tests/java/ifc/sheet/_XCellRangeMovement.java
@@ -119,9 +119,7 @@ public class _XCellRangeMovement extends MultiMethodTest {
             oSheet.getCellByPosition(3,21).setValue(200);
 
             // catch some sleight of hand threads
-            if (oSheet.getCellByPosition(1,21).getValue() == 200){
-            }
-            else{
+            if (oSheet.getCellByPosition(1,21).getValue() != 200){
                 log.println("Cells were already inserted. "+
                     "Delete old cells now");
                 XColumnRowRange oColumnRowRange = UnoRuntime.queryInterface(XColumnRowRange.class, oSheet);
diff --git a/qadevOOo/tests/java/ifc/xml/sax/_XDocumentHandler.java b/qadevOOo/tests/java/ifc/xml/sax/_XDocumentHandler.java
index 93de5ec..4e8b921 100644
--- a/qadevOOo/tests/java/ifc/xml/sax/_XDocumentHandler.java
+++ b/qadevOOo/tests/java/ifc/xml/sax/_XDocumentHandler.java
@@ -148,9 +148,7 @@ public class _XDocumentHandler extends MultiMethodTest {
         if (xmlData == null || checker == null) throw new StatusException
             (Status.failed("Relation wasn't found")) ;
 
-        if (targetDocSet != null){
-
-        }else{
+        if (targetDocSet == null){
             log.println("object relation 'XDocumentHandler.TargetDocumentSetter' not used.");
             log.println("be sure that the test have a target to write throu");
         }
diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java
index c988036..469680e 100644
--- a/wizards/com/sun/star/wizards/report/ReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/ReportWizard.java
@@ -467,9 +467,6 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener
             {
                 sMessage = m_oResource.getResText(UIConsts.RID_REPORT + 92);
             }
-            else
-            {
-            }
             // show a dialog with the error message
             SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMessage);
         }
commit ff3b3bed94b809acbb5b4eb6e52f9b6d8b9398ee
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Nov 5 12:29:43 2015 +0200

    java: make inner classes static where possible
    
    Change-Id: Icc6444ad15d9f4b50858d8c1b1d3adeaeac40926

diff --git a/comphelper/qa/complex/comphelper/Map.java b/comphelper/qa/complex/comphelper/Map.java
index cb6c983..278f5a7 100644
--- a/comphelper/qa/complex/comphelper/Map.java
+++ b/comphelper/qa/complex/comphelper/Map.java
@@ -254,11 +254,11 @@ public class Map
         return someValue;
     }
 
-    private class DummyInterface implements XInterface
+    private static class DummyInterface implements XInterface
     {
     }
 
-    private class DummySet implements XSet
+    private static class DummySet implements XSet
     {
         public boolean has( Object arg0 )       { throw new UnsupportedOperationException( "Not implemented." ); }
         public void insert( Object arg0 )       { throw new UnsupportedOperationException( "Not implemented." ); }
diff --git a/connectivity/qa/complex/connectivity/FlatFileAccess.java b/connectivity/qa/complex/connectivity/FlatFileAccess.java
index c7c961b..43d0eab 100644
--- a/connectivity/qa/complex/connectivity/FlatFileAccess.java
+++ b/connectivity/qa/complex/connectivity/FlatFileAccess.java
@@ -74,7 +74,7 @@ public class FlatFileAccess extends ComplexTestCase
     {
     }
 
-    private class EqualityDate extends Date
+    private static class EqualityDate extends Date
     {
         EqualityDate( short i_day, short i_month, short i_year )
         {
@@ -177,7 +177,7 @@ public class FlatFileAccess extends ComplexTestCase
         Object getValue( final RowSet i_rowSet ) throws SQLException;
     }
 
-    private abstract class RowSetColumnValueGetter implements RowSetValueGetter
+    private static abstract class RowSetColumnValueGetter implements RowSetValueGetter
     {
         RowSetColumnValueGetter( final int i_columnIndex )
         {
@@ -187,7 +187,7 @@ public class FlatFileAccess extends ComplexTestCase
         protected final int m_columnIndex;
     }
 
-    private class RowSetIntGetter extends RowSetColumnValueGetter
+    private static class RowSetIntGetter extends RowSetColumnValueGetter
     {
         RowSetIntGetter( final int i_columnIndex )
         {
@@ -200,7 +200,7 @@ public class FlatFileAccess extends ComplexTestCase
         }
     }
 
-    private class RowSetDateGetter extends RowSetColumnValueGetter
+    private static class RowSetDateGetter extends RowSetColumnValueGetter
     {
         RowSetDateGetter( final int i_columnIndex )
         {
diff --git a/dbaccess/qa/complex/dbaccess/CopyTableWizard.java b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java
index 20454d24..a9254fa 100644
--- a/dbaccess/qa/complex/dbaccess/CopyTableWizard.java
+++ b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java
@@ -73,7 +73,7 @@ public class CopyTableWizard extends CRMBasedTestCase
     }
 
 
-    private class CopyThread implements Runnable
+    private static class CopyThread implements Runnable
     {
 
         private final XCopyTableWizard copyWizard;
diff --git a/extensions/qa/integration/extensions/ServicesHandler.java b/extensions/qa/integration/extensions/ServicesHandler.java
index 516f2a2..4382c84 100644
--- a/extensions/qa/integration/extensions/ServicesHandler.java
+++ b/extensions/qa/integration/extensions/ServicesHandler.java
@@ -29,7 +29,7 @@ public class ServicesHandler implements XPropertyHandler
     private final XComponentContext   m_context;
     private String[]            m_supportedServices;
 
-    private class ClickHandler implements com.sun.star.awt.XActionListener
+    private static class ClickHandler implements com.sun.star.awt.XActionListener
     {
         XComponentContext   m_context;
         private final String      m_serviceName;
diff --git a/forms/qa/complex/forms/CheckOGroupBoxModel.java b/forms/qa/complex/forms/CheckOGroupBoxModel.java
index 1cf2ceb..284840d 100644
--- a/forms/qa/complex/forms/CheckOGroupBoxModel.java
+++ b/forms/qa/complex/forms/CheckOGroupBoxModel.java
@@ -122,7 +122,7 @@ public class CheckOGroupBoxModel
      * Listener implementation which sets a flag when
      * listener was called.
      */
-    private class MyChangeListener implements XPropertiesChangeListener
+    private static class MyChangeListener implements XPropertiesChangeListener
     {
 
         private boolean propertiesChanged = false;
diff --git a/framework/qa/complex/XUserInputInterception/EventTest.java b/framework/qa/complex/XUserInputInterception/EventTest.java
index 0bc8fce..b2a6f06 100644
--- a/framework/qa/complex/XUserInputInterception/EventTest.java
+++ b/framework/qa/complex/XUserInputInterception/EventTest.java
@@ -400,7 +400,7 @@ public class EventTest {
      * press a key with the <CODE>Robot</CODE> class
      * @see java.awt.Robot
      */
-    private class EventTrigger implements Runnable {
+    private static class EventTrigger implements Runnable {
 
         /**
          * represents an <CODE>EventType</CODE>
diff --git a/framework/qa/complex/framework/autosave/AutoSave.java b/framework/qa/complex/framework/autosave/AutoSave.java
index 8f66ccd..e27724e 100644
--- a/framework/qa/complex/framework/autosave/AutoSave.java
+++ b/framework/qa/complex/framework/autosave/AutoSave.java
@@ -62,7 +62,7 @@ import static org.junit.Assert.*;
 public class AutoSave
 {
 
-    private class AutoSaveListener implements XStatusListener
+    private static class AutoSaveListener implements XStatusListener
     {
         private XDispatch m_xAutoSave;
         private URL m_aRegistration;
diff --git a/framework/qa/complex/imageManager/CheckImageManager.java b/framework/qa/complex/imageManager/CheckImageManager.java
index 21f24b6..a88a96d 100644
--- a/framework/qa/complex/imageManager/CheckImageManager.java
+++ b/framework/qa/complex/imageManager/CheckImageManager.java
@@ -141,7 +141,7 @@ public class CheckImageManager  {
     }
 
 
-    private class OXUIConfigurationListenerImpl implements _XUIConfiguration.XUIConfigurationListenerImpl {
+    private static class OXUIConfigurationListenerImpl implements _XUIConfiguration.XUIConfigurationListenerImpl {
         private boolean triggered = false;
 
         public boolean actionWasTriggered() {
diff --git a/framework/qa/complex/path_substitution/PathSubstitutionTest.java b/framework/qa/complex/path_substitution/PathSubstitutionTest.java
index 8615de6..8d85ade 100644
--- a/framework/qa/complex/path_substitution/PathSubstitutionTest.java
+++ b/framework/qa/complex/path_substitution/PathSubstitutionTest.java
@@ -214,7 +214,7 @@ public class PathSubstitutionTest
      * Class for containing the substitution variables with their
      * values and some information.
      */
-    private class VariableContainer
+    private static class VariableContainer
     {
 
         public ArrayList<String> varName;


More information about the Libreoffice-commits mailing list