Example usage for com.liferay.portal.kernel.exception RemoteOptionsException REMOTE_PORT

List of usage examples for com.liferay.portal.kernel.exception RemoteOptionsException REMOTE_PORT

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.exception RemoteOptionsException REMOTE_PORT.

Prototype

int REMOTE_PORT

To view the source code for com.liferay.portal.kernel.exception RemoteOptionsException REMOTE_PORT.

Click Source Link

Usage

From source file:com.liferay.exportimport.staging.StagingImpl.java

License:Open Source License

@Override
public void validateRemote(long groupId, String remoteAddress, int remotePort, String remotePathContext,
        boolean secureConnection, long remoteGroupId) throws PortalException {

    RemoteOptionsException roe = null;/*  w w w . jav  a  2  s. co  m*/

    if (!Validator.isDomain(remoteAddress) && !Validator.isIPAddress(remoteAddress)) {

        roe = new RemoteOptionsException(RemoteOptionsException.REMOTE_ADDRESS);

        roe.setRemoteAddress(remoteAddress);

        throw roe;
    }

    if ((remotePort < 1) || (remotePort > 65535)) {
        roe = new RemoteOptionsException(RemoteOptionsException.REMOTE_PORT);

        roe.setRemotePort(remotePort);

        throw roe;
    }

    if (Validator.isNotNull(remotePathContext) && (!remotePathContext.startsWith(StringPool.FORWARD_SLASH)
            || remotePathContext.endsWith(StringPool.FORWARD_SLASH))) {

        roe = new RemoteOptionsException(RemoteOptionsException.REMOTE_PATH_CONTEXT);

        roe.setRemotePathContext(remotePathContext);

        throw roe;
    }

    validateRemoteGroup(groupId, remoteGroupId, remoteAddress, remotePort, remotePathContext, secureConnection);
}