From c5c52684eb30d924cb75a632b526a0f879d5a33c Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Sun, 18 Sep 2016 17:38:12 +0300 Subject: Format Java files using Eclipse Neon and Vaadin settings Using the same formatting in the 7.7 branch and the master branch eases porting of fixes Change-Id: I51b4693f2f120447702cf322ce4505608ad92987 --- .../java/com/vaadin/buildhelpers/CompileTheme.java | 30 +++++++++--------- .../buildhelpers/GeneratePackageExports.java | 29 ++++++++--------- .../com/vaadin/buildhelpers/ManifestWriter.java | 36 +++++++++++----------- 3 files changed, 48 insertions(+), 47 deletions(-) (limited to 'buildhelpers') diff --git a/buildhelpers/src/main/java/com/vaadin/buildhelpers/CompileTheme.java b/buildhelpers/src/main/java/com/vaadin/buildhelpers/CompileTheme.java index d97025bdb6..edd4fd9b88 100644 --- a/buildhelpers/src/main/java/com/vaadin/buildhelpers/CompileTheme.java +++ b/buildhelpers/src/main/java/com/vaadin/buildhelpers/CompileTheme.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 Vaadin Ltd. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -64,11 +64,11 @@ public class CompileTheme { // Regular theme try { processSassTheme(themeFolder, themeName, "styles", version); - System.out.println("Compiling theme " + themeName - + " styles successful"); + System.out.println( + "Compiling theme " + themeName + " styles successful"); } catch (Exception e) { - System.err.println("Compiling theme " + themeName - + " styles failed"); + System.err + .println("Compiling theme " + themeName + " styles failed"); e.printStackTrace(); } // Legacy theme w/o .themename{} wrapping @@ -82,8 +82,8 @@ public class CompileTheme { + " legacy-styles successful"); } } catch (Exception e) { - System.err.println("Compiling theme " + themeName - + " legacy-styles failed"); + System.err.println( + "Compiling theme " + themeName + " legacy-styles failed"); e.printStackTrace(); } } @@ -103,8 +103,8 @@ public class CompileTheme { ScssStylesheet scss = ScssStylesheet.get(sassFile); if (scss == null) { - throw new IllegalArgumentException("SASS file: " + sassFile - + " not found"); + throw new IllegalArgumentException( + "SASS file: " + sassFile + " not found"); } scss.compile(); String filteredScss = scss.printState().replace("@version@", version); @@ -128,8 +128,8 @@ public class CompileTheme { boolean ok = newCss.renameTo(oldCss); if (!ok) { - throw new RuntimeException("Rename " + newCss + " -> " + oldCss - + " failed"); + throw new RuntimeException( + "Rename " + newCss + " -> " + oldCss + " failed"); } } @@ -142,8 +142,8 @@ public class CompileTheme { // hiding other classpath issues Class smartSpritesClass = org.carrot2.labs.smartsprites.SmartSprites.class; } catch (NoClassDefFoundError e) { - System.err - .println("Could not find smartsprites. No sprites were generated. The theme should still work."); + System.err.println( + "Could not find smartsprites. No sprites were generated. The theme should still work."); return; } diff --git a/buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java b/buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java index d4ad3f838c..a27bed1dba 100644 --- a/buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java +++ b/buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 Vaadin Ltd. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -35,7 +35,7 @@ import java.util.regex.Pattern; * Export-Package attribute, and appends it to the jar's MANIFEST.MF. *

* See #3521 for details. - * + * * @author magi */ public class GeneratePackageExports { @@ -44,11 +44,10 @@ public class GeneratePackageExports { public static void main(String[] args) { if (args.length < 2) { - System.err - .println("Invalid number of parameters\n" - + "Usage: java -cp .. GenerateManifest \n" - + "Use -Dvaadin.version to specify the version to be used for the packages\n" - + "Use -DincludeNumberPackages=1 to include package names which start with a number (not 100% OSGi compatible)"); + System.err.println("Invalid number of parameters\n" + + "Usage: java -cp .. GenerateManifest \n" + + "Use -Dvaadin.version to specify the version to be used for the packages\n" + + "Use -DincludeNumberPackages=1 to include package names which start with a number (not 100% OSGi compatible)"); System.exit(1); } @@ -149,7 +148,7 @@ public class GeneratePackageExports { * version.. Searches for the packge and then its parents * recursively. Falls back to the "vaadin.version" system property if no * other properties are found. - * + * * @param javaPackage * The package to determine a version for * @return A version or null if no version has been defined @@ -178,7 +177,8 @@ public class GeneratePackageExports { } private static HashSet getPackages(JarFile jar, - List acceptedPackagePrefixes, boolean includeNumberPackages) { + List acceptedPackagePrefixes, + boolean includeNumberPackages) { HashSet packages = new HashSet(); Pattern startsWithNumber = Pattern.compile("\\.\\d"); @@ -198,10 +198,11 @@ public class GeneratePackageExports { } int lastSlash = entry.getName().lastIndexOf('/'); - String pkg = entry.getName().substring(0, lastSlash) - .replace('/', '.'); + String pkg = entry.getName().substring(0, lastSlash).replace('/', + '.'); - if (!includeNumberPackages && startsWithNumber.matcher(pkg).find()) { + if (!includeNumberPackages + && startsWithNumber.matcher(pkg).find()) { continue; } diff --git a/buildhelpers/src/main/java/com/vaadin/buildhelpers/ManifestWriter.java b/buildhelpers/src/main/java/com/vaadin/buildhelpers/ManifestWriter.java index 9e9b29c4a1..bb8cb27e38 100644 --- a/buildhelpers/src/main/java/com/vaadin/buildhelpers/ManifestWriter.java +++ b/buildhelpers/src/main/java/com/vaadin/buildhelpers/ManifestWriter.java @@ -1,12 +1,12 @@ /* * Copyright 2000-2014 Vaadin Ltd. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the @@ -33,7 +33,7 @@ public class ManifestWriter { /** * Writes a manifest attribute to a temporary buffer. - * + * * @param name * Attribute name * @param value @@ -56,10 +56,10 @@ public class ManifestWriter { /** * Writes the manifest to given JAR file. - * + * * The manifest must be created with {@code #writeAttribute(String, String)} * before calling this write. - * + * * @param jarFilename * File name of the JAR in which the manifest is written * @return 0 on success, nonzero value on error @@ -85,9 +85,9 @@ public class ManifestWriter { fos.write(getBytes()); fos.close(); } catch (IOException e) { - System.err.println("Writing to file '" - + newMfFile.getAbsolutePath() + "' failed because: " - + e.getMessage()); + System.err.println( + "Writing to file '" + newMfFile.getAbsolutePath() + + "' failed because: " + e.getMessage()); status = 1; } } @@ -100,9 +100,9 @@ public class ManifestWriter { is = new FileInputStream(newMfFile); checkMf.read(is); } catch (IOException e) { - System.err.println("Reading from file '" - + newMfFile.getAbsolutePath() + "' failed because: " - + e.getMessage()); + System.err.println( + "Reading from file '" + newMfFile.getAbsolutePath() + + "' failed because: " + e.getMessage()); status = 1; } } @@ -112,8 +112,8 @@ public class ManifestWriter { System.out.println("Updating manifest in JAR " + jarFilename); try { // The "mf" order must correspond with manifest-jarfile order - Process process = Runtime.getRuntime().exec( - new String[] { "jar", "umf", + Process process = Runtime.getRuntime() + .exec(new String[] { "jar", "umf", newMfFile.getAbsolutePath(), jarFilename }); int exitValue = process.waitFor(); if (exitValue != 0) { @@ -123,14 +123,14 @@ public class ManifestWriter { while (reader.ready()) { System.err.println("jar: " + reader.readLine()); } - System.err - .println("The 'jar' command returned with exit value " + System.err.println( + "The 'jar' command returned with exit value " + exitValue); status = 1; } } catch (IOException e) { - System.err.println("Failed to execute 'jar' command. " - + e.getMessage()); + System.err.println( + "Failed to execute 'jar' command. " + e.getMessage()); status = 1; } catch (InterruptedException e) { System.err -- cgit v1.2.3