Modify

Opened 21 months ago

Last modified 20 months ago

#23402 new defect

Error saving offset bookmark

Reported by: anonymous Owned by: team
Priority: normal Milestone:
Component: Core imagery Version: tested
Keywords: template_report offset Cc:

Description

What steps will reproduce the problem?

(I did not attempt to reproduce to verify, but this is what I did the first time.)

  1. Adjust imagery offset using one imagery source, but don't save the bookmark. Make a note of the offset numbers.
  2. Adjust imagery offset using another imagery source. Use different offset numbers from the ones of step 1.
  3. Close the second imagery source (garbage can button in layers box).
  4. Click "Adjust imagery offset" back in the first imagery source again, don't change anything yet. Look to see what the offset numbers are. If the bug happens for you as it did for me, the numbers will still be from the offset you set on the second imagery source. So if you wanted to save the first imagery offset as a bookmark, it makes sense you would try to change them to the correct numbers first.
  5. Change the numbers in the box back to what they should be (the ones you made a note of in step 1).
  6. Enter a bookmark name to save.
  7. Click OK.

What is the expected result?

The bookmark should save, as it properly does if you skip steps 2 through 5.

What happens instead?

Error box pops up saying "You have encountered a bug in JOSM."

Please provide any additional information below. Attach a screenshot if possible.

Revision:18907
Build-Date:2023-12-07 16:43:08

Identification: JOSM/1.5 (18907 en) Windows 11 64-Bit
OS Build number: Windows 10 Pro 2009 (22621)
Memory Usage: 708 MB / 8172 MB (190 MB allocated, but free)
Java version: 17.0.9+8-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 2560×1440 (scaling 1.00×1.00) \Display1 1920×1080 (scaling 1.00×1.00)
Maximum Screen Size: 2560×1440
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: Cp1252
System property sun.jnu.encoding: Cp1252
Locale info: en_US
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Djpackage.app-version=1.5.18907, --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.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=%UserProfile%\AppData\Local\JOSM\JOSM.exe]
Dataset consistency test: No problems found

Plugins:
+ CommandLine (36178)
+ OpeningHoursEditor (36126)
+ buildings_tools (36178)
+ movemembership (1.0.0)
+ utilsplugin2 (36178)

Last errors/warnings:
- 10111.923 W: java.net.SocketTimeoutException: Read timed out. Cause: java.net.SocketTimeoutException: Read timed out
- 10111.923 W: Already here java.net.SocketTimeoutException: Read timed out
- 10112.024 E: Failed to locate image 'https://www.fs.usda.gov/sites/all/themes/fs_hq/images/usfslogo.png'
- 10763.269 W: java.net.SocketTimeoutException: Read timed out. Cause: java.net.SocketTimeoutException: Read timed out
- 10763.269 W: Already here java.net.SocketTimeoutException: Read timed out
- 10763.376 E: Failed to locate image 'https://www.fs.usda.gov/sites/all/themes/fs_hq/images/usfslogo.png'
- 10852.554 W: java.net.SocketTimeoutException: Read timed out. Cause: java.net.SocketTimeoutException: Read timed out
- 10852.554 W: Already here java.net.SocketTimeoutException: Read timed out
- 10852.662 E: Failed to locate image 'https://www.fs.usda.gov/sites/all/themes/fs_hq/images/usfslogo.png'
- 10983.232 E: Handled by bug report queue: java.lang.NullPointerException: Cannot invoke "org.openstreetmap.josm.gui.layer.ImageryLayer.getInfo()" because "layer" is null



=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (31) of main
java.lang.NullPointerException: Cannot invoke "org.openstreetmap.josm.gui.layer.ImageryLayer.getInfo()" because "layer" is null
	at org.openstreetmap.josm.data.imagery.OffsetBookmark.isUsable(OffsetBookmark.java:52)
	at org.openstreetmap.josm.data.imagery.OffsetBookmark.lambda$getBookmarkByName$5(OffsetBookmark.java:351)
	at java.base/java.util.stream.ReferencePipeline$2$1.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.FindOps$FindOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.findFirst(Unknown Source)
	at org.openstreetmap.josm.data.imagery.OffsetBookmark.getBookmarkByName(OffsetBookmark.java:352)
	at org.openstreetmap.josm.actions.ImageryAdjustAction$ImageryOffsetDialog.buttonAction(ImageryAdjustAction.java:332)
	at org.openstreetmap.josm.gui.ExtendedDialog$1.actionPerformed(ExtendedDialog.java:381)
	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.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
	at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.Component.processEvent(Unknown Source)
	at java.desktop/java.awt.Container.processEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.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 (0)

Change History (4)

comment:1 by GerdP, 21 months ago

It seems one can have the adjust dialog open while the corresponding layer was removed:
Simpler list to reproduce:
1) Open layer Bing
2) Open another image layer, e.g.ESRI
3) open "Adjust image dialog" for ESRI
4) close corresponding layer for ESRI while adjust dialog is still open
5) enter name in Adjust image dialog
6) press OK

comment:2 by GerdP, 21 months ago

Possible quick fix:

  • src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java

     
    4747     * @return <code>true</code> if it is usable on the projection of the layer and the imagery name matches.
    4848     */
    4949    public boolean isUsable(ImageryLayer layer) {
     50        if (layer == null) return false;
    5051        if (projection_code == null) return false;
    5152        if (!ProjectionRegistry.getProjection().toCode().equals(projection_code) && !hasCenter()) return false;
    5253        ImageryInfo info = layer.getInfo();

This just prevents the crash, but I think it would be better to make sure the offset dialog is closed when the imagage layer is removed.

comment:3 by skyper, 21 months ago

Component: CoreCore imagery
Keywords: offset added
Version: tested

comment:4 by GerdP, 20 months ago

I tried to find a solution which would close the offset dialog when the corresponding layer is deleted but that doesn't work well.
It is also not useful to close the dialog when the layer is changed, as this is a common way to test if two different background layers are well adjusted.
We have one instance of ImageryAdjustAction for each background layer but only one static instance for the dialog. Whenever you change the layer while the offset dialog is open it can get complicated. For example, you may change the offset for a layer that isn't visible when you pan while a different background layer is visible.
So, a better solution would be complicated. I'd say the null to prevent the crash report is good enough.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to anonymous.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.