Skip to content

Commit e46da18

Browse files
author
Vincent Potucek
committed
Pull apache#2304: Modernize codebase with Java improvements - test DefaultModelProcessor#read
1 parent 6be7a12 commit e46da18

File tree

2 files changed

+385
-10
lines changed

2 files changed

+385
-10
lines changed

impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelProcessor.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ public Model read(XmlReaderRequest request) throws IOException {
114114
}
115115
try {
116116
return doRead(request);
117-
} catch (IOException e) {
118-
exceptions.forEach(e::addSuppressed);
119-
throw e;
117+
} catch (RuntimeException ex) {
118+
exceptions.forEach(ex::addSuppressed);
119+
throw ex;
120120
}
121121
} else {
122122
return doRead(request);
@@ -126,18 +126,14 @@ public Model read(XmlReaderRequest request) throws IOException {
126126
private Path doLocateExistingPom(Path project) {
127127
if (project == null) {
128128
project = Paths.get(System.getProperty("user.dir"));
129-
}
130-
if (Files.isDirectory(project)) {
129+
} else if (Files.isDirectory(project)) {
131130
Path pom = project.resolve("pom.xml");
132131
return Files.isRegularFile(pom) ? pom : null;
133-
} else if (Files.isRegularFile(project)) {
134-
return project;
135-
} else {
136-
return null;
137132
}
133+
return project;
138134
}
139135

140-
private Model doRead(XmlReaderRequest request) throws IOException {
136+
private Model doRead(XmlReaderRequest request) {
141137
return modelXmlFactory.read(request);
142138
}
143139
}

0 commit comments

Comments
 (0)