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

Workaround to avoid calls to contentStream.moveTo with NaN arguments. #12

Merged
merged 2 commits into from
Apr 11, 2018

Conversation

FabioVassallo
Copy link
Contributor

I’ve found a little bug in Graphics2d (always present since version 0.1).
I use this bridge to put JFreeChart into PDF.
I happened to have a JFreeChart spider chart with no data; in that case, in method walkShape (class PdfBoxGraphics2D) there are calls to contentStream.moveTo(NaN, NaN).

I propose a workaround for this issue: it works, but maybe there's a better solution

It works, but maybe there's a better solution
contentStream.closePath();
break;
}
pi.next();
Copy link
Owner

@rototor rototor Apr 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't advanced the PathIterator if there is a infinite coords[0]? I Think that would cause a endless loop...

@rototor rototor merged commit ae5bdb4 into rototor:master Apr 11, 2018
@rototor
Copy link
Owner

rototor commented Apr 11, 2018

I'll expand this to check all parameters depending on the segment type, but this is fine for now. Do you need a release soon?

@rototor
Copy link
Owner

rototor commented Apr 11, 2018

And thanks for finding this bug and providing a fix for it.

@FabioVassallo
Copy link
Contributor Author

It's not urgent.
You can include the fix when you issue the next release.
Thank you

rototor added a commit that referenced this pull request Apr 15, 2018
…hod,

as it is JDK8+ only. Also added the JFreeChart spider example with valid
and invalid data.
@rototor
Copy link
Owner

rototor commented Apr 15, 2018

I've just released 0.14 with this fix. I changed it to check all arguments and also to compile on at least JDK 1.7. Float.isFinite() is JDK8+ ...

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

Successfully merging this pull request may close these issues.

2 participants