Skip to content

Commit

Permalink
KYLO-3186: fix to allow specialized messages for nifi issues
Browse files Browse the repository at this point in the history
  • Loading branch information
harschware committed Dec 11, 2018
1 parent eb4271c commit d343951
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ private void gatherConnectedReusableTemplates(List<String> connectingReusableTem

private byte[] zip(RegisteredTemplate template, String nifiTemplateXml, List<String> reusableTemplateXmls, Set<ReusableTemplateConnectionInfo> outputPortMetadata,
Set<RemoteProcessGroupInputPort> reusableTemplateRemoteInputPorts) {
if( nifiTemplateXml == null ) {
throw new NifiConnectionException("Attempt to export using invalid template");
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (ZipOutputStream zos = new ZipOutputStream(baos)) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ public Response toResponse(NifiConnectionException e) {
if (e.getCause() != null) {
builder.setDeveloperMessage(e.getCause());
}
builder.message("Unable to connect to NiFi.");
if( e.getMessage().isEmpty() || e.getCause() instanceof java.net.ConnectException ) {
builder.message("Unable to connect to NiFi.");
} else {
builder.message(e.getMessage());
}

return Response.accepted(builder.buildError()).status(Response.Status.SERVICE_UNAVAILABLE).build();
}
Expand Down

0 comments on commit d343951

Please sign in to comment.