diff options
Diffstat (limited to 'plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src')
5 files changed, 16 insertions, 16 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/AvroBytesObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java index dc281a52b..20e701bc7 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java @@ -102,7 +102,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { // The Avro object should be a Utf8 object if (!(avroObject instanceof ByteBuffer)) { final String returnString = - userKey.getID() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -127,7 +127,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { @Override public Object mapToAvro(final Object object) { if (object == null) { - final String returnString = userKey.getID() + ": cannot encode a null object of class \"" + final String returnString = userKey.getId() + ": cannot encode a null object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -135,7 +135,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { // The incoming object should be a byte array if (!(object instanceof byte[])) { - final String returnString = userKey.getID() + ": object \"" + object + "\" of class \"" + object.getClass() + final String returnString = userKey.getId() + ": object \"" + object + "\" of class \"" + object.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java index acf64c3c9..35e811dec 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java @@ -132,7 +132,7 @@ public class AvroDirectObjectMapper implements AvroObjectMapper { // the decoded object is always returned as a null if (!schemaClass.isAssignableFrom(avroObject.getClass())) { final String returnString = - userKey.getID() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -152,7 +152,7 @@ public class AvroDirectObjectMapper implements AvroObjectMapper { // Null values are only allowed if the schema class is null if (object == null) { if (schemaClass != null) { - final String returnString = userKey.getID() + ": cannot encode a null object of class \"" + final String returnString = userKey.getId() + ": cannot encode a null object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java index 22152a8da..a48ca8089 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java @@ -79,7 +79,7 @@ public class AvroObjectMapperFactory { // currently only support unions with 2 types, one of which is NULL final Schema nullschema = Schema.create(Schema.Type.NULL); if (types.size() != 2 || !types.contains(nullschema)) { - final String resultSting = userKey.getID() + final String resultSting = userKey.getId() + ": Apex currently only supports UNION schemas with 2 options, one must be NULL"; LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); @@ -91,7 +91,7 @@ public class AvroObjectMapperFactory { schema = types.get(1); } if (Schema.Type.NULL.equals(schema.getType())) { - final String resultSting = userKey.getID() + final String resultSting = userKey.getId() + ": Apex currently only supports UNION schema2 with 2 options, only one can be NULL, and the other cannot be another UNION"; LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); @@ -103,7 +103,7 @@ public class AvroObjectMapperFactory { // Check that there is a definition for the mapper for this type if (!AVRO_OBJECT_MAPPER_MAP.containsKey(avroType) || AVRO_OBJECT_MAPPER_MAP.get(avroType) == null) { final String resultSting = - userKey.getID() + ": no Avro object mapper defined for Avro type \"" + avroType + "\""; + userKey.getId() + ": no Avro object mapper defined for Avro type \"" + avroType + "\""; LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); } @@ -117,7 +117,7 @@ public class AvroObjectMapperFactory { } } catch (final Exception e) { - final String resultSting = userKey.getID() + ": could not create an Avro object mapper of type \"" + final String resultSting = userKey.getId() + ": could not create an Avro object mapper of type \"" + AVRO_OBJECT_MAPPER_MAP.get(avroType) + "\" for Avro type \"" + avroType + "\" : " + e; LOGGER.warn(resultSting, e); throw new ContextRuntimeException(resultSting, e); 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 5fba274ce..df430b683 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 @@ -66,7 +66,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { try { avroSchema = new Schema.Parser().parse(schema.getSchema()); } catch (final Exception e) { - final String resultSting = userKey.getID() + ": avro context schema \"" + schema.getID() + final String resultSting = userKey.getId() + ": avro context schema \"" + schema.getId() + "\" schema is invalid: " + e.getMessage() + ", schema: " + schema.getSchema(); LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); @@ -121,7 +121,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { return createNewInstance(elementJsonString); } else { - final String returnString = getUserKey().getID() + ": the object \"" + incomingObject + final String returnString = getUserKey().getId() + ": the object \"" + incomingObject + "\" is not an instance of JsonObject"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -146,7 +146,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { final JsonDecoder jsonDecoder = DecoderFactory.get().jsonDecoder(avroSchema, objectString); decodedObject = new GenericDatumReader<GenericRecord>(avroSchema).read(null, jsonDecoder); } catch (final Exception e) { - final String returnString = getUserKey().getID() + ": object \"" + objectString + final String returnString = getUserKey().getId() + ": object \"" + objectString + "\" Avro unmarshalling failed: " + e.getMessage(); LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString, e); @@ -185,7 +185,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { return (String) object; } } catch (final ClassCastException e) { - final String returnString = getUserKey().getID() + ": object \"" + object + "\" of type \"" + final String returnString = getUserKey().getId() + ": object \"" + object + "\" of type \"" + (object != null ? object.getClass().getCanonicalName() : "null") + "\" must be assignable to \"" + getSchemaClass().getCanonicalName() + "\" or be a Json string representation of it for Avro unmarshalling"; @@ -218,7 +218,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { return new String(output.toByteArray()); } catch (final Exception e) { final String returnString = - getUserKey().getID() + ": object \"" + object + "\" Avro marshalling failed: " + e.getMessage(); + getUserKey().getId() + ": object \"" + object + "\" Avro marshalling failed: " + e.getMessage(); LOGGER.warn(returnString); throw new ContextRuntimeException(returnString, e); } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java index cb3625f31..09d1d9f1f 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java @@ -101,7 +101,7 @@ public class AvroStringObjectMapper implements AvroObjectMapper { // The Avro object should be a Utf8 object if (!(avroObject instanceof Utf8)) { final String returnString = - userKey.getID() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -119,7 +119,7 @@ public class AvroStringObjectMapper implements AvroObjectMapper { @Override public Object mapToAvro(final Object object) { if (object == null) { - final String returnString = userKey.getID() + ": cannot encode a null object of class \"" + final String returnString = userKey.getId() + ": cannot encode a null object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); |