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() {
221221 if (matcher .find ()) {
222222 charset = matcher .group (1 );
223223 } 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+ }
225232 }
226233 }
227234 }
@@ -552,9 +559,11 @@ private void request() {
552559 if (checkAbort ()) return ; // exception caused by abort action
553560 //e.printStackTrace();
554561 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+ }
558567 }
559568 connection = null ;
560569 readyState = 0 ;
Original file line number Diff line number Diff line change @@ -22,8 +22,13 @@ private SimpleStore() {
2222 isLocalFile = true;
2323}
2424if (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+ }
2732}
2833var isLocal = false;
2934try {
@@ -41,10 +46,10 @@ private SimpleStore() {
4146}
4247 */ {
4348 File storeFile = new File (System .getProperty ("user.home" ), ".java2script.store" );
44- this .store = new INIFileStore (storeFile .getAbsolutePath ());
49+ this .store = new INIFileStore (storeFile .getAbsolutePath ());
4550 }
4651 }
47-
52+
4853 public static SimpleStore getDefault () {
4954 if (singleton == null ) {
5055 singleton = new SimpleStore ();
You can’t perform that action at this time.
0 commit comments