diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-20 13:48:58 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-10-07 13:20:00 +0200 |
commit | 610f3388c781055fcfc3f1ea8a027b1b9cbc5bae (patch) | |
tree | 563e9c044e7261c6e9d60adedb2b2481227379f7 | |
parent | 831051f55e22e909cc140e3ec4d1aae282a92fcd (diff) |
java: no need to check for null before calling instanceof
the instanceof check returns false when passed a null value
Change-Id: I7742d0d9cf25ef23d9adee7328f701c7efeea8b5
6 files changed, 7 insertions, 7 deletions
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java index 9ceb74d46027..62ccaa401f0c 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java @@ -1603,7 +1603,7 @@ class util static boolean isVoidAny(Object obj) { boolean ret= false; - if( obj != null && obj instanceof Any) + if(obj instanceof Any) { Any a= (Any) obj; if( a.getType().getTypeClass().equals( TypeClass.INTERFACE) diff --git a/jurt/com/sun/star/comp/loader/JavaLoader.java b/jurt/com/sun/star/comp/loader/JavaLoader.java index 4298d0b756d5..7649d1021253 100644 --- a/jurt/com/sun/star/comp/loader/JavaLoader.java +++ b/jurt/com/sun/star/comp/loader/JavaLoader.java @@ -323,7 +323,7 @@ public class JavaLoader implements XImplementationLoader, try { if (null != compfac_method) { Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } ); - if (null == ret || !(ret instanceof XSingleComponentFactory)) + if (!(ret instanceof XSingleComponentFactory)) throw new CannotActivateFactoryException( "No factory object for " + implementationName ); diff --git a/qadevOOo/runner/lib/Parameters.java b/qadevOOo/runner/lib/Parameters.java index 8c05d778ba9c..0e1f6ea242f1 100644 --- a/qadevOOo/runner/lib/Parameters.java +++ b/qadevOOo/runner/lib/Parameters.java @@ -71,7 +71,7 @@ public class Parameters implements XPropertySet { public String get(String paramName) { Object res = parameters.get(paramName); - if (res != null && res instanceof String) + if (res instanceof String) return (String)res; if (defaults != null) diff --git a/qadevOOo/runner/util/SysUtils.java b/qadevOOo/runner/util/SysUtils.java index fbcd0cc6f3e8..cf4b3b56cf4b 100644 --- a/qadevOOo/runner/util/SysUtils.java +++ b/qadevOOo/runner/util/SysUtils.java @@ -61,7 +61,7 @@ public class SysUtils { for (int i = 0; i < dfs.length; i++) { if (dfs[i].MimeType.startsWith("text/plain")) { Object data = xTrans.getTransferData(dfs[i]); - if (data != null && data instanceof String) { + if (data instanceof String) { return (String) data; } } diff --git a/qadevOOo/tests/java/ifc/sheet/_XCellRangesQuery.java b/qadevOOo/tests/java/ifc/sheet/_XCellRangesQuery.java index 36761c342f3d..bc8129f6e1ed 100644 --- a/qadevOOo/tests/java/ifc/sheet/_XCellRangesQuery.java +++ b/qadevOOo/tests/java/ifc/sheet/_XCellRangesQuery.java @@ -95,7 +95,7 @@ public class _XCellRangesQuery extends MultiMethodTest { // and the environment has to be disposed: this is necessary for objects // that do not make entries on the sheet themselves Object o = tEnv.getObjRelation("XCellRangesQuery.CREATEENTRIES"); - if (o != null && o instanceof Boolean) { + if (o instanceof Boolean) { bMakeEntriesAndDispose = ((Boolean)o).booleanValue(); } if(bMakeEntriesAndDispose) { diff --git a/toolkit/test/accessibility/AccessibilityTreeModelBase.java b/toolkit/test/accessibility/AccessibilityTreeModelBase.java index b15379e7d994..5ff2d96c9e48 100644 --- a/toolkit/test/accessibility/AccessibilityTreeModelBase.java +++ b/toolkit/test/accessibility/AccessibilityTreeModelBase.java @@ -52,7 +52,7 @@ public class AccessibilityTreeModelBase Object aChild = null; try { - if (aParent != null && aParent instanceof AccessibleTreeNode) + if (aParent instanceof AccessibleTreeNode) aChild = ((AccessibleTreeNode)aParent).getChild(nIndex); else System.out.println ("getChild called for unknown parent node"); @@ -69,7 +69,7 @@ public class AccessibilityTreeModelBase Object aChild = null; try { - if (aParent != null && aParent instanceof AccessibleTreeNode) + if (aParent instanceof AccessibleTreeNode) aChild = ((AccessibleTreeNode)aParent).getChildNoCreate(nIndex); else System.out.println ("getChild called for unknown parent node"); |