[jira] Commented: (VFS-205) Please provide simple methods for java.io.File - FileObject conversion
[ https://issues.apache.org/jira/browse/VFS-205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12675634#action_12675634 ] Ralph Goers commented on VFS-205: - While this would be nice, java.io.File only supports disk-based objects. File(uri) will throw an exception if the scheme is anything other than file:. Please provide simple methods for java.io.File - FileObject conversion Key: VFS-205 URL: https://issues.apache.org/jira/browse/VFS-205 Project: Commons VFS Issue Type: Improvement Reporter: Tim Lebedkov Please provide simple methods for java.io.File - FileObject conversion -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (VFS-205) Please provide simple methods for java.io.File - FileObject conversion
[ https://issues.apache.org/jira/browse/VFS-205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ralph Goers updated VFS-205: Comment: was deleted Please provide simple methods for java.io.File - FileObject conversion Key: VFS-205 URL: https://issues.apache.org/jira/browse/VFS-205 Project: Commons VFS Issue Type: Improvement Reporter: Tim Lebedkov Please provide simple methods for java.io.File - FileObject conversion -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Resolved: (VFS-205) Please provide simple methods for java.io.File - FileObject conversion
[ https://issues.apache.org/jira/browse/VFS-205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ralph Goers resolved VFS-205. - Resolution: Won't Fix The documentation for File indicates it will throw an exception if the url contains a scheme other than file:. Furthermore, FileInputStream uses native methods to access the file data on disk. Attempting to use a File object based on the FileObject class would be doomed to fail. Since FileReader uses a FileInputStream internally it would also fail. Please provide simple methods for java.io.File - FileObject conversion Key: VFS-205 URL: https://issues.apache.org/jira/browse/VFS-205 Project: Commons VFS Issue Type: Improvement Reporter: Tim Lebedkov Please provide simple methods for java.io.File - FileObject conversion -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Resolved: (VFS-184) Core tests are incorrectly setup due to bad ant-run plugin configuration
[ https://issues.apache.org/jira/browse/VFS-184?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ralph Goers resolved VFS-184. - Resolution: Fixed Fix Version/s: (was: 1.1) 2.0 VFS builds properly in trunk using Maven 2. Core tests are incorrectly setup due to bad ant-run plugin configuration Key: VFS-184 URL: https://issues.apache.org/jira/browse/VFS-184 Project: Commons VFS Issue Type: Bug Affects Versions: 1.1 Reporter: Jerome Lacoste Priority: Blocker Fix For: 2.0 Attachments: VFS-184.diff 2 issues: * missing goal - plugin not executed * configuration - files copied to wrong place -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Created: (SANDBOX-290) [javaflow] Ant task terminates with org.apache.bcel.verifier.exc.AssertionViolatedException
[javaflow] Ant task terminates with org.apache.bcel.verifier.exc.AssertionViolatedException --- Key: SANDBOX-290 URL: https://issues.apache.org/jira/browse/SANDBOX-290 Project: Commons Sandbox Issue Type: Bug Components: Javaflow Reporter: Michael Binz Unexpected behaviour: When the Javaflow Ant task is executed on a set of class files in the file system, then Ant terminates with the error message: {{C:\svnx\dev_scream\build.xml:155: org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL ERROR: Missing class: java.lang.ClassNotFoundException: Exception while looking for class de.michab.scream.FirstClassObject: java.io.IOException: Couldn't find: de/michab/scream/FirstClassObject.class}} Expected is, that the task can rewrite the class files without throwing an exception. The reason for the above behaviour is that currently no explicit Bcel repository is set. This repository (org.apache.bcel.util.Repository) is responsible for resolving class references while Bcel is working. Since none was set explicitly, the implicit default repository is used, which depends on the class path. The solution for the above problem is that the BcelClassTransformer always explicitly installs a SyntheticRepository that points to the task's srcDir. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SANDBOX-290) [javaflow] Ant task terminates with org.apache.bcel.verifier.exc.AssertionViolatedException
[ https://issues.apache.org/jira/browse/SANDBOX-290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Binz updated SANDBOX-290: - Attachment: AntRewriteTask.java Modified AntRewriteTask implementations. Trivial change in execute() method. [javaflow] Ant task terminates with org.apache.bcel.verifier.exc.AssertionViolatedException --- Key: SANDBOX-290 URL: https://issues.apache.org/jira/browse/SANDBOX-290 Project: Commons Sandbox Issue Type: Bug Components: Javaflow Reporter: Michael Binz Attachments: AntRewriteTask.java Unexpected behaviour: When the Javaflow Ant task is executed on a set of class files in the file system, then Ant terminates with the error message: {{C:\svnx\dev_scream\build.xml:155: org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL ERROR: Missing class: java.lang.ClassNotFoundException: Exception while looking for class de.michab.scream.FirstClassObject: java.io.IOException: Couldn't find: de/michab/scream/FirstClassObject.class}} Expected is, that the task can rewrite the class files without throwing an exception. The reason for the above behaviour is that currently no explicit Bcel repository is set. This repository (org.apache.bcel.util.Repository) is responsible for resolving class references while Bcel is working. Since none was set explicitly, the implicit default repository is used, which depends on the class path. The solution for the above problem is that the BcelClassTransformer always explicitly installs a SyntheticRepository that points to the task's srcDir. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (SANDBOX-290) [javaflow] Ant task terminates with org.apache.bcel.verifier.exc.AssertionViolatedException
[ https://issues.apache.org/jira/browse/SANDBOX-290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Michael Binz updated SANDBOX-290: - Attachment: BcelClassTransformer.java Added constructor that allows to set class resolution to a certain directory. See public BcelClassTransformer(File classPathFile). [javaflow] Ant task terminates with org.apache.bcel.verifier.exc.AssertionViolatedException --- Key: SANDBOX-290 URL: https://issues.apache.org/jira/browse/SANDBOX-290 Project: Commons Sandbox Issue Type: Bug Components: Javaflow Reporter: Michael Binz Attachments: AntRewriteTask.java, BcelClassTransformer.java Unexpected behaviour: When the Javaflow Ant task is executed on a set of class files in the file system, then Ant terminates with the error message: {{C:\svnx\dev_scream\build.xml:155: org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL ERROR: Missing class: java.lang.ClassNotFoundException: Exception while looking for class de.michab.scream.FirstClassObject: java.io.IOException: Couldn't find: de/michab/scream/FirstClassObject.class}} Expected is, that the task can rewrite the class files without throwing an exception. The reason for the above behaviour is that currently no explicit Bcel repository is set. This repository (org.apache.bcel.util.Repository) is responsible for resolving class references while Bcel is working. Since none was set explicitly, the implicit default repository is used, which depends on the class path. The solution for the above problem is that the BcelClassTransformer always explicitly installs a SyntheticRepository that points to the task's srcDir. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (SANDBOX-290) [javaflow] Ant task terminates with org.apache.bcel.verifier.exc.AssertionViolatedException
[ https://issues.apache.org/jira/browse/SANDBOX-290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12675657#action_12675657 ] Michael Binz commented on SANDBOX-290: -- The two attached files fix the problem. I tried to keep the code delta to a minimum. [javaflow] Ant task terminates with org.apache.bcel.verifier.exc.AssertionViolatedException --- Key: SANDBOX-290 URL: https://issues.apache.org/jira/browse/SANDBOX-290 Project: Commons Sandbox Issue Type: Bug Components: Javaflow Reporter: Michael Binz Attachments: AntRewriteTask.java, BcelClassTransformer.java Unexpected behaviour: When the Javaflow Ant task is executed on a set of class files in the file system, then Ant terminates with the error message: {{C:\svnx\dev_scream\build.xml:155: org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL ERROR: Missing class: java.lang.ClassNotFoundException: Exception while looking for class de.michab.scream.FirstClassObject: java.io.IOException: Couldn't find: de/michab/scream/FirstClassObject.class}} Expected is, that the task can rewrite the class files without throwing an exception. The reason for the above behaviour is that currently no explicit Bcel repository is set. This repository (org.apache.bcel.util.Repository) is responsible for resolving class references while Bcel is working. Since none was set explicitly, the implicit default repository is used, which depends on the class path. The solution for the above problem is that the BcelClassTransformer always explicitly installs a SyntheticRepository that points to the task's srcDir. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (MATH-239) Add gcd and lcm for long values in MathUtils
[ https://issues.apache.org/jira/browse/MATH-239?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Christian Semrau updated MATH-239: -- Attachment: gcdForLong.txt The long versions of gcd and lcm are adapted copies of the int versions. I added some verification of exception messages to the tests, because I saw the change to gcd(int, int) where the exception message now contains the illegal arguments. To facilitate these (and possibly other) verifications, I added TestUtils.assertMessageContains(). Two of these verifications fail, because the exception is thrown by mulAndCheck without the illegal arguments; they are commented. Add gcd and lcm for long values in MathUtils Key: MATH-239 URL: https://issues.apache.org/jira/browse/MATH-239 Project: Commons Math Issue Type: New Feature Reporter: Christian Semrau Priority: Minor Fix For: 2.1 Attachments: gcdForLong.txt I suggest adding MathUtils.gcd and MathUtils.lcm for long values in addition to the methods for int values. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (DBCP-212) PoolingDataSource closes physical connections
[ https://issues.apache.org/jira/browse/DBCP-212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12675697#action_12675697 ] Mark Thomas commented on DBCP-212: -- I can't see a good reason for the sync on makeObject() so I removed it. It does seem to do a little to alleviate the problem but the issue is still significant. PoolingDataSource closes physical connections - Key: DBCP-212 URL: https://issues.apache.org/jira/browse/DBCP-212 Project: Commons Dbcp Issue Type: Bug Affects Versions: 1.2.2 Environment: Windows XP, Java 1.5.0_06-b05, Sybase ASE 12.5.4, jConnect 6.0.5 EBF 13862, Commons Pool 1.3 Reporter: Marcos Sanz Fix For: 1.3 Attachments: DBCPtester.java, DBCPtester.java, output.txt By executing the attached program and monitoring the process id of the physical connections at the database server, it is possible to demonstrate that the connections are being actually physically closed and reopened by the application at a very high rate. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Created: (MATH-248) Multiplying sparse matrices is slow
Multiplying sparse matrices is slow --- Key: MATH-248 URL: https://issues.apache.org/jira/browse/MATH-248 Project: Commons Math Issue Type: Improvement Reporter: Christian Semrau Priority: Minor The multiplication of sparse real matrices is very slow compared to real matrices: Ten times as slow for size 200, four times as slow for size 400. The time is independent of the number of nonzero entries, because the general algorithm inherited from AbstractRealMatrix is used. I suggest using a specialized multiplication algorithm for matrices that are sparse enough, walking only over the nonzero entries in one of the matrices. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (MATH-248) Multiplying sparse matrices is slow
[ https://issues.apache.org/jira/browse/MATH-248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12675698#action_12675698 ] Christian Semrau commented on MATH-248: --- According to my little tests, walking in optimized order and adding the pairwise products to the result matrix is much faster for very sparse matrices, but for a full matrix (every entry set to 1), it is about 50% slower than the current implementation. So the implementation might switch between the two algorithms. Also one might wish to walk the other matrix if it is more sparse than this. Multiplying sparse matrices is slow --- Key: MATH-248 URL: https://issues.apache.org/jira/browse/MATH-248 Project: Commons Math Issue Type: Improvement Reporter: Christian Semrau Priority: Minor The multiplication of sparse real matrices is very slow compared to real matrices: Ten times as slow for size 200, four times as slow for size 400. The time is independent of the number of nonzero entries, because the general algorithm inherited from AbstractRealMatrix is used. I suggest using a specialized multiplication algorithm for matrices that are sparse enough, walking only over the nonzero entries in one of the matrices. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (DBCP-212) PoolingDataSource closes physical connections
[ https://issues.apache.org/jira/browse/DBCP-212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12675699#action_12675699 ] Mark Thomas commented on DBCP-212: -- I have to add the sync back in - without it, driver registration was broken. Once I get to the bottom of why, I'll take the sync back out if I can. PoolingDataSource closes physical connections - Key: DBCP-212 URL: https://issues.apache.org/jira/browse/DBCP-212 Project: Commons Dbcp Issue Type: Bug Affects Versions: 1.2.2 Environment: Windows XP, Java 1.5.0_06-b05, Sybase ASE 12.5.4, jConnect 6.0.5 EBF 13862, Commons Pool 1.3 Reporter: Marcos Sanz Fix For: 1.3 Attachments: DBCPtester.java, DBCPtester.java, output.txt By executing the attached program and monitoring the process id of the physical connections at the database server, it is possible to demonstrate that the connections are being actually physically closed and reopened by the application at a very high rate. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (MATH-248) Multiplying sparse matrices is slow
[ https://issues.apache.org/jira/browse/MATH-248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12675704#action_12675704 ] Luc Maisonobe commented on MATH-248: You are right. It is probably even worse when compared to DenseRealMatrix which should be more cache-friendly than RealMatrixImpl. It is also possible to walk through non-zero elements of both matrices. Could you provide a patch for this ? Multiplying sparse matrices is slow --- Key: MATH-248 URL: https://issues.apache.org/jira/browse/MATH-248 Project: Commons Math Issue Type: Improvement Reporter: Christian Semrau Priority: Minor The multiplication of sparse real matrices is very slow compared to real matrices: Ten times as slow for size 200, four times as slow for size 400. The time is independent of the number of nonzero entries, because the general algorithm inherited from AbstractRealMatrix is used. I suggest using a specialized multiplication algorithm for matrices that are sparse enough, walking only over the nonzero entries in one of the matrices. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (DBCP-212) PoolingDataSource closes physical connections
[ https://issues.apache.org/jira/browse/DBCP-212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mark Thomas updated DBCP-212: - Issue Type: Improvement (was: Bug) I'm changing the status of this to enhancement as the current code is working as designed, even if it could be smarter. If GenericObjectPool.addObjectToPool took account of the number of waiting threads then this issue would be easy to solve. That number isn't currently available but if POOL-75 is implemented then the number of waiting threads could be exposed. PoolingDataSource closes physical connections - Key: DBCP-212 URL: https://issues.apache.org/jira/browse/DBCP-212 Project: Commons Dbcp Issue Type: Improvement Affects Versions: 1.2.2 Environment: Windows XP, Java 1.5.0_06-b05, Sybase ASE 12.5.4, jConnect 6.0.5 EBF 13862, Commons Pool 1.3 Reporter: Marcos Sanz Fix For: 1.3 Attachments: DBCPtester.java, DBCPtester.java, output.txt By executing the attached program and monitoring the process id of the physical connections at the database server, it is possible to demonstrate that the connections are being actually physically closed and reopened by the application at a very high rate. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Updated: (LANG-483) Add ComparisonUtils to Commons Lang
[ https://issues.apache.org/jira/browse/LANG-483?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benjamin McCann updated LANG-483: - Attachment: ComparisonUtilsTest.java ComparisonUtils.java Add ComparisonUtils to Commons Lang --- Key: LANG-483 URL: https://issues.apache.org/jira/browse/LANG-483 Project: Commons Lang Issue Type: New Feature Reporter: Benjamin McCann Attachments: ComparisonUtils.java, ComparisonUtilsTest.java It'd be impossible to guess how many times code as been written to find the position of the maximum element in an array or the value of the minimum element in a list, etc. This class will handle all of that. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Created: (LANG-483) Add ComparisonUtils to Commons Lang
Add ComparisonUtils to Commons Lang --- Key: LANG-483 URL: https://issues.apache.org/jira/browse/LANG-483 Project: Commons Lang Issue Type: New Feature Reporter: Benjamin McCann Attachments: ComparisonUtils.java, ComparisonUtilsTest.java It'd be impossible to guess how many times code as been written to find the position of the maximum element in an array or the value of the minimum element in a list, etc. This class will handle all of that. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Resolved: (DBCP-175) [dbcp] I'd like to run init SQL after JDBC Connection creation in Tomcat DBCP
[ https://issues.apache.org/jira/browse/DBCP-175?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Phil Steitz resolved DBCP-175. -- Resolution: Fixed Patch applied with only minor modifications in r746849. Many thanks. [dbcp] I'd like to run init SQL after JDBC Connection creation in Tomcat DBCP - Key: DBCP-175 URL: https://issues.apache.org/jira/browse/DBCP-175 Project: Commons Dbcp Issue Type: Improvement Affects Versions: 1.2 Environment: Operating System: other Platform: Other Reporter: Jiri Melichna Assignee: Phil Steitz Priority: Minor Fix For: 1.3 Attachments: DBCP-175-1.txt, DBCP-175-2.txt, DBCP-175-2.txt, dbcp_add_init_sql.zip Hi! I'm porting some j2ee web based applications from BEA Web Logic to Tomcat 5.5. In BEA Web Lobic connection pool it is possible to specify init SQL qurery that server runs after connection is created (before first use). It's very good for example of national settings in Oracle. For correct czech sorting i have to run setting query: ALTER SESSION SET NLS_SORT = XCZECH First time i tryed to write interceptor into my application. This interceptor runs ALTER SESSION SET NLS_SORT = XCZECH before evey sorted query (SELECT ... ORDER BY...), but i had some performance problems. So i starded to work with DBCP. I was very wandered about DBCP packages in Tomcat 5.5 and i did not find sources of naming-factory-dbcp.jar. So i refactored, enhanced and compiled full DBCP (with pool and collections). Now i'm a little afraid of some library conflicts (full DBCP, full Pool and full Collections refactored into tomcat packages), but performance is OK and basic tests of my application seems good. I added property connectionInitSql for int SQL into BasicDataSource. I had to mofify BasicDataSourceFactory for correct setting of this property. Property is used in method createConnection() of DriverConnectionFactory to init Connection. It would be very nice if you will add this init feature into Tomcat DBCP. Best regards Jiri Melichna -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (VFS-203) FileObject..getName().getURI() returns URIs with spaces
[ https://issues.apache.org/jira/browse/VFS-203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12675776#action_12675776 ] Ralph Goers commented on VFS-203: - Yes, please send a patch. I'm fairly new to VFS and am just starting to go through Jira. I could use the help! FileObject..getName().getURI() returns URIs with spaces --- Key: VFS-203 URL: https://issues.apache.org/jira/browse/VFS-203 Project: Commons VFS Issue Type: Bug Affects Versions: 1.0 Reporter: Tim Lebedkov Windows supports file names with spaces and '#'. AFAIK spaces are not allowed in URIs and # will be interpreted as an URI fragment. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (LANG-482) Enhance StrSubstitutor to support nested ${var-${subvr}} expansion
[ https://issues.apache.org/jira/browse/LANG-482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12675777#action_12675777 ] Rob Walker commented on LANG-482: - Thanks - I'll need to take a look at these. The changes are working nicely to great benefit in our usage with a Felix based App here, but clearly they trip out some of the standard tests. - Rob Enhance StrSubstitutor to support nested ${var-${subvr}} expansion -- Key: LANG-482 URL: https://issues.apache.org/jira/browse/LANG-482 Project: Commons Lang Issue Type: Improvement Reporter: Rob Walker Priority: Minor Attachments: StrSubstitutor.java.nested.patch t would be really handy of StrSubstitutor could support nested variable interpolation: org.osgi.framework.system.packages=org.osgi.framework; version=1.4.0, \ org.osgi.service.packageadmin; version=1.2.0, \ org.osgi.service.startlevel; version=1.1.0, \ org.osgi.service.url; version=1.0.0, \ org.osgi.util.tracker; version=1.3.3 \ ${jre-${java.specification.version}} The process being to expand innermost variable references first and work outwards - this allows for very advance config, such as the above, which can dynamically detect the Java version and expand a JRE version specific property into the property being defined. Looking at the implementation, it seems it might be a fairly straightforward enhancement to: private int substitute(StrBuilder buf, int offset, int length, List priorVariables) The code already has the cyclic map in place. I already have code that achieves this within Apache Felix, so I will see if I can retro-fit a similar model to the above and if so submit a patch. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (VFS-203) FileObject..getName().getURI() returns URIs with spaces
[ https://issues.apache.org/jira/browse/VFS-203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12675791#action_12675791 ] Mario Ivankovits commented on VFS-203: -- Hmmm normally escaping these special charachters should do the trick, e.g. %20 instead of space. It might not look nice, but this is how URIs work (IMHO) FileObject..getName().getURI() returns URIs with spaces --- Key: VFS-203 URL: https://issues.apache.org/jira/browse/VFS-203 Project: Commons VFS Issue Type: Bug Affects Versions: 1.0 Reporter: Tim Lebedkov Windows supports file names with spaces and '#'. AFAIK spaces are not allowed in URIs and # will be interpreted as an URI fragment. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (VFS-203) FileObject..getName().getURI() returns URIs with spaces
[ https://issues.apache.org/jira/browse/VFS-203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12675796#action_12675796 ] Ralph Goers commented on VFS-203: - Yes, the URI should contain %20 but the actual file would hopefully contain a space. In any case, I'd still like to see the patch. FileObject..getName().getURI() returns URIs with spaces --- Key: VFS-203 URL: https://issues.apache.org/jira/browse/VFS-203 Project: Commons VFS Issue Type: Bug Affects Versions: 1.0 Reporter: Tim Lebedkov Windows supports file names with spaces and '#'. AFAIK spaces are not allowed in URIs and # will be interpreted as an URI fragment. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Commented: (VFS-203) FileObject..getName().getURI() returns URIs with spaces
[ https://issues.apache.org/jira/browse/VFS-203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12675797#action_12675797 ] Joerg Schaible commented on VFS-203: Benjamin Bentman once gave a good summary of this issue on the Maven list. Citation of http://markmail.org/message/lbnhjsmzrc2ht2fa and following below: {quote} URLs and filesystem paths are really two different beasts and converting between them is not trivial. The main source of problems is that different encoding rules apply for the strings that make up a URL or filesystem path. For example, consider the following code snippet: File file = new File( foo bar+foo ); URL url = file.toURI().toURL(); System.out.println( file.toURL() ); System.out.println( url ); System.out.println( url.getPath() ); System.out.println( URLDecoder.decode( url.getPath(), UTF-8 ) ); which outputs something like file:/M:/scratch-pad/foo bar+foo file:/M:/scratch-pad/foo%20bar+foo /M:/scratch-pad/foo%20bar+foo /M:/scratch-pad/foo bar foo First of all, please note that File.toURL() does not escape the space character. This yields an invalid URL, as per RFC 2396, section 2.4.3 Excluded US-ASCII Characters. The class java.net.URL will silently accept such invalid URLs, in contrast java.net.URI will not (see also URL.toURI()). For this reason, this API method has already been deprecated and should be replaced with File.toURI().toURL(). Next, URL.getPath() does in general not return a string that can be used as a filesystem path. It returns a substring of the URL and as such can contain escape sequences. The prominent example is the space character which will show up as %20. People sometimes hack around this by means of replace(%20, ) but that does simply not cover all cases. It's worth to mention that on the other hand the related method URI.getPath() does decode escapes but still the result is not a filesystem path (compare the source for the constructor File(URI)). To decode a URL, people sometimes also choose java.net.URLDecoder. The pitfall with this class is that is actually performs HTML form decoding which is yet another encoding and not the same as the URL encoding (compare last paragraph in class javadoc about java.net.URL). For instance, a URLDecoder will errorneously convert the character + into a space as illustrated by the last sysout in the example above. Code targetting JRE 1.4+ should easily avoid these problems by using new File( new URI( url.toString() ) ) when converting a URL to a filesystem path and with JDKs = 1.5 using file.toURI().toURL() when converting back. JRE 1.4 is happily returning invalid/unescaped URLs from ClassLoader.getResource(), making the above suggestion fail with a URISyntaxException. The suggestion is to use FileUtils.toFile(URL) from Commons IO. {quote} FileObject..getName().getURI() returns URIs with spaces --- Key: VFS-203 URL: https://issues.apache.org/jira/browse/VFS-203 Project: Commons VFS Issue Type: Bug Affects Versions: 1.0 Reporter: Tim Lebedkov Windows supports file names with spaces and '#'. AFAIK spaces are not allowed in URIs and # will be interpreted as an URI fragment. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.