now mostly streamified!
[fanfix.git] / src / be / nikiroo / utils / serial / server / ConnectAction.java
index 25bde2458ee4789d8436918621c791e2085c0ae6..d359e08b217f623ddde1749090aeefc2391deffd 100644 (file)
@@ -364,6 +364,7 @@ abstract class ConnectAction {
         * @throws java.lang.NullPointerException
         *             for Objects only: if the counter part has no data to send
         */
+       @SuppressWarnings("resource")
        private Object rec(boolean asString) throws IOException,
                        NoSuchFieldException, NoSuchMethodException,
                        ClassNotFoundException, java.lang.NullPointerException {
@@ -375,7 +376,7 @@ abstract class ConnectAction {
                                        contentToSend = false;
                                }
 
-                               if (in.next()) {
+                               if (in.next() && !in.eof()) {
                                        // TODO: could be possible to check for non-crypt and only
                                        // do it for crypt
                                        InputStream read = new ReplaceInputStream(in.open(), //