1 Reply Latest reply on Mar 17, 2008 5:00 AM by tom.baeyens

    Bug in environment ?

    porcherg

      I think there is a bug with Environment.getCurrent() :

      In this test (in ContextBlockSubscription.java):

      public void testUnexistingScope() {
       EnvironmentFactory environmentFactory = EnvironmentFactory.parseXmlString(
       "<environment-scopes>" +
       " <application />" +
       " <block>" +
       " <object name='recorder' class='"+Recorder.class.getName()+"' init='eager'>" +
       " <subscribe context='unexistingcontext' />" +
       " </object>" +
       " </block>" +
       "</environment-scopes>"
       );
      
       assertNull(Environment.getCurrent());
       try {
       environmentFactory.openEnvironment();
       fail("expected exception");
       } catch (WireException e) {
       assertNull(Environment.getCurrent());
       }
       }


      The first assertNull(Environment.getCurrent()); succeed, but the second fails.
      In this test, openEnvironment() fails but the current environment is updated.
      In the test suite, this is a problem because this environment is never closed.

      Regards,
      Guillaume