apache / apache/lucene

java.lang.NumberFormatException: For input string: "4g3 (1)" [LUCENE-4405]

Open
#5,471 4 comments 0 reactions 0 assignees View on GitHub
affects-version:3.5 legacy-jira-priority:Major module:core/index type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

When trying to instantiate IndexWriter, I get this exception. I have no other clues on why this might happen.

Caused by: java.lang.NumberFormatException: For input string: "4g3 (1)"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Long.parseLong(Long.java:419)
at org.apache.lucene.index.SegmentInfos.generationFromSegmentsFileName(SegmentInfos.java:214)
at org.apache.lucene.index.SegmentInfos.getCurrentSegmentGeneration(SegmentInfos.java:149)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:626)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:575)
at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:346)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1115)

---
Migrated from [LUCENE-4405](https://issues.apache.org/jira/browse/LUCENE-4405) by Radhakrishna Bhat, updated Sep 11 2014
Environment:
```
Windows 7 64 bit JDK
```

Contributor guide

Open the contributing guide

Research direction

Start with SegmentInfos.generationFromSegmentsFileName and the surrounding read path in SegmentInfos.java, using the provided IndexWriter stack trace as the entry point. Reproduce the failure on the stated Windows/JDK environment and determine why "4g3 (1)" is passed to Long.parseLong; done means the cause and expected handling are established, with a regression test if the project identifies a fixable behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.