Skip to content

Commit 404a67f

Browse files
committed
avoid use of URL equals()/hashCode() in AbstractScannerImpl
I hope this is the right fix 🤞
1 parent a8638f1 commit 404a67f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hibernate-scan-jandex/src/main/java/org/hibernate/archive/scan/spi/AbstractScannerImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public abstract class AbstractScannerImpl implements Scanner {
3030
private final ArchiveDescriptorFactory archiveDescriptorFactory;
31-
private final Map<URL, ArchiveDescriptorInfo> archiveDescriptorCache = new HashMap<>();
31+
private final Map<String, ArchiveDescriptorInfo> archiveDescriptorCache = new HashMap<>();
3232

3333
protected AbstractScannerImpl(ArchiveDescriptorFactory archiveDescriptorFactory) {
3434
this.archiveDescriptorFactory = archiveDescriptorFactory;
@@ -62,13 +62,13 @@ private ArchiveDescriptor buildArchiveDescriptor(
6262
ScanEnvironment environment,
6363
boolean isRootUrl) {
6464
final ArchiveDescriptor descriptor;
65-
final ArchiveDescriptorInfo descriptorInfo = archiveDescriptorCache.get( url );
65+
final ArchiveDescriptorInfo descriptorInfo = archiveDescriptorCache.get( url.toExternalForm() );
6666
if ( descriptorInfo == null ) {
6767
if ( !isRootUrl && archiveDescriptorFactory instanceof JarFileEntryUrlAdjuster jarFileEntryUrlAdjuster ) {
6868
url = jarFileEntryUrlAdjuster.adjustJarFileEntryUrl( url, environment.getRootUrl() );
6969
}
7070
descriptor = archiveDescriptorFactory.buildArchiveDescriptor( url );
71-
archiveDescriptorCache.put( url, new ArchiveDescriptorInfo( descriptor, isRootUrl ) );
71+
archiveDescriptorCache.put( url.toExternalForm(), new ArchiveDescriptorInfo( descriptor, isRootUrl ) );
7272
}
7373
else {
7474
validateReuse( descriptorInfo, isRootUrl );
@@ -135,9 +135,9 @@ public ArchiveEntryHandler obtainArchiveEntryHandler(ArchiveEntry entry) {
135135
return packageEntryHandler;
136136
}
137137
else if ( nameWithinArchive.endsWith( "module-info.class" ) ) {
138-
//There's two reasons to skip this: the most important one is that Jandex
139-
//is unable to analyze them, so we need to dodge it.
140-
//Secondarily, we have no use for these so let's save the effort.
138+
// There are two reasons to skip this: the most important one is
139+
// that Jandex is unable to analyze them, so we need to dodge it.
140+
// Secondly, we have no use for these, so let's save the effort.
141141
return NoopEntryHandler.NOOP_INSTANCE;
142142
}
143143
else if ( nameWithinArchive.endsWith( ".class" ) ) {

0 commit comments

Comments
 (0)