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

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

Introduction

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

Prototype

public void setRemotePort(int remotePort) 

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;

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

        roe = new RemoteOptionsException(RemoteOptionsException.REMOTE_ADDRESS);

        roe.setRemoteAddress(remoteAddress);

        throw roe;
    }/*from  w w  w  . j  a v a2 s . co m*/

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