You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2011/07/18 10:45:16 UTC

svn commit: r1147784 - /incubator/stanbol/trunk/commons/stanboltools/bundledatafileprovider/src/main/java/org/apache/stanbol/commons/stanboltools/datafileprovider/bundle/impl/BundleDataFileProvider.java

Author: rwesten
Date: Mon Jul 18 08:45:15 2011
New Revision: 1147784

URL: http://svn.apache.org/viewvc?rev=1147784&view=rev
Log:
STANBOL-259: Now independent of the operating systems Unix style '/' are used to normalise configured search paths. Previously File.seperator was used causing the addition of a '\' at the end of configured search paths on Windows. This caused the Bundle.getResource(..) method to fail on providing resources on Windows

Modified:
    incubator/stanbol/trunk/commons/stanboltools/bundledatafileprovider/src/main/java/org/apache/stanbol/commons/stanboltools/datafileprovider/bundle/impl/BundleDataFileProvider.java

Modified: incubator/stanbol/trunk/commons/stanboltools/bundledatafileprovider/src/main/java/org/apache/stanbol/commons/stanboltools/datafileprovider/bundle/impl/BundleDataFileProvider.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/stanboltools/bundledatafileprovider/src/main/java/org/apache/stanbol/commons/stanboltools/datafileprovider/bundle/impl/BundleDataFileProvider.java?rev=1147784&r1=1147783&r2=1147784&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/stanboltools/bundledatafileprovider/src/main/java/org/apache/stanbol/commons/stanboltools/datafileprovider/bundle/impl/BundleDataFileProvider.java (original)
+++ incubator/stanbol/trunk/commons/stanboltools/bundledatafileprovider/src/main/java/org/apache/stanbol/commons/stanboltools/datafileprovider/bundle/impl/BundleDataFileProvider.java Mon Jul 18 08:45:15 2011
@@ -77,9 +77,14 @@ public class BundleDataFileProvider impl
             List<String> paths = new ArrayList<String>(searchPaths.size());
             for(String path : searchPaths){
                 if(path == null){ //null element is interpreted as the "" path
-                    path = File.separator;
-                } else if(!path.endsWith(File.separator)){ //normalise
-                    path = path+File.separator;
+                    path = "/";
+                } else {
+                    //we need Unix style '/' to search resources within bundles
+                    //even on Windows! (see STANBOL-259)
+                    path = FilenameUtils.separatorsToUnix(path);
+                    if(!path.endsWith("/")){ //normalise
+                        path = path+'/';
+                    }
                 }
                 if(!paths.contains(path)){ //do not add paths more than once
                     paths.add(path);
@@ -106,8 +111,6 @@ public class BundleDataFileProvider impl
         while(resource == null && relativePathIterator.hasNext()){
             String path = relativePathIterator.next();
             String resourceName = path != null ? path + filename : filename ;
-            //make the path platform independent (STANBOL-259)
-            resourceName = FilenameUtils.separatorsToSystem(resourceName);
             resource = bundle.getEntry(resourceName);
         }
         log.info("Resource {} found: {}", (resource == null ? "NOT" : ""), filename);