Skip to content

Commit 1e52797

Browse files
author
zhourenjian
committed
Merge from branche 3.3
1 parent eb1a67d commit 1e52797

File tree

2 files changed

+34
-20
lines changed

2 files changed

+34
-20
lines changed

src/net/sf/j2s/core/astvisitors/ASTVariableVisitor.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,20 @@ protected String checkConstantValue(Expression node) {
204204
}
205205
return buffer.toString();
206206
}
207+
if (constValue != null && (constValue instanceof String)) {
208+
StringBuffer buffer = new StringBuffer();
209+
String str = (String) constValue;
210+
if (str.length() > 20) {
211+
return null;
212+
}
213+
buffer.append("\"");
214+
buffer.append(str.replaceAll("\\\\", "\\\\\\\\")
215+
.replaceAll("\r", "\\\\r")
216+
.replaceAll("\n", "\\\\n")
217+
.replaceAll("\"", "\\\\\""));
218+
buffer.append("\"");
219+
return buffer.toString();
220+
}
207221
return null;
208222
}
209223
}

src/net/sf/j2s/core/hotspot/HotspotWorker.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -174,31 +174,31 @@ void sendLatestHotspot(long session, PrintStream ps) throws IOException {
174174
ps.write(EOL);
175175
StringBuffer strBuf = new StringBuffer();
176176
strBuf.append("ClazzLoader.updateHotspot (");
177-
long time = new Date().getTime();
178-
while (new Date().getTime() - time < 5000) {
177+
// long time = new Date().getTime();
178+
// while (new Date().getTime() - time < 5000) {
179179
String hotspotJS = InnerHotspotServer.getHotspotJavaScript(session);
180180
if (hotspotJS.length() != 0) {
181181
strBuf.append("\r\n");
182182
strBuf.append(hotspotJS);
183-
break;
184-
} else {
185-
Thread thread = new Thread(new Runnable() {
186-
public void run() {
187-
try {
188-
Thread.sleep(250);
189-
} catch (InterruptedException e) {
190-
e.printStackTrace();
191-
}
192-
}
193-
});
194-
thread.start();
195-
try {
196-
thread.join();
197-
} catch (InterruptedException e) {
198-
e.printStackTrace();
199-
}
183+
// break;
184+
// } else {
185+
// Thread thread = new Thread(new Runnable() {
186+
// public void run() {
187+
// try {
188+
// Thread.sleep(250);
189+
// } catch (InterruptedException e) {
190+
// e.printStackTrace();
191+
// }
192+
// }
193+
// });
194+
// thread.start();
195+
// try {
196+
// thread.join();
197+
// } catch (InterruptedException e) {
198+
// e.printStackTrace();
199+
// }
200200
}
201-
}
201+
// }
202202
strBuf.append("null);");
203203
ps.write(strBuf.toString().getBytes("utf-8"));
204204
}

0 commit comments

Comments
 (0)