Skip to content

Commit

Permalink
Fixing some issues with the branch and resolving conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
deoyani committed Apr 8, 2020
1 parent 92419da commit 18f420c
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,4 @@
</repository>
</repositories>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -423,5 +423,49 @@ private void basicValidation() throws IOException {
this.inputfileList = this.bundleRequest.getIncludeFiles();
}
}
/*
* provide a compact printing of the stack trace that focuses on the frame(s) associated
* with a particular class and method
*/
String formatLocation(Throwable ex, String methodname) {
return formatLocation(ex, methodname, this);
}
String formatLocation(Throwable ex, String methodname, Object catcher) {
String cls = catcher.getClass().getName();
StringBuilder sb = new StringBuilder();
StringBuilder ellipses = null;
for (StackTraceElement frame : ex.getStackTrace()) {
if (frame.getClassName().equals(cls) && frame.getMethodName().equals(methodname)) {
if (ellipses != null) {
sb.append(ellipses.toString());
ellipses = null;
}
if (sb.length() > 0) sb.append("\n");
sb.append(" at ").append(frame.getClassName()).append(".").append(frame.getMethodName())
.append(":").append(frame.getLineNumber());
}
else if (sb.length() > 0) {
if (ellipses == null)
ellipses = new StringBuilder("\n");
ellipses.append('.');
}
}
if (sb.length() == 0) sb.append(" at undetected code location");

return sb.toString();
}

private void quietClose(Closeable c) { quietClose(c, null); }
private void quietClose(Closeable c, String name) {
try {
if (c != null) c.close();
} catch (IOException ex) {
StringBuffer sb = new StringBuffer();
if (name != null) sb.append(name).append(": ");
sb.append("Trouble closing open stream: ").append(ex.getMessage());
logger.warn(sb.toString());
}
}


}
2 changes: 1 addition & 1 deletion src/main/resources/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ security:
logging:
file: distservice.log
path : /var/log/dist-service
exception-conversion-word: '%wEx'
exception-conversion-word: '%wEx'
2 changes: 1 addition & 1 deletion src/main/resources/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
<appender-ref ref="SAVE-TO-FILE"/>
</root>

</configuration>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void testBundlePlanWithExceptions()
FileRequest[] inputfileList = new FileRequest[3];
String val1 = "{\"filePath\":\"<html>/1894/license.pdf\",\"downloadUrl\":\"https://s3.amazonaws.com/nist-midas/1894/license.pdf\"}";
String val2 = "{\"filePath\":\"/1895/license2.pdf</body>\",\"downloadUrl\":\"https://s3.amazonaws.com/nist-midas/1894/license.pdf\"}";
String val3 = "{\"filePath\":\"/1896/license3.pdf<i>TEST Erro Here</i>\",\"downloadUrl\":\"https://s3.amazonaws.com/nist-midas/1894/license.pdf\"}";
String val3 = "{\"filePath\":\"/1896/license3.pdf<i>TEST Error Here</i>\",\"downloadUrl\":\"https://s3.amazonaws.com/nist-midas/1894/license.pdf\"}";

ObjectMapper mapper = new ObjectMapper();
FileRequest testval1 = mapper.readValue(val1, FileRequest.class);
Expand All @@ -124,10 +124,12 @@ public void testBundlePlanWithExceptions()
inputfileList[1] = testval2;
inputfileList[2] = testval3;

BundleRequest bFL = new BundleRequest("testdownload-4", inputfileList,0);
BundleRequest bFL = new BundleRequest("testdownload-4", inputfileList,99);
RequestEntity<BundleRequest> request = RequestEntity.post(new URI(getBaseURL() + "/ds/_bundle_plan"))
.body(bFL);

System.out.println("request.getStatusCode():" + request + " \n request.getHeaders() :"
+ request.getHeaders() + "\n request.getBody():" + request.getBody());

ResponseEntity<String> response = websvc.exchange(request, String.class);
System.out.println("response.getStatusCode():" + response.getStatusCode() + " \n resp.getHeaders() :"
+ response.getHeaders() + "\n resp.getBody().length():" + response.getBody());
Expand Down

0 comments on commit 18f420c

Please sign in to comment.