You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by sjcorbett <gi...@git.apache.org> on 2016/04/05 13:27:27 UTC

[GitHub] brooklyn-server pull request: Rest API location transformers use m...

GitHub user sjcorbett opened a pull request:

    https://github.com/apache/brooklyn-server/pull/99

    Rest API location transformers use mutable map

    LocationConfig contains null values which Guava's ImmutableMap rejects with a NullPointerException.
    
    This fixes an error observed when deploying the "Template 1: Server" sample to localhost then running `br application <id>` with the CLI. The output from the CLI was "500 Server Error". The server logs contained:
    
    ```
    java.lang.NullPointerException: null value in entry: byon.machineSpecs=null
    	at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33) ~[com.google.guava-guava-16.0.1.jar:na]
    	at com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:135) ~[com.google.guava-guava-16.0.1.jar:na]
    	at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:206) ~[com.google.guava-guava-16.0.1.jar:na]
    	at org.apache.brooklyn.rest.transform.LocationTransformer.copyConfig(LocationTransformer.java:128) ~[org.apache.brooklyn-brooklyn-rest-resources-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
    	at org.apache.brooklyn.rest.transform.LocationTransformer.newInstance(LocationTransformer.java:189) ~[org.apache.brooklyn-brooklyn-rest-resources-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
    	at org.apache.brooklyn.rest.resources.LocationResource.get(LocationResource.java:139) ~[org.apache.brooklyn-brooklyn-rest-resources-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
    	at org.apache.brooklyn.rest.resources.LocationResource.get(LocationResource.java:132) ~[org.apache.brooklyn-brooklyn-rest-resources-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_05]
    
    ```

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

    $ git pull https://github.com/sjcorbett/brooklyn-server fix/location-spec

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

    https://github.com/apache/brooklyn-server/pull/99.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 #99
    
----
commit 067c208fc3e23658dc757dcc5c203c6dab928482
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Date:   2016-04-05T11:25:46Z

    Rest API location transformers use mutable map
    
    LocationConfig contains null values which Guava's ImmutableMap rejects
    with a NullPointerException

----


---
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] brooklyn-server pull request: Rest API location transformers use m...

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

    https://github.com/apache/brooklyn-server/pull/99#issuecomment-205793229
  
    Looks good, will wait for the build to complete and merge.


---
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] brooklyn-server pull request: Rest API location transformers use m...

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

    https://github.com/apache/brooklyn-server/pull/99#issuecomment-205792423
  
    Test failure unrelated. Filed at https://issues.apache.org/jira/browse/BROOKLYN-247. Trying again.


---
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] brooklyn-server pull request: Rest API location transformers use m...

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

    https://github.com/apache/brooklyn-server/pull/99


---
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] brooklyn-server pull request: Rest API location transformers use m...

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

    https://github.com/apache/brooklyn-server/pull/99#discussion_r58533880
  
    --- Diff: rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/LocationSpec.java ---
    @@ -53,7 +54,7 @@ public LocationSpec(
                 @JsonProperty("config") @Nullable Map<String, ?> config) {
             this.name = name;
             this.spec = spec;
    -        this.config = (config == null) ? Collections.<String, String> emptyMap() : ImmutableMap.copyOf(config);
    +        this.config = (config == null) ? Collections.<String, String> emptyMap() : MutableMap.copyOf(config);
    --- End diff --
    
    (minor) could add `asUnmodifiable` or `asImmutableCopy` to keep the immutability.


---
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] brooklyn-server pull request: Rest API location transformers use m...

Posted by sjcorbett <gi...@git.apache.org>.
GitHub user sjcorbett reopened a pull request:

    https://github.com/apache/brooklyn-server/pull/99

    Rest API location transformers use mutable map

    LocationConfig contains null values which Guava's ImmutableMap rejects with a NullPointerException.
    
    This fixes an error observed when deploying the "Template 1: Server" sample to localhost then running `br application <id>` with the CLI. The output from the CLI was "500 Server Error". The server logs contained:
    
    ```
    java.lang.NullPointerException: null value in entry: byon.machineSpecs=null
    	at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33) ~[com.google.guava-guava-16.0.1.jar:na]
    	at com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:135) ~[com.google.guava-guava-16.0.1.jar:na]
    	at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:206) ~[com.google.guava-guava-16.0.1.jar:na]
    	at org.apache.brooklyn.rest.transform.LocationTransformer.copyConfig(LocationTransformer.java:128) ~[org.apache.brooklyn-brooklyn-rest-resources-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
    	at org.apache.brooklyn.rest.transform.LocationTransformer.newInstance(LocationTransformer.java:189) ~[org.apache.brooklyn-brooklyn-rest-resources-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
    	at org.apache.brooklyn.rest.resources.LocationResource.get(LocationResource.java:139) ~[org.apache.brooklyn-brooklyn-rest-resources-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
    	at org.apache.brooklyn.rest.resources.LocationResource.get(LocationResource.java:132) ~[org.apache.brooklyn-brooklyn-rest-resources-0.10.0-SNAPSHOT.jar:0.10.0-SNAPSHOT]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_05]
    
    ```

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

    $ git pull https://github.com/sjcorbett/brooklyn-server fix/location-spec

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

    https://github.com/apache/brooklyn-server/pull/99.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 #99
    
----
commit 067c208fc3e23658dc757dcc5c203c6dab928482
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Date:   2016-04-05T11:25:46Z

    Rest API location transformers use mutable map
    
    LocationConfig contains null values which Guava's ImmutableMap rejects
    with a NullPointerException

----


---
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] brooklyn-server pull request: Rest API location transformers use m...

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

    https://github.com/apache/brooklyn-server/pull/99


---
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.
---