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

不支持1.7.2版本启动? #8

Closed
ghost opened this issue Nov 6, 2015 · 5 comments
Closed

不支持1.7.2版本启动? #8

ghost opened this issue Nov 6, 2015 · 5 comments
Labels

Comments

@ghost
Copy link

ghost commented Nov 6, 2015

我在使用JMCCC的时候遇到了一些问题,希望能得到一些答复

事情是这样的:

本人最近(实际上是今天)写了个针对某服务器的启动器,本人也按照README里的示例去写了启动代码,但是在测试的时候出现了问题:

java.io.IOException: unable to resolve json
    at com.github.to2mbn.jmccc.version.Versions.resolveVersion(Versions.java:39)
    at biz.cirno.jdj.cirnocraft.launcher.form.MainWindow$5.actionPerformed(MainWindow.java:308)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6516)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6281)
    at java.awt.Container.processEvent(Container.java:2229)
    at java.awt.Component.dispatchEventImpl(Component.java:4872)
    at java.awt.Container.dispatchEventImpl(Container.java:2287)
    at java.awt.Component.dispatchEvent(Component.java:4698)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.java:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719)
    at java.awt.Component.dispatchEvent(Component.java:4698)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:740)
    at java.awt.EventQueue.access$300(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:699)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:713)
    at java.awt.EventQueue$4.run(EventQueue.java:711)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:710)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: org.json.JSONException: JSONObject["assets"] not found.
    at org.json.JSONObject.get(JSONObject.java:473)
    at org.json.JSONObject.getString(JSONObject.java:654)
    at com.github.to2mbn.jmccc.version.VersionParser.parse(VersionParser.java:26)
    at com.github.to2mbn.jmccc.version.Versions.resolveVersion(Versions.java:37)
    ... 37 more

根据错误消息可以判断出错误是因为版本json文件里缺少“assets”这个值发生的

但是问题来了:本人所在的服务器的客户端版本为1.7.2,版本文件里并不存在assets这个值,本人也翻阅了部分相关源代码也没能发现有关于这方面的解决方案。

请问这样的问题能否修复,或者给出个解决方案?

(JMCCC版本为最新的2.3.1)

@darkyzhou
Copy link

@yushijinhun 这是他的锅
出现这个错误是因为1.7.10以前的版本用的assets的index都是legacy.json 所以version的json不会包含assets 正在修复

@darkyzhou
Copy link

已解决

@ghost
Copy link
Author

ghost commented Nov 6, 2015

刚才看了下修复后的源代码,虽然确实解决了1.7.2不能启动的问题,但是...1.7.10和以上版本的兼容性怎么办?

PS:我个人认为的解决方法是加个判断,检查是否有assets值,若不存在的时候就加载legacy.json,若存在时加载对应的assets文件

@darkyzhou
Copy link

optString已经把这事干了

@yushijinhun
Copy link
Contributor

我的锅咯

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

2 participants