Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-17505

SimpleNamingContextBuilder: Second builder does not change JNDI context after first has been deactivated

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.3.14, 5.1.2
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      When creating the SimpleNamingContextBuilder for a second time, it doesn't work well. Different testcases can cause eachother to fail. The second will be missing it's JDNI settings.
      This is caused by the fact that the first SimpleNamingContextBuilder is still connected to the NamingManager.

      @Test
      public void testSimpleNamingContextBuilder()
      	throws NamingException, MalformedURLException, IllegalStateException
      {
      	SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
      	builder.bind("url/testname", "WillNotBeCleared");
      	builder.deactivate();
      
      	SimpleNamingContextBuilder builder2 = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
      	builder2.clear();
      	builder2.bind("url/testname", "ThisIsNotSet");
      
      	InitialContext initialContext2 = new InitialContext();
      	assertEquals("WillNotBeCleared", initialContext2.lookup("url/testname"));
      }
      

        Attachments

          Activity

            People

            • Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              armhart Eelco de Lang
              Last updater:
              Spring Issuemaster
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                47 weeks ago