#23485 closed defect (fixed)
JOSM crashes when opening Imagery Prefrences
Reported by: | Owned by: | team | |
---|---|---|---|
Priority: | normal | Milestone: | 24.02 |
Component: | Core imagery | Version: | |
Keywords: | template_report | Cc: | stoecker, taylor.smock |
Description
What steps will reproduce the problem?
- Imagery > Imagery Preferences
What is the expected result?
Display imagery preferences window
What happens instead?
JOSM crashes and must be force quit
Please provide any additional information below. Attach a screenshot if possible.
Revision:18969 Build-Date:2024-02-06 12:15:17 Identification: JOSM/1.5 (18969 en) Mac OS X 13.4.1 OS Build number: macOS 13.4.1 (22F770820d) Memory Usage: 417 MB / 2048 MB (141 MB allocated, but free) Java version: 17.0.10+7-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM Look and Feel: com.apple.laf.AquaLookAndFeel Screen: Display 1 1440×900 (scaling 2.00×2.00) Display 2 2560×1440 (scaling 2.00×2.00) Maximum Screen Size: 2560×1440 Best cursor sizes: 16×16→16×16, 32×32→32×32 System property file.encoding: UTF-8 System property sun.jnu.encoding: UTF-8 Locale info: en_US Numbers with default locale: 1234567890 -> 1234567890 VM arguments: [-Djpackage.app-version=18969, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.base/sun.security.action=ALL-UNNAMED, --add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED, --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED, --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED, -Djpackage.app-path=/Applications/JOSM.app/Contents/MacOS/JOSM] Plugins: + PicLayer (1.0.3) + apache-commons (36176) + ejml (36176) + geotools (36176) + jackson (36176) + jaxb (36118) + jts (36004) + measurement (36200) + opendata (36200) + utilsplugin2 (36200) Map paint styles: - https://josm.openstreetmap.de/josmfile?page=Styles/ColourTag&zip=1 + ${HOME}/Documents/piste.mapcss Last errors/warnings: - 00043.704 E: Handled by bug report queue: java.lang.NullPointerException: Cannot invoke "org.openstreetmap.josm.data.imagery.ImageryInfo$ImageryType.getTypeString()" because "this.sourceType" is null === REPORTED CRASH DATA === BugReportExceptionHandler#handleException: No data collected. Warning issued by: BugReportExceptionHandler#handleException === STACK TRACE === Thread: AWT-EventQueue-0 (23) of main java.lang.NullPointerException: Cannot invoke "org.openstreetmap.josm.data.imagery.ImageryInfo$ImageryType.getTypeString()" because "this.sourceType" is null at org.openstreetmap.josm.data.imagery.ImageryInfo.getExtendedUrl(ImageryInfo.java:776) at org.openstreetmap.josm.gui.preferences.imagery.ImageryProvidersPanel$ImageryURLTableCellRenderer.lambda$getTableCellRendererComponent$0(ImageryProvidersPanel.java:133) at java.base/java.util.stream.MatchOps$1MatchSink.accept(Unknown Source) at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(Unknown Source) at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source) at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source) at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(Unknown Source) at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(Unknown Source) at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.base/java.util.stream.ReferencePipeline.anyMatch(Unknown Source) at org.openstreetmap.josm.gui.preferences.imagery.ImageryProvidersPanel$ImageryURLTableCellRenderer.getTableCellRendererComponent(ImageryProvidersPanel.java:133) at java.desktop/javax.swing.JTable.prepareRenderer(Unknown Source) at java.desktop/javax.swing.plaf.basic.BasicTableUI.paintCell(Unknown Source) at java.desktop/javax.swing.plaf.basic.BasicTableUI.paintCells(Unknown Source) at java.desktop/javax.swing.plaf.basic.BasicTableUI.paint(Unknown Source) at java.desktop/javax.swing.plaf.ComponentUI.update(Unknown Source) at java.desktop/javax.swing.JComponent.paintComponent(Unknown Source) at java.desktop/javax.swing.JComponent.paint(Unknown Source) at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source) at java.desktop/javax.swing.JComponent.paint(Unknown Source) at java.desktop/javax.swing.JViewport.paint(Unknown Source) at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source) at java.desktop/javax.swing.JComponent.paint(Unknown Source) at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source) at java.desktop/javax.swing.JComponent.paint(Unknown Source) at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source) at java.desktop/javax.swing.JComponent.paint(Unknown Source) at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source) at java.desktop/javax.swing.JComponent.paint(Unknown Source) at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source) at java.desktop/javax.swing.JComponent.paint(Unknown Source) at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source) at java.desktop/javax.swing.JComponent.paint(Unknown Source) at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source) at java.desktop/javax.swing.JComponent.paint(Unknown Source) at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source) at java.desktop/javax.swing.JComponent.paint(Unknown Source) at java.desktop/javax.swing.JLayeredPane.paint(Unknown Source) at java.desktop/javax.swing.JComponent.paintChildren(Unknown Source) at java.desktop/javax.swing.JComponent.paintToOffscreen(Unknown Source) at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(Unknown Source) at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) at java.desktop/javax.swing.RepaintManager$PaintManager.paint(Unknown Source) at java.desktop/javax.swing.RepaintManager.paint(Unknown Source) at java.desktop/javax.swing.JComponent.paint(Unknown Source) at java.desktop/java.awt.GraphicsCallback$PaintCallback.run(Unknown Source) at java.desktop/sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source) at java.desktop/sun.awt.SunGraphicsCallback.runComponents(Unknown Source) at java.desktop/java.awt.Container.paint(Unknown Source) at java.desktop/java.awt.Window.paint(Unknown Source) at java.desktop/javax.swing.RepaintManager$4.run(Unknown Source) at java.desktop/javax.swing.RepaintManager$4.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source) at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue$4.run(Unknown Source) at java.desktop/java.awt.EventQueue$4.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$2.run(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$4.run(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$4.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport.enter(Unknown Source) at java.desktop/java.awt.Dialog.show(Unknown Source) at java.desktop/java.awt.Component.show(Unknown Source) at java.desktop/java.awt.Component.setVisible(Unknown Source) at java.desktop/java.awt.Window.setVisible(Unknown Source) at java.desktop/java.awt.Dialog.setVisible(Unknown Source) at org.openstreetmap.josm.gui.preferences.PreferenceDialog.setVisible(PreferenceDialog.java:145) at org.openstreetmap.josm.actions.PreferencesAction.run(PreferencesAction.java:119) at org.openstreetmap.josm.actions.PreferencesAction.actionPerformed(PreferencesAction.java:104) at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source) at java.desktop/javax.swing.AbstractButton.doClick(Unknown Source) at java.desktop/com.apple.laf.ScreenMenuItem.actionPerformed(Unknown Source) at java.desktop/java.awt.MenuItem.processActionEvent(Unknown Source) at java.desktop/java.awt.MenuItem.processEvent(Unknown Source) at java.desktop/java.awt.MenuComponent.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.MenuComponent.dispatchEvent(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue$4.run(Unknown Source) at java.desktop/java.awt.EventQueue$4.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue$5.run(Unknown Source) at java.desktop/java.awt.EventQueue$5.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
Attachments (2)
Change History (34)
by , 15 months ago
Attachment: | Capture.PNG added |
---|
comment:1 by , 15 months ago
comment:2 by , 15 months ago
You can try to rename the cached file JOSM/cache/mirror_https___josm.openstreetmap.de_maps
If that solves the problem this was a temporary bad version.
comment:4 by , 15 months ago
Component: | Core → Core imagery |
---|
comment:5 by , 15 months ago
I can reproduce the crash when I try to enter 'e' in the search field for the available default entries. Also when I scroll up or down in the list without any search argument. So there must be one or more entries which cause trouble. A#23486 mentions ES GRAFCAN ORTOEXPRESS
so I guess that could be the culprit. As far as I know this has to be fixed in the wiki, but JOSM should be made more robust as well.
comment:6 by , 15 months ago
Could this change be the reason?
https://josm.openstreetmap.de/wiki/Maps/Switzerland?action=diff&version=331
It removed a <type> entry and I think that causes the crash.
comment:7 by , 15 months ago
I've added the entry again with
https://josm.openstreetmap.de/wiki/Maps/Switzerland?action=diff&version=332
and this fixes the problem.
Users have to "Update the default entries"
comment:8 by , 15 months ago
Does anyone have a solution to this issue with step by step instructions? I'm using linux.
comment:9 by , 15 months ago
If the problem still exists:
- Start JOSM, open Help|About and the tab "Installation details". This shows you the location of the JOSM cache directory. Click on the button to the right to open the directory.
- Search the file
mirror_https___josm.openstreetmap.de_maps
and rename or delete it. Its size is about 9.5 MB. - go back to JOSM
- open Imagery preferences and click on the refresh
button to download the latest version of the file
(Maybe only the last step is needed)
follow-up: 13 comment:11 by , 15 months ago
Cc: | added |
---|
Possible simply patch to skip the invalid(?) entry:
-
src/org/openstreetmap/josm/io/imagery/ImageryReader.java
351 351 entry.setCustomHttpHeaders(customHttpHeaders); 352 352 customHttpHeaders = null; 353 353 354 if (!skipEntry ) {354 if (!skipEntry && entry.getSourceType() != null) { 355 355 entries.add(entry); 356 356 } 357 357 entry = null;
Or maybe the default type "wms" should be used if none is given?
comment:13 by , 15 months ago
Replying to GerdP:
Possible simply patch to skip the invalid(?) entry:
[...]
Or maybe the default type "wms" should be used if none is given?
Skipping the invalid entry is probably a good idea. We'd probably want to report that somehow though so it can be fixed.
I don't think we want to try and guess what the wiki editor was trying to do.
comment:14 by , 15 months ago
We'd probably want to report that somehow though so it can be fixed.
I also thought so but didn't find any code for similar problems which set skipEntry to true.
comment:15 by , 15 months ago
I think
-
core/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
diff --git a/core/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java b/core/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
a b 166 166 reader = new ImageryReader(source); 167 167 reader.setFastFail(fastFail); 168 168 Collection<ImageryInfo> result = reader.parse(); 169 // See #23485 (remove invalid source entries) 170 result.removeIf(info -> info.getSourceType() == null); 169 171 newLayers.addAll(result); 170 172 } catch (IOException ex) { 171 173 loadError = true; -
core/scripts/SyncEditorLayerIndex.java
diff --git a/core/scripts/SyncEditorLayerIndex.java b/core/scripts/SyncEditorLayerIndex.java
a b 499 499 } 500 500 501 501 for (ImageryInfo e : josmEntries) { 502 if (e.getSourceType() == null) { 503 myprintln("~~~ JOSM-Entry without type: " + getDescription(e)); 504 } 502 505 if (isBlank(getUrl(e))) { 503 506 myprintln("~~~ JOSM-Entry without URL: " + getDescription(e)); 504 507 continue;
would be better. This would keep SyncEditorLayerIndex
working, and it would hopefully catch the missing type and report it.
comment:18 by , 14 months ago
Cc: | added |
---|
@stoecker: Are we still running validation checks on edits to the backgrounds? Or did that get broken by the Trac 1.2 -> 1.6 upgrade?
comment:19 by , 14 months ago
Yes. Try entering invalid XML and it will show you an error. Thought that only validates against the XSD. The checks in the sync script are optional and don't prevent a submission. Thought a missing "type" probably should have been caught by the XSD checks...
comment:20 by , 14 months ago
Thought a missing "type" probably should have been caught by the XSD checks
I thought so too. I just checked with xmllint --schema resources/data/maps.xsd maps --noout
, and it thought that the xml was valid.
EDIT: The maps file was modified to be invalid.
comment:21 by , 14 months ago
Well, XSD is a magic in itself, so maybe I only think that check is there, but in reality it isn't due to the limitations of XSD. Wouldn't be the first time that happens.
follow-up: 23 comment:22 by , 14 months ago
It turns out that the problem is from r8048.
<xs:sequence> <xs:choice minOccurs="1" maxOccurs="unbounded"> [...xml elements...]
The problem is that so long as any valid xml element occurs and no invalid xml elements occur, the xml will be seen as "valid".
I'll check and see if there is a way to avoid the <xs:choice
bit while still keeping unbounded
as a maxOccurs
for the elements. I'm not hopeful.
comment:23 by , 14 months ago
comment:24 by , 14 months ago
I saw a reference that XSD 1.1 would fix it, but I think the reference was wrong (see XSD 1.1 Model Groups).
In other words, it looks like the validating XSD is broken. And I don't think it can be fixed without modifying the schema.
Specifically, we would have to move the unbounded elements to subelements.
comment:25 by , 14 months ago
Jupp. Like before :-) The way we use XML and the way XSD offers don't match, so the XSD can only provide a limited check. That's why we have additional checks. I think the XSD inventors were a little single-minded.
by , 14 months ago
Attachment: | 23485.patch added |
---|
Check for required elements in ELI SyncEditorLayerIndex since XSD syntax does not allow us to validate the desired XML format
comment:26 by , 14 months ago
Notes on attachment:23485.patch:
SyncEditorLayerIndex.java
checks to see if ImageryInfo is valid; if not, it prints the missing fields and the standard description.- There are some additional changes to make it easier to run the script in a dev environment
ImageryInfo
has two new methods:isValid
andgetMissingFields
.ImageryLayerInfo
now removes any invalidImageryInfo
objects based off of theisValid
check.
comment:28 by , 14 months ago
comment:29 by , 14 months ago
If they are required, then there is also a reason for that, even when not neceesary an obvious one ;-)
comment:31 by , 14 months ago
Milestone: | → 24.02 |
---|
Confirming this is an issue for a coworker and me today as well. We are using slightly different versions of Windows 10, Java, and JOSM.
Could this possibly be related to one of the individual imagery providers and their service/URL causing the error? This could explain how this issue could have occurred suddenly for multiple users worldwide running different versions.