drogatkin / TJWS2

Tiny Java Web and App server second generation
66 stars 42 forks source link

Unhandled null pointer exception at initializing a servlet #10

Open drogatkin opened 3 years ago

drogatkin commented 3 years ago

I post this issue on behalf of Robert Roth I had a typo in the attribute name and because I didn't check for null I created a NullPointerException. The problem was that it happened in the init() function of a servlet that was supposed to be initiated at startup. This lead to Atjeews crashing every time I tried to start it. Because of that and becasue it happened on an unrooted phone I couldn't remove the offending servlet either. The only option was to re-install Atjeews.

I think the problem lies here:

https://github.com/drogatkin/TJWS2/blob/be9d1de0dd065d2e21a44fda0184e899841848bf/1.x/src/rogatkin/web/WebAppServlet.java#L379

try { instance.init(ServletAccessDescr.this); } catch (ServletException se) { // this should probably be: } catch((Exception e) { exHolder[0] = se; }

drogatkin commented 3 years ago

I provided the recommended fix, please retest. As for reinstalling Atjeews, perhaps only cleaning data will help, but all servlets need to be installed again.