mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-18 02:39:44 +00:00
Swap order of closing streams to avoid deadlocking issue on android
This commit is contained in:
parent
ac43a629e6
commit
bcb89d8351
@ -108,6 +108,8 @@ public class JSONTokeniser {
|
|||||||
|
|
||||||
private int _read()
|
private int _read()
|
||||||
{
|
{
|
||||||
|
if (closed)
|
||||||
|
return -1;
|
||||||
int p = pushedChar;
|
int p = pushedChar;
|
||||||
pushedChar = -1;
|
pushedChar = -1;
|
||||||
if (p!=-1)
|
if (p!=-1)
|
||||||
@ -128,6 +130,8 @@ public class JSONTokeniser {
|
|||||||
|
|
||||||
private int _read(char[] buf, int offset, int length)
|
private int _read(char[] buf, int offset, int length)
|
||||||
{
|
{
|
||||||
|
if (closed)
|
||||||
|
return -1;
|
||||||
if (length==0)
|
if (length==0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -528,8 +532,8 @@ public class JSONTokeniser {
|
|||||||
public void close() throws IOException
|
public void close() throws IOException
|
||||||
{
|
{
|
||||||
closed = true;
|
closed = true;
|
||||||
this.reader.close();
|
|
||||||
this.underlyingStream.close();
|
this.underlyingStream.close();
|
||||||
|
this.reader.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user