Copilot commented on code in PR #103:
URL: 
https://github.com/apache/commons-secure-xml/pull/103#discussion_r4093519705


##########
src/test/java/org/apache/commons/xml/secure/JaxbExamples.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * 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
+ *
+ *      https://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.
+ */
+
+package org.apache.commons.xml.secure;
+
+import java.io.InputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.sax.SAXSource;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+/**
+ * Examples for the Javadoc {@code overview.html} file.
+ */
+public class JaxbExamples {
+
+    static class MyJaxbModel {
+        // JAXB model fields and methods
+    }
+
+    public MyJaxbModel unmarshalSecurelyWithSax(InputStream xmlStream) throws 
Exception {
+        JAXBContext context = JAXBContext.newInstance(MyJaxbModel.class);
+        Unmarshaller unmarshaller = context.createUnmarshaller();
+
+        // Create a secure SAXParserFactory via Apache Commons Secure XML
+        SAXParserFactory spf = SecureSAXParserFactory.newDefaultNSInstance();
+        

Review Comment:
   This whitespace-only line violates the repository's trailing-whitespace 
Checkstyle rule, so the default build fails. Remove the trailing spaces here 
and on the analogous blank lines at lines 55 and 62.



##########
src/test/java/org/apache/commons/xml/secure/JaxbExamples.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * 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
+ *
+ *      https://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.
+ */
+
+package org.apache.commons.xml.secure;
+
+import java.io.InputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.sax.SAXSource;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+/**
+ * Examples for the Javadoc {@code overview.html} file.
+ */
+public class JaxbExamples {
+
+    static class MyJaxbModel {
+        // JAXB model fields and methods
+    }
+
+    public MyJaxbModel unmarshalSecurelyWithSax(InputStream xmlStream) throws 
Exception {
+        JAXBContext context = JAXBContext.newInstance(MyJaxbModel.class);
+        Unmarshaller unmarshaller = context.createUnmarshaller();

Review Comment:
   `FinalLocalVariable` is enabled in the repository Checkstyle configuration, 
but the locals introduced here and in the StAX method are not declared `final`. 
The default Maven build will reject this example; declare the context, 
unmarshaller, factory, reader, and source locals `final` in both methods.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to