[jira] [Updated] (OGNL-38) [PATCH] Use StringBuilder instead of StringBuffer, deprecate =JDK1.5 conditionals and use CONSTANT.equals(variable).
[ https://issues.apache.org/jira/browse/OGNL-38?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated OGNL-38: Attachment: patch-OGNL38.txt [PATCH] Use StringBuilder instead of StringBuffer, deprecate =JDK1.5 conditionals and use CONSTANT.equals(variable). - Key: OGNL-38 URL: https://issues.apache.org/jira/browse/OGNL-38 Project: OGNL Issue Type: Improvement Reporter: Adrian Cumiskey Priority: Minor Attachments: patch-OGNL38.txt This patch replaces all StringBuffer references with StringBuilder for better performance. Improved performance has not been verified but it is fairly well established that StringBuilder performs better in single threaded use cases (see http://littletutorials.com/2008/07/16/stringbuffer-vs-stringbuilder-performance-comparison/). All JDK1.5 checking has also been deprecated/removed since OGNL is now dependent upon =JDK1.5 these days. Lastly, all remaining variable.equals(CONSTANT) has been flipped to the null safe CONSTANT.equals(variable). A list of modified classes and changes are given here :- MenuItem: toString() now uses a chained StringBuilder instead of StringBuffer. StaticsAndConstructorsTest: use StringBuilder instead of StringBuffer. EnumerationPropertyAccessor: Test CONSTANT.equals(variable). ExpressionCompiler: Test CONSTANT.equals(variable). ASTMethod: Variable naming (don't use acronyms), remove OgnlRuntime.isJdk15() check. OgnlRuntime: * Remove JDK1.5 checking since OGNL now requires =JDK1.5. * The isJdk15() method is now deprecated. * Variable naming (don't use acronyms. * getPointerString(int) now uses StringBuilder instead of StringBuffer. * getUniqueDescriptor(Object, boolean) now uses StringBuilder instead of StringBuffer. * package private method findType() unused to removed. * Simplify getMethods(Class?,boolean) with ternary. * getStaticField(OgnlContext,String,String) test CONSTANT.equals(variable) and remove JDK1.5 conditionals. * A lot of variable naming! SetPropertyAccessor: Test CONSTANT.equals(variable) and simplify conditionals. ASTStaticField: Test CONSTANT.equals(variable), remove JDK1.5 conditionals and variable naming. MapPropertyAccessor: Simplify conditionals. ArrayPropertyAccessor: Test CONSTANT.equals(variable). IteratorPropertyAccessor: Test CONSTANT.equals(variable). OgnlOps: Use StringBuilder instead of StringBuffer. ognl.jjt: Variable naming, use StringBuilder instead of StringBuffer. Replace new String(stringBuffer) with stringBuffer.toString(). Cheers, Adrian. -- 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] [Updated] (OGNL-37) [PATCH] Findbugs fixes
[ https://issues.apache.org/jira/browse/OGNL-37?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated OGNL-37: Attachment: patch-OGNL37.txt [PATCH] Findbugs fixes -- Key: OGNL-37 URL: https://issues.apache.org/jira/browse/OGNL-37 Project: OGNL Issue Type: Improvement Reporter: Adrian Cumiskey Priority: Minor Attachments: patch-OGNL37.txt ExpressionNode: Use StringBuilder instead of String concatenation with '+'. ObjectIndexedPropertyDescriptor: Provide equals() and hashcode() implementation to override PropertyDescriptor. ExpressionCompiler: Remove redundant attempt to remove LocalReference key (keys are always of type String). ASTMethod: Use StringBuilder instead of String concatenation with '+'. DeclaredMethodCacheEntry: Modified equals() implementation to take account of super class fields. OgnlRuntime: Made static ints final. Use Map.entrySet instead of Map.keySet for better performance. Javadoc improvements. ASTChain: Remove int boxing, lets rely on autoboxing. ArrayPropertyAccessor: Remove unnecessary int boxing and redundant code. OgnlOps: use valueOf() instead of new for boxing. Adjust unnecessary conditional checking. -- 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] [Updated] (OGNL-35) [PATCH] Improvements to {List,Map,Array}PropertyAccessor and ASTProperty
[ https://issues.apache.org/jira/browse/OGNL-35?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated OGNL-35: Description: * Flipped equals() everywhere where a variable is tested against a String constant. * ListPropertyAccessor: CPD fix, extracted shared method getSourceBeanMethod() from getSourceSetter() and getSourceAccessor(). * ASTProperty: CPD fix, extracted shared method getSourceString() from toGetSourceString() and toSetSourceString(). * ArrayPropertyAccessor: CPD fix, extracted getIndexString() from getSourceAccessor() and getSourceSetter(). was: * Flipped equals() where variable is tested against String constant. * CPD: Extracted getSourceBeanMethod() shared method from getSourceSetter() and getSourceAccessor() in ListPropertyAccessor Summary: [PATCH] Improvements to {List,Map,Array}PropertyAccessor and ASTProperty (was: [PATCH] Improvements to {List,Map}PropertyAccessor) [PATCH] Improvements to {List,Map,Array}PropertyAccessor and ASTProperty Key: OGNL-35 URL: https://issues.apache.org/jira/browse/OGNL-35 Project: OGNL Issue Type: Improvement Reporter: Adrian Cumiskey Priority: Minor Attachments: patch-OGNL35-v2.txt, patch-OGNL35.txt * Flipped equals() everywhere where a variable is tested against a String constant. * ListPropertyAccessor: CPD fix, extracted shared method getSourceBeanMethod() from getSourceSetter() and getSourceAccessor(). * ASTProperty: CPD fix, extracted shared method getSourceString() from toGetSourceString() and toSetSourceString(). * ArrayPropertyAccessor: CPD fix, extracted getIndexString() from getSourceAccessor() and getSourceSetter(). -- 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] [Updated] (OGNL-35) [PATCH] Improvements to {List,Map,Array}PropertyAccessor and ASTProperty
[ https://issues.apache.org/jira/browse/OGNL-35?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated OGNL-35: Attachment: patch-OGNL35-v2.txt [PATCH] Improvements to {List,Map,Array}PropertyAccessor and ASTProperty Key: OGNL-35 URL: https://issues.apache.org/jira/browse/OGNL-35 Project: OGNL Issue Type: Improvement Reporter: Adrian Cumiskey Priority: Minor Attachments: patch-OGNL35-v2.txt, patch-OGNL35.txt * Flipped equals() everywhere where a variable is tested against a String constant. * ListPropertyAccessor: CPD fix, extracted shared method getSourceBeanMethod() from getSourceSetter() and getSourceAccessor(). * ASTProperty: CPD fix, extracted shared method getSourceString() from toGetSourceString() and toSetSourceString(). * ArrayPropertyAccessor: CPD fix, extracted getIndexString() from getSourceAccessor() and getSourceSetter(). -- 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] [Updated] (OGNL-35) [PATCH] Improvements to {List,Map}PropertyAccessor
[ https://issues.apache.org/jira/browse/OGNL-35?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated OGNL-35: Attachment: patch-OGNL35.txt [PATCH] Improvements to {List,Map}PropertyAccessor -- Key: OGNL-35 URL: https://issues.apache.org/jira/browse/OGNL-35 Project: OGNL Issue Type: Improvement Reporter: Adrian Cumiskey Priority: Minor Attachments: patch-OGNL35.txt * Flipped equals() where variable is tested against String constant. * CPD: Extracted getSourceBeanMethod() shared method from getSourceSetter() and getSourceAccessor() in ListPropertyAccessor -- 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] [Updated] (OGNL-32) [PATCH] CPD fix to ASTProperty
[ https://issues.apache.org/jira/browse/OGNL-32?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated OGNL-32: Attachment: patch-OGNL32.txt [PATCH] CPD fix to ASTProperty -- Key: OGNL-32 URL: https://issues.apache.org/jira/browse/OGNL-32 Project: OGNL Issue Type: Improvement Reporter: Adrian Cumiskey Priority: Minor Attachments: patch-OGNL32.txt Extracted a new getTarget() method from two copy paste duplications found in ASTProperty. -- 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] [Updated] (OGNL-33) [PATCH] Improvements to JJTOgnlParserState
[ https://issues.apache.org/jira/browse/OGNL-33?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated OGNL-33: Attachment: patch-OGNL33.txt [PATCH] Improvements to JJTOgnlParserState -- Key: OGNL-33 URL: https://issues.apache.org/jira/browse/OGNL-33 Project: OGNL Issue Type: Improvement Reporter: Adrian Cumiskey Priority: Minor Attachments: patch-OGNL33.txt JJTOgnlParserState was looking a little old school. * Introduced generics on the nodes and marks List. * Replaced 1-3 character acronyms with meaningful, camel case variable names. * Removed unnecessary use of (un)boxing. -- 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] [Updated] (OGNL-31) [PATCH] Some CPD fixes around ASTMethod and ASTStaticMethod.
[ https://issues.apache.org/jira/browse/OGNL-31?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated OGNL-31: Attachment: patch-OGNL31-v2.txt @Maurizio Cucchiara I believe you are making reference to a different patch contribution https://issues.apache.org/jira/browse/OGNL-23 which Simone applied. I have attached a replacement patch which I believe will address your concerns. I have also added the test case you described to the patch. Although harmless, the compiler caching implementation wasn't ideal or necessary so I have removed it. The context is only passed to the getCompiler() method in order for the OgnlRuntime to perform its class resolving. Once this has been achieved the first time the context and class resolving is unnecessary on subsequent calls so we can just return the valid _compiler reference that is held. @Adrian Crum, Simone Tripodi I have removed both Luke and Drew as @authors in the newly introduced class ASTMethodUtil. I decided to provide a default private constructor as this class should never be instantiated and also made both the class and its methods package private as they will (and should) only ever be accessed by ASTMethod and ASTStaticMethod. I was slightly tempted to make ASTMethodUtil a base class but its methods have no dependencies on any of the instance variables in either ASTMethod or ASTStaticMethod so I decided to leave it as it is. Wishing you all a nice weekend. Cheers, Adrian. [PATCH] Some CPD fixes around ASTMethod and ASTStaticMethod. Key: OGNL-31 URL: https://issues.apache.org/jira/browse/OGNL-31 Project: OGNL Issue Type: Improvement Reporter: Adrian Cumiskey Assignee: Maurizio Cucchiara Priority: Minor Attachments: patch-OGNL31-v2.txt, patch-OGNL31.txt I discovered a number of PMD CPD issues around ASTMethod and ASTStaticMethod class, there was quite a bit of duplication there. This patch comes courtesy of the wifi connection in my local laundry-mat here in Milwaukee. Its strange the things people will do to make their clothes wash more quickly :-). Cheers, Adrian. -- 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] [Updated] (OGNL-31) [PATCH] Some CPD fixes around ASTMethod and ASTStaticMethod.
[ https://issues.apache.org/jira/browse/OGNL-31?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated OGNL-31: Attachment: patch-OGNL31.txt [PATCH] Some CPD fixes around ASTMethod and ASTStaticMethod. Key: OGNL-31 URL: https://issues.apache.org/jira/browse/OGNL-31 Project: OGNL Issue Type: Improvement Reporter: Adrian Cumiskey Priority: Minor Attachments: patch-OGNL31.txt I discovered a number of PMD CPD issues around ASTMethod and ASTStaticMethod class, there was quite a bit of duplication there. This patch comes courtesy of the wifi connection in my local laundry-mat here in Milwaukee. Its strange the things people will do to make their clothes wash more quickly :-). Cheers, Adrian. -- 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] [Updated] (OGNL-23) Class.forName() usage is malicious inside OSGi
[ https://issues.apache.org/jira/browse/OGNL-23?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated OGNL-23: Attachment: patch-OGNL23-v2.txt Hi Simone, I have read your comments and I have had a little more time to review the code earlier and have made what I hope are some useful additions to my patch. I found that there is provision in the existing code for the user to be able to configure their own ClassLoader. This is achieved by calling OgnlContext.setClassResolver(). The problem with the current code is that this configured ClassResolver is not always being used by OGNL library. For example the ExpressionCompiler is always resolved using the DefaultClassResolver and any user defined ClassResolver is ignored. With this patch, all roads in the code base for class loading/resolving now point to OgnlRuntime.classForName(). This method firstly tries to resolve using the ClassResolver configured on the OgnlContext it is passed. If none is configured it then defaults to using the DefaultClassResolver. Hope this helps. Cheers, Adrian. Class.forName() usage is malicious inside OSGi -- Key: OGNL-23 URL: https://issues.apache.org/jira/browse/OGNL-23 Project: OGNL Issue Type: Bug Reporter: Simone Tripodi Assignee: Simone Tripodi Attachments: patch-OGNL23-v2.txt, patch-OGNL23.txt {{Class.forName()}} could make OGNL unusable [inside OSGi|http://olegz.wordpress.com/2008/11/05/osgi-and-classforname/]. The fix would involve the {{ClassLoader.loadClass()}} method, allowing users setting a custom {{ClassLoader} Classes affected by that issues are: * {{org.apache.commons.ognl.DefaultClassResolver}} * {{org.apache.commons.ognl.OgnlRuntime}} The {{org.apache.commons.ognl.ASTMap}} class is affected as well, even if loading {{java.util.LinkedHashMap}} in that way should be safe. -- 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] [Updated] (OGNL-23) Class.forName() usage is malicious inside OSGi
[ https://issues.apache.org/jira/browse/OGNL-23?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated OGNL-23: Attachment: patch-OGNL23.txt This is a patch file which I believe should satisfy the issue. All references to Class.forName() have been replaced with calls to OgnlContext.DEFAULT_CLASS_RESOLVER.classForName(). This method also previously used Class.forName and now it uses ClassLoader.loadClass(). Cheers, Adrian. Class.forName() usage is malicious inside OSGi -- Key: OGNL-23 URL: https://issues.apache.org/jira/browse/OGNL-23 Project: OGNL Issue Type: Bug Reporter: Simone Tripodi Attachments: patch-OGNL23.txt {{Class.forName()}} could make OGNL unusable [inside OSGi|http://olegz.wordpress.com/2008/11/05/osgi-and-classforname/]. The fix would involve the {{ClassLoader.loadClass()}} method, allowing users setting a custom {{ClassLoader} Classes affected by that issues are: * {{org.apache.commons.ognl.DefaultClassResolver}} * {{org.apache.commons.ognl.OgnlRuntime}} The {{org.apache.commons.ognl.ASTMap}} class is affected as well, even if loading {{java.util.LinkedHashMap}} in that way should be safe. -- 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] [Updated] (LANG-762) Handle or document ReflectionToStringBuilder and ToStringBuilder for collections that are not thread safe
[ https://issues.apache.org/jira/browse/LANG-762?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated LANG-762: - Attachment: patch-LANG762.txt I tried pretty hard to try and reproduce ConcurrentModificationException in a fairly elaborate multithreaded unit test (but alas failed...). I looked at the two approaches you proposed for fixing this issue. I believe it is not correct to expect the ReflectionToStringBuilder caller to synchronize his toString() implementation. I believe the best place for the guard is just prior to the object being appended by the StringBuffer. I have provided a small patch that takes care of synchronizing any Collection or Map in ToStringStyle. Cheers, Adrian. Handle or document ReflectionToStringBuilder and ToStringBuilder for collections that are not thread safe - Key: LANG-762 URL: https://issues.apache.org/jira/browse/LANG-762 Project: Commons Lang Issue Type: Bug Components: lang.builder.* Environment: Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500) Maven home: C:\Java\apache-maven-3.0.3\bin\.. Java version: 1.6.0_24, vendor: Sun Microsystems Inc. Java home: C:\Program Files\Java\jdk1.6.0_24\jre Default locale: en_US, platform encoding: Cp1252 OS name: windows 7, version: 6.1, arch: amd64, family: windows Reporter: Gary D. Gregory Attachments: patch-LANG762.txt Moving discussion here from https://issues.apache.org/jira/browse/POOL-191 ConcurrentModificationException in GenericObjectPool LinkedList. It is possible to get a {{ConcurrentModificationException}} in a {{LinkedList}} from a Commons Pool {{GenericObjectPool}}. This happens when I call {{ReflectionToStringBuilder.toString(this)}} from a subclass of {{GenericObjectPool}}. My guess is that it would happen with just {{ReflectionToStringBuilder.toString(gop)}}. IOW, subclassing does not have anything to do with it I would venture. For example, in this stack trace {{JmsSessionPool}} is a subclass of {{GenericObjectPool}}. {noformat} java.util.ConcurrentModificationException at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:761) at java.util.LinkedList$ListItr.next(LinkedList.java:696) at java.util.AbstractCollection.toString(AbstractCollection.java:421) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuffer.append(StringBuffer.java:219) at org.apache.commons.lang3.builder.ToStringStyle.appendDetail(ToStringStyle.java:598) at org.apache.commons.lang3.builder.ToStringStyle.appendInternal(ToStringStyle.java:473) at org.apache.commons.lang3.builder.ToStringStyle.append(ToStringStyle.java:436) at org.apache.commons.lang3.builder.ToStringBuilder.append(ToStringBuilder.java:848) at org.apache.commons.lang3.builder.ReflectionToStringBuilder.appendFieldsIn(ReflectionToStringBuilder.java:528) at org.apache.commons.lang3.builder.ReflectionToStringBuilder.toString(ReflectionToStringBuilder.java:692) at org.apache.commons.lang3.builder.ReflectionToStringBuilder.toString(ReflectionToStringBuilder.java:288) at org.apache.commons.lang3.builder.ReflectionToStringBuilder.toString(ReflectionToStringBuilder.java:119) at com.seagullsw.appinterface.comm.jms.JmsSessionPool.toString(JmsSessionPool.java:120) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuffer.append(StringBuffer.java:219) at org.apache.commons.lang3.builder.ToStringStyle.appendDetail(ToStringStyle.java:586) at org.apache.commons.lang3.builder.ToStringStyle.appendInternal(ToStringStyle.java:550) at org.apache.commons.lang3.builder.ToStringStyle.append(ToStringStyle.java:436) at org.apache.commons.lang3.builder.ToStringBuilder.append(ToStringBuilder.java:848) at org.apache.commons.lang3.builder.ReflectionToStringBuilder.appendFieldsIn(ReflectionToStringBuilder.java:528) at org.apache.commons.lang3.builder.ReflectionToStringBuilder.toString(ReflectionToStringBuilder.java:689) at org.apache.commons.lang3.builder.ReflectionToStringBuilder.toString(ReflectionToStringBuilder.java:288) at org.apache.commons.lang3.builder.ReflectionToStringBuilder.toString(ReflectionToStringBuilder.java:119) at com.seagullsw.appinterface.server.comm.BasicCommunicationManager.toString(BasicCommunicationManager.java:828) at com.seagullsw.appinterface.server.comm.BasicCommunicationManager.toString(BasicCommunicationManager.java:817) at java.lang.String.valueOf(String.java:2826) at java.lang.StringBuilder.append(StringBuilder.java:115) at com.seagullsw.appinterface.server.AisHelper.waitForCommuncationManagers(AisHelper.java:217) at com.seagullsw.appinterface.server.AisHelper.start(AisHelper.java:136) at
[jira] [Updated] (COLLECTIONS-383) [PATCH] CollectionUtils.forAllDo(IteratorT, C Closure) implementation
[ https://issues.apache.org/jira/browse/COLLECTIONS-383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Adrian Cumiskey updated COLLECTIONS-383: Attachment: patch.txt [PATCH] CollectionUtils.forAllDo(IteratorT, C Closure) implementation --- Key: COLLECTIONS-383 URL: https://issues.apache.org/jira/browse/COLLECTIONS-383 Project: Commons Collections Issue Type: Improvement Components: Collection Affects Versions: Nightly Builds Reporter: Adrian Cumiskey Priority: Minor Labels: patch Fix For: Nightly Builds Attachments: patch.txt Original Estimate: 0h Remaining Estimate: 0h A simple additional CollectionUtils.forAllDo() implementation providing support for taking an Iterator instead of a Collection as input. -- 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