diff --git a/libsrc/uploader/src/com/jpexs/uploader/Uploader.java b/libsrc/uploader/src/com/jpexs/uploader/Uploader.java index c2d7895f7..b20d84abf 100644 --- a/libsrc/uploader/src/com/jpexs/uploader/Uploader.java +++ b/libsrc/uploader/src/com/jpexs/uploader/Uploader.java @@ -5,6 +5,7 @@ */ package com.jpexs.uploader; +import java.awt.Dimension; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -18,6 +19,12 @@ import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.List; +import javax.swing.BoxLayout; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.UIManager; /** * @@ -132,31 +139,31 @@ public class Uploader { * status OK, otherwise an exception is thrown. * @throws IOException */ - public List finish() throws IOException { - List response = new ArrayList<>(); - + public boolean finish(List response) throws IOException { + response.clear(); writer.append(LINE_FEED).flush(); writer.append("--" + boundary + "--").append(LINE_FEED); writer.close(); // checks server's status code first int status = httpConn.getResponseCode(); - if (status == HttpURLConnection.HTTP_OK) { - BufferedReader reader = new BufferedReader(new InputStreamReader( - httpConn.getInputStream())); - String line = null; - while ((line = reader.readLine()) != null) { - response.add(line); - } - reader.close(); - httpConn.disconnect(); - } else { - throw new IOException("Server returned non-OK status: " + status); + BufferedReader reader = new BufferedReader(new InputStreamReader( + httpConn.getInputStream())); + String line = null; + while ((line = reader.readLine()) != null) { + response.add(line); } - - return response; + reader.close(); + httpConn.disconnect(); + + return status == HttpURLConnection.HTTP_OK; } } + + private static List types = new ArrayList<>(); + private static List names = new ArrayList<>(); + private static List values = new ArrayList<>(); + private static List labels = new ArrayList<>(); public static void main(String[] args) { @@ -167,32 +174,99 @@ public class Uploader { String charset = "UTF-8"; String requestURL = args[0]; - - try { + + + for(int i=1;i texts=new ArrayList<>(); + List textLabels = new ArrayList<>(); + List textIndices=new ArrayList<>(); + + for(int i=0;i response = multipart.finish(); + List response = new ArrayList<>(); + boolean ok = multipart.finish(response); for (String line : response) { - System.out.println(line); + if(ok){ + System.out.println(line); + }else{ + System.err.println(line); + } } - System.exit(0); + System.exit(ok?0:1); } catch (IOException ex) { ex.printStackTrace(); System.exit(1); diff --git a/uploader.jar b/uploader.jar index 2713c6011..d012a93f7 100644 Binary files a/uploader.jar and b/uploader.jar differ