質問

JColorChoserと一緒に物質外観を使用しているアプリケーションを書いています。これはJava 6ではうまく機能しますが、Java 7で物事を試してみると、それは本当にJColorChooserの:

java.lang.NullPointerException
at org.pushingpixels.substance.internal.ui.SubstanceListUI$SubstanceListSelectionListener$1.run(SubstanceListUI.java:135)
.

これは、Java 7で導入されている新しいJColorChoserと関係があり、その物質が何らかの方法で現在のものに関連付けられていることを推測しています。しかし、私自身のカラー選択者を書くこととは別に、誰かが知っているこの問題を丸めるのはいい方法ですか?私はこの問題を解決するために(希望)物質が完全に更新されるだろうと思われるでしょう、しかし、それが解放される前に、Java 7の初期のビルドのいくつかの新機能で遊ぼうとしたいです。

私はどういうわけかこれに対する答えが疑われるのですが、どこかのどこかにクイックフィックス/パッチがある場合(私は1つ見つかりませんでした)それは役に立ちます!

役に立ちましたか?

解決

This is an interesting study in "Bug Compatibility." If the color is set to null and you try and get the color from the color chooser, a NullPointerException resulted. Kirill expected this and trapped it in a try/catch block. However, in Java 7 they instead return null from that method instead of throwing an NPE.

There are about three snippets of code that need to be changed:

https://github.com/Insubstantial/insubstantial/commit/0f01ae676c6f56d6879862a911ad03caeafabc52

In the next week or so I'm going to publish my first distribution of insubstantial that will include this fix.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top