Example usage for java.security InvalidParameterException InvalidParameterException

List of usage examples for java.security InvalidParameterException InvalidParameterException

Introduction

In this page you can find the example usage for java.security InvalidParameterException InvalidParameterException.

Prototype

public InvalidParameterException(String msg) 

Source Link

Document

Constructs an InvalidParameterException with the specified detail message.

Usage

From source file:eu.bittrade.libs.steemj.base.models.ChainProperties.java

/**
 * Define the account creation fee.//from  www .jav a 2  s  .  c  o  m
 * 
 * This fee, paid in STEEM, is converted into VESTING SHARES for the new
 * account. Accounts without vesting shares cannot earn usage rations and
 * therefore are powerless. This minimum fee requires all accounts to have
 * some kind of commitment to the network that includes the ability to vote
 * and make transactions.
 * 
 * @param accountCreationFee
 *            The accountCreationFee to set.
 * @throws InvalidParameterException
 *             If the fee is not present or less than 0.
 */
public void setAccountCreationFee(Asset accountCreationFee) {
    if (accountCreationFee == null || accountCreationFee.getAmount() <= 0) {
        throw new InvalidParameterException("The account creation fee needs to be greater than 0.");
    }
    this.accountCreationFee = accountCreationFee;
}

From source file:net.nelz.simplesm.aop.CacheBase.java

protected String buildCacheKey(final String objectId, final AnnotationData data) {
    if (objectId == null || objectId.length() < 1) {
        throw new InvalidParameterException("Ids for objects in the cache must be at least 1 character long.");
    }/*from  ww  w .ja v  a2  s.  c  o  m*/
    return data.getNamespace() + SEPARATOR + objectId;
}

From source file:ru.jts_dev.authserver.util.Encoder.java

public ByteBuf validateChecksum(ByteBuf buf) {
    if (buf.readableBytes() % 4 != 0 || buf.readableBytes() <= 4) {
        throw new IndexOutOfBoundsException("ByteBuf size must be multiply of 4 and more, that 4");
    }/* ww  w . ja  v  a  2s.  c o m*/

    long checksum = 0;
    long check;
    int i;

    for (i = 0; i < buf.readableBytes() - 4; i += 4) {
        check = buf.getInt(i);

        checksum ^= check;
    }

    check = buf.getInt(i);

    if (check != checksum) {
        throw new InvalidParameterException("Wrong checksum");
    }

    return buf.copy(0, buf.readableBytes() - 4);
}

From source file:com.dsf.dbxtract.cdc.App.java

private static void parseCommand(CommandLine cmd) throws ConfigurationException, IOException, ParseException {

    String configFilename;//  w w  w  .j a v  a  2 s  . c o m
    Config config;

    if (cmd.hasOption(PARAM_CONFIG)) {
        configFilename = cmd.getOptionValue(PARAM_CONFIG);
        config = new Config(configFilename);

    } else {
        throw new InvalidParameterException("Parameter required: --config");
    }

    if (cmd.hasOption(COMMAND_LIST)) {
        config.listAll();

    } else if (cmd.hasOption(COMMAND_START)) {
        info("Welcome to db-xtract");

        // get db-xtract configuration
        config.report();

        // Starts monitor server
        Monitor.getInstance(config);

        // Starts service
        App app = new App(config);
        app.start();

    } else {
        throw new ParseException("A command is required: --list or --start");
    }
}

From source file:com.gdo.util.XmlWriter.java

/**
 * Writes a new XML starting tag, closing previous one if needed.
 * /* w ww  .  j  a v a  2s.c  o m*/
 * @param name
 *            opened tag's name.
 * @throws IOException
 */
public void startElement(String name) throws IOException {
    if (StringUtils.isEmpty(name)) {
        throw new InvalidParameterException("XML tag name must not be null");
    }

    closeTagIfNeeded(true);
    writeIndent();
    _writer.write('<');
    _writer.write(name);

    _tag = name; // now a tag is opened
    _indent++;
}

From source file:com.richtodd.android.quiltdesign.block.PaperPiecedBlock.java

public void setHeight(float height) {
    if (height < 0)
        throw new InvalidParameterException("Invalid height " + height);

    m_height = height;/*  w w  w. j  av a2  s.com*/
}

From source file:com.mobdb.android.MobDB.java

/**
 * Send's SELECT SQL request to mobDB /* w  w w.  java  2  s .co m*/
 * @param appKey String value Application key
 * @param getRowdata GetRowData object
 * @param bargraph String value for Analytics tag name
 * @param secure boolean value to set SSL communication
 * @param listener MobDBResponseListener object
 * @throws InvalidParameterException
 */
