Author: bdaw
Date: 2007-06-14 19:44:39 -0400 (Thu, 14 Jun 2007)
New Revision: 7429
Modified:
trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java
trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java
trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java
Log:
rollback recent changes that broke portal deployment
Modified: trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java 2007-06-14
23:20:26 UTC (rev 7428)
+++ trunk/common/src/main/org/jboss/portal/common/jar/JarEntryInfo.java 2007-06-14
23:44:39 UTC (rev 7429)
@@ -52,12 +52,9 @@
throw new IllegalArgumentException();
}
+ //
String entryName = entry.getName();
ArrayList atoms = new ArrayList();
-
- //add the root element since this is not actually included in the jar as a entry
- atoms.add("/");
-
int previous = -1;
while (true)
{
Modified:
trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java 2007-06-14
23:20:26 UTC (rev 7428)
+++
trunk/common/src/main/org/jboss/portal/common/net/file/FileURLNavigationProvider.java 2007-06-14
23:44:39 UTC (rev 7429)
@@ -29,7 +29,6 @@
import java.util.Arrays;
import java.net.URL;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.File;
@@ -54,55 +53,48 @@
private void visit(File file, URLVisitor visitor, URLFilter filter) throws
IllegalArgumentException, IOException
{
- if (!file.exists())
+ String name = file.getName();
+ if (file.isDirectory())
{
- throw new FileNotFoundException();
- }
- else
- {
- String name = file.getName();
- if (file.isDirectory())
+ if (trace)
{
- if (trace)
- {
- log.debug("entering directory" + file.getAbsolutePath());
- }
- URL url = file.toURL();
- boolean visit = filter == null || filter.acceptDir(url);
- if (visit)
- {
- visitor.startDir(url, name);
- File[] childrenFiles = file.listFiles();
- Arrays.sort(childrenFiles);
- for (int i = 0; i < childrenFiles.length; i++)
- {
- File childFile = childrenFiles[i];
- visit(childFile, visitor, filter);
- }
- visitor.endDir(file.toURL(), name);
- if (trace)
- {
- log.debug("leaving directory" + file.getAbsolutePath());
- }
- }
+ log.debug("entering directory" + file.getAbsolutePath());
}
- else
+ URL url = file.toURL();
+ boolean visit = filter == null || filter.acceptDir(url);
+ if (visit)
{
- if (trace)
+ visitor.startDir(url, name);
+ File[] childrenFiles = file.listFiles();
+ Arrays.sort(childrenFiles);
+ for (int i = 0; i < childrenFiles.length; i++)
{
- log.debug("visiting file " + file.getAbsolutePath());
+ File childFile = childrenFiles[i];
+ visit(childFile, visitor, filter);
}
- URL url = file.toURL();
- File file2 = new File(url.getFile());
- if (file.equals(file2) && filter.acceptFile(url))
+ visitor.endDir(file.toURL(), name);
+ if (trace)
{
- visitor.file(url, name);
+ log.debug("leaving directory" + file.getAbsolutePath());
}
- else if (trace)
- {
- log.debug("The file does not respect url format");
- }
}
}
+ else
+ {
+ if (trace)
+ {
+ log.debug("visiting file " + file.getAbsolutePath());
+ }
+ URL url = file.toURL();
+ File file2 = new File(url.getFile());
+ if (file.equals(file2))
+ {
+ visitor.file(url, name);
+ }
+ else if (trace)
+ {
+ log.debug("The file does not respect url format");
+ }
+ }
}
}
Modified:
trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java
===================================================================
---
trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java 2007-06-14
23:20:26 UTC (rev 7428)
+++
trunk/common/src/main/org/jboss/portal/common/net/jar/JarURLNavigationProvider.java 2007-06-14
23:44:39 UTC (rev 7429)
@@ -65,27 +65,13 @@
JarFile jarFile = conn.getJarFile();
URL jarURL = conn.getJarFileURL();
JarEntry rootEntry = conn.getJarEntry();
-
- // if the URL specifies a directory without a "/" at the end
- // the entry will be found, except it won't actually exist.
- // To get around this issue, we need to check if an entry exists
- // with a "/" at the end.
- if (rootEntry != null)
+
+ //
+ if (rootEntry == null)
{
- JarEntry testDirEntry = conn.getJarFile().getJarEntry(rootEntry +
"/");
- if (testDirEntry != null)
- {
- rootEntry = testDirEntry;
- }
+ throw new NotYetImplemented("The code for exact jar url has not been
implemented");
}
- else
- {
- // if rootEntry == null then the url points to the root of the jar. The problem
- // is that the root of the jar doesn't actually exist in the jar.
- // We need to create a fake jar entry to mimic this behavior
- rootEntry = new JarEntry("/");
- }
-
+
// Get the root entry
JarEntryInfo rootEntryInfo = new JarEntryInfo(rootEntry);
@@ -103,15 +89,8 @@
// Only consider descendant of the root or root itself
if (entryInfo.equals(rootEntryInfo) || entryInfo.isDescendantOf(rootEntryInfo))
{
- List relPath;
// The relative path from the root
- if (rootEntryInfo.size() > 1){
- relPath = entryInfo.getNames().subList(rootEntryInfo.size() - 1,
entryInfo.size());
- }
- else
- {
- relPath = entryInfo.getNames();
- }
+ List relPath = entryInfo.getNames().subList(rootEntryInfo.size() - 1,
entryInfo.size());
// Enter intermediate dirs
while (stack.size() < relPath.size() - 1 && enabled)
@@ -166,10 +145,7 @@
String name = (String)relPath.get(relPath.size() - 1);
stack.push(name, false);
URL url = stack.getURL();
- if (filter.acceptFile(url))
- {
- visitor.file(url, name);
- }
+ visitor.file(url, name);
stack.pop();
}
}