Skip to content

Commit f74cc99

Browse files
committed
fix(JF-1083): remove currently not working rules
1 parent 0b96fb2 commit f74cc99

4 files changed

Lines changed: 27 additions & 37 deletions

File tree

src/main/resources/magic.xml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -376,24 +376,6 @@
376376
<match-string offset="0">\211PNG</match-string>
377377
<match-string offset="12">IHDR</match-string>
378378

379-
<type>
380-
<mime-type>image/png</mime-type>
381-
<extension>png</extension>
382-
<description>%ld x</description>
383-
<match-long order="be" offset="16"></match-long>
384-
</type>
385-
<type>
386-
<mime-type>image/png</mime-type>
387-
<extension>png</extension>
388-
<description>%ld,</description>
389-
<match-long order="be" offset="20"></match-long>
390-
</type>
391-
<type>
392-
<mime-type>image/png</mime-type>
393-
<extension>png</extension>
394-
<description>%d-bit</description>
395-
<match-byte order="be" offset="24"></match-byte>
396-
</type>
397379
<type>
398380
<mime-type>image/png</mime-type>
399381
<extension>png</extension>
@@ -634,19 +616,6 @@
634616
<extension>pdf</extension>
635617
<description>PDF document</description>
636618
<match-string offset="0">%PDF-</match-string>
637-
638-
<type>
639-
<mime-type>application/pdf</mime-type>
640-
<extension>pdf</extension>
641-
<description>version %c</description>
642-
<match-byte order="be" offset="5"></match-byte>
643-
</type>
644-
<type>
645-
<mime-type>application/pdf</mime-type>
646-
<extension>pdf</extension>
647-
<description>\b.%c</description>
648-
<match-byte order="be" offset="7"></match-byte>
649-
</type>
650619
<type>
651620
<!-- Extract further PDF details -->
652621
<match-custom>org.jadice.filetype.matchers.PDFMatcher</match-custom>

