importStream() throws error: The method toArray() is undefined for the type Collection

I have these lines in one of my Java actions where I am converting a JSON string into the appropriate entity using an import mapping: final InputStream inputStream = new ByteArrayInputStream(jsonString.getBytes(StandardCharsets.UTF_8)); List<IMendixObject> mendixObjects = Core.integration().importStream(getContext(), inputStream, importMappingName, null, false); My setup is: Mendix 8.0.0 jdk- Eclipse IDE for Enterprise Java Developers - Version: 2019-03 (4.11.0)    The importStream() call throws the following error when debugging in Eclipse: The method toArray() is undefined for the type Collection… How do I proceed?  
1 answers

I created a test project to try and reproduce the issue.

Used Mx 7.23.5 and 8.0.0 with AdoptOpenJDK\jdk- and Eclipse Version: Kepler Service Release 2 Build id: 20140224-0627.

Created and entity with 1 string attribute.

Created a java action with 2 input parameters:

  1. String, for the jsonstring
  2. import mapping, to use the import mapping

Created a simple JSON structure:


From the structure created the import mapping

And with the following code imported the data from the string via the mapping:

		final InputStream inputStream = new ByteArrayInputStream(jsonStr.getBytes(StandardCharsets.UTF_8));
		List<IMendixObject> mendixObjects = Core.integration().importStream(getContext(), inputStream, importmap, null, false);
		return true;

This works fine, so I think the issue that you are experiencing should have something to do with the json being supplied to the java action rather than the jdk or Eclipse version. I would investigate this via a simple microflow in which you create a string variable with your json and perform a import activity with the import_mapping and see if that will also fail or not.