-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDK-8264454 : Jaxp unit test from open jdk needs to be improved #3274
Conversation
👋 Welcome back mahendrachhipa! A progress list of the required criteria for merging this PR into |
@mahendrachhipa The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
} catch (Exception e) { | ||
e.printStackTrace(); | ||
Assert.fail("Exception occured: " + e.getMessage()); | ||
runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To address item 4 (the environment is changed), a note, something like "this test runs in othervm" can be added here or to the summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the comment
|
||
@Test | ||
public void test1() { | ||
public void testSAXParserFactoryCreationWithDefaultContextClassLoader() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A shorter name such as testWithDefaultClassLoader would be fine.
@@ -41,27 +42,28 @@ | |||
*/ | |||
@Listeners({jaxp.library.BasePolicy.class}) | |||
public class Bug6723276Test { | |||
private static final String ERR_MSG = "org.apache.xerces.jaxp.SAXParserFactoryImpl not found"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test currently doesn't verify anything since there's no org.apache.xerces.jaxp.SAXParserFactoryImpl on the classpath. Post JDK 9, such test would require creating a dummy module.
Assert.fail(e.getMessage()); | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
public void test2() { | ||
public void testSAXParserFactoryCreationWithGivenURLContextClassLoader() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A shorter name would be testWithURLClassLoader
Assert.assertEquals(calendar.getYear(), 1970); | ||
Assert.assertEquals(calendar.getMonth(), 1); | ||
Assert.assertEquals(calendar.getDay(), 2); | ||
Assert.assertEquals(calendar.getHour(), 0, "hour 24 needs to be treated as hour 0 of next day"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change has added assertions, but it seems ok.
@@ -56,7 +57,7 @@ | |||
private static final String TEST_VALUE_FAIL = "*FAIL*"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this in the expected values. It, along with the related assertions, may be removed.
if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(duration.toString())) { | ||
Assert.fail("Duration created with \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" was expected to be \"" | ||
+ TEST_VALUES_LEXICAL[onTestValue + 1] + "\" and has the value \"" + duration.toString() + "\""); | ||
if (!expectedLex.equals(duration.toString())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be changed to assertEquals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// for now due to a bug | ||
try { | ||
QName xmlSchemaType = duration.getXMLSchemaType(); | ||
if (!xmlSchemaType.equals(DatatypeConstants.DURATION_YEARMONTH)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be changed to assertEquals
+ DatatypeConstants.DURATION_YEARMONTH + "\" and has the value \"" + duration.toString() + "\""); | ||
} | ||
} | ||
} catch (IllegalStateException illegalStateException) { | ||
// TODO; this test really should pass | ||
System.err.println("Please fix this bug that is being ignored, for now: " + illegalStateException.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still have such a bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, test is still trowing IllegalStateException.
Ok, this is enough of improvement for now. I created a bug to keep track of the ISE case. |
@mahendrachhipa This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 394 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@JoeWang-Java) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@mahendrachhipa |
/sponsor |
1 similar comment
/sponsor |
@JoeWang-Java @mahendrachhipa Since your change was applied there have been 401 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 308f679. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
@msheppar The command |
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3274/head:pull/3274
$ git checkout pull/3274
Update a local copy of the PR:
$ git checkout pull/3274
$ git pull https://git.openjdk.java.net/jdk pull/3274/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3274
View PR using the GUI difftool:
$ git pr show -t 3274
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3274.diff