Example usage for org.apache.commons.lang NullArgumentException NullArgumentException

List of usage examples for org.apache.commons.lang NullArgumentException NullArgumentException

Introduction

In this page you can find the example usage for org.apache.commons.lang NullArgumentException NullArgumentException.

Prototype

public NullArgumentException(String argName) 

Source Link

Document

Instantiates with the given argument name.

Usage

From source file:CS2JNet.JavaSupport.Collections.Generic.LCC.CollectionSupport.java

public void copyTo(T[] arr, int i) throws Exception {
    if (arr == null) {
        throw new NullArgumentException("arr");
    }// w w  w .  j a  va 2  s .  c o  m
    if (i < 0 || i + myCollection.size() > arr.length) {
        throw new ArgumentException("i");
    }
    int idx = 0;
    for (T e : this) {
        arr[i + idx] = e;
    }

}

From source file:com.swordlord.gozer.eventhandler.generic.GozerEventListenerList.java

/**
 * Adds the listener as a listener of the specified type.
 * @param t the type of the listener to be added
 * @param l the listener to be added/*w  w w . j  av  a 2 s .c o  m*/
 */
public synchronized <T extends GozerEventListener> void add(Class<T> t, T l) {
    if (l == null) {
        throw new NullArgumentException("Listener is null");
    }

    if (!t.isInstance(l)) {
        throw new IllegalArgumentException("Listener " + l + " is not of type " + t);
    }

    if (listenerList == NULL_ARRAY) {
        // if this is the first listener added,
        // initialize the lists
        listenerList = new Object[] { t, l };
    } else {
        // Otherwise copy the array and add the new listener
        int i = listenerList.length;
        Object[] tmp = new Object[i + 2];
        System.arraycopy(listenerList, 0, tmp, 0, i);

        tmp[i] = t;
        tmp[i + 1] = l;

        listenerList = tmp;
    }
}

From source file:CS2JNet.JavaSupport.Collections.Generic.CollectionSupport.java

public void CopyTo(T[] arr, int i) throws Exception {
    if (arr == null) {
        throw new NullArgumentException("arr");
    }/*from w  w  w .  j  a  v a2  s.  c  o m*/
    if (i < 0 || i + myCollection.size() > arr.length) {
        throw new ArgumentException("i");
    }
    int idx = 0;
    for (T e : this) {
        arr[i + idx] = e;
    }

}

From source file:com.eyeq.pivot4j.sort.SortMode.java

/**
 * @param model/*from w ww  .  j a  v  a2s . c o m*/
 */
public void toggleSort(PivotModel model) {
    if (model == null) {
        throw new NullArgumentException("model");
    }

    SortCriteria currentCriteria = null;
    if (model.isSorting()) {
        currentCriteria = model.getSortCriteria();
    }

    SortCriteria criteria = nextMode(currentCriteria);
    if (criteria == null) {
        model.setSorting(false);
    } else {
        model.setSorting(true);
        model.setSortCriteria(criteria);
    }
}

From source file:com.eyeq.pivot4j.ui.property.PropertySupport.java

/**
 * @param name//from w  w w .j a va2  s  .c om
 * @param defaultValue
 * @param context
 * @return
 */
public String getString(String name, String defaultValue, RenderContext context) {
    if (name == null) {
        throw new NullArgumentException("name");
    }

    if (context == null) {
        throw new NullArgumentException("context");
    }

    String value = null;

    Property property = properties.get(name);

    if (property != null) {
        value = StringUtils.trimToNull(property.getValue(context));
    }

    if (value == null) {
        value = defaultValue;
    }

    return value;
}

From source file:m.c.m.proxyma.context.ProxymaContextPool.java

/**
 * Unregister an existing and empty context from the pool
 * NOTE: This method requires that the context is empty.
 * In other words, it will remove the context only if it doesn't contain
 * any ProxyFolderBean.//from w  ww .  j a  va 2s .  co  m
 *
 * @param the context to unregister
 * @throws IllegalArgumentException if the doesn't exists
 * @throws NullArgumentException if a null argument is passed to this method
 * @throws IllegalStateException if the context is not empty
 */
