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:
parent
ae9c6e3542
commit
bb25b8312c
@ -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();
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user