* @see ScriptableFunctionBase#validateArgs(Object[])
*/
protected void validateArgs( Object[] args ) {
super.validateArgs( args );
Scriptable obj = (Scriptable) args[ 0 ];
try {
Object port = obj.getField( KEY_PORT );
if( port != null && port != UNDEFINED ) {
int portValue = ( (Integer) port ).intValue();
if( portValue < 0 ) {
throw new IllegalArgumentException( "Invalid port." );
} else if( !PushService.isValidPort( portValue ) ) {
throw new IllegalArgumentException( "Reserved port" );
}
} else {
throw new IllegalArgumentException( "Port is missing." );
}
Object wakeUpPage = obj.getField( KEY_WAKEUP_PAGE );
if( wakeUpPage == null || wakeUpPage == UNDEFINED ) {
throw new IllegalArgumentException( "AppId is missing." );
}
} catch( Exception e ) {
throw new IllegalArgumentException( "Error retrieving arguments: " + e.getMessage() );