Wednesday, October 3, 2012

Re: GWT WebApp and iOS 6 Safari

Hi Manolo,
yes the app is crashing and I finally found where it happen.
As I wrote in previous messages, this happen only when using iOS 6 Safari: I tested again with iOS 5 Safari and it works good.

The problem looks really strange:

Accessing to http://127.0.0.1/webcontext/#register:email!code result in Safari to download the GWT App and start onModuleLoad of my EntryPoint.
After that, PlaceHistoryHandler.handleCurrentHistory() raise an exception.
Following the code flow I found that the originating code line that raise the exception is in my RegisterPlace.Tokenizer (whose prefix is "register").

Here is my RegisterPlace class: the exception is raised where the tokenizer try to instanciate the RegisterPlace with the perfectly retrieved tokens.
Exception looks to be a ClassCastException, but I really don't understand why it's raised and why only on iOS 6 Safari.

package com.module.client.place;    import java.util.logging.Logger;    import com.google.gwt.place.shared.Place;  import com.google.gwt.place.shared.PlaceTokenizer;  import com.google.gwt.place.shared.Prefix;    public class RegisterPlace extends Place {            private final static Logger logger = Logger.getLogger(RegisterPlace.class.getName());            private static final String SEPARATOR="!";                    private String email;          private String code;            public RegisterPlace(String email, String code) {                  this.email = email;                  this.code = code;          }            public String getEmail() {                  return email;          }            public String getCode() {                  return code;          }        @Override      public boolean equals(Object obj) {                    if (this == obj ) {              return true;          }          if (obj == null) {              return false;          }          if (    obj instanceof RegisterPlace &&                           ((RegisterPlace)obj).getEmail() != null &&                          ((RegisterPlace)obj).getCode() != null &&                           ((RegisterPlace)obj).getEmail().equals(this.getEmail()) &&                          ((RegisterPlace)obj).getCode().equals(this.getCode()) ) {                  return true;          }          return false;      }                    @Override          public String toString() {                  return "RegisterPlace [email=" + email + ", code=" + code + "]";          }              @Prefix("register")          public static class Tokenizer implements PlaceTokenizer<RegisterPlace> {                    @Override                  public String getToken(RegisterPlace place) {                          return place.getEmail() + SEPARATOR + place.getCode();                  }                    @Override                  public RegisterPlace getPlace(String token) {                          String bits[] = token.split(SEPARATOR);                          if (bits.length == 2) {
return new RegisterPlace(bits[0], bits[1]); } else { return new RegisterPlace(null,null); } } } }




--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/hWjU-csLSNoJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment