Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 6a2e69d

Browse files
committed
8284690: [macos] VoiceOver : Getting java.lang.IllegalArgumentException: Invalid location on Editable JComboBox
Backport-of: ebfa27b9f06aee8ceceabc564a78a351903ce9a1
1 parent 7b8afd5 commit 6a2e69d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibleText.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -288,7 +288,9 @@ public String call() throws Exception {
288288
final AccessibleEditableText aet = ac.getAccessibleEditableText();
289289
if (aet == null) return null;
290290

291-
return aet.getTextRange(location, location + length);
291+
int currentLength = aet.getCharCount();
292+
return aet.getTextRange(Math.min(currentLength, location),
293+
Math.min(currentLength, location + length));
292294
}
293295
}, c);
294296
}

0 commit comments

Comments
 (0)