Fix scanner errors

This commit is contained in:
tom79 2019-08-17 17:10:24 +02:00
parent 2310af6d10
commit baf0c8f1af
2 changed files with 45 additions and 16 deletions

View File

@ -750,7 +750,6 @@ public class API {
instanceNodeInfo.setName("GNU"); instanceNodeInfo.setName("GNU");
instanceNodeInfo.setVersion("unknown"); instanceNodeInfo.setVersion("unknown");
instanceNodeInfo.setOpenRegistrations(true); instanceNodeInfo.setOpenRegistrations(true);
e1.printStackTrace();
} catch (JSONException e1) { } catch (JSONException e1) {
e1.printStackTrace(); e1.printStackTrace();
} }

View File

@ -198,7 +198,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
@ -252,7 +254,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
@ -296,7 +300,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
@ -331,7 +337,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
@ -398,7 +406,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
@ -458,7 +468,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
@ -512,7 +524,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
@ -556,7 +570,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
@ -606,7 +622,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
@ -998,7 +1016,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
@ -1073,7 +1093,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
@ -1143,7 +1165,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
@ -1205,7 +1229,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();
@ -1272,7 +1298,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpsURLConnection.getResponseCode(); int responseCode = httpsURLConnection.getResponseCode();
@ -1331,7 +1359,9 @@ public class HttpsConnection {
} }
try (Scanner scanner = new Scanner(stream)) { try (Scanner scanner = new Scanner(stream)) {
scanner.useDelimiter("\\Z"); scanner.useDelimiter("\\Z");
error = scanner.next(); if( scanner.hasNext()) {
error = scanner.next();
}
}catch (Exception e){e.printStackTrace();} }catch (Exception e){e.printStackTrace();}
} }
int responseCode = httpURLConnection.getResponseCode(); int responseCode = httpURLConnection.getResponseCode();