[ 
https://issues.apache.org/jira/browse/SQOOP-2823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15151675#comment-15151675
 ] 

Hudson commented on SQOOP-2823:
-------------------------------

SUCCESS: Integrated in Sqoop2 #1015 (See 
[https://builds.apache.org/job/Sqoop2/1015/])
SQOOP-2823: Sqoop2: RESTiliency: Remove repetitive try-catch block for (colin: 
[https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=acc08540634c91541245b652a95c9ace1ff2ead4])
* server/src/main/java/org/apache/sqoop/server/RequestContext.java
* server/src/main/java/org/apache/sqoop/handler/LinkRequestHandler.java
* server/src/main/java/org/apache/sqoop/handler/AuthorizationRequestHandler.java
* server/src/main/java/org/apache/sqoop/handler/JobRequestHandler.java


> Sqoop2: RESTiliency: Remove repetitive try-catch block for accessing POST and 
> PUT request
> -----------------------------------------------------------------------------------------
>
>                 Key: SQOOP-2823
>                 URL: https://issues.apache.org/jira/browse/SQOOP-2823
>             Project: Sqoop
>          Issue Type: Sub-task
>            Reporter: Jarek Jarcec Cecho
>            Assignee: Jarek Jarcec Cecho
>             Fix For: 1.99.7
>
>         Attachments: SQOOP-2823.patch
>
>
> I've noticed that we have quite a few repetition of code like this one:
> {code}
>      RoleBean bean = new RoleBean();
>     try {
>       JSONObject json = JSONUtils.parse(ctx.getRequest().getReader());
>       bean.restore(json);
>     } catch (IOException e) {
>       throw new SqoopException(ServerError.SERVER_0003, "Can't read request 
> content", e);
>     }
> {code}
> It's relatively a lot of code just because {{ctx.getRequest()}} can throw an 
> exception. I would like to propose to create a method in our {{ctx}} wrapper 
> to provide the {{getReader}} method without any exception, which will 
> simplify the code to:
> {code}
>     bean.restore(JSONUtils.parse(ctx.getReader()));
> {code}
> We'll of course throw an exception on failure - but using our 
> {{SqoopException}} mechanism.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to