This is an automated email from the ASF dual-hosted git repository.

matthiasblaesing pushed a commit to branch release90
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git

commit 399b124dcc6d2eeeee938447174d37f41d1c56d9
Author: Matthias Bläsing <mblaes...@doppel-helix.eu>
AuthorDate: Wed Jun 27 19:31:54 2018 +0200

    [NETBEANS-853] Remove DTD files from maven.coverage
    
    The license situation around the DTDs is unclear and as the DTDs don't
    contain entity definitions, so they are not strictly necessary to parse
    the XML files
    
    Entity resolver is overriden to prevent retrieval of the cobertura DTDs
    via network calls.
---
 maven.coverage/licenseinfo.xml                     | 32 ---------
 .../maven/coverage/MavenCoverageProvider.java      | 22 +++---
 .../modules/maven/coverage/coverage-04.dtd         | 60 ----------------
 .../netbeans/modules/maven/coverage/jacoco-1.0.dtd | 84 ----------------------
 4 files changed, 11 insertions(+), 187 deletions(-)

diff --git a/maven.coverage/licenseinfo.xml b/maven.coverage/licenseinfo.xml
deleted file mode 100644
index c29f4ae..0000000
--- a/maven.coverage/licenseinfo.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    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.
-
--->
-<licenseinfo>
-    <fileset>
-        <file>src/org/netbeans/modules/maven/coverage/coverage-04.dtd</file>
-        <license ref="ISO-8879-SGML" />
-    </fileset>
-    <fileset>
-        <file>src/org/netbeans/modules/maven/coverage/jacoco-1.0.dtd</file>
-        <license ref="EPL-v10" />
-        <comment type="CATEGORY_B">Used by XML parser at runtime.</comment>
-    </fileset>
-</licenseinfo>
diff --git 
a/maven.coverage/src/org/netbeans/modules/maven/coverage/MavenCoverageProvider.java
 
b/maven.coverage/src/org/netbeans/modules/maven/coverage/MavenCoverageProvider.java
index a9075cd..5663591 100644
--- 
a/maven.coverage/src/org/netbeans/modules/maven/coverage/MavenCoverageProvider.java
+++ 
b/maven.coverage/src/org/netbeans/modules/maven/coverage/MavenCoverageProvider.java
@@ -19,6 +19,7 @@
 
 package org.netbeans.modules.maven.coverage;
 
