Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 64076

Summary: Background Indexer Crash Recovery logs many exceptions
Product: [Eclipse Project] JDT Reporter: Ed Merks <Ed.Merks>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.0 RC1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Ed Merks CLA 2004-05-26 07:52:15 EDT
I've been getting these exceptions for a long time and they still happen 
frequently with M9:

!SESSION May 26, 2004 06:45:33.26 ----------------------------------------------
eclipse.buildId=I200405211200
java.fullversion=J2RE 1.4.1 IBM Windows 32 build cn1411-20030930 (JIT enabled: 
jitc)
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
!ENTRY org.eclipse.jdt.core 4 4 May 26, 2004 06:45:33.26
!MESSAGE Background Indexer Crash Recovery
!STACK 0
java.lang.IllegalArgumentException: Buffer size <= 0
 at java.io.BufferedInputStream.<init>(BufferedInputStream.java(Inlined Compiled 
Code))
 at java.io.BufferedInputStream.<init>(BufferedInputStream.java(Inlined Compiled 
Code))
 at 
org.eclipse.jdt.internal.core.index.DiskIndex.readCategoryTable(DiskIndex.java(C
ompiled Code))
 at 
org.eclipse.jdt.internal.core.index.DiskIndex.mergeCategory(DiskIndex.java:360)
 at 
org.eclipse.jdt.internal.core.index.DiskIndex.mergeCategories(DiskIndex.java:352
)
 at org.eclipse.jdt.internal.core.index.DiskIndex.mergeWith(DiskIndex.java:444)
 at org.eclipse.jdt.internal.core.index.Index.save(Index.java:171)
 at 
org.eclipse.jdt.internal.core.search.indexing.IndexManager.saveIndex(IndexManage
r.java:491)
 at 
org.eclipse.jdt.internal.core.search.indexing.IndexManager.saveIndexes(IndexMana
ger.java:533)
 at 
org.eclipse.jdt.internal.core.search.indexing.IndexManager.notifyIdle(IndexManag
er.java:354)
 at 
org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:3
50)
 at java.lang.Thread.run(Thread.java:568)

I'm not sure what causes them.
Comment 1 Kent Johnson CLA 2004-05-26 09:53:59 EDT
From the stack trace, this is the call we are making in DiskIndex:

DataInputStream stream = new DataInputStream(new BufferedInputStream(new 
FileInputStream(getIndexFile())));

The constructor in BufferedInputStream is:

public BufferedInputStream(InputStream in) {
  this(in, defaultBufferSize);
}

which calls:

public BufferedInputStream(InputStream in, int size) {
  super(in);
  if (size <= 0) {
    throw new IllegalArgumentException("Buffer size <= 0");
  }
  buf = new byte[size];
}

We do NOT pass in the buffer size (we use the default) so how can it be <= 0?

Its initialized as:

    private static int defaultBufferSize = 2048;

*** This bug has been marked as a duplicate of 57419 ***