Describe the bug
I found that the ResourceFingerprintVisitor is failing to add integer values to its digest.
Environment
main
To Reproduce
@Test
public void testUnequalResources_intVals() throws Exception {
Patient patient = TestUtil.getMinimalResource(Patient.class).toBuilder()
.multipleBirth(1)
.build();
ResourceFingerprintVisitor resourceFingerprintVisitor = new ResourceFingerprintVisitor();
patient.accept(resourceFingerprintVisitor);
SaltHash baseline = resourceFingerprintVisitor.getSaltAndHash();
patient = patient.toBuilder()
.multipleBirth(2)
.build();
resourceFingerprintVisitor = new ResourceFingerprintVisitor(baseline);
patient.accept(resourceFingerprintVisitor);
assertNotEquals(resourceFingerprintVisitor.getSaltAndHash(), baseline);
}
Expected behavior
the test should succeed
Additional context
does the ByteBuffer need to get flipped before we add it to the digest?
@Override
public void visit(java.lang.String elementName, java.lang.Integer value) {
ByteBuffer bb = ByteBuffer.allocate(4);
bb.putInt(value);
// flip here?
digest.update(bb);
}
Describe the bug
I found that the ResourceFingerprintVisitor is failing to add integer values to its digest.
Environment
main
To Reproduce
Expected behavior
the test should succeed
Additional context
does the ByteBuffer need to get flipped before we add it to the digest?