FHNW-OOP2 / countryfx-AceVanCleef

countryfx-AceVanCleef created by GitHub Classroom
1 stars 0 forks source link

Seltsamer Bug bei Wertänderung eines Landes mit anschließendem speichern. #1

Open AceVanCleef opened 7 years ago

AceVanCleef commented 7 years ago

Guten Abend Herr @DieterHolz

Die Integration unseres cuie custom controls funktioniert soweit gut. Ebenfalls konnte ich gemäss Ihrem Vorschlag das äussere /libs entfernen.

Doch wenn man die Applikation nun startet und dann z.B. den Namen eines Landes verändert und dann gespeichert wird, lässt sich die Applikation nicht mehr neu starten. Wie im nachfolgenden Video gezeigt lässt sich dieser Fehler wunderbar reproduzieren.

Hinweis: In der Beschreibung finden Sie die Erläuterungen zu den von mir gezeigten Schritten im Video, inkl. Zeitsprungmarken. https://www.youtube.com/watch?v=asnRWy_j1y8&feature=youtu.be

Zur Einfachheit hier der Stacktrace und die Rebuildwarnungen zum nachlesen:

Rebuildwarnungen

Information:javac 1.8.0_45 was used to compile java sources
Information:08.06.2017 22:16 - Compilation completed successfully with 1 warning in 12s 345ms

C:\Files\Programming_Workspace\oop2_FS17-workspace\countryfx-AceVanCleef\src\main\java\ch\fhnw\cuie\cloud_save_control\libs\svgloader\Examples\src\main\java\afester\javafx\examples\colorchannels\ColorChannelsExample.java
Warning:(65, 25) java: getBlueChannel1() in ch.fhnw.cuie.cloud_save_control.libs.svgloader.FranzXaver.src.main.java.afester.javafx.tools.ColorSeparator has been deprecated

C:\Files\Programming_Workspace\oop2_FS17-workspace\countryfx-AceVanCleef\src\main\java\ch\fhnw\oop2\countryfx\presentationmodel\RootPM.java
Information:java: Some input files use unchecked or unsafe operations.
Information:java: Recompile with -Xlint:unchecked for details.

Stacktrace

"C:\Program Files\Java\jdk1.8.0_45\bin\java" -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_45\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\rt.jar;C:\Files\Programming_Workspace\oop2_FS17-workspace\countryfx-AceVanCleef\build\classes\main;C:\Files\Programming_Workspace\oop2_FS17-workspace\countryfx-AceVanCleef\build\resources\main;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-dom\1.8\4e696cf01cee52e8c4f86c842b5d8314e689209c\batik-dom-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-anim\1.8\68197dfa3643a906ba250025a03dc42e6efe2dec\batik-anim-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-bridge\1.8\4ab4110b0ed4650ef50d4a344f0ca5c027f3283a\batik-bridge-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\xalan\xalan\2.7.2\d55d3f02a56ec4c25695fe67e1334ff8c2ecea23\xalan-2.7.2.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.5\e7fd981408caba8a0c0fb276413562468d260160\log4j-api-2.5.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\xmlgraphics-commons\2.1\b61132defe1df4e91c1eb0ddf544958c50d358b5\xmlgraphics-commons-2.1.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-core\2.5\7ed845de1dfe070d43511fab321784e6c4118398\log4j-core-2.5.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-css\1.8\2b3f22cc65702a0821b7f0178d055282a1cdde59\batik-css-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-ext\1.8\8713f3238cfac337624a90c3ad7d45d7bc6fb1b5\batik-ext-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-util\1.8\35dcd204f397d6976290ca48ffa0011ba9b7ef43\batik-util-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-xml\1.8\9bf0ee759fed1e3a2e4ad41819eac69ff4873732\batik-xml-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\xml-apis\xml-apis\1.3.04\90b215f48fe42776c8c7f6e3509ec54e84fd65ef\xml-apis-1.3.04.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\xml-apis\xml-apis-ext\1.3.04\41a8b86b358e87f3f13cf46069721719105aff66\xml-apis-ext-1.3.04.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-awt-util\1.8\5cd7f97060cdfab0139e70504962d48ceee71ef2\batik-awt-util-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-parser\1.8\7e4e69a4aa5317861864db93da5f246214750484\batik-parser-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-svg-dom\1.8\97c9d00d08c849066d2359b0f1124f0e82b952c2\batik-svg-dom-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-gvt\1.8\fbde4cd3c43001c162446cf43093d09fda346e11\batik-gvt-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\org.apache.xmlgraphics\batik-script\1.8\5bda6a9d45065b184c83c46b64d8002b4e0ab7c7\batik-script-1.8.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\commons-io\commons-io\1.3.1\b90b6ac57cf27a2858eaa490d02ba7945d18ca7b\commons-io-1.3.1.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\commons-logging\commons-logging\1.0.4\f029a2aefe2b3e1517573c580f948caac31b1056\commons-logging-1.0.4.jar;C:\Users\degonas\.gradle\caches\modules-2\files-2.1\xalan\serializer\2.7.2\24247f3bb052ee068971393bdb83e04512bb1c3c\serializer-2.7.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain ch.fhnw.oop2.countryfx.AppStarter
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$152(LauncherImpl.java:182)
    at com.sun.javafx.application.LauncherImpl$$Lambda$2/769287236.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:592)
    at java.lang.Integer.parseInt(Integer.java:615)
    at ch.fhnw.oop2.countryfx.service.CountryDTO.<init>(CountryDTO.java:30)
    at ch.fhnw.oop2.countryfx.service.serviceimpl.CountryServiceFileBased.lambda$findAll$36(CountryServiceFileBased.java:35)
    at ch.fhnw.oop2.countryfx.service.serviceimpl.CountryServiceFileBased$$Lambda$55/1497115867.apply(Unknown Source)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.stream.SliceOps$1$1.accept(SliceOps.java:204)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at ch.fhnw.oop2.countryfx.service.serviceimpl.CountryServiceFileBased.findAll(CountryServiceFileBased.java:36)
    at ch.fhnw.oop2.countryfx.presentationmodel.RootPM.<init>(RootPM.java:48)
    at ch.fhnw.oop2.countryfx.AppStarter.start(AppStarter.java:19)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
    at com.sun.javafx.application.LauncherImpl$$Lambda$52/280631478.run(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl$$Lambda$48/43542222.run(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
    at com.sun.javafx.application.PlatformImpl$$Lambda$50/2002636616.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
    at com.sun.javafx.application.PlatformImpl$$Lambda$49/149783560.run(Unknown Source)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101)
    at com.sun.glass.ui.win.WinApplication$$Lambda$38/1818869418.run(Unknown Source)
    ... 1 more

Process finished with exit code 1

Mein Gesamteindruck ist wie folgt:

allCountries.addAll(service.findAll().stream()
                .map(dto -> new CountryPM(dto))         //Mapping von DTOs zu PMs
                .collect(Collectors.toList()));         //Alle PMs zur ObservableList

Was ist Ihr Eindruck, wodurch das Problem ausgelöst werden könnte?

Freundliche Grüsse, Stefan W.

cc an: @lensbreak

DieterHolz commented 7 years ago

Das Problem sieht man am Ende des gespeicherten Files. Da stehen noch Zeichen drin, die dort nix zu suchen haben.

Mit Files.write(getPath(FILE_NAME), dtosAsString, StandardCharsets.UTF_8, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);

sollte es besser gehen.