Copilot commented on code in PR #2865:
URL: https://github.com/apache/tika/pull/2865#discussion_r3351234811


##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-integration-tests/src/test/java/org/apache/tika/parser/AndroidBinaryXMLTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+package org.apache.tika.parser;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
+import java.io.ByteArrayOutputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.junit.jupiter.api.Test;
+
+import org.apache.tika.TikaTest;
+import org.apache.tika.io.TikaInputStream;
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.metadata.TikaCoreProperties;
+
+/**
+ * Android Binary XML (AXML) is the compiled binary form of 
AndroidManifest.xml and the
+ * res/*.xml resources packed inside an APK. Those entries keep a .xml 
extension and live
+ * inside the (zip) APK, so before TIKA-4748 the *.xml glob caused them to be 
detected as
+ * application/xml and handed to the XML parser, which failed on the binary 
header with
+ * "Invalid byte 1 of 1-byte UTF-8 sequence". This was a large source of 
exceptions in
+ * regression runs over APK-heavy corpora.

Review Comment:
   The JIRA issue reference in this new Javadoc (TIKA-4748) is inconsistent 
with the PR title (TIKA-4747). Please confirm which issue is correct and update 
the reference here (and anywhere else in this PR) so the change can be traced 
back to the right ticket.



##########
tika-core/src/test/java/org/apache/tika/mime/MimeDetectionTest.java:
##########
@@ -85,6 +85,11 @@ public void testDetection() throws Exception {
 
         // truncated xml should still be detected as xml, See TIKA-3596
         testFile("application/xml", "truncated-utf16-xml.xyz");
+
+        // Android Binary XML (compiled AndroidManifest.xml / res/*.xml inside 
an APK).
+        // Carries a .xml extension, so magic must win over the *.xml glob and 
it must
+        // NOT be routed to application/xml / the XML parser. See TIKA-4748.
+        testFile("application/vnd.android.axml", "test-android-binary.xml");

Review Comment:
   The comment references TIKA-4748, but the PR title indicates TIKA-4747. 
Please verify the correct JIRA issue id and update this reference to match (or 
adjust the PR title if that is what’s incorrect).



-- 
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