String portString = getParameter("port"); if (portString == null) { status.setText("Port parameter missing!"); return; } int port; try { port = Integer.parseInt(portString); } catch (java.lang.NumberFormatException e) { status.setText("Bad port parameter!"); return; }