OpenNTF / org.openntf.nsfodp

Maven and Eclipse tooling for working with NSF on-disk-project representations
Apache License 2.0
14 stars 6 forks source link

View import fails when selection formula includes @Now #255

Open jesse-gallagher opened 3 years ago

jesse-gallagher commented 3 years ago

I observed this in the OpenNTF XSnippets app. Its selection formula is:

SELECT ((Form = "Log") & (DOWNLOADTYPE = "snippet") & ((@Date(@Now) - @Date(Date)) )/86400 >= 90)

On import, this leads to:

[INFO] Caused by: com.darwino.domino.napi.DominoException: Signature on document is invalid (inconsistent field signatures)
[INFO]  at com.darwino.domino.napi.DominoAPIImpl.NSFNoteSign(Native Method)
[INFO]  at com.darwino.domino.napi.wrap.NSFNote.sign(NSFNote.java:1078)
[INFO]  at org.openntf.nsfodp.compiler.ODPCompiler.importDxl(ODPCompiler.java:855)
[INFO]  at org.openntf.nsfodp.compiler.ODPCompiler.importBasicElements(ODPCompiler.java:577)
[INFO]  ... 9 more

This appears to be specifically due to the presence of @Now somehow. If I change it to reference a field name (say, just Now), it compiles without issue.

Since this is almost definitely an underlying problem, the options are limited. One potential, extremely-ugly workaround would be:

1) Look for @Now in the selection formula before import 2) Stash the value and set the formula to e.g. SELECT @All 3) Open the view post-import, set the formula programmatically, and re-save

jesse-gallagher commented 3 years ago

I could also lower the severity of NSFNoteSign exceptions to a logged warning or error.