Page 1 of 1

Cannot read field "result" because "fi" is null

Posted: Sat Mar 27, 2021 1:48 pm
by Gertone
All,

I get a nullpointer exception generating a customized responsive webhelp from DITA (I do get the same exception when I just run the vanilla HTML 5 plugin)
So the issue is in my DITA, but I am not sure how to analyse this.
It happens when copying the images, I guess. There is plenty of options. Just too much data (it is a 800 pages manual with many high resolution images), not enough memory, not enough disk space, maybe the images are locked (windows 10 machine)? Plenty of stuff to look into.
It could help however if someone had suffered from the same and could hint towards what exactly the nullpointer exception means

Thanks a lot,
Geert

[code]copy-image:
BUILD FAILED
D:\XML\IDE\Oxygen XML Editor 23\frameworks\dita\DITA-OT3.x\plugins\org.dita.base\build.xml:29: The following error occurred while executing this line:
D:\XML\IDE\Oxygen XML Editor 23\frameworks\dita\DITA-OT3.x\plugins\org.dita.base\build_preprocess.xml:364: java.lang.NullPointerException: Cannot read field "result" because "fi" is null
at org.dita.dost.ant.types.JobMapper.mapFileName(JobMapper.java:79)
at org.apache.tools.ant.util.CompositeMapper.lambda$mapFileName$0(CompositeMapper.java:32)
[/code]

Re: Cannot read field "result" because "fi" is null

Posted: Sat Mar 27, 2021 2:16 pm
by Gertone
Some additional info
- generating a PDF (using FO and PDF2) causes no problems at all
- I did discover that all images were "blocked" by windows1à because they came from a different computer. Unblocking all the images (thank you PowerShell :) did not resolve the issue

Re: Cannot read field "result" because "fi" is null

Posted: Mon Mar 29, 2021 4:14 pm
by Radu
Hi,

I'm not sure what the problem is. Are you using Oxygen 23.0 or 23.1?
Can you try to reduce your DITA project to a smaller sample with which the problem can be reproduced?
Or at least try to copy the project along with the images to some folder location where the publishing engine has full read-write access and try to see if publishing works from there.

Regards,
Radu

Re: Cannot read field "result" because "fi" is null

Posted: Mon Mar 29, 2021 7:23 pm
by Gertone
Thanks for looking into this Radu

I took the opportunity to upgrade to 23.1, the issue was discovered in 23.0, it also happens in 23.1.

Then interestingly, I tried with Oxygen 22.0 and I don't have the issue.
(DITA Open Toolkit bundled with Oxygen 22.0, build 2020030411)

So whatever happens, it started happening with the OT framework bundled in Oxygen 23.0

Not sure that helps

Next step, I will try to isolate the issue in a smaller sample

Re: Cannot read field "result" because "fi" is null

Posted: Thu Apr 14, 2022 8:22 pm
by Stacey
We had the same error message come up.
The .ditamap file had a bunch of other .ditamaps in it.
I think the issue was with these errors:
erroroxygen.jpg
erroroxygen.jpg (82.59 KiB) Viewed 2028 times
When I deleted the submaps I believe these images would have been pulled from, the Transformation ran okay.
We haven't sorted out how to fix the original map(s) yet, this is just what seemed to be stopping things from actually outputting.

Re: Cannot read field "result" because "fi" is null

Posted: Fri Apr 15, 2022 6:43 am
by Radu
Hi Stacey,

And what version of Oxygen do you have? I'm afraid I need information in order to debug such problems further. If you put together a small DITA Project exhibiting the problem and steps to reproduce the problem you can send them via our tech support form and we can try to take a look at this on our side: https://www.oxygenxml.com/techSupport.html

Regards,
Radu

Re: Cannot read field "result" because "fi" is null

Posted: Mon Apr 18, 2022 9:45 pm
by Stacey
It was happening both from 23.1 and 24.1.
I'm not sure how feasible pulling together a short selection is and still have the error appearing, but I'll see what I can do.

Re: Cannot read field "result" because "fi" is null

Posted: Thu May 19, 2022 5:20 pm
by tgrantham
I encountered this problem this week while troubleshooting HTML publishing for a client. I'm using oXygen Editor 24.1, but I don't think that's relevant, as I'm using an external copy of DITA OT 3.5.4 to publish, not the one that comes with oXygen Editor.

In my case, the exception gets thrown by JobMapper, a Java class in the OT that I believe interacts with the .job.xml file in the temp folder created by the OT. The exception occurs apparently at the line referencing fi.result:

Code: Select all

    @Override
    public String[] mapFileName(String sourceFileName) {
        final URI uri = toURI(sourceFileName);
        Job.FileInfo fi = job.getFileInfo(uri);
        if (fi == null) {
            fi = job.getFileInfo(job.getInputDir().resolve(uri));
        }
        final String res;
        switch (type) {
            case TEMP:
                res = fi.file.getPath();
                break;
            case RESULT:
                if (fi.result == null) {
                    res = sourceFileName;
                } else {
                    final URI base = job.getInputDir();
                    final URI rel = base.relativize(fi.result);
                    res = toFile(rel).getPath();
                }
                break;
            default:
                throw new IllegalArgumentException();
        }
        return new String[]{extension != null ? (FilenameUtils.removeExtension(res) + extension) : res};
    }
Examining this code didn't reveal an answer, but it got me checking the file names of the DITA content topics. Through a process of elimination, I discovered that file names containing both square brackets ('[', ']') AND apostrophes (char '0027': "'") triggered this exception. The file names could contain square brackets or apostrophes on their own, but if they contained BOTH, the exception was thrown.

At this point, I don't know what the root cause is: it could be JobMapper or Java or the Windows file system or something else. But making sure the file names did not contain both square brackets and apostrophes solved the issue for me.

Re: Cannot read field "result" because "fi" is null

Posted: Fri May 20, 2022 6:54 am
by Radu
Hi,

There was this problem logged here about using apostrophes in the file named:
https://github.com/dita-ot/dita-ot/issues/2844
The problem was fixed in DITA OT 3.7.1 and also the DITA OT 3.7 bundled with Oxygen 24.1 should have it fixed as well.

Regards,
Radu

Re: Cannot read field "result" because "fi" is null

Posted: Fri May 20, 2022 5:11 pm
by tgrantham
Thanks, Radu.