Skip to content

Commit 3d47661

Browse files
committed
Formatting, whitespace, checkstyle
1 parent 53d10b1 commit 3d47661

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1305
-1135
lines changed

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/runtime/cmd/DetectCutAndPasteCmd.java

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@
4444
import java.util.Iterator;
4545
import java.util.List;
4646

47-
import name.herlin.command.CommandException;
47+
import org.apache.log4j.Logger;
48+
import org.eclipse.core.resources.IFile;
49+
import org.eclipse.core.resources.IFolder;
50+
import org.eclipse.core.resources.IResource;
51+
import org.eclipse.core.runtime.CoreException;
52+
import org.eclipse.swt.widgets.Display;
53+
import org.eclipse.ui.IPropertyListener;
54+
4855
import net.sourceforge.pmd.cpd.CPD;
4956
import net.sourceforge.pmd.cpd.CPDConfiguration;
5057
import net.sourceforge.pmd.cpd.Language;
@@ -58,13 +65,7 @@
5865
import net.sourceforge.pmd.eclipse.util.IOUtil;
5966
import net.sourceforge.pmd.util.StringUtil;
6067

61-
import org.apache.log4j.Logger;
62-
import org.eclipse.core.resources.IFile;
63-
import org.eclipse.core.resources.IFolder;
64-
import org.eclipse.core.resources.IResource;
65-
import org.eclipse.core.runtime.CoreException;
66-
import org.eclipse.swt.widgets.Display;
67-
import org.eclipse.ui.IPropertyListener;
68+
import name.herlin.command.CommandException;
6869

6970
/**
7071
* This command produces a report of the Cut And Paste detector
@@ -82,7 +83,7 @@ public class DetectCutAndPasteCmd extends AbstractProjectCommand {
8283
private List<IPropertyListener> listeners;
8384

8485
private static final long serialVersionUID = 1L;
85-
private static final Logger log = Logger.getLogger(DetectCutAndPasteCmd.class);
86+
private static final Logger LOG = Logger.getLogger(DetectCutAndPasteCmd.class);
8687

8788
/**
8889
* Default Constructor
@@ -134,10 +135,10 @@ public void execute() throws CommandException {
134135
}
135136
}
136137
} catch (CoreException e) {
137-
log.debug("Core Exception: " + e.getMessage(), e);
138+
LOG.debug("Core Exception: " + e.getMessage(), e);
138139
throw new CommandException(e);
139140
} catch (PropertiesException e) {
140-
log.debug("Properties Exception: " + e.getMessage(), e);
141+
LOG.debug("Properties Exception: " + e.getMessage(), e);
141142
throw new CommandException(e);
142143
} finally {
143144
setTerminated(true);
@@ -220,18 +221,8 @@ private boolean canRenderReport() {
220221
*/
221222
@Override
222223
public boolean isReadyToExecute() {
223-
return super.isReadyToExecute() && language != null && (!createReport // need
224-
// a
225-
// renderer
226-
// and
227-
// reportName
228-
// if
229-
// a
230-
// report
231-
// should
232-
// be
233-
// created
234-
|| canRenderReport());
224+
// need a renderer and reportName if a report should be created
225+
return super.isReadyToExecute() && language != null && (!createReport || canRenderReport());
235226
}
236227

237228
/**
@@ -264,7 +255,7 @@ private List<File> findCandidateFiles() throws PropertiesException, CoreExceptio
264255
* @throws CoreException
265256
*/
266257
private CPD detectCutAndPaste(final List<File> files) {
267-
log.debug("Searching for project files");
258+
LOG.debug("Searching for project files");
268259

269260
final CPD cpd = newCPD();
270261

@@ -276,13 +267,13 @@ private CPD detectCutAndPaste(final List<File> files) {
276267
cpd.add(file);
277268
worked(1);
278269
} catch (IOException e) {
279-
log.warn("IOException when adding file " + file.getName() + " to CPD. Continuing.", e);
270+
LOG.warn("IOException when adding file " + file.getName() + " to CPD. Continuing.", e);
280271
}
281272
}
282273

