| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4653dbe commit 9833a4c
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -299,7 +299,9 @@ else if (!StringUtils.hasText(pattern1)) { | |||
| 299 | 299 | else if (!StringUtils.hasText(pattern2)) { | |
| 300 | 300 | return pattern1; | |
| 301 | 301 | } | |
| 302 | - else if (!pattern1.contains("{") && match(pattern1, pattern2)) { | ||
| 302 | + else if (!pattern1.equals(pattern2) && !pattern1.contains("{") && match(pattern1, pattern2)) { | ||
| 303 | + // /* + /hotel -> /hotel ; "/*.*" + "/*.html" -> /*.html | ||
| 304 | + // However /user + /user -> /usr/user ; /{foo} + /bar -> /{foo}/bar | ||
| 303 | 305 | return pattern2; | |
| 304 | 306 | } | |
| 305 | 307 | else if (pattern1.endsWith("/*")) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -348,13 +348,13 @@ public void extractUriTemplateVariablesRegex() { | |||
| 348 | 348 | assertEquals("com.example", result.get("symbolicName")); | |
| 349 | 349 | assertEquals("1.0.0", result.get("version")); | |
| 350 | 350 | } | |
| 351 | - | ||
| 351 | + | ||
| 352 | 352 | // SPR-7787 | |
| 353 | - | ||
| 353 | + | ||
| 354 | 354 | @Test | |
| 355 | 355 | public void extractUriTemplateVarsRegexQualifiers() { | |
| 356 | 356 | Map<String, String> result = pathMatcher.extractUriTemplateVariables( | |
| 357 | - "{symbolicName:[\\p{L}\\.]+}-sources-{version:[\\p{N}\\.]+}.jar", | ||
| 357 | + "{symbolicName:[\\p{L}\\.]+}-sources-{version:[\\p{N}\\.]+}.jar", | ||
| 358 | 358 | "com.example-sources-1.0.0.jar"); | |
| 359 | 359 | assertEquals("com.example", result.get("symbolicName")); | |
| 360 | 360 | assertEquals("1.0.0", result.get("version")); | |
@@ -376,18 +376,18 @@ public void extractUriTemplateVarsRegexQualifiers() { | |||
| 376 | 376 | } | |
| 377 | 377 | ||
| 378 | 378 | // SPR-8455 | |
| 379 | - | ||
| 379 | + | ||
| 380 | 380 | @Test | |
| 381 | 381 | public void extractUriTemplateVarsRegexCapturingGroups() { | |
| 382 | 382 | try { | |
| 383 | 383 | pathMatcher.extractUriTemplateVariables("/web/{id:foo(bar)?}", "/web/foobar"); | |
| 384 | 384 | fail("Expected exception"); | |
| 385 | 385 | } catch (IllegalArgumentException e) { | |
| 386 | - assertTrue("Expected helpful message on the use of capturing groups", | ||
| 386 | + assertTrue("Expected helpful message on the use of capturing groups", | ||
| 387 | 387 | e.getMessage().contains("The number of capturing groups in the pattern")); | |
| 388 | 388 | } | |
| 389 | 389 | } | |
| 390 | - | ||
| 390 | + | ||
| 391 | 391 | @Test | |
| 392 | 392 | public void combine() { | |
| 393 | 393 | assertEquals("", pathMatcher.combine(null, null)); | |
@@ -410,7 +410,8 @@ public void combine() { | |||
| 410 | 410 | assertEquals("/*.html", pathMatcher.combine("/**", "/*.html")); | |
| 411 | 411 | assertEquals("/*.html", pathMatcher.combine("/*", "/*.html")); | |
| 412 | 412 | assertEquals("/*.html", pathMatcher.combine("/*.*", "/*.html")); | |
| 413 | - assertEquals("/{foo}/bar", pathMatcher.combine("/{foo}", "/bar")); | ||
| 413 | + assertEquals("/{foo}/bar", pathMatcher.combine("/{foo}", "/bar")); // SPR-8858 | ||
| 414 | + assertEquals("/user/user", pathMatcher.combine("/user", "/user")); // SPR-7970 | ||
| 414 | 415 | } | |
| 415 | 416 | ||
| 416 | 417 | @Test | |
| Back | FazBrowse Home | New Git URL |
0 commit comments