You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2010/01/17 19:28:31 UTC

svn commit: r900180 - in /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup: MarkupStream.java html/internal/DirectChildTagIterator.java

Author: jdonnerstag
Date: Sun Jan 17 18:28:31 2010
New Revision: 900180

URL: http://svn.apache.org/viewvc?rev=900180&view=rev
Log:
fixed  Enclosure causes Nullpointer exception
Issue: WICKET-2671

Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/MarkupStream.java
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/internal/DirectChildTagIterator.java

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/MarkupStream.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/MarkupStream.java?rev=900180&r1=900179&r2=900180&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/MarkupStream.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/MarkupStream.java Sun Jan 17 18:28:31 2010
@@ -309,7 +309,16 @@
 	}
 
 	/**
-	 * Note:
+	 * The correct way of using MarkupStream is like:
+	 * 
+	 * <pre>
+	 * while (markupStream.hasMore())
+	 * {
+	 *    final MarkupElement cursor = markupStream.get();
+	 *    ...
+	 *    markupStream.next();
+	 * }
+	 * </pre>
 	 * 
 	 * @return The next markup element in the stream
 	 */

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/internal/DirectChildTagIterator.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/internal/DirectChildTagIterator.java?rev=900180&r1=900179&r2=900180&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/internal/DirectChildTagIterator.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/markup/html/internal/DirectChildTagIterator.java Sun Jan 17 18:28:31 2010
@@ -28,7 +28,7 @@
 {
 	private final MarkupStream markupStream;
 	private final ComponentTag parent;
-	private ComponentTag next = null;
+	private ComponentTag next;
 	private int nextIndex;
 	private int currentIndex;
 	private final int originalIndex;
@@ -91,6 +91,9 @@
 		return currentIndex;
 	}
 
+	/**
+	 * 
+	 */
 	private void findNext()
 	{
 		ComponentTag tag = next;
@@ -102,9 +105,10 @@
 			tag = null;
 		}
 
+		markupStream.next();
 		while (markupStream.hasMore())
 		{
-			final MarkupElement cursor = markupStream.next();
+			final MarkupElement cursor = markupStream.get();
 
 			if (cursor.closes(parent))
 			{
@@ -124,6 +128,7 @@
 				nextIndex = markupStream.getCurrentIndex();
 				break;
 			}
+			markupStream.next();
 		}
 	}
 }
\ No newline at end of file