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") ) { |
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 |
} |
} |