File tree Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,14 @@ public String getResponseText() {
221
221
if (matcher .find ()) {
222
222
charset = matcher .group (1 );
223
223
} else {
224
- responseText = tmp ;
224
+ matcher = Pattern .compile (
225
+ "<meta.*\\ s+charset\\ s*=\\ s*[\' \" ]([^'\" ]*)\\ s*[\' \" ].*>" ,
226
+ Pattern .MULTILINE | Pattern .CASE_INSENSITIVE ).matcher (tmp );
227
+ if (matcher .find ()) {
228
+ charset = matcher .group (1 );
229
+ } else {
230
+ responseText = tmp ;
231
+ }
225
232
}
226
233
}
227
234
}
@@ -552,9 +559,11 @@ private void request() {
552
559
if (checkAbort ()) return ; // exception caused by abort action
553
560
//e.printStackTrace();
554
561
status = connection .getResponseCode ();
555
- readyState = 4 ;
556
- if (onreadystatechange != null ) {
557
- onreadystatechange .onLoaded ();
562
+ if (readyState != 4 ) {
563
+ readyState = 4 ;
564
+ if (onreadystatechange != null ) {
565
+ onreadystatechange .onLoaded ();
566
+ }
558
567
}
559
568
connection = null ;
560
569
readyState = 0 ;
Original file line number Diff line number Diff line change @@ -22,8 +22,13 @@ private SimpleStore() {
22
22
isLocalFile = true;
23
23
}
24
24
if (window["j2s.html5.store"] && window["localStorage"] != null && (ua.indexOf ("gecko/") == -1 || !isLocalFile)) {
25
- this.store = new net.sf.j2s.store.HTML5LocalStorage ();
26
- return;
25
+ try {
26
+ localStorage.setItem('net.sf.j2s.test', '1');
27
+ localStorage.removeItem('net.sf.j2s.test');
28
+ this.store = new net.sf.j2s.store.HTML5LocalStorage ();
29
+ return;
30
+ } catch (error) {
31
+ }
27
32
}
28
33
var isLocal = false;
29
34
try {
@@ -41,10 +46,10 @@ private SimpleStore() {
41
46
}
42
47
*/ {
43
48
File storeFile = new File (System .getProperty ("user.home" ), ".java2script.store" );
44
- this .store = new INIFileStore (storeFile .getAbsolutePath ());
49
+ this .store = new INIFileStore (storeFile .getAbsolutePath ());
45
50
}
46
51
}
47
-
52
+
48
53
public static SimpleStore getDefault () {
49
54
if (singleton == null ) {
50
55
singleton = new SimpleStore ();
You can’t perform that action at this time.
0 commit comments