[seam-issues] [JBoss JIRA] Commented: (SEAMINTL-33) Injections null when Bundles.get(String) is called

Nicklas Karlsson (JIRA) jira-events at lists.jboss.org
Thu Mar 24 17:02:45 EDT 2011


    [ https://issues.jboss.org/browse/SEAMINTL-33?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12591695#comment-12591695 ] 

Nicklas Karlsson commented on SEAMINTL-33:
------------------------------------------

(extending HashMap won't work because it has final methods). I made a small test look that did

      for (Method m : Bundles.class.getMethods())
      {
         try
         {
            System.out.print(m.getName() + " is ");
            Class<?>[] params = m.getParameterTypes();
            Object[] paramVals = new Object[params.length];
            int i = 0;
            for (Class<?> c : params)
            {
               paramVals[i] = c.newInstance();
               i++;
            }
            m.invoke(bundles, paramVals);
            System.out.println("ok");
         }
         catch (Exception e)
         {
            System.out.println("not ok, " + e.getMessage());
         }
      }

and I got (null is NPE)

22:56:27,702 INFO  [STDOUT] get is not ok, null
22:56:35,099 INFO  [STDOUT] get is not ok, null
22:56:41,445 INFO  [STDOUT] put is not ok, null
22:56:44,812 INFO  [STDOUT] put is not ok, null
22:56:47,079 INFO  [STDOUT] values is ok
22:56:50,777 INFO  [STDOUT] clear is ok
22:56:55,066 INFO  [STDOUT] isEmpty is ok
22:57:01,793 INFO  [STDOUT] entrySet is ok
22:57:02,578 INFO  [STDOUT] putAll is not ok, java.util.Map
22:57:03,857 INFO  [STDOUT] size is ok
22:57:06,818 INFO  [STDOUT] remove is ok
22:57:07,525 INFO  [STDOUT] remove is ok
22:57:08,232 INFO  [STDOUT] keySet is ok
22:57:08,963 INFO  [STDOUT] containsKey is ok
22:57:10,205 INFO  [STDOUT] containsValue is ok

Some pass, some don't. And almost all methods are passthrough to the same place...

> Injections null when Bundles.get(String) is called
> --------------------------------------------------
>
>                 Key: SEAMINTL-33
>                 URL: https://issues.jboss.org/browse/SEAMINTL-33
>             Project: Seam International
>          Issue Type: Bug
>          Components: Messages
>    Affects Versions: 3.0.0.CR2
>            Reporter: Nicklas Karlsson
>            Assignee: Ken Finnigan
>         Attachments: arquillian.zip, passivation.zip
>
>
> Strange one. I'm trying to @Produce shorthands for my bundles so I have @Injected Bundles bundles but I get a NPE from my
>    @Produces
>    @Named
>    public ResourceBundle getMsg()
>    {
>       return bundles.get("default");
>    }
> The strange thing is that if I put breakpoints in Bundles.size() and Bundles.get(String), the injected Locale and ApplicationBundles are null for get(String) but non-null for the size() invocations!

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list