#19259 closed defect (fixed)
NPE at org.openstreetmap.josm.tools.ReflectionUtils.findCaller()
Reported by: | Klumbumbus | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 20.05 |
Component: | Core | Version: | latest |
Keywords: | template_report regression findfirst | Cc: |
Description
What steps will reproduce the problem?
I can't reproduce. I was selecting 2 buildings with CTRL (or SHIFT?) before the NPE.
URL:https://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2020-05-17 23:26:27 +0200 (Sun, 17 May 2020) Build-Date:2020-05-18 01:30:48 Revision:16459 Relative:URL: ^/trunk Identification: JOSM/1.5 (16459 de) Windows 10 64-Bit OS Build number: Windows 10 Pro 1909 (18363) Memory Usage: 918 MB / 1820 MB (307 MB allocated, but free) Java version: 1.8.0_251-b08, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM Screen: \Display0 1680x1050 Maximum Screen Size: 1680x1050 VM arguments: [-Djava.security.manager, -Djava.security.policy=file:<java.home>\lib\security\javaws.policy, -DtrustProxy=true, -Djnlpx.home=<java.home>\bin, -Djnlpx.origFilenameArg=C:\Program Files (x86)\josm-latest.jnlp, -Djnlpx.remove=false, -Djava.util.Arrays.useLegacyMergeSort=true, -Djnlpx.heapsize=NULL,2048m, -Djnlpx.splashport=52637, -Djnlpx.jvm=<java.home>\bin\javaw.exe] Dataset consistency test: No problems found Plugins: + DirectUpload (35248) + HouseNumberTaggingTool (35248) + OpeningHoursEditor (35414) + PicLayer (35405) + RoadSigns (35424) + SimplifyArea (35405) + apache-commons (35362) + apache-http (35092) + austriaaddresshelper (57) + buildings_tools (35405) + editgpx (35248) + ejml (35313) + imagery-xml-bounds (35313) + imagery_offset_db (35405) + javafx-windows (35375) + jaxb (35092) + jna (35092) + jogl (1.2.3) + log4j (35092) + measurement (35405) + osm-obj-info (56) + photo_geotagging (35405) + photoadjust (35405) + reltoolbox (35405) + reverter (35409) + rex (53) + tageditor (35258) + tagging-preset-tester (35267) + terracer (35327) + turnlanes-tagging (283) + turnrestrictions (35405) + undelete (35405) + utilsplugin2 (35440) + wms-turbo-challenge2 (35248) Tagging presets: + https://josm.openstreetmap.de/josmfile?page=Presets/OneClick&zip=1 + https://josm.openstreetmap.de/josmfile?page=Presets/StolpersteineLight&zip=1 + %UserProfile%\Documents\OSM\TestNew\newpresets.xml + https://josm.openstreetmap.de/josmfile?page=Presets/NewTags&zip=1 + %UserProfile%\Documents\OSM\josm\core\resources\data\defaultpresets.xml + https://josm.openstreetmap.de/josmfile?page=Presets/MastAndTower&zip=1 + https://josm.openstreetmap.de/josmfile?page=Presets/COVID-19&zip=1 + https://raw.githubusercontent.com/Sowa1980/Start_Data_preset/master/Start_Data_preset.zip Map paint styles: + %UserProfile%\Documents\OSM\josm\core\resources\styles\standard\elemstyles.mapcss - https://josm.openstreetmap.de/josmfile?page=Styles/NewHighwayColors&zip=1 + https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_Streets&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/HiDPISupport&zip=1 - %UserProfile%\Documents\OSM\TestNew\newicons.mapcss - %UserProfile%\Downloads\Road_Extended_JOSM_style.zip - https://josm.openstreetmap.de/josmfile?page=Styles/Modified&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/sac_scale&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/ShowID&zip=1 - %UserProfile%\Documents\OSM\eigene styles\PriorityRoad\PriorityRoad_1.0.mapcss - https://josm.openstreetmap.de/josmfile?page=Styles/LayerChecker&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Surface&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/ParkingLanes&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Sidewalks&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Cycleways&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Osmc&style&zip=1 - https://raw.githubusercontent.com/species/josm-preset-wheelchair/master/sidewalks_kerbs.mapcss - https://josm.openstreetmap.de/josmfile?page=Styles/LitObjects&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Lit&style&zip=1 - %UserProfile%\Documents\OSM\eigene styles\Tourenplanung.mapcss - %UserProfile%\Documents\OSM\eigene styles\SpecificBuildingValues\SpecificBuildingValues.mapcss - https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_buildings&zip=1 - https://github.com/bastik/mapcss-tools/raw/osm/mapnik2mapcss/osm-results/mapnik.zip - https://josm.openstreetmap.de/josmfile?page=Styles/Incline&zip=1 - %UserProfile%\Documents\OSM\eigene styles\area-symbol.zip - http://www.freietonne.de/ft_icons/josm/FreieTonne_rules_presets_zip.php - http://www.openrailwaymap.org/styles/standard.zip - https://josm.openstreetmap.de/josmfile?page=Styles/MaxspeedIcons&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/DestinationSignRelation&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/ParkingLanes&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/PTStops&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/AdvertisingStyle&zip=1 - https://www.dropbox.com/s/qo3ai47fpv241jf/Styles_Fixme_and_Notes.zip?raw=1 - https://github.com/gmgeo/osmic-josm-style/archive/master.zip - https://josm.openstreetmap.de/josmfile?page=Styles/hazmat&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_Suburb&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_Postcode&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/RecyclingMaterials&zip=1 - %UserProfile%\Documents\OSM\eigene styles\maxspeed\maxspeed_2.9_01 basierend auf 2.7_02 Zahlen.mapcss - https://josm.openstreetmap.de/josmfile?page=Styles/Bench&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransportV2&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/ColourTag&zip=1 - %UserProfile%\Downloads\coloured_kerbs_style.zip - https://josm.openstreetmap.de/josmfile?page=Styles/Admin_Boundaries&zip=1 - https://raw.githubusercontent.com/species/josm-preset-traffic_sign_direction/master/direction.mapcss - https://josm.openstreetmap.de/josmfile?page=Styles/Cycleways&zip=1 - %UserProfile%\Documents\OSM\eigene styles\yes-no-unset\YesNoUnset_1.0.mapcss - <josm.pref>\styles\sit.mapcss - <josm.pref>\styles\sit.mapcss - https://josm.openstreetmap.de/josmfile?page=Styles/IconTester&zip=1 Validator rules: + https://raw.githubusercontent.com/<user.name>n-a-bauer/josm-validators/master/mtb.validator.mapcss + %UserProfile%\Documents\OSM\TestNew\new.validator.mapcss + https://josm.openstreetmap.de/josmfile?page=Rules/GermanySpecific&zip=1 Last errors/warnings: - W: java.net.SocketTimeoutException: Read timed out - W: java.net.SocketTimeoutException: Read timed out. Ursache: java.net.SocketTimeoutException: Read timed out - W: java.net.SocketTimeoutException: Read timed out. Ursache: java.net.SocketTimeoutException: Read timed out - W: java.net.SocketTimeoutException: Read timed out. Ursache: java.net.SocketTimeoutException: Read timed out - W: java.net.SocketTimeoutException: Read timed out. Ursache: java.net.SocketTimeoutException: Read timed out - W: Unable to use English input method - W: Unable to use English input method - W: Unable to use English input method - E: java.lang.ClassNotFoundException: org.openstreetmap.josm.plugins.utilsplugin2.actions.TagSourceAction - E: Handled by bug report queue: java.lang.NullPointerException === REPORTED CRASH DATA === BugReportExceptionHandler#handleException: No data collected. Warning issued by: BugReportExceptionHandler#handleException === STACK TRACE === Thread: AWT-EventQueue-2 (51) of javawsApplicationThreadGroup java.lang.NullPointerException at java.util.Objects.requireNonNull(Unknown Source) at java.util.Optional.<init>(Unknown Source) at java.util.Optional.of(Unknown Source) at java.util.stream.FindOps$FindSink$OfRef.get(Unknown Source) at java.util.stream.FindOps$FindSink$OfRef.get(Unknown Source) at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source) at java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.util.stream.ReferencePipeline.findFirst(Unknown Source) at org.openstreetmap.josm.tools.ReflectionUtils.findCaller(ReflectionUtils.java:69) at org.openstreetmap.josm.tools.ReflectionUtils.findCallerClass(ReflectionUtils.java:47) at org.openstreetmap.josm.data.Preferences.firePreferenceChanged(Preferences.java:306) at org.openstreetmap.josm.data.Preferences.putSetting(Preferences.java:724) at org.openstreetmap.josm.spi.preferences.AbstractPreferences.put(AbstractPreferences.java:26) at org.openstreetmap.josm.plugins.utilsplugin2.actions.TagSourceAction.updateEnabledState(TagSourceAction.java:75) at org.openstreetmap.josm.actions.JosmAction$SelectionChangeAdapter.selectionChanged(JosmAction.java:486) at org.openstreetmap.josm.data.osm.event.SelectionEventManager$DataListenerInfo.fire(SelectionEventManager.java:57) at org.openstreetmap.josm.data.osm.event.SelectionEventManager.fireEvent(SelectionEventManager.java:159) at org.openstreetmap.josm.data.osm.event.SelectionEventManager.lambda$selectionChanged$0(SelectionEventManager.java:150) at org.openstreetmap.josm.gui.util.GuiHelper.runInEDTAndWaitWithException(GuiHelper.java:240) at org.openstreetmap.josm.data.osm.event.SelectionEventManager.selectionChanged(SelectionEventManager.java:150) at org.openstreetmap.josm.data.osm.DataSet.lambda$doSelectionChange$13(DataSet.java:729) at org.openstreetmap.josm.tools.ListenerList.fireEvent(ListenerList.java:156) at org.openstreetmap.josm.data.osm.DataSet.doSelectionChange(DataSet.java:729) at org.openstreetmap.josm.data.osm.DataSet.toggleSelected(DataSet.java:710) at org.openstreetmap.josm.data.osm.DataSet.toggleSelected(DataSet.java:701) at org.openstreetmap.josm.actions.mapmode.SelectAction.selectPrims(SelectAction.java:969) at org.openstreetmap.josm.actions.mapmode.SelectAction.mouseReleased(SelectAction.java:603) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
Attachments (0)
Change History (14)
comment:1 by , 5 years ago
Version: | → latest |
---|
comment:2 by , 5 years ago
comment:4 by , 5 years ago
Milestone: | → 20.05 |
---|
Yes,very likely!
From the Javadoc of java.util.stream.Stream#findFirst:
@throws NullPointerException if the element selected is null
Various other locations could also be affected. So either add filter(Objects::nonNull)
before findFirst()
or revert the changes.
comment:5 by , 5 years ago
I still try to understand why it cannot handle a stream containing a null value. Makes it rather unusable.
comment:6 by , 5 years ago
Found this on stacktrace:
"The null-safe way is to use something like: set.stream().map(Optional::ofNullable).findFirst().orElseGet(Optional::empty).orElse(null)"
comment:7 by , 5 years ago
comment:9 by , 5 years ago
Summary: | NPE at org.openstreetmap.josm.plugins.utilsplugin2.actions.TagSourceAction → NPE at org.openstreetmap.josm.tools.ReflectionUtils.findCaller() |
---|
comment:11 by , 5 years ago
Keywords: | regression findfirst added |
---|
comment:12 by , 5 years ago
@simon04: I could not find a nice solution. Do you think about reverting all changes in #19251 which introduced .findFirst() or .findAny()?
comment:14 by , 5 years ago
I inspected every .findFirst().orElse(null)
occurrence in the code and found one potential problem which I fixed in r16466.
Similar one while trying to upload gpx data:
(That was still the same josm session.)