Skip to content

Commit

Permalink
which dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjingwang committed Jan 20, 2017
1 parent 838aac0 commit 7ccc8e2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/edu/washington/escience/myria/api/DatasetResource.java
Expand Up @@ -103,11 +103,11 @@ public Response getDataset(
@PathParam("programName") final String programName,
@PathParam("relationName") final String relationName)
throws DbException {
DatasetStatus status =
server.getDatasetStatus(RelationKey.of(userName, programName, relationName));
RelationKey relationKey = RelationKey.of(userName, programName, relationName);
DatasetStatus status = server.getDatasetStatus(relationKey);
if (status == null) {
/* Not found, throw a 404 (Not Found) */
throw new MyriaApiException(Status.NOT_FOUND, "That dataset was not found");
throw new MyriaApiException(Status.NOT_FOUND, "Dataset " + relationKey + " was not found");
}
status.setUri(getCanonicalResourcePath(uriInfo, status.getRelationKey()));
/* Yay, worked! */
Expand Down Expand Up @@ -355,13 +355,12 @@ public Response deleteDataset(
@PathParam("programName") final String programName,
@PathParam("relationName") final String relationName)
throws DbException {
DatasetStatus status =
server.getDatasetStatus(RelationKey.of(userName, programName, relationName));
RelationKey relationKey = RelationKey.of(userName, programName, relationName);
DatasetStatus status = server.getDatasetStatus(relationKey);
if (status == null) {
/* Dataset not found, throw a 404 (Not Found) */
throw new MyriaApiException(Status.NOT_FOUND, "That dataset was not found");
throw new MyriaApiException(Status.NOT_FOUND, "Dataset " + relationKey + " was not found");
}
RelationKey relationKey = status.getRelationKey();
// delete command
try {
server.deleteDataset(relationKey);
Expand Down Expand Up @@ -586,7 +585,7 @@ private Response doIngest(
/* Check overwriting existing dataset. */
try {
if (!MoreObjects.firstNonNull(overwrite, false) && server.getSchema(relationKey) != null) {
throw new MyriaApiException(Status.CONFLICT, "That dataset already exists.");
throw new MyriaApiException(Status.CONFLICT, "Dataset " + relationKey + " already exists.");
}
} catch (CatalogException e) {
throw new DbException(e);
Expand Down Expand Up @@ -662,7 +661,8 @@ public Response addDatasetToCatalog(final DatasetEncoding dataset, @Context fina
if (!MoreObjects.firstNonNull(dataset.overwrite, Boolean.FALSE)
&& server.getSchema(dataset.relationKey) != null) {
/* Found, throw a 409 (Conflict) */
throw new MyriaApiException(Status.CONFLICT, "That dataset already exists.");
throw new MyriaApiException(
Status.CONFLICT, "Dataset " + dataset.relationKey + " already exists.");
}
} catch (CatalogException e) {
throw new DbException(e);
Expand Down

0 comments on commit 7ccc8e2

Please sign in to comment.