Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexer: improve logging for empty .class/.jar files #3486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jukzi
Copy link
Contributor

@jukzi jukzi commented Dec 20, 2024

As happening with empty dummy ".class" / empty.jar files in tests for example during:
JavaElementDeltaTests.testChangeExternalLibFolder3(),
CompletionTests2.testBug281598b().
Empty files are no real problem they just do not need to be indexed.

was ArrayIndexOutOfBoundsException / "java.util.zip.ZipException: zip file is empty" with long stacktraces flooding the logfile

@jukzi
Copy link
Contributor Author

jukzi commented Dec 20, 2024

was for example


!ENTRY org.eclipse.jdt.core 4 4 2024-12-20 05:06:49.342
!MESSAGE Failed to index /P/empty.jar
!STACK 0
java.util.zip.ZipException: zip file is empty
	at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1781)
	at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1562)
	at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1657)
	at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1495)
	at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1458)
	at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:724)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:251)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:180)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:194)
	at org.eclipse.jdt.internal.core.search.indexing.AddJarFileToIndex.execute(AddJarFileToIndex.java:154)
	at org.eclipse.jdt.internal.core.search.processing.JobManager.indexerLoop(JobManager.java:541)
	at java.base/java.lang.Thread.run(Thread.java:1583)

!ENTRY org.eclipse.jdt.core 4 4 2024-12-20 05:06:49.342
!ENTRY org.eclipse.jdt.core 2 0 2024-12-20 04:59:55.951
!MESSAGE The Java indexing could not index /.org.eclipse.jdt.core.external.folders/.link12/p/X.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!STACK 0
org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
	at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:554)
	at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:218)
	at org.eclipse.jdt.internal.core.search.indexing.BinaryIndexer.indexDocument(BinaryIndexer.java:684)
	at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:99)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java:662)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager$2.execute(IndexManager.java:1267)
	at org.eclipse.jdt.internal.core.search.processing.JobManager.indexerLoop(JobManager.java:541)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused in /.org.eclipse.jdt.core.external.folders/.link12/p/X.class by: java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 0
	at org.eclipse.jdt.internal.compiler.classfmt.ClassFileStruct.u2At(ClassFileStruct.java:55)
	at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:246)
	at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:218)
	at org.eclipse.jdt.internal.core.search.indexing.BinaryIndexer.indexDocument(BinaryIndexer.java:684)
	at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.indexDocument(JavaSearchParticipant.java:99)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexDocument(IndexManager.java:662)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager$2.execute(IndexManager.java:1267)
	at org.eclipse.jdt.internal.core.search.processing.JobManager.indexerLoop(JobManager.java:541)
	at java.base/java.lang.Thread.run(Thread.java:1583)
!MESSAGE File no longer exists: /TypeHierarchy/linked.jar
!STACK 0
java.nio.file.NoSuchFileException: C:\Users\genie.releng\workspace\AutomatedTests\ep435I-unit-win32-x86_64-java21\workarea\I20241219-1920\eclipse-testing\test-eclipse\eclipse\jdt_model_folder\unknown.jar
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53)
	at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:197)
	at java.base/java.nio.file.Files.readAttributes(Files.java:1853)
	at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1445)
	at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:724)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:251)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:180)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:194)
	at org.eclipse.jdt.internal.core.search.indexing.AddJarFileToIndex.execute(AddJarFileToIndex.java:154)
	at org.eclipse.jdt.internal.core.search.processing.JobManager.indexerLoop(JobManager.java:541)
	at java.base/java.lang.Thread.run(Thread.java:1583)

https://download.eclipse.org/eclipse/downloads/drops4/R-4.32-202406010610/testresults/ep432I-unit-win32-java17_win32.win32.x86_64_17/org.eclipse.jdt.core.tests.model.AllJavaModelTests.txt

As happening with empty dummy ".class" / empty.jar files in tests
for example during:
 JavaElementDeltaTests.testChangeExternalLibFolder3(),
 CompletionTests2.testBug281598b().
Empty files are no real problem they just do not need to be indexed.

was ArrayIndexOutOfBoundsException / "java.util.zip.ZipException: zip
file is empty" with long stacktraces flooding the logfile
@jukzi jukzi added the test Work on unit tests, no change of productive code label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Work on unit tests, no change of productive code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant