in RemoteBundleContextImpl.waitForState, the bundle can be null if is not 
already installed. 
---------------------------------------------------------------------------------------------

                 Key: PAXEXAM-195
                 URL: http://issues.ops4j.org/browse/PAXEXAM-195
             Project: Pax Exam
          Issue Type: Bug
    Affects Versions: 1.2.2
            Reporter: Stephane Chomat
            Assignee: Toni Menzel
             Fix For: 1.2.3


In RemoteBundleContextImpl.waitForState, the bundle can be null if is not 
already installed. 

I implemented another TestContainer for execute karaf configuration and I want 
wait the last started bundle.
The test give the id of the last stated bundle.

But when i call the method waitForState, the last stated bundle is not 
installed. And I want wait this bunble is installed and next started.
I fixed the NPE with this path.


diff -r affdcda3b675 
pax-exam-container-rbc/src/main/java/org/ops4j/pax/exam/rbc/internal/RemoteBundleContextImpl.java
--- 
a/pax-exam-container-rbc/src/main/java/org/ops4j/pax/exam/rbc/internal/RemoteBundleContextImpl.java
 Mon Sep 13 07:46:14 2010 +0000
+++ 
b/pax-exam-container-rbc/src/main/java/org/ops4j/pax/exam/rbc/internal/RemoteBundleContextImpl.java
 Fri Dec 24 13:53:36 2010 +0100
@@ -162,8 +162,8 @@
                               final long timeoutInMillis )
         throws TimeoutException
     {
-        final Bundle bundle = m_bundleContext.getBundle( bundleId );
-        if( timeoutInMillis == NO_WAIT && bundle.getState() < state )
+        Bundle bundle = m_bundleContext.getBundle( bundleId );
+        if( timeoutInMillis == NO_WAIT && (bundle == null || bundle.getState() 
< state ))
         {
             throw new TimeoutException(
                 "There is no waiting timeout set and bundle has state '" + 
bundleStateToString( bundle.getState() )
@@ -173,6 +173,7 @@
         long startedTrying = System.currentTimeMillis();
         do
         {
+           bundle = m_bundleContext.getBundle( bundleId );
            try
            {
               Thread.sleep(50);
@@ -183,7 +184,7 @@
               break;
            }
         }
-        while( bundle.getState() < state
+        while( (bundle == null || bundle.getState() < state)
                && ( timeoutInMillis == WAIT_FOREVER
                     || System.currentTimeMillis() < startedTrying + 
timeoutInMillis ) );
         if( bundle.getState() < state )

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.ops4j.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to