Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Commit c0710df

Browse files
author
Matthias Böckmann
committed
Hotfix to repair parsing of SubmodelElementCollections and their validation
1 parent 6676a8b commit c0710df

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • dataformat-rdf/src/main/java/io/adminshell/aas/v3/dataformat/rdf

dataformat-rdf/src/main/java/io/adminshell/aas/v3/dataformat/rdf/Parser.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ private <T> T handleObject(Model inputModel, String objectUri, Class<T> targetCl
223223
//Yes, it is assignable multiple times. Concatenate multiple values together using some delimiter
224224
try {
225225
//ArrayLists are generics. We need to extract the name of the generic parameter as string and interpret that
226-
String typeName = extractTypeNameFromList(value.getGenericParameterTypes()[0]);
226+
String typeName = extractTypeNameFromCollection(value.getGenericParameterTypes()[0]);
227227

228228
if (typeName.endsWith("LangString"))
229229
isTypedLiteral = true;
@@ -549,7 +549,7 @@ private <T> T handleObject(Model inputModel, String objectUri, Class<T> targetCl
549549
if (Collection.class.isAssignableFrom(currentType)) {
550550
//We are working with ArrayLists.
551551
//Here, we need to work with the GenericParameterTypes instead to find out what kind of ArrayList we are dealing with
552-
String typeName = extractTypeNameFromList(entry.getValue().getGenericParameterTypes()[0]);
552+
String typeName = extractTypeNameFromCollection(entry.getValue().getGenericParameterTypes()[0]);
553553
if (isArrayListTypePrimitive(entry.getValue().getGenericParameterTypes()[0])) {
554554
if (typeName.endsWith("LangString")) {
555555
try {
@@ -914,7 +914,7 @@ private Object handlePrimitive(Class<?> currentType, Literal literal, String cur
914914
}
915915

916916
private boolean isArrayListTypePrimitive(Type t) throws IOException {
917-
String typeName = extractTypeNameFromList(t);
917+
String typeName = extractTypeNameFromCollection(t);
918918

919919
try {
920920
//Do not try to call Class.forName(primitive) -- that would throw an exception
@@ -925,9 +925,9 @@ private boolean isArrayListTypePrimitive(Type t) throws IOException {
925925
}
926926
}
927927

928-
private String extractTypeNameFromList(Type t) throws IOException {
928+
private String extractTypeNameFromCollection(Type t) throws IOException {
929929
String typeName = t.getTypeName();
930-
if (!typeName.startsWith("java.util.ArrayList<") && !typeName.startsWith("java.util.List<")) {
930+
if (!typeName.startsWith("java.util.ArrayList<") && !typeName.startsWith("java.util.List<") && !typeName.startsWith("java.util.Collection<")) {
931931
throw new IOException("Illegal argument encountered while interpreting type parameter");
932932
}
933933
//"<? extends XYZ>" or super instead of extends

0 commit comments

Comments
 (0)