You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2009/11/16 20:37:12 UTC
svn commit: r880925 - in /incubator/shindig/trunk/java:
common/src/main/java/org/apache/shindig/common/uri/
gadgets/src/main/java/org/apache/shindig/gadgets/features/
gadgets/src/test/java/org/apache/shindig/gadgets/features/
Author: lindner
Date: Mon Nov 16 19:37:11 2009
New Revision: 880925
URL: http://svn.apache.org/viewvc?rev=880925&view=rev
Log:
SHINDIG-1223 | windows directory searching issue
Modified:
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/uri/Uri.java
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java
incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/features/FeatureRegistryTest.java
Modified: incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/uri/Uri.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/uri/Uri.java?rev=880925&r1=880924&r2=880925&view=diff
==============================================================================
--- incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/uri/Uri.java (original)
+++ incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/uri/Uri.java Mon Nov 16 19:37:11 2009
@@ -70,6 +70,10 @@
}
if (authority != null) {
out.append("//").append(authority);
+ // insure that there's a separator between authority/path
+ if (path != null && path.length() > 1 && !path.startsWith("/")) {
+ out.append("/");
+ }
}
if (path != null) {
out.append(path);
Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java?rev=880925&r1=880924&r2=880925&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java Mon Nov 16 19:37:11 2009
@@ -37,6 +37,7 @@
import java.io.File;
import java.io.IOException;
+import java.net.URI;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -146,7 +147,7 @@
// Load files in directory structure.
logger.info("Loading files from: " + location);
- loadFile(uriLoc.getPath());
+ loadFile(new File(uriLoc.getPath()));
}
}
@@ -401,11 +402,10 @@
}
}
- private void loadFile(String filePath) throws GadgetException, IOException {
- File file = new File(filePath);
+ private void loadFile(File file) throws GadgetException, IOException {
if (!file.exists() || !file.canRead()) {
throw new GadgetException(GadgetException.Code.INVALID_CONFIG,
- "Feature file '" + filePath + "' doesn't exist or can't be read");
+ "Feature file '" + file.getPath() + "' doesn't exist or can't be read");
}
File[] toLoad = null;
@@ -416,13 +416,12 @@
}
for (File featureFile : toLoad) {
- String featureFilePath = featureFile.getAbsolutePath();
if (featureFile.isDirectory()) {
// Traverse into subdirectories.
- loadFile(featureFilePath);
- } else if (featureFilePath.toLowerCase(Locale.ENGLISH).endsWith(".xml")) {
+ loadFile(featureFile);
+ } else if (featureFile.getName().toLowerCase(Locale.ENGLISH).endsWith(".xml")) {
String content = ResourceLoader.getContent(featureFile);
- Uri parent = new UriBuilder().setScheme("file").setPath(featureFilePath).toUri();
+ Uri parent = Uri.fromJavaUri(featureFile.toURI());
loadFeature(parent, content);
} else {
if (logger.isLoggable(Level.FINEST)) {
Modified: incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/features/FeatureRegistryTest.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/features/FeatureRegistryTest.java?rev=880925&r1=880924&r2=880925&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/features/FeatureRegistryTest.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/features/FeatureRegistryTest.java Mon Nov 16 19:37:11 2009
@@ -510,7 +510,7 @@
BufferedWriter out = new BufferedWriter(new FileWriter(file));
out.write(content);
out.close();
- return new UriBuilder().setScheme("file").setPath(file.getPath()).toUri();
+ return Uri.fromJavaUri(file.toURI());
}
private static Uri makeResourceUri(String suffix) {