[jira] Commented: (LANG-667) Add a Null-safe compare() method to ObjectUtils
[ https://issues.apache.org/jira/browse/LANG-667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12978693#action_12978693 ] Julien Aymé commented on LANG-667: -- Even is this method does break the contract of Comparable, it is really usefull when comparing many fields of two comparable beans (which may be null): {code} public int compareTo(Bean other) { int c = ObjectUtils.compare(this.getField1(), other.getField1()); if (c != 0) { return c; } c = ObjectUtils.compare(this.getField2(), other.getField2()); if (c != 0) { return c; } return ObjectUtils.compare(this.getField3(), other.getField3()); } {code} I don't want to be forced to handle null on field1, 2, or 3 for the 2 beans (and that's why in my projects I already have this method added to ObjectUtils). I propose that we add a javadoc comment stating that the method breaks the Comparable contract. Add a Null-safe compare() method to ObjectUtils --- Key: LANG-667 URL: https://issues.apache.org/jira/browse/LANG-667 Project: Commons Lang Issue Type: New Feature Components: lang.* Affects Versions: 2.5 Reporter: Niall Pemberton Assignee: Niall Pemberton Priority: Minor Fix For: 3.0 Add a Null-safe compare() method to ObjectUtils -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (LANG-667) Add a Null-safe compare() method to ObjectUtils
[ https://issues.apache.org/jira/browse/LANG-667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12978701#action_12978701 ] Julien Aymé commented on LANG-667: -- Regarding the code, I think it would be faster and simpler to understand if we add a == test first: {code} public static T extends Comparable? super T int compare(T c1, T c2, boolean nullGreater) { if (c1 == c2) { return 0; } else if (c1 == null) { return nullGreater ? 1 : -1; } else if (c2 == null) { return nullGreater ? -1 : 1; } return c1.compareTo(c2); } {code} Note: the commited code in rev 1056124 was: {code} public static T extends Comparable? super T int compare(T c1, T c2, boolean nullGreater) { int result = 0; if ((c1 == null) || (c2 == null)) { if (nullGreater) { result = (c1 == null ? 1 : 0) - (c2 == null ? 1 : 0); } else { result = (c1 == null ? -1 : 0) - (c2 == null ? -1 : 0); } } else { result = c1.compareTo(c2); } return result; } {code} Add a Null-safe compare() method to ObjectUtils --- Key: LANG-667 URL: https://issues.apache.org/jira/browse/LANG-667 Project: Commons Lang Issue Type: New Feature Components: lang.* Affects Versions: 2.5 Reporter: Niall Pemberton Assignee: Niall Pemberton Priority: Minor Fix For: 3.0 Add a Null-safe compare() method to ObjectUtils -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (LANG-667) Add a Null-safe compare() method to ObjectUtils
[ https://issues.apache.org/jira/browse/LANG-667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12978707#action_12978707 ] Niall Pemberton commented on LANG-667: -- @Julien - thanks for the suggestion, I'll look at this when I get home @Paul - Lang is all about adding useful utilities that Java itself doesn't have and theres alot of *prior art* here of null-safe utilities. Julien's example is a great demonstration of how this function can be used to simplify code. This feature is not a Comparable implementation and so breaks no contract. I really don't understand your objection and IMO its a very weak argument to object on the basis of Comparable's JavaDoc. How would you handle implementing a compareTo() method where the properties being compared may be null - surely you're not arguing that Julien's example should fail and throw a NullPointerException if one of the properties is null? Add a Null-safe compare() method to ObjectUtils --- Key: LANG-667 URL: https://issues.apache.org/jira/browse/LANG-667 Project: Commons Lang Issue Type: New Feature Components: lang.* Affects Versions: 2.5 Reporter: Niall Pemberton Assignee: Niall Pemberton Priority: Minor Fix For: 3.0 Add a Null-safe compare() method to ObjectUtils -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Created: (VFS-345) Regression: FTP Provider does not support symbolic links correctly
Regression: FTP Provider does not support symbolic links correctly -- Key: VFS-345 URL: https://issues.apache.org/jira/browse/VFS-345 Project: Commons VFS Issue Type: Bug Affects Versions: Nightly Builds Reporter: Andreas Persson After the fix from VFS-307, the FTP provider does not handle symbolic links correctly. A symlink to a directory returns false from exists(). getType() returns FileType.IMAGINARY. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (LANG-667) Add a Null-safe compare() method to ObjectUtils
[ https://issues.apache.org/jira/browse/LANG-667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12978733#action_12978733 ] Stephen Colebourne commented on LANG-667: - I support this change, its a useful feature that is clearly documented and no threat to the Comparable contract. Add a Null-safe compare() method to ObjectUtils --- Key: LANG-667 URL: https://issues.apache.org/jira/browse/LANG-667 Project: Commons Lang Issue Type: New Feature Components: lang.* Affects Versions: 2.5 Reporter: Niall Pemberton Assignee: Niall Pemberton Priority: Minor Fix For: 3.0 Add a Null-safe compare() method to ObjectUtils -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (COLLECTIONS-323) Behavior of constructors CaseInsensitiveMap inconsistent with standard Java HashMap
[ https://issues.apache.org/jira/browse/COLLECTIONS-323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12978736#action_12978736 ] Stephen Colebourne commented on COLLECTIONS-323: The behaviour should match the JDK classes, whatever that is. Behavior of constructors CaseInsensitiveMap inconsistent with standard Java HashMap --- Key: COLLECTIONS-323 URL: https://issues.apache.org/jira/browse/COLLECTIONS-323 Project: Commons Collections Issue Type: Bug Components: Map Affects Versions: 3.2 Environment: Any Reporter: Maarten Brak Priority: Minor Fix For: 4.x Original Estimate: 24h Remaining Estimate: 24h The constructor CaseInsensitiveMap(int initialCapacity) throws an IllegalArgumentException if the initial capacity is less than one. This is inconsistent with the standard Java HashMap constructor HashMap(int initialCapacity), which throws an if IllegalArgumentException if the initial capacity is negative. Thus: new HashMap(0) == no exception new CaseInsensitiveMap(0) == IllegalArgumentException. This inconsistency is confusing. Actions: - Change Javadoc (this shouldn't be a problem in practice since surely there is no code around depending on the fact that the constructor throws an IllegalArgumentException :-)) - Change code. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (VFS-345) Regression: FTP Provider does not support symbolic links correctly
[ https://issues.apache.org/jira/browse/VFS-345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12978819#action_12978819 ] Ralph Goers commented on VFS-345: - I need a bit more information as I can't tell what was changed in VFS-307. What class should I look at? Regression: FTP Provider does not support symbolic links correctly -- Key: VFS-345 URL: https://issues.apache.org/jira/browse/VFS-345 Project: Commons VFS Issue Type: Bug Affects Versions: Nightly Builds Reporter: Andreas Persson After the fix from VFS-307, the FTP provider does not handle symbolic links correctly. A symlink to a directory returns false from exists(). getType() returns FileType.IMAGINARY. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (VFS-345) Regression: FTP Provider does not support symbolic links correctly
[ https://issues.apache.org/jira/browse/VFS-345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12978828#action_12978828 ] Andreas Persson commented on VFS-345: - FTPClientWrapper: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftp/FTPClientWrapper.java?r1=804644r2=940808diff_format=h I don't understand the code enough to tell how the VFS-307 patch works, but when I removed these lines: files = getFtpClient().listFiles(relPath); if (FTPReply.isPositiveCompletion(getFtpClient().getReplyCode())) { return files; } which were added in VFS-307, the bug disappeared. Regression: FTP Provider does not support symbolic links correctly -- Key: VFS-345 URL: https://issues.apache.org/jira/browse/VFS-345 Project: Commons VFS Issue Type: Bug Affects Versions: Nightly Builds Reporter: Andreas Persson After the fix from VFS-307, the FTP provider does not handle symbolic links correctly. A symlink to a directory returns false from exists(). getType() returns FileType.IMAGINARY. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Resolved: (MATH-466) BaseMultiStartMultivariateRealOptimizer.optimize() can generate NPE if starts 1
[ https://issues.apache.org/jira/browse/MATH-466?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gilles resolved MATH-466. - Resolution: Fixed Fix Version/s: 3.0 Added preconditions checks in revision 1056391. BaseMultiStartMultivariateRealOptimizer.optimize() can generate NPE if starts 1 - Key: MATH-466 URL: https://issues.apache.org/jira/browse/MATH-466 Project: Commons Math Issue Type: Bug Affects Versions: 3.0 Reporter: Sebb Assignee: Gilles Fix For: 3.0 The Javadoc for BaseMultiStartMultivariateRealOptimizer says that starts can be = 1; however if it is set to 0, then the optimize() method will try to throw a null exception. Perhaps starts should be constrained to be at least 1? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (MATH-422) Constructor calls overrideable methods
[ https://issues.apache.org/jira/browse/MATH-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12978913#action_12978913 ] Gilles commented on MATH-422: - Actually, If you'd like to help, I think that it would be more useful to start with MATH-459; there are still 40 files containing calls to methods in the deprecated {{MathRuntimeException}} class; one patch per package would be nice. Constructor calls overrideable methods -- Key: MATH-422 URL: https://issues.apache.org/jira/browse/MATH-422 Project: Commons Math Issue Type: Bug Reporter: Sebb Fix For: 3.0 The ctor MicrosphereInterpolator(int microsphereElements, int brightnessExponent) calls 2 public setters that are not final. This is unsafe if the class is ever extended. Likewise for ComplexFormat(String imaginaryCharacter, NumberFormat realFormat, NumberFormat imaginaryFormat) Are the setters even needed? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Created: (NET-349) FTPClient.listFiles() returns a file entry containing a new line character only up to the new line character
FTPClient.listFiles() returns a file entry containing a new line character only up to the new line character Key: NET-349 URL: https://issues.apache.org/jira/browse/NET-349 Project: Commons Net Issue Type: Bug Components: FTP Affects Versions: 2.2 Environment: Linux localhost 2.6.9-22.ELsmp #1 SMP Mon Sep 19 18:32:14 EDT 2005 i686 i686 i386 GNU/Linux RedHat Enterprise Linux Reporter: Max Priority: Minor Create 3 files File with new lines: echo 'test line1 line2 line3.txt' 2 files without: echo test1 echo testz connect via ftpclient to the server containing these files, switch to that directory and call listFiles(). The file with new lines will return as test and trailing components of the path will be missing. FTPFileEntryParserImpl.readNextEntry() is using BufferedReader.readLine() to identify the end of the entry. May be some other approach is needed to identify the end of the entry, since file names with new lines although undesired, are actually valid in unix environments. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Resolved: (MATH-422) Constructor calls overrideable methods
[ https://issues.apache.org/jira/browse/MATH-422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gilles resolved MATH-422. - Resolution: Fixed Rrevision 1056493. Constructor calls overrideable methods -- Key: MATH-422 URL: https://issues.apache.org/jira/browse/MATH-422 Project: Commons Math Issue Type: Bug Reporter: Sebb Fix For: 3.0 The ctor MicrosphereInterpolator(int microsphereElements, int brightnessExponent) calls 2 public setters that are not final. This is unsafe if the class is ever extended. Likewise for ComplexFormat(String imaginaryCharacter, NumberFormat realFormat, NumberFormat imaginaryFormat) Are the setters even needed? -- 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: (MATH-422) Constructor calls overrideable methods
[ https://issues.apache.org/jira/browse/MATH-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12978952#action_12978952 ] Gilles edited comment on MATH-422 at 1/7/11 3:34 PM: - Revision 1056493. was (Author: erans): Rrevision 1056493. Constructor calls overrideable methods -- Key: MATH-422 URL: https://issues.apache.org/jira/browse/MATH-422 Project: Commons Math Issue Type: Bug Reporter: Sebb Fix For: 3.0 The ctor MicrosphereInterpolator(int microsphereElements, int brightnessExponent) calls 2 public setters that are not final. This is unsafe if the class is ever extended. Likewise for ComplexFormat(String imaginaryCharacter, NumberFormat realFormat, NumberFormat imaginaryFormat) Are the setters even needed? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (LANG-667) Add a Null-safe compare() method to ObjectUtils
[ https://issues.apache.org/jira/browse/LANG-667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12978972#action_12978972 ] Niall Pemberton commented on LANG-667: -- Simplified the code as per Julien's suggestion: http://svn.apache.org/viewvc?view=revisionrevision=1056520 Add a Null-safe compare() method to ObjectUtils --- Key: LANG-667 URL: https://issues.apache.org/jira/browse/LANG-667 Project: Commons Lang Issue Type: New Feature Components: lang.* Affects Versions: 2.5 Reporter: Niall Pemberton Assignee: Niall Pemberton Priority: Minor Fix For: 3.0 Add a Null-safe compare() method to ObjectUtils -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (MATH-459) Remove usage of org.apache.commons.math.MathRuntimeException
[ https://issues.apache.org/jira/browse/MATH-459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12979015#action_12979015 ] Gilles commented on MATH-459: - Modified {{Vector3D}} (package {{geometry}}) in revision 1056554. Remove usage of org.apache.commons.math.MathRuntimeException -- Key: MATH-459 URL: https://issues.apache.org/jira/browse/MATH-459 Project: Commons Math Issue Type: Improvement Reporter: Gilles Priority: Minor Fix For: 3.0 Occurrences of {{org.apache.commons.math.MathRuntimeException}} must be replaced by the appropriate class from package {{exception}}. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (MATH-423) Upgrade all test code to Junit 4
[ https://issues.apache.org/jira/browse/MATH-423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12979017#action_12979017 ] Gilles commented on MATH-423: - {{Vector3DTest}} (package {{geometry}}) upgraded in revision 1056554. Upgrade all test code to Junit 4 Key: MATH-423 URL: https://issues.apache.org/jira/browse/MATH-423 Project: Commons Math Issue Type: Task Reporter: Gilles Priority: Minor Fix For: 3.0 Make all tests use the JUnit 4 annotation-based syntax. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.