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 2013/02/05 11:22:28 UTC
svn commit: r1442527 -
/stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/utils/ConfigUtils.java
Author: rwesten
Date: Tue Feb 5 10:22:28 2013
New Revision: 1442527
URL: http://svn.apache.org/viewvc?rev=1442527&view=rev
Log:
STANBOL-908: Copying of {name}.solrindex.zip files should now work even if ZipEntries do use backslashes as separator char
Modified:
stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/utils/ConfigUtils.java
Modified: stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/utils/ConfigUtils.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/utils/ConfigUtils.java?rev=1442527&r1=1442526&r2=1442527&view=diff
==============================================================================
--- stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/utils/ConfigUtils.java (original)
+++ stanbol/trunk/commons/solr/core/src/main/java/org/apache/stanbol/commons/solr/utils/ConfigUtils.java Tue Feb 5 10:22:28 2013
@@ -386,18 +386,19 @@ public final class ConfigUtils {
* found in the parsed resource this method returns <code>null</code>
*/
private static File prepairCopy(String resource, File targetDir, String context) {
- if (!(context.charAt(context.length() - 1) == '/')) {
- context = context + '/';
+ if (!(context.charAt(context.length() - 1) == File.separatorChar)) {
+ context = context + File.separatorChar;
}
+ resource = FilenameUtils.separatorsToSystem(resource);
int contextPos = resource.lastIndexOf(context);
if (contextPos >= 0) {
contextPos = contextPos + context.length();
} else {
- log.warn(String.format("Context %s not found in resource %s -> ignored!", context, resource));
+ log.warn("Context {} not found in resource {} -> ignored!", context, resource);
return null;
}
String relativePath = resource.substring(contextPos);
- String[] relativePathElements = relativePath.split("/");
+ String[] relativePathElements = relativePath.split(File.separator);
File parentElement = targetDir;
for (int i = 0; i < relativePathElements.length - 1; i++) {
File pathElement = new File(parentElement, relativePathElements[i]);