提交 4b3e2ab4 编写于 作者: L lana

Merge

...@@ -614,14 +614,15 @@ public final class AlphaComposite implements Composite { ...@@ -614,14 +614,15 @@ public final class AlphaComposite implements Composite {
} }
private AlphaComposite(int rule, float alpha) { private AlphaComposite(int rule, float alpha) {
if (alpha < 0.0f || alpha > 1.0f) {
throw new IllegalArgumentException("alpha value out of range");
}
if (rule < MIN_RULE || rule > MAX_RULE) { if (rule < MIN_RULE || rule > MAX_RULE) {
throw new IllegalArgumentException("unknown composite rule"); throw new IllegalArgumentException("unknown composite rule");
} }
this.rule = rule; if (alpha >= 0.0f && alpha <= 1.0f) {
this.extraAlpha = alpha; this.rule = rule;
this.extraAlpha = alpha;
} else {
throw new IllegalArgumentException("alpha value out of range");
}
} }
/** /**
......
...@@ -3058,7 +3058,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { ...@@ -3058,7 +3058,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
return; return;
} }
/* Use lock specific to the font system */ /* Use lock specific to the font system */
synchronized (lucidaFontName) { synchronized (this) {
if (FontUtilities.debugFonts()) { if (FontUtilities.debugFonts()) {
Thread.dumpStack(); Thread.dumpStack();
FontUtilities.getLogger() FontUtilities.getLogger()
...@@ -3194,7 +3194,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE { ...@@ -3194,7 +3194,7 @@ public abstract class SunFontManager implements FontSupport, FontManagerForSGE {
return; return;
} }
/* Use lock specific to the font system */ /* Use lock specific to the font system */
synchronized (lucidaFontName) { synchronized (this) {
if (FontUtilities.debugFonts()) { if (FontUtilities.debugFonts()) {
Thread.dumpStack(); Thread.dumpStack();
FontUtilities.getLogger().info("loadAllFontFiles() called"); FontUtilities.getLogger().info("loadAllFontFiles() called");
......
/*
* @test
* @bug 6918065
* @summary Test for passing NaN as alpha
* should throw IllegalArgumentException
*/
import java.awt.*;
public class TestAlphaCompositeForNaN {
public static void main(String[] args) {
try {
AlphaComposite a = AlphaComposite.getInstance(AlphaComposite.DST, Float.NaN);
System.out.println("Failed");
throw new RuntimeException(a + " failed to throw IllegalArgumentException for alpha = " + Float.NaN);
}
catch (IllegalArgumentException ie) {
System.out.println("Passed");
System.out.println("Caught " + ie);
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册