Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4145150

sun.awt.AppContext.get() and put(...) some times works incorrectly

XMLWordPrintable

    • sparc
    • solaris_2.5.1



      Name: aaC67449 Date: 06/03/98


       
      sun.awt.AppContext.get() and put(...) some times works incorrectly (See example)

      To fix this bug add something like this two lines to AppContext.java:
          
      AppContext,205:
          
          public synchronized Object put(Object key, Object value) {
              if (key == lastKey ) // <--- this two lines
                  lastValue = value; // change lastValue if needed
              return table.put(key, value);
          }
       

      ------------------Example-----------------------------------
      import sun.awt.AppContext;

      public class Test {

         public static void main(String argv[]) {
          
              String key="--test key--";
              
              AppContext c = AppContext.getAppContext();
              
              c.get(key);
              c.put(key,"Failed");
              c.get(key);
              c.put(key,"Passed");
              System.out.println(c.get(key));
                        
         }

      }

      -------------------Output------------------------------------
      Failed

      ======================================================================

            duke J. Duke
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: