addCustomEditorVariablesResolver exception in trasformation

Post here questions and problems related to oXygen frameworks/document types.
miquik
Posts: 7
Joined: Tue Jun 23, 2015 1:21 pm

addCustomEditorVariablesResolver exception in trasformation

Post by miquik »

Hi,
I just finished my first plugin and everythings works well. One of the task of my plugin is to set a custom id to new docs; I do that using addCustomEditorVariablesResolver function based on this code :https://github.com/digicademy/CustomUUI ... nsion.java.
Everything works well except that this line of code throw an "java.lang.NullPointerException" when I perform a Transformation Task (I use DITA to PDF but I try every transformations and gave me same results).
If I remove this line of code, everything works as expected.

Thanks
alex_jitianu
Posts: 1009
Joined: Wed Nov 16, 2005 11:11 am

Re: addCustomEditorVariablesResolver exception in trasformat

Post by alex_jitianu »

Hello,

What happens is that at some point, in CustomUUIDResolver .resolveEditorVariables(), parameter contentWithEditorVariables has a null value. Just check it for null before trying to expand:

Code: Select all

public String resolveEditorVariables(String contentWithEditorVariables, String currentEditedFileURL){			
if (contentWithEditorVariables != null) {
return contentWithEditorVariables.replaceAll("\\$\\{customUUID\\}", createCustomUUID().toString());
}
return contentWithEditorVariables;
}
we will also change the code a bit so that in the future you wont get a callback for a null value.

Best regards,
Alex
miquik
Posts: 7
Joined: Tue Jun 23, 2015 1:21 pm

Re: addCustomEditorVariablesResolver exception in trasformat

Post by miquik »

Thank you very much,
it was easier than I think.

Thanks again
Post Reply