Reformat code use Eclipse Mars

This commit is contained in:
Phillip Webb
2015-10-07 23:32:31 -07:00
parent ba7c1fda72
commit 6ab376e2e8
652 changed files with 4151 additions and 3919 deletions

View File

@@ -107,10 +107,10 @@ public abstract class AbstractDependencyFilterMojo extends AbstractMojo {
for (ArtifactsFilter additionalFilter : additionalFilters) {
filters.addFilter(additionalFilter);
}
filters.addFilter(new ArtifactIdFilter("",
cleanFilterConfig(this.excludeArtifactIds)));
filters.addFilter(new MatchingGroupIdFilter(
cleanFilterConfig(this.excludeGroupIds)));
filters.addFilter(
new ArtifactIdFilter("", cleanFilterConfig(this.excludeArtifactIds)));
filters.addFilter(
new MatchingGroupIdFilter(cleanFilterConfig(this.excludeGroupIds)));
if (this.includes != null && !this.includes.isEmpty()) {
filters.addFilter(new IncludeFilter(this.includes));
}

View File

@@ -41,6 +41,7 @@ import org.springframework.boot.loader.tools.LibraryScope;
public class ArtifactsLibraries implements Libraries {
private static final Map<String, LibraryScope> SCOPES;
static {
Map<String, LibraryScope> scopes = new HashMap<String, LibraryScope>();
scopes.put(Artifact.SCOPE_COMPILE, LibraryScope.COMPILE);

View File

@@ -65,8 +65,8 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer
String name = (String) key;
String value = properties.getProperty(name);
String existing = this.data.getProperty(name);
this.data
.setProperty(name, existing == null ? value : existing + "," + value);
this.data.setProperty(name,
existing == null ? value : existing + "," + value);
}
}

View File

@@ -147,10 +147,9 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
finally {
long duration = System.currentTimeMillis() - startTime;
if (duration > FIND_WARNING_TIMEOUT) {
getLog().warn(
"Searching for the main-class is taking some time, "
+ "consider using the mainClass configuration "
+ "parameter");
getLog().warn("Searching for the main-class is taking some time, "
+ "consider using the mainClass configuration "
+ "parameter");
}
}
}
@@ -173,9 +172,8 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
throw new MojoExecutionException(ex.getMessage(), ex);
}
if (!source.equals(target)) {
getLog().info(
"Attaching archive: " + target + ", with classifier: "
+ this.classifier);
getLog().info("Attaching archive: " + target + ", with classifier: "
+ this.classifier);
this.projectHelper.attachArtifact(this.project, this.project.getPackaging(),
this.classifier, target);
}

View File

@@ -43,8 +43,8 @@ class RunArguments {
return CommandLineUtils.translateCommandline(arguments);
}
catch (Exception ex) {
throw new IllegalArgumentException("Failed to parse arguments [" + arguments
+ "]", ex);
throw new IllegalArgumentException(
"Failed to parse arguments [" + arguments + "]", ex);
}
}

View File

