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) {
129129 * @param newColName
130130 */
131131 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." );
134137
135138 if (this .colNames .contains (originalColName )) {
136139 int index = colNames .indexOf (originalColName );
137140 colNames .set (index , newColName );
138141 } 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." );
140143 }
141144 }
142145
You can’t perform that action at this time.
0 commit comments