src/test/java/TestRTFMatcher.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public static void init() throws AnalyzerException {
3535
void testRtfEmbeddedFiles() throws IOException {
3636
for (File f : nullSafe(EMBEDDED_FILES_FOLDER.listFiles())) {
3737
final Map<String, Object> result = ANALYZER.analyze(f);
38+
TestVariousTypes.printResult(result);
3839
assertNotNull(result, f + " could not be analyzed");
3940
assertEquals("text/rtf", result.get(MimeTypeAction.KEY), f + " is recognized as RTF");
4041
assertValidDetails(result);
@@ -46,6 +47,7 @@ void testRtfEmbeddedFiles() throws IOException {
4647
void testNormalRtfFiles() throws IOException {
4748
for (File f : nullSafe(NORMAL_FOLDER.listFiles())) {
4849
final Map<String, Object> result = ANALYZER.analyze(f);
50+
TestVariousTypes.printResult(result);
4951
assertNotNull(result, f + " could not be analyzed");
5052
assertEquals("text/rtf", result.get(MimeTypeAction.KEY), f + " is recognized as RTF");
5153
assertValidDetails(result);

src/test/java/TestVariousTypes.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,16 @@ void testEmptyStream() throws Exception {
6161
assertNotNull(results, "empty stream could not be analyzed");
6262
assertEquals("text/plain", results.get(MimeTypeAction.KEY));
6363
assertEquals("txt", results.get(ExtensionAction.KEY));
64-
assertEquals("Binary data, ASCII Text Document", results.get(DescriptionAction.KEY));
64+
assertEquals("ASCII Text Document", results.get(DescriptionAction.KEY));
6565
}
6666

6767
public static Stream<Arguments> dataProviderVarious() {
6868
return Stream.of(
69-
arguments("/various_types/test.png", "image/png", "Binary data, PNG image data, colormap,", "png"),
70-
arguments("/various_types/File-PNG_8pbc_GRAY.png", "image/png", "Binary data, PNG image data, grayscale,", "png"),
71-
arguments("/various_types/File-PNG_8bpc_RGBA.png", "image/png", "Binary data, PNG image data, \\b/color RGBA,", "png"),
72-
arguments("/various_types/File-PNG_16bpc_RGBA.png", "image/png", "Binary data, PNG image data, \\b/color RGBA,", "png")
69+
arguments("/various_types/test.png", "image/png", "PNG image data, colormap,", "png"),
70+
arguments("/various_types/File-PNG_8pbc_GRAY.png", "image/png", "PNG image data, grayscale,", "png"),
71+
arguments("/various_types/File-PNG_8bpc_RGBA.png", "image/png", "PNG image data, \\b/color RGBA,", "png"),
72+
arguments("/various_types/File-PNG_16bpc_RGBA.png", "image/png", "PNG image data, \\b/color RGBA,", "png"),
73+
arguments("/various_types/sample-rtf-files-sample2.rtf", "text/rtf", "Rich Text Format data", "rtf")
7374
);
7475
}
7576

@@ -135,7 +136,7 @@ private void ensureXRechnungIsTrue(final Map<String, Object> results, final Stri
135136
}
136137

137138

138-
private static void printResult(final Map<String, Object> results) {
139+
public static void printResult(final Map<String, Object> results) {
139140
for (final Map.Entry<String, Object> e : results.entrySet()) {
140141
LOGGER.info(" {}={}", e.getKey(), e.getValue());
141142
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{\rtf1\mac\deff2 {\fonttbl{\f0\fswiss Chicago;}{\f2\froman New York;}{\f3\fswiss Geneva;}{\f4\fmodern Monaco;}{\f11\fnil Cairo;}{\f13\fnil Zapf Dingbats;}{\f14\fnil Bookman;}{\f15\fnil N Helvetica Narrow;}{\f16\fnil Palatino;}{\f18\fnil Zapf Chancery;}
2+
{\f20\froman Times;}{\f21\fswiss Helvetica;}{\f22\fmodern Courier;}{\f23\ftech Symbol;}{\f33\fnil Avant Garde;}{\f34\fnil New Century Schlbk;}{\f1297\fnil GoudyHundred;}{\f1602\fnil BlackChancery;}{\f2515\fnil MT Extra;}{\f4950\fnil TTYFont;}
3+
{\f11132\fnil InsigniaLQmono;}{\f11133\fnil InsigniaLQprop;}{\f32500\fnil VT320;}{\f32525\fnil VT100;}}{\colortbl\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;
4+
\red255\green255\blue0;\red255\green255\blue255;}{\stylesheet{\s250\li720 \f21\fs20\ul \sbasedon0\snext0 heading 6;}{\s251\li720 \b\f21\fs20 \sbasedon0\snext0 heading 5;}{\s252\li360 \f21\ul \sbasedon0\snext0 heading 4;}{\s253\li360 \b\f21
5+
\sbasedon0\snext0 heading 3;}{\s254\sb120 \b\f21 \sbasedon0\snext0 heading 2;}{\s255\sb240 \b\f21\ul \sbasedon0\snext0 heading 1;}{\f21 \sbasedon222\snext0 Normal;}{\s2 \b\f21\cf1 \sbasedon0\snext2 Anchor;}}{\info{\author Chuck Shotton}}
6+
\margl720\margr720\ftnbj\fracwidth \sectd \sbknone\linemod0\linex0\cols1\endnhere \pard\plain \s255\sb240 \b\f21\ul Heading 1\par
7+
\pard\plain \f21 This is the first normal paragraph!\par
8+
\pard\plain \s254\sb120 \b\f21 Heading 2\par
9+
\pard\plain \s253\li360 \b\f21 Heading 3\par
10+
\pard\plain \s252\li360 \f21\ul Heading 4\par
11+
\pard\plain \s251\li720 \b\f21\fs20 Heading 5\par
12+
\pard\plain \s250\li720 \f21\fs20\ul Heading 6\par
13+
\pard\plain \f21 This is a chunk of normal text.\par
14+
This is a chunk of normal text with specials, &, <, and >.\par
15+
This is a second paragraph.\par
16+
This is text with embedded {\b bold}, {\i italic}, and {\ul underline} styles.\par
17+
Here is the {\cf1 anchor} style. And here is the {\cf5 Image} style.\par
18+
}

0 commit comments

Comments
 (0)