5 Replies Latest reply on Jan 30, 2009 2:13 AM by amram99.nate.ridderman.gmail.com

    Problem with converters on Seam 2.1.1.CR1

    chawax

      Hi,


      I just upgraded to Seam 2.1.1.CR1 and it looks like something has changed with converters. Now you have to add @BypassInterceptors annotation in converter class. If you don't, you will have this exception on Seam startup.


      Caused by: java.lang.IllegalStateException: Converter t4.web.converters.OrganizationTypeConverter must be annotated with @BypassInterceptors
           at org.jboss.seam.Component.registerConverterOrValidator(Component.java:330)
           at org.jboss.seam.Component.<init>(Component.java:257)
           at org.jboss.seam.Component.<init>(Component.java:206)
           at org.jboss.seam.init.Initialization.addComponent(Initialization.java:1161)
           ... 93 more
      



      Problem is that I use @In annotation in my converter, and it doesn't work if Seam bypasses interceptors for it ! My converter looks like this :


      @Name(value="organizationTypeConverter")
      @Converter
      @BypassInterceptors
      public class OrganizationTypeConverter implements javax.faces.convert.Converter {
          
          @In(required=false)
          private VOOrganizationType[] organizationTypes;
          
          public Object getAsObject(FacesContext context, UIComponent component, String value) {
              for (VOOrganizationType type : organizationTypes) {
                  if (type.getCode().equals(value))
                      return type;
                  }
              return null;
          }
      
          public String getAsString(FacesContext context, UIComponent component, Object object) {
              return ((VOOrganizationType) object).getCode();
          }
      }



      So how should I do to use @In annotation in converters, so that it will work again ?


      Thanks in advance,


      Olivier