283274
if (!isCanceled()) {
284275
subTask("Performing CPD");
285-
log.debug("Performing CPD");
276+
LOG.debug("Performing CPD");
286277
cpd.go();
287278
worked(getStepCount());
288279
}
@@ -310,32 +301,32 @@ private void renderReport(Iterator<Match> matches) throws CommandException {
310301
InputStream contentsStream = null;
311302

312303
try {
313-
log.debug("Rendering CPD report");
304+
LOG.debug("Rendering CPD report");
314305
subTask("Rendering CPD report");
315306
final String reportString = renderer.render(matches);
316307

317308
// Create the report folder if not already existing
318-
log.debug("Create the report folder");
309+
LOG.debug("Create the report folder");
319310
final IFolder folder = getProjectFolder(PMDRuntimeConstants.REPORT_FOLDER);
320311
if (!folder.exists()) {
321312
folder.create(true, true, getMonitor());
322313
}
323314

324315
// Create the report file
325-
log.debug("Create the report file");
316+
LOG.debug("Create the report file");
326317
final IFile reportFile = folder.getFile(reportName);
327318
contentsStream = new ByteArrayInputStream(reportString.getBytes());
328319
if (reportFile.exists()) {
329-
log.debug(" Overwriting report file");
320+
LOG.debug(" Overwriting report file");
330321
reportFile.setContents(contentsStream, true, false, getMonitor());
331322
} else {
332-
log.debug(" Creating report file");
323+
LOG.debug(" Creating report file");
333324
reportFile.create(contentsStream, true, getMonitor());
334325
}
335326
reportFile.refreshLocal(IResource.DEPTH_INFINITE, getMonitor());
336327

337328
} catch (CoreException e) {
338-
log.debug("Core Exception: " + e.getMessage(), e);
329+
LOG.debug("Core Exception: " + e.getMessage(), e);
339330
throw new CommandException(e);
340331
} finally {
341332
IOUtil.closeQuietly(contentsStream);
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
package net.sourceforge.pmd.eclipse.runtime.cmd;
23

34
import org.eclipse.core.commands.AbstractHandler;
@@ -7,10 +8,9 @@
78

89
public class DisableRuleHandler extends AbstractHandler {
910

10-
public Object execute(ExecutionEvent event) throws ExecutionException {
11-
HandlerUtil.getActiveWorkbenchWindow(event).close();
12-
return null;
13-
}
14-
11+
public Object execute(ExecutionEvent event) throws ExecutionException {
12+
HandlerUtil.getActiveWorkbenchWindow(event).close();
13+
return null;
14+
}
1515

1616
}

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/runtime/cmd/FakeRuleViolation.java

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
import net.sourceforge.pmd.lang.rule.ParametricRuleViolation;
4343

4444
/**
45-
* This is an implementation of IRuleViolation.
46-
* It is meant to rebuild a RuleViolation from a PMD Marker.
47-
* This object is used to generate violation reports.
45+
* This is an implementation of IRuleViolation. It is meant to rebuild a
46+
* RuleViolation from a PMD Marker. This object is used to generate violation
47+
* reports.
4848
*
4949
* @author Herlin
5050
* @author Brian Remedios
@@ -53,16 +53,17 @@
5353
class FakeRuleViolation extends ParametricRuleViolation<Node> {
5454

5555
private String description = "";
56-
57-
private static final RuleContext DummyContext = new RuleContext();
58-
56+
57+
private static final RuleContext DUMMY_CONTEXT = new RuleContext();
58+
5959
/**
60-
* Default constructor take a rule object to initialize.
61-
* All other variables have default values to empty;
60+
* Default constructor take a rule object to initialize. All other variables
61+
* have default values to empty;
62+
*
6263
* @param rule
6364
*/
64-
public FakeRuleViolation(Rule theRule) {
65-
super(theRule, DummyContext, null, null);
65+
FakeRuleViolation(Rule theRule) {
66+
super(theRule, DUMMY_CONTEXT, null, null);
6667
}
6768

6869
/**
@@ -73,70 +74,80 @@ public String getDescription() {
7374
}
7475

7576
/**
76-
* @param beginColumn The beginColumn to set.
77+
* @param beginColumn
78+
* The beginColumn to set.
7779
*/
7880
public void setBeginColumn(int beginColumn) {
7981
this.beginColumn = beginColumn;
8082
}
8183

8284
/**
83-
* @param beginLine The beginLine to set.
85+
* @param beginLine
86+
* The beginLine to set.
8487
*/
8588
public void setBeginLine(int beginLine) {
8689
this.beginLine = beginLine;
8790
}
8891

8992
/**
90-
* @param className The className to set.
93+
* @param className
94+
* The className to set.
9195
*/
9296
public void setClassName(String className) {
9397
this.className = className;
9498
}
9599

96100
/**
97-
* @param description The description to set.
101+
* @param description
102+
* The description to set.
98103
*/
99104
public void setDescription(String description) {
100105
this.description = description;
101106
}
102107

103108
/**
104-
* @param endColumn The endColumn to set.
109+
* @param endColumn
110+
* The endColumn to set.
105111
*/
106112
public void setEndColumn(int endColumn) {
107113
this.endColumn = endColumn;
108114
}
109115

110116
/**
111-
* @param endLine The endLine to set.
117+
* @param endLine
118+
* The endLine to set.
112119
*/
113120
public void setEndLine(int endLine) {
114121
this.endLine = endLine;
115122
}
116123

117124
/**
118-
* @param filename The filename to set.
125+
* @param filename
126+
* The filename to set.
119127
*/
120128
public void setFilename(String filename) {
121129
this.filename = filename;
122130
}
123131

124132
/**
125-
* @param methodName The methodName to set.
133+
* @param methodName
134+
* The methodName to set.
126135
*/
127136
public void setMethodName(String methodName) {
128137
this.methodName = methodName;
129138
}
130139

131140
/**
132-
* @param packageName The packageName to set.
141+
* @param packageName
142+
* The packageName to set.
133143
*/
134144
public void setPackageName(String packageName) {
135145
this.packageName = packageName;
136146
}
137147

138148
/**
139-
* @param variableName The variableName to set.
149+
* @param variableName
150+
* The variableName to set.
140151
*/
141152
public void setVariableName(String variableName) {
142153
this.variableName = variableName;

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/runtime/cmd/JavaProjectClassLoader.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* This is a ClassLoader for the Build Path of an IJavaProject.
2222
*/
2323
public class JavaProjectClassLoader extends URLClassLoader {
24-
private static final Logger log = Logger.getLogger(JavaProjectClassLoader.class);
24+
private static final Logger LOG = Logger.getLogger(JavaProjectClassLoader.class);
2525

2626
private Set<IJavaProject> javaProjects = new HashSet<IJavaProject>();
2727
private IWorkspaceRoot workspaceRoot;
@@ -51,8 +51,9 @@ private static IProject projectFor(IJavaProject javaProject, IClasspathEntry cla
5151

5252
private void addURLs(IJavaProject javaProject, boolean exportsOnly) {
5353

54-
if (javaProjects.contains(javaProject))
54+
if (javaProjects.contains(javaProject)) {
5555
return;
56+
}
5657

5758
javaProjects.add(javaProject);
5859

@@ -93,12 +94,13 @@ private void addURLs(IJavaProject javaProject, boolean exportsOnly) {
9394
// because we've asked for resolved entries.
9495
case IClasspathEntry.CPE_VARIABLE:
9596
case IClasspathEntry.CPE_CONTAINER:
97+
default:
9698
break;
9799
}
98100
}
99101
}
100102
} catch (JavaModelException e) {
101-
log.debug("MalformedURLException occurred: " + e.getLocalizedMessage(), e);
103+
LOG.debug("MalformedURLException occurred: " + e.getLocalizedMessage(), e);
102104
}
103105
}
104106

@@ -116,7 +118,7 @@ private void addURL(IPath path) {
116118
URL url = path.toFile().getAbsoluteFile().toURI().toURL();
117119
addURL(url);
118120
} catch (MalformedURLException e) {
119-
log.debug("MalformedURLException occurred: " + e.getLocalizedMessage(), e);
121+
LOG.debug("MalformedURLException occurred: " + e.getLocalizedMessage(), e);
120122
}
121123
}
122124
}

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/runtime/cmd/JobCommandProcessor.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,20 @@
4343
import java.util.concurrent.ConcurrentLinkedQueue;
4444
import java.util.concurrent.atomic.AtomicInteger;
4545

46-
import name.herlin.command.AbstractProcessableCommand;
47-
import name.herlin.command.CommandException;
48-
import name.herlin.command.CommandProcessor;
49-
import name.herlin.command.Timer;
50-
import name.herlin.command.UnsetInputPropertiesException;
51-
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
52-
5346
import org.apache.log4j.Logger;
5447
import org.eclipse.core.runtime.IProgressMonitor;
5548
import org.eclipse.core.runtime.IStatus;
5649
import org.eclipse.core.runtime.Status;
5750
import org.eclipse.core.runtime.jobs.Job;
5851

52+
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
53+
54+
import name.herlin.command.AbstractProcessableCommand;
55+
import name.herlin.command.CommandException;
56+
import name.herlin.command.CommandProcessor;
57+
import name.herlin.command.Timer;
58+
import name.herlin.command.UnsetInputPropertiesException;
59+
5960
/**
6061
* This is a particular processor for Eclipse in order to handle long running
6162
* commands.
@@ -64,7 +65,7 @@
6465
*
6566
*/
6667
public class JobCommandProcessor implements CommandProcessor {
67-
private static final Logger log = Logger.getLogger(JobCommandProcessor.class);
68+
private static final Logger LOG = Logger.getLogger(JobCommandProcessor.class);
6869
private final Map<AbstractProcessableCommand, Job> jobs = Collections
6970
.synchronizedMap(new HashMap<AbstractProcessableCommand, Job>());
7071

@@ -75,7 +76,7 @@ public class JobCommandProcessor implements CommandProcessor {
7576
* @see name.herlin.command.CommandProcessor#processCommand(name.herlin.command.AbstractProcessableCommand)
7677
*/
7778
public void processCommand(final AbstractProcessableCommand aCommand) throws CommandException {
78-
log.debug("Begining job command " + aCommand.getName());
79+
LOG.debug("Begining job command " + aCommand.getName());
7980

8081
if (!aCommand.isReadyToExecute()) {
8182
throw new UnsetInputPropertiesException();
@@ -121,7 +122,7 @@ protected IStatus run(IProgressMonitor monitor) {
121122
}
122123
}
123124
this.addJob(aCommand, job);
124-
log.debug("Ending job command " + aCommand.getName());
125+
LOG.debug("Ending job command " + aCommand.getName());
125126
}
126127

127128
/**

0 commit comments

Comments
 (0)