in src/main/java/org/apache/sling/maven/slingstart/JSONFeatures.java [51:74]
public static String read(final Reader reader, final ArtifactId optionalId, final String location)
throws IOException {
JsonObject featureObj;
try (JsonReader jsonReader = Json.createReader(Configurations.jsonCommentAwareReader(reader))) {
featureObj = jsonReader.readObject();
if ( !featureObj.containsKey("id") ) {
final JsonObjectBuilder job = Json.createObjectBuilder();
job.add("id", optionalId.toMvnId());
for(final Map.Entry<String, JsonValue> prop : featureObj.entrySet() ) {
job.add(prop.getKey(), prop.getValue());
}
featureObj = job.build();
}
} catch ( final JsonException je) {
throw new IOException(location.concat(" : " ).concat(je.getMessage()), je);
}
try ( final StringWriter writer = new StringWriter()) {
try ( final JsonWriter jsonWriter = Json.createWriter(writer)) {
jsonWriter.writeObject(featureObj);
}
return writer.toString();
}
}