public synchronized void execute(String appKey, GetRowData getRowdata, String bargraph, boolean secure,
        MobDBResponseListener listener) throws InvalidParameterException {

    try {
        execute(appKey, new String[] { getRowdata.getQueryString() }, null, bargraph, secure, listener);
    } catch (Exception e) {

        throw new InvalidParameterException(e.toString());

    }
}

From source file:uk.org.openeyes.oink.facade.FacadeRoutingServiceFactory.java

public FacadeRoutingService createInstance() {
    HttpMapper<RabbitRoute> mappings;
    String defaultReplyRoutingKey;

    log.debug("Using props: " + adapterProperties.toString());

    Configuration config = ConfigurationConverter.getConfiguration(adapterProperties);

    String defaultExchange = config.getString(MAPPING_DEFAULT_EXCHANGE_KEY);
    defaultReplyRoutingKey = config.getString(MAPPING_DEFAULT_REPLY_ROUTING_KEY);

    Configuration facadeConfig = config.subset(MAPPING_KEY);

    int numOfMappings = getNumberOfMappingsGiven(facadeConfig);

    List<HttpMapperEntry<RabbitRoute>> entries = new LinkedList<HttpMapperEntry<RabbitRoute>>();
    for (int i = 1; i <= numOfMappings; i++) {
        Configuration mappingCfg = getMappingsDetailsForIndex(i, facadeConfig);

        String service = mappingCfg.getString("service");
        if (service != null && !service.equals("*") && isReservedResourceWord(service)) {
            throw new InvalidParameterException("A service name cannot be a Resource name");
        }//from ww  w.  j  a  v  a2  s.co m

        String resource = mappingCfg.getString("resource");
        if (resource != null && !resource.equals("*") && !isReservedResourceWord(resource)) {
            throw new InvalidParameterException(
                    "A resource must be a recognised Resource name e.g. Patient  (case-sensitive)");
        }

        String method = mappingCfg.getString("method");
        HttpMethod methodEnum;
        if (method != null && !method.equals("*") && !isValidHttpMethod(method)) {
            throw new InvalidParameterException(
                    "A resource must be a recognised method verb e.g. POST,GET,PUT  (case-sensitive)");
        } else if (method == null || method.equals("*")) {
            methodEnum = HttpMethod.ANY;
        } else {
            methodEnum = HttpMethod.valueOf(method);
        }

        String routingKey = mappingCfg.getString("routingKey");
        if (routingKey == null || routingKey.isEmpty()) {
            throw new InvalidParameterException("A routingKey must be given for every mapping entry");
        }

        StringBuilder uri = new StringBuilder();
        if (!(service == null || service.isEmpty())) {
            uri.append(service);
            uri.append("/");
        }

        if (!(resource == null || resource.isEmpty())) {
            uri.append(resource);
        }

        uri.append("*");

        RabbitRoute route = new RabbitRoute(routingKey, defaultExchange);

        HttpMapperEntry<RabbitRoute> entry = new HttpMapperEntry<RabbitRoute>(uri.toString(), methodEnum,
                route);

        entries.add(entry);

    }

    mappings = new HttpMapper<RabbitRoute>(entries);
    return new FacadeRoutingService(mappings, defaultReplyRoutingKey);
}

From source file:ua.at.tsvetkov.data_processor.ProcessingCentre.java

/**
 * @param request//  w  w w . ja v a  2  s .  c  om
 * @param clazz
 * @param callback
 */
public ProcessingCentre(Request request, Class<T> clazz, Callback<T> callback) {
    if (request == null || clazz == null) {
        throw new InvalidParameterException(INVALID_PARAMETER);
    }
    this.request = request;
    this.clazz = clazz;
    this.callback = callback;

    if (Looper.myLooper() != null)
        handler = new Handler();
    else
        handler = null;
    thread = Thread.currentThread();
}

From source file:org.hillview.sketches.JLProjection.java

public double getInnerProduct(String s, String t) {
    if (!this.hMap.containsKey(s))
        throw new InvalidParameterException("No sketch found for column: " + s);
    if (!this.hMap.containsKey(t))
        throw new InvalidParameterException("No sketch found for column: " + t);
    if (this.highDim <= 0)
        throw new InvalidParameterException("Dimension must be positive.");
    double sum = 0;
    double a[] = this.hMap.get(s);
    double b[] = this.hMap.get(t);
    for (int i = 0; i < this.lowDim; i++)
        sum += a[i] * b[i];/*from  w w w.  jav a  2s .  c  om*/
    return (sum / (this.lowDim * this.highDim));
}