Skip to content

Commit 019711c

Browse files
committed
Fix compilation by migrating from deprecated API usage
1 parent ca5aa6d commit 019711c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

datamodel/odata-v4/odata-v4-core/src/main/java/com/sap/cloud/sdk/datamodel/odatav4/adapter/JacksonVdmObjectDeserializer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public VdmObject<?> deserialize( @Nonnull final JsonParser parser, @Nonnull fina
9999
throw new IOException(
100100
"Expected field name at current position of JSON object. Instead there was " + token);
101101
}
102-
final String fieldName = parser.getCurrentName();
102+
final String fieldName = parser.currentName();
103103

104104
// Step from JSON element name to element value
105105
parser.nextToken();

datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/ApiClassNameFieldPreprocessor.java

+12-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ApiClassNameFieldPreprocessor implements PreprocessingStep
2323
@Override
2424
public PreprocessingStepResult execute( @Nonnull final JsonNode input, @Nonnull final ObjectMapper objectMapper )
2525
{
26-
final String extensionFieldValue = input.path(API_CLASS_NAME_EXTENSION_FIELD).asText(null);
26+
final String extensionFieldValue = input.path(API_CLASS_NAME_EXTENSION_FIELD).asText();
2727

2828
final JsonNode paths = input.path("paths");
2929

@@ -54,9 +54,14 @@ private void visitPath(
5454
return;
5555
}
5656

57-
final String extensionFieldValue = inputNode.path(API_CLASS_NAME_EXTENSION_FIELD).asText(rootLevelValue);
57+
String extensionFieldValue = inputNode.path(API_CLASS_NAME_EXTENSION_FIELD).asText();
58+
if( extensionFieldValue != null && !extensionFieldValue.isEmpty() ) {
59+
extensionFieldValue = rootLevelValue;
60+
}
5861

59-
inputNode.forEach(operation -> visitOperation(operation, mapper, extensionFieldValue));
62+
for( final JsonNode jsonNode : inputNode ) {
63+
visitOperation(jsonNode, mapper, extensionFieldValue);
64+
}
6065
}
6166

6267
private void visitOperation(
@@ -68,7 +73,10 @@ private void visitOperation(
6873
return;
6974
}
7075

71-
final String extensionFieldValue = inputNode.path(API_CLASS_NAME_EXTENSION_FIELD).asText(pathLevelValue);
76+
String extensionFieldValue = inputNode.path(API_CLASS_NAME_EXTENSION_FIELD).asText();
77+
if( extensionFieldValue != null && !extensionFieldValue.isEmpty() ) {
78+
extensionFieldValue = pathLevelValue;
79+
}
7280

7381
if( extensionFieldValue != null && !extensionFieldValue.isEmpty() ) {
7482
changesApplied = true;

0 commit comments

Comments
 (0)