add debug information.

This commit is contained in:
huanghongxun
2015-11-22 17:50:00 +08:00
parent 2dede7dea1
commit c76b0e0ffb
9 changed files with 36 additions and 12 deletions

View File

@@ -105,17 +105,18 @@ public final class NetUtils {
con.setDoOutput(true);
con.setDoInput(true);
con.setUseCaches(false);
con.setConnectTimeout(15000);
con.setReadTimeout(15000);
con.setConnectTimeout(30000);
con.setReadTimeout(30000);
con.setRequestProperty("Content-Type", contentType + "; charset=utf-8");
con.setRequestProperty("Content-Length", "" + post.getBytes(DEFAULT_CHARSET).length);
byte[] bytes = post.getBytes(DEFAULT_CHARSET);
con.setRequestProperty("Content-Length", "" + bytes.length);
con.connect();
OutputStream os = null;
try {
os = con.getOutputStream();
IOUtils.write(post, os, DEFAULT_CHARSET);
IOUtils.write(bytes, os);
} finally {
if (os != null)
IOUtils.closeQuietly(os);
IOUtils.closeQuietly(os);
}
String result;
@@ -124,8 +125,7 @@ public final class NetUtils {
is = con.getInputStream();
result = getStreamContent(is);
} catch (IOException ex) {
if (is != null)
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(is);
is = con.getErrorStream();
result = getStreamContent(is);
}

View File

@@ -16,6 +16,7 @@
*/
package org.jackhuang.hellominecraft.views;
import java.awt.Frame;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.SimpleAttributeSet;
@@ -197,7 +198,15 @@ public class LogWindow extends javax.swing.JFrame {
}// </editor-fold>//GEN-END:initComponents
private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed
this.dispose();
boolean flag = false;
for (Frame f : Frame.getFrames()) {
if (f == this) continue;
if (f.isVisible()) flag = true;
}
if (flag)
this.dispose();
else
Utils.shutdownForcely(0);
}//GEN-LAST:event_btnCloseActionPerformed
private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed