Skip to content

Conversation

@dhanalla
Copy link

@dhanalla dhanalla commented Jun 13, 2023

Backport openjdk/jdk#13430


Progress

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

Issue

  • JDK-8305763: Parsing a URI with an underscore goes through a silent exception, negatively impacting performance (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/1428/head:pull/1428
$ git checkout pull/1428

Update a local copy of the PR:
$ git checkout pull/1428
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/1428/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1428

View PR using the GUI difftool:
$ git pr show -t 1428

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/1428.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 13, 2023

👋 Welcome back dhanalla! 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 changed the title Backport 749d4801937ac145f945765f0ba0980bbccf384f 8305763: Parsing a URI with an underscore goes through a silent exception, negatively impacting performance Jun 13, 2023
@openjdk
Copy link

openjdk bot commented Jun 13, 2023

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required labels Jun 13, 2023
@openjdk
Copy link

openjdk bot commented Jun 13, 2023

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

8305763: Parsing a URI with an underscore goes through a silent exception, negatively impacting performance

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

  • c39f3c1: 8278141: LIR_OpLoadKlass::_info shadows the field of the same name from LIR_Op
  • a34d90b: 8277860: PPC: Remove duplicate info != NULL check
  • d7a59f3: 8277417: C1 LIR instruction for load-klass
  • c2e274e: 8304725: AsyncGetCallTrace can cause SIGBUS on M1
  • 3b4df97: 6176679: Application freezes when copying an animated gif image to the system clipboard
  • 2bc77e3: 8299713: Test javax/swing/JTableHeader/6889007/bug6889007.java failed: Wrong type of cursor
  • 50399e3: 8304314: StackWalkTest.java fails after CODETOOLS-7903373
  • fc08b73: 8307348: Parallelize heap walk for ObjectCount(AfterGC) JFR event collection
  • 43f14e4: 8311249: Remove unused MemAllocator::obj_memory_range
  • 8a9162f: 8268852: AsyncLogWriter should not overide is_Named_thread()
  • ... and 109 more: https://git.openjdk.org/jdk17u-dev/compare/12d08f0cabefc6b23690b7c3676ffdfb7388a779...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 13, 2023
@mlbridge
Copy link

mlbridge bot commented Jun 13, 2023

Webrevs

@GoeLin
Copy link
Member

GoeLin commented Jun 14, 2023

What is wrong with the Pre-submti tests?

@dhanalla
Copy link
Author

Thanks @GoeLin, one test "java/util/BitSet/stream/BitSetStreamTest.java" failed with time out error which is not related to my change.

@dhanalla
Copy link
Author

dhanalla commented Jun 22, 2023

Validations with JShell:

   jshell> new URI("http://foo_bar:8080/").getHost()
   $1 ==> null
  jshell> new URI("http://foo_bar:8080/").getPort()
  $2 ==> -1      
  jshell> new URI("http://foobar:8080/").getHost()
  $3 ==> "foobar"      
  jshell> new URI("http://foobar:8080/").getPort()
  $4 ==> 8080

@dhanalla
Copy link
Author

dhanalla commented Jul 7, 2023

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jul 7, 2023
@openjdk
Copy link

openjdk bot commented Jul 7, 2023

@dhanalla
Your change (at version 488a722) is now ready to be sponsored by a Committer.

@RealCLanger
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Jul 13, 2023

Going to push as commit 310115a.
Since your change was applied there have been 138 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 13, 2023
@openjdk openjdk bot closed this Jul 13, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Jul 13, 2023
@openjdk
Copy link

openjdk bot commented Jul 13, 2023

@RealCLanger @dhanalla Pushed as commit 310115a.

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

@dhanalla
Copy link
Author

/backport jdk11u-dev

@openjdk
Copy link

openjdk bot commented Jul 13, 2023

@dhanalla the backport was successfully created on the branch dhanalla-backport-310115aa 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 310115aa from the openjdk/jdk17u-dev repository.

The commit being backported was authored by Dhamoder Nalla on 13 Jul 2023 and had no reviewers.

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.git dhanalla-backport-310115aa:dhanalla-backport-310115aa
$ git checkout dhanalla-backport-310115aa
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev.git dhanalla-backport-310115aa

@FireBurn
Copy link

FireBurn commented Jul 11, 2024

I'm seeing a "URI Syntax Exception: Illegal character in hostname at index 10:" in a PUT after getting a successful bearer token in a previous call the url start https://2t_

Do we need something along the lines of:

diff --git a/src/java.base/share/classes/java/net/URI.java b/src/java.base/share/classes/java/net/URI.java
index 644fc05bdc1..2b6996ee12a 100644
--- a/src/java.base/share/classes/java/net/URI.java
+++ b/src/java.base/share/classes/java/net/URI.java
@@ -2717,6 +2717,10 @@ public final class URI
     private static final long L_DASH = 0x200000000000L; // lowMask("-");
     private static final long H_DASH = 0x0L; // highMask("-");

+    // Underscore, for use in hostnames
+    private static final long L_UNDERSCORE = 0L; // lowMask("_");
+    private static final long H_UNDERSCORE = 0x80000000; // highMask("_");
+
     // Dot, for use in hostnames
     private static final long L_DOT = 0x400000000000L; // lowMask(".");
     private static final long H_DOT = 0x0L; // highMask(".");
@@ -3511,7 +3515,7 @@ public final class URI
                 l = p;
                 if (q > p) {
                     p = q;
-                    q = scan(p, n, L_ALPHANUM | L_DASH, H_ALPHANUM | H_DASH);
+                    q = scan(p, n, L_ALPHANUM | L_DASH | L_UNDERSCORE, H_ALPHANUM | H_DASH | H_UNDERSCORE);
                     if (q > p) {
                         if (input.charAt(q - 1) == '-')
                             fail("Illegal character in hostname", q - 1);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

4 participants