void checkHealth() { // Check that the sending operation is still active if (writeStarted > -1 && System.currentTimeMillis() - writeStarted > JiveGlobals.getIntProperty("xmpp.session.sending-limit", 60000)) { // Close the socket if (Log.isDebugEnabled()) { Log.debug( "Closing connection: " + this + " that started sending data at: " + new Date(writeStarted)); } forceClose(); } else { // Check if the connection has been idle. A connection is considered idle if the client // has not been receiving data for a period. Sending data to the client is not // considered as activity. if (idleTimeout > -1 && socketReader != null && System.currentTimeMillis() - socketReader.getLastActive() > idleTimeout) { // Close the socket if (Log.isDebugEnabled()) { Log.debug("Closing connection that has been idle: " + this); } forceClose(); } } }
private DatabaseManager() { /* * Load time from globals if it is set. It represents the minutes the * log entries stay in database until they will get deleted */ // TODO: Use PropertyEventListener to check if cleaner.minutes have // changed _dbCleanMinutes = JiveGlobals.getIntProperty("plugin.remoteroster.log.cleaner.minutes", 60); startDatabaseCleanLoop(); }
public ServerSocketReader( PacketRouter router, RoutingTable routingTable, String serverName, Socket socket, SocketConnection connection, boolean useBlockingMode) { super(router, routingTable, serverName, socket, connection, useBlockingMode); // Create a pool of threads that will process received packets. If more threads are // required then the command will be executed on the SocketReader process int coreThreads = JiveGlobals.getIntProperty("xmpp.server.processing.core.threads", 2); int maxThreads = JiveGlobals.getIntProperty("xmpp.server.processing.max.threads", 50); int queueSize = JiveGlobals.getIntProperty("xmpp.server.processing.queue", 50); threadPool = new ThreadPoolExecutor( coreThreads, maxThreads, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(queueSize), new ThreadPoolExecutor.CallerRunsPolicy()); }
private void init() { // Create a pool of threads that will process incoming packets. int maxThreads = JiveGlobals.getIntProperty("xmpp.manager.incoming.threads", 5); if (maxThreads < 1) { // Ensure that the max number of threads in the pool is at least 1 maxThreads = 1; } threadPool = new ThreadPoolExecutor( maxThreads, maxThreads, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new ThreadPoolExecutor.CallerRunsPolicy()); // Create a thread that will read and store DOM Elements. Thread thread = new Thread("Server Packet Reader") { public void run() { while (open) { Element doc; try { doc = reader.parseDocument().getRootElement(); if (doc == null) { // Stop reading the stream since the remote server has sent an end of // stream element and probably closed the connection. shutdown(); } else { // Queue task that process incoming stanzas threadPool.execute(new ProcessStanzaTask(packetsHandler, doc)); } } catch (IOException e) { Log.debug("Finishing Incoming Server Stanzas Reader.", e); shutdown(); } catch (Exception e) { Log.error("Finishing Incoming Server Stanzas Reader.", e); shutdown(); } } } }; thread.setDaemon(true); thread.start(); }
private void deliverRawText(String text, boolean asynchronous) { if (!isClosed()) { boolean errorDelivering = false; IoBuffer buffer = IoBuffer.allocate(text.length()); buffer.setAutoExpand(true); try { // Charset charset = Charset.forName(CHARSET); // buffer.putString(text, charset.newEncoder()); buffer.put(text.getBytes(CHARSET)); if (flashClient) { buffer.put((byte) '\0'); } buffer.flip(); ioSessionLock.lock(); try { if (asynchronous) { // OF-464: handle dropped connections (no backupDeliverer in this case?) if (!ioSession.isConnected()) { throw new IOException("Connection reset/closed by peer"); } ioSession.write(buffer); } else { // Send stanza and wait for ACK (using a 2 seconds default timeout) boolean ok = ioSession .write(buffer) .awaitUninterruptibly( JiveGlobals.getIntProperty("connection.ack.timeout", 2000)); if (!ok) { Log.warn("No ACK was received when sending stanza to: " + this.toString()); } } } finally { ioSessionLock.unlock(); } } catch (Exception e) { Log.debug("Error delivering raw text:\n" + text, e); errorDelivering = true; } // Close the connection if delivering text fails and we are already not closing the connection if (errorDelivering && asynchronous) { close(); } } }
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"); org.jivesoftware.util.WebManager webManager = null; synchronized (_jspx_page_context) { webManager = (org.jivesoftware.util.WebManager) _jspx_page_context.getAttribute("webManager", PageContext.PAGE_SCOPE); if (webManager == null) { webManager = new org.jivesoftware.util.WebManager(); _jspx_page_context.setAttribute("webManager", webManager, PageContext.PAGE_SCOPE); } } out.write('\r'); out.write('\n'); webManager.init(request, response, session, application, out); boolean save = request.getParameter("save") != null; boolean success = request.getParameter("success") != null; String persistentRosterParam = request.getParameter("persistentEnabled"); boolean persistentRoster = persistentRosterParam == null ? false : persistentRosterParam.equals("true"); String ignoreSubdomainsParam = request.getParameter("ignoreSubdomains"); boolean ignnoreSubdomains = ignoreSubdomainsParam == null ? false : ignoreSubdomainsParam.equals("true"); String blockPresencesParam = request.getParameter("blockPresences"); boolean blockPresences = blockPresencesParam == null ? false : blockPresencesParam.equals("true"); String sparkdiscoParam = request.getParameter("sparkDiscoInfo"); boolean sparkDiscoInfo = sparkdiscoParam == null ? false : sparkdiscoParam.equals("true"); String iqLastFilterPram = request.getParameter("iqLastFilter"); boolean iqLastFilter = iqLastFilterPram == null ? false : iqLastFilterPram.equals("true"); String mucFilterParam = request.getParameter("mucFilter"); boolean mucFilter = mucFilterParam == null ? false : mucFilterParam.equals("true"); String gajimBroadcastParam = request.getParameter("gajimBroadcast"); boolean gajimBroadcast = gajimBroadcastParam == null ? false : gajimBroadcastParam.equals("true"); String[] componentsEnabled = request.getParameterValues("enabledComponents[]"); PermissionManager _pmanager = new PermissionManager(); DatabaseManager _db; Map<String, String> errors = new HashMap<String, String>(); if (save) { for (String property : JiveGlobals.getPropertyNames("plugin.remoteroster.jids")) { JiveGlobals.deleteProperty(property); } if (componentsEnabled != null) { for (int i = 0; i < componentsEnabled.length; i++) { JiveGlobals.setProperty("plugin.remoteroster.jids." + componentsEnabled[i], "true"); String group = request.getParameter("input_group." + componentsEnabled[i]); if (group != null) { _pmanager.setGroupForGateway(componentsEnabled[i], group); } } } JiveGlobals.setProperty( "plugin.remoteroster.persistent", (persistentRoster ? "true" : "false")); JiveGlobals.setProperty( "plugin.remoteroster.blockPresences", (blockPresences ? "true" : "false")); JiveGlobals.setProperty( "plugin.remoteroster.sparkDiscoInfo", (sparkDiscoInfo ? "true" : "false")); JiveGlobals.setProperty( "plugin.remoteroster.iqLastFilter", (iqLastFilter ? "true" : "false")); JiveGlobals.setProperty("plugin.remoteroster.mucFilter", (mucFilter ? "true" : "false")); JiveGlobals.setProperty( "plugin.remoteroster.gajimBroadcast", (gajimBroadcast ? "true" : "false")); JiveGlobals.setProperty( "plugin.remoteroster.ignoreSubdomains", (ignnoreSubdomains ? "true" : "false")); response.sendRedirect("rr-main.jsp?success=true"); return; } // Get the session manager SessionManager sessionManager = webManager.getSessionManager(); Collection<ComponentSession> sessions = sessionManager.getComponentSessions(); _db = DatabaseManager.getInstance(); out.write( "\r\n\r\n<html>\r\n<head>\r\n<title>Gojara Settings</title>\r\n<link href=\"./css/rr.css\" rel=\"stylesheet\" type=\"text/css\">\r\n<script src=\"./js/http.js\" type=\"text/javascript\"></script>\r\n<script src=\"./js/jquery.js\" type=\"text/javascript\"></script>\r\n<script src=\"./js/rr.js\" type=\"text/javascript\"></script>\r\n<script src=\"./js/jquery.sparkline.js\" type=\"text/javascript\"></script>\r\n<script src=\"./js/jquery.horiz-bar-graph.js\" type=\"text/javascript\"></script>\r\n<!--[if lte IE 8]><script language=\"javascript\" type=\"text/javascript\" src=\"./js/excanvas.min.js\"></script><![endif]-->\r\n<script language=\"javascript\" type=\"text/javascript\" src=\"./js/jquery.flot.js\"></script>\r\n<script language=\"javascript\" type=\"text/javascript\" src=\"./js/jquery.flot.pie.js\"></script>\r\n\r\n<meta name=\"pageID\" content=\"remoteRoster\" />\r\n<meta name=\"helpPage\" content=\"\" />\r\n\r\n</head>\r\n<body>\r\n\r\n\t<p>Any components configured here will allow the external component associated with them full control over their\r\n\t\tdomain within any user's roster. Before enabling Remote Roster Management support for an external component, first\r\n"); out.write( "\t\tconnect it like you would any external component. Once it has connected and registered with Openfire, it's JID should\r\n\t\tshow up below and you can enable Remote Roster support.</p>\r\n\r\n\t"); if (success) { out.write( "\r\n\r\n\t<div class=\"jive-success\">\r\n\t\t<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n\t\t\t<tbody>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"jive-icon\"><img src=\"images/success-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"></td>\r\n\t\t\t\t\t<td class=\"jive-icon-label\">Settings saved!</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</tbody>\r\n\t\t</table>\r\n\t</div>\r\n\t<br>\r\n\r\n\t"); } else if (errors.size() > 0) { out.write( "\r\n\r\n\t<div class=\"jive-error\">\r\n\t\t<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n\t\t\t<tbody>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"jive-icon\"><img src=\"images/error-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"></td>\r\n\t\t\t\t\t<td class=\"jive-icon-label\">Error saving settings!</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</tbody>\r\n\t\t</table>\r\n\t</div>\r\n\t<br>\r\n\r\n\t"); } out.write( "\r\n\r\n\t<form action=\"rr-main.jsp?save\" method=\"post\">\r\n\r\n\t\t<div class=\"jive-contentBoxHeader\">Connected Gateway Components</div>\r\n\t\t<div class=\"jive-contentBox\">\r\n\r\n\t\t\t<p>Select which components you want to enable remote roster on:</p>\r\n\t\t\t"); boolean gatewayFound = false; int i = 0; for (ComponentSession componentSession : sessions) { if (!componentSession.getExternalComponent().getCategory().equals("gateway")) { continue; } gatewayFound = true; long incoming = componentSession.getNumClientPackets(); long outgoing = componentSession.getNumServerPackets(); long both = incoming + outgoing; int incomingPercent = (int) (incoming * 100 / both); int outgoingPercent = (int) (outgoing * 100 / both); out.write( "\r\n\t\t\t<table class=\"gatewayHeader\">\r\n\t\t\t\t<tbody>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td class=\"gatewayCheckbox\"><input type=\"checkbox\" name=\"enabledComponents[]\"\r\n\t\t\t\t\t\t\tvalue=\""); out.print(componentSession.getExternalComponent().getInitialSubdomain()); out.write("\"\r\n\t\t\t\t\t\t\t"); out.print( JiveGlobals.getBooleanProperty( "plugin.remoteroster.jids." + componentSession.getExternalComponent().getInitialSubdomain(), false) ? "checked=\"checked\"" : ""); out.write(" />\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t<td class=\"gatewayName\">"); out.print(componentSession.getExternalComponent().getName()); out.write( "</td>\r\n\t\t\t\t\t\t<td class=\"gatewayIcons\"><img src=\"images/log-16x16.png\" onclick=\"slideToggle('#logs"); out.print(i); out.write( "')\"><img\r\n\t\t\t\t\t\t\tsrc=\"images/permissions-16x16.png\" id=\"showPermissions\" onclick=\"slideToggle('#permission"); out.print(i); out.write( "')\"><img\r\n\t\t\t\t\t\t\tsrc=\"images/info-16x16.png\" id=\"showConfig\" onclick=\"slideToggle('#config"); out.print(i); out.write( "')\"></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</tbody>\r\n\t\t\t</table>\r\n\t\t\t<div id=\"config"); out.print(i); out.write( "\" class=\"slider\">\r\n\t\t\t\t<div class=\"sildeHeader\">Information</div>\r\n\t\t\t\t<table class=\"configTable\">\r\n\t\t\t\t\t<tbody>\r\n\t\t\t\t\t\t<tr id=\"logodd\">\r\n\t\t\t\t\t\t\t<td width=\"200px\">Domain:</td>\r\n\t\t\t\t\t\t\t<td>"); out.print(componentSession.getExternalComponent().getInitialSubdomain()); out.write( "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr id=\"logeven\">\r\n\t\t\t\t\t\t\t<td>Status:</td>\r\n\t\t\t\t\t\t\t<td>Online</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr id=\"logodd\">\r\n\t\t\t\t\t\t\t<td>Packages Send/Received:</td>\r\n\t\t\t\t\t\t\t<td><dl class=\"browser-data\" title=\"\">\r\n\t\t\t\t\t\t\t\t\t<dt>Incoming</dt>\r\n\t\t\t\t\t\t\t\t\t<dd>"); out.print(incomingPercent); out.write("</dd>\r\n\t\t\t\t\t\t\t\t\t<dt>Outgoing</dt>\r\n\t\t\t\t\t\t\t\t\t<dd>"); out.print(outgoingPercent); out.write( "</dd>\r\n\t\t\t\t\t\t\t\t</dl></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</tbody>\r\n\t\t\t\t</table>\r\n\t\t\t</div>\r\n\t\t\t<div id=\"permission"); out.print(i); out.write( "\" class=\"slider\">\r\n\t\t\t\t<div class=\"sildeHeader\">Access control</div>\r\n\t\t\t\t<table class=\"groupTable\">\r\n\t\t\t\t\t<tbody>\r\n\t\t\t\t\t\t<tr id=\"loghead\">\r\n\t\t\t\t\t\t\t<td colspan=\"3\">You can limit the access to the external component to an existing group</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td class=\"permissionTableColumn\">Groupname:</td>\r\n\t\t\t\t\t\t\t<td><input class=\"groupInput\" type=\"text\" id=\"groupSearch"); out.print(i); out.write("\"\r\n\t\t\t\t\t\t\t\tname=\"input_group."); out.print(componentSession.getExternalComponent().getInitialSubdomain()); out.write("\" alt=\"Find Groups\"\r\n\t\t\t\t\t\t\t\tonkeyup=\"searchSuggest('"); out.print(i); out.write("');\" autocomplete=\"off\"\r\n\t\t\t\t\t\t\t\tvalue=\""); out.print( _pmanager.getGroupForGateway( componentSession.getExternalComponent().getInitialSubdomain())); out.write("\">\r\n\t\t\t\t\t\t\t\t<div id=\"search_suggest"); out.print(i); out.write( "\"></div></td>\r\n\t\t\t\t\t\t\t<td style=\"vertical-align: top;\">\r\n\t\t\t\t\t\t\t\t<div class=\"ajaxloading\" id=\"ajaxloading"); out.print(i); out.write( "\"></div>\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</tbody>\r\n\t\t\t\t</table>\r\n\t\t\t</div>\r\n\t\t\t<div id=\"logs"); out.print(i); out.write("\" class=\"slider\">\r\n\t\t\t\t"); int iqs = _db.getPacketCount( componentSession.getExternalComponent().getInitialSubdomain(), Class.forName("org.xmpp.packet.IQ")); int msgs = _db.getPacketCount( componentSession.getExternalComponent().getInitialSubdomain(), Class.forName("org.xmpp.packet.Message")); int rosters = _db.getPacketCount( componentSession.getExternalComponent().getInitialSubdomain(), Class.forName("org.xmpp.packet.Roster")); int presences = _db.getPacketCount( componentSession.getExternalComponent().getInitialSubdomain(), Class.forName("org.xmpp.packet.Presence")); out.write( "\r\n\t\t\t\t<div class=\"sildeHeader\">Logs & Statistics</div>\r\n\r\n\t\t\t\t<table class=\"logtable\">\r\n\t\t\t\t\t<tfoot>\r\n\t\t\t\t\t\t<tr id=\"logfoot\">\r\n\t\t\t\t\t\t\t<td colspan=\"2\">Packages being logged for "); out.print(JiveGlobals.getIntProperty("plugin.remoteroster.log.cleaner.minutes", 60)); out.write( "\r\n\t\t\t\t\t\t\t\tminutes\r\n\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t<td><a style=\"float: right;\"\r\n\t\t\t\t\t\t\t\tonClick=\"window.open('liveStats.jsp?component="); out.print(componentSession.getExternalComponent().getInitialSubdomain()); out.write( "','mywindow','width=1200,height=700')\">Show\r\n\t\t\t\t\t\t\t\t\trealtime Log</a>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</tfoot>\r\n\t\t\t\t\t<tbody>\r\n\t\t\t\t\t\t<tr id=\"loghead\">\r\n\t\t\t\t\t\t\t<td width=\"200px\">Paket type</td>\r\n\t\t\t\t\t\t\t<td width=\"100px\">Number</td>\r\n\t\t\t\t\t\t\t<td></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr id=\"logodd\">\r\n\t\t\t\t\t\t\t<td>IQ</td>\r\n\t\t\t\t\t\t\t<td id=\"logiq"); out.print(i); out.write('"'); out.write('>'); out.print(iqs); out.write("</td>\r\n\t\t\t\t\t\t\t<td rowspan=\"5\"><div id=\"pie"); out.print(i); out.write( "\" class=\"graph\"></div></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr id=\"logeven\">\r\n\t\t\t\t\t\t\t<td>Messages</td>\r\n\t\t\t\t\t\t\t<td id=\"logmsg"); out.print(i); out.write('"'); out.write('>'); out.print(msgs); out.write( "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr id=\"logodd\">\r\n\t\t\t\t\t\t\t<td>Roster</td>\r\n\t\t\t\t\t\t\t<td id=\"logroster"); out.print(i); out.write('"'); out.write('>'); out.print(rosters); out.write( "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr id=\"logeven\">\r\n\t\t\t\t\t\t\t<td>Presence</td>\r\n\t\t\t\t\t\t\t<td id=\"logpresence"); out.print(i); out.write('"'); out.write('>'); out.print(presences); out.write( "</td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t<tr id=\"logodd\">\r\n\t\t\t\t\t\t\t<td><span style=\"font-weight: bold;\">Total:</span></td>\r\n\t\t\t\t\t\t\t<td><span style=\"font-weight: bold;\">"); out.print(iqs + msgs + rosters + presences); out.write( "</span></td>\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</tbody>\r\n\t\t\t\t</table>\r\n\r\n\t\t\t</div>\r\n\r\n\r\n\t\t\t"); ++i; } out.write("\r\n\t\t\t"); if (!gatewayFound) { out.write( "\r\n\t\t\t<span style=\"font-weight: bold\">No connected external gateway components found.</span>\r\n\t\t\t"); } out.write( "\r\n\t\t</div>\r\n\t\t\r\n\t\t\r\n<div class=\"jive-contentBoxHeader\">General Options</div>\r\n<div class=\"jive-contentBox\">\r\n <table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">\r\n <tbody>\r\n <tr valign=\"top\">\r\n <td width=\"100%\">\r\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n <tbody>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td><input type=\"checkbox\" name=\"persistentEnabled\" id=\"GO1\" value=\"true\"\r\n\t\t\t\t\t\t"); out.print( JiveGlobals.getBooleanProperty("plugin.remoteroster.persistent", false) ? "checked=\"checked\"" : ""); out.write( " />\r\n\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t<td><label for=\"GO1\">Enable persistent Roster</label></td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td />\r\n\t\t\t\t\t<td align=\"left\" style=\"font-size: -3; color: grey\">When Persistent-Roster is enabled, contacts will be saved to database and\r\n\t\t\t\t\tno contacts will be deleted\tby GoJara automatically.<br>\t\t\t\t\t\r\n\t\t\t\t\tWhen Persistent-Roster is disabled, contacts will not be saved to database and \r\n\t\t\t\t\tGoJara will automatically delete all Legacy-RosterItems from the OF-Roster of a User upon logout.<br>Enable this if you want to store Gateway contacts in DB. </td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td><input type=\"checkbox\" name=\"mucFilter\" id=\"GO2\" value=\"true\"\r\n\t\t\t\t\t\t"); out.print( JiveGlobals.getBooleanProperty("plugin.remoteroster.mucFilter", false) ? "checked=\"checked\"" : ""); out.write( " />\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t<td><label for=\"GO2\">Only allow internal Jabber Conferences</label></td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td />\r\n\t\t\t\t\t<td align=\"left\" style=\"font-size: -3; color: grey\">Spectrum might add MUC(Multi User Chat) to supported features\r\n\t\t\t\t\t of some Transports. If this should not be allowed, because only internal Jabber Conferences should be used, GoJara\r\n\t\t\t\t\t can remove these.</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td><input type=\"checkbox\" name=\"ignoreSubdomains\" id=\"GO3\" value=\"true\"\r\n\t\t\t\t\t\t"); out.print( JiveGlobals.getBooleanProperty("plugin.remoteroster.ignoreSubdomains", true) ? "checked=\"checked\"" : ""); out.write( " />\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t<td><label for=\"GO2\">Do not add Subdomains to Roster</label></td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td />\r\n\t\t\t\t\t<td align=\"left\" style=\"font-size: -3; color: grey\">If you do not want the gateway itself to show up as a contact on your roster,\r\n\t\t\t\t\tenable this (only happens on registration).\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>\r\n\r\n\t\t<br /> <br />\r\n\t\t<div class=\"jive-contentBoxHeader\">Client specific options</div>\r\n\t\t<div class=\"jive-contentBox\">\r\n\t\t\t<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">\r\n\t\t\t\t<tbody>\r\n\t\t\t\t\t<tr valign=\"top\">\r\n\t\t\t\t\t\t<td width=\"1%\" nowrap class=\"c1\">Spark:</td>\r\n\t\t\t\t\t\t<td width=\"99%\">\r\n\t\t\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n\t\t\t\t\t\t\t\t<tbody>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td><input type=\"checkbox\" name=\"sparkDiscoInfo\" id=\"SDI\" value=\"true\"\r\n\t\t\t\t\t\t\t\t\t\t\t"); out.print( JiveGlobals.getBooleanProperty("plugin.remoteroster.sparkDiscoInfo", false) ? "checked=\"checked\"" : ""); out.write( " />\r\n\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t\t<td><label for=\"SDI\"> Support jabber:iq:registered feature</label></td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td />\r\n\t\t\t\t\t\t\t\t\t\t<td align=\"left\" style=\"font-size: -3; color: grey\">If you use Spark clients within your network, it\r\n\t\t\t\t\t\t\t\t\t\t\tmight be necessary to modify the service discovery packets between Spark and the external component. If you\r\n\t\t\t\t\t\t\t\t\t\t\tcheck this RemoteRoster will add the feature \"jabber:iq:registered\" to the disco#info to indicate that the\r\n\t\t\t\t\t\t\t\t\t\t\tClient is registered with the external component.</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td><input type=\"checkbox\" name=\"iqLastFilter\" id=\"SDI2\" value=\"true\"\r\n\t\t\t\t\t\t\t\t\t\t\t"); out.print( JiveGlobals.getBooleanProperty("plugin.remoteroster.iqLastFilter", false) ? "checked=\"checked\"" : ""); out.write( " />\r\n\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t\t<td><label for=\"SDI\">Reply to jabber:iq:last </label></td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td />\r\n\t\t\t\t\t\t\t\t\t\t<td align=\"left\" style=\"font-size: -3; color: grey\">Some clients try to check how long a contact is already offline.\r\n\t\t\t\t\t\t\t\t\t\t This feature is not supported by spectrum so it won't response to this IQ stanza. To prevent the client from waiting\r\n\t\t\t\t\t\t\t\t\t\t for a response we could answer with a service-unavailable message as described in XEP-12.</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td><input type=\"checkbox\" name=\"blockPresences\" id=\"SDI3\" value=\"true\"\r\n\t\t\t\t\t\t\t\t\t\t\t"); out.print( JiveGlobals.getBooleanProperty("plugin.remoteroster.blockPresences", true) ? "checked=\"checked\"" : ""); out.write( " />\r\n\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t\t<td><label for=\"SDI\">Block presence pushing to rosterItems except gateway</label></td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td />\r\n\t\t\t\t\t\t\t\t\t\t<td align=\"left\" style=\"font-size: -3; color: grey\">Openfire automatically pushes Presences to every Item on your Roster.\r\n\t\t\t\t\t\t\t\t\t\tFor Spark, this means that roster items which are imported through gateway will trigger automatic login, even if you configured\r\n\t\t\t\t\t\t\t\t\t\tSpark to not connect to these gateways on Startup.<br>\r\n\t\t\t\t\t\t\t\t\t\tBlock Presences if you use Spark and do not want to autoconnect.</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<tr valign=\"top\">\r\n\t\t\t\t\t\t<td width=\"1%\" nowrap class=\"c1\">Gajim:</td>\r\n\t\t\t\t\t\t<td width=\"99%\">\r\n\t\t\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n\t\t\t\t\t\t\t\t<tbody>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td><input type=\"checkbox\" name=\"gajimBroadcast\" id=\"gajimBroadcast\" value=\"true\"\r\n\t\t\t\t\t\t\t\t\t\t\t"); out.print( JiveGlobals.getBooleanProperty("plugin.remoteroster.gajimBroadcast", false) ? "checked=\"checked\"" : ""); out.write( " />\r\n\t\t\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t\t\t<td><label for=\"gajimBroadcast\">Push available presence on startup</label></td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<td />\r\n\t\t\t\t\t\t\t\t\t\t<td align=\"left\" style=\"font-size: -3; color: grey\">Enable this if Gojara should push available presences to\r\n\t\t\t\t\t\t\t\t\t\ttransports from your roster on startup. If disabled, you may have to manually send an available presence to the specific \r\n\t\t\t\t\t\t\t\t\t\ttransport to connect to it.<br>Not needed if you add Subdomains to roster + disabled presence blocking.</td>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</tbody>\r\n\t\t\t</table>\r\n\t\t</div>\r\n\r\n\r\n\t\t<input type=\"submit\" name=\"save\" value=\"Save Settings\" />\r\n\t</form>\r\n\r\n</body>\r\n</html>\r\n"); } catch (Throwable t) { if (!(t instanceof SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); } }
/** * Create an XMPP Session instance. * * @param registration Registration information used for logging in. * @param jid JID associated with this session. * @param transport Transport instance associated with this session. * @param priority Priority of this session. */ public XMPPSession( Registration registration, JID jid, XMPPTransport transport, Integer priority) { super(registration, jid, transport, priority); setSupportedFeature(SupportedFeature.attention); setSupportedFeature(SupportedFeature.chatstates); Log.debug( "Creating " + getTransport().getType() + " session for " + registration.getUsername()); String connecthost; Integer connectport; String domain; connecthost = JiveGlobals.getProperty( "plugin.gateway." + getTransport().getType() + ".connecthost", (getTransport().getType().equals(TransportType.gtalk) ? "talk.google.com" : getTransport().getType().equals(TransportType.facebook) ? "chat.facebook.com" : "jabber.org")); connectport = JiveGlobals.getIntProperty( "plugin.gateway." + getTransport().getType() + ".connectport", 5222); if (getTransport().getType().equals(TransportType.gtalk)) { domain = "gmail.com"; } else if (getTransport().getType().equals(TransportType.facebook)) { // if (connecthost.equals("www.facebook.com")) { connecthost = "chat.facebook.com"; // } // if (connectport.equals(80)) { connectport = 5222; // } domain = "chat.facebook.com"; } else if (getTransport().getType().equals(TransportType.renren)) { connecthost = "talk.renren.com"; connectport = 5222; domain = "renren.com"; } else { domain = connecthost; } // For different domains other than 'gmail.com', which is given with Google Application services if (registration.getUsername().indexOf("@") > -1) { domain = registration.getUsername().substring(registration.getUsername().indexOf("@") + 1); } // If administrator specified "*" for domain, allow user to connect to anything. if (connecthost.equals("*")) { connecthost = domain; } config = new ConnectionConfiguration(connecthost, connectport, domain); config.setCompressionEnabled( JiveGlobals.getBooleanProperty( "plugin.gateway." + getTransport().getType() + ".usecompression", false)); if (getTransport().getType().equals(TransportType.facebook)) { // SASLAuthentication.supportSASLMechanism("PLAIN", 0); // config.setSASLAuthenticationEnabled(false); // config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled); } // instead, send the initial presence right after logging in. This // allows us to use a different presence mode than the plain old // 'available' as initial presence. config.setSendPresence(false); if (getTransport().getType().equals(TransportType.gtalk) && JiveGlobals.getBooleanProperty("plugin.gateway.gtalk.mailnotifications", true)) { ProviderManager.getInstance() .addIQProvider( GoogleMailBoxPacket.MAILBOX_ELEMENT, GoogleMailBoxPacket.MAILBOX_NAMESPACE, new GoogleMailBoxPacket.Provider()); ProviderManager.getInstance() .addExtensionProvider( GoogleNewMailExtension.ELEMENT_NAME, GoogleNewMailExtension.NAMESPACE, new GoogleNewMailExtension.Provider()); } }
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { JspFactory _jspxFactory = null; PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html"); pageContext = _jspxFactory.getPageContext(this, request, response, "error.jsp", true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\n\n\n\n\n\n\n\n\n"); out.write('\n'); org.jivesoftware.util.WebManager webManager = null; synchronized (_jspx_page_context) { webManager = (org.jivesoftware.util.WebManager) _jspx_page_context.getAttribute("webManager", PageContext.PAGE_SCOPE); if (webManager == null) { webManager = new org.jivesoftware.util.WebManager(); _jspx_page_context.setAttribute("webManager", webManager, PageContext.PAGE_SCOPE); } } out.write('\n'); webManager.init(request, response, session, application, out); out.write('\n'); out.write('\n'); // Get paramters boolean doTest = request.getParameter("test") != null; boolean cancel = request.getParameter("cancel") != null; boolean sent = ParamUtils.getBooleanParameter(request, "sent"); boolean success = ParamUtils.getBooleanParameter(request, "success"); String from = ParamUtils.getParameter(request, "from"); String to = ParamUtils.getParameter(request, "to"); String subject = ParamUtils.getParameter(request, "subject"); String body = ParamUtils.getParameter(request, "body"); // Cancel if requested if (cancel) { response.sendRedirect("system-email.jsp"); return; } // Variable to hold messaging exception, if one occurs Exception mex = null; // Validate input Map<String, String> errors = new HashMap<String, String>(); if (doTest) { if (from == null) { errors.put("from", ""); } if (to == null) { errors.put("to", ""); } if (subject == null) { errors.put("subject", ""); } if (body == null) { errors.put("body", ""); } EmailService service = EmailService.getInstance(); // Validate host - at a minimum, it needs to be set: String host = service.getHost(); if (host == null) { errors.put("host", ""); } // if no errors, continue if (errors.size() == 0) { // Create a message MimeMessage message = service.createMimeMessage(); // Set the date of the message to be the current date SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", java.util.Locale.US); format.setTimeZone(JiveGlobals.getTimeZone()); message.setHeader("Date", format.format(new Date())); // Set to and from. message.setRecipient(Message.RecipientType.TO, new InternetAddress(to, null)); message.setFrom(new InternetAddress(from, null)); message.setSubject(subject); message.setText(body); // Send the message, wrap in a try/catch: try { service.sendMessagesImmediately(Collections.singletonList(message)); // success, so indicate this: response.sendRedirect("system-emailtest.jsp?sent=true&success=true"); return; } catch (MessagingException me) { me.printStackTrace(); mex = me; } } } // Set var defaults Collection<JID> jids = webManager.getXMPPServer().getAdmins(); User user = null; if (!jids.isEmpty()) { for (JID jid : jids) { if (webManager.getXMPPServer().isLocal(jid)) { user = webManager.getUserManager().getUser(jid.getNode()); if (user.getEmail() != null) { break; } } } } if (from == null) { from = user.getEmail(); } if (to == null) { to = user.getEmail(); } if (subject == null) { subject = "Test email sent via Openfire"; } if (body == null) { body = "This is a test message."; } out.write("\n\n<html>\n <head>\n <title>"); if (_jspx_meth_fmt_message_0(_jspx_page_context)) return; out.write( "</title>\n <meta name=\"pageID\" content=\"system-email\"/>\n </head>\n <body>\n\n<script language=\"JavaScript\" type=\"text/javascript\">\nvar clicked = false;\nfunction checkClick(el) {\n if (!clicked) {\n clicked = true;\n return true;\n }\n return false;\n}\n</script>\n\n<p>\n"); if (_jspx_meth_fmt_message_1(_jspx_page_context)) return; out.write("\n</p>\n\n"); if (JiveGlobals.getProperty("mail.smtp.host") == null) { out.write( "\n\n <div class=\"jive-error\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tbody>\n <tr>\n \t<td class=\"jive-icon\"><img src=\"images/error-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"></td>\n\t <td class=\"jive-icon-label\">\n\t\t "); if (_jspx_meth_fmt_message_2(_jspx_page_context)) return; out.write("\n\t </td>\n </tr>\n </tbody>\n </table>\n </div>\n\n"); } out.write('\n'); out.write('\n'); if (doTest || sent) { out.write("\n\n "); if (success) { out.write( "\n\n <div class=\"jive-success\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tbody>\n <tr>\n \t<td class=\"jive-icon\"><img src=\"images/success-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"></td>\n \t<td class=\"jive-icon-label\">"); if (_jspx_meth_fmt_message_3(_jspx_page_context)) return; out.write( "</td>\n </tr>\n </tbody>\n </table>\n </div>\n\n "); } else { out.write( "\n\n <div class=\"jive-error\">\n <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n <tbody>\n <tr><td class=\"jive-icon\"><img src=\"images/error-16x16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"\"></td>\n <td class=\"jive-icon-label\">\n "); if (_jspx_meth_fmt_message_4(_jspx_page_context)) return; out.write("\n "); if (mex != null) { out.write("\n "); if (mex instanceof AuthenticationFailedException) { out.write("\n \t"); if (_jspx_meth_fmt_message_5(_jspx_page_context)) return; out.write(" \n "); } else { out.write("\n (Message: "); out.print(mex.getMessage()); out.write(")\n "); } out.write("\n "); } out.write( "\n </td></tr>\n </tbody>\n </table>\n </div>\n\n "); } out.write("\n\n <br>\n\n"); } out.write( "\n\n<form action=\"system-emailtest.jsp\" method=\"post\" name=\"f\" onsubmit=\"return checkClick(this);\">\n\n<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\">\n<tbody>\n <tr>\n <td>\n "); if (_jspx_meth_fmt_message_6(_jspx_page_context)) return; out.write(":\n </td>\n <td>\n "); String host = JiveGlobals.getProperty("mail.smtp.host"); if (host == null) { out.write("\n <i>"); if (_jspx_meth_fmt_message_7(_jspx_page_context)) return; out.write("</i>\n "); } else { out.write("\n "); out.print(host); out.write(':'); out.print(JiveGlobals.getIntProperty("mail.smtp.port", 25)); out.write("\n\n "); if (JiveGlobals.getBooleanProperty("mail.smtp.ssl", false)) { out.write("\n\n ("); if (_jspx_meth_fmt_message_8(_jspx_page_context)) return; out.write(")\n\n "); } out.write("\n "); } out.write("\n </td>\n </tr>\n <tr>\n <td>\n "); if (_jspx_meth_fmt_message_9(_jspx_page_context)) return; out.write( ":\n </td>\n <td>\n <input type=\"hidden\" name=\"from\" value=\""); out.print(from); out.write("\">\n "); out.print(StringUtils.escapeHTMLTags(from)); out.write( "\n <span class=\"jive-description\">\n (<a href=\"user-edit-form.jsp?username="******"\">Update Address</a>)\n </span>\n </td>\n </tr>\n <tr>\n <td>\n "); if (_jspx_meth_fmt_message_10(_jspx_page_context)) return; out.write( ":\n </td>\n <td>\n <input type=\"text\" name=\"to\" value=\""); out.print(((to != null) ? to : "")); out.write( "\"\n size=\"40\" maxlength=\"100\">\n </td>\n </tr>\n <tr>\n <td>\n "); if (_jspx_meth_fmt_message_11(_jspx_page_context)) return; out.write( ":\n </td>\n <td>\n <input type=\"text\" name=\"subject\" value=\""); out.print(((subject != null) ? subject : "")); out.write( "\"\n size=\"40\" maxlength=\"100\">\n </td>\n </tr>\n <tr valign=\"top\">\n <td>\n "); if (_jspx_meth_fmt_message_12(_jspx_page_context)) return; out.write( ":\n </td>\n <td>\n <textarea name=\"body\" cols=\"45\" rows=\"5\" wrap=\"virtual\">"); out.print(body); out.write( "</textarea>\n </td>\n </tr>\n <tr>\n <td colspan=\"2\">\n <br>\n <input type=\"submit\" name=\"test\" value=\""); if (_jspx_meth_fmt_message_13(_jspx_page_context)) return; out.write("\">\n <input type=\"submit\" name=\"cancel\" value=\""); if (_jspx_meth_fmt_message_14(_jspx_page_context)) return; out.write( "\">\n </td>\n </tr>\n</tbody>\n</table>\n\n</form>\n\n </body>\n</html>"); } catch (Throwable t) { if (!(t instanceof SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) out.clearBuffer(); if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context); } }
public void setPassword(String username, String password) throws UserNotFoundException { // Determine if the password should be stored as plain text or encrypted. boolean usePlainPassword = JiveGlobals.getBooleanProperty("user.usePlainPassword"); boolean scramOnly = JiveGlobals.getBooleanProperty("user.scramHashedPasswordOnly"); String encryptedPassword = null; if (username.contains("@")) { // Check that the specified domain matches the server's domain int index = username.indexOf("@"); String domain = username.substring(index + 1); if (domain.equals(XMPPServer.getInstance().getServerInfo().getXMPPDomain())) { username = username.substring(0, index); } else { // Unknown domain. throw new UserNotFoundException(); } } // Store the salt and salted password so SCRAM-SHA-1 SASL auth can be used later. byte[] saltShaker = new byte[32]; random.nextBytes(saltShaker); String salt = DatatypeConverter.printBase64Binary(saltShaker); int iterations = JiveGlobals.getIntProperty( "sasl.scram-sha-1.iteration-count", ScramUtils.DEFAULT_ITERATION_COUNT); byte[] saltedPassword = null, clientKey = null, storedKey = null, serverKey = null; try { saltedPassword = ScramUtils.createSaltedPassword(saltShaker, password, iterations); clientKey = ScramUtils.computeHmac(saltedPassword, "Client Key"); storedKey = MessageDigest.getInstance("SHA-1").digest(clientKey); serverKey = ScramUtils.computeHmac(saltedPassword, "Server Key"); } catch (SaslException | NoSuchAlgorithmException | UnsupportedEncodingException e) { Log.warn("Unable to persist values for SCRAM authentication."); } if (!scramOnly && !usePlainPassword) { try { encryptedPassword = AuthFactory.encryptPassword(password); // Set password to null so that it's inserted that way. password = null; } catch (UnsupportedOperationException uoe) { // Encryption may fail. In that case, ignore the error and // the plain password will be stored. } } if (scramOnly) { encryptedPassword = null; password = null; } Connection con = null; PreparedStatement pstmt = null; try { con = DbConnectionManager.getConnection(); pstmt = con.prepareStatement(UPDATE_PASSWORD); if (password == null) { pstmt.setNull(1, Types.VARCHAR); } else { pstmt.setString(1, password); } if (encryptedPassword == null) { pstmt.setNull(2, Types.VARCHAR); } else { pstmt.setString(2, encryptedPassword); } if (storedKey == null) { pstmt.setNull(3, Types.VARCHAR); } else { pstmt.setString(3, DatatypeConverter.printBase64Binary(storedKey)); } if (serverKey == null) { pstmt.setNull(4, Types.VARCHAR); } else { pstmt.setString(4, DatatypeConverter.printBase64Binary(serverKey)); } pstmt.setString(5, salt); pstmt.setInt(6, iterations); pstmt.setString(7, username); pstmt.executeUpdate(); } catch (SQLException sqle) { throw new UserNotFoundException(sqle); } finally { DbConnectionManager.closeConnection(pstmt, con); } }