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

Problem with int64 type in javascript API #40

Closed
ghost opened this issue Mar 6, 2018 · 3 comments
Closed

Problem with int64 type in javascript API #40

ghost opened this issue Mar 6, 2018 · 3 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Mar 6, 2018

We have a problem: when maven generate javascript api our parameters with int64 type have equals and incorrect index. Please fix it, as soon as possible please, it is very important for us.

In example serverEventDatetime parameter is int64.

this.Journal.prototype.marshal = function () {
    var segs = [];
    if (this.serverEventDatetime) {


        var seg = [4]; // PROBLEM IN THIS LINE, MUST BE: var seg = [0];


        if (this.serverEventDatetime < 0) {
            seg[0] |= 128;
            if (this.serverEventDatetime < Number.MIN_SAFE_INTEGER)
                fail('colfer: api/Journal field serverEventDatetime exceeds Number.MIN_SAFE_INTEGER');
            encodeVarint(seg, -this.serverEventDatetime);
        } else {
            if (this.serverEventDatetime > Number.MAX_SAFE_INTEGER)
                fail('colfer: api/Journal field serverEventDatetime exceeds Number.MAX_SAFE_INTEGER');
            encodeVarint(seg, this.serverEventDatetime);
        }
        segs.push(seg);
    }
    if (this.subsystemCode) {
        var utf = encodeUTF8(this.subsystemCode);
        var seg = [1];
        encodeVarint(seg, utf.length);
        segs.push(seg);
        segs.push(utf)
    }
    if (this.code) {
        var utf = encodeUTF8(this.code);
        var seg = [2];
        encodeVarint(seg, utf.length);
        segs.push(seg);
        segs.push(utf)
    }
// ................................................................................
this.Journal.prototype.unmarshal = function (data) {
// ................................................................................
//IN UNMARSHAL HEADER CORRECT
    if (header == 0) {
        var x = readVarint();
        if (x < 0) fail('colfer: api/IJournal field serverEventDatetime exceeds Number.MAX_SAFE_INTEGER');
        this.serverEventDatetime = x;
        readHeader();
    } else if (header == (0 | 128)) {
        var x = readVarint();
        if (x < 0) fail('colfer: api/Journal field serverEventDatetime exceeds Number.MAX_SAFE_INTEGER');
        this.serverEventDatetime = -1 * x;
        readHeader();
    }

    if (header == 1) {
        var size = readVarint();
        if (size < 0)
            fail('colfer: api.Journal.subsystemCode size exceeds Number.MAX_SAFE_INTEGER');
        else if (size > colferSizeMax)
            fail('colfer: api.Journal.subsystemCode size ' + size + ' exceeds ' + colferSizeMax + ' UTF-8 bytes');

        var start = i;
        i += size;
        if (i > data.length) fail(EOF);
        this.subsystemCode = decodeUTF8(data.subarray(start, i));
        readHeader();
    }

    if (header == 2) {
        var size = readVarint();
        if (size < 0)
            fail('colfer: api.Journal.code size exceeds Number.MAX_SAFE_INTEGER');
        else if (size > colferSizeMax)
            fail('colfer: api.Journal.code size ' + size + ' exceeds ' + colferSizeMax + ' UTF-8 bytes');

        var start = i;
        i += size;
        if (i > data.length) fail(EOF);
        this.code = decodeUTF8(data.subarray(start, i));
        readHeader();
    }
// ................................................................................
@pascaldekloe pascaldekloe self-assigned this Mar 6, 2018
@pascaldekloe
Copy link
Owner

I will fix this right now for you @nikolkax. Can you please share the schema? Feel free to change the names if you must.

@pascaldekloe
Copy link
Owner

Never mind @nikolkax, I just found the (very stupid) mistake. You'll have a fix within the hour.

@pascaldekloe
Copy link
Owner

Maven plugin version 1.11.2 should be in the central repository within a few minutes.

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

No branches or pull requests

1 participant