/[projects]/WebConfig/src/dk/thoerup/webconfig/ConfigServlet.java
ViewVC logotype

Diff of /WebConfig/src/dk/thoerup/webconfig/ConfigServlet.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1319 by torben, Tue Apr 19 20:23:29 2011 UTC revision 1321 by torben, Tue Apr 19 20:29:52 2011 UTC
# Line 84  public class ConfigServlet extends HttpS Line 84  public class ConfigServlet extends HttpS
84                          field.setAccessible(true);                          field.setAccessible(true);
85                          ConfigVariable anno = field.getAnnotation(ConfigVariable.class);                          ConfigVariable anno = field.getAnnotation(ConfigVariable.class);
86                                                    
87                          if (anno == null)                          if (anno == null) {
88                                  throw new ServletException("Field is not annotated");                                  resp.sendError(500, "Field is not annotated");
89                                    return;
90                            }                              
91                                                    
92                          if (anno.readonly() == true)                          if (anno.readonly() == true) {
93                                  throw new ServletException("Can't write a read-only field");                                  resp.sendError(500, "Can't write a read-only field");
94                                    return;
95                            }
96    
97                                                    
98                                                    
99                          if (field.getType().getName().equals("int") ) {                          if (field.getType().getName().equals("int") ) {
# Line 109  public class ConfigServlet extends HttpS Line 114  public class ConfigServlet extends HttpS
114                                  field.set(configObject, value );                                  field.set(configObject, value );
115                          }                          }
116                                                                    
   
117                                                    
118                  } catch (NoSuchFieldException e) {                  } catch (NoSuchFieldException e) {
119                          throw new ServletException(e);                          resp.sendError(500, "No such field: " + name);
120                  } catch (IllegalAccessException e) { //this can't happen                  } catch (IllegalAccessException e) { //this can't happen
121                          throw new ServletException(e);                          throw new ServletException(e);
122                  }                  }

Legend:
Removed from v.1319  
changed lines
  Added in v.1321

  ViewVC Help
Powered by ViewVC 1.1.20