Skip to content

Commit 1d92a38

Browse files
committed
HADOOP-8341. Fix or filter findbugs issues in hadoop-tools (bobby)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1335505 13f79535-47bb-0310-9956-ffa450edef68
1 parent fea2cb8 commit 1d92a38

File tree

15 files changed

+114
-27
lines changed

15 files changed

+114
-27
lines changed

hadoop-common-project/hadoop-common/CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,8 @@ Release 0.23.3 - UNRELEASED
545545
HADOOP-8327. distcpv2 and distcpv1 jars should not coexist (Dave Thompson
546546
via bobby)
547547

548+
HADOOP-8341. Fix or filter findbugs issues in hadoop-tools (bobby)
549+
548550
Release 0.23.2 - UNRELEASED
549551

550552
INCOMPATIBLE CHANGES

hadoop-tools/hadoop-archives/src/main/java/org/apache/hadoop/tools/HadoopArchives.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void setConf(Configuration conf) {
117117
// will when running the mapreduce job.
118118
String testJar = System.getProperty(TEST_HADOOP_ARCHIVES_JAR_PATH, null);
119119
if (testJar != null) {
120-
((JobConf)conf).setJar(testJar);
120+
this.conf.setJar(testJar);
121121
}
122122
}
123123

hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCp.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,13 @@ public Job execute() throws Exception {
136136

137137
Job job = null;
138138
try {
139-
metaFolder = createMetaFolderPath();
140-
jobFS = metaFolder.getFileSystem(getConf());
139+
synchronized(this) {
140+
//Don't cleanup while we are setting up.
141+
metaFolder = createMetaFolderPath();
142+
jobFS = metaFolder.getFileSystem(getConf());
141143

142-
job = createJob();
144+
job = createJob();
145+
}
143146
createInputFileListing(job);
144147

145148
job.submit();

hadoop-tools/hadoop-extras/src/main/java/org/apache/hadoop/tools/Logalyzer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
public class Logalyzer {
6666
// Constants
6767
private static Configuration fsConfig = new Configuration();
68-
public static String SORT_COLUMNS =
68+
public static final String SORT_COLUMNS =
6969
"logalizer.logcomparator.sort.columns";
70-
public static String COLUMN_SEPARATOR =
70+
public static final String COLUMN_SEPARATOR =
7171
"logalizer.logcomparator.column.separator";
7272

7373
static {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one or more
4+
contributor license agreements. See the NOTICE file distributed with
5+
this work for additional information regarding copyright ownership.
6+
The ASF licenses this file to You under the Apache License, Version 2.0
7+
(the "License"); you may not use this file except in compliance with
8+
the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
<FindBugsFilter>
19+
<And>
20+
<Class name="org.apache.hadoop.tools.rumen.LoggedJob"/>
21+
<Method name="getMapperTriesToSucceed"/>
22+
<Bug pattern="EI_EXPOSE_REP"/>
23+
<Bug code="EI"/>
24+
</And>
25+
<And>
26+
<Class name="org.apache.hadoop.tools.rumen.ZombieJob"/>
27+
<Method name="getInputSplits"/>
28+
<Bug pattern="EI_EXPOSE_REP"/>
29+
<Bug code="EI"/>
30+
</And>
31+
</FindBugsFilter>

hadoop-tools/hadoop-rumen/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@
9090

9191
<build>
9292
<plugins>
93+
<plugin>
94+
<groupId>org.codehaus.mojo</groupId>
95+
<artifactId>findbugs-maven-plugin</artifactId>
96+
<configuration>
97+
<findbugsXmlOutput>true</findbugsXmlOutput>
98+
<xmlOutput>true</xmlOutput>
99+
<excludeFilterFile>${basedir}/dev-support/findbugs-exclude.xml</excludeFilterFile>
100+
<effort>Max</effort>
101+
</configuration>
102+
</plugin>
93103
<plugin>
94104
<groupId>org.apache.maven.plugins</groupId>
95105
<artifactId>maven-antrun-plugin</artifactId>

hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/DeskewedJobTraceReader.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import java.io.Closeable;
2222
import java.io.IOException;
23+
import java.io.Serializable;
2324
import java.util.Comparator;
2425
import java.util.Iterator;
2526
import java.util.PriorityQueue;
@@ -59,7 +60,8 @@ public class DeskewedJobTraceReader implements Closeable {
5960
static final private Log LOG =
6061
LogFactory.getLog(DeskewedJobTraceReader.class);
6162

62-
static private class JobComparator implements Comparator<LoggedJob> {
63+
static private class JobComparator implements Comparator<LoggedJob>,
64+
Serializable {
6365
@Override
6466
public int compare(LoggedJob j1, LoggedJob j2) {
6567
return (j1.getSubmitTime() < j2.getSubmitTime()) ? -1 : (j1

hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/JobConfPropertyNames.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
package org.apache.hadoop.tools.rumen;
1919

20+
import java.util.Arrays;
21+
2022
import org.apache.hadoop.mapreduce.MRJobConfig;
2123

2224
public enum JobConfPropertyNames {
@@ -33,6 +35,6 @@ public enum JobConfPropertyNames {
3335
}
3436

3537
public String[] getCandidates() {
36-
return candidates;
38+
return Arrays.copyOf(candidates, candidates.length);
3739
}
3840
}

hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/LoggedNetworkTopology.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package org.apache.hadoop.tools.rumen;
1919

20+
import java.io.Serializable;
2021
import java.util.Collections;
2122
import java.util.HashMap;
2223
import java.util.HashSet;
@@ -68,7 +69,8 @@ public void setUnknownAttribute(String attributeName, Object ignored) {
6869
* order.
6970
*
7071
*/
71-
static class TopoSort implements Comparator<LoggedNetworkTopology> {
72+
static class TopoSort implements Comparator<LoggedNetworkTopology>,
73+
Serializable {
7274
public int compare(LoggedNetworkTopology t1, LoggedNetworkTopology t2) {
7375
return t1.name.getValue().compareTo(t2.name.getValue());
7476
}

hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/TraceBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.io.FileNotFoundException;
2121
import java.io.IOException;
2222
import java.io.InputStream;
23+
import java.io.Serializable;
2324
import java.util.ArrayList;
2425
import java.util.Arrays;
2526
import java.util.Comparator;
@@ -98,7 +99,7 @@ static class MyOptions {
9899
* history file names should result in the order of jobs' submission times.
99100
*/
100101
private static class HistoryLogsComparator
101-
implements Comparator<FileStatus> {
102+
implements Comparator<FileStatus>, Serializable {
102103
@Override
103104
public int compare(FileStatus file1, FileStatus file2) {
104105
return file1.getPath().getName().compareTo(

0 commit comments

Comments
 (0)