Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null list item causes failure #676

Closed
shollander opened this issue May 10, 2018 · 3 comments
Closed

Null list item causes failure #676

shollander opened this issue May 10, 2018 · 3 comments
Labels

Comments

@shollander
Copy link
Contributor

@shollander shollander commented May 10, 2018

I am using Javers with MongoDB. I have an object with a field that is a List. If the List contains an entry that is null, then I get the following exception:

java.lang.IllegalArgumentException: argument should not be null
    at org.javers.common.validation.Validate.argumentsAreNotNull(Validate.java:33)
    at org.javers.core.metamodel.object.GlobalIdFactory.createId(GlobalIdFactory.java:44)
    at org.javers.core.graph.LiveCdoFactory.create(LiveCdoFactory.java:29)
    at org.javers.core.graph.LiveCdoFactory.create(LiveCdoFactory.java:15)
    at org.javers.core.graph.EdgeBuilder$MultiEdgeContainerBuilderFunction.apply(EdgeBuilder.java:72)
    at org.javers.core.metamodel.type.ListType.map(ListType.java:33)
    ...
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented May 10, 2018

hi, could you reproduce it in a failing test case?

@shollander
Copy link
Contributor Author

@shollander shollander commented May 10, 2018

If I have a domain object like this:

@Document
public class Customer {
    @Id
    private String id;
    private List<Order> orders;

    // getters/setters
}
public class Order {
    private String orderNumber;

   // getters/setters
}

Then this test will fail with an exception:

@SpringJUnitConfig
@SpringBootTest
class CustomerTest {
    @Autowired
    CustomerRepository customerRepository;
    
    @Test
    void test() {
        Customer customer = new Customer();
        customer.setOrders(Arrays.asList(null, null));
        customerRepository.save(customer);
    }    
}
bartoszwalacik added a commit that referenced this issue May 11, 2018
failing test
@bartoszwalacik bartoszwalacik added the bug label May 11, 2018
bartoszwalacik added a commit that referenced this issue May 11, 2018
NPE fixed
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented May 11, 2018

fixed in 3.9.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants