Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrepaired Chart-15 by Flacoco #108

Closed
martinezmatias opened this issue Oct 11, 2021 · 3 comments
Closed

Unrepaired Chart-15 by Flacoco #108

martinezmatias opened this issue Oct 11, 2021 · 3 comments

Comments

@martinezmatias
Copy link
Collaborator

The suspicious line where Astor finds a fix
(https://github.com/martinezmatias/astor/runs/3851808653?check_suite_focus=true#step:8:1938) is not included by Flacoco in the suspicious list

@andre15silva
Copy link
Member

andre15silva commented Oct 16, 2021

This is the same of #109

In this case, this exception is thrown:

java.lang.IllegalArgumentException: Null 'dataset' argument.
	at org.jfree.data.general.DatasetUtilities.calculatePieDatasetTotal(DatasetUtilities.java:153)
	at org.jfree.chart.plot.PiePlot.initialise(PiePlot.java:2051)
	at org.jfree.chart.plot.PiePlot3D.draw(PiePlot3D.java:280)
	at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1219)
	at org.jfree.chart.plot.junit.PiePlot3DTests.testDrawWithNullDataset(PiePlot3DTests.java:144)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
...

It is not as obvious because the test case that fails catches it and then fails afterwards. Since the stack-trace of the original exceptions is discarded, we also do not include it through our stack-trace parsing mechanism.

    public void testDrawWithNullDataset() {
        JFreeChart chart = ChartFactory.createPieChart3D("Test", null, true, 
                false, false);
        boolean success = false;
        try {
            BufferedImage image = new BufferedImage(200 , 100, 
                    BufferedImage.TYPE_INT_RGB);
            Graphics2D g2 = image.createGraphics();
            chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
            g2.dispose();
            success = true;
        }
        catch (Exception e) {
            success = false;
        }
        assertTrue(success);
    }

@monperrus
Copy link
Collaborator

As suggest bu @andre15silva we can slightly refactor the test

@martinezmatias
Copy link
Collaborator Author

Using a refactored version of the buggy project, we repair the bug as the suspicious line appears in the suspicious list: https://github.com/martinezmatias/astor/runs/4168386737?check_suite_focus=true#step:8:11547

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants