Skip to content

Commit

Permalink
8284690: [macos] VoiceOver : Getting java.lang.IllegalArgumentExcepti…
Browse files Browse the repository at this point in the history
…on: Invalid location on Editable JComboBox

Backport-of: ebfa27b9f06aee8ceceabc564a78a351903ce9a1
  • Loading branch information
mrserb committed Dec 6, 2022
1 parent 2abc206 commit d13b813
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jdk/src/macosx/classes/sun/lwawt/macosx/CAccessibleText.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -288,7 +288,9 @@ public String call() throws Exception {
final AccessibleEditableText aet = ac.getAccessibleEditableText();
if (aet == null) return null;

return aet.getTextRange(location, location + length);
int currentLength = aet.getCharCount();
return aet.getTextRange(Math.min(currentLength, location),
Math.min(currentLength, location + length));
}
}, c);
}
Expand Down

1 comment on commit d13b813

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.