|
32 | 32 | import javax.xml.stream.XMLStreamConstants;
|
33 | 33 | import javax.xml.stream.XMLStreamException;
|
34 | 34 | import javax.xml.stream.XMLStreamReader;
|
35 |
| -import javax.xml.transform.stream.StreamSource; |
36 | 35 | import java.io.IOException;
|
37 | 36 | import java.io.Writer;
|
38 | 37 | import java.net.URI;
|
39 | 38 | import java.net.URISyntaxException;
|
40 | 39 | import java.nio.file.Files;
|
41 | 40 | import java.nio.file.Path;
|
42 |
| -import java.nio.file.Paths; |
43 |
| -import java.util.Set; |
44 | 41 |
|
45 | 42 | /**
|
46 | 43 | * Handle the exist.xml descriptor in an EXPath package.
|
@@ -158,23 +155,22 @@ private void setupPackage(Package pkg, ExistPkgInfo info)
|
158 | 155 | throw new PackageException("Impossible to create directory: " + exist);
|
159 | 156 | }
|
160 | 157 | }
|
161 |
| - final Set<String> jars = info.getJars(); |
| 158 | + |
162 | 159 | try(final Writer out = Files.newBufferedWriter(classpath)) {
|
163 |
| - for (final String jar : jars) { |
164 |
| - StreamSource jar_src; |
| 160 | + for (final String jar : info.getJars()) { |
| 161 | + |
165 | 162 | try {
|
166 |
| - jar_src = res.resolveComponent(jar); |
| 163 | + res.resolveComponent(jar); |
167 | 164 | } catch (final NotExistException ex) {
|
168 |
| - final String msg = "Inconsistent package descriptor, the JAR file is not in the package: "; |
| 165 | + final String msg = "Inconsistent package descriptor, the JAR file is not in the EXPath package: "; |
169 | 166 | throw new PackageException(msg + jar, ex);
|
170 | 167 | }
|
171 |
| - final URI uri = URI.create(jar_src.getSystemId()); |
172 |
| - final Path file = Paths.get(uri); |
173 |
| - out.write(file.normalize().toString()); |
174 |
| - out.write("\n"); |
| 168 | + |
| 169 | + out.write(jar); |
| 170 | + out.write('\n'); |
175 | 171 | }
|
176 | 172 | } catch (final IOException ex) {
|
177 |
| - throw new PackageException("Error writing the eXist classpath file: " + classpath, ex); |
| 173 | + throw new PackageException("Error writing the eXist classpath file '" + classpath + "' for the EXPath package: " + pkg.getName(), ex); |
178 | 174 | }
|
179 | 175 | }
|
180 | 176 |
|
|
0 commit comments