Skip to content

Commit 565d5de

Browse files
committed
Simplify *Transfer check* methods
* instanceof already checks nulls * String.isEmpty used
1 parent 3d9d8fb commit 565d5de

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,6 @@ protected Object nativeToJava(TransferData transferData) {
192192
}
193193

194194
boolean checkByteArray(Object object) {
195-
return (object != null && object instanceof byte[] && ((byte[])object).length > 0);
195+
return (object instanceof byte[] && ((byte[])object).length > 0);
196196
}
197197
}

bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/HTMLTransfer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ protected String[] getTypeNames() {
122122
}
123123

124124
boolean checkHTML(Object object) {
125-
return (object != null && object instanceof String && ((String)object).length() > 0);
125+
return (object instanceof String && !((String)object).isEmpty());
126126
}
127127

128128
@Override

bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ImageTransfer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ protected String[] getTypeNames(){
171171
}
172172

173173
boolean checkImage(Object object) {
174-
if (object == null || !(object instanceof ImageData)) return false;
174+
if (!(object instanceof ImageData)) return false;
175175
return true;
176176
}
177177

bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected String[] getTypeNames() {
118118
}
119119

120120
boolean checkRTF(Object object) {
121-
return (object != null && object instanceof String && ((String)object).length() > 0);
121+
return (object instanceof String && !((String)object).isEmpty());
122122
}
123123

124124
@Override

bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ protected String[] getTypeNames() {
161161
}
162162

163163
boolean checkText(Object object) {
164-
return (object != null && object instanceof String && ((String)object).length() > 0);
164+
return (object instanceof String && !((String)object).isEmpty());
165165
}
166166

167167
@Override

0 commit comments

Comments
 (0)