Skip to content

Commit

Permalink
Use InputSource.toApiSource
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Oct 20, 2023
1 parent 10f28ab commit b93730b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,7 @@ private Model read(InputStream input, Path pomFile, Map<String, ?> options) thro
boolean strict = isStrict(options);
MavenStaxReader mr = new MavenStaxReader();
mr.setAddLocationInformation(source != null);
Model model = new Model(mr.read(
parser,
strict,
source != null
? new org.apache.maven.api.model.InputSource(source.getModelId(), source.getLocation())
: null));
Model model = new Model(mr.read(parser, strict, source != null ? source.toApiSource() : null));
return model;
} catch (XMLStreamException e) {
Location location = e.getLocation();
Expand All @@ -139,10 +134,7 @@ private Model read(Reader reader, Path pomFile, Map<String, ?> options) throws I
boolean strict = isStrict(options);
MavenStaxReader mr = new MavenStaxReader();
mr.setAddLocationInformation(source != null);
Model model = new Model(mr.read(
parser,
strict,
new org.apache.maven.api.model.InputSource(source.getModelId(), source.getLocation())));
Model model = new Model(mr.read(parser, strict, source != null ? source.toApiSource() : null));
return model;
} catch (XMLStreamException e) {
Location location = e.getLocation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,8 @@ public void setAddDefaultEntities(boolean addDefaultEntities) {

protected Model read(Reader reader, boolean strict, InputSource source) throws IOException, XmlPullParserException {
try {
org.apache.maven.api.model.Model model = delegate.read(
reader,
strict,
source != null
? new org.apache.maven.api.model.InputSource(source.getModelId(), source.getLocation())
: null);
org.apache.maven.api.model.Model model =
delegate.read(reader, strict, source != null ? source.toApiSource() : null);
return new Model(model);
} catch (XMLStreamException e) {
throw new XmlPullParserException(e.getMessage(), null, e);
Expand Down Expand Up @@ -110,12 +106,8 @@ public Model read(Reader reader) throws IOException, XmlPullParserException {
protected Model read(InputStream is, boolean strict, InputSource source)
throws IOException, XmlPullParserException {
try {
org.apache.maven.api.model.Model model = delegate.read(
is,
strict,
source != null
? new org.apache.maven.api.model.InputSource(source.getModelId(), source.getLocation())
: null);
org.apache.maven.api.model.Model model =
delegate.read(is, strict, source != null ? source.toApiSource() : null);
return new Model(model);
} catch (XMLStreamException e) {
throw new XmlPullParserException(e.getMessage(), null, e);
Expand Down

0 comments on commit b93730b

Please sign in to comment.