:bug: don't close source after processing partial request without cac… · passiontim/AndroidVideoCache@6c996ea · GitHub
Skip to content

Commit 6c996ea

Browse files
committed
🐛 don't close source after processing partial request without cache danikula#43
prevent invalid calling source.close() in different threads to avoid crashes on Lollipop (danikula#37, danikula#29, danikula#63, danikula#66)
1 parent 582832f commit 6c996ea

5 files changed

Lines changed: 121 additions & 27 deletions

File tree

files/space.jpg

1.03 MB
Loading

library/src/main/java/com/danikula/videocache/HttpProxyCache.java

Lines changed: 4 additions & 4 deletions

library/src/main/java/com/danikula/videocache/HttpUrlSource.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ public void close() throws ProxyCacheException {
7878
if (connection != null) {
7979
try {
8080
connection.disconnect();
81-
} catch (NullPointerException e) {
82-
// https://github.com/danikula/AndroidVideoCache/issues/32
83-
// https://github.com/danikula/AndroidVideoCache/issues/29
84-
throw new ProxyCacheException("Error disconnecting HttpUrlConnection", e);
81+
} catch (NullPointerException | IllegalArgumentException e) {
82+
String message = "Wait... but why? WTF!? " +
83+
"Really shouldn't happen any more after fixing https://github.com/danikula/AndroidVideoCache/issues/43. " +
84+
"If you read it on your device log, please, notify me danikula@gmail.com or create issue here https://github.com/danikula/AndroidVideoCache/issues.";
85+
throw new RuntimeException(message, e);
8586
}
8687
}
8788
}

test/src/main/assets/space.jpg

1.03 MB
Loading

test/src/test/java/com/danikula/videocache/HttpProxyCacheTest.java

Lines changed: 112 additions & 19 deletions

0 commit comments

Comments
 (0)