Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of type Long in GWT 2.1 #9

Closed
GoogleCodeExporter opened this issue Mar 21, 2015 · 5 comments
Closed

Handling of type Long in GWT 2.1 #9

GoogleCodeExporter opened this issue Mar 21, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

The encoding of type Long in GWT2.1 seems to have changed.
Instead of appending two doubles, it uses a Base64 representation.

Changing these two methods seem to have solved the problem for me:
SyncClientSerializationStreamWriter:
  public void writeLong(long fieldValue) {
    if (getVersion() == SERIALIZATION_STREAM_MIN_VERSION) {
        double[] parts;
        parts = makeLongComponents((int) (fieldValue >> 32), (int) fieldValue);
        assert parts.length == 2;
        writeDouble(parts[0]);
        writeDouble(parts[1]);
    } else {
        StringBuilder sb = new StringBuilder();
        sb.append('\'');
        sb.append(Base64Utils.toBase64(fieldValue));
        sb.append('\'');
        append(sb.toString());
    }

SyncClientSerializationStreamReader:

  public long readLong() {
        if (getVersion() == SERIALIZATION_STREAM_MIN_VERSION) {
            return (long) readDouble() + (long) readDouble();
        } else {
            return Base64Utils.longFromBase64(results.get(--index));
        }
  }

Original issue reported on code.google.com by [email protected] on 21 Oct 2010 at 2:01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant