Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
Code cleanup according to Sonar warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
marchof committed Jun 9, 2013
1 parent 4c8e9a2 commit 4a4ad05
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
package com.mountainminds.eclemma.core;

import org.jacoco.core.runtime.AgentOptions;
import org.jacoco.core.runtime.WildcardMatcher;

/**
* Clients may implement this interface to customize the behavior of the EclEmma
Expand Down Expand Up @@ -109,23 +108,23 @@ public String getAgentExclClassloader() {
* Returns the wildcard expression for classes to include.
*
* @return wildcard expression for classes to include
* @see WildcardMatcher
* @see org.jacoco.core.runtime.WildcardMatcher
*/
public String getAgentIncludes();

/**
* Returns the wildcard expression for classes to exclude.
*
* @return wildcard expression for classes to exclude
* @see WildcardMatcher
* @see org.jacoco.core.runtime.WildcardMatcher
*/
public String getAgentExcludes();

/**
* Returns the wildcard expression for excluded class loaders.
*
* @return expression for excluded class loaders
* @see WildcardMatcher
* @see org.jacoco.core.runtime.WildcardMatcher
*/
public String getAgentExclClassloader();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.util.Set;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jdt.core.IPackageFragmentRoot;

Expand All @@ -31,8 +30,8 @@
*
* This interface is not intended to be implemented by clients.
*
* @see CoverageTools#createCoverageSession(String, IClassFiles[], IPath[],
* ILaunchConfiguration)
* @see CoverageTools#createCoverageSession(String, IClassFiles[],
* org.eclipse.core.runtime.IPath[], ILaunchConfiguration)
*/
public interface ICoverageSession extends IAdaptable, IExecutionDataSource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ public JavaCoverageLoader(ISessionManager sessionManager) {
}

public void addJavaCoverageListener(IJavaCoverageListener l) {
if (l == null)
throw new NullPointerException();
if (l == null) {
throw new IllegalArgumentException();
}
if (!listeners.contains(l)) {
listeners.add(l);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ private IReportVisitor createFormatter() throws IOException {
case CSV:
final CSVFormatter csvFormatter = new CSVFormatter();
return csvFormatter.createVisitor(out);
default:
out.close();
throw new AssertionError("Unexpected format " + format); //$NON-NLS-1$
}
throw new AssertionError("Unexpected format " + format); //$NON-NLS-1$
}

private ISourceFileLocator createSourceFileLocator(IPackageFragmentRoot root)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ private void fireModelChanged(AnnotationModelEvent event) {
}

public void connect(IDocument document) {
if (this.document != document)
throw new RuntimeException("Can't connect to different document."); //$NON-NLS-1$
if (this.document != document) {
throw new IllegalArgumentException("Can't connect to different document."); //$NON-NLS-1$
}
for (final CoverageAnnotation ca : annotations) {
try {
document.addPosition(ca.getPosition());
Expand All @@ -274,8 +275,10 @@ public void connect(IDocument document) {
}

public void disconnect(IDocument document) {
if (this.document != document)
throw new RuntimeException("Can't disconnect from different document."); //$NON-NLS-1$
if (this.document != document) {
throw new IllegalArgumentException(
"Can't disconnect from different document."); //$NON-NLS-1$
}
for (final CoverageAnnotation ca : annotations) {
document.removePosition(ca.getPosition());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Filters for executed classes.
*/
class ExecutedClassesFilters {
final class ExecutedClassesFilters {

public static ViewerFilter fromPatternString(final String pattern) {
return new ViewerFilter() {
Expand Down Expand Up @@ -84,4 +84,9 @@ protected String getMatchedValue(Object toTest) {
}

}

// No instances
private ExecutedClassesFilters() {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
event.getTrigger(), event.getApplicationContext());
try {
command.executeWithChecks(importEvent);
} catch (ExecutionException e) {
throw e;
} catch (CommandException e) {
EclEmmaUIPlugin.log(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
event.getTrigger(), event.getApplicationContext());
try {
command.executeWithChecks(importEvent);
} catch (ExecutionException e) {
throw e;
} catch (CommandException e) {
EclEmmaUIPlugin.log(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ public void init(IWorkbench workbench, IStructuredSelection selection) {
}

public void addPages() {
addPage(page1 = new SessionImportPage1());
addPage(page2 = new SessionImportPage2());
page1 = new SessionImportPage1();
addPage(page1);
page2 = new SessionImportPage2();
addPage(page2);
}

public boolean performFinish() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected ILaunchConfigurationTabGroup createDelegate(String type)
}
}
if (element == null) {
String msg = "No tab group registered to run " + type; //$NON-NLS-1$;
String msg = "No tab group registered to run " + type; //$NON-NLS-1$
throw new CoreException(EclEmmaUIPlugin.errorStatus(msg, null));
} else {
return (ILaunchConfigurationTabGroup) element
Expand Down

0 comments on commit 4a4ad05

Please sign in to comment.