提交 c87d9ab6 authored 作者: Thomas Mueller Graf's avatar Thomas Mueller Graf

Formatting / Javadocs

上级 d7f16c93
...@@ -54,7 +54,7 @@ table with an LOB column. ...@@ -54,7 +54,7 @@ table with an LOB column.
</li> </li>
<li>Add support for ALTER VIEW [ IF EXISTS ] <li>Add support for ALTER VIEW [ IF EXISTS ]
</li> </li>
<li>Add support for ALTER INDE [ IF EXISTS ] <li>Add support for ALTER INDEX [ IF EXISTS ]
</li> </li>
<li>Add support for ALTER SEQUENCE [ IF EXISTS ] <li>Add support for ALTER SEQUENCE [ IF EXISTS ]
</li> </li>
......
...@@ -5615,7 +5615,8 @@ public class Parser { ...@@ -5615,7 +5615,8 @@ public class Parser {
return command; return command;
} else if (readIf("TYPE")) { } else if (readIf("TYPE")) {
// PostgreSQL compatibility // PostgreSQL compatibility
return parseAlterTableAlterColumnType(schema, tableName, columnName, ifTableExists); return parseAlterTableAlterColumnType(schema, tableName,
columnName, ifTableExists);
} else if (readIf("SET")) { } else if (readIf("SET")) {
if (readIf("DATA")) { if (readIf("DATA")) {
// Derby compatibility // Derby compatibility
...@@ -5658,7 +5659,8 @@ public class Parser { ...@@ -5658,7 +5659,8 @@ public class Parser {
command.setSelectivity(readExpression()); command.setSelectivity(readExpression());
return command; return command;
} else { } else {
return parseAlterTableAlterColumnType(schema, tableName, columnName, ifTableExists); return parseAlterTableAlterColumnType(schema, tableName,
columnName, ifTableExists);
} }
} }
throw getSyntaxError(); throw getSyntaxError();
...@@ -5672,21 +5674,24 @@ public class Parser { ...@@ -5672,21 +5674,24 @@ public class Parser {
return table; return table;
} }
private Column columnIfTableExists(Schema schema, String tableName, String columnName, boolean ifTableExists) { private Column columnIfTableExists(Schema schema, String tableName,
String columnName, boolean ifTableExists) {
Table table = tableIfTableExists(schema, tableName, ifTableExists); Table table = tableIfTableExists(schema, tableName, ifTableExists);
return table == null ? null : table.getColumn(columnName); return table == null ? null : table.getColumn(columnName);
} }
private Prepared commandIfTableExists(Schema schema, String tableName, boolean ifTableExists, Prepared commandIfTableExists) { private Prepared commandIfTableExists(Schema schema, String tableName,
boolean ifTableExists, Prepared commandIfTableExists) {
return tableIfTableExists(schema, tableName, ifTableExists) == null return tableIfTableExists(schema, tableName, ifTableExists) == null
? new NoOperation(session) ? new NoOperation(session)
: commandIfTableExists; : commandIfTableExists;
} }
private AlterTableAlterColumn parseAlterTableAlterColumnType(Schema schema, String tableName, private AlterTableAlterColumn parseAlterTableAlterColumnType(Schema schema,
String columnName, boolean ifTableExists) { String tableName, String columnName, boolean ifTableExists) {
Column oldColumn = columnIfTableExists(schema, tableName, columnName, ifTableExists); Column oldColumn = columnIfTableExists(schema, tableName, columnName, ifTableExists);
Column newColumn = parseColumnForTable(columnName, oldColumn == null ? true : oldColumn.isNullable()); Column newColumn = parseColumnForTable(columnName,
oldColumn == null ? true : oldColumn.isNullable());
AlterTableAlterColumn command = new AlterTableAlterColumn(session, AlterTableAlterColumn command = new AlterTableAlterColumn(session,
schema); schema);
command.setTableName(tableName); command.setTableName(tableName);
...@@ -5697,7 +5702,8 @@ public class Parser { ...@@ -5697,7 +5702,8 @@ public class Parser {
return command; return command;
} }
private AlterTableAlterColumn parseAlterTableAddColumn(String tableName, Schema schema, boolean ifTableExists) { private AlterTableAlterColumn parseAlterTableAddColumn(String tableName,
Schema schema, boolean ifTableExists) {
readIf("COLUMN"); readIf("COLUMN");
AlterTableAlterColumn command = new AlterTableAlterColumn(session, AlterTableAlterColumn command = new AlterTableAlterColumn(session,
schema); schema);
......
...@@ -382,7 +382,7 @@ public class CompareLike extends Condition { ...@@ -382,7 +382,7 @@ public class CompareLike extends Condition {
} }
patternString = new String(patternChars, 0, patternLength); patternString = new String(patternChars, 0, patternLength);
/* optimises the common case of LIKE 'foo%' */ // optimizes the common case of LIKE 'foo%'
if (compareMode.getName().equals(CompareMode.OFF) && patternLength > 1) { if (compareMode.getName().equals(CompareMode.OFF) && patternLength > 1) {
int maxMatch = 0; int maxMatch = 0;
while (maxMatch < patternLength && patternTypes[maxMatch] == MATCH) { while (maxMatch < patternLength && patternTypes[maxMatch] == MATCH) {
......
...@@ -177,12 +177,12 @@ public class CipherFactory { ...@@ -177,12 +177,12 @@ public class CipherFactory {
if (list == null) { if (list == null) {
return list; return list;
} }
List<String> algos = new LinkedList<String>(Arrays.asList(list.split("\\s*,\\s*"))); List<String> algorithms = new LinkedList<String>(Arrays.asList(list.split("\\s*,\\s*")));
boolean dhAnonRemoved = algos.remove("DH_anon"); boolean dhAnonRemoved = algorithms.remove("DH_anon");
boolean ecdhAnonRemoved = algos.remove("ECDH_anon"); boolean ecdhAnonRemoved = algorithms.remove("ECDH_anon");
if (dhAnonRemoved || ecdhAnonRemoved) { if (dhAnonRemoved || ecdhAnonRemoved) {
String algosStr = Arrays.toString(algos.toArray(new String[algos.size()])); String string = Arrays.toString(algorithms.toArray(new String[algorithms.size()]));
return (algos.size() > 0) ? algosStr.substring(1, algosStr.length() - 1): ""; return (algorithms.size() > 0) ? string.substring(1, string.length() - 1): "";
} }
return list; return list;
} }
...@@ -203,13 +203,13 @@ public class CipherFactory { ...@@ -203,13 +203,13 @@ public class CipherFactory {
* behavior. * behavior.
*/ */
public static synchronized void removeAnonFromLegacyAlgorithms() { public static synchronized void removeAnonFromLegacyAlgorithms() {
String legacyAlgosOrig = getLegacyAlgorithmsSilently(); String legacyOriginal = getLegacyAlgorithmsSilently();
if (legacyAlgosOrig == null) { if (legacyOriginal == null) {
return; return;
} }
String legacyAlgosNew = removeDhAnonFromCommaSeparatedList(legacyAlgosOrig); String legacyNew = removeDhAnonFromCommaSeparatedList(legacyOriginal);
if (!legacyAlgosOrig.equals(legacyAlgosNew)) { if (!legacyOriginal.equals(legacyNew)) {
setLegacyAlgorithmsSilently(legacyAlgosNew); setLegacyAlgorithmsSilently(legacyNew);
} }
} }
...@@ -243,12 +243,12 @@ public class CipherFactory { ...@@ -243,12 +243,12 @@ public class CipherFactory {
return defaultLegacyAlgorithms; return defaultLegacyAlgorithms;
} }
private static void setLegacyAlgorithmsSilently(String legacyAlgos) { private static void setLegacyAlgorithmsSilently(String legacyAlgorithms) {
if (legacyAlgos == null) { if (legacyAlgorithms == null) {
return; return;
} }
try { try {
Security.setProperty(LEGACY_ALGORITHMS_SECURITY_KEY, legacyAlgos); Security.setProperty(LEGACY_ALGORITHMS_SECURITY_KEY, legacyAlgorithms);
} catch (SecurityException e) { } catch (SecurityException e) {
// ignore // ignore
} }
......
...@@ -2994,7 +2994,7 @@ alter view address_view recompile; ...@@ -2994,7 +2994,7 @@ alter view address_view recompile;
alter view if exists address_view recompile; alter view if exists address_view recompile;
> ok > ok
alter view if exists doesnt_exist recompile; alter view if exists does_not_exist recompile;
> ok > ok
select * from ADDRESS_VIEW; select * from ADDRESS_VIEW;
...@@ -10318,31 +10318,31 @@ insert into x(id) values(1); ...@@ -10318,31 +10318,31 @@ insert into x(id) values(1);
delete from x; delete from x;
> update count: 1 > update count: 1
alter table if exists y add constraint x_chk check (b = 'a'); alter table if exists y add constraint x_check check (b = 'a');
> ok > ok
alter table if exists x add constraint x_chk check (b = 'a'); alter table if exists x add constraint x_check check (b = 'a');
> ok > ok
alter table if exists x add constraint x_chk check (b = 'a'); alter table if exists x add constraint x_check check (b = 'a');
> exception > exception
insert into x(id, b) values(1, 'b'); insert into x(id, b) values(1, 'b');
> exception > exception
alter table if exists y rename constraint x_chk to x_chk1; alter table if exists y rename constraint x_check to x_check1;
> ok > ok
alter table if exists x rename constraint x_chk to x_chk1; alter table if exists x rename constraint x_check to x_check1;
> ok > ok
alter table if exists x rename constraint x_chk to x_chk1; alter table if exists x rename constraint x_check to x_check1;
> exception > exception
alter table if exists y drop constraint x_chk1; alter table if exists y drop constraint x_check1;
> ok > ok
alter table if exists x drop constraint x_chk1; alter table if exists x drop constraint x_check1;
> ok > ok
alter table if exists y rename to z; alter table if exists y rename to z;
......
...@@ -37,7 +37,7 @@ public class TestSecurity extends TestBase { ...@@ -37,7 +37,7 @@ public class TestSecurity extends TestBase {
testAES(); testAES();
testBlockCiphers(); testBlockCiphers();
testRemoveAnonFromLegacyAlgorithms(); testRemoveAnonFromLegacyAlgorithms();
//testResetLegacyAlgos(); // testResetLegacyAlgorithms();
} }
private static void testConnectWithHash() throws SQLException { private static void testConnectWithHash() throws SQLException {
...@@ -255,22 +255,22 @@ public class TestSecurity extends TestBase { ...@@ -255,22 +255,22 @@ public class TestSecurity extends TestBase {
} }
private void testRemoveAnonFromLegacyAlgorithms() { private void testRemoveAnonFromLegacyAlgorithms() {
String legacyAlgos = "K_NULL, C_NULL, M_NULL, DHE_DSS_EXPORT" + String legacyAlgorithms = "K_NULL, C_NULL, M_NULL, DHE_DSS_EXPORT" +
", DHE_RSA_EXPORT, DH_anon_EXPORT, DH_DSS_EXPORT, DH_RSA_EXPORT, RSA_EXPORT" + ", DHE_RSA_EXPORT, DH_anon_EXPORT, DH_DSS_EXPORT, DH_RSA_EXPORT, RSA_EXPORT" +
", DH_anon, ECDH_anon, RC4_128, RC4_40, DES_CBC, DES40_CBC"; ", DH_anon, ECDH_anon, RC4_128, RC4_40, DES_CBC, DES40_CBC";
String expectedLegacyAlgosWithoutDhAnon = "K_NULL, C_NULL, M_NULL, DHE_DSS_EXPORT" + String expectedLegacyWithoutDhAnon = "K_NULL, C_NULL, M_NULL, DHE_DSS_EXPORT" +
", DHE_RSA_EXPORT, DH_anon_EXPORT, DH_DSS_EXPORT, DH_RSA_EXPORT, RSA_EXPORT" + ", DHE_RSA_EXPORT, DH_anon_EXPORT, DH_DSS_EXPORT, DH_RSA_EXPORT, RSA_EXPORT" +
", RC4_128, RC4_40, DES_CBC, DES40_CBC"; ", RC4_128, RC4_40, DES_CBC, DES40_CBC";
assertEquals(expectedLegacyAlgosWithoutDhAnon, assertEquals(expectedLegacyWithoutDhAnon,
CipherFactory.removeDhAnonFromCommaSeparatedList(legacyAlgos)); CipherFactory.removeDhAnonFromCommaSeparatedList(legacyAlgorithms));
legacyAlgos = "ECDH_anon, DH_anon_EXPORT, DH_anon"; legacyAlgorithms = "ECDH_anon, DH_anon_EXPORT, DH_anon";
expectedLegacyAlgosWithoutDhAnon = "DH_anon_EXPORT"; expectedLegacyWithoutDhAnon = "DH_anon_EXPORT";
assertEquals(expectedLegacyAlgosWithoutDhAnon, assertEquals(expectedLegacyWithoutDhAnon,
CipherFactory.removeDhAnonFromCommaSeparatedList(legacyAlgos)); CipherFactory.removeDhAnonFromCommaSeparatedList(legacyAlgorithms));
legacyAlgos = null; legacyAlgorithms = null;
assertNull(CipherFactory.removeDhAnonFromCommaSeparatedList(legacyAlgos)); assertNull(CipherFactory.removeDhAnonFromCommaSeparatedList(legacyAlgorithms));
} }
/** /**
...@@ -281,7 +281,7 @@ public class TestSecurity extends TestBase { ...@@ -281,7 +281,7 @@ public class TestSecurity extends TestBase {
* to a modification of the global state with hard-to-track consequences. * to a modification of the global state with hard-to-track consequences.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
private void testResetLegacyAlgos() { private void testResetLegacyAlgorithms() {
String legacyAlgorithmsBefore = CipherFactory.getLegacyAlgorithmsSilently(); String legacyAlgorithmsBefore = CipherFactory.getLegacyAlgorithmsSilently();
assertEquals("Failed assumption: jdk.tls.legacyAlgorithms" + assertEquals("Failed assumption: jdk.tls.legacyAlgorithms" +
" has been modified from its initial setting", " has been modified from its initial setting",
......
...@@ -719,7 +719,5 @@ xmlhttp xmlnode xmlns xmlstartdoc xmltext xmx xor xrmd xrunhprof xsi xsm xtea xt ...@@ -719,7 +719,5 @@ xmlhttp xmlnode xmlns xmlstartdoc xmltext xmx xor xrmd xrunhprof xsi xsm xtea xt
xtime xts xvi xyz yacute year years yen yes yet yield yielding yjp ymd york you xtime xts xvi xyz yacute year years yen yes yet yield yielding yjp ymd york you
young younger youngest your yourself youtube ytd yuml yyfxyy yyyymmdd zeile zen young younger youngest your yourself youtube ytd yuml yyfxyy yyyymmdd zeile zen
zepfred zero zeroes zeros zeta zhang zip ziv zloty zone zones zurich zwj zwnj zepfred zero zeroes zeros zeta zhang zip ziv zloty zone zones zurich zwj zwnj
recompiled incl reveal designators templates invoked candidate handshake altered
incl reveal designators templates invoked candidate handshake optimises altered accomplished permanent algos clarify weaken excl alternatively accomplished permanent clarify weaken excl alternatively dita imjcc optimizes
\ No newline at end of file
dita imjcc
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论