You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by ahgittin <gi...@git.apache.org> on 2014/10/31 18:54:43 UTC

[GitHub] incubator-brooklyn pull request: fix dto.entries repetition errors...

GitHub user ahgittin opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/289

    fix dto.entries repetition errors by improving the api for access to internal fields

    not as clean as it could be, but quick and safe, as this is needed in production systems

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

    $ git pull https://github.com/ahgittin/incubator-brooklyn fix-for-catalog-entry-dto-repetition

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

    https://github.com/apache/incubator-brooklyn/pull/289.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 #289
    
----
commit ed92b0e341ada0dc7ae277960c3de34632bd3b44
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2014-10-31T17:53:37Z

    fix dto.entries repetition errors by improving the api for access to internal fields
    
    not as clean as it could be, but quick and safe, as this is needed in production systems

----


---
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] incubator-brooklyn pull request: fix dto.entries repetition errors...

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

    https://github.com/apache/incubator-brooklyn/pull/289#issuecomment-61489771
  
    Code looks fine - only a couple of minor comments. Happy for this to be merged once you've looked through the comments.


---
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] incubator-brooklyn pull request: fix dto.entries repetition errors...

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

    https://github.com/apache/incubator-brooklyn/pull/289


---
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] incubator-brooklyn pull request: fix dto.entries repetition errors...

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

    https://github.com/apache/incubator-brooklyn/pull/289#discussion_r19737243
  
    --- Diff: core/src/main/java/brooklyn/catalog/internal/CatalogDto.java ---
    @@ -49,7 +52,8 @@
         String name;
         String description;
         CatalogClasspathDto classpath;
    -    List<CatalogItemDtoAbstract<?,?>> entries = null;
    +    private List<CatalogItemDtoAbstract<?,?>> entries = null;
    +//    Map<String,CatalogItemDtoAbstract<?,?>> entries = null;
    --- End diff --
    
    Commented out code deserves either being deleted, or a comment added to say why it would be useful / what it means.


---
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] incubator-brooklyn pull request: fix dto.entries repetition errors...

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

    https://github.com/apache/incubator-brooklyn/pull/289#discussion_r19737220
  
    --- Diff: core/src/main/java/brooklyn/catalog/internal/CatalogDto.java ---
    @@ -178,4 +182,33 @@ public String toString() {
                     .toString();
         }
     
    +    // temporary fix for issue where entries might not be unique
    +    Iterable<CatalogItemDtoAbstract<?, ?>> getUniqueEntries() {
    +        if (entries==null) return null;
    +        Map<String, CatalogItemDtoAbstract<?, ?>> result = getEntriesMap();
    +        return result.values();
    +    }
    +
    +    private Map<String, CatalogItemDtoAbstract<?, ?>> getEntriesMap() {
    +        if (entries==null) return null;
    --- End diff --
    
    Personal preference: I'm a big fan of not returning null when an `ImmutableMap.of()` means the same thing. Same for returning an `ImmutableList.of()` from `getUniqueEntries()`. It saves null guards all over the place, and NPEs when someone forgets to guard against null.


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