|
@@ -61,6 +61,9 @@ import com.google.inject.Singleton;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.IllegalFormatException;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* The main per-node REST end point for timeline service writes. It is
|
|
* The main per-node REST end point for timeline service writes. It is
|
|
* essentially a container service that routes requests to the appropriate
|
|
* essentially a container service that routes requests to the appropriate
|
|
@@ -166,7 +169,7 @@ public class TimelineCollectorWebService {
|
|
TimelineCollector collector = collectorManager.get(appID);
|
|
TimelineCollector collector = collectorManager.get(appID);
|
|
if (collector == null) {
|
|
if (collector == null) {
|
|
LOG.error("Application: "+ appId + " is not found");
|
|
LOG.error("Application: "+ appId + " is not found");
|
|
- throw new NotFoundException(); // different exception?
|
|
|
|
|
|
+ throw new NotFoundException("Application: "+ appId + " is not found");
|
|
}
|
|
}
|
|
|
|
|
|
boolean isAsync = async != null && async.trim().equalsIgnoreCase("true");
|
|
boolean isAsync = async != null && async.trim().equalsIgnoreCase("true");
|
|
@@ -179,7 +182,10 @@ public class TimelineCollectorWebService {
|
|
}
|
|
}
|
|
|
|
|
|
return Response.ok().build();
|
|
return Response.ok().build();
|
|
- } catch (Exception e) {
|
|
|
|
|
|
+ } catch (NotFoundException | ForbiddenException e) {
|
|
|
|
+ throw new WebApplicationException(e,
|
|
|
|
+ Response.Status.INTERNAL_SERVER_ERROR);
|
|
|
|
+ } catch (IOException e) {
|
|
LOG.error("Error putting entities", e);
|
|
LOG.error("Error putting entities", e);
|
|
throw new WebApplicationException(e,
|
|
throw new WebApplicationException(e,
|
|
Response.Status.INTERNAL_SERVER_ERROR);
|
|
Response.Status.INTERNAL_SERVER_ERROR);
|
|
@@ -221,14 +227,17 @@ public class TimelineCollectorWebService {
|
|
TimelineCollector collector = collectorManager.get(appID);
|
|
TimelineCollector collector = collectorManager.get(appID);
|
|
if (collector == null) {
|
|
if (collector == null) {
|
|
LOG.error("Application: " + appId + " is not found");
|
|
LOG.error("Application: " + appId + " is not found");
|
|
- throw new NotFoundException(); // different exception?
|
|
|
|
|
|
+ throw new NotFoundException("Application: " + appId + " is not found");
|
|
}
|
|
}
|
|
|
|
|
|
domain.setOwner(callerUgi.getShortUserName());
|
|
domain.setOwner(callerUgi.getShortUserName());
|
|
collector.putDomain(domain, callerUgi);
|
|
collector.putDomain(domain, callerUgi);
|
|
|
|
|
|
return Response.ok().build();
|
|
return Response.ok().build();
|
|
- } catch (Exception e) {
|
|
|
|
|
|
+ } catch (NotFoundException e) {
|
|
|
|
+ throw new WebApplicationException(e,
|
|
|
|
+ Response.Status.INTERNAL_SERVER_ERROR);
|
|
|
|
+ } catch (IOException e) {
|
|
LOG.error("Error putting entities", e);
|
|
LOG.error("Error putting entities", e);
|
|
throw new WebApplicationException(e,
|
|
throw new WebApplicationException(e,
|
|
Response.Status.INTERNAL_SERVER_ERROR);
|
|
Response.Status.INTERNAL_SERVER_ERROR);
|
|
@@ -242,7 +251,7 @@ public class TimelineCollectorWebService {
|
|
} else {
|
|
} else {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- } catch (Exception e) {
|
|
|
|
|
|
+ } catch (IllegalFormatException e) {
|
|
LOG.error("Invalid application ID: " + appId);
|
|
LOG.error("Invalid application ID: " + appId);
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|