rapiddata

This commit is contained in:
huanghongxun
2015-09-29 13:48:12 +08:00
parent 7916715efa
commit 9b95f9d2d7
25 changed files with 175 additions and 114 deletions

View File

@@ -254,7 +254,7 @@ public class TaskWindow extends javax.swing.JDialog
public void onFailed(Task task) {
SwingUtilities.invokeLater(() -> {
if(taskList == null) return;
failReasons.add(task.getInfo() + ": " + (null == task.getFailReason() ? "No exception" : task.getFailReason().getLocalizedMessage()));
failReasons.add(task.getInfo() + ": " + (null == task.getFailReason() ? "No exception" : (StrUtils.isBlank(task.getFailReason().getLocalizedMessage()) ? task.getFailReason().getClass().getSimpleName() : task.getFailReason().getLocalizedMessage())));
pgsTotal.setMaximum(taskList.taskCount());
pgsTotal.setValue(pgsTotal.getValue() + 1);
int idx = tasks.indexOf(task);

View File

@@ -51,15 +51,14 @@ public final class NetUtils {
public static String getStreamContent(InputStream is, String encoding)
throws IOException {
String result;
try (BufferedReader br = new BufferedReader(new InputStreamReader(is, encoding))) {
result = "";
String line;
while ((line = br.readLine()) != null)
result += line + "\n";
StringBuilder sb = new StringBuilder();
try (InputStreamReader br = new InputStreamReader(is, encoding)) {
int len;
char[] buf = new char[16384];
while ((len = br.read(buf)) != -1)
sb.append(buf, 0, len);
}
if (result.length() < 1) return "";
else return result.substring(0, result.length() - 1);
return sb.toString();
}
public static String doGet(String url, String encoding) throws IOException {