File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -129,14 +129,17 @@ public void setColName (final List<String> colNames) {
129
129
* @param newColName
130
130
*/
131
131
public void replaceColName (String originalColName , String newColName ) {
132
- if (Utils .isEmpty (originalColName ))
133
- throw new RuntimeException ("colName cannot be null." );
132
+ if (Objects .isNull (newColName ) || Utils .isEmpty (newColName ))
133
+ throw new RuntimeException ("The param 'newColName' cannot be null or empty." );
134
+
135
+ if (this .colNames .contains (newColName ))
136
+ throw new RuntimeException ("The newColName '" + newColName +"' already exists in table. Column names cannot be duplicated." );
134
137
135
138
if (this .colNames .contains (originalColName )) {
136
139
int index = colNames .indexOf (originalColName );
137
140
colNames .set (index , newColName );
138
141
} else {
139
- throw new RuntimeException ("colName '" + originalColName +"' does not exist in table." );
142
+ throw new RuntimeException ("The param originalColName '" + originalColName +"' does not exist in table." );
140
143
}
141
144
}
142
145
You can’t perform that action at this time.
0 commit comments