GML encoder doesn't use the provided prefix writes NULL instead

Description

If you run this code:
{{
try (
FileOutputStream fos = new FileOutputStream(new File(fileName))) {
GML encoder;
if (Version.GML3.equals(version)) {
encoder = new GML(Version.WFS1_1);
} else if (Version.GML2.equals(version)) {
encoder = new GML(Version.WFS1_0);
} else {
throw new RuntimeException("Unsupported GML version " + version);
}
encode.setBaseURL(xsdURL);
encoder.setNamespace(prefix, namespace);
encoder.setCoordinateReferenceSystem(schema.getCoordinateReferenceSystem());
encoder.encode(fos, simpleFeatureCollection);

} catch (IOException e) {
e.printStackTrace();
return false;
}

}}

It outputs:

{{

<?xml version="1.0" encoding="UTF-8"?><wfs:FeatureCollection xmlns:gtx="file:/tmp/Featurewriter/test-3.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink">
<gml:boundedBy>
<gml:Envelope srsDimension="2" srsName="GCS_North_American_1983">
<gml:lowerCorner>-124.731422 24.955967</gml:lowerCorner>
<gml:upperCorner>-66.969849 49.371735</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>
<gml:featureMembers>
<null:statepop gml:id="statepop.1">
<gml:boundedBy>
<gml:Envelope srsName="GCS_North_American_1983" srsDimension="2">
<gml:lowerCorner>-91.516129 36.986771</gml:lowerCorner>
<gml:upperCorner>-87.507889 42.509361</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>
<the_geom>

}}

Environment

None

Assignee

Ian Turton

Reporter

Ian Turton

Triage

None

Components

Affects versions

Priority

Medium
Configure