diff --git a/pom.xml b/pom.xml
index 20ab650..02c6a88 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.github.immueggpain
simple-streaming
- 0.1.0
+ 0.1.1
UTF-8
diff --git a/src/main/java/com/github/immueggpain/simplestreaming/Launcher.java b/src/main/java/com/github/immueggpain/simplestreaming/Launcher.java
index 9f9345f..2c7a076 100644
--- a/src/main/java/com/github/immueggpain/simplestreaming/Launcher.java
+++ b/src/main/java/com/github/immueggpain/simplestreaming/Launcher.java
@@ -11,7 +11,7 @@
subcommands = { HelpCommand.class, StreamUpload.class, StreamServer.class, Serve.class })
public class Launcher implements Callable {
- public static final String VERSTR = "0.1.0";
+ public static final String VERSTR = "0.1.1";
public static final int LOCAL_PORT = 2233;
public static final int LOCAL_OVPN_PORT = 1194;
public static final int BUFLEN = 1024 * 256;
diff --git a/src/main/java/com/github/immueggpain/simplestreaming/StreamUpload.java b/src/main/java/com/github/immueggpain/simplestreaming/StreamUpload.java
index 430a0e2..ee2a23b 100644
--- a/src/main/java/com/github/immueggpain/simplestreaming/StreamUpload.java
+++ b/src/main/java/com/github/immueggpain/simplestreaming/StreamUpload.java
@@ -1,5 +1,6 @@
package com.github.immueggpain.simplestreaming;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.RandomAccessFile;
@@ -20,13 +21,13 @@ public class StreamUpload implements Callable {
@Override
public Void call() throws Exception {
- try {
- Socket socket = new Socket(serverName, serverPort);
+ try (Socket socket = new Socket(serverName, serverPort)) {
OutputStream os = socket.getOutputStream();
byte[] buf = new byte[Launcher.BUFLEN];
- RandomAccessFile file = new RandomAccessFile(filepath, "r");
+ RandomAccessFile file;
+ file = new RandomAccessFile(filepath, "r");
file.seek(file.length());
try {
@@ -43,9 +44,11 @@ public Void call() throws Exception {
e.printStackTrace();
}
- System.out.println("close socket");
file.close();
- socket.close();
+
+ } catch (FileNotFoundException e) {
+ System.out.println("File not found, please start OBS and record first!");
+ return null;
} catch (Exception e) {
e.printStackTrace();
}