michael-o commented on a change in pull request #286: [MNG-6656] Introduce base 
for build/consumer process
URL: https://github.com/apache/maven/pull/286#discussion_r386401402
 
 

 ##########
 File path: 
maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
 ##########
 @@ -48,14 +54,44 @@
 public class DefaultModelReader
     implements ModelReader
 {
+    @Inject
+    private ModelSourceTransformer transformer;
 
+    public void setTransformer( ModelSourceTransformer transformer )
+    {
+        this.transformer = transformer;
+    }
+    
     @Override
     public Model read( File input, Map<String, ?> options )
         throws IOException
     {
         Objects.requireNonNull( input, "input cannot be null" );
 
-        Model model = read( new FileInputStream( input ), options );
+        TransformerContext context = null;
+        if ( options != null )
+        {
+            context = (TransformerContext) options.get( "transformerContext" );
+        }        
+
+        final InputStream is;
+        if ( context == null )
+        {
+            is = new FileInputStream( input );
+        }
+        else
+        {
+            try
+            {
+                is = transformer.transform( input.toPath(), context );
 
 Review comment:
   You have opened the input streams, but never closed them.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to