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.protocol.operations.ClaimRewardBalanceOperation.java

/**
 * Set the amount of Vests that should be collected. Please note that it is
 * not possible to collect more than that what is available. You can check
 * the available amount by requesting the Account information using
 * {@link eu.bittrade.libs.steemj.SteemJ#getAccounts(List)
 * getAccounts(List)} method.// ww w .  ja  v  a 2  s. com
 * 
 * @param rewardVests
 *            The amount of Vests to collect.
 * @throws InvalidParameterException
 *             If the provided <code>rewardVests</code> is null, does not
 *             have the symbol type VESTS or the amount to claim is
 *             negative.
 */
public void setRewardVests(Asset rewardVests) {
    if (rewardVests == null) {
        throw new InvalidParameterException("The VESTS reward can't be null.");
    }

    this.rewardVests = rewardVests;
}

From source file:eu.bittrade.libs.steemj.protocol.operations.CustomOperation.java

@Override
public void validate(ValidationType validationType) {
    if (!ValidationType.SKIP_ASSET_VALIDATION.equals(validationType) && requiredAuths.isEmpty()) {
        throw new InvalidParameterException("At least on account must be specified.");
    }/*from  w w  w.ja  v a  2 s .co  m*/
}

From source file:eu.bittrade.libs.steemj.protocol.operations.ResetAccountOperation.java

@Override
public void validate(ValidationType validationType) {
    if (!ValidationType.SKIP_VALIDATION.equals(validationType)) {
        if (newOwnerAuthority.isImpossible()) {
            throw new InvalidParameterException("The new owner authority can't be impossible.");
        } else if (newOwnerAuthority.getWeightThreshold() < 1) {
            throw new InvalidParameterException("The new owner authority can't be trivial.");
        }/*w  ww  .ja va 2 s .  co  m*/
    }
}

From source file:sh.isaac.api.component.semantic.version.dynamic.DynamicDataType.java

/**
 * Parses the./*from  ww  w  .  j a  va2 s . c o m*/
 *
 * @param nameOrTokenOrEnumId the name or token or enum id
 * @param exceptionOnParseFail the exception on parse fail
 * @return the dynamic data type
 */
public static DynamicDataType parse(String nameOrTokenOrEnumId, boolean exceptionOnParseFail) {
    if (nameOrTokenOrEnumId == null) {
        return null;
    }

    final String clean = nameOrTokenOrEnumId.toLowerCase(Locale.ENGLISH).trim();

    if (StringUtils.isBlank(clean)) {
        return null;
    }

    try {
        final int i = Integer.parseInt(clean);

        if (i > 100) {
            return getFromToken(i);
        } else {
            // enumId
            return DynamicDataType.values()[i];
        }
    } catch (final NumberFormatException e) {
        for (final DynamicDataType x : DynamicDataType.values()) {
            if (x.displayName.equalsIgnoreCase(clean) || x.name().toLowerCase().equals(clean)) {
                return x;
            }
        }
    }

    if (exceptionOnParseFail) {
        throw new InvalidParameterException(
                "Could not determine DynamicSememeDataType from " + nameOrTokenOrEnumId);
    } else {
        return UNKNOWN;
    }
}

From source file:org.openanzo.rdf.MemValueFactory.java

@Override
public TypedLiteral createLiteral(String label, URI dataType) {
    if (dataType == null) {
        throw new InvalidParameterException("dataType must be non-null.");
    }/*from  w  ww .jav a 2  s .  co  m*/
    MemTypedLiteral lit = new MemTypedLiteral(label, dataType);
    MemTypedLiteral literal = null;
    synchronized (typedLiterals) {
        literal = typedLiterals.get(lit);
        if (literal == null) {
            literal = lit;
            typedLiterals.put(literal, literal);
        }
        return literal;
    }
}

From source file:com.joey.software.plottingToolkit.PlotingToolkit.java

