Closed amoeba closed 8 years ago
I looked into this, and its due to the numberReplicas attribute being missing from the system metadata, and therefor an array out of bounds exception was being thrown. The fix is to test for existence first. The schema doesn't require the numberReplicas
attribute, so if it is missing I set the parse routine to set it to 0.
I can't reproduce this bug and I could use some help!
While using a package that uses
datapack
, two of our interns reported this error to me:They were using a HEAD install of this package (016c9d3544cce03953e1651f184caea4e887f0fb) rather than the published CRAN version and this was because this commit fixed a bug they needed fixed. However, it looks like that fix introduced a bug. I had the interns revert back to the CRAN version and everything started working again.
The line of code producing this error only occurs once in the repo and it looks like it would be caused by the named vector returned by
xmlAttrs(xml[["replicationPolicy"]])
not having an element callednumberReplicas
which should be caused by thereplicationPolicy
element not having that attribute set.This is really weird because a valid System Metadata document, if it has a
replicationPolicy
, must have values set fornumberReplicas
andreplicationAllowed
. The object in question causing the issue was on arcticdata.io and the PID is arctic-data.9797.1.I thought this code would reproduce their error:
but it doesn't.
I'd like to reproduce the bug before making any code changes but I could at least propose checking that named vector index before accessing it.
Any thoughts?