Skip to content

Commit

Permalink
8299520: TestPrintXML.java output error messages in case compare fails
Browse files Browse the repository at this point in the history
Reviewed-by: mgronlun
  • Loading branch information
MBaesken committed Jan 3, 2023
1 parent 92dfc73 commit ea25a56
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/jdk/jdk/jfr/tool/TestPrintXML.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ static boolean compare(Object eventObject, Object xmlObject) {
Map<String, Object> xmlMap = (Map<String, Object>) xmlObject;
List<ValueDescriptor> fields = re.getFields();
if (fields.size() != xmlMap.size()) {
System.err.println("Size of fields of recorded object (" + fields.size() +
") and reference (" + xmlMap.size() + ") differ");
return false;
}
for (ValueDescriptor v : fields) {
Expand All @@ -154,6 +156,7 @@ static boolean compare(Object eventObject, Object xmlObject) {
expectedValue = Long.toUnsignedString(re.getLong(name));
}
if (!compare(expectedValue, xmlValue)) {
System.err.println("Expcted value " + expectedValue + " differs from " + xmlValue);
return false;
}
}
Expand All @@ -163,18 +166,26 @@ static boolean compare(Object eventObject, Object xmlObject) {
Object[] array = (Object[]) eventObject;
Object[] xmlArray = (Object[]) xmlObject;
if (array.length != xmlArray.length) {
System.err.println("Array length " + array.length + " differs from length " +
xmlArray.length);
return false;
}
for (int i = 0; i < array.length; i++) {
if (!compare(array[i], xmlArray[i])) {
System.err.println("Array element " + i + "(" + array[i] +
") differs from element " + xmlArray[i]);
return false;
}
}
return true;
}
String s1 = String.valueOf(eventObject);
String s2 = (String) xmlObject;
return s1.equals(s2);
boolean res = s1.equals(s2);
if (! res) {
System.err.println("Event object string " + s1 + " differs from " + s2);
}
return res;
}

static class XMLEvent {
Expand Down

5 comments on commit ea25a56

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@MBaesken
Copy link
Member Author

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on ea25a56 Jan 11, 2023

Choose a reason for hiding this comment

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

@MBaesken the backport was successfully created on the branch MBaesken-backport-ea25a561 in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit ea25a561 from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 3 Jan 2023 and was reviewed by Markus Grönlund.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev MBaesken-backport-ea25a561:MBaesken-backport-ea25a561
$ git checkout MBaesken-backport-ea25a561
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev MBaesken-backport-ea25a561

@MBaesken
Copy link
Member Author

Choose a reason for hiding this comment

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

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on ea25a56 Feb 24, 2023

Choose a reason for hiding this comment

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

@MBaesken the backport was successfully created on the branch MBaesken-backport-ea25a561 in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit ea25a561 from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 3 Jan 2023 and was reviewed by Markus Grönlund.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev MBaesken-backport-ea25a561:MBaesken-backport-ea25a561
$ git checkout MBaesken-backport-ea25a561
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev MBaesken-backport-ea25a561

Please sign in to comment.