Skip to content

Commit

Permalink
Improvements to the Java APIView processor (#2032)
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanGiles authored Sep 23, 2021
1 parent 0d32bfd commit 858c27a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/dotnet/APIView/APIViewWeb/APIViewWeb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<AssemblyName>APIViewWeb</AssemblyName>
<UserSecretsId>79cceff6-d533-4370-a0ee-f3321a343907</UserSecretsId>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<JavaProcessor>..\..\..\java\apiview-java-processor\target\apiview-java-processor-1.23.0.jar</JavaProcessor>
<JavaProcessor>..\..\..\java\apiview-java-processor\target\apiview-java-processor-1.24.0.jar</JavaProcessor>
<PythonProcessor>..\..\..\..\packages\python-packages\api-stub-generator\dist\api_stub_generator-0.1.0-py3-none-any.whl</PythonProcessor>
<JavaScriptProcessor>..\..\..\ts\ts-genapi\</JavaScriptProcessor>
<TypeScriptToolsVersion>latest</TypeScriptToolsVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class JavaLanguageService : LanguageProcessor
public override string Name { get; } = "Java";
public override string Extension { get; } = ".jar";
public override string ProcessName { get; } = "java";
public override string VersionString { get; } = "apiview-java-processor-1.23.0.jar";
public override string VersionString { get; } = "apiview-java-processor-1.24.0.jar";

public override string GetProcessorArguments(string originalName, string tempDirectory, string jsonPath)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class XmlLanguageService : LanguageProcessor
public override string Name { get; } = "Xml";
public override string Extension { get; } = ".xml";
public override string ProcessName { get; } = "java";
public override string VersionString { get; } = "apiview-java-processor-1.23.0.jar";
public override string VersionString { get; } = "apiview-java-processor-1.24.0.jar";

public override string GetProcessorArguments(string originalName, string tempDirectory, string jsonPath)
{
Expand Down
2 changes: 1 addition & 1 deletion src/java/apiview-java-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.azure</groupId>
<artifactId>apiview-java-processor</artifactId>
<version>1.23.0</version>
<version>1.24.0</version>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ private void processFile(Path file) {
apiListing.addChildItem(new ChildItem(filename, filename, TypeKind.ASSEMBLY));

final XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);

XMLStreamReader reader = null;
try {
reader = factory.createXMLStreamReader(new FileInputStream(file.toFile()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
Expand Down Expand Up @@ -41,6 +42,11 @@ public Pom(InputStream pomFileStream) throws IOException {
try {
// use xpath to get the artifact ID
final DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
builderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
builderFactory.setXIncludeAware(false);
builderFactory.setExpandEntityReferences(false);

final DocumentBuilder builder = builderFactory.newDocumentBuilder();
final Document xmlDocument = builder.parse(pomFileStream);
final XPath xPath = XPathFactory.newInstance().newXPath();
Expand Down

0 comments on commit 858c27a

Please sign in to comment.