Skip to content

6211257: BasicStroke.createStrokedShape(Shape): NPE is not specified #2377

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

Closed
wants to merge 7 commits into from

Conversation

prsadhuk
Copy link
Contributor

@prsadhuk prsadhuk commented Feb 3, 2021

Method createStrokedShape(Shape) for java.awt.BasicStroke class throws NullPointerException when passed a null object reference for a input parameter but it's not specified in the spec.
Updated spec to illustrate this.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-6211257: BasicStroke.createStrokedShape(Shape): NPE is not specified

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/2377/head:pull/2377
$ git checkout pull/2377

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 3, 2021

👋 Welcome back psadhukhan! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 3, 2021
@openjdk
Copy link

openjdk bot commented Feb 3, 2021

@prsadhuk The following labels will be automatically applied to this pull request:

  • 2d
  • awt

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added 2d client-libs-dev@openjdk.org awt client-libs-dev@openjdk.org labels Feb 3, 2021
@mlbridge
Copy link

mlbridge bot commented Feb 3, 2021

Webrevs

@prsadhuk
Copy link
Contributor Author

prsadhuk commented Feb 3, 2021

/label remove awt

@openjdk openjdk bot removed the awt client-libs-dev@openjdk.org label Feb 3, 2021
@openjdk
Copy link

openjdk bot commented Feb 3, 2021

@prsadhuk
The awt label was successfully removed.

@prsadhuk
Copy link
Contributor Author

prsadhuk commented Feb 3, 2021

/csr JDK-8261033

@openjdk
Copy link

openjdk bot commented Feb 3, 2021

@prsadhuk usage: /csr [needed|unneeded], requires that the issue the pull request refers to links to an approved CSR request.

@prsadhuk
Copy link
Contributor Author

prsadhuk commented Feb 3, 2021

/csr

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Feb 3, 2021
@openjdk
Copy link

openjdk bot commented Feb 3, 2021

@prsadhuk this pull request will not be integrated until the CSR request JDK-8261033 for issue JDK-6211257 has been approved.

@@ -294,6 +294,7 @@ public BasicStroke() {
* stroked outline of a specified {@code Shape}.
* @param s the {@code Shape} boundary be stroked
* @return the {@code Shape} of the stroked outline.
* @exception NullPointerException if {@code Shape} is {@code null}
Copy link
Member

Choose a reason for hiding this comment

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

We use "@throws" in the new code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

any feedback on this?

System.out.println("result (npe): true");
return;
}
throw new RuntimeException("NPE is expected");
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest moving this into the try-block as it would make the intention clearer: if NPE is not thrown, it's a failure.

Also catch should be on the same line as the closing brace of try.

@@ -294,6 +294,7 @@ public BasicStroke() {
* stroked outline of a specified {@code Shape}.
* @param s the {@code Shape} boundary be stroked
* @return the {@code Shape} of the stroked outline.
* @throws NullPointerException if {@code Shape} is {@code null}
Copy link
Member

Choose a reason for hiding this comment

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

I think that you mean the parameter {@code s}, not a type Shape.

Shape s = bs.createStrokedShape(null);
System.out.println("result: false");
}
catch(NullPointerException ne) {
Copy link
Member

Choose a reason for hiding this comment

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

You can add a space after catch and move it to one line above.

}
catch(NullPointerException ne) {
throw new RuntimeException("NPE is expected");
} catch (NullPointerException ne) {
System.out.println("result (npe): true");
return;
Copy link
Member

Choose a reason for hiding this comment

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

Return is from catch is redundant now.

Suggested change
return;

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Feb 8, 2021
@openjdk
Copy link

openjdk bot commented Feb 8, 2021

@prsadhuk 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:

6211257: BasicStroke.createStrokedShape(Shape): NPE is not specified

Reviewed-by: serb, prr, aivanov

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 116 new commits pushed to the master branch:

  • 7451962: 8129776: The optimized Stream returned from Files.lines should unmap the mapped byte buffer (if created) when closed
  • ad525bc: 8261281: Linking jdk.jpackage fails for linux aarch32 builds after 8254702
  • 2fd8ed0: 8240632: Note differences between IEEE 754-2019 math lib special cases and java.lang.Math
  • ace8f94: 8195744: Avoid calling ClassLoader.checkPackageAccess if security manager is not installed
  • ab65d53: 8261261: The version extra fields needs to be overridable in jib-profiles.js
  • 20d7713: 8261334: NMT: tuning statistic shows incorrect hash distribution
  • 92c6e6d: 8261254: Initialize charset mapping data lazily
  • 351d788: 8259074: regex benchmarks and tests
  • d6d5d9b: 8261231: Windows IME was disabled after DnD operation
  • 29a428f: 8261229: MethodData is not correctly initialized with TieredStopAtLevel=3
  • ... and 106 more: https://git.openjdk.java.net/jdk/compare/181d63ffcee7a2f03ed9b8278b5ffface71a494f...master

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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 8, 2021
@prsadhuk
Copy link
Contributor Author

/integrate

@openjdk openjdk bot closed this Feb 10, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Feb 10, 2021
@prsadhuk prsadhuk deleted the JDK-6211257 branch February 10, 2021 07:23
@openjdk
Copy link

openjdk bot commented Feb 10, 2021

@prsadhuk Since your change was applied there have been 136 commits pushed to the master branch:

  • 4619f37: 8261472: BasicConstraintsExtension::toString shows "PathLen:2147483647" if there is no pathLenConstraint
  • 699a3cd: 8223188: Removed unnecessary #ifdef __cplusplus from .cpp sources
  • 05c6009: 8259656: fixpath.sh changes broke _NT_SYMBOL_PATH in RunTests.gmk
  • ef7ee3f: 8225081: Remove Telia Company CA certificate expiring in April 2021
  • 7c565f8: 8261209: isStandalone property: remove dependency on pretty-print
  • 01d9280: 8261299: Use-after-free on failure path in LinuxPackage.c, getJvmLauncherLibPath
  • a00b130: 8261356: Clean up enum G1Mark
  • becee64: 8261279: sun/util/resources/cldr/TimeZoneNamesTest.java timed out
  • f395ee0: 8261306: ServiceLoader documentation has malformed Unicode escape
  • 8f4c15f: 8198540: Dynalink leaks memory when generating type converters
  • ... and 126 more: https://git.openjdk.java.net/jdk/compare/181d63ffcee7a2f03ed9b8278b5ffface71a494f...master

Your commit was automatically rebased without conflicts.

Pushed as commit 3af334a.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2d client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants