aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-10-29 19:12:47 +0100
committerChristian Schneppe <christian@pix-art.de>2017-10-29 19:12:47 +0100
commit6b861d9eb8efa77d649e5899decdf21cbdf1d2ed (patch)
tree8ee77921020644fe787096d6f28198e748319df8 /src/main/java/de
parentdda1ea39a3e6c12f8c160efba6e2bfcde91bb038 (diff)
Jingle: create output stream on demand
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java11
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/jingle/JingleInbandTransport.java2
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/jingle/JingleSocks5Transport.java2
3 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
index d8bb0c21d..54e9bd205 100644
--- a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java
@@ -5,6 +5,7 @@ import android.util.Log;
import android.util.Pair;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
@@ -157,7 +158,14 @@ public class JingleConnection implements Transferable {
return this.mFileInputStream;
}
- public OutputStream getFileOutputStream() {
+ public OutputStream getFileOutputStream() throws IOException {
+ if (this.file == null) {
+ Log.d(Config.LOGTAG, "file object was not assigned");
+ return null;
+ }
+ this.file.getParentFile().mkdirs();
+ this.file.createNewFile();
+ this.mFileOutputStream = AbstractConnectionManager.createOutputStream(this.file, message.getEncryption() == Message.ENCRYPTION_AXOLOTL);
return this.mFileOutputStream;
}
@@ -463,7 +471,6 @@ public class JingleConnection implements Transferable {
this.file.setKeyAndIv(key);
}
}
- this.mFileOutputStream = AbstractConnectionManager.createOutputStream(this.file, message.getEncryption() == Message.ENCRYPTION_AXOLOTL);
this.file.setExpectedSize(size);
message.resetFileParams();
Log.d(Config.LOGTAG, "receiving file: expecting size of " + this.file.getExpectedSize());
diff --git a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleInbandTransport.java b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleInbandTransport.java
index a945f9241..61a87c2b9 100644
--- a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleInbandTransport.java
+++ b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleInbandTransport.java
@@ -100,8 +100,6 @@ public class JingleInbandTransport extends JingleTransport {
try {
this.digest = MessageDigest.getInstance("SHA-1");
digest.reset();
- file.getParentFile().mkdirs();
- file.createNewFile();
this.fileOutputStream = connection.getFileOutputStream();
if (this.fileOutputStream == null) {
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": could not create output stream");
diff --git a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleSocks5Transport.java b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleSocks5Transport.java
index aa30d69a5..595f17e28 100644
--- a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleSocks5Transport.java
+++ b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleSocks5Transport.java
@@ -141,8 +141,6 @@ public class JingleSocks5Transport extends JingleTransport {
digest.reset();
//inputStream.skip(45);
socket.setSoTimeout(30000);
- file.getParentFile().mkdirs();
- file.createNewFile();
fileOutputStream = connection.getFileOutputStream();
if (fileOutputStream == null) {
callback.onFileTransferAborted();