问答详情
源自:4-1 百度翻译一

这错误是什么意思呀?

java.lang.IllegalArgumentException: Illegal character in query at index 92: http://openapi.baidu.com/public/2.0/translate/dict/simple?client_id=GLVYQUA55ZLc3t49mlGNaLW3 &q=do &from=auto &to=auto

at java.net.URI.create(URI.java:859)

at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)

at com.imooc.util.WeixinUtil.doGetStr(WeixinUtil.java:69)

at com.imooc.util.WeixinUtil.translate(WeixinUtil.java:289)

at com.imooc.test.WeixinTest.main(WeixinTest.java:42)

Caused by: java.net.URISyntaxException: Illegal character in query at index 92: http://openapi.baidu.com/public/2.0/translate/dict/simple?client_id=GLVYQUA55ZLc3t49mlGNaLW3 &q=do &from=auto &to=auto

at java.net.URI$Parser.fail(URI.java:2829)

at java.net.URI$Parser.checkChars(URI.java:3002)

at java.net.URI$Parser.parseHierarchical(URI.java:3092)

at java.net.URI$Parser.parse(URI.java:3034)

at java.net.URI.<init>(URI.java:595)

at java.net.URI.create(URI.java:857)

... 4 more


提问者:比偶 2015-07-30 10:23

个回答

  • luckyforever
    2016-03-27 16:34:40

    IllegalArgumentException此异常表明向方法传递了一个不合法或不正确的参数。你看看传值的方法是否参数不正确。

  • luckyforever
    2016-03-27 16:33:20

    . lang。IllegalArgumentException:非法字符在查询索引92:http://openapi.baidu.com/public/2.0/translate/dict/simple?client_id = GLVYQUA55ZLc3t49mlGNaLW3 q =做汽车服务只限= =汽车

    java.net.URI.create(URI.java:859)

    在org.apache.http.client.methods.HttpGet。< init >(HttpGet.java:69)

    com.imooc.util.WeixinUtil.doGetStr(WeixinUtil.java:69)

    com.imooc.util.WeixinUtil.translate(WeixinUtil.java:289)

    在com.imooc.test.WeixinTest.main(WeixinTest.java:42)

    引起的:java.net.URISyntaxException:非法字符在查询索引92:http://openapi.baidu.com/public/2.0/translate/dict/simple?client_id = GLVYQUA55ZLc3t49mlGNaLW3 q =做汽车服务只限= =汽车

    java.net.URI Parser.fail美元(URI.java:2829)

    java.net.URI Parser.checkChars美元(URI.java:3002)

    java.net.URI Parser.parseHierarchical美元(URI.java:3092)

    java.net.URI Parser.parse美元(URI.java:3034)

    在java.net.URI。< init >(URI.java:595)

    java.net.URI.create(URI.java:857)

    …4个