google-code-export / nutz

Automatically exported from code.google.com/p/nutz
Apache License 2.0
1 stars 1 forks source link

context.js的正確格式是? #114

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
问题产生的条件:
使用Ioc ioc = new NutIoc(new JsonLoader("context.js"));
context.js的開頭格式如下:
var ioc = {
    dataSource : {
        type : 'org.apache.commons.dbcp.BasicDataSource',
        singleton : true,
        events : {depose : "close"},
        fields : {xxxx}
        }
        (略)
}
這樣是正常的,可是,如果格式如下:
var ioc={
    dataSource : {
        type : 'org.apache.commons.dbcp.BasicDataSource',
        singleton : true,
        events : {depose : "close"},
        fields : {xxxx}
        }
        (略)
}
就會報錯,而報錯得訊息是:org.nutz.json.JsonException: !Json 
syntax error
nearby [row:1,col:8 char '='], reason: 'Don't know how to handle this char'

不知道有哪位先進也曾遇過此問題呢?

发生问题的调用代码:

异常堆栈:
org.nutz.json.JsonException: !Json syntax error nearby [row:1,col:8 char
'='], reason: 'Don't know how to handle this char'

    org.nutz.json.JsonParsing.makeError(JsonParsing.java:295)
    org.nutz.json.JsonParsing.parseFromCurrentLocation(JsonParsing.java:290)
    org.nutz.json.JsonParsing.parseFromJson(JsonParsing.java:99)
    org.nutz.json.Json.fromJson(Json.java:46)
    org.nutz.json.Json.fromJson(Json.java:78)
    org.nutz.ioc.loader.json.JsonLoader.(JsonLoader.java:30)

相关日志:
OS: Window XP SP3
JDK: 1.6.0_17-b04
Nutz: 1.a.25

Original issue reported on code.google.com by wsc0...@gmail.com on 31 Jan 2010 at 6:41

GoogleCodeExporter commented 9 years ago
的确存在这个问题,之前我看代码的时候就发现了。
现在只认:“var ioc = {” 双引号里面。

这到底算不算Bug呢?

Original comment by wendal1985@gmail.com on 31 Jan 2010 at 7:57

GoogleCodeExporter commented 9 years ago
fixed in 1.a.26(r868)

Update JUnit: JsonTest.with_var_ioc_as_prefix

Original comment by zozoh...@gmail.com on 31 Jan 2010 at 1:36

GoogleCodeExporter commented 9 years ago

Original comment by wendal1985@gmail.com on 13 May 2010 at 11:05

GoogleCodeExporter commented 9 years ago
Verified in 1.a.28

Original comment by wendal1985@gmail.com on 15 May 2010 at 8:29