Examples of MalformedServerReplyException


Examples of org.apache.commons.net.MalformedServerReplyException

        // In case we run into an anomaly we don't want fatal index exceptions
        // to be thrown.
        length = line.length();
        if (length < REPLY_CODE_LEN) {
            throw new MalformedServerReplyException(
                "Truncated server reply: " + line);
        }

        String code = null;
        try
        {
            code = line.substring(0, REPLY_CODE_LEN);
            _replyCode = Integer.parseInt(code);
        }
        catch (NumberFormatException e)
        {
            throw new MalformedServerReplyException(
                "Could not parse response code.\nServer Reply: " + line);
        }

        _replyLines.add(line);
View Full Code Here

Examples of org.apache.commons.net.MalformedServerReplyException

    protected void _parsePassiveModeReply(String reply)
    throws MalformedServerReplyException
    {
        java.util.regex.Matcher m = __PARMS_PAT.matcher(reply);
        if (!m.find()) {
            throw new MalformedServerReplyException(
                    "Could not parse passive host information.\nServer Reply: " + reply);
        }

        __passiveHost = m.group(1).replace(',', '.'); // Fix up to look like IP address

        try
        {
            int oct1 = Integer.parseInt(m.group(2));
            int oct2 = Integer.parseInt(m.group(3));
            __passivePort = (oct1 << 8) | oct2;
        }
        catch (NumberFormatException e)
        {
            throw new MalformedServerReplyException(
                    "Could not parse passive port information.\nServer Reply: " + reply);
        }

        try {
            InetAddress host = InetAddress.getByName(__passiveHost);
            // reply is a local address, but target is not - assume NAT box changed the PASV reply
            if (host.isSiteLocalAddress()) {
                InetAddress remote = getRemoteAddress();
                if (!remote.isSiteLocalAddress()){
                    String hostAddress = remote.getHostAddress();
                    fireReplyReceived(0,
                                "[Replacing site local address "+__passiveHost+" with "+hostAddress+"]\n");
                    __passiveHost = hostAddress;                   
                }
            }
        } catch (UnknownHostException e) { // Should not happen as we are passing in an IP address
            throw new MalformedServerReplyException(
                    "Could not parse passive host information.\nServer Reply: " + reply);
        }
    }
View Full Code Here

Examples of org.apache.commons.net.MalformedServerReplyException

        delim3 = reply.charAt(2);
        delim4 = reply.charAt(reply.length()-1);

        if (!(delim1 == delim2) || !(delim2 == delim3)
                || !(delim3 == delim4)) {
            throw new MalformedServerReplyException(
                    "Could not parse extended passive host information.\nServer Reply: " + reply);
        }

        int port;
        try
        {
            port = Integer.parseInt(reply.substring(3, reply.length()-1));
        }
        catch (NumberFormatException e)
        {
            throw new MalformedServerReplyException(
                    "Could not parse extended passive host information.\nServer Reply: " + reply);
        }


        // in EPSV mode, the passive host address is implicit
View Full Code Here

Examples of org.apache.commons.net.MalformedServerReplyException

            }
            if (code.equals(IMAP_NO)) {
                return NO;
            }
        }
        throw new MalformedServerReplyException(
            "Received unexpected IMAP protocol response from server: '" + line + "'.");
    }
View Full Code Here

Examples of org.apache.commons.net.MalformedServerReplyException

            catch (NumberFormatException e)
            {
                // drop through and raise exception
            }
        }
        throw new MalformedServerReplyException(
            "Could not parse article pointer.\nServer reply: " + reply);
    }
View Full Code Here

Examples of org.apache.commons.net.MalformedServerReplyException

            {
               // drop through to report error
            }
        }

        throw new MalformedServerReplyException(
            "Could not parse newsgroup info.\nServer reply: " + reply);
    }
View Full Code Here

Examples of org.apache.commons.net.MalformedServerReplyException

            while ((line = reader.readLine()) != null) {
                NewsgroupInfo tmp = __parseNewsgroupListEntry(line);
                if (tmp != null) {
                    list.addElement(tmp);
                } else {
                    throw new MalformedServerReplyException(line);
                }
            }
        } finally {
            reader.close();
        }
View Full Code Here

Examples of org.apache.commons.net.MalformedServerReplyException

        // In case we run into an anomaly we don't want fatal index exceptions
        // to be thrown.
        length = line.length();
        if (length < 3) {
            throw new MalformedServerReplyException(
                "Truncated server reply: " + line);
        }

        try
        {
            String code = line.substring(0, 3);
            _replyCode = Integer.parseInt(code);
        }
        catch (NumberFormatException e)
        {
            throw new MalformedServerReplyException(
                "Could not parse response code.\nServer Reply: " + line);
        }

        _replyLines.add(line);
View Full Code Here

Examples of org.apache.commons.net.MalformedServerReplyException

            pointer.articleId = tokenizer.nextToken();
            return ;
        }
        while (false);

        throw new MalformedServerReplyException(
            "Could not parse article pointer.\nServer reply: " + reply);
    }
View Full Code Here

Examples of org.apache.commons.net.MalformedServerReplyException

            info._setPostingPermission(NewsgroupInfo.UNKNOWN_POSTING_PERMISSION);
            return ;
        }
        while (false);

        throw new MalformedServerReplyException(
            "Could not parse newsgroup info.\nServer reply: " + reply);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.