+import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -199,17 +200,16 @@ public final class MavenCoverageProvider implements 
CoverageProvider {
             return null;
         }
         try {
-            org.w3c.dom.Document report = XMLUtil.parse(new 
InputSource(r.toURI().toString()), true, false, XMLUtil.defaultErrorHandler(), 
new EntityResolver() {
-                                     public @Override InputSource 
resolveEntity(String publicId, String systemId) throws SAXException, 
IOException {
-                                         if 
(systemId.equals("http://cobertura.sourceforge.net/xml/coverage-04.dtd";)) {
-                                             return new 
InputSource(MavenCoverageProvider.class.getResourceAsStream("coverage-04.dtd"));
 // NOI18N
-                                         } else if 
(publicId.equals("-//JACOCO//DTD Report 1.0//EN")) {
-                                             return new 
InputSource(MavenCoverageProvider.class.getResourceAsStream("jacoco-1.0.dtd"));
-                                         } else {
-                                             return null;
-                                         }
-                                     }
-                                 });
+            // Entity resolver is overriden to prevent retrieval of the 
cobertura
+            // DTDs. The license situation around the DTDs is unclear and as 
the
+            // DTDs don't contain entity definitions, they are not strictly
+            // necessary to parse the XML files
+            org.w3c.dom.Document report = XMLUtil.parse(new 
InputSource(r.toURI().toString()), false, false, XMLUtil.defaultErrorHandler(), 
new EntityResolver() {
+                @Override
+                public InputSource resolveEntity(String publicId, String 
systemId) throws SAXException, IOException {
+                    return new InputSource(new ByteArrayInputStream(new 
byte[0]));
+                }
+            });
             LOG.log(Level.FINE, "parsed {0}", r);
             return Pair.of(r, report);
         } catch (/*IO,SAX*/Exception x) {
diff --git 
a/maven.coverage/src/org/netbeans/modules/maven/coverage/coverage-04.dtd 
b/maven.coverage/src/org/netbeans/modules/maven/coverage/coverage-04.dtd
deleted file mode 100644
index e5a21bb..0000000
--- a/maven.coverage/src/org/netbeans/modules/maven/coverage/coverage-04.dtd
+++ /dev/null
@@ -1,60 +0,0 @@
-<!-- Portions (C) International Organization for Standardization 1986:
-     Permission to copy in any form is granted for use with
-     conforming SGML systems and applications as defined in
-     ISO 8879, provided this notice is included in all copies.
--->
-
-<!ELEMENT coverage (sources?,packages)>
-<!ATTLIST coverage line-rate        CDATA #REQUIRED>
-<!ATTLIST coverage branch-rate      CDATA #REQUIRED>
-<!ATTLIST coverage lines-covered    CDATA #REQUIRED>
-<!ATTLIST coverage lines-valid      CDATA #REQUIRED>
-<!ATTLIST coverage branches-covered CDATA #REQUIRED>
-<!ATTLIST coverage branches-valid   CDATA #REQUIRED>
-<!ATTLIST coverage complexity       CDATA #REQUIRED>
-<!ATTLIST coverage version          CDATA #REQUIRED>
-<!ATTLIST coverage timestamp        CDATA #REQUIRED>
-
-<!ELEMENT sources (source*)>
-
-<!ELEMENT source (#PCDATA)>
-
-<!ELEMENT packages (package*)>
-
-<!ELEMENT package (classes)>
-<!ATTLIST package name        CDATA #REQUIRED>
-<!ATTLIST package line-rate   CDATA #REQUIRED>
-<!ATTLIST package branch-rate CDATA #REQUIRED>
-<!ATTLIST package complexity  CDATA #REQUIRED>
-
-<!ELEMENT classes (class*)>
-
-<!ELEMENT class (methods,lines)>
-<!ATTLIST class name        CDATA #REQUIRED>
-<!ATTLIST class filename    CDATA #REQUIRED>
-<!ATTLIST class line-rate   CDATA #REQUIRED>
-<!ATTLIST class branch-rate CDATA #REQUIRED>
-<!ATTLIST class complexity  CDATA #REQUIRED>
-
-<!ELEMENT methods (method*)>
-
-<!ELEMENT method (lines)>
-<!ATTLIST method name        CDATA #REQUIRED>
-<!ATTLIST method signature   CDATA #REQUIRED>
-<!ATTLIST method line-rate   CDATA #REQUIRED>
-<!ATTLIST method branch-rate CDATA #REQUIRED>
-
-<!ELEMENT lines (line*)>
-
-<!ELEMENT line (conditions*)>
-<!ATTLIST line number CDATA #REQUIRED>
-<!ATTLIST line hits   CDATA #REQUIRED>
-<!ATTLIST line branch CDATA "false">
-<!ATTLIST line condition-coverage CDATA "100%">
-
-<!ELEMENT conditions (condition*)>
-
-<!ELEMENT condition EMPTY>
-<!ATTLIST condition number CDATA #REQUIRED>
-<!ATTLIST condition type CDATA #REQUIRED>
-<!ATTLIST condition coverage CDATA #REQUIRED>
diff --git 
a/maven.coverage/src/org/netbeans/modules/maven/coverage/jacoco-1.0.dtd 
b/maven.coverage/src/org/netbeans/modules/maven/coverage/jacoco-1.0.dtd
deleted file mode 100644
index 5e6184a..0000000
--- a/maven.coverage/src/org/netbeans/modules/maven/coverage/jacoco-1.0.dtd
+++ /dev/null
@@ -1,84 +0,0 @@
-<!-- 
-   Copyright (c) 2009, 2012 Mountainminds GmbH & Co. KG and Contributors
-   All rights reserved. This program and the accompanying materials
-   are made available under the terms of the Eclipse Public License v1.0
-   which accompanies this distribution, and is available at
-   http://www.eclipse.org/legal/epl-v10.html
-     
-   Contributors:
-      Brock Janiczak - initial API and implementation
-      Marc R. Hoffmann - generalized report structure, line info, documentation
-      
-   $Id: $
--->
-
-<!-- This DTD describes the JaCoCo XML report format. It is identified by the
-     following identifiers:
-
-        PUBID  = "-//JACOCO//DTD Report 1.0//EN"
-        SYSTEM = "report.dtd"
--->
-
-<!-- report root node -->
-<!ELEMENT report (sessioninfo*, (group* | package*), counter*)>
-  <!ATTLIST report name CDATA #REQUIRED>
-
-<!-- information about a session which contributed execution data -->
-<!ELEMENT sessioninfo EMPTY>
-  <!-- session id -->
-  <!ATTLIST sessioninfo id CDATA #REQUIRED>
-  <!-- start time stamp -->
-  <!ATTLIST sessioninfo start CDATA #REQUIRED>
-  <!-- dump time stamp -->
-  <!ATTLIST sessioninfo dump CDATA #REQUIRED>
-
-<!-- representation of a group -->
-<!ELEMENT group ((group* | package*), counter*)>
-  <!-- group name -->
-  <!ATTLIST group name CDATA #REQUIRED>
-
-<!-- representation of a package -->
-<!ELEMENT package ((class | sourcefile)*, counter*)>
-  <!-- package name in VM notation -->
-  <!ATTLIST package name CDATA #REQUIRED>
-
-<!-- representation of a class -->
-<!ELEMENT class (method*, counter*)>
-  <!-- fully qualified VM name -->
-  <!ATTLIST class name CDATA #REQUIRED>
-
-<!-- representation of a method -->
-<!ELEMENT method (counter*)>
-  <!-- method name -->
-  <!ATTLIST method name CDATA #REQUIRED>
-  <!-- method parameter description -->
-  <!ATTLIST method desc CDATA #REQUIRED>
-  <!-- first source line number of this method -->
-  <!ATTLIST method line CDATA #IMPLIED>
-  
-<!-- representation of a source file -->
-<!ELEMENT sourcefile (line*, counter*)>
-  <!-- local source file name -->
-  <!ATTLIST sourcefile name CDATA #REQUIRED>
-
-<!-- representation of a source line -->
-<!ELEMENT line EMPTY>
-  <!-- line number -->
-  <!ATTLIST line nr CDATA #REQUIRED>
-  <!-- number of missed instructions -->
-  <!ATTLIST line mi CDATA #IMPLIED>
-  <!-- number of covered instructions -->
-  <!ATTLIST line ci CDATA #IMPLIED>
-  <!-- number of missed branches -->
-  <!ATTLIST line mb CDATA #IMPLIED>
-  <!-- number of covered branches -->
-  <!ATTLIST line cb CDATA #IMPLIED>
-
-<!-- coverage data counter for different metrics -->
-<!ELEMENT counter EMPTY>
-  <!-- metric type -->
-  <!ATTLIST counter type (INSTRUCTION|BRANCH|LINE|COMPLEXITY|METHOD|CLASS) 
#REQUIRED>
-  <!-- number of missed items -->
-  <!ATTLIST counter missed CDATA #REQUIRED>
-  <!-- number of covered items -->
-  <!ATTLIST counter covered CDATA #REQUIRED>
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to