You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by th...@apache.org on 2020/09/30 08:01:51 UTC

[wicket] branch master updated: WICKET-6835 Improve performance of `AbstractMapper.getPlaceholder`

This is an automated email from the ASF dual-hosted git repository.

theigl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e29178  WICKET-6835 Improve performance of `AbstractMapper.getPlaceholder`
     new efa3175  Merge pull request #455 from theigl/WICKET-6835-mapper-get-placeholder
3e29178 is described below

commit 3e29178981b1d42cd75fdeccdba620b8ce89e37f
Author: Thomas Heigl <th...@gmail.com>
AuthorDate: Tue Sep 29 17:20:19 2020 +0200

    WICKET-6835 Improve performance of `AbstractMapper.getPlaceholder`
---
 .../main/java/org/apache/wicket/request/mapper/AbstractMapper.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/AbstractMapper.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/AbstractMapper.java
index 1fdf955..14408c0 100644
--- a/wicket-request/src/main/java/org/apache/wicket/request/mapper/AbstractMapper.java
+++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/AbstractMapper.java
@@ -68,7 +68,11 @@ public abstract class AbstractMapper implements IRequestMapper
 	 */
 	protected String getPlaceholder(final String s, char startChar)
 	{
-		if ((s == null) || (s.length() < 4) || !s.startsWith(startChar + "{") || !s.endsWith("}"))
+		if (s == null || s.length() < 4)
+		{
+			return null;
+		}
+		else if (s.charAt(0) != startChar || s.charAt(1) != '{' || s.charAt(s.length() - 1) != '}')
 		{
 			return null;
 		}