-
Notifications
You must be signed in to change notification settings - Fork 74
Description
A Simple Pojorepository delete causes nullpointer exception. The delete does delete the object in the database. Previously, the delete method used to return a null and hence in the following snippet:
Artifact artifact = pojoReposProducts.read(longId);
artifact was null.
Not sure if this is the intended functionality.
Pojo Class used:
public class Artifact {
@id
public long id;
private String name;
private Company manufacturer;
private int inventory;
public long getId() {
return id;
}
public Artifact setId(long id) {
this.id= id; return this;
}
public String getName() {
return name;
}
public Artifact setName(String name) {
this.name = name; return this;
}
public Company getManufacturer() {
return manufacturer;
}
public Artifact setManufacturer(Company manufacturer) {
this.manufacturer= manufacturer; return this;
}
public int getInventory() {
return inventory;
}
public Artifact setInventory(int inventory) {
this.inventory= inventory; return this;
}
}
Test method:
@test
public void testPOJORepoDeleteWithNegativeId() {
PojoRepository<Artifact,Long> pojoReposProducts = client.newPojoRepository(Artifact.class, Long.class);
//Load two objects into database
long longId = getOneNegativeLongId();
longId = 1000L;
pojoReposProducts.write(this.setArtifact(longId),"odd","numbers");
// Delete the object
pojoReposProducts.delete(longId);
// Validate the artifact read back.
Artifact artifact = pojoReposProducts.read(longId);
assertNull(artifact);
}
Exception Trace
java.lang.NullPointerException
at com.marklogic.client.impl.JerseyServices.getBulkDocumentsImpl(JerseyServices.java:834)
at com.marklogic.client.impl.JerseyServices.getBulkDocuments(JerseyServices.java:729)
at com.marklogic.client.impl.DocumentManagerImpl.read(DocumentManagerImpl.java:398)
at com.marklogic.client.impl.JSONDocumentImpl.read(JSONDocumentImpl.java:26)
at com.marklogic.client.impl.DocumentManagerImpl.read(DocumentManagerImpl.java:370)
at com.marklogic.client.impl.JSONDocumentImpl.read(JSONDocumentImpl.java:26)
......
......
at com.marklogic.javaclient.TestPOJOSpecialCharRead.testPOJORepoDeleteWithNegativeId(TestPOJOSpecialCharRead.java:474)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)