Skip to content

Commit fd2cc3f

Browse files
style: QA/CI exceptions
Signed-off-by: Andreas Reichel <andreas@manticore-projects.com> Signed-off-by: manticore-projects <andreas@manticore-projects.com>
1 parent 365ff33 commit fd2cc3f

File tree

6 files changed

+112
-84
lines changed

6 files changed

+112
-84
lines changed

src/main/java/net/sf/jsqlparser/statement/alter/AlterExpression.java

Lines changed: 95 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,29 @@ public class AlterExpression implements Serializable {
5454
private boolean usingIfExists;
5555

5656
/**
57-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
57+
* @deprecated Use {@link #setIndex(Index)} with a
58+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
5859
*/
5960
@Deprecated
6061
private List<String> fkColumns;
6162

6263
/**
63-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
64+
* @deprecated Use {@link #setIndex(Index)} with a
65+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
6466
*/
6567
@Deprecated
6668
private String fkSourceSchema;
6769

6870
/**
69-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
71+
* @deprecated Use {@link #setIndex(Index)} with a
72+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
7073
*/
7174
@Deprecated
7275
private String fkSourceTable;
7376

7477
/**
75-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
78+
* @deprecated Use {@link #setIndex(Index)} with a
79+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
7680
*/
7781
@Deprecated
7882
private List<String> fkSourceColumns;
@@ -155,15 +159,17 @@ public void hasColumns(boolean hasColumns) {
155159
}
156160

157161
/**
158-
* @deprecated Use {@link #getIndex()} with {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
162+
* @deprecated Use {@link #getIndex()} with
163+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
159164
*/
160165
@Deprecated
161166
public String getFkSourceSchema() {
162167
return fkSourceSchema;
163168
}
164169

165170
/**
166-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
171+
* @deprecated Use {@link #setIndex(Index)} with a
172+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
167173
*/
168174
@Deprecated
169175
public void setFkSourceSchema(String fkSourceSchema) {
@@ -205,7 +211,9 @@ public void setOptionalSpecifier(String optionalSpecifier) {
205211
/**
206212
* @param type
207213
* @param action
208-
* @deprecated Standalone FK fields are deprecated. Use a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} via {@link #setIndex(Index)} instead.
214+
* @deprecated Standalone FK fields are deprecated. Use a
215+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} via
216+
* {@link #setIndex(Index)} instead.
209217
*/
210218
@Deprecated
211219
public void setReferentialAction(Type type, Action action) {
@@ -238,9 +246,9 @@ public void removeReferentialAction(Type type) {
238246
@Deprecated
239247
public ReferentialAction getReferentialAction(Type type) {
240248
return referentialActions.stream()
241-
.filter(ra -> type.equals(ra.getType()))
242-
.findFirst()
243-
.orElse(null);
249+
.filter(ra -> type.equals(ra.getType()))
250+
.findFirst()
251+
.orElse(null);
244252
}
245253

246254
private void setReferentialAction(Type type, Action action, boolean set) {
@@ -317,31 +325,35 @@ public void setOnDeleteSetNull(boolean onDeleteSetNull) {
317325
}
318326

319327
/**
320-
* @deprecated Use {@link #getIndex()} with {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
328+
* @deprecated Use {@link #getIndex()} with
329+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
321330
*/
322331
@Deprecated
323332
public List<String> getFkColumns() {
324333
return fkColumns;
325334
}
326335

327336
/**
328-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
337+
* @deprecated Use {@link #setIndex(Index)} with a
338+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
329339
*/
330340
@Deprecated
331341
public void setFkColumns(List<String> fkColumns) {
332342
this.fkColumns = fkColumns;
333343
}
334344

335345
/**
336-
* @deprecated Use {@link #getIndex()} with {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
346+
* @deprecated Use {@link #getIndex()} with
347+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
337348
*/
338349
@Deprecated
339350
public String getFkSourceTable() {
340351
return fkSourceTable;
341352
}
342353

343354
/**
344-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
355+
* @deprecated Use {@link #setIndex(Index)} with a
356+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
345357
*/
346358
@Deprecated
347359
public void setFkSourceTable(String fkSourceTable) {
@@ -404,15 +416,17 @@ public List<ColumnSetVisibility> getColumnSetVisibilityList() {
404416
}
405417

406418
/**
407-
* @deprecated Use {@link #getIndex()} with {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
419+
* @deprecated Use {@link #getIndex()} with
420+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
408421
*/
409422
@Deprecated
410423
public List<String> getFkSourceColumns() {
411424
return fkSourceColumns;
412425
}
413426

414427
/**
415-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
428+
* @deprecated Use {@link #setIndex(Index)} with a
429+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
416430
*/
417431
@Deprecated
418432
public void setFkSourceColumns(List<String> fkSourceColumns) {
@@ -723,21 +737,21 @@ public final String toString() {
723737
}
724738

725739
/**
726-
* Appends the main body of this ALTER expression to the builder.
727-
* Subclasses override this for type-specific rendering.
740+
* Appends the main body of this ALTER expression to the builder. Subclasses override this for
741+
* type-specific rendering.
728742
*/
729743
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity",
730744
"PMD.ExcessiveMethodLength", "PMD.SwitchStmtsShouldHaveDefault"})
731745
protected void appendBody(StringBuilder b) {
732746
if (operation == AlterOperation.UNSPECIFIC) {
733747
b.append(optionalSpecifier);
734748
} else if (constraintType != null && constraintSymbol != null
735-
&& (operation == AlterOperation.ALTER || operation == AlterOperation.ADD)) {
749+
&& (operation == AlterOperation.ALTER || operation == AlterOperation.ADD)) {
736750
toStringConstraintAlter(b);
737751
} else if (operation == AlterOperation.ALTER
738-
&& (columnDropDefaultList != null && !columnDropDefaultList.isEmpty()
739-
|| columnSetDefaultList != null && !columnSetDefaultList.isEmpty()
740-
|| columnSetVisibilityList != null && !columnSetVisibilityList.isEmpty())) {
752+
&& (columnDropDefaultList != null && !columnDropDefaultList.isEmpty()
753+
|| columnSetDefaultList != null && !columnSetDefaultList.isEmpty()
754+
|| columnSetVisibilityList != null && !columnSetVisibilityList.isEmpty())) {
741755
toStringAlterColumn(b);
742756
} else if (isSimpleKeywordOperation()) {
743757
toStringSimpleKeyword(b);
@@ -833,10 +847,10 @@ protected void toStringConstraintAlter(StringBuilder b) {
833847
}
834848
} else {
835849
b.append("ADD CONSTRAINT ").append(constraintType).append(" ").append(constraintSymbol)
836-
.append(" ");
850+
.append(" ");
837851
if (index != null && index.getColumnsNames() != null) {
838852
b.append(" ")
839-
.append(PlainSelect.getStringList(index.getColumnsNames(), true, true));
853+
.append(PlainSelect.getStringList(index.getColumnsNames(), true, true));
840854
}
841855
}
842856
}
@@ -874,22 +888,30 @@ protected void toStringSimpleKeyword(StringBuilder b) {
874888
break;
875889
case ENGINE:
876890
b.append("ENGINE ");
877-
if (useEqual) { b.append("= "); }
891+
if (useEqual) {
892+
b.append("= ");
893+
}
878894
b.append(engineOption);
879895
break;
880896
case ALGORITHM:
881897
b.append("ALGORITHM ");
882-
if (useEqual) { b.append("= "); }
898+
if (useEqual) {
899+
b.append("= ");
900+
}
883901
b.append(algorithmOption);
884902
break;
885903
case KEY_BLOCK_SIZE:
886904
b.append("KEY_BLOCK_SIZE ");
887-
if (useEqual) { b.append("= "); }
905+
if (useEqual) {
906+
b.append("= ");
907+
}
888908
b.append(keyBlockSize);
889909
break;
890910
case LOCK:
891911
b.append("LOCK ");
892-
if (useEqual) { b.append("= "); }
912+
if (useEqual) {
913+
b.append("= ");
914+
}
893915
b.append(lockOption);
894916
break;
895917
}
@@ -925,7 +947,7 @@ protected void toStringDropSpecial(StringBuilder b) {
925947
break;
926948
case DROP_FOREIGN_KEY:
927949
b.append("DROP FOREIGN KEY (").append(PlainSelect.getStringList(pkColumns))
928-
.append(')');
950+
.append(')');
929951
break;
930952
default:
931953
// Oracle Multi Column Drop
@@ -940,25 +962,33 @@ protected void toStringConvert(StringBuilder b) {
940962
b.append("CONVERT TO CHARACTER SET ");
941963
} else if (convertType == ConvertType.DEFAULT_CHARACTER_SET) {
942964
b.append("DEFAULT CHARACTER SET ");
943-
if (hasEqualForCharacterSet) { b.append("= "); }
965+
if (hasEqualForCharacterSet) {
966+
b.append("= ");
967+
}
944968
} else if (convertType == ConvertType.CHARACTER_SET) {
945969
b.append("CHARACTER SET ");
946-
if (hasEqualForCharacterSet) { b.append("= "); }
970+
if (hasEqualForCharacterSet) {
971+
b.append("= ");
972+
}
947973
}
948974
if (getCharacterSet() != null) {
949975
b.append(getCharacterSet());
950976
}
951977
if (getCollation() != null) {
952978
b.append(" COLLATE ");
953-
if (hasEqualForCollate) { b.append("= "); }
979+
if (hasEqualForCollate) {
980+
b.append("= ");
981+
}
954982
b.append(getCollation());
955983
}
956984
} else {
957985
if (isDefaultCollateSpecified()) {
958986
b.append("DEFAULT ");
959987
}
960988
b.append("COLLATE ");
961-
if (hasEqualForCollate) { b.append("= "); }
989+
if (hasEqualForCollate) {
990+
b.append("= ");
991+
}
962992
if (getCollation() != null) {
963993
b.append(getCollation());
964994
}
@@ -970,11 +1000,15 @@ protected void toStringPartition(StringBuilder b) {
9701000
switch (operation) {
9711001
case DISCARD_PARTITION:
9721002
b.append("DISCARD PARTITION ").append(PlainSelect.getStringList(partitions));
973-
if (tableOption != null) { b.append(" ").append(tableOption); }
1003+
if (tableOption != null) {
1004+
b.append(" ").append(tableOption);
1005+
}
9741006
break;
9751007
case IMPORT_PARTITION:
9761008
b.append("IMPORT PARTITION ").append(PlainSelect.getStringList(partitions));
977-
if (tableOption != null) { b.append(" ").append(tableOption); }
1009+
if (tableOption != null) {
1010+
b.append(" ").append(tableOption);
1011+
}
9781012
break;
9791013
case TRUNCATE_PARTITION:
9801014
b.append("TRUNCATE PARTITION ").append(PlainSelect.getStringList(partitions));
@@ -984,17 +1018,17 @@ protected void toStringPartition(StringBuilder b) {
9841018
break;
9851019
case REORGANIZE_PARTITION:
9861020
b.append("REORGANIZE PARTITION ")
987-
.append(PlainSelect.getStringList(partitions))
988-
.append(" INTO (")
989-
.append(partitionDefinitions.stream()
990-
.map(PartitionDefinition::toString)
991-
.collect(Collectors.joining(", ")))
992-
.append(")");
1021+
.append(PlainSelect.getStringList(partitions))
1022+
.append(" INTO (")
1023+
.append(partitionDefinitions.stream()
1024+
.map(PartitionDefinition::toString)
1025+
.collect(Collectors.joining(", ")))
1026+
.append(")");
9931027
break;
9941028
case EXCHANGE_PARTITION:
9951029
b.append("EXCHANGE PARTITION ");
9961030
b.append(partitions.get(0)).append(" WITH TABLE ")
997-
.append(exchangePartitionTableName);
1031+
.append(exchangePartitionTableName);
9981032
if (exchangePartitionWithValidation) {
9991033
b.append(" WITH VALIDATION ");
10001034
} else if (exchangePartitionWithoutValidation) {
@@ -1027,16 +1061,16 @@ protected void toStringPartition(StringBuilder b) {
10271061
b.append("COLUMNS(").append(String.join(", ", partitionColumns)).append(") ");
10281062
}
10291063
b.append("(").append(partitionDefinitions.stream()
1030-
.map(PartitionDefinition::toString)
1031-
.collect(Collectors.joining(", ")))
1032-
.append(")");
1064+
.map(PartitionDefinition::toString)
1065+
.collect(Collectors.joining(", ")))
1066+
.append(")");
10331067
break;
10341068
}
10351069
}
10361070

10371071
/**
1038-
* Handles the general case for ADD, MODIFY, CHANGE, DROP (column), COMMENT,
1039-
* row-level security, and all field-based dispatch (columns, constraints, FK, UK, PK, index).
1072+
* Handles the general case for ADD, MODIFY, CHANGE, DROP (column), COMMENT, row-level security,
1073+
* and all field-based dispatch (columns, constraints, FK, UK, PK, index).
10401074
*/
10411075
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
10421076
protected void toStringGeneral(StringBuilder b) {
@@ -1084,7 +1118,7 @@ protected void toStringGeneral(StringBuilder b) {
10841118
b.append("COLUMNS ");
10851119
}
10861120
if (useIfNotExists
1087-
&& operation == AlterOperation.ADD) {
1121+
&& operation == AlterOperation.ADD) {
10881122
b.append("IF NOT EXISTS ");
10891123
}
10901124
}
@@ -1128,19 +1162,19 @@ protected void toStringGeneral(StringBuilder b) {
11281162
}
11291163
b.append(" (").append(PlainSelect.getStringList(ukColumns)).append(")");
11301164
} else if (fkColumns != null
1131-
&& !(index instanceof net.sf.jsqlparser.statement.create.table.ForeignKeyIndex)) {
1165+
&& !(index instanceof net.sf.jsqlparser.statement.create.table.ForeignKeyIndex)) {
11321166
// @deprecated path - kept for backward compatibility when ForeignKeyIndex is not set
11331167
b.append("FOREIGN KEY (")
1134-
.append(PlainSelect.getStringList(fkColumns))
1135-
.append(") REFERENCES ")
1136-
.append(
1137-
fkSourceSchema != null && fkSourceSchema.trim().length() > 0
1138-
? fkSourceSchema + "."
1139-
: "")
1140-
.append(fkSourceTable)
1141-
.append(" (")
1142-
.append(PlainSelect.getStringList(fkSourceColumns))
1143-
.append(")");
1168+
.append(PlainSelect.getStringList(fkColumns))
1169+
.append(") REFERENCES ")
1170+
.append(
1171+
fkSourceSchema != null && fkSourceSchema.trim().length() > 0
1172+
? fkSourceSchema + "."
1173+
: "")
1174+
.append(fkSourceTable)
1175+
.append(" (")
1176+
.append(PlainSelect.getStringList(fkSourceColumns))
1177+
.append(")");
11441178
referentialActions.forEach(b::append);
11451179
} else if (index != null) {
11461180
b.append(index);
@@ -1374,7 +1408,7 @@ public ColumnDataType(
13741408
@Override
13751409
public String toString() {
13761410
return getColumnName() + (withType ? " TYPE " : getColDataType() == null ? "" : " ")
1377-
+ toStringDataTypeAndSpec();
1411+
+ toStringDataTypeAndSpec();
13781412
}
13791413

13801414
@Override
@@ -1498,4 +1532,4 @@ public String toString() {
14981532
public enum ConvertType {
14991533
CONVERT_TO, DEFAULT_CHARACTER_SET, CHARACTER_SET
15001534
}
1501-
}
1535+
}

src/main/java/net/sf/jsqlparser/statement/alter/AlterExpressionCharset.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
package net.sf.jsqlparser.statement.alter;
1111

1212
/**
13-
* Internal subclass for character set and collation operations within ALTER TABLE.
14-
* Handles CONVERT TO CHARACTER SET, DEFAULT CHARACTER SET, CHARACTER SET, and COLLATE.
13+
* Internal subclass for character set and collation operations within ALTER TABLE. Handles CONVERT
14+
* TO CHARACTER SET, DEFAULT CHARACTER SET, CHARACTER SET, and COLLATE.
1515
*/
1616
public class AlterExpressionCharset extends AlterExpression {
1717

1818
@Override
1919
protected void appendBody(StringBuilder b) {
2020
toStringConvert(b);
2121
}
22-
}
22+
}

0 commit comments

Comments
 (0)