[Arakhnę-Dev] [161] * Bug fix: because Windows operating system uses '\' has file separator, some regular expression patterns in ReflectionUtil are failing when running under Windows . |
[ Thread Index |
Date Index
| More arakhne.org/dev Archives
]
- To: dev@xxxxxxxxxxx
- Subject: [Arakhnę-Dev] [161] * Bug fix: because Windows operating system uses '\' has file separator, some regular expression patterns in ReflectionUtil are failing when running under Windows .
- From: subversion@xxxxxxxxxxxxx
- Date: Mon, 12 Jul 2010 16:11:41 +0200
Revision: 161
Author: galland
Date: 2010-07-12 16:11:41 +0200 (Mon, 12 Jul 2010)
Log Message:
-----------
* Bug fix: because Windows operating system uses '\' has file separator, some regular expression patterns in ReflectionUtil are failing when running under Windows.
Modified Paths:
--------------
trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ReflectionUtil.java
Modified: trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ReflectionUtil.java
===================================================================
--- trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ReflectionUtil.java 2010-06-15 10:13:44 UTC (rev 160)
+++ trunk/arakhneVmutils/java/src/main/java/org/arakhne/vmutil/ReflectionUtil.java 2010-07-12 14:11:41 UTC (rev 161)
@@ -32,6 +32,7 @@
import java.util.TreeSet;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import java.util.regex.Pattern;
/**
* This utility class provides a way to extend the reflection API and
@@ -396,7 +397,8 @@
// In package and not inner class
if (entryPath.endsWith(".class") //$NON-NLS-1$
&& !entryPath.contains("$")) { //$NON-NLS-1$
- entryClassname = entryPath.substring(0, entryPath.length()-6).replaceAll(File.separator, "."); //$NON-NLS-1$
+ entryClassname = entryPath.substring(0, entryPath.length()-6).replaceAll(
+ Pattern.quote(File.separator), "."); //$NON-NLS-1$
try {
Class<?> clazz = Class.forName(entryClassname);
if ((className.isAssignableFrom(clazz))
@@ -447,7 +449,9 @@
else if (entryPath.endsWith(".class") //$NON-NLS-1$
&& !entryPath.contains("$")) { //$NON-NLS-1$
assert(ldir!=null);
- entryClassname = ldir.replaceAll(File.separator, ".") + "." + FileSystem.shortBasename(entryPath); //$NON-NLS-1$ //$NON-NLS-2$
+ entryClassname = ldir.replaceAll(
+ Pattern.quote(File.separator), ".") //$NON-NLS-1$
+ + "." + FileSystem.shortBasename(entryPath); //$NON-NLS-1$
try {
Class<?> clazz = Class.forName(entryClassname);
if ((className.isAssignableFrom(clazz))