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 2022/03/23 17:13:45 UTC

[wicket] branch wicket-9.x updated (8dcf605 -> 9278637)

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

theigl pushed a change to branch wicket-9.x
in repository https://gitbox.apache.org/repos/asf/wicket.git.


    from 8dcf605  WICKET-6965 Memory leak in WicketEndpoint (#505)
     new 07fe09a  WICKET-6964 Do not allocate when escaping empty string (#502)
     new 9278637  WICKET-6963 Use singletons for PanelMarkupSourcingStrategy (#503)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/wicket/markup/html/border/BorderPanel.java |  2 +-
 .../wicket/markup/html/form/FormComponentPanel.java   |  2 +-
 .../org/apache/wicket/markup/html/panel/Panel.java    |  2 +-
 .../html/panel/PanelMarkupSourcingStrategy.java       | 19 +++++++++++++++++++
 .../java/org/apache/wicket/util/string/Strings.java   |  7 ++++++-
 5 files changed, 28 insertions(+), 4 deletions(-)

[wicket] 01/02: WICKET-6964 Do not allocate when escaping empty string (#502)

Posted by th...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 07fe09a6b87411977100317b240bc41be0d929fc
Author: Thomas Heigl <th...@gmail.com>
AuthorDate: Tue Mar 22 10:20:07 2022 +0100

    WICKET-6964 Do not allocate when escaping empty string (#502)
    
    (cherry picked from commit 28cda68f6e589b4a1d74536fd67c0bc570ebce6e)
---
 .../src/main/java/org/apache/wicket/util/string/Strings.java       | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java b/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java
index d569323..414c427 100755
--- a/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java
@@ -302,7 +302,12 @@ public final class Strings
 			return null;
 		}
 
-		int len = s.length();
+		final int len = s.length();
+		if (len == 0)
+		{
+			return s;
+		}
+
 		final AppendingStringBuffer buffer = new AppendingStringBuffer((int)(len * 1.1));
 
 		for (int i = 0; i < len; i++)

[wicket] 02/02: WICKET-6963 Use singletons for PanelMarkupSourcingStrategy (#503)

Posted by th...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 92786370d7d830d9d4e5a47c0d9e5bf6d2e2259b
Author: Thomas Heigl <th...@gmail.com>
AuthorDate: Wed Mar 23 18:07:00 2022 +0100

    WICKET-6963 Use singletons for PanelMarkupSourcingStrategy (#503)
    
    (cherry picked from commit 2e3e95f919c9eb08eca8898da7d3b3103a497879)
---
 .../apache/wicket/markup/html/border/BorderPanel.java |  2 +-
 .../wicket/markup/html/form/FormComponentPanel.java   |  2 +-
 .../org/apache/wicket/markup/html/panel/Panel.java    |  2 +-
 .../html/panel/PanelMarkupSourcingStrategy.java       | 19 +++++++++++++++++++
 4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/border/BorderPanel.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/border/BorderPanel.java
index c194333..997372a 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/border/BorderPanel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/border/BorderPanel.java
@@ -92,7 +92,7 @@ public abstract class BorderPanel extends Panel
 	@Override
 	protected IMarkupSourcingStrategy newMarkupSourcingStrategy()
 	{
-		return new PanelMarkupSourcingStrategy(true);
+		return PanelMarkupSourcingStrategy.get(true);
 	}
 
 	/**
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java
index 5fe284f..50c4846 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java
@@ -146,7 +146,7 @@ public abstract class FormComponentPanel<T> extends FormComponent<T> implements
 	@Override
 	protected IMarkupSourcingStrategy newMarkupSourcingStrategy()
 	{
-		return new PanelMarkupSourcingStrategy(false);
+		return PanelMarkupSourcingStrategy.get(false);
 	}
 
 	@Override
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Panel.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Panel.java
index 1520c07..ba3d9d9 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Panel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Panel.java
@@ -81,7 +81,7 @@ public abstract class Panel extends WebMarkupContainer implements IQueueRegion
 	@Override
 	protected IMarkupSourcingStrategy newMarkupSourcingStrategy()
 	{
-		return new PanelMarkupSourcingStrategy(false);
+		return PanelMarkupSourcingStrategy.get(false);
 	}
 	
 	/**
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/PanelMarkupSourcingStrategy.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/PanelMarkupSourcingStrategy.java
index 50c80c7..fe0418f 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/PanelMarkupSourcingStrategy.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/PanelMarkupSourcingStrategy.java
@@ -33,10 +33,29 @@ import org.apache.wicket.markup.MarkupStream;
  */
 public class PanelMarkupSourcingStrategy extends AssociatedMarkupSourcingStrategy
 {
+	private static final PanelMarkupSourcingStrategy PANEL_INSTANCE = new PanelMarkupSourcingStrategy(
+		false);
+	private static final PanelMarkupSourcingStrategy BORDER_INSTANCE = new PanelMarkupSourcingStrategy(
+		true);
+
 	// False for Panel and true for Border components.
 	private final boolean allowWicketComponentsInBodyMarkup;
 
 	/**
+	 * @param allowWicketComponentsInBodyMarkup
+	 *            {@code false} for Panel and {@code true} for Border components. If Panel then the
+	 *            body markup should only contain raw markup, which is ignored (removed), but no
+	 *            Wicket Component. With Border components, the body markup will be associated with
+	 *            the Body Component.
+	 * 
+	 * @return A singleton of the strategy
+	 */
+	public static PanelMarkupSourcingStrategy get(final boolean allowWicketComponentsInBodyMarkup)
+	{
+		return allowWicketComponentsInBodyMarkup ? BORDER_INSTANCE : PANEL_INSTANCE;
+	}
+
+	/**
 	 * Constructor.
 	 * 
 	 * @param wicketTagName