diff --git a/api/src/main/java/org/itsallcode/whiterabbit/api/features/MonthDataStorage.java b/api/src/main/java/org/itsallcode/whiterabbit/api/features/MonthDataStorage.java index 27790282..ece037b7 100644 --- a/api/src/main/java/org/itsallcode/whiterabbit/api/features/MonthDataStorage.java +++ b/api/src/main/java/org/itsallcode/whiterabbit/api/features/MonthDataStorage.java @@ -59,7 +59,7 @@ public interface MonthDataStorage extends PluginFeature /** * A {@link ModelFactory} allows creating new instances of the data model. */ - public interface ModelFactory + interface ModelFactory { /** * Create a new {@link MonthData} instance. @@ -82,4 +82,4 @@ public interface ModelFactory */ ActivityData createActivityData(); } -} \ No newline at end of file +} diff --git a/api/src/main/java/org/itsallcode/whiterabbit/api/model/ActivityData.java b/api/src/main/java/org/itsallcode/whiterabbit/api/model/ActivityData.java index 120869c3..1d4abe08 100644 --- a/api/src/main/java/org/itsallcode/whiterabbit/api/model/ActivityData.java +++ b/api/src/main/java/org/itsallcode/whiterabbit/api/model/ActivityData.java @@ -61,4 +61,4 @@ public interface ActivityData * the new comment. */ void setComment(String comment); -} \ No newline at end of file +} diff --git a/api/src/main/java/org/itsallcode/whiterabbit/api/model/DayData.java b/api/src/main/java/org/itsallcode/whiterabbit/api/model/DayData.java index 87969568..bd544be8 100644 --- a/api/src/main/java/org/itsallcode/whiterabbit/api/model/DayData.java +++ b/api/src/main/java/org/itsallcode/whiterabbit/api/model/DayData.java @@ -130,4 +130,4 @@ public interface DayData * new new activities. */ void setActivities(List activities); -} \ No newline at end of file +} diff --git a/api/src/main/java/org/itsallcode/whiterabbit/api/model/DayType.java b/api/src/main/java/org/itsallcode/whiterabbit/api/model/DayType.java index b44af6d4..0880e5f8 100644 --- a/api/src/main/java/org/itsallcode/whiterabbit/api/model/DayType.java +++ b/api/src/main/java/org/itsallcode/whiterabbit/api/model/DayType.java @@ -20,7 +20,7 @@ public enum DayType private final boolean workDay; - private DayType(final boolean workDay) + DayType(final boolean workDay) { this.workDay = workDay; } diff --git a/api/src/main/java/org/itsallcode/whiterabbit/api/model/MonthData.java b/api/src/main/java/org/itsallcode/whiterabbit/api/model/MonthData.java index c75f083d..70b82980 100644 --- a/api/src/main/java/org/itsallcode/whiterabbit/api/model/MonthData.java +++ b/api/src/main/java/org/itsallcode/whiterabbit/api/model/MonthData.java @@ -68,4 +68,4 @@ public interface MonthData * the new {@link DayData}s. */ void setDays(List days); -} \ No newline at end of file +} diff --git a/api/src/main/java/org/itsallcode/whiterabbit/api/model/Project.java b/api/src/main/java/org/itsallcode/whiterabbit/api/model/Project.java index 555c8422..e4524097 100644 --- a/api/src/main/java/org/itsallcode/whiterabbit/api/model/Project.java +++ b/api/src/main/java/org/itsallcode/whiterabbit/api/model/Project.java @@ -26,4 +26,4 @@ public interface Project * @return the cost carrier of this project. */ String getCostCarrier(); -} \ No newline at end of file +} diff --git a/api/src/main/java/org/itsallcode/whiterabbit/api/model/ProjectReport.java b/api/src/main/java/org/itsallcode/whiterabbit/api/model/ProjectReport.java index d8a1a9d8..1b440e04 100644 --- a/api/src/main/java/org/itsallcode/whiterabbit/api/model/ProjectReport.java +++ b/api/src/main/java/org/itsallcode/whiterabbit/api/model/ProjectReport.java @@ -28,4 +28,4 @@ public interface ProjectReport * @return the activities in this project report. */ List getProjects(); -} \ No newline at end of file +} diff --git a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/JavaFxUtil.java b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/JavaFxUtil.java index 4fb5ed2d..26270749 100644 --- a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/JavaFxUtil.java +++ b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/JavaFxUtil.java @@ -7,7 +7,7 @@ import javafx.application.Platform; -public class JavaFxUtil +public final class JavaFxUtil { private JavaFxUtil() { diff --git a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/OsCheck.java b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/OsCheck.java index 4b8488f8..ac57229d 100644 --- a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/OsCheck.java +++ b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/OsCheck.java @@ -49,7 +49,10 @@ else if (os.indexOf("linux") >= 0) { return OSType.LINUX; } - return OSType.OTHER; + else + { + return OSType.OTHER; + } } public boolean isDesktopSupported() diff --git a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/UiActions.java b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/UiActions.java index 992b9a91..e623fa78 100644 --- a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/UiActions.java +++ b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/UiActions.java @@ -33,7 +33,7 @@ import javafx.stage.Modality; import javafx.stage.Stage; -public class UiActions +public final class UiActions { private static final Logger LOG = LogManager.getLogger(UiActions.class); @@ -95,7 +95,7 @@ private void createAndOpenDirectory(final Path directory) openFileWithDefaultProgram(directory); } - private void createDir(final Path directory) + private static void createDir(final Path directory) { try { @@ -195,14 +195,14 @@ private String formatAboutHeaderText() return "White Rabbit version " + properties.getVersion() + " (" + properties.getBuildDate() + ")"; } - private String formatSystemPropertyValues(final Map properties) + private static String formatSystemPropertyValues(final Map properties) { return properties.entrySet().stream() // .map(entry -> entry.getKey() + ": " + System.getProperty(entry.getValue())) // .collect(joining("\n")); } - private Map getProperties() + private static Map getProperties() { final Map properties = new LinkedHashMap<>(); properties.put("Java Vendor", "java.vendor"); diff --git a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/property/ClockPropertyFactory.java b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/property/ClockPropertyFactory.java index d3ba0d83..7990b476 100644 --- a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/property/ClockPropertyFactory.java +++ b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/property/ClockPropertyFactory.java @@ -14,7 +14,7 @@ import javafx.beans.property.SimpleObjectProperty; -public class ClockPropertyFactory +public final class ClockPropertyFactory { private static final Logger LOG = LogManager.getLogger(ClockPropertyFactory.class); diff --git a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/service/DesktopService.java b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/service/DesktopService.java index aa25d189..40903e5f 100644 --- a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/service/DesktopService.java +++ b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/service/DesktopService.java @@ -8,6 +8,7 @@ public interface DesktopService { + static DesktopService create() { final Logger log = LogManager.getLogger(DesktopService.class); diff --git a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/service/RealDesktopService.java b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/service/RealDesktopService.java index e1de1e13..57a39040 100644 --- a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/service/RealDesktopService.java +++ b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/service/RealDesktopService.java @@ -14,13 +14,13 @@ class RealDesktopService implements DesktopService private static final Logger LOG = LogManager.getLogger(RealDesktopService.class); private final Desktop desktop; - RealDesktopService(Desktop desktop) + RealDesktopService(final Desktop desktop) { this.desktop = desktop; } @Override - public void open(Path file) + public void open(final Path file) { SwingUtil.invokeInAwtEventQueue(() -> { LOG.info("Opening file {} with default application", file); @@ -34,4 +34,4 @@ public void open(Path file) } }); } -} \ No newline at end of file +} diff --git a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/splashscreen/SplashScreenLoader.java b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/splashscreen/SplashScreenLoader.java index 588a4605..58911691 100644 --- a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/splashscreen/SplashScreenLoader.java +++ b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/splashscreen/SplashScreenLoader.java @@ -24,10 +24,10 @@ public class SplashScreenLoader extends Preloader { private static final Logger LOG = LogManager.getLogger(SplashScreenLoader.class); - private Stage splashScreen; + private Stage splashScreen = null; @Override - public void start(Stage stage) + public void start(final Stage stage) { splashScreen = stage; splashScreen.initStyle(StageStyle.UNDECORATED); @@ -49,7 +49,7 @@ public Scene createScene() return new Scene(root, 300, 300); } - private Image loadImage(String resourceName) + private Image loadImage(final String resourceName) { try (InputStream iconStream = getClass().getResourceAsStream(resourceName)) { @@ -62,11 +62,10 @@ private Image loadImage(String resourceName) } @Override - public void handleApplicationNotification(PreloaderNotification notification) + public void handleApplicationNotification(final PreloaderNotification notification) { - if (notification instanceof ProgressPreloaderNotification) + if (notification instanceof final ProgressPreloaderNotification progressNotification) { - final ProgressPreloaderNotification progressNotification = (ProgressPreloaderNotification) notification; LOG.debug("Preloader application notification: {}", progressNotification.getNotificationType()); if (progressNotification.getNotificationType() == Type.STARTUP_FINISHED) { @@ -81,7 +80,7 @@ public void handleApplicationNotification(PreloaderNotification notification) } @Override - public boolean handleErrorNotification(ErrorNotification info) + public boolean handleErrorNotification(final ErrorNotification info) { splashScreen.hide(); final Alert alert = createAlert(info); @@ -89,7 +88,7 @@ public boolean handleErrorNotification(ErrorNotification info) return false; } - private Alert createAlert(ErrorNotification info) + private static Alert createAlert(final ErrorNotification info) { final Throwable exception = info.getCause(); if (exception instanceof OtherInstanceAlreadyRunningException) @@ -97,7 +96,7 @@ private Alert createAlert(ErrorNotification info) final String message = "Another instance of WhiteRabbit is already running.\n\n" + exception.getMessage(); return new Alert(AlertType.WARNING, message, ButtonType.OK); } - final String location = info.getLocation() != null ? info.getLocation() + "\n" : ""; + final String location = info.getLocation() != null ? (info.getLocation() + "\n") : ""; final String message = "Error during initialization: " + location + info.getDetails() + "\n" + exception; LOG.error(message, exception); return new Alert(AlertType.ERROR, message, ButtonType.OK); diff --git a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/systemmenu/DesktopIntegration.java b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/systemmenu/DesktopIntegration.java index 3b3d66d7..f288891e 100644 --- a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/systemmenu/DesktopIntegration.java +++ b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/systemmenu/DesktopIntegration.java @@ -4,7 +4,7 @@ public interface DesktopIntegration { - public static DesktopIntegration getInstance() + static DesktopIntegration getInstance() { return StaticInstanceHolder.getInstance(); } @@ -12,4 +12,4 @@ public static DesktopIntegration getInstance() void register(); void setUiActions(UiActions actions); -} \ No newline at end of file +} diff --git a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/systemmenu/StaticInstanceHolder.java b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/systemmenu/StaticInstanceHolder.java index b8f7d3de..10a07fa0 100644 --- a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/systemmenu/StaticInstanceHolder.java +++ b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/systemmenu/StaticInstanceHolder.java @@ -4,7 +4,7 @@ import org.itsallcode.whiterabbit.jfxui.OsCheck; -class StaticInstanceHolder +final class StaticInstanceHolder { private static DesktopIntegration instance; @@ -26,7 +26,7 @@ static class InstanceFactory { private final OsCheck osCheck; - InstanceFactory(OsCheck osCheck) + InstanceFactory(final OsCheck osCheck) { this.osCheck = osCheck; } diff --git a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/table/DelegatingChangeListener.java b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/table/DelegatingChangeListener.java index 0f087c2a..3538cdd1 100644 --- a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/table/DelegatingChangeListener.java +++ b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/table/DelegatingChangeListener.java @@ -9,18 +9,18 @@ public class DelegatingChangeListener implements ChangeListener private final ChangeListener delegate; private final BooleanProperty currentlyUpdating; - public DelegatingChangeListener(ChangeListener delegate, BooleanProperty currentlyUpdating) + public DelegatingChangeListener(final ChangeListener delegate, final BooleanProperty currentlyUpdating) { this.delegate = delegate; this.currentlyUpdating = currentlyUpdating; } @Override - public void changed(ObservableValue observable, T oldValue, T newValue) + public void changed(final ObservableValue observable, final T oldValue, final T newValue) { if (!currentlyUpdating.get()) { delegate.changed(observable, oldValue, newValue); } } -} \ No newline at end of file +} diff --git a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/table/converter/DayTypeStringConverter.java b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/table/converter/DayTypeStringConverter.java index 5fdcf72f..f860cb66 100644 --- a/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/table/converter/DayTypeStringConverter.java +++ b/jfxui/src/main/java/org/itsallcode/whiterabbit/jfxui/table/converter/DayTypeStringConverter.java @@ -7,14 +7,14 @@ public class DayTypeStringConverter extends StringConverter { @Override - public String toString(DayType object) + public String toString(final DayType object) { return object != null ? object.name() : null; } @Override - public DayType fromString(String string) + public DayType fromString(final String string) { return DayType.valueOf(string); } -} \ No newline at end of file +} diff --git a/jfxui/src/uiTest/java/org/itsallcode/whiterabbit/jfxui/DailyProjectReportTest.java b/jfxui/src/uiTest/java/org/itsallcode/whiterabbit/jfxui/DailyProjectReportTest.java index 16beb3ff..f5cdb58a 100644 --- a/jfxui/src/uiTest/java/org/itsallcode/whiterabbit/jfxui/DailyProjectReportTest.java +++ b/jfxui/src/uiTest/java/org/itsallcode/whiterabbit/jfxui/DailyProjectReportTest.java @@ -50,7 +50,7 @@ void exportButtonsFromPluginsAvailable() { time().tickSeparateMinutes(2); final DailyProjectReportWindow report = app().openDailyProjectReport(); - report.assertExportButtons("Export to demo", "Export to pmsmart"); + report.assertExportButtons("Export to demo", "Export to csv"); report.closeViaEscKey(); } @@ -72,7 +72,7 @@ void filledProjectReport() @Override @Start - void start(Stage stage) + void start(final Stage stage) { setLocale(Locale.GERMANY); setInitialTime(Instant.parse("2007-12-03T10:15:30.20Z")); diff --git a/logic/src/main/java/org/itsallcode/whiterabbit/logic/service/plugin/origin/PluginOrigin.java b/logic/src/main/java/org/itsallcode/whiterabbit/logic/service/plugin/origin/PluginOrigin.java index 65ddbdbc..dcce1524 100644 --- a/logic/src/main/java/org/itsallcode/whiterabbit/logic/service/plugin/origin/PluginOrigin.java +++ b/logic/src/main/java/org/itsallcode/whiterabbit/logic/service/plugin/origin/PluginOrigin.java @@ -28,7 +28,7 @@ public static PluginOrigin forJar(final Path jar) private static ClassLoader getBaseClassLoader() { - return PluginOrigin.class.getClassLoader(); + return Thread.currentThread().getContextClassLoader(); } private static ClassLoader createClassLoader(final Path jar)