首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JayRock间歇缺失值

JayRock间歇缺失值
EN

Stack Overflow用户
提问于 2013-08-21 12:47:50
回答 1查看 187关注 0票数 1

我在JayRock上遇到了问题,在那里我间歇地收到丢失的值错误。

我无法重新创建错误,但它发生在生产每天大约100-150次(在成千上万的请求)。

经过研究发现,在失败的请求中,HTTP请求中没有RequestBody元素。

通常情况下是这样的:

urlfield {"id":1,“方法”:“getAllAirports”,"params":[]} 曲奇饼

但是,如果请求没有生效,则请求包含:

厄尔菲尔德

我使用的是默认的JayRock代理,通过使用测试页面,请求总是可以工作的。

以前有人遇到过这种情况吗?或者有什么想法?

非常感谢,

艾恩

更新:查看数据似乎完全是IE中的一个错误,在IE7、8、9和10中有错误。尽管8的错误最多,尽管它的流量可以与9相比,但少于10。

EN

回答 1

Stack Overflow用户

发布于 2013-10-24 14:40:42

似乎是Jayrock http://jayrock.googlecode.com/hg/src/Jayrock.Json/Json/JsonTextReader.cs的解析问题

代码语言:javascript
复制
private JsonToken Parse()
    {
        char ch = NextClean();

        //
        // String
        //

        if (ch == '"' || ch == '\'')
        {
            return Yield(JsonToken.String(NextString(ch)));
        }

        //
        // Object
        //

        if (ch == '{')
        {
            _reader.Back();
            return ParseObject();
        }

        //
        // Array
        //

        if (ch == '[')
        {
            _reader.Back();
            return ParseArray();
        }

        //
        // Handle unquoted text. This could be the values true, false, or
        // null, or it can be a number. An implementation (such as this one)
        // is allowed to also accept non-standard forms.
        //
        // Accumulate characters until we reach the end of the text or a
        // formatting character.
        // 

        StringBuilder sb = new StringBuilder();
        char b = ch;

        while (ch >= ' ' && ",:]}/\\\"[{;=#".IndexOf(ch) < 0) 
        {
            sb.Append(ch);
            ch = _reader.Next();
        }

        _reader.Back();

        string s = sb.ToString().Trim();

        if (s.Length == 0)
            throw SyntaxError("Missing value.");


        //
        // Boolean
        //

        if (s == JsonBoolean.TrueText || s == JsonBoolean.FalseText)
            return Yield(JsonToken.Boolean(s == JsonBoolean.TrueText));

        //
        // Null
        //

        if (s == JsonNull.Text)
            return Yield(JsonToken.Null());

        //
        // Number
        //
        // Try converting it. We support the 0- and 0x- conventions. 
        // If a number cannot be produced, then the value will just
        // be a string. Note that the 0-, 0x-, plus, and implied 
        // string conventions are non-standard, but a JSON text parser 
        // is free to accept non-JSON text forms as long as it accepts 
        // all correct JSON text forms.
        //

        if ((b >= '0' && b <= '9') || b == '.' || b == '-' || b == '+')
        {
            if (b == '0' && s.Length > 1 && s.IndexOfAny(_numNonDigitChars) < 0)
            {
                if (s.Length > 2 && (s[1] == 'x' || s[1] == 'X'))
                {
                    string parsed = TryParseHex(s);
                    if (!ReferenceEquals(parsed, s))
                        return Yield(JsonToken.Number(parsed));
                }
                else
                {
                    string parsed = TryParseOctal(s);
                    if (!ReferenceEquals(parsed, s))
                        return Yield(JsonToken.Number(parsed));
                }
            }
            else
            {
                if (!JsonNumber.IsValid(s))
                    throw SyntaxError(string.Format("The text '{0}' has the incorrect syntax for a number.", s));

                return Yield(JsonToken.Number(s));
            }
        }

        //
        // Treat as String in all other cases, e.g. when unquoted.
        //

        return Yield(JsonToken.String(s));
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18357851

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档