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

Post here questions and problems related to editing and publishing DITA content.
Gertone
Posts: 17
Joined: Mon Sep 17, 2007 10:02 am
Location: Flanders

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

Post 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]
Gertone
Posts: 17
Joined: Mon Sep 17, 2007 10:02 am
Location: Flanders

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

Post 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
Radu
Posts: 8010
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Gertone
Posts: 17
Joined: Mon Sep 17, 2007 10:02 am
Location: Flanders

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

Post 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
Stacey
Posts: 37
Joined: Tue Mar 14, 2017 12:36 am

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

Post 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 401 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.
Radu
Posts: 8010
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Stacey
Posts: 37
Joined: Tue Mar 14, 2017 12:36 am

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

Post 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.
tgrantham
Posts: 25
Joined: Thu Oct 27, 2011 8:03 pm

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

Post 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.
Radu
Posts: 8010
Joined: Fri Jul 09, 2004 5:18 pm

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

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tgrantham
Posts: 25
Joined: Thu Oct 27, 2011 8:03 pm

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

Post by tgrantham »

Thanks, Radu.
Post Reply