Make exceptions more specific for load errors. Still no error returned to user though (just hangs)
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1450 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
ea28784e8b
commit
5040b06d9f
@ -103,16 +103,25 @@ public abstract class Command {
|
|||||||
* @throws ServletException
|
* @throws ServletException
|
||||||
*/
|
*/
|
||||||
protected Project getProject(HttpServletRequest request) throws ServletException {
|
protected Project getProject(HttpServletRequest request) throws ServletException {
|
||||||
if (request == null) throw new IllegalArgumentException("parameter 'request' should not be null");
|
if (request == null) {
|
||||||
|
throw new IllegalArgumentException("parameter 'request' should not be null");
|
||||||
|
}
|
||||||
|
String param = request.getParameter("project");
|
||||||
|
if (param == null || "".equals(param)) {
|
||||||
|
throw new ServletException("Can't find project: missing ID parameter");
|
||||||
|
}
|
||||||
|
Long id;
|
||||||
try {
|
try {
|
||||||
Project p = ProjectManager.singleton.getProject(Long.parseLong(request.getParameter("project")));
|
id = Long.parseLong(param);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
throw new ServletException("Can't find project: badly formatted id #", e);
|
||||||
|
}
|
||||||
|
Project p = ProjectManager.singleton.getProject(id);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
return p;
|
return p;
|
||||||
|
} else {
|
||||||
|
throw new ServletException("Failed to find project id #" + param + " - may be corrupt");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
throw new ServletException("Can't find project: missing or bad URL parameter");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user