@@ -154,7 +154,8 @@ public class RunMojo extends AbstractDependencyFilterMojo {
}
CodeSource source = loaded.getProtectionDomain().getCodeSource();
if (source != null) {
this.agent = new File[] { new File(source.getLocation().getFile()) };
this.agent = new File[] {
new File(source.getLocation().getFile()) };
}
}
}
@@ -170,7 +171,8 @@ public class RunMojo extends AbstractDependencyFilterMojo {
private void run(String startClassName) throws MojoExecutionException {
findAgent();
boolean hasAgent = (this.agent != null && this.agent.length > 0);
boolean hasJvmArgs = (this.jvmArguments != null && this.jvmArguments.length() > 0);
boolean hasJvmArgs = (this.jvmArguments != null
&& this.jvmArguments.length() > 0);
if (Boolean.TRUE.equals(this.fork)
|| (this.fork == null && (hasAgent || hasJvmArgs))) {
runWithForkedJvm(startClassName);
@@ -180,9 +182,8 @@ public class RunMojo extends AbstractDependencyFilterMojo {
getLog().warn("Fork mode disabled, ignoring agent");
}
if (hasJvmArgs) {
getLog().warn(
"Fork mode disabled, ignoring JVM argument(s) ["
+ this.jvmArguments + "]");
getLog().warn("Fork mode disabled, ignoring JVM argument(s) ["
+ this.jvmArguments + "]");
}
runWithMavenJvm(startClassName);
}
@@ -196,8 +197,8 @@ public class RunMojo extends AbstractDependencyFilterMojo {
args.add(startClassName);
addArgs(args);
try {
new RunProcess(new JavaExecutable().toString()).run(args
.toArray(new String[args.size()]));
new RunProcess(new JavaExecutable().toString())
.run(args.toArray(new String[args.size()]));
}
catch (Exception ex) {
throw new MojoExecutionException("Could not exec java", ex);
@@ -206,8 +207,9 @@ public class RunMojo extends AbstractDependencyFilterMojo {
private void runWithMavenJvm(String startClassName) throws MojoExecutionException {
IsolatedThreadGroup threadGroup = new IsolatedThreadGroup(startClassName);
Thread launchThread = new Thread(threadGroup, new LaunchRunner(startClassName,
this.arguments), startClassName + ".main()");
Thread launchThread = new Thread(threadGroup,
new LaunchRunner(startClassName, this.arguments),
startClassName + ".main()");
launchThread.setContextClassLoader(new URLClassLoader(getClassPathUrls()));
launchThread.start();
join(threadGroup);
@@ -236,8 +238,9 @@ public class RunMojo extends AbstractDependencyFilterMojo {
try {
StringBuilder classpath = new StringBuilder();
for (URL ele : getClassPathUrls()) {
classpath = classpath.append((classpath.length() > 0 ? File.pathSeparator
: "") + new File(ele.toURI()));
classpath = classpath
.append((classpath.length() > 0 ? File.pathSeparator : "")
+ new File(ele.toURI()));
}
getLog().debug("Classpath for forked process: " + classpath);
args.add("-cp");
@@ -310,10 +313,11 @@ public class RunMojo extends AbstractDependencyFilterMojo {
urls.add(this.classesDirectory.toURI().toURL());
}
private void addDependencies(List<URL> urls) throws MalformedURLException,
MojoExecutionException {
private void addDependencies(List<URL> urls)
throws MalformedURLException, MojoExecutionException {
FilterArtifacts filters = getFilters(new TestArtifactFilter());
Set<Artifact> artifacts = filterDependencies(this.project.getArtifacts(), filters);
Set<Artifact> artifacts = filterDependencies(this.project.getArtifacts(),
filters);
for (Artifact artifact : artifacts) {
if (artifact.getFile() != null) {
urls.add(artifact.getFile().toURI().toURL());
@@ -382,7 +386,8 @@ public class RunMojo extends AbstractDependencyFilterMojo {
}
}
public synchronized void rethrowUncaughtException() throws MojoExecutionException {
public synchronized void rethrowUncaughtException()
throws MojoExecutionException {
if (this.exception != null) {
throw new MojoExecutionException("An exception occured while running. "
+ this.exception.getMessage(), this.exception);
@@ -420,7 +425,8 @@ public class RunMojo extends AbstractDependencyFilterMojo {
catch (NoSuchMethodException ex) {
Exception wrappedEx = new Exception(
"The specified mainClass doesn't contain a "
+ "main method with appropriate signature.", ex);
+ "main method with appropriate signature.",
ex);
thread.getThreadGroup().uncaughtException(thread, wrappedEx);
}
catch (Exception ex) {

View File

@@ -72,8 +72,8 @@ public class DependencyFilterMojoTests {
return a;
}
private static class TestableDependencyFilterMojo extends
AbstractDependencyFilterMojo {
private static class TestableDependencyFilterMojo
extends AbstractDependencyFilterMojo {
private TestableDependencyFilterMojo(List<Exclude> excludes,
String excludeGroupIds, String excludeArtifactIds) {

View File

@@ -41,17 +41,17 @@ public class ExcludeFilterTests {
@Test
public void excludeSimple() throws ArtifactFilterException {
ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo",
"bar")));
Set result = filter.filter(Collections
.singleton(createArtifact("com.foo", "bar")));
ExcludeFilter filter = new ExcludeFilter(
Arrays.asList(createExclude("com.foo", "bar")));
Set result = filter
.filter(Collections.singleton(createArtifact("com.foo", "bar")));
assertEquals("Should have been filtered", 0, result.size());
}
@Test
public void excludeGroupIdNoMatch() throws ArtifactFilterException {
ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo",
"bar")));
ExcludeFilter filter = new ExcludeFilter(
Arrays.asList(createExclude("com.foo", "bar")));
Artifact artifact = createArtifact("com.baz", "bar");
Set result = filter.filter(Collections.singleton(artifact));
assertEquals("Should not have been filtered", 1, result.size());
@@ -60,8 +60,8 @@ public class ExcludeFilterTests {
@Test
public void excludeArtifactIdNoMatch() throws ArtifactFilterException {
ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo",
"bar")));
ExcludeFilter filter = new ExcludeFilter(
Arrays.asList(createExclude("com.foo", "bar")));
Artifact artifact = createArtifact("com.foo", "biz");
Set result = filter.filter(Collections.singleton(artifact));
assertEquals("Should not have been filtered", 1, result.size());
@@ -70,17 +70,17 @@ public class ExcludeFilterTests {
@Test
public void excludeClassifier() throws ArtifactFilterException {
ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo",
"bar", "jdk5")));
Set result = filter.filter(Collections.singleton(createArtifact("com.foo", "bar",
"jdk5")));
ExcludeFilter filter = new ExcludeFilter(
Arrays.asList(createExclude("com.foo", "bar", "jdk5")));
Set result = filter
.filter(Collections.singleton(createArtifact("com.foo", "bar", "jdk5")));
assertEquals("Should have been filtered", 0, result.size());
}
@Test
public void excludeClassifierNoTargetClassifier() throws ArtifactFilterException {
ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo",
"bar", "jdk5")));
ExcludeFilter filter = new ExcludeFilter(
Arrays.asList(createExclude("com.foo", "bar", "jdk5")));
Artifact artifact = createArtifact("com.foo", "bar");
Set result = filter.filter(Collections.singleton(artifact));
assertEquals("Should not have been filtered", 1, result.size());
@@ -89,8 +89,8 @@ public class ExcludeFilterTests {
@Test
public void excludeClassifierNoMatch() throws ArtifactFilterException {
ExcludeFilter filter = new ExcludeFilter(Arrays.asList(createExclude("com.foo",
"bar", "jdk5")));
ExcludeFilter filter = new ExcludeFilter(
Arrays.asList(createExclude("com.foo", "bar", "jdk5")));
Artifact artifact = createArtifact("com.foo", "bar", "jdk6");
Set result = filter.filter(Collections.singleton(artifact));
assertEquals("Should not have been filtered", 1, result.size());
@@ -126,7 +126,8 @@ public class ExcludeFilterTests {
return exclude;
}
private Artifact createArtifact(String groupId, String artifactId, String classifier) {
private Artifact createArtifact(String groupId, String artifactId,
String classifier) {
Artifact a = mock(Artifact.class);
given(a.getGroupId()).willReturn(groupId);
given(a.getArtifactId()).willReturn(artifactId);

View File

@@ -39,8 +39,8 @@ public class IncludeFilterTests {
@Test
public void includeSimple() throws ArtifactFilterException {
IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo",
"bar")));
IncludeFilter filter = new IncludeFilter(
Arrays.asList(createInclude("com.foo", "bar")));
Artifact artifact = createArtifact("com.foo", "bar");
Set result = filter.filter(Collections.singleton(artifact));
assertEquals("Should not have been filtered", 1, result.size());
@@ -49,8 +49,8 @@ public class IncludeFilterTests {
@Test
public void includeGroupIdNoMatch() throws ArtifactFilterException {
IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo",
"bar")));
IncludeFilter filter = new IncludeFilter(
Arrays.asList(createInclude("com.foo", "bar")));
Artifact artifact = createArtifact("com.baz", "bar");
Set result = filter.filter(Collections.singleton(artifact));
assertEquals("Should have been filtered", 0, result.size());
@@ -58,8 +58,8 @@ public class IncludeFilterTests {
@Test
public void includeArtifactIdNoMatch() throws ArtifactFilterException {
IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo",
"bar")));
IncludeFilter filter = new IncludeFilter(
Arrays.asList(createInclude("com.foo", "bar")));
Artifact artifact = createArtifact("com.foo", "biz");
Set result = filter.filter(Collections.singleton(artifact));
assertEquals("Should have been filtered", 0, result.size());
@@ -67,8 +67,8 @@ public class IncludeFilterTests {
@Test
public void includeClassifier() throws ArtifactFilterException {
IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo",
"bar", "jdk5")));
IncludeFilter filter = new IncludeFilter(
Arrays.asList(createInclude("com.foo", "bar", "jdk5")));
Artifact artifact = createArtifact("com.foo", "bar", "jdk5");
Set result = filter.filter(Collections.singleton(artifact));
assertEquals("Should not have been filtered", 1, result.size());
@@ -77,8 +77,8 @@ public class IncludeFilterTests {
@Test
public void includeClassifierNoTargetClassifier() throws ArtifactFilterException {
IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo",
"bar", "jdk5")));
IncludeFilter filter = new IncludeFilter(
Arrays.asList(createInclude("com.foo", "bar", "jdk5")));
Artifact artifact = createArtifact("com.foo", "bar");
Set result = filter.filter(Collections.singleton(artifact));
assertEquals("Should have been filtered", 0, result.size());
@@ -86,8 +86,8 @@ public class IncludeFilterTests {
@Test
public void includeClassifierNoMatch() throws ArtifactFilterException {
IncludeFilter filter = new IncludeFilter(Arrays.asList(createInclude("com.foo",
"bar", "jdk5")));
IncludeFilter filter = new IncludeFilter(
Arrays.asList(createInclude("com.foo", "bar", "jdk5")));
Artifact artifact = createArtifact("com.foo", "bar", "jdk6");
Set result = filter.filter(Collections.singleton(artifact));
assertEquals("Should have been filtered", 0, result.size());
@@ -121,7 +121,8 @@ public class IncludeFilterTests {
return include;
}
private Artifact createArtifact(String groupId, String artifactId, String classifier) {
private Artifact createArtifact(String groupId, String artifactId,
String classifier) {
Artifact a = mock(Artifact.class);
given(a.getGroupId()).willReturn(groupId);
given(a.getArtifactId()).willReturn(artifactId);

View File

@@ -44,7 +44,8 @@ public class RunArgumentsTests {
@Test
public void parseDebugFlags() {
String[] args = parseArgs("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005");
String[] args = parseArgs(
"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005");
assertEquals(2, args.length);
assertEquals("-Xdebug", args[0]);
assertEquals("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005",

View File

@@ -118,8 +118,8 @@ public class Verify {
return entry.getValue();
}
}
throw new IllegalStateException("Unable to find entry starting with "
+ entryName);
throw new IllegalStateException(
"Unable to find entry starting with " + entryName);
}
public boolean hasEntry(String entry) {
@@ -191,16 +191,16 @@ public class Verify {
verifier.assertHasEntryNameStartingWith("lib/spring-context");
verifier.assertHasEntryNameStartingWith("lib/spring-core");
verifier.assertHasEntryNameStartingWith("lib/javax.servlet-api-3");
assertTrue("Unpacked launcher classes", verifier.hasEntry("org/"
+ "springframework/boot/loader/JarLauncher.class"));
assertTrue("Own classes", verifier.hasEntry("org/"
+ "test/SampleApplication.class"));
assertTrue("Unpacked launcher classes", verifier
.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class"));
assertTrue("Own classes",
verifier.hasEntry("org/" + "test/SampleApplication.class"));
}
@Override
protected void verifyManifest(Manifest manifest) throws Exception {
assertEquals("org.springframework.boot.loader.JarLauncher", manifest
.getMainAttributes().getValue("Main-Class"));
assertEquals("org.springframework.boot.loader.JarLauncher",
manifest.getMainAttributes().getValue("Main-Class"));
assertEquals(this.main, manifest.getMainAttributes().getValue("Start-Class"));
assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used"));
}
@@ -217,20 +217,21 @@ public class Verify {
super.verifyZipEntries(verifier);
verifier.assertHasEntryNameStartingWith("WEB-INF/lib/spring-context");
verifier.assertHasEntryNameStartingWith("WEB-INF/lib/spring-core");
verifier.assertHasEntryNameStartingWith("WEB-INF/lib-provided/javax.servlet-api-3");
assertTrue("Unpacked launcher classes", verifier.hasEntry("org/"
+ "springframework/boot/loader/JarLauncher.class"));
assertTrue("Own classes", verifier.hasEntry("WEB-INF/classes/org/"
+ "test/SampleApplication.class"));
verifier.assertHasEntryNameStartingWith(
"WEB-INF/lib-provided/javax.servlet-api-3");
assertTrue("Unpacked launcher classes", verifier
.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class"));
assertTrue("Own classes", verifier
.hasEntry("WEB-INF/classes/org/" + "test/SampleApplication.class"));
assertTrue("Web content", verifier.hasEntry("index.html"));
}
@Override
protected void verifyManifest(Manifest manifest) throws Exception {
assertEquals("org.springframework.boot.loader.WarLauncher", manifest
.getMainAttributes().getValue("Main-Class"));
assertEquals("org.test.SampleApplication", manifest.getMainAttributes()
.getValue("Start-Class"));
assertEquals("org.springframework.boot.loader.WarLauncher",
manifest.getMainAttributes().getValue("Main-Class"));
assertEquals("org.test.SampleApplication",
manifest.getMainAttributes().getValue("Start-Class"));
assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used"));
}
}
@@ -243,10 +244,10 @@ public class Verify {
@Override
protected void verifyManifest(Manifest manifest) throws Exception {
assertEquals("org.springframework.boot.loader.PropertiesLauncher", manifest
.getMainAttributes().getValue("Main-Class"));
assertEquals("org.test.SampleApplication", manifest.getMainAttributes()
.getValue("Start-Class"));
assertEquals("org.springframework.boot.loader.PropertiesLauncher",
manifest.getMainAttributes().getValue("Main-Class"));
assertEquals("org.test.SampleApplication",
manifest.getMainAttributes().getValue("Start-Class"));
assertEquals("Foo", manifest.getMainAttributes().getValue("Not-Used"));
}
}
@@ -263,10 +264,10 @@ public class Verify {
verifier.assertHasEntryNameStartingWith("lib/spring-context");
verifier.assertHasEntryNameStartingWith("lib/spring-core");
verifier.assertHasNoEntryNameStartingWith("lib/javax.servlet-api-3");
assertFalse("Unpacked launcher classes", verifier.hasEntry("org/"
+ "springframework/boot/loader/JarLauncher.class"));
assertTrue("Own classes", verifier.hasEntry("org/"
+ "test/SampleModule.class"));
assertFalse("Unpacked launcher classes", verifier
.hasEntry("org/" + "springframework/boot/loader/JarLauncher.class"));
assertTrue("Own classes",
verifier.hasEntry("org/" + "test/SampleModule.class"));
}
@Override