Skip to content

Commit d54a441

Browse files
authored
Merge pull request #6 from SAP/develop
Remove JDK17 specific syntax
2 parents 0452c4e + aae2a4a commit d54a441

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

commercedbsync/src/com/sap/cx/boosters/commercedbsync/dataset/impl/DefaultDataSet.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import javax.annotation.concurrent.Immutable;
1717
import java.util.Collections;
1818
import java.util.List;
19+
import java.util.stream.Collectors;
1920

2021
import static java.sql.Types.CHAR;
2122
import static java.sql.Types.SMALLINT;
@@ -32,7 +33,7 @@ public DefaultDataSet(int batchId, int columnCount, List<DataColumn> columnOrder
3233
this.batchId = batchId;
3334
this.columnCount = columnCount;
3435
this.columnOrder = Collections.unmodifiableList(columnOrder);
35-
this.result = result.stream().map(Collections::unmodifiableList).toList();
36+
this.result = result.stream().map(Collections::unmodifiableList).collect(Collectors.toList());
3637
}
3738

3839
@Override

commercedbsync/src/com/sap/cx/boosters/commercedbsync/events/handlers/CopyCompleteEventListener.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ public Object execute() throws Exception {
8282
});
8383
} catch (final Exception e) {
8484
LOG.error("Error during PostProcessor execution", e);
85-
if (e instanceof RuntimeException re) {
86-
throw re;
85+
if (e instanceof RuntimeException) {
86+
throw (RuntimeException) e;
8787
} else {
8888
throw new RuntimeException(e);
8989
}

commercedbsync/src/com/sap/cx/boosters/commercedbsync/repository/impl/HanaDataRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ protected String getBulkUpdateStatementParamList(List<String> columnsToCopy, Lis
175175
List<String> upsertIDs) {
176176
final String upsertID = upsertIDs.get(0); // TODO handle multiple upsert IDs if needed
177177
final List<String> columnsToCopyMinusPK = columnsToCopy.stream().filter(s -> !s.equalsIgnoreCase(upsertID))
178-
.toList();
178+
.collect(Collectors.toList());
179179
final List<String> columnsToCopyValuesMinusPK = columnsToCopyValues.stream()
180-
.filter(s -> !s.equalsIgnoreCase("s." + upsertID)).toList();
180+
.filter(s -> !s.equalsIgnoreCase("s." + upsertID)).collect(Collectors.toList());
181181
LOG.debug("getBulkUpdateStatementParamList - columnsToCopyMinusPK =" + columnsToCopyMinusPK);
182182
return "SET " + IntStream.range(0, columnsToCopyMinusPK.size()).mapToObj(
183183
idx -> String.format("%s = %s", columnsToCopyMinusPK.get(idx), columnsToCopyValuesMinusPK.get(idx)))

commercedbsync/src/com/sap/cx/boosters/commercedbsync/repository/impl/OracleDataRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,9 @@ protected String getBulkUpdateStatementParamList(List<String> columnsToCopy, Lis
255255
List<String> upsertIDs) {
256256
final String upsertID = upsertIDs.get(0);
257257
final List<String> columnsToCopyMinusPK = columnsToCopy.stream().filter(s -> !s.equalsIgnoreCase(upsertID))
258-
.toList();
258+
.collect(Collectors.toList());
259259
final List<String> columnsToCopyValuesMinusPK = columnsToCopyValues.stream()
260-
.filter(s -> !s.equalsIgnoreCase("s." + upsertID)).toList();
260+
.filter(s -> !s.equalsIgnoreCase("s." + upsertID)).collect(Collectors.toList());
261261
LOG.debug("getBulkUpdateStatementParamList - columnsToCopyMinusPK =" + columnsToCopyMinusPK);
262262
return "SET " + IntStream.range(0, columnsToCopyMinusPK.size()).mapToObj(
263263
idx -> String.format("%s = %s", columnsToCopyMinusPK.get(idx), columnsToCopyValuesMinusPK.get(idx)))

commercedbsync/src/com/sap/cx/boosters/commercedbsync/repository/platform/MigrationHybrisHANABuilder.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,12 @@ private String detectSize(Column column) {
8888
public void processTableStructureChanges(Database currentModel, Database desiredModel, Table sourceTable,
8989
Table targetTable, Map parameters, List changes) throws IOException {
9090
Iterator changeIt = changes.iterator();
91+
Object change;
9192

9293
while (changeIt.hasNext()) {
93-
if (changeIt.next()instanceof RemoveColumnChange removeColumnChange) {
94-
processChange(currentModel, desiredModel, removeColumnChange);
94+
change = changeIt.next();
95+
if (change instanceof RemoveColumnChange) {
96+
processChange(currentModel, desiredModel, (RemoveColumnChange) change);
9597
changeIt.remove();
9698
}
9799
}

commercedbsync/src/com/sap/cx/boosters/commercedbsync/strategy/impl/CopyPipeWriterTask.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ private void process() throws Exception {
197197
+ sourceColumnValue.getClass().getTypeName());
198198
printedClobLog = true;
199199
}
200-
if (sourceColumnValue instanceof String clobString) {
200+
if (sourceColumnValue instanceof String) {
201+
String clobString = (String) sourceColumnValue;
201202
if (!clobString.isEmpty()) {
202203
LOG.debug(" reading CLOB");
203204
bulkWriterStatement.setClob(paramIdx,
@@ -224,11 +225,12 @@ private void process() throws Exception {
224225
+ ", targetColumnType =" + targetColumnType + ", source type = "
225226
+ sourceColumnValue.getClass().getTypeName());
226227
if (dbProvider.isOracleUsed()) {
227-
if (targetColumnType == NUMERIC
228-
&& sourceColumnValue instanceof String stringValue
229-
&& !stringValue.isEmpty()) {
230-
final int character = Character.codePointAt(stringValue, 0);
231-
bulkWriterStatement.setInt(paramIdx, character);
228+
if (targetColumnType == NUMERIC && sourceColumnValue instanceof String) {
229+
final String stringValue = (String) sourceColumnValue;
230+
if (!stringValue.isEmpty()) {
231+
final int character = Character.codePointAt(stringValue, 0);
232+
bulkWriterStatement.setInt(paramIdx, character);
233+
}
232234
}
233235
}
234236
} catch (final Exception e) {

0 commit comments

Comments
 (0)