Index: trunk/src/org/openstreetmap/josm/gui/dialogs/SearchDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/SearchDialog.java	(revision 16305)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/SearchDialog.java	(revision 16306)
@@ -233,10 +233,11 @@
                 super.buttonAction(buttonIndex, evt);
             } catch (SearchParseError | MapCSSException e) {
-                Logging.debug(e);
+                Logging.warn(e);
+                String message = Utils.escapeReservedCharactersHTML(e.getMessage()
+                        .replace("<html>", "")
+                        .replace("</html>", ""));
                 JOptionPane.showMessageDialog(
                         MainApplication.getMainFrame(),
-                        "<html>" + tr("Search expression is not valid: \n\n {0}",
-                                e.getMessage().replace("<html>", "").replace("</html>", "")).replace("\n", "<br>") +
-                        "</html>",
+                        "<html>" + tr("Search expression is not valid: \n\n {0}", message).replace("\n", "<br>") + "</html>",
                         tr("Invalid search expression"),
                         JOptionPane.ERROR_MESSAGE);
