Commit 40254632 authored by Hallvard Trætteberg's avatar Hallvard Trætteberg

Added checkstyle and fixed issues

parent 899ead05
......@@ -46,10 +46,12 @@
<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<!--
<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
-->
<module name="AvoidStarImport"/>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
......@@ -242,10 +244,12 @@
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingThrowsTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="allowedAnnotations" value="Override, Test"/>
<!-- Not supported anymore
<property name="allowMissingThrowsTags" value="true"/>
<property name="allowThrowsTagsForSubclasses" value="true"/>
-->
</module>
<!-- Removed due to instantiation exception
<module name="MissingJavadocMethod">
......
......@@ -103,7 +103,29 @@
<configuration>
<mainClass>simpleex.ui.FxApp</mainClass>
</configuration>
</plugin>
</plugin>
<!-- Run the checkstyle code quality tool -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<configLocation>config/checkstyle/google_checks.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
......@@ -80,8 +80,8 @@ public class LatLong {
/**
* Creates a LatLong object from a String, using a specific separator.
* The format is &lt;latitude&gt;&lt;separator&gt;&lt;longitude&gt;.
* @param s
* @param sep
* @param s the string to parse
* @param sep the separator to use between latitude, longitude elements
* @return
*/
public static LatLong valueOf(final String s, final String sep) {
......
......@@ -9,7 +9,8 @@ public class LatLongs implements Iterable<LatLong> {
final List<LatLong> latLongs = new ArrayList<>();
public LatLongs() {}
public LatLongs() {
}
public LatLongs(final double... latLongsArray) {
addLatLongs(latLongsArray);
......
......@@ -84,7 +84,7 @@ public class FxAppController {
// map stuff
// mapView.getChildren().add(MapTileLayer.getOpenStreetMapLayer());
zoomSlider.valueProperty()
.addListener((prop, oldValue, newValue) -> mapView.setZoomLevel(zoomSlider.getValue()));
.addListener((prop, oldValue, newValue) -> mapView.setZoomLevel(zoomSlider.getValue()));
zoomSlider.setValue(8);
markersParent = new MapItemsControl<MapNode>();
mapView.getChildren().add(markersParent);
......@@ -192,7 +192,7 @@ public class FxAppController {
final FileChooser fileChooser = getFileChooser();
final File selection = fileChooser.showOpenDialog(null);
if (selection != null) {
try (InputStream input = new FileInputStream(selection) ){
try (InputStream input = new FileInputStream(selection)) {
setLatLongs(getObjectMapper().readValue(input, LatLongs.class));
} catch (final IOException e) {
showExceptionDialog("Oops, problem when opening " + selection, e);
......@@ -227,7 +227,7 @@ public class FxAppController {
void handleSaveAction() {
final FileChooser fileChooser = getFileChooser();
final File selection = fileChooser.showSaveDialog(null);
if (selection != null ) {
if (selection != null) {
try (OutputStream outputStream = new FileOutputStream(selection, false)) {
getObjectMapper().writeValue(outputStream, getLatLongs());
} catch (final IOException e) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment