Author: fmeschbe
Date: Mon Sep 29 04:19:49 2008
New Revision: 700063
URL: http://svn.apache.org/viewvc?rev=700063&view=rev
Log:
FELIX-662 Not calling toType if the property is null and catching
NumberFormatException
if the target type is numeric but the property value cannot be parsed/converted
Modified:
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
Modified:
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
URL:
http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java?rev=700063&r1=700062&r2=700063&view=diff
==============================================================================
---
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
(original)
+++
felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
Mon Sep 29 04:19:49 2008
@@ -729,7 +729,17 @@
{
// scalar of non-string
String prop = request.getParameter( propName );
- props.put( propName, this.toType( ad.getType(), prop )
);
+ if ( prop != null )
+ {
+ try
+ {
+ props.put( propName, this.toType(
ad.getType(), prop ) );
+ }
+ catch ( NumberFormatException nfe )
+ {
+ // don't care
+ }
+ }
}
else
{
@@ -741,7 +751,14 @@
{
for ( int i = 0; i < properties.length; i++ )
{
- vec.add( this.toType( ad.getType(),
properties[i] ) );
+ try
+ {
+ vec.add( this.toType( ad.getType(),
properties[i] ) );
+ }
+ catch ( NumberFormatException nfe )
+ {
+ // don't care
+ }
}
}
@@ -785,6 +802,10 @@
}
+ /**
+ * @throws NumberFormatException If the value cannot be converted to
+ * a number and type indicates a numeric type
+ */
private Object toType( int type, String value )
{
switch ( type )