Skip to content

Missing Diffs #35

@ali-ghanbari

Description

@ali-ghanbari

Hi,

Thanks for this useful library.
When parsing the attached unified diff file, I noticed that the library fails to retrieve all the diffs (it only sees the first one).
I am not sure if the format of the file is correct; when I delete the blank lines between the diffs the library works just fine.
I am guessing this might be a bug in the library, and it would be ideal to fix it.

Here is my use case:

final DiffParser parser = new UnifiedDiffParser();
try (InputStream is = new FileInputStream("test.patch")) {
   System.out.println(parser.parse(is).size()); // This is supposed to print 2, but it prints 1: it only sees the first diff!
}

And here is the patch file test.patch:

--- /source/org/jfree/chart/plot/CategoryPlot.java
+++ /source/org/jfree/chart/plot/CategoryPlot.java
@@ -1042,7 +1042,8 @@
             result = (ValueAxis) this.rangeAxes.get(index);
         }
         if (result == null) {
-            Plot parent = getParent();
+            CategoryAxis xAxis = (CategoryAxis) this.domainAxes.get(index);
+			Plot parent = getParent();
             if (parent instanceof CategoryPlot) {
                 CategoryPlot cp = (CategoryPlot) parent;
                 result = cp.getRangeAxis(index);
@@ -1349,7 +1350,8 @@
      */
     public void setDataset(int index, CategoryDataset dataset) {
 
-        CategoryDataset existing = (CategoryDataset) this.datasets.get(index);
+        Object result = null;
+        CategoryDataset existing = (CategoryDataset) this.datasets.get(index);
         if (existing != null) {
             existing.removeChangeListener(this);
         }


--- /source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java
+++ /source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java
@@ -1795,7 +1795,7 @@
         int index = this.plot.getIndexOf(this);
         CategoryDataset dataset = this.plot.getDataset(index);
         if (dataset != null) {
-            return result;
+            Paint outlinePaint = plot.getOutlinePaint();
         }
         int seriesCount = dataset.getRowCount();
         if (plot.getRowRenderingOrder().equals(SortOrder.ASCENDING)) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions