Skip to content

Commit

Permalink
FALCON-319 Summary instance API returning wrong exception. Contribute…
Browse files Browse the repository at this point in the history
…d by Shwetha GS
  • Loading branch information
shwethags committed Mar 4, 2014
1 parent 341b531 commit b143c17
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Expand Up @@ -36,6 +36,8 @@ Trunk (Unreleased)
Srikanth Sundarrajan)

BUG FIXES
FALCON-319 Summary instance API returning wrong exception. (Shwetha GS)

FALCON-297 Validations on update with effective time. (Shwetha GS)

FALCON-260 When a process is scheduled, the user workflow is failing with OozieClientException.
Expand Down
11 changes: 0 additions & 11 deletions client/src/main/java/org/apache/falcon/client/FalconClient.java
Expand Up @@ -416,17 +416,6 @@ private InputStream getServletInputStream(String clusters,
stream = new ByteArrayInputStream(buffer.toString().getBytes());
return (buffer.length() == 0) ? null : stream;
}
// private ServletInputStream getServletInputStream(final InputStream
// stream)
// throws IOException {
// return new ServletInputStream() {
//
// @Override
// public int read() throws IOException {
// return stream.read();
// }
// };
// }

private String sendEntityRequest(Entities entities, String entityType,
String entityName, String colo) throws FalconCLIException {
Expand Down
8 changes: 8 additions & 0 deletions prism/src/main/java/org/apache/falcon/FalconWebException.java
Expand Up @@ -21,6 +21,7 @@
import org.apache.commons.lang.StringUtils;
import org.apache.falcon.resource.APIResult;
import org.apache.falcon.resource.InstancesResult;
import org.apache.falcon.resource.InstancesSummaryResult;
import org.apache.log4j.Logger;

import javax.ws.rs.WebApplicationException;
Expand All @@ -45,6 +46,13 @@ public static FalconWebException newInstanceException(Throwable e, Response.Stat
return newInstanceException(e.getMessage() + "\n" + getAddnInfo(e), status);
}

public static FalconWebException newInstanceSummaryException(Throwable e, Response.Status status) {
LOG.error("Failure reason", e);
String message = e.getMessage() + "\n" + getAddnInfo(e);
LOG.error("Action failed: " + status + "\nError:" + message);
APIResult result = new InstancesSummaryResult(APIResult.Status.FAILED, message);
return new FalconWebException(Response.status(status).entity(result).type(MediaType.TEXT_XML_TYPE).build());
}

public static FalconWebException newException(APIResult result,
Response.Status status) {
Expand Down
Expand Up @@ -96,8 +96,7 @@ public InstancesResult getStatus(String type, String entity, String startStr, St
}
}

public InstancesSummaryResult getSummary(String type, String entity, String startStr, String endStr,
String colo) {
public InstancesSummaryResult getSummary(String type, String entity, String startStr, String endStr, String colo) {
checkColo(colo);
checkType(type);
try {
Expand All @@ -111,14 +110,12 @@ public InstancesSummaryResult getSummary(String type, String entity, String star
return wfEngine.getSummary(entityObject, start, end);
} catch (Throwable e) {
LOG.error("Failed to get instances status", e);
throw FalconWebException
.newInstanceException(e, Response.Status.BAD_REQUEST);
throw FalconWebException.newInstanceSummaryException(e, Response.Status.BAD_REQUEST);
}
}

public InstancesResult getLogs(String type, String entity, String startStr,
String endStr, String colo, String runId) {

try {
// TODO getStatus does all validations and filters clusters
InstancesResult result = getStatus(type, entity, startStr, endStr,
Expand Down

0 comments on commit b143c17

Please sign in to comment.