Skip to content

Handling of type Long in GWT 2.1 #9

@GoogleCodeExporter

Description

@GoogleCodeExporter
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 hhcofc...@gmail.com on 21 Oct 2010 at 2:01

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions