fix sublime plugin issue with ui mode, object prototype pollution, try for ui api
This commit is contained in:
@@ -26,6 +26,8 @@ import com.stardust.util.AssetsCache;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/5/3.
|
||||
*/
|
||||
|
||||
@@ -87,26 +87,22 @@ public class SublimePluginClient {
|
||||
if (mSocket == null) {
|
||||
throw new IllegalStateException("Socket is not listening ");
|
||||
}
|
||||
if (Looper.myLooper() == Looper.getMainLooper()) {
|
||||
if (mExecutor == null) {
|
||||
mExecutor = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
mExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
send(object);
|
||||
if (mExecutor == null) {
|
||||
mExecutor = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
mExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
mOutputStream.write(object.toString().getBytes());
|
||||
mOutputStream.write("\n".getBytes());
|
||||
mOutputStream.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
tryClose();
|
||||
}
|
||||
});
|
||||
}
|
||||
try {
|
||||
mOutputStream.write(object.toString().getBytes());
|
||||
mOutputStream.write("\n".getBytes());
|
||||
mOutputStream.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
tryClose();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user