You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Tassos Souris (Created) (JIRA)" <ji...@apache.org> on 2012/01/16 20:51:42 UTC
[jira] [Created] (ZOOKEEPER-1362) ZooDefs.Ids ACL lists not
immutable
ZooDefs.Ids ACL lists not immutable
-----------------------------------
Key: ZOOKEEPER-1362
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1362
Project: ZooKeeper
Issue Type: Improvement
Components: java client
Reporter: Tassos Souris
Priority: Trivial
In org.apache.zookeeper:
1) ZooDefs.Ids.OPEN_ACL_UNSAFE
2) ZooDefs.Ids.CREATOR_ALL_ACL
3) ZooDefs.Ids.READ_ALL_ACL
are not immutable lists. Unlikely but the client could alter them.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (ZOOKEEPER-1362) ZooDefs.Ids ACL lists not
immutable
Posted by "Tassos Souris (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ZOOKEEPER-1362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187312#comment-13187312 ]
Tassos Souris commented on ZOOKEEPER-1362:
------------------------------------------
or keep the ArrayList and use unmodifiableList:
public final ArrayList<ACL> OPEN_ACL_UNSAFE = Collections.unmodifiableList( new ArrayList<ACL>(
Collections.singletonList(new ACL(Perms.ALL, ANYONE_ID_UNSAFE))
));
> ZooDefs.Ids ACL lists not immutable
> -----------------------------------
>
> Key: ZOOKEEPER-1362
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1362
> Project: ZooKeeper
> Issue Type: Improvement
> Components: java client
> Reporter: Tassos Souris
> Priority: Trivial
>
> In org.apache.zookeeper:
> 1) ZooDefs.Ids.OPEN_ACL_UNSAFE
> 2) ZooDefs.Ids.CREATOR_ALL_ACL
> 3) ZooDefs.Ids.READ_ALL_ACL
> are not immutable lists. Unlikely but the client could alter them.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (ZOOKEEPER-1362) ZooDefs.Ids ACL lists not
immutable
Posted by "Tassos Souris (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ZOOKEEPER-1362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187327#comment-13187327 ]
Tassos Souris commented on ZOOKEEPER-1362:
------------------------------------------
ignore the above.. rushed to answer... can't delete it though
> ZooDefs.Ids ACL lists not immutable
> -----------------------------------
>
> Key: ZOOKEEPER-1362
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1362
> Project: ZooKeeper
> Issue Type: Improvement
> Components: java client
> Reporter: Tassos Souris
> Priority: Trivial
>
> In org.apache.zookeeper:
> 1) ZooDefs.Ids.OPEN_ACL_UNSAFE
> 2) ZooDefs.Ids.CREATOR_ALL_ACL
> 3) ZooDefs.Ids.READ_ALL_ACL
> are not immutable lists. Unlikely but the client could alter them.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (ZOOKEEPER-1362) ZooDefs.Ids ACL lists not
immutable
Posted by "Edward Ribeiro (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ZOOKEEPER-1362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187212#comment-13187212 ]
Edward Ribeiro commented on ZOOKEEPER-1362:
-------------------------------------------
All three fields are declared as follows:
public final ArrayList<ACL> OPEN_ACL_UNSAFE = new ArrayList<ACL>( Collections.singletonList(new ACL(Perms.ALL, ANYONE_ID_UNSAFE)));
The change would be a matter of just removing the ArrayList and declaring the field as a List as Collections.singletonList() already returns an immutable collection:
public final List<ACL> OPEN_ACL_UNSAFE = Collections.singletonList(new ACL(Perms.ALL, ANYONE_ID_UNSAFE));
Unfortunately, they are public fields, so I suppose it could pontentially broke many client apps that are referencing this field as
ArrayList<ACL> perms = ZooDefs.Ids.OPEN_ACL_UNSAFE;
I still think this change is doable, but I would like to hear what other people think. :)
> ZooDefs.Ids ACL lists not immutable
> -----------------------------------
>
> Key: ZOOKEEPER-1362
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1362
> Project: ZooKeeper
> Issue Type: Improvement
> Components: java client
> Reporter: Tassos Souris
> Priority: Trivial
>
> In org.apache.zookeeper:
> 1) ZooDefs.Ids.OPEN_ACL_UNSAFE
> 2) ZooDefs.Ids.CREATOR_ALL_ACL
> 3) ZooDefs.Ids.READ_ALL_ACL
> are not immutable lists. Unlikely but the client could alter them.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (ZOOKEEPER-1362) ZooDefs.Ids ACL lists not
immutable
Posted by "Patrick Hunt (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/ZOOKEEPER-1362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191434#comment-13191434 ]
Patrick Hunt commented on ZOOKEEPER-1362:
-----------------------------------------
That's unfortunate. We typically don't break b/w compatibility outside of a Major upgrade.
Create an immutable ArrayList subclass? a proxy?
> ZooDefs.Ids ACL lists not immutable
> -----------------------------------
>
> Key: ZOOKEEPER-1362
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1362
> Project: ZooKeeper
> Issue Type: Improvement
> Components: java client
> Reporter: Tassos Souris
> Priority: Trivial
>
> In org.apache.zookeeper:
> 1) ZooDefs.Ids.OPEN_ACL_UNSAFE
> 2) ZooDefs.Ids.CREATOR_ALL_ACL
> 3) ZooDefs.Ids.READ_ALL_ACL
> are not immutable lists. Unlikely but the client could alter them.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira