Repository: oozie Updated Branches: refs/heads/master ae11fe7a9 -> e229e4dbb
OOZIE-3314 Remove findbugs-filter.xml and convert its contents to annotations (asalamon74 via andras.piros) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/e229e4db Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/e229e4db Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/e229e4db Branch: refs/heads/master Commit: e229e4dbb42b7bc0fdb866ccc530b533a2b2008b Parents: ae11fe7 Author: Andras Piros <andras.pi...@cloudera.com> Authored: Wed Aug 8 13:15:32 2018 +0200 Committer: Andras Piros <andras.pi...@cloudera.com> Committed: Wed Aug 8 13:15:32 2018 +0200 ---------------------------------------------------------------------- .../java/org/apache/oozie/command/XCommand.java | 5 +++-- .../command/coord/CoordinatorXCommand.java | 8 ++++---- .../oozie/command/wf/WorkflowXCommand.java | 8 ++++---- .../org/apache/oozie/util/Instrumentation.java | 13 ++++++++----- findbugs-filter.xml | 20 -------------------- fluent-job/fluent-job-api/pom.xml | 10 +++++++++- .../oozie/fluentjob/api/GraphVisualization.java | 3 +++ fluent-job/pom.xml | 10 +++++++++- pom.xml | 1 - release-log.txt | 1 + 10 files changed, 41 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/e229e4db/core/src/main/java/org/apache/oozie/command/XCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/XCommand.java b/core/src/main/java/org/apache/oozie/command/XCommand.java index 7b8f47c..4876e58 100644 --- a/core/src/main/java/org/apache/oozie/command/XCommand.java +++ b/core/src/main/java/org/apache/oozie/command/XCommand.java @@ -79,7 +79,9 @@ public abstract class XCommand<T> implements XCallable<T> { protected boolean dryrun = false; protected Instrumentation instrumentation; - protected static EventHandlerService eventService; + protected static EventHandlerService getEventService() { + return Services.get().get(EventHandlerService.class); + } /** * Create a command. @@ -95,7 +97,6 @@ public abstract class XCommand<T> implements XCallable<T> { this.key = name + "_" + UUID.randomUUID(); createdTime = System.currentTimeMillis(); instrumentation = Services.get().get(InstrumentationService.class).get(); - eventService = Services.get().get(EventHandlerService.class); } /** http://git-wip-us.apache.org/repos/asf/oozie/blob/e229e4db/core/src/main/java/org/apache/oozie/command/coord/CoordinatorXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/coord/CoordinatorXCommand.java b/core/src/main/java/org/apache/oozie/command/coord/CoordinatorXCommand.java index 18937a4..fc0d071 100644 --- a/core/src/main/java/org/apache/oozie/command/coord/CoordinatorXCommand.java +++ b/core/src/main/java/org/apache/oozie/command/coord/CoordinatorXCommand.java @@ -57,7 +57,7 @@ public abstract class CoordinatorXCommand<T> extends XCommand<T> { } public static void generateEvent(CoordinatorActionBean coordAction, String user, String appName, Date startTime) { - if (eventService.isSupportedApptype(AppType.COORDINATOR_ACTION.name())) { + if (getEventService().isSupportedApptype(AppType.COORDINATOR_ACTION.name())) { String missDep = coordAction.getMissingDependencies(); if (missDep != null && missDep.length() > 0) { missDep = missDep.split(CoordELFunctions.INSTANCE_SEPARATOR)[0]; @@ -73,16 +73,16 @@ public abstract class CoordinatorXCommand<T> extends XCommand<T> { deps); event.setErrorCode(coordAction.getErrorCode()); event.setErrorMessage(coordAction.getErrorMessage()); - eventService.queueEvent(event); + getEventService().queueEvent(event); } } protected void generateEvent(CoordinatorJobBean coordJob) { - if (eventService.isSupportedApptype(AppType.COORDINATOR_JOB.name())) { + if (getEventService().isSupportedApptype(AppType.COORDINATOR_JOB.name())) { CoordinatorJobEvent event = new CoordinatorJobEvent(coordJob.getId(), coordJob.getBundleId(), coordJob.getStatus(), coordJob.getUser(), coordJob.getAppName(), coordJob.getStartTime(), coordJob.getEndTime()); - eventService.queueEvent(event); + getEventService().queueEvent(event); } } http://git-wip-us.apache.org/repos/asf/oozie/blob/e229e4db/core/src/main/java/org/apache/oozie/command/wf/WorkflowXCommand.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/command/wf/WorkflowXCommand.java b/core/src/main/java/org/apache/oozie/command/wf/WorkflowXCommand.java index 87d7e77..9ed4336 100644 --- a/core/src/main/java/org/apache/oozie/command/wf/WorkflowXCommand.java +++ b/core/src/main/java/org/apache/oozie/command/wf/WorkflowXCommand.java @@ -66,12 +66,12 @@ public abstract class WorkflowXCommand<T> extends XCommand<T> { } protected static void generateEvent(WorkflowJobBean wfJob, String errorCode, String errorMsg) { - if (eventService.isSupportedApptype(AppType.WORKFLOW_JOB.name())) { + if (getEventService().isSupportedApptype(AppType.WORKFLOW_JOB.name())) { WorkflowJobEvent event = new WorkflowJobEvent(wfJob.getId(), wfJob.getParentId(), wfJob.getStatus(), wfJob.getUser(), wfJob.getAppName(), wfJob.getStartTime(), wfJob.getEndTime()); event.setErrorCode(errorCode); event.setErrorMessage(errorMsg); - eventService.queueEvent(event); + getEventService().queueEvent(event); } } @@ -80,12 +80,12 @@ public abstract class WorkflowXCommand<T> extends XCommand<T> { } protected void generateEvent(WorkflowActionBean wfAction, String wfUser) { - if (eventService.isSupportedApptype(AppType.WORKFLOW_ACTION.name())) { + if (getEventService().isSupportedApptype(AppType.WORKFLOW_ACTION.name())) { WorkflowActionEvent event = new WorkflowActionEvent(wfAction.getId(), wfAction.getJobId(), wfAction.getStatus(), wfUser, wfAction.getName(), wfAction.getStartTime(), wfAction.getEndTime()); event.setErrorCode(wfAction.getErrorCode()); event.setErrorMessage(wfAction.getErrorMessage()); - eventService.queueEvent(event); + getEventService().queueEvent(event); } } http://git-wip-us.apache.org/repos/asf/oozie/blob/e229e4db/core/src/main/java/org/apache/oozie/util/Instrumentation.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/util/Instrumentation.java b/core/src/main/java/org/apache/oozie/util/Instrumentation.java index 8bcb64c..93c00ed 100644 --- a/core/src/main/java/org/apache/oozie/util/Instrumentation.java +++ b/core/src/main/java/org/apache/oozie/util/Instrumentation.java @@ -709,16 +709,19 @@ public class Instrumentation { public String toString() { String E = System.getProperty("line.separator"); StringBuilder sb = new StringBuilder(4096); - for (String element : all.keySet()) { - sb.append(element).append(':').append(E); - List<String> groups = new ArrayList<String>(all.get(element).keySet()); + + for (Map.Entry<String, Map<String, Map<String, Object>>> entry : all.entrySet()) { + String allKey = entry.getKey(); + Map<String, Map<String, Object>> allValue = entry.getValue(); + sb.append(allKey).append(':').append(E); + List<String> groups = new ArrayList<>(allValue.keySet()); Collections.sort(groups); for (String group : groups) { sb.append(" ").append(group).append(':').append(E); - List<String> names = new ArrayList<String>(all.get(element).get(group).keySet()); + List<String> names = new ArrayList<>(allValue.get(group).keySet()); Collections.sort(names); for (String name : names) { - sb.append(" ").append(name).append(": ").append(((Element) all.get(element). + sb.append(" ").append(name).append(": ").append(((Element)allValue. get(group).get(name)).getValue()).append(E); } } http://git-wip-us.apache.org/repos/asf/oozie/blob/e229e4db/findbugs-filter.xml ---------------------------------------------------------------------- diff --git a/findbugs-filter.xml b/findbugs-filter.xml index 133178f..2f29987 100644 --- a/findbugs-filter.xml +++ b/findbugs-filter.xml @@ -16,29 +16,9 @@ limitations under the License. --> <FindBugsFilter> - <!-- excluded because eventServie is static and it cannot be simply rewritten --> - <Match> - <Class name="org.apache.oozie.command.XCommand" /> - <Field name="eventService" /> - <Bug pattern="MS_CANNOT_BE_FINAL" /> - </Match> - - <!-- excluded due to the complicated usage of keySet()/get() methods --> - <Match> - <Class name="org.apache.oozie.util.Instrumentation" /> - <Method name="toString" /> - <Bug pattern="WMI_WRONG_MAP_ITERATOR" /> - </Match> - <!-- Don't have much control on generated JAXB2 classes --> <Match> <Package name="~org\.apache\.oozie\.fluentjob\.api\.generated.*" /> <Bug pattern="EQ_UNUSUAL" /> </Match> - - <!-- Directory name is private static final --> - <Match> - <Class name="org.apache.oozie.fluentjob.api.GraphVisualization" /> - <Bug pattern="WEAK_FILENAMEUTILS" /> - </Match> </FindBugsFilter> http://git-wip-us.apache.org/repos/asf/oozie/blob/e229e4db/fluent-job/fluent-job-api/pom.xml ---------------------------------------------------------------------- diff --git a/fluent-job/fluent-job-api/pom.xml b/fluent-job/fluent-job-api/pom.xml index 4c9b853..cefd43c 100644 --- a/fluent-job/fluent-job-api/pom.xml +++ b/fluent-job/fluent-job-api/pom.xml @@ -72,6 +72,14 @@ <build> <plugins> + <!-- findbugs plugin. Execute 'mvn verify' and look for target/findbugs/findbugsXml.html under each module --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + <configuration> + <excludeFilterFile>${basedir}/findbugs-filter.xml</excludeFilterFile> + </configuration> + </plugin> <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> @@ -209,4 +217,4 @@ </build> </profile> </profiles> -</project> \ No newline at end of file +</project> http://git-wip-us.apache.org/repos/asf/oozie/blob/e229e4db/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/GraphVisualization.java ---------------------------------------------------------------------- diff --git a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/GraphVisualization.java b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/GraphVisualization.java index 437d6b3..4ad0ad7 100644 --- a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/GraphVisualization.java +++ b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/GraphVisualization.java @@ -18,6 +18,7 @@ package org.apache.oozie.fluentjob.api; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import guru.nidi.graphviz.engine.Format; import guru.nidi.graphviz.engine.Graphviz; import guru.nidi.graphviz.model.MutableGraph; @@ -40,6 +41,8 @@ import java.util.List; * <p> * Applying memory constraints, the width of the resulting {@code .png} is limited to {@link #PNG_WIDTH}. */ +@SuppressFBWarnings(value = {"WEAK_FILENAMEUTILS"}, + justification = "Directory name is private static final") public class GraphVisualization { private static final String PARENT_FOLDER_NAME = "target/graphviz"; private static final int PNG_WIDTH = 1024; http://git-wip-us.apache.org/repos/asf/oozie/blob/e229e4db/fluent-job/pom.xml ---------------------------------------------------------------------- diff --git a/fluent-job/pom.xml b/fluent-job/pom.xml index 5b24c91..1af60a4 100644 --- a/fluent-job/pom.xml +++ b/fluent-job/pom.xml @@ -31,6 +31,14 @@ <name>Apache Oozie Fluent Job</name> <packaging>pom</packaging> + <dependencies> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>annotations</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> + <modules> <module>fluent-job-api</module> <module>fluent-job-client</module> @@ -59,4 +67,4 @@ </plugins> </build> -</project> \ No newline at end of file +</project> http://git-wip-us.apache.org/repos/asf/oozie/blob/e229e4db/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 92358aa..e0dbe85 100644 --- a/pom.xml +++ b/pom.xml @@ -1814,7 +1814,6 @@ <threshold>Low</threshold> <xmlOutput>true</xmlOutput> <findbugsXmlOutputDirectory>${project.build.directory}/findbugs</findbugsXmlOutputDirectory> - <excludeFilterFile>findbugs-filter.xml</excludeFilterFile> <plugins> <plugin> <groupId>com.h3xstream.findsecbugs</groupId> http://git-wip-us.apache.org/repos/asf/oozie/blob/e229e4db/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index 5ed9f79..310f78a 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 5.1.0 release (trunk - unreleased) +OOZIE-3314 Remove findbugs-filter.xml and convert its contents to annotations (asalamon74 via andras.piros) OOZIE-3321 PySpark example fails (daniel.becker via andras.piros) OOZIE-3315 DateList example fails (daniel.becker via andras.piros) OOZIE-3313 Hive example action fails (daniel.becker via gezapeti)