Skip to content

Commit

Permalink
Merge pull request #69 from ybiquitous/issues/68
Browse files Browse the repository at this point in the history
Fixed bug which platform encoding is used by `java.io.FileReader`: use InputStream instead
  • Loading branch information
hboutemy committed Apr 14, 2016
2 parents 42a0869 + e2253cd commit ddf38a1
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/main/java/org/codehaus/mojo/versions/api/PomHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@

import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import java.io.BufferedReader;

import java.io.File;
import java.io.FileReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
Expand Down Expand Up @@ -102,14 +102,12 @@ public static Model getRawModel( MavenProject project )
public static Model getRawModel( File moduleProjectFile )
throws IOException
{
FileReader fileReader = null;
BufferedReader bufferedReader = null;
FileInputStream input = null;
try
{
fileReader = new FileReader( moduleProjectFile );
bufferedReader = new BufferedReader( fileReader );
input = new FileInputStream( moduleProjectFile );
MavenXpp3Reader reader = new MavenXpp3Reader();
return reader.read( bufferedReader );
return reader.read( input );
}
catch ( XmlPullParserException e )
{
Expand All @@ -119,13 +117,9 @@ public static Model getRawModel( File moduleProjectFile )
}
finally
{
if ( bufferedReader != null )
{
bufferedReader.close();
}
if ( fileReader != null )
if ( input != null )
{
fileReader.close();
input.close();
}
}
}
Expand Down

0 comments on commit ddf38a1

Please sign in to comment.