Changeset 16217 in josm for trunk


Ignore:
Timestamp:
2020-03-29T10:10:42+02:00 (4 years ago)
Author:
GerdP
Message:

see #18982: Improve log message, show content of panel instead of meaningless output of HtmlPanel.toString()

  • Don't create HtmlPanel in ExceptionDialogUtil (regression from #13777), create it in HelpAwareOptionPane instead when msg is a String
Location:
trunk/src/org/openstreetmap/josm/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java

    r15084 r16217  
    1616
    1717import org.openstreetmap.josm.data.osm.OsmPrimitive;
    18 import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    1918import org.openstreetmap.josm.io.ChangesetClosedException;
    2019import org.openstreetmap.josm.io.IllegalDataException;
     
    4544        return HelpAwareOptionPane.showOptionDialog(
    4645                MainApplication.getMainFrame(),
    47                 new HtmlPanel(msg),
     46                msg,
    4847                title,
    4948                JOptionPane.ERROR_MESSAGE,
     
    336335        Object msg = null;
    337336        if (e.isHtml() && body != null && body.startsWith("<") && body.contains("<html>")) {
    338             msg = new HtmlPanel(body);
     337            // use html string as is
    339338        } else {
    340339            msg = ExceptionUtil.explainGeneric(e);
  • trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java

    r13842 r16217  
    2828import org.openstreetmap.josm.gui.util.GuiHelper;
    2929import org.openstreetmap.josm.gui.util.WindowGeometry;
    30 import org.openstreetmap.josm.gui.widgets.JMultilineLabel;
     30import org.openstreetmap.josm.gui.widgets.HtmlPanel;
    3131import org.openstreetmap.josm.tools.ImageProvider;
    3232import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
     
    258258            }
    259259        }
    260 
     260        final Object content;
     261        if (msg instanceof String) {
     262            String msgStr = (String) msg;
     263            content = new HtmlPanel(msgStr.startsWith("<html>") ? msgStr : "<html>" + msgStr + "</html>");
     264        } else {
     265            content = msg;
     266        }
    261267        final JOptionPane pane = new JOptionPane(
    262                 msg instanceof String ? new JMultilineLabel((String) msg, true) : msg,
     268                content,
    263269                messageType,
    264270                JOptionPane.DEFAULT_OPTION,
Note: See TracChangeset for help on using the changeset viewer.