Re: org.apache.wicket.util.convert.ConversionException: Cannot parse 'abcdef' using format java.text.DecimalFormat@674dc

2013-03-03 Thread Pratibha
Thanks for the reply, i added Validator,  basically first validate the input
and then convert it.

---Pratibha



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-util-convert-ConversionException-Cannot-parse-abcdef-using-format-java-text-Decimac-tp4656895p4656920.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: org.apache.wicket.util.convert.ConversionException: Cannot parse 'abcdef' using format java.text.DecimalFormat@674dc

2013-03-01 Thread Richard W. Adams
Clearly you're not detecting the non-numeric format before trying to parse 
it. Tracing the execution path with the debugger ought to show where you 
can capture that??




From:   Pratibha pratibha.pari...@gmail.com
To: users@wicket.apache.org
Date:   03/01/2013 07:20 AM
Subject:org.apache.wicket.util.convert.ConversionException: Cannot 
parse 'abcdef' using format java.text.DecimalFormat@674dc



Hi team,

My converter is working perfectly if i enter double value but when i enter
any String value it throws me error, i am unable to catch this error in
feedbackpanel.

Here's my converter code

@Override
 public Object convertToObject(String value, 
java.util.Locale locale) {

 try{

 if 
(Strings.isEmpty(value))
 {
 return 
null;
 }
 else {

 if 
(Double.class.isAssignableFrom(value.getClass())) { 
  return value;
 }
 if 
(value.equals(String.class)) { 
  return convertToString((T)value, locale);
 }
 }
 }
 catch(Exception e){
 error(value,format);
 }
 return value;

 }

 private void error(String value, String errorKey)
 {
 ConversionException e = new 
ConversionException(' + value + ' is not a
valid Double);
 e.setSourceValue(value);
 e.setVariable(format, value);
 e.setResourceKey(getClass().getSimpleName() + . + errorKey);
 throw e;
 }


 and my java code

 final TextFieldDouble field = new 
TextFieldDouble(field, new
PropertyModelDouble(field, fieldNumber)){
 @Override
 public IConverter 
getConverter(Class? clazz)
 {
 return 
new LocaleConverterDouble();
 
 }
 };
 field.setType(Double.class);



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-util-convert-ConversionException-Cannot-parse-abcdef-using-format-java-text-Decimac-tp4656895.html

Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**