Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ public JavassistTemplateBuilder(TemplateRegistry registry, ClassLoader cl) {
appended = true;
}
} catch (SecurityException e) {
LOG.fine("Cannot append a search path of classloader");
e.printStackTrace();
if (LOG.isLoggable(Level.WARNING)) {
LOG.log(Level.WARNING, "Cannot append a search path of classloader", e);
}
}
if (!appended) {
pool.appendSystemPath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.msgpack.template.TemplateRegistry;
import org.msgpack.util.android.DalvikVmChecker;

public class TemplateBuilderChain {
private static final String JAVASSIST_TEMPLATE_BUILDER_CLASS_NAME =
"org.msgpack.template.builder.JavassistTemplateBuilder";
private static final String REFLECTION_TEMPLATE_BUILDER_CLASS_NAME =
"org.msgpack.template.builder.ReflectionTemplateBuilder";
private static final Logger LOG = Logger.getLogger(TemplateBuilderChain.class.getName());

private static final String JAVASSIST_TEMPLATE_BUILDER_CLASS_NAME =
"org.msgpack.template.builder.JavassistTemplateBuilder";
private static final String REFLECTION_TEMPLATE_BUILDER_CLASS_NAME =
"org.msgpack.template.builder.ReflectionTemplateBuilder";

private static boolean enableDynamicCodeGeneration() {
return !DalvikVmChecker.isDalvikVm() &&
Expand Down Expand Up @@ -74,16 +78,18 @@ protected void reset(final TemplateRegistry registry, final ClassLoader cl) {
templateBuilders.add(new ReflectionBeansTemplateBuilder(registry));
}

private static TemplateBuilder createForceTemplateBuilder(String className,
TemplateRegistry registry, ClassLoader cl) {
try {
Class<?> c = (Class<?>) Class.forName(className);
Constructor<?> cons = c.getConstructor(TemplateRegistry.class,
ClassLoader.class);
return (TemplateBuilder) cons.newInstance(registry, cl);
} catch (Exception e) {
e.printStackTrace();
}
private static TemplateBuilder createForceTemplateBuilder(String className,
TemplateRegistry registry, ClassLoader cl) {
try {
Class<?> c = (Class<?>) Class.forName(className);
Constructor<?> cons = c.getConstructor(TemplateRegistry.class,
ClassLoader.class);
return (TemplateBuilder) cons.newInstance(registry, cl);
} catch (Exception e) {
if (LOG.isLoggable(Level.WARNING)) {
LOG.log(Level.WARNING, "Failed to create a TemplateBuilder reflectively", e);
}
}
return new ReflectionTemplateBuilder(registry, cl);
}

Expand Down