You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xbean-scm@geronimo.apache.org by st...@apache.org on 2014/10/07 08:46:22 UTC
svn commit: r1629810 -
/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/archive/JarArchive.java
Author: struberg
Date: Tue Oct 7 06:46:22 2014
New Revision: 1629810
URL: http://svn.apache.org/r1629810
Log:
XBEAN-274 improve performance by rewriting replaceFirst with endsWith + substring.
The code just removes a ".class" at the end of the entry name.
Overall performance of finder improved by as much as 20%.
Modified:
geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/archive/JarArchive.java
Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/archive/JarArchive.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/archive/JarArchive.java?rev=1629810&r1=1629809&r2=1629810&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/archive/JarArchive.java (original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/archive/JarArchive.java Tue Oct 7 06:46:22 2014
@@ -103,12 +103,16 @@ public class JarArchive implements Archi
if (!stream.hasMoreElements()) return false;
final JarEntry entry = stream.nextElement();
+ final String entryName = entry.getName();
- if (entry.isDirectory() || !entry.getName().endsWith(".class")) {
+ if (entry.isDirectory() || !entryName.endsWith(".class")) {
return advance();
}
- final String className = entry.getName().replaceFirst(".class$", "");
+ String className = entryName;
+ if (entryName.endsWith(".class")) {
+ className = className.substring(0, className.length() - 6);
+ }
if (className.contains(".")) {
return advance();