Skip to content

Commit

Permalink
[#7655] ResultImpl#intoMap produces an incorrect error message on dup…
Browse files Browse the repository at this point in the history
…licate key
  • Loading branch information
lukaseder committed Jul 10, 2018
1 parent cddc738 commit 70685cb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions jOOQ/src/main/java/org/jooq/impl/ResultImpl.java
Expand Up @@ -379,12 +379,12 @@ public final Map<?, R> intoMap(Name keyFieldName) {
return intoMap(field(keyFieldName));
}

private final <K> Map<K, R> intoMap0(int keyFieldIndex) {
private final <K> Map<K, R> intoMap0(int kIndex) {
Map<K, R> map = new LinkedHashMap<K, R>();

for (R record : this)
if (map.put((K) record.get(keyFieldIndex), record) != null)
throw new InvalidResultException("Key " + keyFieldIndex + " is not unique in Result for " + this);
if (map.put((K) record.get(kIndex), record) != null)
throw new InvalidResultException("Key " + record.get(kIndex) + " is not unique in Result for " + this);

return map;
}
Expand Down Expand Up @@ -689,12 +689,12 @@ public final <K, E> Map<K, E> intoMap(Field<K> key, RecordMapper<? super R, E> m
return intoMap0(indexOrFail(fieldsRow(), key), mapper);
}

private final <K, E> Map<K, E> intoMap0(int keyFieldIndex, RecordMapper<? super R, E> mapper) {
private final <K, E> Map<K, E> intoMap0(int kIndex, RecordMapper<? super R, E> mapper) {
Map<K, E> map = new LinkedHashMap<K, E>();

for (R record : this)
if (map.put((K) record.get(keyFieldIndex), mapper.map(record)) != null)
throw new InvalidResultException("Key " + keyFieldIndex + " is not unique in Result for " + this);
if (map.put((K) record.get(kIndex), mapper.map(record)) != null)
throw new InvalidResultException("Key " + record.get(kIndex) + " is not unique in Result for " + this);

return map;
}
Expand Down

0 comments on commit 70685cb

Please sign in to comment.