diff --git a/ide/html.validation/external/binaries-list b/ide/html.validation/external/binaries-list index 853738ed15d0..2d81ebf904a7 100644 --- a/ide/html.validation/external/binaries-list +++ b/ide/html.validation/external/binaries-list @@ -16,8 +16,7 @@ # under the License. CC78B59E2539C78AF923C12939D8D1CDE44B5CC1 com.hp.hpl.jena:iri:0.8 483A61B688B13C62BB201A683D98A6688B5373B6 jing-0unknown.jar -F0A0D2E29ED910808C33135A3A5A51BBA6358F7B log4j:log4j:1.2.15 -2EF7FD1E7A714E04EF0881FB451CC4E85AD3D23F validator-20200626-patched.jar +4BC279C404401D55DF1811A08A43ACF8BC06FB92 https://doppel-helix.eu/4BC279C404401D55DF1811A08A43ACF8BC06FB92-validator-20200626-patched2.jar validator-20200626-patched2.jar FACC6D84B0B0A650B1D44FED941E9ADD9F326862 isorelax-20041111.jar FF0A7D89CE99F8D9EACDDC9D5D0B154462CA9935 com.shapesecurity:salvation:2.7.2 FCF9C70F53B9C0E7BC723F43558488BF58390B33 nu.validator:galimatias:0.1.3 diff --git a/ide/html.validation/external/log4j-1.2.15-license.txt b/ide/html.validation/external/log4j-1.2.15-license.txt deleted file mode 100644 index 2c6578a59d33..000000000000 --- a/ide/html.validation/external/log4j-1.2.15-license.txt +++ /dev/null @@ -1,209 +0,0 @@ -Name: Log4j -Description: Logging support library -Version: 1.2.15 -Origin: Apache Software Foundation -License: Apache-2.0 -URL: http://logging.apache.org/log4j/ - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/ide/html.validation/external/validator-20200626.patch b/ide/html.validation/external/validator-20200626-0001-nb-patch1.patch similarity index 97% rename from ide/html.validation/external/validator-20200626.patch rename to ide/html.validation/external/validator-20200626-0001-nb-patch1.patch index d504cded7153..d2f1539a2f89 100644 --- a/ide/html.validation/external/validator-20200626.patch +++ b/ide/html.validation/external/validator-20200626-0001-nb-patch1.patch @@ -1,22 +1,41 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# https://github.com/validator/validator -# parent 787a7a7e972719edf7a79009d768f5111e1d93bc +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Base commit: 787a7a7e972719edf7a79009d768f5111e1d93bc + +--- + build/build.py | 1 + + .../checker/schematronequiv/Assertions.java | 152 +----- + src/nu/validator/datatype/IriRef.java | 93 ---- + src/nu/validator/datatype/Language.java | 2 +- + src/nu/validator/datatype/MediaQuery.java | 55 -- + src/nu/validator/io/DataUri.java | 28 +- + .../LocalCacheEntityResolver.java | 9 +- + src/nu/validator/localentities/presets | 10 + + .../BufferingRootNamespaceSniffer.java | 171 +++++++ + .../messages/RootNamespaceSniffer.java | 124 +++++ + .../messages/ValidationTransaction.java | 471 ++++++++++++++++++ + src/nu/validator/xml/BaseUriTracker.java | 70 ++- + .../validator/xml/DataUriEntityResolver.java | 18 +- + 13 files changed, 864 insertions(+), 340 deletions(-) + create mode 100644 src/nu/validator/localentities/presets + create mode 100644 src/nu/validator/messages/BufferingRootNamespaceSniffer.java + create mode 100644 src/nu/validator/messages/RootNamespaceSniffer.java + create mode 100644 src/nu/validator/messages/ValidationTransaction.java diff --git a/build/build.py b/build/build.py index 72145331..76d57d1e 100755 @@ -1521,3 +1540,6 @@ index ac905052..d9febbb5 100644 DataUri du = new DataUri(systemId); TypedInputSource is = contentTypeParser.buildTypedInputSource(systemId, publicId, du.getContentType()); +-- +2.37.2 + diff --git a/ide/html.validation/external/validator-20200626-0002-Remove-log4j-usage.patch b/ide/html.validation/external/validator-20200626-0002-Remove-log4j-usage.patch new file mode 100644 index 000000000000..461f111ade70 --- /dev/null +++ b/ide/html.validation/external/validator-20200626-0002-Remove-log4j-usage.patch @@ -0,0 +1,709 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Base commit: 787a7a7e972719edf7a79009d768f5111e1d93bc + +--- + .../checker/schematronequiv/Assertions.java | 11 +--- + .../messages/MessageEmitterAdapter.java | 10 ++-- + src/nu/validator/servlet/Main.java | 50 +++++----------- + src/nu/validator/servlet/VerifierServlet.java | 10 ++-- + .../servlet/VerifierServletTransaction.java | 59 ++++++++++--------- + src/nu/validator/source/LocationRecorder.java | 8 +-- + src/nu/validator/source/SourceCode.java | 6 +- + .../validation/SimpleDocumentValidator.java | 3 - + .../xml/PrudentHttpEntityResolver.java | 25 ++++---- + 9 files changed, 78 insertions(+), 104 deletions(-) + +diff --git a/src/nu/validator/checker/schematronequiv/Assertions.java b/src/nu/validator/checker/schematronequiv/Assertions.java +index 6aba4301..0f2da1af 100644 +--- a/src/nu/validator/checker/schematronequiv/Assertions.java ++++ b/src/nu/validator/checker/schematronequiv/Assertions.java +@@ -22,8 +22,6 @@ + + package nu.validator.checker.schematronequiv; + +-import java.io.ByteArrayInputStream; +-import java.io.StringReader; + import java.util.concurrent.ConcurrentHashMap; + import java.util.ArrayList; + import java.util.HashMap; +@@ -35,6 +33,7 @@ import java.util.Map; + import java.util.Set; + import java.util.Arrays; + import java.util.Collections; ++import java.util.logging.Logger; + + import javax.servlet.http.HttpServletRequest; + +@@ -44,7 +43,6 @@ import nu.validator.checker.LocatorImpl; + import nu.validator.checker.TaintableLocatorImpl; + import nu.validator.checker.VnuBadAttrValueException; + import nu.validator.checker.VnuBadElementNameException; +-import nu.validator.client.TestRunner; + import nu.validator.datatype.AutocompleteDetailsAny; + import nu.validator.datatype.AutocompleteDetailsDate; + import nu.validator.datatype.AutocompleteDetailsEmail; +@@ -61,21 +59,16 @@ import nu.validator.datatype.ImageCandidateStringsWidthRequired; + import nu.validator.datatype.ImageCandidateStrings; + import nu.validator.datatype.ImageCandidateURL; + import nu.validator.htmlparser.impl.NCName; +-import nu.validator.messages.MessageEmitterAdapter; + + import org.relaxng.datatype.DatatypeException; + + import org.xml.sax.Attributes; + import org.xml.sax.Locator; + import org.xml.sax.SAXException; +-import org.xml.sax.SAXParseException; +- +-import org.apache.log4j.Logger; + + public class Assertions extends Checker { + +- private static final Logger log4j = // +- Logger.getLogger(Assertions.class); ++ private static final Logger log4j = Logger.getLogger(Assertions.class.getName()); + + private static boolean equalsIgnoreAsciiCase(String one, String other) { + if (other == null) { +diff --git a/src/nu/validator/messages/MessageEmitterAdapter.java b/src/nu/validator/messages/MessageEmitterAdapter.java +index 4d143d42..aa7e156c 100644 +--- a/src/nu/validator/messages/MessageEmitterAdapter.java ++++ b/src/nu/validator/messages/MessageEmitterAdapter.java +@@ -29,6 +29,7 @@ import java.util.HashSet; + import java.util.Iterator; + import java.util.LinkedList; + import java.util.List; ++import java.util.logging.Logger; + import java.util.Map; + import java.util.TreeMap; + import java.util.regex.Pattern; +@@ -80,13 +81,12 @@ import com.thaiopensource.relaxng.exceptions.UnfinishedElementOneOfException; + import com.thaiopensource.relaxng.exceptions.UnknownElementException; + import com.thaiopensource.xml.util.Name; + +-import org.apache.log4j.Logger; + import com.ibm.icu.text.Normalizer; + + @SuppressWarnings("unchecked") + public class MessageEmitterAdapter implements ErrorHandler { + +- private static final Logger log4j = Logger.getLogger(MessageEmitterAdapter.class); ++ private static final Logger log4j = Logger.getLogger(MessageEmitterAdapter.class.getName()); + + private final static Map WELL_KNOWN_NAMESPACES = new HashMap<>(); + +@@ -817,7 +817,7 @@ public class MessageEmitterAdapter implements ErrorHandler { + && msg != null + && (systemId.startsWith("http:") || systemId.startsWith("https:"))) { + log4j.info(zapLf(new StringBuilder() // +- .append(systemId).append('\t').append(msg))); ++ .append(systemId).append('\t').append(msg)).toString()); + } + if (errorsOnly && type.getSuperType() == "info") { + return; +@@ -1241,7 +1241,7 @@ public class MessageEmitterAdapter implements ErrorHandler { + if (humanReadable == null) { + if (loggingOk) { + log4j.info(new StringBuilder().append("UNKNOWN_NS:\t").append( +- ns)); ++ ns).toString()); + } + messageTextString(messageTextHandler, ELEMENT, atSentenceStart); + linkedCodeString(messageTextHandler, element.getLocalName(), +@@ -1287,7 +1287,7 @@ public class MessageEmitterAdapter implements ErrorHandler { + if (humanReadable == null) { + if (loggingOk) { + log4j.info(new StringBuilder().append("UNKNOWN_NS:\t").append( +- ns)); ++ ns).toString()); + } + messageTextString(messageTextHandler, ATTRIBUTE, + atSentenceStart); +diff --git a/src/nu/validator/servlet/Main.java b/src/nu/validator/servlet/Main.java +index 49c70181..1f154a4d 100644 +--- a/src/nu/validator/servlet/Main.java ++++ b/src/nu/validator/servlet/Main.java +@@ -38,13 +38,10 @@ import java.net.Socket; + import java.net.SocketException; + import java.util.EnumSet; + import java.util.Enumeration; ++import java.util.logging.Logger; + + import javax.servlet.DispatcherType; + +-import org.apache.log4j.ConsoleAppender; +-import org.apache.log4j.Logger; +-import org.apache.log4j.PatternLayout; +-import org.apache.log4j.PropertyConfigurator; + import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; + import org.eclipse.jetty.server.Connector; + import org.eclipse.jetty.server.HttpConfiguration; +@@ -88,19 +85,19 @@ public class Main { + private static final void emitStartupMessage(Logger log4j, String host, + int port) { + if (isRunningInsideDockerContainer()) { +- log4j.debug(""); +- log4j.debug("Checker service started."); ++ log4j.fine(""); ++ log4j.fine("Checker service started."); + return; + } + String ip; +- log4j.debug(""); +- log4j.debug("WARNING: Future checker releases will bind by default to" ++ log4j.fine(""); ++ log4j.fine("WARNING: Future checker releases will bind by default to" + + " 127.0.0.1."); +- log4j.debug("Your checker deployment might become unreachable unless" ++ log4j.fine("Your checker deployment might become unreachable unless" + + " you use the"); +- log4j.debug("nu.validator.servlet.bind-address system property or" ++ log4j.fine("nu.validator.servlet.bind-address system property or" + + " --bind-address"); +- log4j.debug("script option to bind the checker to a different" ++ log4j.fine("script option to bind the checker to a different" + + " address:"); + try { + Enumeration interfaces = // +@@ -114,18 +111,18 @@ public class Main { + InetAddress addr = addresses.nextElement(); + ip = addr.getHostAddress(); + if (addr instanceof Inet4Address) { +- log4j.debug(""); +- log4j.debug(String.format( ++ log4j.fine(""); ++ log4j.fine(String.format( + " python ./checker.py --bind-address %s run", + ip)); +- log4j.debug(String.format(" java" ++ log4j.fine(String.format(" java" + + " -Dnu.validator.servlet.bind-address=%s" + + " -cp vnu.jar" + + " nu.validator.servlet.Main 8888", ip)); +- log4j.debug(String.format(" vnu-runtime-image/bin/java" ++ log4j.fine(String.format(" vnu-runtime-image/bin/java" + + " -Dnu.validator.servlet.bind-address=%s" + + " nu.validator.servlet.Main 8888", ip)); +- log4j.debug(String.format( ++ log4j.fine(String.format( + " vnu-runtime-image\\bin\\java.exe" + + " -Dnu.validator.servlet.bind-address=%s" + + " nu.validator.servlet.Main 8888", +@@ -136,28 +133,13 @@ public class Main { + } catch (SocketException e) { + throw new RuntimeException(e); + } +- log4j.debug(""); +- log4j.debug(String.format("Checker service started at http://%s:%s/", ++ log4j.fine(""); ++ log4j.fine(String.format("Checker service started at http://%s:%s/", + host, port)); + } + + public static void main(String[] args) throws Exception { +- if (!"1".equals(System.getProperty( +- "nu.validator.servlet.read-local-log4j-properties"))) { +- PropertyConfigurator.configure( +- Main.class.getClassLoader().getResource( +- "nu/validator/localentities/files/log4j.properties")); +- } else { +- PropertyConfigurator.configure( +- System.getProperty("nu.validator.servlet.log4j-properties", +- "log4j.properties")); +- } +- Logger log4j = Logger.getLogger(Main.class); +- ConsoleAppender console = new ConsoleAppender(); +- console.setLayout(new PatternLayout("%m%n")); +- console.activateOptions(); +- log4j.setAdditivity(false); +- log4j.addAppender(console); ++ Logger log4j = Logger.getLogger(Main.class.getName()); + + ServletContextHandler contextHandler = new ServletContextHandler(); + contextHandler.setContextPath("/"); +diff --git a/src/nu/validator/servlet/VerifierServlet.java b/src/nu/validator/servlet/VerifierServlet.java +index 8da1aaf1..a7fc9247 100644 +--- a/src/nu/validator/servlet/VerifierServlet.java ++++ b/src/nu/validator/servlet/VerifierServlet.java +@@ -28,6 +28,7 @@ import java.io.InputStream; + import java.io.OutputStream; + import java.io.ByteArrayOutputStream; + import java.io.UnsupportedEncodingException; ++import java.util.logging.Logger; + + import javax.servlet.ServletException; + import javax.servlet.http.HttpServlet; +@@ -37,9 +38,6 @@ import javax.servlet.http.HttpServletResponse; + import nu.validator.messages.MessageEmitterAdapter; + import nu.validator.xml.PrudentHttpEntityResolver; + +-import org.apache.log4j.Logger; +- +- + /** + * @version $Id$ + * @author hsivonen +@@ -50,7 +48,7 @@ public class VerifierServlet extends HttpServlet { + */ + private static final long serialVersionUID = 7811043632732680935L; + +- private static final Logger log4j = Logger.getLogger(VerifierServlet.class); ++ private static final Logger log4j = Logger.getLogger(VerifierServlet.class.getName()); + + static final String GENERIC_HOST = System.getProperty("nu.validator.servlet.host.generic", ""); + +@@ -272,8 +270,8 @@ public class VerifierServlet extends HttpServlet { + response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED); + return; + } +- log4j.debug("pathInfo: " + pathInfo); +- log4j.debug("serverName: " + serverName); ++ log4j.fine("pathInfo: " + pathInfo); ++ log4j.fine("serverName: " + serverName); + + if ("validator.nu".equals(serverName) && "/html5/".equals(pathInfo)) { + response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY); +diff --git a/src/nu/validator/servlet/VerifierServletTransaction.java b/src/nu/validator/servlet/VerifierServletTransaction.java +index 358bdc62..6c60ee1c 100644 +--- a/src/nu/validator/servlet/VerifierServletTransaction.java ++++ b/src/nu/validator/servlet/VerifierServletTransaction.java +@@ -43,6 +43,8 @@ import java.util.HashSet; + import java.util.LinkedHashSet; + import java.util.LinkedList; + import java.util.List; ++import java.util.logging.Level; ++import java.util.logging.Logger; + import java.util.Map; + import java.util.Properties; + import java.util.Set; +@@ -135,7 +137,6 @@ import com.thaiopensource.validate.prop.wrap.WrapProperty; + import com.thaiopensource.validate.rng.CompactSchemaReader; + + import org.apache.http.conn.ConnectTimeoutException; +-import org.apache.log4j.Logger; + + import com.ibm.icu.text.Normalizer; + +@@ -150,7 +151,7 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + HTML, XHTML, TEXT, XML, JSON, RELAXED, SOAP, UNICORN, GNU + } + +- private static final Logger log4j = Logger.getLogger(VerifierServletTransaction.class); ++ private static final Logger log4j = Logger.getLogger(VerifierServletTransaction.class.getName()); + + private static final Pattern SPACE = Pattern.compile("\\s+"); + +@@ -418,7 +419,7 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + + static { + try { +- log4j.debug("Starting static initializer."); ++ log4j.fine("Starting static initializer."); + + lastModified = 0; + BufferedReader r = new BufferedReader(new InputStreamReader(LocalCacheEntityResolver.getPresetsAsStream(), "UTF-8")); +@@ -429,7 +430,7 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + List urls = new LinkedList<>(); + Properties props = new Properties(); + +- log4j.debug("Reading miscellaneous properties."); ++ log4j.fine("Reading miscellaneous properties."); + + props.load(VerifierServlet.class.getClassLoader().getResourceAsStream( + "nu/validator/localentities/files/misc.properties")); +@@ -448,7 +449,7 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + props.getProperty("nu.validator.servlet.user-agent", + "Validator.nu/LV"))); + +- log4j.debug("Starting to loop over config file lines."); ++ log4j.fine("Starting to loop over config file lines."); + + while ((line = r.readLine()) != null) { + if ("".equals(line.trim())) { +@@ -461,14 +462,14 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + urls.add(s[3]); + } + +- log4j.debug("Finished reading config."); ++ log4j.fine("Finished reading config."); + + String[] presetDoctypesAsStrings = doctypes.toArray(new String[0]); + presetNamespaces = namespaces.toArray(new String[0]); + presetLabels = labels.toArray(new String[0]); + presetUrls = urls.toArray(new String[0]); + +- log4j.debug("Converted config to arrays."); ++ log4j.fine("Converted config to arrays."); + + for (int i = 0; i < presetNamespaces.length; i++) { + String str = presetNamespaces[i]; +@@ -479,18 +480,18 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + } + } + +- log4j.debug("Prepared namespace array."); ++ log4j.fine("Prepared namespace array."); + + presetDoctypes = new int[presetDoctypesAsStrings.length]; + for (int i = 0; i < presetDoctypesAsStrings.length; i++) { + presetDoctypes[i] = Integer.parseInt(presetDoctypesAsStrings[i]); + } + +- log4j.debug("Parsed doctype numbers into ints."); ++ log4j.fine("Parsed doctype numbers into ints."); + + String prefix = System.getProperty("nu.validator.servlet.cachepathprefix"); + +- log4j.debug("The cache path prefix is: " + prefix); ++ log4j.fine("The cache path prefix is: " + prefix); + + ErrorHandler eh = new SystemErrErrorHandler(); + LocalCacheEntityResolver er = new LocalCacheEntityResolver(new NullEntityResolver()); +@@ -503,7 +504,7 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + RngProperty.CHECK_ID_IDREF.add(pmb); + PropertyMap pMap = pmb.toPropertyMap(); + +- log4j.debug("Parsing set up. Starting to read schemas."); ++ log4j.fine("Parsing set up. Starting to read schemas."); + + SortedMap schemaMap = new TreeMap<>(); + +@@ -553,7 +554,7 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + } + } + +- log4j.debug("Schemas read."); ++ log4j.fine("Schemas read."); + + preloadedSchemaUrls = new String[schemaMap.size()]; + preloadedSchemas = new Schema[schemaMap.size()]; +@@ -582,14 +583,14 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + i++; + } + +- log4j.debug("Reading spec."); ++ log4j.fine("Reading spec."); + + html5spec = Html5SpecBuilder.parseSpec(LocalCacheEntityResolver.getHtml5SpecAsStream()); + +- log4j.debug("Spec read."); ++ log4j.fine("Spec read."); + + if (new File(FILTER_FILE).isFile()) { +- log4j.debug("Reading filter file " + FILTER_FILE); ++ log4j.fine("Reading filter file " + FILTER_FILE); + try (BufferedReader reader = new BufferedReader( + new InputStreamReader(new FileInputStream(FILTER_FILE), + "UTF-8"))) { +@@ -612,7 +613,7 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + } + } + } +- log4j.debug("Filter file read."); ++ log4j.fine("Filter file read."); + } + } catch (Exception e) { + throw new RuntimeException(e); +@@ -719,7 +720,7 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + try { + request.setCharacterEncoding("utf-8"); + } catch (NoSuchMethodError e) { +- log4j.debug("Vintage Servlet API doesn't support setCharacterEncoding().", e); ++ log4j.log(Level.FINE, "Vintage Servlet API doesn't support setCharacterEncoding().", e); + } + + if (!methodIsGet) { +@@ -978,7 +979,7 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + validate(); + } + } catch (SAXException e) { +- log4j.debug("SAXException: " + e.getMessage()); ++ log4j.fine("SAXException: " + e.getMessage()); + } + } + +@@ -1167,11 +1168,11 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + } + } catch (CannotFindPresetSchemaException e) { + } catch (ResourceNotRetrievableException e) { +- log4j.debug(e.getMessage()); ++ log4j.fine(e.getMessage()); + } catch (NonXmlContentTypeException e) { +- log4j.debug(e.getMessage()); ++ log4j.fine(e.getMessage()); + } catch (FatalSAXException e) { +- log4j.debug(e.getMessage()); ++ log4j.fine(e.getMessage()); + } catch (SocketTimeoutException e) { + errorHandler.ioError(new IOException(e.getMessage(), null)); + } catch (ConnectTimeoutException e) { +@@ -1181,28 +1182,28 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + } catch (SAXException e) { + String msg = e.getMessage(); + if (!cannotRecover.equals(msg) && !changingEncoding.equals(msg)) { +- log4j.debug("SAXException: " + e.getMessage()); ++ log4j.fine("SAXException: " + e.getMessage()); + } + } catch (IOException e) { + isHtmlOrXhtml = false; + if (e.getCause() instanceof org.apache.http.TruncatedChunkException) { +- log4j.debug("TruncatedChunkException", e.getCause()); ++ log4j.log(Level.FINE, "TruncatedChunkException", e.getCause()); + } else { + errorHandler.ioError(e); + } + } catch (IncorrectSchemaException e) { +- log4j.debug("IncorrectSchemaException", e); ++ log4j.log(Level.FINE, "IncorrectSchemaException", e); + errorHandler.schemaError(e); + } catch (RuntimeException e) { + isHtmlOrXhtml = false; +- log4j.error("RuntimeException, doc: " + document + " schema: " ++ log4j.log(Level.SEVERE, "RuntimeException, doc: " + document + " schema: " + + schemaUrls + " lax: " + laxType, e); + errorHandler.internalError( + e, + "Oops. That was not supposed to happen. A bug manifested itself in the application internals. Unable to continue. Sorry. The admin was notified."); + } catch (Error e) { + isHtmlOrXhtml = false; +- log4j.error("Error, doc: " + document + " schema: " + schemaUrls ++ log4j.log(Level.SEVERE, "Error, doc: " + document + " schema: " + schemaUrls + + " lax: " + laxType, e); + errorHandler.internalError( + e, +@@ -1448,7 +1449,7 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + try { + stats.incrementField(stats.getFieldFromName(fieldName)); + } catch (IllegalArgumentException e) { +- log4j.error(e.getMessage(), e); ++ log4j.log(Level.SEVERE, e.getMessage(), e); + } + } + String langVal = (String) request.getAttribute( +@@ -1834,13 +1835,13 @@ class VerifierServletTransaction implements DocumentModeHandler, SchemaResolver + private static Schema schemaByUrl(String url, EntityResolver resolver, + PropertyMap pMap) throws SAXException, IOException, + IncorrectSchemaException { +- log4j.debug("Will load schema: " + url); ++ log4j.fine("Will load schema: " + url); + TypedInputSource schemaInput; + try { + schemaInput = (TypedInputSource) resolver.resolveEntity( + null, url); + } catch (ClassCastException e) { +- log4j.fatal(url, e); ++ log4j.log(Level.SEVERE, url, e); + throw e; + } + SchemaReader sr = null; +diff --git a/src/nu/validator/source/LocationRecorder.java b/src/nu/validator/source/LocationRecorder.java +index efdeb1fb..a296a656 100644 +--- a/src/nu/validator/source/LocationRecorder.java ++++ b/src/nu/validator/source/LocationRecorder.java +@@ -22,7 +22,7 @@ + + package nu.validator.source; + +-import org.apache.log4j.Logger; ++import java.util.logging.Logger; + import org.xml.sax.Attributes; + import org.xml.sax.ContentHandler; + import org.xml.sax.Locator; +@@ -30,7 +30,7 @@ import org.xml.sax.SAXException; + import org.xml.sax.ext.LexicalHandler; + + final class LocationRecorder implements ContentHandler, LexicalHandler { +- private static final Logger log4j = Logger.getLogger(LocationRecorder.class); ++ private static final Logger log4j = Logger.getLogger(LocationRecorder.class.getName()); + + private final SourceCode owner; + +@@ -51,7 +51,7 @@ final class LocationRecorder implements ContentHandler, LexicalHandler { + private void addLocatorLocation() { + if (locator != null) { + String systemId = locator.getSystemId(); +- log4j.debug(systemId); ++ log4j.fine(systemId); + if (uri == systemId || (uri != null && uri.equals(systemId))) { + owner.addLocatorLocation(locator.getLineNumber(), locator.getColumnNumber()); + } +@@ -97,7 +97,7 @@ final class LocationRecorder implements ContentHandler, LexicalHandler { + @Override + public void setDocumentLocator(Locator locator) { + this.locator = locator; +- log4j.debug(locator); ++ log4j.fine(String.valueOf(locator)); + } + + @Override +diff --git a/src/nu/validator/source/SourceCode.java b/src/nu/validator/source/SourceCode.java +index b7dcfb43..de50ce9d 100644 +--- a/src/nu/validator/source/SourceCode.java ++++ b/src/nu/validator/source/SourceCode.java +@@ -28,20 +28,20 @@ import java.util.Iterator; + import java.util.LinkedList; + import java.util.List; + import java.util.SortedSet; ++import java.util.logging.Logger; + + import nu.validator.collections.HeadBiasedSortedSet; + import nu.validator.collections.TailBiasedSortedSet; + import nu.validator.htmlparser.common.CharacterHandler; + import nu.validator.xml.TypedInputSource; + +-import org.apache.log4j.Logger; + import org.xml.sax.ContentHandler; + import org.xml.sax.InputSource; + import org.xml.sax.Locator; + import org.xml.sax.SAXException; + + public final class SourceCode implements CharacterHandler { +- private static final Logger log4j = Logger.getLogger(SourceCode.class); ++ private static final Logger log4j = Logger.getLogger(SourceCode.class.getName()); + + private static Location[] SOURCE_LOCATION_ARRAY_TYPE = new Location[0]; + +@@ -183,7 +183,7 @@ public final class SourceCode implements CharacterHandler { + } + + public void addLocatorLocation(int oneBasedLine, int oneBasedColumn) { +- log4j.debug(oneBasedLine + ", " + oneBasedColumn); ++ log4j.fine(oneBasedLine + ", " + oneBasedColumn); + reverseSortedLocations.add(new Location(this, oneBasedLine - 1, + oneBasedColumn - 1)); + } +diff --git a/src/nu/validator/validation/SimpleDocumentValidator.java b/src/nu/validator/validation/SimpleDocumentValidator.java +index f9600817..b57404a5 100644 +--- a/src/nu/validator/validation/SimpleDocumentValidator.java ++++ b/src/nu/validator/validation/SimpleDocumentValidator.java +@@ -79,8 +79,6 @@ import com.thaiopensource.validate.prop.rng.RngProperty; + import com.thaiopensource.validate.rng.CompactSchemaReader; + import com.thaiopensource.xml.sax.Jaxp11XMLReaderCreator; + +-import org.apache.log4j.PropertyConfigurator; +- + import java.net.*; + import java.util.ArrayList; + import java.util.Collections; +@@ -227,7 +225,6 @@ public class SimpleDocumentValidator { + "log4j.logger.nu.validator.xml.PrudentHttpEntityResolver", + "FATAL"); + } +- PropertyConfigurator.configure(properties); + } catch (IOException e) { + e.printStackTrace(); + } +diff --git a/src/nu/validator/xml/PrudentHttpEntityResolver.java b/src/nu/validator/xml/PrudentHttpEntityResolver.java +index f851bc32..22680402 100644 +--- a/src/nu/validator/xml/PrudentHttpEntityResolver.java ++++ b/src/nu/validator/xml/PrudentHttpEntityResolver.java +@@ -31,6 +31,8 @@ import java.security.NoSuchAlgorithmException; + import java.security.cert.CertificateException; + import java.security.cert.X509Certificate; + import java.util.zip.GZIPInputStream; ++import java.util.logging.Level; ++import java.util.logging.Logger; + + import javax.net.ssl.HostnameVerifier; + import javax.net.ssl.SSLContext; +@@ -64,7 +66,6 @@ import org.apache.http.impl.client.HttpClientBuilder; + import org.apache.http.impl.client.HttpClients; + import org.apache.http.impl.client.LaxRedirectStrategy; + import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +-import org.apache.log4j.Logger; + + import org.xml.sax.EntityResolver; + import org.xml.sax.ErrorHandler; +@@ -83,7 +84,7 @@ import io.mola.galimatias.GalimatiasParseException; + @SuppressWarnings("deprecation") public class PrudentHttpEntityResolver + implements EntityResolver { + +- private static final Logger log4j = Logger.getLogger(PrudentHttpEntityResolver.class); ++ private static final Logger log4j = Logger.getLogger(PrudentHttpEntityResolver.class.getName()); + + private static HttpClient client; + +@@ -380,14 +381,15 @@ import io.mola.galimatias.GalimatiasParseException; + + @Override + public void closeCalled() { +- log4j.debug("closeCalled"); ++ log4j.fine("closeCalled"); + if (!released) { +- log4j.debug("closeCalled, not yet released"); ++ log4j.fine("closeCalled, not yet released"); + released = true; + try { + meth.releaseConnection(); + } catch (Exception e) { +- log4j.debug( ++ log4j.log( ++ Level.FINE, + "closeCalled, releaseConnection", e); + } + } +@@ -401,12 +403,13 @@ import io.mola.galimatias.GalimatiasParseException; + try { + meth.abort(); + } catch (Exception e) { +- log4j.debug("exceptionOccurred, abort", e); ++ log4j.log(Level.FINE, "exceptionOccurred, abort", e); + } finally { + try { + meth.releaseConnection(); + } catch (Exception e) { +- log4j.debug( ++ log4j.log( ++ Level.FINE, + "exceptionOccurred, releaseConnection", + e); + } +@@ -434,12 +437,12 @@ import io.mola.galimatias.GalimatiasParseException; + try { + meth.abort(); + } catch (Exception e) { +- log4j.debug("finalizerCalled, abort", e); ++ log4j.log(Level.FINE, "finalizerCalled, abort", e); + } finally { + try { + meth.releaseConnection(); + } catch (Exception e) { +- log4j.debug( ++ log4j.log(Level.FINE, + "finalizerCalled, releaseConnection", + e); + } +@@ -454,12 +457,12 @@ import io.mola.galimatias.GalimatiasParseException; + try { + m.abort(); + } catch (Exception ex) { +- log4j.debug("abort", ex); ++ log4j.log(Level.FINE, "abort", ex); + } finally { + try { + m.releaseConnection(); + } catch (Exception ex) { +- log4j.debug("releaseConnection", ex); ++ log4j.log(Level.FINE, "releaseConnection", ex); + } + } + } +-- +2.37.2 + diff --git a/ide/html.validation/external/validator-howto-build.txt b/ide/html.validation/external/validator-howto-build.txt index 49708f9d2a24..c2c6795252c8 100644 --- a/ide/html.validation/external/validator-howto-build.txt +++ b/ide/html.validation/external/validator-howto-build.txt @@ -5,11 +5,14 @@ git clone https://github.com/validator/validator.git cd validator git checkout 787a7a7e972719edf7a79009d768f5111e1d93bc -git apply ../validator-20200626.patch -python3 checker.py all -# ignore the error messages +git apply $NETBEANS_SOURCE/ide/html.validation/external/validator-20200626-0001-nb-patch1.patch +git apply $NETBEANS_SOURCE/ide/html.validation/external/validator-20200626-0002-Remove-log4j-usage.patch +export JAVA_HOME= +git submodule init +git submodule update --depth 1 +python3 checker.py dldeps build cd jars -mv validator.jar validator-20200626-patched.jar -sha1sum validator-20200626-patched.jar | awk '{print "mv "$2" "toupper($1)"-"$2}' | sh +mv validator.jar validator-20200626-patched2.jar +sha1sum validator-20200626-patched2.jar | awk '{print "mv "$2" "toupper($1)"-"$2}' | sh # At this point the directory cotains a build of the validator in the format # needed for the upload to the netbeans.osuosl.org \ No newline at end of file diff --git a/ide/html.validation/nbproject/project.properties b/ide/html.validation/nbproject/project.properties index 1297c3b89901..ae91acceb383 100644 --- a/ide/html.validation/nbproject/project.properties +++ b/ide/html.validation/nbproject/project.properties @@ -18,7 +18,7 @@ file.reference.iri-0.8.jar=external/iri-0.8.jar file.reference.jing-0unknown.jar=external/jing-0unknown.jar file.reference.log4j-1.2.15.jar=external/log4j-1.2.15.jar -file.reference.validator-20200626-patched.jar=external/validator-20200626-patched.jar +file.reference.validator-20200626-patched2.jar=external/validator-20200626-patched2.jar file.reference.isorelax-20041111.jar=external/isorelax-20041111.jar file.reference.salvation-2.7.2.jar=external/salvation-2.7.2.jar file.reference.galimatias-0.1.3.jar=external/galimatias-0.1.3.jar @@ -26,8 +26,7 @@ file.reference.langdetect-1.2.jar=external/langdetect-1.2.jar release.external/iri-0.8.jar=modules/ext/iri.jar release.external/jing-0unknown.jar=modules/ext/jing.jar -release.external/log4j-1.2.15.jar=modules/ext/log4j-1.2.15.jar -release.external/validator-20200626-patched.jar=modules/ext/validator.jar +release.external/validator-20200626-patched2.jar=modules/ext/validator.jar release.external/isorelax-20041111.jar=modules/ext/isorelax.jar release.external/salvation-2.7.2.jar=modules/ext/salvation.jar release.external/galimatias-0.1.3.jar=modules/ext/galimatias.jar diff --git a/ide/html.validation/nbproject/project.xml b/ide/html.validation/nbproject/project.xml index 64c804051a21..cec40f438dd4 100644 --- a/ide/html.validation/nbproject/project.xml +++ b/ide/html.validation/nbproject/project.xml @@ -159,17 +159,13 @@ ext/jing.jar external/jing-0unknown.jar - - ext/log4j-1.2.15.jar - external/log4j-1.2.15.jar - ext/iri.jar external/iri-0.8.jar ext/validator.jar - external/validator-20200626-patched.jar + external/validator-20200626-patched2.jar ext/isorelax.jar