Changeset 11848 in josm for trunk/src/org


Ignore:
Timestamp:
2017-04-07T00:18:07+02:00 (7 years ago)
Author:
Don-vip
Message:

fix #14613 - Special HTML characters not escaped in GUI error messages

Location:
trunk/src/org/openstreetmap/josm
Files:
39 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java

    r11017 r11848  
    2222import org.openstreetmap.josm.tools.GBC;
    2323import org.openstreetmap.josm.tools.Shortcut;
     24import org.openstreetmap.josm.tools.Utils;
    2425
    2526public abstract class AbstractMergeAction extends JosmAction {
     
    100101    protected void warnNoTargetLayersForSourceLayer(Layer sourceLayer) {
    101102        JOptionPane.showMessageDialog(Main.parent,
    102                 tr("<html>There are no layers the source layer<br>''{0}''<br>could be merged to.</html>", sourceLayer.getName()),
     103                tr("<html>There are no layers the source layer<br>''{0}''<br>could be merged to.</html>",
     104                        Utils.escapeReservedCharactersHTML(sourceLayer.getName())),
    103105                tr("No target layers"), JOptionPane.WARNING_MESSAGE);
    104106    }
  • trunk/src/org/openstreetmap/josm/actions/MergeLayerAction.java

    r11739 r11848  
    130130                        "<b>This is not the recommended way of merging such data</b>.<br />"+
    131131                        "You should instead check and merge each object, one by one, by using ''<i>Merge selection</i>''.<br /><br />"+
    132                         "Are you sure you want to continue?", sourceLayer.getName(), targetLayer.getName(), targetLayer.getName())+
     132                        "Are you sure you want to continue?",
     133                        Utils.escapeReservedCharactersHTML(sourceLayer.getName()),
     134                        Utils.escapeReservedCharactersHTML(targetLayer.getName()),
     135                        Utils.escapeReservedCharactersHTML(targetLayer.getName()))+
    133136                "</html>",
    134137                ImageProvider.get("dialogs", "mergedown"), tr("Ignore this hint and merge anyway"));
  • trunk/src/org/openstreetmap/josm/actions/MergeSelectionAction.java

    r10552 r11848  
    1818import org.openstreetmap.josm.tools.ImageProvider;
    1919import org.openstreetmap.josm.tools.Shortcut;
     20import org.openstreetmap.josm.tools.Utils;
    2021
    2122/**
     
    9091                        "You should instead check and merge each object, <b>one by one</b>.<br /><br />"+
    9192                        "Are you sure you want to continue?",
    92                         getLayerManager().getEditLayer().getName(), targetLayer.getName(), targetLayer.getName())+
     93                        Utils.escapeReservedCharactersHTML(getLayerManager().getEditLayer().getName()),
     94                        Utils.escapeReservedCharactersHTML(targetLayer.getName()),
     95                        Utils.escapeReservedCharactersHTML(targetLayer.getName()))+
    9396                "</html>",
    9497                ImageProvider.get("dialogs", "mergedown"), tr("Ignore this hint and merge anyway"));
  • trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java

    r10601 r11848  
    3939import org.openstreetmap.josm.tools.MultiMap;
    4040import org.openstreetmap.josm.tools.Shortcut;
     41import org.openstreetmap.josm.tools.Utils;
    4142import org.xml.sax.SAXException;
    4243
     
    182183                        files.size(),
    183184                        files.size(),
    184                         importer.filter.getDescription()
     185                        Utils.escapeReservedCharactersHTML(importer.filter.getDescription())
    185186                    )
    186187            ).append("<br><ul>");
  • trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java

    r11746 r11848  
    190190                    Main.parent,
    191191                    tr("<html>Could not load session file ''{0}''.<br>Error is:<br>{1}</html>",
    192                             uri != null ? uri : file.getName(), e.getMessage()),
     192                            uri != null ? uri : file.getName(), Utils.escapeReservedCharactersHTML(e.getMessage())),
    193193                    dialogTitle,
    194194                    JOptionPane.ERROR_MESSAGE,
  • trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java

    r11109 r11848  
    170170            HelpAwareOptionPane.showMessageDialogInEDT(
    171171                    Main.parent,
    172                     tr("<html>Could not save session file ''{0}''.<br>Error is:<br>{1}</html>", file.getName(), ex.getMessage()),
     172                    tr("<html>Could not save session file ''{0}''.<br>Error is:<br>{1}</html>",
     173                            file.getName(), Utils.escapeReservedCharactersHTML(ex.getMessage())),
    173174                    tr("IO Error"),
    174175                    JOptionPane.ERROR_MESSAGE,
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r11709 r11848  
    2929import org.openstreetmap.josm.tools.ImageProvider;
    3030import org.openstreetmap.josm.tools.Shortcut;
     31import org.openstreetmap.josm.tools.Utils;
    3132
    3233/**
     
    154155                Main.parent,
    155156                tr("<html>The data to be uploaded participates in unresolved conflicts of layer ''{0}''.<br>"
    156                         + "You have to resolve them first.</html>", layer.getName()
     157                        + "You have to resolve them first.</html>", Utils.escapeReservedCharactersHTML(layer.getName())
    157158                ),
    158159                tr("Warning"),
     
    173174                    "Sending data from this layer is <b>strongly discouraged</b>. If you continue,<br />"+
    174175                    "it may require you subsequently have to revert your changes, or force other contributors to.<br /><br />"+
    175                     "Are you sure you want to continue?", layer.getName())+
     176                    "Are you sure you want to continue?", Utils.escapeReservedCharactersHTML(layer.getName()))+
    176177                "</html>",
    177178                ImageProvider.get("upload"), tr("Ignore this hint and upload anyway"));
  • trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java

    r10378 r11848  
    1717import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1818import org.openstreetmap.josm.tools.ImageProvider;
     19import org.openstreetmap.josm.tools.Utils;
    1920
    2021/**
     
    4142                        + "''{1}''.<br>"
    4243                        + "This conflict cannot be added.</html>",
    43                         getLayer().getName(),
    44                         conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance())
     44                        Utils.escapeReservedCharactersHTML(getLayer().getName()),
     45                        Utils.escapeReservedCharactersHTML(conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance()))
    4546                ),
    4647                tr("Double conflict"),
  • trunk/src/org/openstreetmap/josm/corrector/ReverseWayNoTagCorrector.java

    r10763 r11848  
    8686                + "Do you really want to change the way direction, thus its semantic meaning?</html>",
    8787                tags.size(),
    88                 way.getDisplayName(DefaultNameFormatter.getInstance()),
     88                Utils.escapeReservedCharactersHTML(way.getDisplayName(DefaultNameFormatter.getInstance())),
    8989                Utils.joinAsHtmlUnorderedList(tags)
    9090            );
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r11811 r11848  
    3535import org.openstreetmap.josm.tools.LanguageInfo;
    3636import org.openstreetmap.josm.tools.MultiMap;
     37import org.openstreetmap.josm.tools.Utils;
    3738
    3839/**
     
    872873        String desc = getDescription();
    873874        if (desc != null && !desc.isEmpty()) {
    874             res.append("<br>").append(desc);
     875            res.append("<br>").append(Utils.escapeReservedCharactersHTML(desc));
    875876            html = true;
    876877        }
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r11746 r11848  
    7979import org.openstreetmap.josm.tools.GBC;
    8080import org.openstreetmap.josm.tools.ImageProvider;
     81import org.openstreetmap.josm.tools.Utils;
    8182
    8283/**
     
    587588        private JLabel popupBuildPrimitiveLabels(final OsmPrimitive osm) {
    588589            final StringBuilder text = new StringBuilder(32);
    589             String name = osm.getDisplayName(DefaultNameFormatter.getInstance());
     590            String name = Utils.escapeReservedCharactersHTML(osm.getDisplayName(DefaultNameFormatter.getInstance()));
    590591            if (osm.isNewOrUndeleted() || osm.isModified()) {
    591592                name = "<i><b>"+ name + "*</b></i>";
     
    601602
    602603            if (osm.getUser() != null) {
    603                 text.append(" [").append(tr("User:")).append(' ').append(osm.getUser().getName()).append(']');
     604                text.append(" [").append(tr("User:")).append(' ')
     605                    .append(Utils.escapeReservedCharactersHTML(osm.getUser().getName())).append(']');
    604606            }
    605607
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java

    r10210 r11848  
    2929import org.openstreetmap.josm.gui.history.VersionInfoPanel;
    3030import org.openstreetmap.josm.tools.ImageProvider;
     31import org.openstreetmap.josm.tools.Utils;
    3132
    3233/**
     
    315316        StringBuilder str = new StringBuilder("<html>");
    316317        for (OsmPrimitive r: referrers) {
    317             str.append(r.getDisplayName(DefaultNameFormatter.getInstance())).append("<br>");
     318            str.append(Utils.escapeReservedCharactersHTML(r.getDisplayName(DefaultNameFormatter.getInstance()))).append("<br>");
    318319        }
    319320        str.append("</html>");
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java

    r11452 r11848  
    6767                JOptionPane.showMessageDialog(
    6868                        Main.parent,
    69                         tr("<html>Error in filter <code>{0}</code>:<br>{1}", Utils.shortenString(filter.text, 80), e.getMessage()),
     69                        tr("<html>Error in filter <code>{0}</code>:<br>{1}",
     70                                Utils.escapeReservedCharactersHTML(Utils.shortenString(filter.text, 80)),
     71                                Utils.escapeReservedCharactersHTML(e.getMessage())),
    7072                        tr("Error in filter"),
    7173                        JOptionPane.ERROR_MESSAGE);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java

    r11746 r11848  
    5555import org.openstreetmap.josm.tools.ImageProvider;
    5656import org.openstreetmap.josm.tools.JosmRuntimeException;
     57import org.openstreetmap.josm.tools.Utils;
    5758import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler;
    5859
     
    199200                        + "edit layer ''{0}''.</html>",
    200201                        primitives.size(),
    201                         Main.getLayerManager().getEditLayer().getName()
     202                        Utils.escapeReservedCharactersHTML(Main.getLayerManager().getEditLayer().getName())
    202203                ),
    203204                title, JOptionPane.WARNING_MESSAGE, helpTopic
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanel.java

    r10490 r11848  
    4343import org.openstreetmap.josm.io.OnlineResource;
    4444import org.openstreetmap.josm.tools.ImageProvider;
     45import org.openstreetmap.josm.tools.Utils;
    4546import org.openstreetmap.josm.tools.date.DateUtils;
    4647
     
    340341                            + "edit layer ''{1}''.</html>",
    341342                            currentChangeset.getId(),
    342                             Main.getLayerManager().getEditLayer().getName()
     343                            Utils.escapeReservedCharactersHTML(Main.getLayerManager().getEditLayer().getName())
    343344                    ),
    344345                    tr("Nothing to select"),
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java

    r11534 r11848  
    4646import org.openstreetmap.josm.tools.CheckParameterUtil;
    4747import org.openstreetmap.josm.tools.ImageProvider;
     48import org.openstreetmap.josm.tools.Utils;
    4849import org.xml.sax.SAXException;
    4950
     
    347348                    + "{0}<br>"
    348349                    + "is deleted on the server. It cannot be loaded</html>",
    349                     r.getDisplayName(DefaultNameFormatter.getInstance())
     350                    Utils.escapeReservedCharactersHTML(r.getDisplayName(DefaultNameFormatter.getInstance()))
    350351            );
    351352
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r11490 r11848  
    9898import org.openstreetmap.josm.tools.CheckParameterUtil;
    9999import org.openstreetmap.josm.tools.Shortcut;
     100import org.openstreetmap.josm.tools.Utils;
    100101import org.openstreetmap.josm.tools.WindowGeometry;
    101102
     
    872873                + "<br>"
    873874                + "Do you really want to add another relation member?</html>",
    874                 primitive.getDisplayName(DefaultNameFormatter.getInstance())
     875                Utils.escapeReservedCharactersHTML(primitive.getDisplayName(DefaultNameFormatter.getInstance()))
    875876            );
    876877        int ret = ConditionalOptionPaneUtil.showOptionDialog(
     
    906907                + "This creates circular references and is therefore discouraged.<br>"
    907908                + "Skipping relation ''{0}''.</html>",
    908                 primitive.getDisplayName(DefaultNameFormatter.getInstance()));
     909                Utils.escapeReservedCharactersHTML(primitive.getDisplayName(DefaultNameFormatter.getInstance())));
    909910        JOptionPane.showMessageDialog(
    910911                Main.parent,
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java

    r11684 r11848  
    3030import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
    3131import org.openstreetmap.josm.tools.ImageProvider;
     32import org.openstreetmap.josm.tools.Utils;
    3233
    3334/**
     
    152153                        + "''{1}''.<br>"
    153154                        + "Please resolve this conflict first, then try again.</html>",
    154                         layer.getName(),
    155                         editor.getRelation().getDisplayName(DefaultNameFormatter.getInstance())
     155                        Utils.escapeReservedCharactersHTML(layer.getName()),
     156                        Utils.escapeReservedCharactersHTML(editor.getRelation().getDisplayName(DefaultNameFormatter.getInstance()))
    156157                ),
    157158                tr("Double conflict"),
  • trunk/src/org/openstreetmap/josm/gui/history/VersionInfoPanel.java

    r11435 r11848  
    152152            text = tr("<html>Version <strong>{0}</strong> currently edited in layer ''{1}''</html>",
    153153                    Long.toString(version),
    154                     editLayer == null ? tr("unknown") : editLayer.getName()
     154                    editLayer == null ? tr("unknown") : Utils.escapeReservedCharactersHTML(editLayer.getName())
    155155                    );
    156156        } else {
  • trunk/src/org/openstreetmap/josm/gui/io/ChangesetCellRenderer.java

    r11608 r11848  
    1515import org.openstreetmap.josm.data.osm.Changeset;
    1616import org.openstreetmap.josm.tools.ImageProvider;
     17import org.openstreetmap.josm.tools.Utils;
    1718import org.openstreetmap.josm.tools.date.DateUtils;
    1819
     
    4243        String comment = cs.get("comment");
    4344        if (comment != null) {
    44             sb.append("<strong>").append(tr("Changeset comment:")).append("</strong>").append(comment).append("<br>");
     45            sb.append("<strong>").append(tr("Changeset comment:")).append("</strong>")
     46              .append(Utils.escapeReservedCharactersHTML(comment)).append("<br>");
    4547        }
    4648        return sb.toString();
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersTableColumnModel.java

    r10308 r11848  
    1616
    1717import org.openstreetmap.josm.tools.GBC;
     18import org.openstreetmap.josm.tools.Utils;
    1819
    1920class SaveLayersTableColumnModel extends DefaultTableColumnModel {
     
    4243            sb.append("<html>");
    4344            if (info != null) {
     45                String htmlInfoName = Utils.escapeReservedCharactersHTML(info.getName());
    4446                if (info.getLayer().requiresUploadToServer() && !info.getLayer().isUploadDiscouraged()) {
    4547                    panel.add(needsUpload, defaultCellStyle);
    46                     sb.append(tr("Layer ''{0}'' has modifications which should be uploaded to the server.", info.getName()));
     48                    sb.append(tr("Layer ''{0}'' has modifications which should be uploaded to the server.", htmlInfoName));
    4749
    4850                } else {
     
    5153                    }
    5254                    if (info.getLayer().requiresUploadToServer()) {
    53                         sb.append(tr("Layer ''{0}'' has modifications which are discouraged to be uploaded.", info.getName()));
     55                        sb.append(tr("Layer ''{0}'' has modifications which are discouraged to be uploaded.", htmlInfoName));
    5456                    } else {
    55                         sb.append(tr("Layer ''{0}'' has no modifications to be uploaded.", info.getName()));
     57                        sb.append(tr("Layer ''{0}'' has no modifications to be uploaded.", htmlInfoName));
    5658                    }
    5759                }
     
    6163                    panel.add(needsSave, defaultCellStyle);
    6264                    sb.append(tr("Layer ''{0}'' has modifications which should be saved to its associated file ''{1}''.",
    63                             info.getName(), info.getFile().toString()));
     65                            htmlInfoName, info.getFile().toString()));
    6466                } else {
    6567                    if (info.isSavable()) {
    6668                        panel.add(pnlEmpty, defaultCellStyle);
    6769                    }
    68                     sb.append(tr("Layer ''{0}'' has no modifications to be saved.", info.getName()));
     70                    sb.append(tr("Layer ''{0}'' has no modifications to be saved.", htmlInfoName));
    6971                }
    7072            }
  • trunk/src/org/openstreetmap/josm/gui/layer/Layer.java

    r11553 r11848  
    553553        if (!isProjectionSupported(newValue)) {
    554554            final String message = "<html><body><p>" +
    555                     tr("The layer {0} does not support the new projection {1}.", getName(), newValue.toCode()) + "</p>" +
     555                    tr("The layer {0} does not support the new projection {1}.",
     556                            Utils.escapeReservedCharactersHTML(getName()), newValue.toCode()) + "</p>" +
    556557                    "<p style='width: 450px;'>" + tr("Supported projections are: {0}", nameSupportedProjections()) + "</p>" +
    557558                    tr("Change the projection again or remove the layer.");
  • trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java

    r11168 r11848  
    3131import org.openstreetmap.josm.gui.layer.imagery.TileSourceDisplaySettings;
    3232import org.openstreetmap.josm.tools.CheckParameterUtil;
     33import org.openstreetmap.josm.tools.Utils;
    3334
    3435/**
     
    138139        if (!isProjectionSupported(newValue)) {
    139140            String message =
    140                     "<html><body><p>" + tr("The layer {0} does not support the new projection {1}.", getName(), newValue.toCode()) +
     141                    "<html><body><p>" + tr("The layer {0} does not support the new projection {1}.",
     142                            Utils.escapeReservedCharactersHTML(getName()), newValue.toCode()) +
    141143                    "<p style='width: 450px; position: absolute; margin: 0px;'>" +
    142144                            tr("Supported projections are: {0}", nameSupportedProjections()) + "</p>" +
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r11434 r11848  
    275275            sb.append("<html>");
    276276            if (errorMessages.size() == 1) {
    277                 sb.append(errorMessages.iterator().next());
     277                sb.append(Utils.escapeReservedCharactersHTML(errorMessages.iterator().next()));
    278278            } else {
    279279                sb.append(Utils.joinAsHtmlUnorderedList(errorMessages));
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerAction.java

    r11486 r11848  
    151151        JPanel msg = new JPanel(new GridBagLayout());
    152152        msg.add(new JLabel(
    153                 // CHECKSTYLE.OFF: LineLength
    154                 tr("<html>Upload of unprocessed GPS data as map data is considered harmful.<br>If you want to upload traces, look here:</html>")),
    155                 // CHECKSTYLE.ON: LineLength
     153                tr("<html>Upload of unprocessed GPS data as map data is considered harmful.<br>"
     154                        + "If you want to upload traces, look here:</html>")),
    156155                GBC.eol());
    157156        msg.add(new UrlLabel(Main.getOSMWebsite() + "/traces", 2), GBC.eop());
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java

    r11621 r11848  
    7171        String msg = tr("<html>The data in the GPX layer ''{0}'' has been downloaded from the server.<br>" +
    7272                "Because its way points do not include a timestamp we cannot correlate them with audio data.</html>",
    73                 layer.getName());
     73                Utils.escapeReservedCharactersHTML(layer.getName()));
    7474        HelpAwareOptionPane.showOptionDialog(Main.parent, msg, tr("Import not possible"),
    7575                JOptionPane.WARNING_MESSAGE, ht("/Action/ImportAudio#CantImportIntoGpxLayerFromServer"));
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportImagesAction.java

    r11747 r11848  
    3636        String msg = tr("<html>The data in the GPX layer ''{0}'' has been downloaded from the server.<br>"+
    3737                "Because its way points do not include a timestamp we cannot correlate them with images.</html>",
    38                 layer.getName());
     38                Utils.escapeReservedCharactersHTML(layer.getName()));
    3939        HelpAwareOptionPane.showOptionDialog(Main.parent, msg, tr("Import not possible"),
    4040                JOptionPane.WARNING_MESSAGE, ht("/Action/ImportImages#CantImportIntoGpxLayerFromServer"));
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r11381 r11848  
    5151import org.openstreetmap.josm.tools.AudioPlayer;
    5252import org.openstreetmap.josm.tools.ImageProvider;
     53import org.openstreetmap.josm.tools.Utils;
    5354
    5455/**
     
    247248
    248249    @Override public Object getInfoComponent() {
    249         return "<html>"+trn("{0} consists of {1} marker", "{0} consists of {1} markers", data.size(), getName(), data.size()) + "</html>";
     250        return "<html>"+trn("{0} consists of {1} marker", "{0} consists of {1} markers",
     251                data.size(), Utils.escapeReservedCharactersHTML(getName()), data.size()) + "</html>";
    250252    }
    251253
  • trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java

    r11604 r11848  
    5050import org.openstreetmap.josm.io.auth.CredentialsManager;
    5151import org.openstreetmap.josm.tools.ImageProvider;
     52import org.openstreetmap.josm.tools.Utils;
    5253import org.xml.sax.SAXException;
    5354
     
    456457                            +"</html>",
    457458                            loginUrl,
    458                             getOsmUserName()),
     459                            Utils.escapeReservedCharactersHTML(getOsmUserName())),
    459460                    tr("OAuth authorization failed"),
    460461                    JOptionPane.ERROR_MESSAGE,
  • trunk/src/org/openstreetmap/josm/gui/oauth/TestAccessTokenTask.java

    r10404 r11848  
    147147                        token.getKey(),
    148148                        apiUrl,
    149                         userInfo.getDisplayName(),
     149                        Utils.escapeReservedCharactersHTML(userInfo.getDisplayName()),
    150150                        userInfo.getId()
    151151                ),
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r11435 r11848  
    826826
    827827        private static void appendRow(StringBuilder s, String th, String td) {
    828             s.append("<tr><th>").append(th).append("</th><td>").append(td).append("</td</tr>");
     828            s.append("<tr><th>").append(th).append("</th><td>").append(Utils.escapeReservedCharactersHTML(td)).append("</td</tr>");
    829829        }
    830830
     
    16211621            StringBuilder s = new StringBuilder(128).append("<html><b>");
    16221622            if (entry.title != null) {
    1623                 s.append(entry.title).append("</b> <span color=\"gray\">");
     1623                s.append(Utils.escapeReservedCharactersHTML(entry.title)).append("</b> <span color=\"gray\">");
    16241624            }
    16251625            s.append(entry.url);
  • trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java

    r10627 r11848  
    3535import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetReader;
    3636import org.openstreetmap.josm.tools.GBC;
     37import org.openstreetmap.josm.tools.Utils;
    3738import org.xml.sax.SAXException;
    3839import org.xml.sax.SAXParseException;
     
    8990                                errorMessage = tr("<html>Tagging preset source {0} can be loaded but it contains errors. " +
    9091                                        "Do you really want to use it?<br><br><table width=600>Error is: [{1}:{2}] {3}</table></html>",
    91                                         source, e.getLineNumber(), e.getColumnNumber(), e.getMessage());
     92                                        source, e.getLineNumber(), e.getColumnNumber(), Utils.escapeReservedCharactersHTML(e.getMessage()));
    9293                            } else {
    9394                                errorMessage = tr("<html>Unable to parse tagging preset source: {0}. " +
    9495                                        "Do you really want to use it?<br><br><table width=400>Error is: [{1}:{2}] {3}</table></html>",
    95                                         source, e.getLineNumber(), e.getColumnNumber(), e.getMessage());
     96                                        source, e.getLineNumber(), e.getColumnNumber(), Utils.escapeReservedCharactersHTML(e.getMessage()));
    9697                            }
    9798                            Main.warn(e, errorMessage);
     
    100101                                errorMessage = tr("<html>Tagging preset source {0} can be loaded but it contains errors. " +
    101102                                        "Do you really want to use it?<br><br><table width=600>Error is: {1}</table></html>",
    102                                         source, e.getMessage());
     103                                        source, Utils.escapeReservedCharactersHTML(e.getMessage()));
    103104                            } else {
    104105                                errorMessage = tr("<html>Unable to parse tagging preset source: {0}. " +
    105106                                        "Do you really want to use it?<br><br><table width=600>Error is: {1}</table></html>",
    106                                         source, e.getMessage());
     107                                        source, Utils.escapeReservedCharactersHTML(e.getMessage()));
    107108                            }
    108109                            Main.warn(e, errorMessage);
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginCheckBox.java

    r10228 r11848  
    8888                "Plugin {0} is still required by these {1} plugins:",
    8989                otherPlugins.size(),
    90                 plugin,
     90                Utils.escapeReservedCharactersHTML(plugin),
    9191                otherPlugins.size()))
    9292          .append(Utils.joinAsHtmlUnorderedList(otherPlugins))
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java

    r11386 r11848  
    4343import org.openstreetmap.josm.io.CachedFile;
    4444import org.openstreetmap.josm.io.UTFInputStreamReader;
     45import org.openstreetmap.josm.tools.Utils;
    4546import org.openstreetmap.josm.tools.XmlObjectParser;
    4647import org.xml.sax.SAXException;
     
    377378                JOptionPane.showMessageDialog(
    378379                        Main.parent,
    379                         "<html>" + tr("Error parsing {0}: ", source) + "<br><br><table width=600>" + e.getMessage() + "</table></html>",
     380                        "<html>" + tr("Error parsing {0}: ", source) + "<br><br><table width=600>" +
     381                                Utils.escapeReservedCharactersHTML(e.getMessage()) + "</table></html>",
    380382                        tr("Error"),
    381383                        JOptionPane.ERROR_MESSAGE
  • trunk/src/org/openstreetmap/josm/io/FileImporter.java

    r10615 r11848  
    1616import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1717import org.openstreetmap.josm.gui.util.GuiHelper;
     18import org.openstreetmap.josm.tools.Utils;
    1819
    1920/**
     
    108109        HelpAwareOptionPane.showMessageDialogInEDT(
    109110                Main.parent,
    110                 tr("<html>Could not read file ''{0}''.<br>Error is:<br>{1}</html>", f.getName(), e.getMessage()),
     111                tr("<html>Could not read file ''{0}''.<br>Error is:<br>{1}</html>",
     112                        f.getName(), Utils.escapeReservedCharactersHTML(e.getMessage())),
    111113                tr("Error"),
    112114                JOptionPane.ERROR_MESSAGE, null
     
    138140            HelpAwareOptionPane.showMessageDialogInEDT(
    139141                    Main.parent,
    140                     tr("<html>Could not read files.<br>Error is:<br>{0}</html>", e.getMessage()),
     142                    tr("<html>Could not read files.<br>Error is:<br>{0}</html>", Utils.escapeReservedCharactersHTML(e.getMessage())),
    141143                    tr("Error"),
    142144                    JOptionPane.ERROR_MESSAGE, null
  • trunk/src/org/openstreetmap/josm/io/OsmExporter.java

    r11809 r11848  
    9494            JOptionPane.showMessageDialog(
    9595                    Main.parent,
    96                     tr("<html>An error occurred while saving.<br>Error is:<br>{0}</html>", e.getMessage()),
     96                    tr("<html>An error occurred while saving.<br>Error is:<br>{0}</html>",
     97                            Utils.escapeReservedCharactersHTML(e.getMessage())),
    9798                    tr("Error"),
    9899                    JOptionPane.ERROR_MESSAGE
     
    108109                JOptionPane.showMessageDialog(
    109110                        Main.parent,
    110                         tr("<html>An error occurred while restoring backup file.<br>Error is:<br>{0}</html>", e2.getMessage()),
     111                        tr("<html>An error occurred while restoring backup file.<br>Error is:<br>{0}</html>",
     112                                Utils.escapeReservedCharactersHTML(e2.getMessage())),
    111113                        tr("Error"),
    112114                        JOptionPane.ERROR_MESSAGE
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r11645 r11848  
    507507                        dialog.show(
    508508                                tr("Error loading layer"),
    509                                 tr("<html>Could not load layer {0} ''{1}''.<br>Error is:<br>{2}</html>", idx, name, exception.getMessage()),
     509                                tr("<html>Could not load layer {0} ''{1}''.<br>Error is:<br>{2}</html>", idx,
     510                                        Utils.escapeReservedCharactersHTML(name),
     511                                        Utils.escapeReservedCharactersHTML(exception.getMessage())),
    510512                                JOptionPane.ERROR_MESSAGE,
    511513                                progressMonitor
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r11746 r11848  
    350350            String msg = tr("<html>Loading of the plugin \"{0}\" was requested."
    351351                    + "<br>This plugin is no longer developed and very likely will produce errors."
    352                     +"<br>It should be disabled.<br>Delete from preferences?</html>", unmaintained);
     352                    +"<br>It should be disabled.<br>Delete from preferences?</html>",
     353                    Utils.escapeReservedCharactersHTML(unmaintained));
    353354            if (confirmDisablePlugin(parent, msg, unmaintained)) {
    354355                Main.pref.removeFromCollection("plugins", unmaintained);
     
    506507                "Plugin {0} requires {1} plugins which were not found. The missing plugins are:",
    507508                missingRequiredPlugin.size(),
    508                 plugin,
     509                Utils.escapeReservedCharactersHTML(plugin),
    509510                missingRequiredPlugin.size()))
    510511          .append(Utils.joinAsHtmlUnorderedList(missingRequiredPlugin))
     
    723724            if (e.getCause() instanceof ClassNotFoundException) {
    724725                msg = tr("<html>Could not load plugin {0} because the plugin<br>main class ''{1}'' was not found.<br>"
    725                         + "Delete from preferences?</html>", plugin.name, plugin.className);
     726                        + "Delete from preferences?</html>", Utils.escapeReservedCharactersHTML(plugin.name), plugin.className);
    726727            }
    727728        } catch (RuntimeException e) { // NOPMD
     
    919920          .append("<ul>");
    920921        for (PluginInformation pi: plugins) {
    921             sb.append("<li>").append(pi.name).append("</li>");
     922            sb.append("<li>").append(Utils.escapeReservedCharactersHTML(pi.name)).append("</li>");
    922923        }
    923924        sb.append("</ul>")
     
    12701271        final StringBuilder msg = new StringBuilder(256);
    12711272        msg.append("<html>")
    1272            .append(tr("An unexpected exception occurred that may have come from the ''{0}'' plugin.", plugin.getPluginInformation().name))
     1273           .append(tr("An unexpected exception occurred that may have come from the ''{0}'' plugin.",
     1274                   Utils.escapeReservedCharactersHTML(plugin.getPluginInformation().name)))
    12731275           .append("<br>");
    12741276        if (plugin.getPluginInformation().author != null) {
    1275             msg.append(tr("According to the information within the plugin, the author is {0}.", plugin.getPluginInformation().author))
     1277            msg.append(tr("According to the information within the plugin, the author is {0}.",
     1278                    Utils.escapeReservedCharactersHTML(plugin.getPluginInformation().author)))
    12761279               .append("<br>");
    12771280        }
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r11553 r11848  
    298298        StringBuilder sb = new StringBuilder(128);
    299299        sb.append("<html><body>")
    300           .append(description == null ? tr("no description available") : description);
     300          .append(description == null ? tr("no description available") : Utils.escapeReservedCharactersHTML(description));
    301301        if (link != null) {
    302302            sb.append(" <a href=\"").append(link).append("\">").append(tr("More info...")).append("</a>");
Note: See TracChangeset for help on using the changeset viewer.