Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,17 @@ protected void prepareUndoLog(TableRecords beforeImage, TableRecords afterImage)
}
}

/**
* validate that the primary key is free of illegal characters
*
* @param pkVal primary key value
*/
protected void validPk(String pkVal) {
if (pkVal.contains(",")) {
throw new IllegalArgumentException(pkVal + " contains illegal character!");
}
}

/**
* build lockKey
*
Expand All @@ -406,7 +417,6 @@ protected String buildLockKey(TableRecords rowsIncludingPK) {
if (rowsIncludingPK.size() == 0) {
return null;
}

StringBuilder sb = new StringBuilder();
sb.append(rowsIncludingPK.getTableMeta().getTableName());
sb.append(":");
Expand All @@ -419,7 +429,9 @@ protected String buildLockKey(TableRecords rowsIncludingPK) {
if (pkSplitIndex > 0) {
sb.append("_");
}
sb.append(rowMap.get(pkName).getValue());
Object pkVal = rowMap.get(pkName).getValue();
validPk(String.valueOf(pkVal));
sb.append(pkVal);
pkSplitIndex++;
}
rowSequence++;
Expand Down