Skip to content

Commit

Permalink
added the stack trace
Browse files Browse the repository at this point in the history
  • Loading branch information
annaibm committed May 29, 2024
1 parent 2649846 commit 4a4285a
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/org/testKitGen/TestDivider.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public boolean accept(File f) {
return map;
}

private Map<String, Integer> getDataFromTRSS() {
private Map<String, Integer> getDataFromTRSS() throws ParseException {
String impl = arg.getBuildImpl();
String plat = arg.getPlat();
if (impl.equals("") || plat.equals("")) {
Expand All @@ -236,10 +236,22 @@ private Map<String, Integer> getDataFromTRSS() {
System.out.println("Warning: cannot get data from TRSS.");
return map;
}
try (InputStream responseStream = process.getInputStream();
Reader responseReader = new BufferedReader(new InputStreamReader(responseStream))) {
parseDuration(responseReader, map);
} catch (IOException | ParseException e) {
try (InputStream responseStream = process.getInputStream();
Reader responseReader = new BufferedReader(new InputStreamReader(responseStream))) {
StringBuilder responseBuilder = new StringBuilder();
String line;
while ((line = ((BufferedReader) responseReader).readLine()) != null) {
responseBuilder.append(line);
}
String responseData = responseBuilder.toString();
System.out.println("Received data: " + responseData); // Log the response data
if (!responseData.isEmpty()) {
parseDuration(responseData, map); // Assuming parseDuration can now handle a String
} else {
System.out.println("No data received from TRSS. Using cached data.");
// Consider loading cached data here
}
} catch (IOException e) {
System.out.println("Warning: cannot parse data from TRSS.");
e.printStackTrace();
}
Expand Down

0 comments on commit 4a4285a

Please sign in to comment.