diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-05 13:36:36 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-11-05 13:43:02 +0200 |
commit | eda52500c72c56149c10f2ef73474b4ac1ae0552 (patch) | |
tree | 59af47d32f1de7e33c7d0880b04972b02fbf7a7b /qadevOOo | |
parent | ff3b3bed94b809acbb5b4eb6e52f9b6d8b9398ee (diff) |
java:avoid empty if statements
Change-Id: I9c66dd5331f422d8d6271157fece2b346d8b3756
Diffstat (limited to 'qadevOOo')
6 files changed, 25 insertions, 40 deletions
diff --git a/qadevOOo/tests/java/ifc/beans/_XHierarchicalPropertySet.java b/qadevOOo/tests/java/ifc/beans/_XHierarchicalPropertySet.java index dd19cf8f52a4..16ce506c6fae 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 9bcc3436e1c1..10b1c8ce9937 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 46a0b15b4973..102bf7fc9b28 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 51dcff41c2f0..3643c06e4ce6 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 ebd7c8020fa7..1d0d33c327e4 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 93de5ec39046..4e8b9216618e 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"); } |