Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 47305 invoked from network); 31 Mar 2011 14:18:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 31 Mar 2011 14:18:46 -0000 Received: (qmail 25186 invoked by uid 500); 31 Mar 2011 14:18:46 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 25110 invoked by uid 500); 31 Mar 2011 14:18:45 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 25102 invoked by uid 99); 31 Mar 2011 14:18:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Mar 2011 14:18:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Mar 2011 14:18:43 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id B069A8BB15 for ; Thu, 31 Mar 2011 14:18:05 +0000 (UTC) Date: Thu, 31 Mar 2011 14:18:05 +0000 (UTC) From: "Bogdan Drozdowski (JIRA)" To: issues@commons.apache.org Message-ID: <1139934520.24406.1301581085719.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <80691529.13696.1300549109558.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (NET-382) Subclasses of SocketClient should use _input_ and _output_ rather than calling _socket_.getInputStream() etc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/NET-382?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bogdan Drozdowski updated NET-382: ---------------------------------- Attachment: sockclient-socket-private.diff I thought about that this too one day. Now I have a patch. It allows the user to get the current socket, set a new one (automatically updating _input and _output) and get the current streams. If accepted, _socket, _input and _output can be made private and the subclasses modified to fit the new interface. This will force the subclasses to use _input and _output. It still is one call, but this time the call simply returns a field. I don't like getSocket(), but it's required by classes that can, for example, switch between encrypted and plain-text modes (like FTPSClient) to save to original socket. Better than relying on a field name, anyway. The classes that inherit from SocketClient still can modify the Socket the way they like, so it's no worse than what it's like currently. BufferedReaders/Writers are subclass-specific, so they can't be set automatically when changing the socket. But it's probably useless to have them in a general-purpose socket class, since they could be unused. So it's probably best to leave things as they are: let the subclasses worry about these. > Subclasses of SocketClient should use _input_ and _output_ rather than calling _socket_.getInputStream() etc > ------------------------------------------------------------------------------------------------------------ > > Key: NET-382 > URL: https://issues.apache.org/jira/browse/NET-382 > Project: Commons Net > Issue Type: Bug > Reporter: Sebb > Attachments: sockclient-socket-private.diff > > > SocketClient._connectAction() sets up \_input\_ and \_output\_ from \_socket\_ so it is wasteful to do this again in subclasses. > Potentially consider making \_socket\_ private? > However, this would currently break most of the "S" versions of the protocols, unless SocketClient is extended to handle their needs. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira