better messages
This commit is contained in:
parent
bcae781794
commit
33f8aeb123
|
@ -29,10 +29,11 @@ public class Online {
|
||||||
* blocking call for http file upload
|
* blocking call for http file upload
|
||||||
*/
|
*/
|
||||||
public static UploadResult upload(File fileName, String authTokenValue) {
|
public static UploadResult upload(File fileName, String authTokenValue) {
|
||||||
try {
|
HttpClient httpclient = new DefaultHttpClient();
|
||||||
HttpClient httpclient = new DefaultHttpClient();
|
HttpPost httpPost = new HttpPost(url);
|
||||||
HttpPost httpPost = new HttpPost(url);
|
|
||||||
|
|
||||||
|
String responseString;
|
||||||
|
try {
|
||||||
FileBody uploadFilePart = new FileBody(fileName);
|
FileBody uploadFilePart = new FileBody(fileName);
|
||||||
MultipartEntity reqEntity = new MultipartEntity();
|
MultipartEntity reqEntity = new MultipartEntity();
|
||||||
reqEntity.addPart("upload-file", uploadFilePart);
|
reqEntity.addPart("upload-file", uploadFilePart);
|
||||||
|
@ -43,8 +44,14 @@ public class Online {
|
||||||
HttpResponse response = httpclient.execute(httpPost);
|
HttpResponse response = httpclient.execute(httpPost);
|
||||||
System.out.println("response=" + response);
|
System.out.println("response=" + response);
|
||||||
System.out.println("code " + response.getStatusLine().getStatusCode());
|
System.out.println("code " + response.getStatusLine().getStatusCode());
|
||||||
|
responseString = HttpUtil.getResponse(response);
|
||||||
|
|
||||||
JSONObject object = HttpUtil.getJsonResponse(HttpUtil.getResponse(response));
|
} catch (IOException e) {
|
||||||
|
return new UploadResult(true, "Upload io ERROR " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject object = HttpUtil.getJsonResponse(responseString);
|
||||||
|
|
||||||
System.out.println("object=" + object);
|
System.out.println("object=" + object);
|
||||||
JSONArray info = (JSONArray) object.get("info");
|
JSONArray info = (JSONArray) object.get("info");
|
||||||
|
@ -57,8 +64,8 @@ public class Online {
|
||||||
return new UploadResult(false, info);
|
return new UploadResult(false, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException | ParseException e) {
|
} catch (ParseException e) {
|
||||||
return new UploadResult(true, "Error " + e);
|
return new UploadResult(true, "Upload Error " + responseString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,8 @@ public class PluginEntry implements TsPluginBody {
|
||||||
System.out.println("PluginEntry init " + this);
|
System.out.println("PluginEntry init " + this);
|
||||||
|
|
||||||
if (isLauncherTooOld()) {
|
if (isLauncherTooOld()) {
|
||||||
content.add(new JLabel("Please manually install latest plugin version"));
|
content.add(new JLabel("<html>Please manually install latest plugin version<br/>Usually we can update to latest version but this time there was a major change.<br/>" +
|
||||||
|
"Please use TunerStudio controls to update to plugin from recent rusEFI bundle."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue