Skip to content
Permalink
Browse files

0003989: Java versions 11 and 12 should work with SymmetricDS

  • Loading branch information...
philipmarzullo64 committed Jun 5, 2019
1 parent 336ee02 commit 0e0e92b83aaa990420e286fd0424d9cc5e514d12
Showing with 759 additions and 541 deletions.
  1. +5 −14 symmetric-client/src/main/java/org/jumpmind/symmetric/AbstractCommandLauncher.java
  2. +1 −1 symmetric-client/src/main/java/org/jumpmind/symmetric/DbFillCommand.java
  3. +1 −1 symmetric-client/src/main/java/org/jumpmind/symmetric/DbImportCommand.java
  4. +3 −9 symmetric-client/src/main/java/org/jumpmind/symmetric/SymmetricAdmin.java
  5. +1 −1 symmetric-client/src/main/java/org/jumpmind/symmetric/ext/FtpDataLoaderFactory.java
  6. +1 −1 symmetric-client/src/main/java/org/jumpmind/symmetric/io/MongoDataLoaderFactory.java
  7. +1 −1 symmetric-client/src/main/java/org/jumpmind/symmetric/job/JobCreator.java
  8. +5 −7 symmetric-client/src/main/java/org/jumpmind/symmetric/service/jmx/NodeManagementService.java
  9. +80 −48 symmetric-client/src/main/java/org/jumpmind/symmetric/util/SnapshotUtil.java
  10. +1 −1 symmetric-client/src/main/resources/symmetric-jmx.xml
  11. +4 −3 symmetric-client/src/test/java/org/jumpmind/symmetric/DbExportImportTest.java
  12. +1 −1 ...ic-client/src/test/java/org/jumpmind/symmetric/io/data/writer/AbstractBulkDatabaseWriterTest.java
  13. +3 −2 symmetric-client/src/test/java/org/jumpmind/symmetric/tool/RefactorTool.java
  14. +7 −7 symmetric-core/src/main/java/org/jumpmind/symmetric/file/FileSyncZipDataWriter.java
  15. +4 −0 symmetric-core/src/main/java/org/jumpmind/symmetric/file/FileTriggerFileModifiedListener.java
  16. +11 −5 symmetric-core/src/main/java/org/jumpmind/symmetric/io/DbCompare.java
  17. +3 −2 symmetric-core/src/main/java/org/jumpmind/symmetric/io/DbValueComparator.java
  18. +2 −2 symmetric-core/src/main/java/org/jumpmind/symmetric/io/stage/BatchStagingManager.java
  19. +5 −1 symmetric-core/src/main/java/org/jumpmind/symmetric/model/FileSnapshot.java
  20. +2 −2 symmetric-core/src/main/java/org/jumpmind/symmetric/route/AbstractFileParsingRouter.java
  21. +6 −6 symmetric-core/src/main/java/org/jumpmind/symmetric/route/parse/DBFField.java
  22. +5 −2 symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/BandwidthService.java
  23. +3 −2 symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/ClusterService.java
  24. +3 −2 symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataService.java
  25. +3 −2 symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/FileSyncService.java
  26. +1 −1 symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/OutgoingBatchService.java
  27. +1 −1 symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/TriggerRouterService.java
  28. +2 −1 symmetric-core/src/main/java/org/jumpmind/symmetric/statistic/AbstractStatsByPeriodMap.java
  29. +1 −1 symmetric-core/src/main/java/org/jumpmind/symmetric/transport/TransportManagerFactory.java
  30. +10 −3 symmetric-core/src/main/java/org/jumpmind/symmetric/transport/file/FileIncomingTransport.java
  31. +10 −6 symmetric-core/src/main/java/org/jumpmind/symmetric/transport/file/FileOutgoingTransport.java
  32. +8 −5 symmetric-core/src/main/java/org/jumpmind/symmetric/transport/http/HttpIncomingTransport.java
  33. +16 −9 symmetric-core/src/main/java/org/jumpmind/symmetric/transport/http/HttpOutgoingTransport.java
  34. +6 −10 symmetric-core/src/main/java/org/jumpmind/symmetric/transport/http/HttpTransportManager.java
  35. +11 −8 ...etric-core/src/main/java/org/jumpmind/symmetric/transport/internal/InternalIncomingTransport.java
  36. +6 −2 ...etric-core/src/main/java/org/jumpmind/symmetric/transport/internal/InternalOutgoingTransport.java
  37. +21 −6 ...rc/main/java/org/jumpmind/symmetric/transport/internal/InternalOutgoingWithResponseTransport.java
  38. +10 −3 symmetric-core/src/main/java/org/jumpmind/symmetric/transport/internal/InternalTransportManager.java
  39. +2 −1 symmetric-core/src/main/java/org/jumpmind/symmetric/util/SymmetricUtils.java
  40. +4 −3 symmetric-core/src/test/java/org/jumpmind/symmetric/file/FileTriggerTrackerTest.java
  41. +21 −20 symmetric-core/src/test/java/org/jumpmind/symmetric/route/DataGapDetectorTest.java
  42. +18 −19 symmetric-core/src/test/java/org/jumpmind/symmetric/route/DataGapRouteReaderTest.java
  43. +1 −1 symmetric-core/src/test/java/org/jumpmind/symmetric/service/impl/AbstractDataLoaderServiceTest.java
  44. +1 −1 ...tric-core/src/test/java/org/jumpmind/symmetric/service/impl/AbstractTriggerRouterServiceTest.java
  45. +5 −4 symmetric-core/src/test/java/org/jumpmind/symmetric/service/impl/DataServiceTest.java
  46. +4 −3 symmetric-core/src/test/java/org/jumpmind/symmetric/transform/JavaColumnTransformTest.java
  47. +2 −2 symmetric-csv/src/main/java/org/jumpmind/symmetric/csv/CsvReader.java
  48. +1 −6 symmetric-db/src/main/java/org/jumpmind/db/io/DatabaseXmlUtil.java
  49. +9 −9 symmetric-db/src/main/java/org/jumpmind/db/model/Column.java
  50. +9 −9 symmetric-db/src/main/java/org/jumpmind/db/model/TypeMap.java
  51. +16 −4 symmetric-db/src/main/java/org/jumpmind/db/platform/AbstractDatabasePlatform.java
  52. +33 −33 symmetric-db/src/main/java/org/jumpmind/db/platform/DatabaseInfo.java
  53. +1 −1 symmetric-db/src/main/java/org/jumpmind/db/platform/DefaultValueHelper.java
  54. +3 −3 symmetric-db/src/main/java/org/jumpmind/db/platform/MetaDataColumnDescriptor.java
  55. +1 −1 symmetric-db/src/main/java/org/jumpmind/db/sql/Row.java
  56. +6 −6 symmetric-db/src/main/java/org/jumpmind/db/sql/SqlPersistenceManager.java
  57. +5 −2 symmetric-db/src/main/java/org/jumpmind/db/sql/SqlScript.java
  58. +2 −2 symmetric-db/src/test/java/org/jumpmind/db/sql/LogSqlBuilderTest.java
  59. +5 −2 symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/DbExport.java
  60. +4 −4 symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/DbFill.java
  61. +6 −2 symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/reader/AbstractTableDataReader.java
  62. +4 −2 symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/reader/SqlDataReader.java
  63. +5 −2 symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/reader/SymXmlDataReader.java
  64. +5 −2 symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/reader/XmlDataReader.java
  65. +1 −1 symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/transform/TransformColumn.java
  66. +6 −2 symmetric-io/src/main/java/org/jumpmind/symmetric/io/data/writer/DefaultDatabaseWriter.java
  67. +17 −6 symmetric-io/src/main/java/org/jumpmind/symmetric/io/stage/StagedResource.java
  68. +2 −1 symmetric-io/src/main/java/org/jumpmind/symmetric/io/stage/StagingManager.java
  69. +3 −3 symmetric-io/src/test/java/org/jumpmind/symmetric/io/AbstractWriterTest.java
  70. +1 −1 symmetric-io/src/test/java/org/jumpmind/symmetric/io/data/writer/DatabaseWriterConflictTest.java
  71. +19 −19 symmetric-jdbc/src/main/java/org/jumpmind/db/platform/AbstractJdbcDdlReader.java
  72. +2 −2 symmetric-jdbc/src/main/java/org/jumpmind/db/platform/h2/H2DdlReader.java
  73. +2 −2 symmetric-jdbc/src/main/java/org/jumpmind/db/platform/oracle/OracleDdlReader.java
  74. +9 −10 symmetric-jdbc/src/main/java/org/jumpmind/db/platform/tibero/TiberoDdlReader.java
  75. +8 −13 symmetric-jdbc/src/main/java/org/jumpmind/db/sql/JdbcSqlTemplate.java
  76. +1 −1 symmetric-jdbc/src/main/java/org/jumpmind/db/sql/JdbcSqlTransaction.java
  77. +1 −1 symmetric-jdbc/src/main/java/org/jumpmind/db/util/BasicDataSourceFactory.java
  78. +1 −3 symmetric-jdbc/src/main/java/org/jumpmind/db/util/ResettableBasicDataSource.java
  79. +66 −66 symmetric-jdbc/src/main/java/org/jumpmind/driver/PreparedStatementWrapper.java
  80. +2 −2 symmetric-jdbc/src/main/java/org/jumpmind/driver/StatementBypassInterceptor.java
  81. +4 −4 symmetric-server/src/main/java/org/jumpmind/symmetric/SymmetricLauncher.java
  82. +1 −1 symmetric-server/src/main/java/org/jumpmind/symmetric/SymmetricWebServer.java
  83. +1 −1 symmetric-server/src/main/java/org/jumpmind/symmetric/web/ServerSymmetricEngine.java
  84. +2 −13 symmetric-server/src/main/java/org/jumpmind/symmetric/web/SymmetricEngineHolder.java
  85. +5 −9 symmetric-server/src/main/java/org/jumpmind/symmetric/web/rest/RestService.java
  86. +10 −1 symmetric-server/src/test/java/org/jumpmind/symmetric/test/AbstractTest.java
  87. +123 −33 symmetric-server/src/test/java/org/jumpmind/symmetric/test/FileSyncTest.java
  88. +2 −1 symmetric-util/src/main/java/org/jumpmind/properties/DefaultParameterParser.java
  89. +6 −3 symmetric-util/src/main/java/org/jumpmind/properties/TypedProperties.java
  90. +1 −1 symmetric-util/src/main/java/org/jumpmind/security/SecurityServiceFactory.java
  91. +7 −10 symmetric-util/src/main/java/org/jumpmind/util/AbstractVersion.java
  92. +3 −5 symmetric-util/src/main/java/org/jumpmind/util/AppUtils.java
  93. +1 −1 symmetric-util/src/main/java/org/jumpmind/util/LogSummaryAppender.java
  94. +1 −1 symmetric-util/src/main/java/org/jumpmind/util/SimpleClassCompiler.java
  95. +2 −1 symmetric-util/src/main/java/org/jumpmind/util/StreamGobbler.java
  96. +12 −0 symmetric-util/src/test/resources/log4j.xml
