5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-08 07:29:09 +08:00

SQOOP-1784: Sqoop2: Sending POST request to link or job end-point might end up with NPE

(Jarek Jarcec Cecho via Abraham Elmahrek)
This commit is contained in:
Abraham Elmahrek 2014-11-23 21:38:34 -08:00
parent ae9c6e3542
commit bb25b8312c
2 changed files with 4 additions and 2 deletions

View File

@ -153,7 +153,6 @@ private JsonBean createUpdateJob(RequestContext ctx, boolean create) {
Repository repository = RepositoryManager.getInstance().getRepository();
String username = ctx.getUserName();
JobBean bean = new JobBean();
try {
@ -163,6 +162,8 @@ private JsonBean createUpdateJob(RequestContext ctx, boolean create) {
throw new SqoopException(ServerError.SERVER_0003, "Can't read request content", e);
}
String username = ctx.getUserName();
// Get job object
List<MJob> jobs = bean.getJobs();

View File

@ -108,7 +108,6 @@ private JsonBean createUpdateLink(RequestContext ctx, boolean create) {
Repository repository = RepositoryManager.getInstance().getRepository();
String username = ctx.getUserName();
LinkBean linkBean = new LinkBean();
try {
JSONObject postData = (JSONObject) JSONValue.parse(ctx.getRequest().getReader());
@ -117,6 +116,8 @@ private JsonBean createUpdateLink(RequestContext ctx, boolean create) {
throw new SqoopException(ServerError.SERVER_0003, "Can't read request content", e);
}
String username = ctx.getUserName();
// Get link object
List<MLink> links = linkBean.getLinks();
if (links.size() != 1) {