Skip to content

Commit

Permalink
Fix the case sensitivity issue caused by using CaseInsensitiveMap keys.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamhucong committed Oct 11, 2023
1 parent c2e6330 commit 54be15a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public String getLogicColumnByCipherColumn(final String cipherColumnName) {
public String getLogicColumnByAssistedQueryColumn(final String assistQueryColumnName) {
for (Entry<String, EncryptColumn> entry : columns.entrySet()) {
if (entry.getValue().getAssistedQuery().isPresent() && entry.getValue().getAssistedQuery().get().getName().equalsIgnoreCase(assistQueryColumnName)) {
return entry.getKey();
return entry.getValue().getName();
}
}
throw new EncryptLogicColumnNotFoundException(assistQueryColumnName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -140,7 +141,18 @@ private void setColumnNames(final Iterator<Result> rows) {
if (rows.hasNext()) {
compensateResult = rows.next();
}
columnNames = null == compensateResult ? Arrays.asList(ROW_KEY_COLUMN_NAME, CONTENT_COLUMN_NAME) : parseResult(compensateResult).keySet();
columnNames = null == compensateResult ? Arrays.asList(ROW_KEY_COLUMN_NAME, CONTENT_COLUMN_NAME) : parseResultColumnNames(compensateResult);
}

private Collection<String> parseResultColumnNames(final Result result) {
Collection<String> columnNames = new LinkedList<>();
columnNames.add(ROW_KEY_COLUMN_NAME);
for (Cell each : result.listCells()) {
String column = new String(CellUtil.cloneQualifier(each), StandardCharsets.UTF_8);
columnNames.add(column);
}
columnNames.add(TIMESTAMP_COLUMN_NAME);
return columnNames;
}

private Map<String, String> parseResult(final Result result) {
Expand Down

0 comments on commit 54be15a

Please sign in to comment.