You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Goran Hacek (JIRA)" <ji...@apache.org> on 2009/10/15 14:16:31 UTC
[jira] Created: (COLLECTIONS-343) Functor singleton classes do not
implement singleton pattern correctly
Functor singleton classes do not implement singleton pattern correctly
----------------------------------------------------------------------
Key: COLLECTIONS-343
URL: https://issues.apache.org/jira/browse/COLLECTIONS-343
Project: Commons Collections
Issue Type: Bug
Components: Functor
Reporter: Goran Hacek
Fix For: 4.0
All classes in package "org.apache.commons.collections.functors" that advertise that they have singleton instance actually cannot guarantee that. Because of serialization support multiple instances of those classes can exist at runtime.
Following classes are making this false claim:
* CloneTransformer
* ExceptionClosure
* ExceptionFactory
* ExceptionPredicate
* ExceptionTransformer
* FalsePredicate
* NOPClosure
* NOPTransformer
* NotNullPredicate
* NullPredicate
* StringValueTransformer
* TruePredicate
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (COLLECTIONS-343) Functor singleton
classes do not implement singleton pattern correctly
Posted by "Goran Hacek (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COLLECTIONS-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12766039#action_12766039 ]
Goran Hacek edited comment on COLLECTIONS-343 at 10/15/09 5:49 AM:
-------------------------------------------------------------------
Fix for this issue is simple, all of these classes should implement readResolve() in the following way:
{noformat}private Object readResolve() {
return INSTANCE;
}
{noformat}
This also makes default equals() and hashCode() methods behave correctly for this classes.
I am providing a patch for this issue with tests, so can someone, please, review it.
was (Author: ghacek):
Fix for this issue is simple, all of these classes should implement readResolve() in the following way:
{noformat}private Object readResolve() {
return INSTANCE;
}
{noformat}
This also makes default equals() and hashCode() methods behave appropriately for this classes.
I am providing a patch for this issue with tests, so can someone, please, review it.
> Functor singleton classes do not implement singleton pattern correctly
> ----------------------------------------------------------------------
>
> Key: COLLECTIONS-343
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-343
> Project: Commons Collections
> Issue Type: Bug
> Components: Functor
> Reporter: Goran Hacek
> Fix For: 4.0
>
> Attachments: fix_functor_singletones.patch
>
>
> All classes in package "org.apache.commons.collections.functors" that advertise that they have singleton instance actually cannot guarantee that. Because of serialization support multiple instances of those classes can exist at runtime.
> Following classes are making this false claim:
> * CloneTransformer
> * ExceptionClosure
> * ExceptionFactory
> * ExceptionPredicate
> * ExceptionTransformer
> * FalsePredicate
> * NOPClosure
> * NOPTransformer
> * NotNullPredicate
> * NullPredicate
> * StringValueTransformer
> * TruePredicate
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Issue Comment Edited: (COLLECTIONS-343) Functor singleton
classes do not implement singleton pattern correctly
Posted by "Goran Hacek (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COLLECTIONS-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12766039#action_12766039 ]
Goran Hacek edited comment on COLLECTIONS-343 at 10/15/09 5:26 AM:
-------------------------------------------------------------------
Fix for this issue is simple, all of these classes should implement readResolve() in the following way:
{noformat}private Object readResolve() {
return INSTANCE;
}
{noformat}
This also makes default equals() and hashCode() methods behave appropriately for this classes.
I am providing a patch for this issue with tests, so can someone, please, review it.
was (Author: ghacek):
Fix for this issue is simple, all classes of these classes should implement readResolve() in the following way:
{noformat}private Object readResolve() {
return INSTANCE;
}
{noformat}
This also makes default equals() and hashCode() methods behave appropriately for this classes.
I am providing a patch for this issue with tests, so can someone, please, review it.
> Functor singleton classes do not implement singleton pattern correctly
> ----------------------------------------------------------------------
>
> Key: COLLECTIONS-343
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-343
> Project: Commons Collections
> Issue Type: Bug
> Components: Functor
> Reporter: Goran Hacek
> Fix For: 4.0
>
> Attachments: fix_functor_singletones.patch
>
>
> All classes in package "org.apache.commons.collections.functors" that advertise that they have singleton instance actually cannot guarantee that. Because of serialization support multiple instances of those classes can exist at runtime.
> Following classes are making this false claim:
> * CloneTransformer
> * ExceptionClosure
> * ExceptionFactory
> * ExceptionPredicate
> * ExceptionTransformer
> * FalsePredicate
> * NOPClosure
> * NOPTransformer
> * NotNullPredicate
> * NullPredicate
> * StringValueTransformer
> * TruePredicate
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (COLLECTIONS-343) Functor singleton classes do not
implement singleton pattern correctly
Posted by "Goran Hacek (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COLLECTIONS-343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Goran Hacek updated COLLECTIONS-343:
------------------------------------
Attachment: fix_functor_singletones.patch
Fix for this issue is simple, all classes of these classes should implement readResolve() in the following way:
{noformat}private Object readResolve() {
return INSTANCE;
}
{noformat}
This also makes default equals() and hashCode() methods behave appropriately for this classes.
I am providing a patch for this issue with tests, so can someone, please, review it.
> Functor singleton classes do not implement singleton pattern correctly
> ----------------------------------------------------------------------
>
> Key: COLLECTIONS-343
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-343
> Project: Commons Collections
> Issue Type: Bug
> Components: Functor
> Reporter: Goran Hacek
> Fix For: 4.0
>
> Attachments: fix_functor_singletones.patch
>
>
> All classes in package "org.apache.commons.collections.functors" that advertise that they have singleton instance actually cannot guarantee that. Because of serialization support multiple instances of those classes can exist at runtime.
> Following classes are making this false claim:
> * CloneTransformer
> * ExceptionClosure
> * ExceptionFactory
> * ExceptionPredicate
> * ExceptionTransformer
> * FalsePredicate
> * NOPClosure
> * NOPTransformer
> * NotNullPredicate
> * NullPredicate
> * StringValueTransformer
> * TruePredicate
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (COLLECTIONS-343) Functor singleton classes do not
implement singleton pattern correctly
Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COLLECTIONS-343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matt Benson resolved COLLECTIONS-343.
-------------------------------------
Resolution: Fixed
! /Users/mbenson/oss/asf/commons/trunks-proper/collections> svn commit -m "[COLLECTIONS-343] applied patch to preserve singleton integrity with readResolve" src pom.xml
Sending pom.xml
Sending src/java/org/apache/commons/collections/functors/CloneTransformer.java
Sending src/java/org/apache/commons/collections/functors/ExceptionClosure.java
Sending src/java/org/apache/commons/collections/functors/ExceptionFactory.java
Sending src/java/org/apache/commons/collections/functors/ExceptionPredicate.java
Sending src/java/org/apache/commons/collections/functors/ExceptionTransformer.java
Sending src/java/org/apache/commons/collections/functors/FalsePredicate.java
Sending src/java/org/apache/commons/collections/functors/NOPClosure.java
Sending src/java/org/apache/commons/collections/functors/NOPTransformer.java
Sending src/java/org/apache/commons/collections/functors/NotNullPredicate.java
Sending src/java/org/apache/commons/collections/functors/NullPredicate.java
Sending src/java/org/apache/commons/collections/functors/StringValueTransformer.java
Sending src/java/org/apache/commons/collections/functors/TruePredicate.java
Sending src/test/org/apache/commons/collections/TestClosureUtils.java
Sending src/test/org/apache/commons/collections/TestFactoryUtils.java
Sending src/test/org/apache/commons/collections/TestPredicateUtils.java
Sending src/test/org/apache/commons/collections/TestTransformerUtils.java
Adding src/test/org/apache/commons/collections/TestUtils.java
Transmitting file data ..................
Committed revision 894507.
> Functor singleton classes do not implement singleton pattern correctly
> ----------------------------------------------------------------------
>
> Key: COLLECTIONS-343
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-343
> Project: Commons Collections
> Issue Type: Bug
> Components: Functor
> Reporter: Goran Hacek
> Fix For: 4.0
>
> Attachments: fix_functor_singletones.patch
>
>
> All classes in package "org.apache.commons.collections.functors" that advertise that they have singleton instance actually cannot guarantee that. Because of serialization support multiple instances of those classes can exist at runtime.
> Following classes are making this false claim:
> * CloneTransformer
> * ExceptionClosure
> * ExceptionFactory
> * ExceptionPredicate
> * ExceptionTransformer
> * FalsePredicate
> * NOPClosure
> * NOPTransformer
> * NotNullPredicate
> * NullPredicate
> * StringValueTransformer
> * TruePredicate
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.