Mathijs den Burger pushed to branch master at cms-community / hippo-cms

Commits:
23c94277 by Marijan Milicevic at 2016-08-05T14:03:58+02:00
CMS-10158 Can't save document with only Youtube video in required rich text 
field
- add iframe as valid element

(cherry picked from commit f5ba5322de83327a2c475571be1d5cb35ee9f424)

- - - - -
a81e489d by Mathijs den Burger at 2016-08-05T14:07:13+02:00
CMS-10158 Bump copyright year, format code

- - - - -
750b20ef by Mathijs den Burger at 2016-08-05T14:08:07+02:00
CMS-10158 Reintegrate bugfix/CMS-10158b

- - - - -


1 changed file:

- 
editor/frontend/src/main/java/org/hippoecm/frontend/editor/validator/HtmlValidator.java


Changes:

=====================================
editor/frontend/src/main/java/org/hippoecm/frontend/editor/validator/HtmlValidator.java
=====================================
--- 
a/editor/frontend/src/main/java/org/hippoecm/frontend/editor/validator/HtmlValidator.java
+++ 
b/editor/frontend/src/main/java/org/hippoecm/frontend/editor/validator/HtmlValidator.java
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2009-2013 Hippo B.V. (http://www.onehippo.com)
+ *  Copyright 2009-2016 Hippo B.V. (http://www.onehippo.com)
  * 
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ public class HtmlValidator implements IClusterable {
 
     private static final long serialVersionUID = 1L;
 
-    public static final String[] VALID_ELEMENTS = new String[] {"img", 
"object", "embed", "form", "applet"};
+    public static final String[] VALID_ELEMENTS = new String[]{"img", 
"object", "embed", "form", "applet", "iframe"};
 
     static class Handler extends DefaultHandler {
         boolean valid = false;
@@ -43,7 +43,7 @@ public class HtmlValidator implements IClusterable {
         @Override
         public void characters(char[] chars, int start, int length) throws 
SAXException {
             String value = new String(chars, start, length).intern();
-            if(CharMatcher.INVISIBLE.negate().matchesAnyOf(value)) {
+            if (CharMatcher.INVISIBLE.negate().matchesAnyOf(value)) {
                 valid = true;
             }
         }
@@ -51,8 +51,8 @@ public class HtmlValidator implements IClusterable {
         @Override
         public void startElement(String namespaceURI, String localName, String 
qName, Attributes atts)
                 throws SAXException {
-            for(String element : VALID_ELEMENTS) {
-                if(element.equalsIgnoreCase(localName)) {
+            for (String element : VALID_ELEMENTS) {
+                if (element.equalsIgnoreCase(localName)) {
                     valid = true;
                     break;
                 }
@@ -65,7 +65,7 @@ public class HtmlValidator implements IClusterable {
     }
 
     public Set<String> validateNonEmpty(String html) throws 
ValidationException {
-        Set<String> result = new HashSet<String>();
+        Set<String> result = new HashSet<>();
         Handler handler = new Handler();
         try {
             InputSource is = new InputSource();



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-cms/compare/44c5b86e8fcc5079a23f6bf6f5612eb0a9496d3b...750b20ef67433e5fa120b9d0292e4a331471b635
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to