Skip to content

Commit

Permalink
ResultSetWrappingSqlRowSet preserves first matching column per name (…
Browse files Browse the repository at this point in the history
…as defined in ResultSet's javadoc)

Issue: SPR-11786
(cherry picked from commit 0728e32)
  • Loading branch information
jhoeller committed May 15, 2014
1 parent bc43f2e commit 3ae6c0f
Showing 1 changed file with 7 additions and 2 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -99,7 +99,12 @@ public ResultSetWrappingSqlRowSet(ResultSet resultSet) throws InvalidResultSetAc
int columnCount = rsmd.getColumnCount();
this.columnLabelMap = new HashMap<String, Integer>(columnCount);
for (int i = 1; i <= columnCount; i++) {
this.columnLabelMap.put(rsmd.getColumnLabel(i), i);
String key = rsmd.getColumnLabel(i);
// Make sure to preserve first matching column for any given name,
// as defined in ResultSet's type-level javadoc (lines 81 to 83).
if (!this.columnLabelMap.containsKey(key)) {
this.columnLabelMap.put(key, i);
}
}
}
else {
Expand Down

0 comments on commit 3ae6c0f

Please sign in to comment.