Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
skybber committed Mar 23, 2021
1 parent 188e630 commit ae419ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.hotswap.agent.annotation.handler;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
Expand Down Expand Up @@ -212,9 +213,12 @@ public void onWatchEvent(PluginAnnotation<T> pluginAnnotation, WatchFileEvent ev
* @throws org.hotswap.agent.javassist.NotFoundException
*/
private CtClass createCtClass(URI uri, ClassLoader classLoader) throws NotFoundException, IOException {
ClassPool cp = new ClassPool();
cp.appendClassPath(new LoaderClassPath(classLoader));

return cp.makeClass(new ByteArrayInputStream(IOUtils.toByteArray(uri)));
File file = new File(uri);
if (file.exists()) {
ClassPool cp = new ClassPool();
cp.appendClassPath(new LoaderClassPath(classLoader));
return cp.makeClass(new ByteArrayInputStream(IOUtils.toByteArray(uri)));
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static void refreshHandler(ClassLoader appClassLoader, String repoClassNa
LOGGER.info("Deltaspike repository {} refreshed.", repoClassName);
RepositoryRefreshAgent.reloadFlag = true;
} catch (ClassNotFoundException e) {
LOGGER.error("Repository class '{}' not found.", e, repoClassName);
LOGGER.error("Repository class '{}' not found.", repoClassName, e);
} finally {
Thread.currentThread().setContextClassLoader(oldContextClassLoader);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import javax.enterprise.inject.spi.CDI;

import org.hotswap.agent.plugin.hotswapper.HotSwapper;
import org.hotswap.agent.plugin.owb.command.BeanClassRefreshAgent;
import org.hotswap.agent.plugin.owb.command.BeanClassRefreshCommand;
import org.hotswap.agent.plugin.owb.testBeans.DependentHello1;
import org.hotswap.agent.plugin.owb.testBeans.HelloProducer1;
Expand Down

0 comments on commit ae419ff

Please sign in to comment.