提交 2edeb643 编写于 作者: J jgodinez

6939417: ArrayIndexOutOfBoundsException in Win 7 on selected printers

Reviewed-by: igor, prr
上级 06a36d9d
...@@ -439,7 +439,14 @@ public class Win32PrintService implements PrintService, AttributeUpdater, ...@@ -439,7 +439,14 @@ public class Win32PrintService implements PrintService, AttributeUpdater,
MediaTray[] arr = new MediaTray[nTray]; MediaTray[] arr = new MediaTray[nTray];
int dmBin; int dmBin;
for (int i = 0, j=0; i < mediaTr.length; i++) {
/* Some drivers in Win 7 don't have the same length for DC_BINS and
* DC_BINNAMES so there is no guarantee that lengths of mediaTr and
* winMediaTrayNames are equal. To avoid getting ArrayIndexOutOfBounds,
* we need to make sure we get the minimum of the two.
*/
for (int i = 0, j=0; i < Math.min(mediaTr.length, winMediaTrayNames.length); i++) {
dmBin = mediaTr[i]; dmBin = mediaTr[i];
if (dmBin > 0) { if (dmBin > 0) {
// check for unsupported DMBINs and create new Win32MediaTray // check for unsupported DMBINs and create new Win32MediaTray
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
/** /**
* @test * @test
* @bug 4485755 6361370 6448717 5080051 * @bug 4485755 6361370 6448717 5080051 6939417
* @summary dialog doesn't have way to specify margins * @summary dialog doesn't have way to specify margins
* for 6361370, verify exception for offline printer in Windows * for 6361370, verify exception for offline printer in Windows
* for 6448717, faster display of print dialog * for 6448717, faster display of print dialog
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册