You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2010/08/25 06:40:16 UTC

[jira] Commented: (WICKET-2852) Palette nested in a ListView results in a NPE when an error feedback is logged when submitting form

    [ https://issues.apache.org/jira/browse/WICKET-2852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12902293#action_12902293 ] 

Hudson commented on WICKET-2852:
--------------------------------

Integrated in Apache Wicket 1.4.x #117 (See [https://hudson.apache.org/hudson/job/Apache%20Wicket%201.4.x/117/])
    fixed npe in palette
Issue: WICKET-2852


> Palette nested in a ListView results in a NPE when an error feedback is logged when submitting form
> ---------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-2852
>                 URL: https://issues.apache.org/jira/browse/WICKET-2852
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 1.4.7
>            Reporter: Robin Shine
>            Assignee: Igor Vaynberg
>            Priority: Minor
>             Fix For: 1.4.11, 1.5-M2
>
>
> Reproducing steps:
> 1. Put TestPage.html and TestPage.java into a wicket application, visit test page.
> 2. Hit the save button and NullPointerException will be thrown indicating the "ids" field of component Palette$Recorder is not initialized
> If taken Palette outside of ListView, the code will work fine. 
> TestPage.html:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <?xml version="1.0" encoding="UTF-8"?>
> <html xmlns="http://www.w3.org/1999/xhtml">
> 	<head>
> 	    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
> 	</head>
> 	<body>
> 		<form wicket:id="form">
> 			<div wicket:id="palettes">
> 				<div wicket:id="palette"></div>
> 			</div>
> 			<input type="submit" value="save"></input>
> 		</form>
> 		<div wicket:id="feedback"></div>
> 	</body>
> </html>
> TestPage.java:
> import java.util.ArrayList;
> import java.util.List;
> import org.apache.wicket.extensions.markup.html.form.palette.Palette;
> import org.apache.wicket.feedback.ContainerFeedbackMessageFilter;
> import org.apache.wicket.markup.html.WebPage;
> import org.apache.wicket.markup.html.form.Form;
> import org.apache.wicket.markup.html.form.IChoiceRenderer;
> import org.apache.wicket.markup.html.list.ListItem;
> import org.apache.wicket.markup.html.list.ListView;
> import org.apache.wicket.markup.html.panel.FeedbackPanel;
> import org.apache.wicket.model.AbstractReadOnlyModel;
> import org.apache.wicket.model.IModel;
> public class TestPage extends WebPage {
> 	
> 	@SuppressWarnings({ "unchecked", "serial" })
> 	public TestPage() {
> 		Form form = new Form("form") {
> 			@Override
> 			protected void onSubmit() {
> 				error("Please select a value.");
> 			}
> 			
> 		};
> 		add(form);
> 		
> 		List<String> list = new ArrayList<String>();
> 		list.add("1");
> 		
> 		form.add(new ListView("palettes", list) {
> 			@Override
> 			protected void populateItem(ListItem item) {
> 			    IChoiceRenderer renderer = new IChoiceRenderer() {
> 					public Object getDisplayValue(Object object) {
> 						return object;
> 					}
> 					public String getIdValue(Object object, int index) {
> 						return (String) object;
> 					}
> 			    	
> 			    };
> 			    final List selected = new ArrayList();
> 			    IModel model = new IModel() {
> 					public Object getObject() {
> 						return selected;
> 					}
> 					public void setObject(Object object) {
> 						selected.clear();
> 						selected.addAll((List) object);
> 					}
> 					public void detach() {
> 					}
> 			    	
> 			    };
> 			    
> 			    IModel choicesModel = new AbstractReadOnlyModel() {
> 					@Override
> 					public Object getObject() {
> 					    final List<String> choices = new ArrayList<String>();
> 					    choices.add("1");
> 					    choices.add("2");
> 					    return choices;
> 					}
> 			    	
> 			    };
> 			    
> 			    item.add(new Palette("palette", model, choicesModel, renderer, 10, false));
> 			}
> 			
> 		});
> 	    
> 	    add(new FeedbackPanel("feedback", new ContainerFeedbackMessageFilter(this)));
> 	}
> 	
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.