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

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

Introduction

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

Prototype

public void setRemoteAddress(String remoteAddress) 

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;
    }/*w  ww .j  a v a2s  . c  o 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);
}