public void unregisterContext(ProxymaContext context)
        throws NullArgumentException, IllegalArgumentException, IllegalStateException {
    if (context == null) {
        log.warning("Null context argument received.. operation aborted");
        throw new NullArgumentException("Null context argument received.. operation aborted");
    } else if (context.getProxyFoldersCount() > 0) {
        log.warning("Context \"" + context.getName() + "\" is not empty.. operation aborted");
        throw new IllegalStateException(
                "Context \"" + context.getName() + "\" is not empty.. operation aborted");
    } else if (!proxymaContexts.containsKey(context.getName())) {
        log.warning("Context \"" + context.getName() + "\" doesn't exists.. operation aborted.");
        throw new IllegalArgumentException(
                "Context \"" + context.getName() + "\" doesn't exists.. operation aborted.");
    } else {
        log.finer("Removing context \"" + context.getName() + "\" from the pool.");
        proxymaContexts.remove(context.getName());
    }
}

From source file:com.amalto.workbench.detailtabs.sections.handlers.ListContentsCommitHandler.java

protected void doUpdateFKAnnotationStructure(XSDAnnotationsStructure xsdAnnoStruct) {
    if (xsdAnnoStruct == null) {
        throw new NullArgumentException(null);
    }//ww w.  j av a2 s  .  co m

    String fk = xsdAnnoStruct.getForeignKey();
    if (fk == null || fk.trim().isEmpty()) {
        xsdAnnoStruct.setForeignKeyNotSep(null);
        xsdAnnoStruct.setFKFilter(null);
        xsdAnnoStruct.setForeignKeyInfos(new ArrayList());
        xsdAnnoStruct.setRetrieveFKinfos(null);
        xsdAnnoStruct.setFKIntegrity(null);
        xsdAnnoStruct.setFKIntegrityOverride(null);

        if (xsdAnnoStruct.getAnnotation().getApplicationInformation().isEmpty()
                && xsdAnnoStruct.getAnnotation().getUserInformation().isEmpty()) {
            xsdAnnoStruct.getDeclaration().setAnnotation(null);
        }
    }
}

From source file:com.comphenix.xp.lookup.ItemQuery.java

/**
 * Creates a query from a given world block.
 * @param block - block to create from.// ww w  .ja v a2s .  c om
 * @return The created query.
 */
public static ItemQuery fromAny(Block block) {
    if (block == null)
        throw new NullArgumentException("block");

    return fromAny(block.getTypeId(), (int) block.getData(), null);
}

From source file:com.phoenixnap.oss.ramlapisync.data.ApiParameterMetadata.java

/**
 * Default constructor that creates a metadata object from a Raml parameter
 * /*  ww  w .  ja v  a2s . c o m*/
 * @param param Java Parameter representation
 */
public ApiParameterMetadata(String name, AbstractParam param) {
    super();

    if (param == null) {
        throw new NullArgumentException("param");
    }

    if (param instanceof UriParameter) {
        resourceId = true;
        nullable = false;
    } else {
        resourceId = false;
        nullable = !param.isRequired();
    }

    this.name = name;
    this.param = null; //we wont have this.

    this.type = SchemaHelper.mapSimpleType(param.getType());
    this.genericType = null;

    this.example = StringUtils.hasText(param.getExample()) ? param.getExample() : null;
    this.setRamlParam(param);
}

From source file:com.comphenix.xp.rewards.xp.RewardVirtual.java

@Override
public void reward(World world, Location point, ResourceHolder resource) {
    if (world == null)
        throw new NullArgumentException("world");
    if (point == null)
        throw new NullArgumentException("point");
    if (!isExperience(resource))
        throw new IllegalArgumentException("Must be a experience resource.");

    List<Player> closest = Server.getNearbyPlayers(world, point, searchRadius);

    // Give experience directly
    if (closest.size() == 1)
        reward(closest.get(0), null, resource);
    else/*from  www . ja  va2  s.co m*/
        // Spawn experience
        Server.spawnExperience(world, point, resource.getAmount());
}