Skip to content

Commit 710a2eb

Browse files
committed
Added workaround for AS7 which doesn't handle # characters in URLs correctly
1 parent a750c5c commit 710a2eb

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎annotations-impl/src/main/java/org/ocpsoft/rewrite/annotation/scan/WebClassesFinder.java‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,15 @@ protected void processDirectory(URL classesFolderUrl, URL directoryUrl, ClassVis
124124
continue;
125125
}
126126

127+
// we are using toString() instead of getPath() because AS7 doesn't handle # characters correctly
128+
String entryName = entryUrl.toString();
129+
127130
// if this URL ends with .class it is a Java class
128-
if (entryUrl.getPath().endsWith(".class"))
131+
if (entryName.endsWith(".class"))
129132
{
130133

131134
// the name of the entry relative to the '/WEB-INF/classes/' folder
132-
String entryRelativeName = getPathRelativeToClassesFolder(entryUrl.getPath(), classesFolderPath);
135+
String entryRelativeName = getPathRelativeToClassesFolder(entryName, classesFolderPath);
133136

134137
// build class name from relative name
135138
String className = getClassName(entryRelativeName);
@@ -190,7 +193,7 @@ protected void processDirectory(URL classesFolderUrl, URL directoryUrl, ClassVis
190193
}
191194

192195
// if this URL ends with a slash, its a directory
193-
if (entryUrl.getPath().endsWith("/"))
196+
if (entryName.endsWith("/"))
194197
{
195198

196199
// walk down the directory

‎config-prettyfaces/src/main/java/com/ocpsoft/pretty/faces/config/annotation/WebClassesFinder.java‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,15 @@ protected void processDirectory(URL classesFolderUrl, URL directoryUrl, PrettyAn
127127
continue;
128128
}
129129

130+
// we are using toString() instead of getPath() because AS7 doesn't handle # characters correctly
131+
String entryName = entryUrl.toString();
132+
130133
// if this URL ends with .class it is a Java class
131-
if (entryUrl.getPath().endsWith(".class"))
134+
if (entryName.endsWith(".class"))
132135
{
133136

134137
// the name of the entry relative to the '/WEB-INF/classes/' folder
135-
String entryRelativeName = getPathRelativeToClassesFolder(entryUrl.getPath(), classesFolderPath);
138+
String entryRelativeName = getPathRelativeToClassesFolder(entryName, classesFolderPath);
136139

137140
// build class name from relative name
138141
String className = getClassName(entryRelativeName);
@@ -193,7 +196,7 @@ protected void processDirectory(URL classesFolderUrl, URL directoryUrl, PrettyAn
193196
}
194197

195198
// if this URL ends with a slash, its a directory
196-
if (entryUrl.getPath().endsWith("/"))
199+
if (entryName.endsWith("/"))
197200
{
198201

199202
// walk down the directory

0 commit comments

Comments
 (0)