apache / apache/lucene

Ignoring the Return Values Of Immutable Objects [LUCENE-5506]

Open
#6,569 7 comments 0 reactions 0 assignees View on GitHub
affects-version:4.6.1 affects-version:4.7 legacy-jira-fix-version:4.9 legacy-jira-fix-version:6.0 legacy-jira-priority:Minor type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

I was checking the source code of Lucene and I realized that return values of immutable objects are ignored at CSVUtil.java and Compile.java as follows:

**CSVUtil.java**:

```Java
/**
* Quote and escape input value for CSV
*/
public static String quoteEscape(String original) {
String result = original;

if (result.indexOf('\"') >= 0) {
result.replace("\"", ESCAPED_QUOTE);
}
if(result.indexOf(COMMA) >= 0) {
result = "\"" + result + "\"";
}
return result;
}
```

**Compile.java**

```Java
if (args.length < 1) {
return;
}

args[0].toUpperCase(Locale.ROOT);
```

---
Migrated from [LUCENE-5506](https://issues.apache.org/jira/browse/LUCENE-5506) by Furkan Kamaci, 1 vote, updated May 09 2016
Attachments: [LUCENE-5506.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-5506/LUCENE-5506.patch)
Linked issues:
- #6584
- #6913

Contributor guide

Open the contributing guide

Research direction

Start by reading the quoteEscape method in CSVUtil.java and the argument handling around args[0] in Compile.java. Check the existing behavior for quoted CSV values and uppercased arguments; done means both methods use the intended transformed values without changing unrelated behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.