Skip to content

Commit

Permalink
feat(experiments): add logs from diffoscope
Browse files Browse the repository at this point in the history
  • Loading branch information
algomaster99 committed Sep 3, 2024
1 parent 8041a1e commit 7d91054
Show file tree
Hide file tree
Showing 30,001 changed files with 60,000 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
30,000 changes: 30,000 additions & 0 deletions experiments/diffoscope.log

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions experiments/output/10022/diffoscope.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"diffoscope-json-version": 1, "source1": "first/XmlStreamWriterTest.class", "source2": "second/XmlStreamWriterTest.class", "unified_diff": null, "details": [{"source1": "procyon -ec {}", "source2": "procyon -ec {}", "unified_diff": "@@ -52,40 +52,21 @@\n final String xml = \"<text>text with no XML header</text>\";\n checkXmlContent(\"<text>text with no XML header</text>\", \"UTF-8\", null);\n }\n \n @Test\n public void testEmpty() throws IOException {\n final ByteArrayOutputStream out = new ByteArrayOutputStream();\n- final XmlStreamWriter writer = new XmlStreamWriter((OutputStream)out);\n- Throwable t = null;\n- try {\n+ try (final XmlStreamWriter writer = new XmlStreamWriter((OutputStream)out)) {\n writer.flush();\n writer.write(\"\");\n writer.flush();\n writer.write(\".\");\n writer.flush();\n }\n- catch (final Throwable t2) {\n- t = t2;\n- throw t2;\n- }\n- finally {\n- if (t != null) {\n- try {\n- writer.close();\n- }\n- catch (final Throwable exception) {\n- t.addSuppressed(exception);\n- }\n- }\n- else {\n- writer.close();\n- }\n- }\n }\n \n @Test\n public void testDefaultEncoding() throws IOException {\n checkXmlWriter(\"eacute: \\u00e9, alpha: \\u03b1, euro: \\u20ac, hiragana A: \\u3042\", null, null);\n checkXmlWriter(\"eacute: \\u00e9, alpha: \\u03b1, euro: \\u20ac, hiragana A: \\u3042\", null, \"UTF-8\");\n checkXmlWriter(\"eacute: \\u00e9, alpha: \\u03b1, euro: \\u20ac, hiragana A: \\u3042\", null, \"UTF-16\");\n"}]}
1 change: 1 addition & 0 deletions experiments/output/10028/diffoscope.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"diffoscope-json-version": 1, "source1": "first/MagicNumberFileFilter.class", "source2": "second/MagicNumberFileFilter.class", "unified_diff": null, "details": [{"source1": "procyon -ec {}", "source2": "procyon -ec {}", "unified_diff": "@@ -57,58 +57,43 @@\n }\n this.magicNumbers = magicNumber.getBytes(Charset.defaultCharset());\n this.byteOffset = offset;\n }\n \n public boolean accept(final File file) {\n if (file != null && file.isFile() && file.canRead()) {\n- try {\n- final RandomAccessFile randomAccessFile = new RandomAccessFile(file, \"r\");\n- Throwable x0 = null;\n- try {\n- final byte[] fileBytes = IOUtils.byteArray(this.magicNumbers.length);\n- randomAccessFile.seek(this.byteOffset);\n- final int read = randomAccessFile.read(fileBytes);\n- return read == this.magicNumbers.length && Arrays.equals(this.magicNumbers, fileBytes);\n- }\n- catch (final Throwable t) {\n- x0 = t;\n- throw t;\n- }\n- finally {\n- $closeResource(x0, randomAccessFile);\n+ try (final RandomAccessFile randomAccessFile = new RandomAccessFile(file, \"r\")) {\n+ final byte[] fileBytes = IOUtils.byteArray(this.magicNumbers.length);\n+ randomAccessFile.seek(this.byteOffset);\n+ final int read = randomAccessFile.read(fileBytes);\n+ if (read != this.magicNumbers.length) {\n+ final boolean b = false;\n+ randomAccessFile.close();\n+ return b;\n }\n+ return Arrays.equals(this.magicNumbers, fileBytes);\n }\n catch (final IOException ex) {}\n }\n return false;\n }\n \n public FileVisitResult accept(final Path file, final BasicFileAttributes attributes) {\n if (file != null && Files.isRegularFile(file, new LinkOption[0]) && Files.isReadable(file)) {\n- try {\n- final FileChannel fileChannel = FileChannel.open(file, new OpenOption[0]);\n- Throwable x0 = null;\n- try {\n- final ByteBuffer byteBuffer = ByteBuffer.allocate(this.magicNumbers.length);\n- final int read = fileChannel.read(byteBuffer);\n- if (read != this.magicNumbers.length) {\n- return FileVisitResult.TERMINATE;\n- }\n- return toFileVisitResult(Arrays.equals(this.magicNumbers, byteBuffer.array()), file);\n- }\n- catch (final Throwable t) {\n- x0 = t;\n- throw t;\n- }\n- finally {\n+ try (final FileChannel fileChannel = FileChannel.open(file, new OpenOption[0])) {\n+ final ByteBuffer byteBuffer = ByteBuffer.allocate(this.magicNumbers.length);\n+ final int read = fileChannel.read(byteBuffer);\n+ if (read != this.magicNumbers.length) {\n+ final FileVisitResult terminate = FileVisitResult.TERMINATE;\n if (fileChannel != null) {\n- $closeResource(x0, fileChannel);\n+ fileChannel.close();\n }\n+ return terminate;\n }\n+ return toFileVisitResult(Arrays.equals(this.magicNumbers, byteBuffer.array()), file);\n }\n catch (final IOException ex) {}\n }\n return FileVisitResult.TERMINATE;\n }\n \n public String toString() {\n@@ -116,22 +101,8 @@\n builder.append(\"(\");\n builder.append(new String(this.magicNumbers, Charset.defaultCharset()));\n builder.append(\",\");\n builder.append(this.byteOffset);\n builder.append(\")\");\n return builder.toString();\n }\n- \n- private static /* synthetic */ void $closeResource(final Throwable x0, final AutoCloseable x1) {\n- if (x0 != null) {\n- try {\n- x1.close();\n- }\n- catch (final Throwable exception) {\n- x0.addSuppressed(exception);\n- }\n- }\n- else {\n- x1.close();\n- }\n- }\n }\n"}]}
1 change: 1 addition & 0 deletions experiments/output/10029/diffoscope.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"diffoscope-json-version": 1, "source1": "first/Tailer.class", "source2": "second/Tailer.class", "unified_diff": null, "details": [{"source1": "procyon -ec {}", "source2": "procyon -ec {}", "unified_diff": "@@ -126,35 +126,25 @@\n }\n }\n while (this.getRun()) {\n final boolean newer = FileUtils.isFileNewer(this.file, last);\n final long length = this.file.length();\n if (length < position) {\n this.listener.fileRotated();\n- try {\n- final RandomAccessFile save = reader;\n- Throwable x0 = null;\n+ try (final RandomAccessFile save = reader) {\n+ reader = new RandomAccessFile(this.file, \"r\");\n try {\n- reader = new RandomAccessFile(this.file, \"r\");\n- try {\n- this.readLines(save);\n- }\n- catch (final IOException ioe) {\n- this.listener.handle((Exception)ioe);\n- }\n- position = 0L;\n+ this.readLines(save);\n }\n- catch (final Throwable t) {\n- x0 = t;\n- throw t;\n- }\n- finally {\n- if (save != null) {\n- $closeResource(x0, save);\n- }\n+ catch (final IOException ioe) {\n+ this.listener.handle((Exception)ioe);\n+ }\n+ position = 0L;\n+ if (save == null) {\n+ continue;\n }\n }\n catch (final FileNotFoundException e2) {\n this.listener.fileNotFound();\n Thread.sleep(this.delayMillis);\n }\n }\n@@ -202,17 +192,15 @@\n }\n \n public void stop() {\n this.run = false;\n }\n \n private long readLines(final RandomAccessFile reader) throws IOException {\n- final ByteArrayOutputStream lineBuf = new ByteArrayOutputStream(64);\n- Throwable x0 = null;\n- try {\n+ try (final ByteArrayOutputStream lineBuf = new ByteArrayOutputStream(64)) {\n long rePos;\n long pos = rePos = reader.getFilePointer();\n boolean seenCR = false;\n int num;\n while (this.getRun() && (num = reader.read(this.inbuf)) != -1) {\n for (int i = 0; i < num; ++i) {\n final byte ch = this.inbuf[i];\n@@ -247,34 +235,13 @@\n }\n reader.seek(rePos);\n if (this.listener instanceof TailerListenerAdapter) {\n ((TailerListenerAdapter)this.listener).endOfFileReached();\n }\n return rePos;\n }\n- catch (final Throwable t) {\n- x0 = t;\n- throw t;\n- }\n- finally {\n- $closeResource(x0, lineBuf);\n- }\n- }\n- \n- private static /* synthetic */ void $closeResource(final Throwable x0, final AutoCloseable x1) {\n- if (x0 != null) {\n- try {\n- x1.close();\n- }\n- catch (final Throwable exception) {\n- x0.addSuppressed(exception);\n- }\n- }\n- else {\n- x1.close();\n- }\n }\n \n static {\n DEFAULT_CHARSET = Charset.defaultCharset();\n }\n }\n"}]}
1 change: 1 addition & 0 deletions experiments/output/10030/diffoscope.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"diffoscope-json-version": 1, "source1": "first/ByteArrayOutputStream.class", "source2": "second/ByteArrayOutputStream.class", "unified_diff": null, "details": [{"source1": "procyon -ec {}", "source2": "procyon -ec {}", "unified_diff": "@@ -54,37 +54,18 @@\n }\n \n public static InputStream toBufferedInputStream(final InputStream input) throws IOException {\n return toBufferedInputStream(input, 1024);\n }\n \n public static InputStream toBufferedInputStream(final InputStream input, final int size) throws IOException {\n- final ByteArrayOutputStream output = new ByteArrayOutputStream(size);\n- Throwable t = null;\n- try {\n+ try (final ByteArrayOutputStream output = new ByteArrayOutputStream(size)) {\n output.write(input);\n return output.toInputStream();\n }\n- catch (final Throwable t2) {\n- t = t2;\n- throw t2;\n- }\n- finally {\n- if (t != null) {\n- try {\n- output.close();\n- }\n- catch (final Throwable exception) {\n- t.addSuppressed(exception);\n- }\n- }\n- else {\n- output.close();\n- }\n- }\n }\n \n public synchronized InputStream toInputStream() {\n return this.toInputStream(ByteArrayInputStream::new);\n }\n \n public synchronized byte[] toByteArray() {\n"}]}
1 change: 1 addition & 0 deletions experiments/output/10060/diffoscope.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"diffoscope-json-version": 1, "source1": "first/ConstructorUtilsTest.class", "source2": "second/ConstructorUtilsTest.class", "unified_diff": null, "details": [{"source1": "procyon -ec {}", "source2": "procyon -ec {}", "unified_diff": "@@ -52,23 +52,17 @@\n public void testInvokeExactConstructor() throws Exception {\n Assertions.assertEquals((Object)\"()\", (Object)((ConstructorUtilsTest.TestBean)ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, (Object[])ArrayUtils.EMPTY_CLASS_ARRAY)).toString());\n Assertions.assertEquals((Object)\"()\", (Object)((ConstructorUtilsTest.TestBean)ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, (Object[])null)).toString());\n Assertions.assertEquals((Object)\"(String)\", (Object)((ConstructorUtilsTest.TestBean)ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, new Object[] { \"\" })).toString());\n Assertions.assertEquals((Object)\"(Object)\", (Object)((ConstructorUtilsTest.TestBean)ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, new Object[] { new Object() })).toString());\n Assertions.assertEquals((Object)\"(Integer)\", (Object)((ConstructorUtilsTest.TestBean)ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, new Object[] { NumberUtils.INTEGER_ONE })).toString());\n Assertions.assertEquals((Object)\"(double)\", (Object)((ConstructorUtilsTest.TestBean)ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, new Object[] { NumberUtils.DOUBLE_ONE }, new Class[] { Double.TYPE })).toString());\n- Assertions.assertThrows((Class)NoSuchMethodException.class, () -> {\n- final ConstructorUtilsTest.TestBean testBean = (ConstructorUtilsTest.TestBean)ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, new Object[] { NumberUtils.BYTE_ONE });\n- });\n- Assertions.assertThrows((Class)NoSuchMethodException.class, () -> {\n- final ConstructorUtilsTest.TestBean testBean = (ConstructorUtilsTest.TestBean)ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, new Object[] { NumberUtils.LONG_ONE });\n- });\n- Assertions.assertThrows((Class)NoSuchMethodException.class, () -> {\n- final ConstructorUtilsTest.TestBean testBean = (ConstructorUtilsTest.TestBean)ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, new Object[] { Boolean.TRUE });\n- });\n+ Assertions.assertThrows((Class)NoSuchMethodException.class, () -> ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, new Object[] { NumberUtils.BYTE_ONE }));\n+ Assertions.assertThrows((Class)NoSuchMethodException.class, () -> ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, new Object[] { NumberUtils.LONG_ONE }));\n+ Assertions.assertThrows((Class)NoSuchMethodException.class, () -> ConstructorUtils.invokeExactConstructor((Class)ConstructorUtilsTest.TestBean.class, new Object[] { Boolean.TRUE }));\n }\n \n @Test\n public void testGetAccessibleConstructor() throws Exception {\n Assertions.assertNotNull((Object)ConstructorUtils.getAccessibleConstructor((Constructor)Object.class.getConstructor((Class<?>[])ArrayUtils.EMPTY_CLASS_ARRAY)));\n Assertions.assertNull((Object)ConstructorUtils.getAccessibleConstructor((Constructor)ConstructorUtilsTest.PrivateClass.class.getConstructor((Class<?>[])ArrayUtils.EMPTY_CLASS_ARRAY)));\n Assertions.assertNull((Object)ConstructorUtils.getAccessibleConstructor((Class)ConstructorUtilsTest.PrivateClass.PublicInnerClass.class, new Class[0]));\n"}]}
Loading

0 comments on commit 7d91054

Please sign in to comment.