@@ -36,13 +36,12 @@
import java.util.Properties;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.log4j.Appender;
@@ -134,9 +133,7 @@ protected static void initFromServerProperties() {
TypedProperties serverProperties = new TypedProperties();

if (serverPropertiesFile.exists() && serverPropertiesFile.isFile()) {
FileInputStream fis = null;
try {
fis = new FileInputStream(serverPropertiesFile);
try(FileInputStream fis = new FileInputStream(serverPropertiesFile)) {
serverProperties.load(fis);

/* System properties always override */
@@ -150,8 +147,6 @@ protected static void initFromServerProperties() {

} catch (IOException ex) {
log.error("Failed to load " + DEFAULT_SERVER_PROPERTIES, ex);
} finally {
IOUtils.closeQuietly(fis);
}
} else if (!serverPropertiesFile.exists()) {
log.debug("Failed to load " + DEFAULT_SERVER_PROPERTIES + ". File does not exist.");
@@ -167,7 +162,7 @@ protected static void initFromServerProperties() {
abstract protected boolean requiresPropertiesFile(CommandLine line);

public void execute(String args[]) {
PosixParser parser = new PosixParser();
DefaultParser parser = new DefaultParser();
Options options = new Options();
buildOptions(options);
try {
@@ -321,16 +316,12 @@ public File findPropertiesFileForEngineWithName(String engineName) {
for (int i = 0; i < files.length; i++) {
File file = files[i];
Properties properties = new Properties();
FileInputStream is = null;
try {
is = new FileInputStream(file);
try(FileInputStream is = new FileInputStream(file)) {
properties.load(is);
if (engineName.equals(properties.getProperty(ParameterConstants.ENGINE_NAME))) {
return file;
}
} catch (IOException ex) {
} finally {
IOUtils.closeQuietly(is);
}
}
return null;
@@ -374,7 +365,7 @@ protected void configureCrypto(CommandLine line) throws Exception {

if (line.hasOption(OPTION_JCE_PROVIDER)) {
Provider provider = (Provider) Class.forName(line.getOptionValue(OPTION_JCE_PROVIDER))
.newInstance();
.getDeclaredConstructor().newInstance();
Security.addProvider(provider);
}
}
@@ -143,7 +143,7 @@ protected boolean executeWithOptions(CommandLine line) throws Exception {
String[] strWeight = line.getOptionValue(OPTION_WEIGHTS).split(",");
if (strWeight != null && strWeight.length == 3) {
for (int i=0; i<3; i++) {
dmlWeight[i] = new Integer(strWeight[i]);
dmlWeight[i] = Integer.valueOf(strWeight[i]);
}
dbFill.setDmlWeight(dmlWeight);
}
@@ -155,7 +155,7 @@ protected boolean executeWithOptions(CommandLine line) throws Exception {
for (String clazz : clazzes) {
if (StringUtils.isNotBlank(clazz)) {
IDatabaseWriterFilter databaseWriterFilter = (IDatabaseWriterFilter) Class
.forName(clazz.trim()).newInstance();
.forName(clazz.trim()).getDeclaredConstructor().newInstance();
dbImport.addDatabaseWriterFilter(databaseWriterFilter);
}
}
@@ -43,7 +43,6 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -283,7 +282,6 @@ protected void buildOptions(Options options) {
buildCryptoOptions(options);
}

@SuppressWarnings("unchecked")
@Override
protected boolean executeWithOptions(CommandLine line) throws Exception {
List<String> args = line.getArgList();
@@ -374,16 +372,12 @@ private void listEngines(CommandLine line, List<String> args) {
File[] files = findEnginePropertiesFiles();
for (File file : files) {
Properties properties = new Properties();
FileInputStream is = null;
try {
is = new FileInputStream(file);
try(FileInputStream is = new FileInputStream(file)) {
properties.load(is);
String name = properties.getProperty(ParameterConstants.ENGINE_NAME);
System.out.println(name + " -> " + file.getAbsolutePath());
count++;
} catch (IOException ex) {
} finally {
IOUtils.closeQuietly(is);
}
}
System.out.println(count + " engines returned");
@@ -519,7 +513,7 @@ private void syncTrigger(CommandLine line, List<String> args) throws IOException
}
}
if (file != null) {
FileUtils.writeStringToFile(file, sqlBuffer.toString());
FileUtils.writeStringToFile(file, sqlBuffer.toString(), Charset.defaultCharset(), false);
}
}

@@ -645,7 +639,7 @@ private void sendSchema(CommandLine line, List<String> args) {

private void sendScript(CommandLine line, List<String> args) throws Exception {
String scriptName = popArg(args, "Script Name");
String scriptData = FileUtils.readFileToString(new File(scriptName));
String scriptData = FileUtils.readFileToString(new File(scriptName), Charset.defaultCharset());
for (Node node : getNodes(line)) {
System.out.println("Sending script to node '" + node.getNodeId() + "'");
getSymmetricEngine().getDataService().sendScript(node.getNodeId(), scriptData, false);
@@ -78,7 +78,7 @@ public IDataWriter getDataWriter(String sourceNodeId, ISymmetricDialect symmetri
List<IDatabaseWriterErrorHandler> errorHandlers,
List<? extends Conflict> conflictSettings, List<ResolvedData> resolvedData) {
try {
FtpDataWriter ftpWriter = (FtpDataWriter) Class.forName(clazzName).newInstance();
FtpDataWriter ftpWriter = (FtpDataWriter) Class.forName(clazzName).getDeclaredConstructor().newInstance();
ftpWriter.setFormat(format);
ftpWriter.setProtocol(protocol);
ftpWriter.setServer(server);
@@ -72,7 +72,7 @@ public IDataWriter getDataWriter(String sourceNodeId, ISymmetricDialect symmetri
List<? extends Conflict> conflictSettings, List<ResolvedData> resolvedData) {
try {
if (objectMapper == null) {
objectMapper = (IDBObjectMapper)Class.forName("org.jumpmind.symmetric.io.SimpleDBObjectMapper").newInstance();
objectMapper = (IDBObjectMapper)Class.forName("org.jumpmind.symmetric.io.SimpleDBObjectMapper").getDeclaredConstructor().newInstance();
}
Method method = objectMapper.getClass().getMethod("setDefaultDatabaseName", String.class);
if (method != null) {
@@ -75,7 +75,7 @@ protected AbstractJob instantiateJavaJob(JobDefinition jobDefinition, ISymmetric
}
}

return (AbstractJob) jobClass.newInstance(); // try default constructor.
return (AbstractJob) jobClass.getDeclaredConstructor().newInstance(); // try default constructor.
} catch (Exception ex) {
throw new SymmetricException("Failed to load and instantiate job class '" + className + "'", ex);
}
@@ -23,6 +23,7 @@
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.text.DateFormat;
import java.text.NumberFormat;
@@ -32,7 +33,6 @@
import javax.sql.DataSource;

import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.jumpmind.extension.IBuiltInExtensionPoint;
import org.jumpmind.security.SecurityConstants;
@@ -296,17 +296,13 @@ public boolean extractBatcheRange(String fileName, String nodeId, String startTi
Date endBatchTime = FormatUtils.parseDate(endTime, FormatUtils.TIMESTAMP_PATTERNS);
String[] channelIds = channelIdList.split(",");
IDataExtractorService dataExtractorService = engine.getDataExtractorService();
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(file));
try(BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
dataExtractorService.extractBatchRange(writer, nodeId, startBatchTime, endBatchTime,
channelIds);
return true;
} catch (Exception ex) {
log.error("Failed to write batch range to file", ex);
return false;
} finally {
IOUtils.closeQuietly(writer);
}
}

@@ -390,7 +386,9 @@ public void writeBatchRangeToFile(String nodeId, String startBatchId, String end
Writer writer = new FileWriter(new File(fileName));
engine.getDataExtractorService().extractBatchRange(writer, nodeId,
Long.valueOf(startBatchId), Long.valueOf(endBatchId));
IOUtils.closeQuietly(writer);
try {
writer.close();
} catch(IOException e) { }
}

@ManagedOperation(description = "Encrypts plain text for use with db.user and db.password properties")

0 comments on commit 0e0e92b

Please sign in to comment.
You can’t perform that action at this time.