You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
I have a test failing from time to time with this exception:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.base/java.lang.String.substring(String.java:1841)
at org.eclipse.reddeer.jface.dialogs.TitleAreaDialog.getMessage(TitleAreaDialog.java:96)
I don't know how to reproduce.
We are waiting for an error message to be displayed in our Wizard:
The recording of the test shows that the message is present (but possibly the exception already occurred):
I guess it could be a race condition in TitleAreaDialog.getMessage:
publicStringgetMessage() {
checkShell();
// Page Message is 5th Text within first Composite of TitleAreaDialog and is inactive ControltextControl = handler.getChildren(getShellComposite())[4];
Stringmessage = "";
// -> At this moment the message and image are still emptyif (textControlinstanceoforg.eclipse.swt.widgets.Label) {
message = getMessageLabel(textControl).getText(); // message = ""
} else {
message = getMessageText(textControl).getText();
}
// --> Here the message and image are changed to Error icon + "Authentication failed", but the message variable has already been assignedif(getMessageImage() != null){ // image is not nullmessage = message.substring(1); // StringIndexOutOfBoundsException
}
returnmessage;
}
If I'm correct, a fix could be to add a guard before calling message.substring(1):
if(getMessageImage() != null && message.length > 0){ //if image is shown TitleAreaDialog adds whitespace before messagemessage = message.substring(1);
}
Except if you can think of an atomic way of getting both the image and the message at the same time?
The text was updated successfully, but these errors were encountered:
odockal
added a commit
to odockal/reddeer
that referenced
this issue
Mar 2, 2022
Hi,
I have a test failing from time to time with this exception:
I don't know how to reproduce.
We are waiting for an error message to be displayed in our Wizard:
The recording of the test shows that the message is present (but possibly the exception already occurred):
I guess it could be a race condition in TitleAreaDialog.getMessage:
If I'm correct, a fix could be to add a guard before calling
message.substring(1)
:Except if you can think of an atomic way of getting both the image and the message at the same time?
The text was updated successfully, but these errors were encountered: