possible NPE
------------

                 Key: OPENJPA-789
                 URL: https://issues.apache.org/jira/browse/OPENJPA-789
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
    Affects Versions: 2.0.0
            Reporter: Fernando
            Priority: Trivial


Still reviewing code.

This time in kernel/QueryImpl.java.  You see that "assertNotSerialized()" 
method, if you go look at that, it just checks to see if "_broker == null", but 
just the line before that method call, we use "_broker.beginOperation(true)".  
So the check happens a second too late to prevent an NPE.  I think that 
assertNotSerialized should be moved up to be the first line in the method.  No 
sense doing any work what so ever, if we don't have a broker.


NOW:
    private Object execute(int operation, Map params) {
        if (params == null)
            params = Collections.EMPTY_MAP;

        lock();
        try {
            _broker.beginOperation(true);
            try {
                assertNotSerialized();
                assertOpen();
....

TO:

    private Object execute(int operation, Map params) {
        assertNotSerialized();
        if (params == null)
            params = Collections.EMPTY_MAP;

        lock();
        try {
            _broker.beginOperation(true);
            try {
                assertOpen();
....



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to