#Not looping through all data

1 messages · Page 1 of 1 (latest)

versed agateBOT
#

Detected code, here are some useful tools:

Formatted code
public void getJasperDisDataFromClient2() {
  RestTemplate restTemplate = new RestTemplate();
  String URL = "...";
  String jasperDisData = (String) restTemplate.execute(URL, HttpMethod.GET, null , (clientHttpResponse -> {
    int bufferSize = 250 * 1024 * 1024;
    InputStreamReader reader = new InputStreamReader(clientHttpResponse.getBody(), StandardCharsets.UTF_8);
    Scanner scanner = new Scanner(new BufferedReader(reader, bufferSize));
    //while ((line = bufferedReader.readLine()) != null)
    if (scanner.hasNextLine()) {
      scanner.nextLine();
    }
    int counter = 0;
    while (scanner.hasNextLine()) {
      String line = scanner.nextLine();
      String[] parts = line.split(",");
      if (parts.length >= 9) {
        String equipmentDescr = parts[0] ;
        ...try {
          Double latitude = parseDouble(parts[3] );
          Double longitude = parseDouble(parts[4] );
          ...JasperDis jasperDis = new JasperDis(equipmentDescr, portAccessID, pathAssetID, latitude, longitude, customerAddress, customerCity, customerCounty, customerType, customerMarketSegment);
          jasperDisService.createJasperDis(jasperDis);
        } catch (NumberFormatException nfe) {
          System.out.println(nfe.getMessage());
        }
      }
      else {
        System.out.println("Invalid input string");
      }
      counter++;
    }
    return "test";
  }
  ));
}
#

<@&1004656351647117403> please have a look, thanks.

versed agateBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

timber latch
#

Check the response, does it actually return all the rows?

#

Also, are you sure all rows contain at least 8 comma's

versed agateBOT
#

Closed the thread due to inactivity.

If your question was not resolved yet, feel free to just post a message to reopen it, or create a new thread. But try to improve the quality of your question to make it easier to help you 👍