public static XYSeriesCollection getCollection(int[] xData, int[] yData, String name) {
    if (xData.length != yData.length) {
        throw new InvalidParameterException("X and Y must be same length");
    }//  w  ww . ja  va2  s .  c o  m

    XYSeries series = new XYSeries(name);
    for (int i = 0; i < xData.length; i++) {
        series.add(xData[i], yData[i]);

    }

    XYSeriesCollection result = new XYSeriesCollection(series);
    return result;
}

From source file:eu.bittrade.libs.steemj.protocol.operations.ConvertOperation.java

@Override
public void validate(ValidationType validationType) {
    if (!ValidationType.SKIP_VALIDATION.equals(validationType)
            && !ValidationType.SKIP_ASSET_VALIDATION.equals(validationType)) {
        if (!amount.getSymbol().equals(SteemJConfig.getInstance().getDollarSymbol())) {
            // Only allow conversion from SBD to STEEM, allowing the
            // opposite can enable traders to abuse market fluxuations
            // through converting large quantities without moving the price.
            throw new InvalidParameterException("Can only convert SBD to STEEM.");
        } else if (amount.getAmount() <= 0) {
            throw new InvalidParameterException("Can only convert more than 0 SBD.");
        }// w w w .  j  a va 2  s. co m
    }
}

From source file:net.blogracy.controller.MediaController.java

/**
 * Get the photo albums from recordDb given the userId.
 * //  w w  w. ja va  2  s.  c o m
 * @param userId
 */
public List<Album> getAlbums(String userId) {
    if (userId == null)
        throw new InvalidParameterException("userId cannot be null");

    List<Album> albums = new ArrayList<Album>();
    try {
        JSONObject recordDb = DistributedHashTable.getSingleton().getRecord(userId);

        if (recordDb == null)
            return albums;

        JSONArray albumArray = recordDb.optJSONArray("albums");

        if (albumArray != null) {
            for (int i = 0; i < albumArray.length(); ++i) {
                JSONObject singleAlbumObject = albumArray.getJSONObject(i);
                Album entry = (Album) CONVERTER.convertToObject(singleAlbumObject, Album.class);
                albums.add(entry);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return albums;
}

From source file:org.cesecore.authorization.rules.AccessRuleData.java

/** Use setIsRecursive(boolean) instead of this method! */
public void setRecursiveBool(final Boolean recursiveBool) {
    if (recursiveBool == null) {
        throw new InvalidParameterException("Illegal to create an access rule with recursiveBool == null");
    }//from  w w w. ja  v a 2s  .  com
    this.recursiveBool = recursiveBool;
}

From source file:org.parosproxy.paros.model.SiteMap.java

public synchronized SiteNode findNode(HttpMessage msg, boolean matchStructural) {
    if (Constant.isLowMemoryOptionSet()) {
        throw new InvalidParameterException("SiteMap should not be accessed when the low memory option is set");
    }//from ww w  .  j  a  v a 2s .c  o  m
    if (msg == null || msg.getRequestHeader() == null) {
        return null;
    }
    SiteNode resultNode = null;
    URI uri = msg.getRequestHeader().getURI();

    SiteNode parent = (SiteNode) getRoot();
    String folder = "";

    try {

        String host = getHostName(uri);

        // no host yet
        parent = findChild(parent, host);
        if (parent == null) {
            return null;
        }

        List<String> path = model.getSession().getTreePath(msg);
        if (path.size() == 0) {
            // Its a top level node
            resultNode = parent;
        }
        for (int i = 0; i < path.size(); i++) {
            folder = path.get(i);
            if (folder != null && !folder.equals("")) {
                if (i == path.size() - 1) {
                    if (matchStructural) {
                        resultNode = findChild(parent, folder);
                    } else {
                        String leafName = getLeafName(folder, msg);
                        resultNode = findChild(parent, leafName);
                    }
                } else {
                    parent = findChild(parent, folder);
                    if (parent == null) {
                        return null;
                    }
                }
            }
        }
    } catch (URIException e) {
        log.error(e.getMessage(), e);
    }

    return resultNode;
}