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:m.c.m.proxyma.ProxymaFacade.java

/**
 * Enable the passed proxyFolder/*from w  w  w  . jav a  2  s  . c  om*/
 *
 * @param theFolder the proxy folder to remove
 * @param context the context to inspect
 * @throws IllegalArgumentException if the context doesn't exist
 * @throws NullArgumentException if the argument is null
 */
public void enableProxyFolder(ProxyFolderBean theFolder) throws NullArgumentException {
    if (theFolder == null)
        throw new NullArgumentException("Can't enable a null Proxy-Folder");
    theFolder.setEnabled(true);
}

From source file:it.geosolutions.geoserver.jms.impl.handlers.catalog.CatalogUtils.java

public static MapInfo localizeMapInfo(final MapInfo info, final Catalog catalog)
        throws IllegalAccessException, InvocationTargetException {
    if (info == null || catalog == null)
        throw new NullArgumentException("Arguments may never be null");

    final MapInfo localObject = catalog.getMapByName(info.getName());
    if (localObject != null) {
        return localObject;
        // else object is modified: continue with localization  
    }/*w  w  w  .  j a v  a2 s . c  o  m*/

    info.getLayers().addAll(localizeLayers(info.getLayers(), catalog));

    final CatalogBuilder builder = new CatalogBuilder(catalog);
    builder.attach(info);
    return info;
}

From source file:com.comphenix.xp.parser.text.MobMatcher.java

/**
 * Register an individual mob./*from   w ww  .j  av a2  s. co m*/
  * @param mobName - ENUM name of the mob.
 * @param id - the unique type ID of the mob.
 */
public void registerMob(String mobName, Short id) {

    if (mobName == null)
        throw new NullArgumentException("mobName");
    if (id == null)
        throw new NullArgumentException("id");

    names.put(mobName, id);
}

From source file:m.c.m.proxyma.ProxymaFacade.java

/**
 * Diable the passed proxyFolder//from   w w w  . j  a  va 2 s .c  o m
 *
 * @param theFolder the proxy folder to remove
 * @param context the context to inspect
 * @throws IllegalArgumentException if the context doesn't exist
 * @throws NullArgumentException if the argument is null
 */
public void disableProxyFolder(ProxyFolderBean theFolder) throws NullArgumentException {
    if (theFolder == null)
        throw new NullArgumentException("Can't disable a null Proxy-Folder");
    theFolder.setEnabled(false);
}

From source file:com.comphenix.xp.extra.ServiceProvider.java

/**
 * Determines if a service is enabled./*from  w ww  .j  a  va 2  s .  c  o m*/
 * @param name - name of service.
 * @return TRUE if the service is enabled, FALSE otherwise.
 */
public boolean isEnabled(String name) {
    if (name == null)
        throw new NullArgumentException("name");
    else
        return !disabledLookup.contains(name);
}

From source file:com.wavemaker.json.AlternateJSONTransformer.java

private static Object toCollectionOrArray(JSONState jsonState, Object obj, Object root,
        FieldDefinition fieldDefinition, TypeState typeState, int arrayLevel, Stack<String> setterQueue)
        throws InstantiationException, IllegalAccessException {

    if (fieldDefinition == null) {
        throw new NullArgumentException("fieldDefinition");
    }/*from  w  w  w. j  a v a2s  . c o m*/

    ListTypeDefinition ltd = fieldDefinition.getArrayTypes().get(arrayLevel);

    JSONArray jsonArray = (JSONArray) obj;
    Object listObject = ltd.newInstance(jsonArray.size());

    for (int i = 0; i < jsonArray.size(); i++) {
        Object arrayElement = toObjectInternal(jsonState, jsonArray.get(i), root, fieldDefinition, typeState,
                arrayLevel + 1, setterQueue);

        ltd.add(listObject, i, arrayElement);
    }

    return listObject;
}

From source file:m.c.m.proxyma.resource.ProxymaResource.java

/**
 * Remove an attribute from the resource
 * @param attributeName the attribute to remove.
 * @throws NullArgumentException if the argument is null
 *///from   w w  w .  j  av a  2 s.c  o m
public void deleteAttribute(String anAttributeName) throws NullArgumentException {
    if (anAttributeName == null) {
        log.warning("Null attribute parameter.. Ignoring operation");
        throw new NullArgumentException("Null ProxyFolderBean parameter.. Ignoring operation");
    } else {
        boolean exists = attributes.containsKey(anAttributeName);
        if (!exists) {
            log.finer("The attribute \"" + anAttributeName + "\" doesn't exists.. nothing done.");
        } else {
            log.finer("Deleting existing attribute " + anAttributeName);
            attributes.remove(anAttributeName);
        }
    }
}

From source file:com.comphenix.xp.extra.ServiceProvider.java

/**
 * Determines if a given service is enabled.
 * @param service - service./*  w  ww .  j  ava2 s .co m*/
 * @return TRUE if the service is enabled, FALSE otherwise.
 */
public boolean isEnabled(TService service) {
    if (service == null)
        throw new NullArgumentException("service");

    return isEnabled(service.getServiceName());
}

From source file:com.comphenix.xp.parser.text.MobMatcher.java

/**
 * Unregisters an individual mob./*www .  j  av  a 2  s.c  o  m*/
 * @param mobName - name of the mob to unregister.
 * @return The previously registered mob's ID, or NULl if no mob could be found.
 */
public Short unregisterMob(String mobName) {

    if (mobName == null)
        throw new NullArgumentException("mobName");

    return names.remove(mobName);
}

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

/**
 * Remove a ProxyFolder from the context
 * @param proxyFolder the proxyFolder to remove.
 * @throws IllegalArgumentException if the context doesn't exist
 * @throws NullArgumentException if the argument is null
 *//*from  www  .  j av a 2  s. c  o m*/
public void removeProxyFolder(ProxyFolderBean proxyFolder)
        throws IllegalArgumentException, NullArgumentException {
    if (proxyFolder == null) {
        log.warning("Null ProxyFolderBean parameter.. Ignoring operation");
        throw new NullArgumentException("Null ProxyFolderBean parameter.. Ignoring operation");
    } else {
        boolean exists = proxyFoldersByURLEncodedName.containsKey(proxyFolder.getURLEncodedFolderName());
        if (!exists) {
            log.warning("The Proxy foder doesn't exists.. nothing done.");
            throw new IllegalArgumentException("The Proxy foder doesn't exists.. nothing done.");
        } else {
            log.finer("Deleting existing Proxy folder " + proxyFolder.getFolderName());
            proxyFoldersByURLEncodedName.remove(proxyFolder.getURLEncodedFolderName());

            //Delete the proxy-folder from the second indexing map.
            String destinationHost = URLUtils.getDestinationHost(proxyFolder.getDestinationAsURL());
            LinkedList<ProxyFolderBean> currentSlot = null;
            currentSlot = proxyFoldersByDestinationHost.get(destinationHost);
            if (currentSlot.size() == 1) {
                currentSlot.remove(proxyFolder);
                proxyFoldersByDestinationHost.remove(destinationHost);
            } else {
                Iterator<ProxyFolderBean> iterator = currentSlot.iterator();
                while (iterator.hasNext()) {
                    ProxyFolderBean curFolder = iterator.next();
                    if (curFolder == proxyFolder)
                        iterator.remove();
                }
            }
        }
    }
}