From 004291302514c68de3773c3a4751591ea4bdf29c Mon Sep 17 00:00:00 2001 From: Erich Douglass Date: Fri, 17 Apr 2015 09:28:20 -0700 Subject: [PATCH] Remove unused code. --- .../org/robolectric/templates/LogHandler.java | 30 +++++++++---------- .../templates/ProcessTemplatesMojo.java | 17 ----------- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/robolectric/templates/LogHandler.java b/src/main/java/org/robolectric/templates/LogHandler.java index 093bdae..aa8ac46 100644 --- a/src/main/java/org/robolectric/templates/LogHandler.java +++ b/src/main/java/org/robolectric/templates/LogHandler.java @@ -4,28 +4,30 @@ import org.apache.velocity.runtime.RuntimeServices; import org.apache.velocity.runtime.log.LogChute; +/** + * Logging adapter for Velocity. + */ public class LogHandler implements LogChute { private final AbstractMojo mojo; - public LogHandler(AbstractMojo velocityMojo) { - this.mojo = velocityMojo; + public LogHandler(AbstractMojo mojo) { + this.mojo = mojo; } public void init(RuntimeServices runtimeServices) throws Exception { } public boolean isLevelEnabled(int level) { - boolean enabled = false; - if (level == DEBUG_ID && mojo.getLog().isDebugEnabled()) - enabled = true; - else if (level == INFO_ID && mojo.getLog().isInfoEnabled()) - enabled = true; - else if (level == WARN_ID && mojo.getLog().isWarnEnabled()) - enabled = true; - else if (level == ERROR_ID && mojo.getLog().isErrorEnabled()) - enabled = true; - - return enabled; + if (level == DEBUG_ID && mojo.getLog().isDebugEnabled()) { + return true; + } else if (level == INFO_ID && mojo.getLog().isInfoEnabled()) { + return true; + } else if (level == WARN_ID && mojo.getLog().isWarnEnabled()) { + return true; + } else if (level == ERROR_ID && mojo.getLog().isErrorEnabled()) { + return true; + } + return false; } public void log(int level, String content) { @@ -43,7 +45,6 @@ public void log(int level, String content) { case ERROR_ID: mojo.getLog().error(content); break; - default: } } @@ -62,7 +63,6 @@ public void log(int level, String content, Throwable throwable) { case ERROR_ID: mojo.getLog().error(content, throwable); break; - default: } } } diff --git a/src/main/java/org/robolectric/templates/ProcessTemplatesMojo.java b/src/main/java/org/robolectric/templates/ProcessTemplatesMojo.java index cede19b..2a23bfa 100644 --- a/src/main/java/org/robolectric/templates/ProcessTemplatesMojo.java +++ b/src/main/java/org/robolectric/templates/ProcessTemplatesMojo.java @@ -43,7 +43,6 @@ public void execute() throws MojoExecutionException { try { Velocity.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM, new LogHandler(this)); Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, project.getBasedir().getAbsolutePath()); - Velocity.init(); VelocityContext context = new VelocityContext(); @@ -98,20 +97,4 @@ private void processTemplate(VelocityContext context, File file) throws Velocity throw new MojoExecutionException("Error processing template file: " + file.getAbsolutePath() + ": " + e); } } - - public void setProject(MavenProject project) { - this.project = project; - } - - public void setApiLevel(Integer apiLevel) { - this.apiLevel = apiLevel; - } - - public void setOutputDirectory(File outputDirectory) { - this.outputDirectory = outputDirectory; - } - - public void setTemplateFiles(FileSet templateFiles) { - this.templateFiles = templateFiles; - } } \ No newline at end of file