Skip to content

Commit 739f5c7

Browse files
committed
SimpleHttpClient merge and unnec. "else " removed
1 parent 91b97cc commit 739f5c7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sources/net.sf.j2s.java.core/src/javajs/http/SimpleHttpClient.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,25 +289,26 @@ public HttpRequest clearFormParts(String name) {
289289
private byte[] toBytes(Object data) {
290290
if (data == null || data instanceof byte[]) {
291291
return (byte[]) data;
292-
} else if (data instanceof File) {
292+
}
293+
if (data instanceof File) {
293294
try (FileInputStream fis = new FileInputStream((File) data)) {
294295
return getBytes(fis);
295296
}
296297
catch (IOException e) {
297298
e.printStackTrace();
298299
return null;
299300
}
300-
} else if (data instanceof InputStream) {
301+
}
302+
if (data instanceof InputStream) {
301303
try (InputStream is = (InputStream) data) {
302304
return getBytes(is);
303305
}
304306
catch (IOException e) {
305307
e.printStackTrace();
306308
return null;
307309
}
308-
} else {
309-
return data.toString().getBytes();
310310
}
311+
return data.toString().getBytes();
311312
}
312313

313314
@Override

0 commit comments

Comments
 (0)