Examples of MalformedServerReplyException


Examples of org.apache.commons.net.MalformedServerReplyException

            index = Integer.parseInt(octet1);
            lastIndex = Integer.parseInt(octet2);
        }
        catch (NumberFormatException e)
        {
            throw new MalformedServerReplyException(
                "Could not parse passive host information.\nServer Reply: " + reply);
        }

        index <<= 8;
        index |= lastIndex;
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() && !getRemoteAddress().isSiteLocalAddress()){
                String hostAddress = getRemoteAddress().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

        // 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);
        }

        String code = null;
        try
        {
            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

            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

            }
            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

            {
               // 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

        {
            NewsgroupInfo tmp = __parseNewsgroupListEntry(line);
            if (tmp != null) {
                list.addElement(tmp);
            } else {
                throw new MalformedServerReplyException(line);
            }
        }

        int size;
        if ((size = list.size()) < 1) {
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

        } else if (line.startsWith(_ERROR)) {
            _replyCode = POP3Reply.ERROR;
        } else if (line.startsWith(_OK_INT)) {
            _replyCode = POP3Reply.OK_INT;
        } else {
            throw new
            MalformedServerReplyException(
                "Received invalid POP3 protocol response from server." + line);
        }

        _replyLines.add(line);
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.