aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-01-22 12:11:11 +0000
committerliamfallon <liam.fallon@est.tech>2020-01-23 12:15:19 +0000
commit755eb9df282d80273043a2e902e2a51bf6eaab24 (patch)
treefb603fff3d378bb868dba63e3d766d7723e03839 /plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main
parent37da84e2a40f7f39fe73fa2ceb6a7166618e9ddb (diff)
Run apex-pdp in Java 11: base changes
This change brings in the minimum changes to get apex-pdp running in Java 11. Other reviews will bring in changes to remove Java 11 warnings and to convert apex-pdp Javascript handling from the now deprecated nashorn engine. Issue-ID: POLICY-1581 Change-Id: I879bbae08d4e67aca3f1bfeedeca639d8dbbc281 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main')
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java25
1 files changed, 12 insertions, 13 deletions
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java
index 94841301d..bc427b9c9 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -75,7 +75,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
avroSchema = new Schema.Parser().parse(schema.getSchema());
} catch (final Exception e) {
final String resultSting = userKey.getId() + ": avro context schema \"" + schema.getId()
- + "\" schema is invalid: " + e.getMessage() + ", schema: " + schema.getSchema();
+ + "\" schema is invalid: " + e.getMessage() + ", schema: " + schema.getSchema();
LOGGER.warn(resultSting, e);
throw new ContextRuntimeException(resultSting);
}
@@ -128,8 +128,8 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
return createNewInstance(elementJsonString);
} else {
- final String returnString = getUserKey().getId() + ": the object \"" + incomingObject
- + "\" is not an instance of JsonObject";
+ final String returnString =
+ getUserKey().getId() + ": the object \"" + incomingObject + "\" is not an instance of JsonObject";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
@@ -145,7 +145,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
return subInstance;
} else {
final String returnString = getUserKey().getId() + ": the schema \"" + avroSchema.getName()
- + "\" does not have a subtype of type \"" + subInstanceType + "\"";
+ + "\" does not have a subtype of type \"" + subInstanceType + "\"";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
@@ -196,7 +196,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
* @return an instance of the type or null if it is the incorrect type
*/
private Object instantiateSubInstance(final String subInstanceType, final Schema subSchema,
- final Set<String> foundTypes) {
+ final Set<String> foundTypes) {
if (subSchema == null) {
return null;
}
@@ -211,7 +211,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
if (subSchema.getName().equals(subInstanceType)) {
return new AvroObjectMapperFactory().get(AxArtifactKey.getNullKey(), subSchema)
- .createNewInstance(subSchema);
+ .createNewInstance(subSchema);
}
return createNewSubInstance(subSchema, subInstanceType, foundTypes);
}
@@ -235,7 +235,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
decodedObject = new GenericDatumReader<GenericRecord>(avroSchema).read(null, jsonDecoder);
} catch (final Exception e) {
final String returnString = getUserKey().getId() + OBJECT_TAG + objectString
- + "\" Avro unmarshalling failed: " + e.getMessage();
+ + "\" Avro unmarshalling failed: " + e.getMessage();
LOGGER.warn(returnString, e);
throw new ContextRuntimeException(returnString, e);
}
@@ -259,9 +259,8 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
}
} catch (final ClassCastException e) {
final String returnString = getUserKey().getId() + OBJECT_TAG + object + "\" of type \""
- + (object != null ? object.getClass().getName() : "null") + "\" must be assignable to \""
- + getSchemaClass().getName()
- + "\" or be a Json string representation of it for Avro unmarshalling";
+ + (object != null ? object.getClass().getName() : "null") + "\" must be assignable to \""
+ + getSchemaClass().getName() + "\" or be a Json string representation of it for Avro unmarshalling";
LOGGER.warn(returnString, e);
throw new ContextRuntimeException(returnString);
}
@@ -314,8 +313,8 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
jsonEncoder.flush();
return new String(output.toByteArray());
} catch (final Exception e) {
- final String returnString = getUserKey().getId() + OBJECT_TAG + object + "\" Avro marshalling failed: "
- + e.getMessage();
+ final String returnString =
+ getUserKey().getId() + OBJECT_TAG + object + "\" Avro marshalling failed: " + e.getMessage();
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString, e);
}