You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by pubudu538 <gi...@git.apache.org> on 2015/05/17 20:52:37 UTC

[GitHub] stratos pull request: Introducing custom exceptions for applicatio...

GitHub user pubudu538 opened a pull request:

    https://github.com/apache/stratos/pull/327

    Introducing custom exceptions for application policy

    ApplicationPolicyAlreadyExistsException is added.
    UI gives proper error message when adding an already exist application policy.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pubudu538/stratos testing-AS

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/stratos/pull/327.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #327
    
----
commit dd2d60297d5eef6b5c900cbe1fab1976b5f0e868
Author: Pubudu Gunatilaka <pu...@gmail.com>
Date:   2015-05-17T18:39:12Z

    Introducing custom exceptions for application policy

commit d00f234ec5b6a43c0dead336bd7f4bbcbed5cebc
Author: Pubudu Gunatilaka <pu...@gmail.com>
Date:   2015-05-17T18:49:55Z

    Fixed minor issue in StratosApiV41

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Introducing custom exceptions for applicatio...

Posted by imesh <gi...@git.apache.org>.
Github user imesh commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/327#discussion_r30473985
  
    --- Diff: components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java ---
    @@ -699,7 +699,7 @@ public static void addAutoscalingPolicy(AutoscalePolicyBean autoscalePolicyBean)
          * @throws RestAPIException
          */
         public static void addApplicationPolicy(ApplicationPolicyBean applicationPolicyBean) throws RestAPIException,
    -            AutoscalerServiceInvalidApplicationPolicyExceptionException {
    +            AutoscalerServiceInvalidApplicationPolicyExceptionException,AutoscalerServiceApplicationPolicyAlreadyExistsExceptionException {
    --- End diff --
    
    +1 for the suggestion, @pubudu538 would you mind sending another PR with proper code formatting?
    Thanks


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Introducing custom exceptions for applicatio...

Posted by pubudu538 <gi...@git.apache.org>.
Github user pubudu538 commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/327#discussion_r30482185
  
    --- Diff: components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java ---
    @@ -699,7 +699,7 @@ public static void addAutoscalingPolicy(AutoscalePolicyBean autoscalePolicyBean)
          * @throws RestAPIException
          */
         public static void addApplicationPolicy(ApplicationPolicyBean applicationPolicyBean) throws RestAPIException,
    -            AutoscalerServiceInvalidApplicationPolicyExceptionException {
    +            AutoscalerServiceInvalidApplicationPolicyExceptionException,AutoscalerServiceApplicationPolicyAlreadyExistsExceptionException {
    --- End diff --
    
    Sent a PR for formatting - https://github.com/apache/stratos/pull/328


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Introducing custom exceptions for applicatio...

Posted by pubudu538 <gi...@git.apache.org>.
Github user pubudu538 commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/327#discussion_r30473952
  
    --- Diff: components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java ---
    @@ -817,12 +817,18 @@ public Response addApplicationPolicy(
                 return Response.created(url).entity(new ResponseMessageBean(ResponseMessageBean.SUCCESS,
                         String.format("Application policy added successfully: [application-policy] %s",
                                 applicationPolicy.getId()))).build();
    -        } catch (RestAPIException e) {
    -            throw e;
             } catch (AutoscalerServiceInvalidApplicationPolicyExceptionException e) {
                 return Response.status(Response.Status.BAD_REQUEST).entity(new ResponseMessageBean(
                         ResponseMessageBean.ERROR, "Invalid application policy")).build();
    +        } catch(AutoscalerServiceApplicationPolicyAlreadyExistsExceptionException e){
    +            return Response.status(Response.Status.CONFLICT).entity(new ResponseMessageBean(
    --- End diff --
    
    Noted. Thank you!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Introducing custom exceptions for applicatio...

Posted by lahirus <gi...@git.apache.org>.
Github user lahirus commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/327#discussion_r30473872
  
    --- Diff: components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java ---
    @@ -699,7 +699,7 @@ public static void addAutoscalingPolicy(AutoscalePolicyBean autoscalePolicyBean)
          * @throws RestAPIException
          */
         public static void addApplicationPolicy(ApplicationPolicyBean applicationPolicyBean) throws RestAPIException,
    -            AutoscalerServiceInvalidApplicationPolicyExceptionException {
    +            AutoscalerServiceInvalidApplicationPolicyExceptionException,AutoscalerServiceApplicationPolicyAlreadyExistsExceptionException {
    --- End diff --
    
    Same about formatting, add a space before Exception 'AutoscalerServiceApplicationPolicyAlreadyExistsExceptionException'


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Introducing custom exceptions for applicatio...

Posted by lahirus <gi...@git.apache.org>.
Github user lahirus commented on the pull request:

    https://github.com/apache/stratos/pull/327#issuecomment-102925171
  
    Thanks Pubudu.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Introducing custom exceptions for applicatio...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/stratos/pull/327


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] stratos pull request: Introducing custom exceptions for applicatio...

Posted by lahirus <gi...@git.apache.org>.
Github user lahirus commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/327#discussion_r30473853
  
    --- Diff: components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java ---
    @@ -817,12 +817,18 @@ public Response addApplicationPolicy(
                 return Response.created(url).entity(new ResponseMessageBean(ResponseMessageBean.SUCCESS,
                         String.format("Application policy added successfully: [application-policy] %s",
                                 applicationPolicy.getId()))).build();
    -        } catch (RestAPIException e) {
    -            throw e;
             } catch (AutoscalerServiceInvalidApplicationPolicyExceptionException e) {
                 return Response.status(Response.Status.BAD_REQUEST).entity(new ResponseMessageBean(
                         ResponseMessageBean.ERROR, "Invalid application policy")).build();
    +        } catch(AutoscalerServiceApplicationPolicyAlreadyExistsExceptionException e){
    +            return Response.status(Response.Status.CONFLICT).entity(new ResponseMessageBean(
    --- End diff --
    
    You can improve the formatting in your diff. There should be a space between ')' and '{'


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---