|
15 | 15 | */
|
16 | 16 | package org.apache.commons.javaflow.tools.maven;
|
17 | 17 |
|
18 |
| -import static java.lang.Thread.currentThread; |
19 |
| - |
20 | 18 | import java.io.File;
|
21 | 19 | import java.io.IOException;
|
22 | 20 | import java.net.MalformedURLException;
|
@@ -127,39 +125,32 @@ public void execute() throws MojoExecutionException {
|
127 | 125 | }
|
128 | 126 |
|
129 | 127 | private void transformFiles(File inputDirectory, List<String> classPathEntries) throws IOException {
|
130 |
| - final Log log = getLog(); |
131 |
| - ClassLoader originalContextClassLoader = currentThread().getContextClassLoader(); |
132 |
| - try { |
133 |
| - List<URL> classPath = new ArrayList<URL>(); |
134 |
| - for (String classPathEntry : classPathEntries) { |
135 |
| - classPath.add(resolveUrl(new File(classPathEntry))); |
136 |
| - } |
137 |
| - classPath.add(resolveUrl(inputDirectory)); |
| 128 | + Log log = getLog(); |
| 129 | + List<URL> classPath = new ArrayList<URL>(); |
| 130 | + for (String classPathEntry : classPathEntries) { |
| 131 | + classPath.add(resolveUrl(new File(classPathEntry))); |
| 132 | + } |
| 133 | + classPath.add(resolveUrl(inputDirectory)); |
138 | 134 |
|
139 |
| - ResourceTransformer dirTransformer = RewritingUtils.createTransformer( |
140 |
| - classPath.toArray(new URL[] {}) |
141 |
| - ); |
142 |
| - |
143 |
| - try { |
144 |
| - long now = System.currentTimeMillis(); |
145 |
| - |
146 |
| - for (File source : RecursiveFilesIterator.scanClassFiles(inputDirectory)) { |
147 |
| - if (source.lastModified() <= now) { |
148 |
| - log.debug("Applying continuations support: " + source); |
149 |
| - boolean rewritten = RewritingUtils.rewriteClassFile(source, dirTransformer, source); |
150 |
| - if (rewritten) { |
151 |
| - log.info("Rewritten continuation-enabled class file: " + source); |
152 |
| - } |
| 135 | + ResourceTransformer dirTransformer = RewritingUtils.createTransformer( |
| 136 | + classPath.toArray(new URL[] {}) |
| 137 | + ); |
| 138 | + |
| 139 | + try { |
| 140 | + long now = System.currentTimeMillis(); |
| 141 | + |
| 142 | + for (File source : RecursiveFilesIterator.scanClassFiles(inputDirectory)) { |
| 143 | + if (source.lastModified() <= now) { |
| 144 | + log.debug("Applying continuations support: " + source); |
| 145 | + boolean rewritten = RewritingUtils.rewriteClassFile(source, dirTransformer, source); |
| 146 | + if (rewritten) { |
| 147 | + log.info("Rewritten continuation-enabled class file: " + source); |
153 | 148 | }
|
154 | 149 | }
|
155 |
| - } finally { |
156 |
| - dirTransformer.release(); |
157 | 150 | }
|
158 |
| - |
159 | 151 | } finally {
|
160 |
| - currentThread().setContextClassLoader(originalContextClassLoader); |
| 152 | + dirTransformer.release(); |
161 | 153 | }
|
162 |
| - |
163 | 154 | }
|
164 | 155 |
|
165 | 156 | private File computeDir(String dir) {
|
|
0 commit comments