[vlma-devel] commit: Improve the configuration consistency. (Adrien Grand )

git version control git at videolan.org
Fri May 9 20:31:08 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Tue May  6 15:46:24 2008 +0200| [cf82e99a4d114c20863f13df4d12cc39d224c308]

Improve the configuration consistency.

If a variable is known to be an integer, don't let the user enter any string.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=cf82e99a4d114c20863f13df4d12cc39d224c308
---

 .../videolan/vlma/web/dwr/RemoteController.java    |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/web/src/main/java/org/videolan/vlma/web/dwr/RemoteController.java b/web/src/main/java/org/videolan/vlma/web/dwr/RemoteController.java
index 2508193..a2e56ed 100644
--- a/web/src/main/java/org/videolan/vlma/web/dwr/RemoteController.java
+++ b/web/src/main/java/org/videolan/vlma/web/dwr/RemoteController.java
@@ -26,6 +26,7 @@ import javax.servlet.ServletException;
 import org.directwebremoting.WebContext;
 import org.directwebremoting.WebContextFactory;
 import org.videolan.vlma.common.Data;
+import org.videolan.vlma.common.VLMa;
 
 /**
  * A remote ajax controller.
@@ -75,7 +76,12 @@ public class RemoteController {
      * @see Data#setConfigurationProperty()
      */
     public void setConfigurationProperty(String key, String value) {
-        data.setConfigurationProperty(key, value);
+        Class objectClass = VLMa.VARIABLES.get(key);
+        if (VLMa.VARIABLES.get(key).equals(Integer.class)) {
+            data.setConfigurationProperty(key, Integer.valueOf(value).toString());
+        } else {
+            data.setConfigurationProperty(key, value);
+        }
     }
 
 }



More information about the vlma-devel mailing list