Do not percent-encode '+' in classpath-jar manifest Class-Path entries (#358)

Add '+' to the allowed character class so it passes through literally.

The java stub template packs over-long classpaths into a classpath jar whose manifest Class-Path entries percent-encode any character outside [-_.~/a-zA-Z0-9]. Bzlmod canonical repository names put '+' into every external-repo classpath entry, so those entries now contain "%2b" sequences. '+' is a valid URI path character and needs no encoding, and the "%2b" breaks consumers that pass classpath URLs through printf-style formatting

Closes #358

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/358 from mgalindo-sc:patch-1 367ccce6a08bb163cfde47ebe44fcdf34593f463
PiperOrigin-RevId: 931225696
Change-Id: I3c4e215afc4c67e25e48485cd58d0c2fe2dcd74c
diff --git a/java/bazel/rules/java_stub_template.txt b/java/bazel/rules/java_stub_template.txt
index 115b46e..8dddd4a 100644
--- a/java/bazel/rules/java_stub_template.txt
+++ b/java/bazel/rules/java_stub_template.txt
@@ -315,14 +315,14 @@
   for path in ${CLASSPATH}; do
     # Loop through the characters of the path and convert characters that are
     # not alphanumeric nor -_.~/ to their 2-digit hexadecimal representation
-    if [[ ! $path =~ ^[-_.~/a-zA-Z0-9]*$ ]]; then
+    if [[ ! $path =~ ^[-_.~/a-zA-Z0-9+]*$ ]]; then
       local i c buff
       local converted_path=""
 
       for ((i=0; i<${#path}; i++)); do
         c=${path:$i:1}
         case ${c} in
-              [-_.~/a-zA-Z0-9] ) buff=${c} ;;
+              [-_.~/a-zA-Z0-9+] ) buff=${c} ;;
               * )               printf -v buff '%%%02x' "'$c'"
         esac
         converted_path+="${buff}"