com.vaadin.event.ListenerMethod$MethodException

Hello all,

For this code:
add.addListener(new Button.ClickListener() {

		public void buttonClick(ClickEvent event) {
	
	
	 try{
		companyDetailBean.businessObjective[countOR]

[0]
=comboBusinessObjectiveType.getItem(Integer.parseInt(comboBusinessObjectiveType.getValue().toString())).toString();

companyDetailBean.businessObjective[countOR]
[1]
=txtdescription.getValue().toString();
companyDetailBean.businessObjectivePriority[countOR]
=Integer.parseInt(comboBOPriority.getValue().toString());
countOR++;

		comboBusinessObjectiveType.select(0);
		txtdescription.setValue("");
		comboBOPriority.select(0);
		
		} catch (Exception e){};
		}
		
	});


I am getting the following exception :

com.vaadin.event.ListenerMethod$MethodException
Cause: java.lang.NumberFormatException: empty String
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:507)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161)
at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1146)
at com.vaadin.ui.Button.fireClick(Button.java:366)
at com.vaadin.ui.Button.changeVariables(Button.java:188)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1087)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:587)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:265)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:482)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at com.featureit.demo.CompanyProfile$1.buttonClick(CompanyProfile.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:487)
… 21 more

As it says, there’s a number format error with empty string. I guess [tt]
Integer.parseInt(“”)
[/tt] or [tt]
parseInt(null)
[/tt] would throw that error. It would probably occur when a TextField with integer string content is empty so that getValue() returns “” or null.