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

NPE in SvgFile.isSvg(String) #1525

Closed
ilnur-z opened this issue Dec 18, 2023 · 4 comments · Fixed by #1526
Closed

NPE in SvgFile.isSvg(String) #1525

ilnur-z opened this issue Dec 18, 2023 · 4 comments · Fixed by #1526
Assignees
Labels
BugFix Change to correct issues
Milestone

Comments

@ilnur-z
Copy link

ilnur-z commented Dec 18, 2023

Where is a NullPointerException on method org.eclipse.birt.report.engine.util.SvgFile.isSvg(String) then uri is null.
I think that because some brackets needed:

if (uri != null && ( uri.endsWith(".svg") || uri.toLowerCase().contains(URL_IMAGE_TYPE_SVG) ) )

(just like on method org.eclipse.birt.report.engine.util.SvgFile.isSvg(String, String, String))

caused by 59c1d03

@wimjongman
Copy link
Contributor

Please add the stacktrace

@ilnur-z
Copy link
Author

ilnur-z commented Dec 18, 2023

here stacktrace
stack.log

@ilnur-z
Copy link
Author

ilnur-z commented Dec 18, 2023

ImageManager2 is our little modified ImageManager, which not takes rasterised data for svg-images (not convert svg to raster).
its addImage method looks like:

public ImageEntry addImage(IImageContent image) throws IOException {
    ImageEntry entry = images.get(image.getURI());
    if (entry != null) {
        return entry;
    }
    String fileName = generateFileName(image.getExtension(), image.getMIMEType());
    entry = new ImageEntry(pkg, fileName, image.getMIMEType(), image);
    byte[] imgData;
    if (SvgFile.isSvg(image.getURI())) {
        imgData = image.getData();
    } else {
        imgData = entry.getImage().getData();
    }
    if (processEntry(entry, imgData)) {
        images.put(image.getURI(), entry);
    }
    return entry;
}

@speckyspooky
Copy link
Contributor

Yes, I can confirm the NPE is based through the missing brackets.
I added a PR #1526 some minutes ago to fix it.

@speckyspooky speckyspooky added the BugFix Change to correct issues label Dec 18, 2023
@speckyspooky speckyspooky added this to the 4.15 milestone Dec 18, 2023
@speckyspooky speckyspooky self-assigned this Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugFix Change to correct issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants