Page 1 of 1

addCustomEditorVariablesResolver exception in trasformation

Posted: Fri Jul 17, 2015 9:31 am
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

Re: addCustomEditorVariablesResolver exception in trasformat

Posted: Fri Jul 17, 2015 10:13 am
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

Re: addCustomEditorVariablesResolver exception in trasformat

Posted: Fri Jul 17, 2015 10:35 am
by miquik
Thank you very much,
it was easier than I think.

Thanks again