sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1650312 - in /sis/branches/JDK8: ./ application/sis-webapp/src/main/java/org/apache/sis/index/tree/ core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/
Date Thu, 08 Jan 2015 15:38:48 GMT
Author: desruisseaux
Date: Thu Jan  8 15:38:48 2015
New Revision: 1650312

URL: http://svn.apache.org/r1650312
Log:
Initial draft of a Checkstyle verification as part of the build.
For now, only enforce the replacement of tabulations by spaces.

Modified:
    sis/branches/JDK8/application/sis-webapp/src/main/java/org/apache/sis/index/tree/GeoRSSData.java
    sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
    sis/branches/JDK8/pom.xml

Modified: sis/branches/JDK8/application/sis-webapp/src/main/java/org/apache/sis/index/tree/GeoRSSData.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/application/sis-webapp/src/main/java/org/apache/sis/index/tree/GeoRSSData.java?rev=1650312&r1=1650311&r2=1650312&view=diff
==============================================================================
--- sis/branches/JDK8/application/sis-webapp/src/main/java/org/apache/sis/index/tree/GeoRSSData.java
[UTF-8] (original)
+++ sis/branches/JDK8/application/sis-webapp/src/main/java/org/apache/sis/index/tree/GeoRSSData.java
[UTF-8] Thu Jan  8 15:38:48 2015
@@ -41,138 +41,138 @@ import com.sun.syndication.feed.rss.Item
  */
 public class GeoRSSData implements QuadTreeData {
 
-	private String filename;
-	private DirectPosition2D latLon;
+    private String filename;
+    private DirectPosition2D latLon;
 
-	/**
-	 * Creates a GeoRSSData object that stores the name of the file that the
-	 * entry's information is written to and the geo location of the entry.
-	 *
-	 * @param filename
-	 *            filename where rss entry's info is stored
-	 * @param latLon
-	 *            geo location of the entry
-	 */
-	public GeoRSSData(String filename, DirectPosition2D latLon) {
-		this.filename = filename;
-		this.latLon = latLon;
-	}
-
-	/**
-	 * Returns the Java 2D x-coordinate for the longitude.
-	 *
-	 * @return the Java 2D x-coordinate
-	 */
-	public double getX() {
-		return latLon.x + 180.0;
-	}
-
-	/**
-	 * Returns the Java 2D y-coordinate for the latitude.
-	 *
-	 * @return the Java 2D y-coordinate
-	 */
-	public double getY() {
-		return latLon.y + 90.0;
-	}
-
-
-  /* (non-Javadoc)
-   * @see org.apache.sis.storage.QuadTreeData#getLatLon()
-   */
-  @Override
-  public DirectPosition2D getLatLon() {
+    /**
+     * Creates a GeoRSSData object that stores the name of the file that the
+     * entry's information is written to and the geo location of the entry.
+     *
+     * @param filename
+     *            filename where rss entry's info is stored
+     * @param latLon
+     *            geo location of the entry
+     */
+    public GeoRSSData(String filename, DirectPosition2D latLon) {
+        this.filename = filename;
+        this.latLon = latLon;
+    }
+
+    /**
+     * Returns the Java 2D x-coordinate for the longitude.
+     *
+     * @return the Java 2D x-coordinate
+     */
+    public double getX() {
+        return latLon.x + 180.0;
+    }
+
+    /**
+     * Returns the Java 2D y-coordinate for the latitude.
+     *
+     * @return the Java 2D y-coordinate
+     */
+    public double getY() {
+        return latLon.y + 90.0;
+    }
+
+
+    /* (non-Javadoc)
+    * @see org.apache.sis.storage.QuadTreeData#getLatLon()
+    */
+    @Override
+    public DirectPosition2D getLatLon() {
     return this.latLon;
-  }
+    }
 
-	/**
-	 * Returns the name of the file where the entry's info is saved.
-	 *
-	 * @return the name of the file where the entry's info is saved
-	 */
-	public String getFileName() {
-		return this.filename;
-	}
-
-	/**
-	 * Saves the GeoRSS entry to file.
-	 *
-	 * @param item
-	 *            the Item object from Java ROME API containing the GeoRSS entry
-	 * @param geoRSSModule
-	 *            the Java ROME API GeoRSSModule to parse geo location
-	 * @param directory
-	 *            the path of the directory in which to save the file
-	 */
-	public void saveToFile(Item item, GeoRSSModule geoRSSModule,
-			String directory) {
-	  if(!new File(directory).exists()) new File(directory).mkdirs();
-		try {
-			BufferedWriter writer = new BufferedWriter(new FileWriter(directory
-					+ filename));
-			if (item.getTitle() != null) {
-				writer.write("title;" + item.getTitle().replace('\n', ' '));
-				writer.newLine();
-			}
-			if (item.getLink() != null) {
-				writer.write("link;" + item.getLink().replace('\n', ' '));
-				writer.newLine();
-			}
-			if (item.getSource() != null) {
-				writer.write("source;"
-						+ item.getSource().getValue().replace('\n', ' '));
-				writer.newLine();
-			}
-			if (item.getAuthor() != null) {
-				writer.write("author;" + item.getAuthor().replace('\n', ' '));
-				writer.newLine();
-			}
-			if (item.getDescription() != null) {
-				writer.write("description;"
-						+ item.getDescription().getValue().replace('\n', ' '));
-				writer.newLine();
-			}
-			writer.write("pubDate;" + item.getPubDate().toString());
-			writer.newLine();
-			writer.write("lat;" + geoRSSModule.getPosition().getLatitude());
-			writer.newLine();
-			writer.write("lon;" + geoRSSModule.getPosition().getLongitude());
-			writer.close();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-	}
-
-	/**
-	 * Reads the file that contains the GeoRSS entry's information and returns a
-	 * HashMap of key, value pairs where the key is the name of the element e.g.
-	 * title, author.
-	 *
-	 * @param fullFileName
-	 *            the full path to the file
-	 * @return HashMap where the key is the name of the element and the value is
-	 *         the data inside the element's tag
-	 */
-	public static HashMap<String, String> loadFromFile(String fullFileName) {
-		HashMap<String, String> map = new HashMap<String, String>();
-		try {
-			BufferedReader reader = new BufferedReader(new FileReader(
-					fullFileName));
-			String line = "";
-			while ((line = reader.readLine()) != null) {
-				int delimIndex = line.indexOf(';');
-				if (delimIndex != -1)
-					map.put(line.substring(0, delimIndex), line.substring(
-							delimIndex + 1, line.length()));
-			}
-			reader.close();
-		} catch (FileNotFoundException e) {
-			e.printStackTrace();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-		return map;
+    /**
+     * Returns the name of the file where the entry's info is saved.
+     *
+     * @return the name of the file where the entry's info is saved
+     */
+    public String getFileName() {
+        return this.filename;
+    }
+
+    /**
+     * Saves the GeoRSS entry to file.
+     *
+     * @param item
+     *            the Item object from Java ROME API containing the GeoRSS entry
+     * @param geoRSSModule
+     *            the Java ROME API GeoRSSModule to parse geo location
+     * @param directory
+     *            the path of the directory in which to save the file
+     */
+    public void saveToFile(Item item, GeoRSSModule geoRSSModule,
+            String directory) {
+      if(!new File(directory).exists()) new File(directory).mkdirs();
+        try {
+            BufferedWriter writer = new BufferedWriter(new FileWriter(directory
+                    + filename));
+            if (item.getTitle() != null) {
+                writer.write("title;" + item.getTitle().replace('\n', ' '));
+                writer.newLine();
+            }
+            if (item.getLink() != null) {
+                writer.write("link;" + item.getLink().replace('\n', ' '));
+                writer.newLine();
+            }
+            if (item.getSource() != null) {
+                writer.write("source;"
+                        + item.getSource().getValue().replace('\n', ' '));
+                writer.newLine();
+            }
+            if (item.getAuthor() != null) {
+                writer.write("author;" + item.getAuthor().replace('\n', ' '));
+                writer.newLine();
+            }
+            if (item.getDescription() != null) {
+                writer.write("description;"
+                        + item.getDescription().getValue().replace('\n', ' '));
+                writer.newLine();
+            }
+            writer.write("pubDate;" + item.getPubDate().toString());
+            writer.newLine();
+            writer.write("lat;" + geoRSSModule.getPosition().getLatitude());
+            writer.newLine();
+            writer.write("lon;" + geoRSSModule.getPosition().getLongitude());
+            writer.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Reads the file that contains the GeoRSS entry's information and returns a
+     * HashMap of key, value pairs where the key is the name of the element e.g.
+     * title, author.
+     *
+     * @param fullFileName
+     *            the full path to the file
+     * @return HashMap where the key is the name of the element and the value is
+     *         the data inside the element's tag
+     */
+    public static HashMap<String, String> loadFromFile(String fullFileName) {
+        HashMap<String, String> map = new HashMap<String, String>();
+        try {
+            BufferedReader reader = new BufferedReader(new FileReader(
+                    fullFileName));
+            String line = "";
+            while ((line = reader.readLine()) != null) {
+                int delimIndex = line.indexOf(';');
+                if (delimIndex != -1)
+                    map.put(line.substring(0, delimIndex), line.substring(
+                            delimIndex + 1, line.length()));
+            }
+            reader.close();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return map;
 
-	}
+    }
 
 }

Modified: sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java?rev=1650312&r1=1650311&r2=1650312&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java
[UTF-8] Thu Jan  8 15:38:48 2015
@@ -113,7 +113,7 @@ public class ResourceCompilerMojo extend
     @Override
     public void execute() throws MojoExecutionException {
         final boolean isIncremental = buildContext.isIncremental();
-    	declareOutputDirectory();
+        declareOutputDirectory();
 
         int errors = 0;
         for (final String sourceDirectory : compileSourceRoots) {

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java?rev=1650312&r1=1650311&r2=1650312&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
[UTF-8] Thu Jan  8 15:38:48 2015
@@ -544,9 +544,9 @@ public class IdentifierMapAdapter extend
     @Debug
     @Override
     public String toString() {
-	final StringBuilder buffer = new StringBuilder(50).append('{');
-	for (final Entry<Citation,String> entry : entrySet()) {
-	    if (buffer.length() != 1) {
+    final StringBuilder buffer = new StringBuilder(50).append('{');
+    for (final Entry<Citation,String> entry : entrySet()) {
+        if (buffer.length() != 1) {
                 buffer.append(", ");
             }
             SpecializedIdentifier.format(buffer, entry.getKey(), entry.getValue());

Modified: sis/branches/JDK8/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/pom.xml?rev=1650312&r1=1650311&r2=1650312&view=diff
==============================================================================
--- sis/branches/JDK8/pom.xml (original)
+++ sis/branches/JDK8/pom.xml Thu Jan  8 15:38:48 2015
@@ -520,6 +520,39 @@ Apache SIS is a free software, Java lang
         </configuration>
       </plugin>
 
+      <!-- Checkstype configuration
+           Legal note: Checkstyle is under LGPL license, but it is okay to use it only for
+           the build if it is downloaded by Maven (not included in Apache SIS distribution).
+           See http://www.apache.org/legal/resolved.html#prohibited
+      -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>2.13</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>check</goal>
+            </goals>
+            <configuration>
+              <skip>${skipTests}</skip> <!-- When skipping tests, skip also
checkstyle verification. -->
+              <encoding>${project.build.sourceEncoding}</encoding>
+              <consoleOutput>true</consoleOutput>
+              <checkstyleRules>
+                <module name="Checker">
+                  <module name="FileTabCharacter"/>     <!-- Checks that there are
no tab characters in the file. -->
+<!--              <module name="NewlineAtEndOfFile"/>   <!-  Checks that there
is a newline at the end of each file. ->
+                  <module name="TreeWalker">
+                    <module name="RedundantImport"/>    <!- Checks for redundant
import statements. ->
+                    <module name="GenericWhitespace"/>  <!- Checks that the whitespace
around the Generic tokens follow the typical convention. ->
+                  </module> -->
+                </module>
+              </checkstyleRules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
       <!-- JavaDoc configuration. -->
       <plugin>
         <artifactId>maven-javadoc-plugin</artifactId>



Mime
View raw message