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:org.flite.cach3.config.ConfigurationHelper.java

public static String addVelocityContextItems(final VelocityContextFactory factory, final String key,
        final Object value) {
    if (factory == null) {
        throw new InvalidParameterException("VelocityContextFactory must be defined.");
    }/*from  ww  w. ja v  a  2  s.c o m*/
    factory.addVelocityContextItems(ImmutableMap.of(key, value));
    return key;
}

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

public Quilt(int rowCount, int columnCount, float width, float height) {
    if (rowCount < 0)
        throw new InvalidParameterException("Invalid rowCount " + rowCount);
    if (columnCount < 0)
        throw new InvalidParameterException("Invalid columnCount " + columnCount);
    if (width < 0)
        throw new InvalidParameterException("Invalid width " + width);
    if (height < 0)
        throw new InvalidParameterException("Invalid height " + height);

    m_new = true;
    m_rowCount = rowCount;/*from w  ww  . ja v a 2s  .c  o m*/
    m_columnCount = columnCount;
    m_width = width;
    m_height = height;
    m_rows = new ArrayList<ArrayList<QuiltBlock>>();
}

From source file:com.github.bfour.fpliteraturecollector.domain.ISBN.java

public ISBN(String v10OrV13String) {

    ISBNValidator validator = ISBNValidator.getInstance();
    String normalizedString = getNormalizedString(v10OrV13String);

    if (validator.isValidISBN13(normalizedString))
        this.v13String = normalizedString;
    else if (validator.isValidISBN10(normalizedString))
        this.v13String = validator.convertToISBN13(normalizedString);
    else//from www  .j  a  v  a  2  s .  c om
        throw new InvalidParameterException("String passed as ISBN is not a valid v10 or v13 ISBN");

}

From source file:opennlp.tools.formats.pan.pan16.PAN16Reader.java

public static ArrayList<PAN16Author> getPAN16Authors(int startAuthorIndex, int endAuthorIndex) {
    ArrayList<PAN16Author> authors = new ArrayList<PAN16Author>();

    try {// ww  w.jav  a  2 s  .c o  m
        HashMap<String, String[]> truthMap = PAN16Reader.getTruthMap();

        JAXBContext jaxbContext = JAXBContext.newInstance(PAN16Author.class);
        Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();

        File folder = new File(PAN16Reader.class.getResource(dataFolder).getPath());
        File[] listOfFiles = folder.listFiles();

        if (startAuthorIndex < 0 || endAuthorIndex >= listOfFiles.length) {
            throw new IndexOutOfBoundsException("an author index is out of bounds, should be in : 0-"
                    + (listOfFiles.length - 2) + " range");
        } else if (startAuthorIndex > endAuthorIndex) {
            throw new InvalidParameterException("the start index is larger than the end index");
        }

        for (int i = startAuthorIndex; i <= endAuthorIndex; i++) {
            File file = listOfFiles[i];
            if (file.isFile() && FilenameUtils.getExtension(file.getPath()).equals("xml")) {
                PAN16Author author = (PAN16Author) jaxbUnmarshaller.unmarshal(new File(file.getPath()));
                String truths[] = truthMap.get(FilenameUtils.getBaseName(file.getPath()));
                author.setGender(truths[0]);
                author.setAge_group(truths[1]);
                authors.add(author);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return authors;
}

From source file:org.flite.cach3.config.ConfigurationHelper.java

public static Boolean setL2CacheDisabled(final L2Cach3State state, final boolean disabled) {
    if (state == null) {
        throw new InvalidParameterException("L2Cach3State must be defined.");
    }//from w ww . j av  a2s  . co  m
    state.setCacheDisabled(disabled);
    return disabled;
}

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

public static XYSeriesCollection getCollection(double[] xData, double[] yData, String name) {
    if (xData.length != yData.length) {
        throw new InvalidParameterException("X and Y must be same length");
    }/*  w  w w  .j av  a2 s.co  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:com.predic8.membrane.core.interceptor.authentication.session.SMSTokenProvider.java

@Override
public void requestToken(Map<String, String> userAttributes) {
    String token = generateToken(userAttributes);
    String recipientNumber;// w  ww  . ja va 2  s.  com

    synchronized (userAttributes) {
        recipientNumber = userAttributes.get("sms");
    }

    if (recipientNumber == null)
        throw new InvalidParameterException("User does not have the 'sms' attribute");

    recipientNumber = normalizeNumber(recipientNumber);

    String text = prefixText + token;

    if (simulate)
        log.error("Send SMS '" + text + "' to " + recipientNumber);
    else
        sendSMS(text, recipientNumber);
}

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

public PaperPiecedBlock(float width, float height, int backgroundColor) {
    if (width < 0)
        throw new InvalidParameterException("Invalid width " + width);
    if (height < 0)
        throw new InvalidParameterException("Invalid height " + height);

    m_dirty = false;/*from w w  w .  j a  va 2s . com*/
    m_width = width;
    m_height = height;
    m_backgroundColor = backgroundColor;
    m_pieces = new ArrayList<PaperPiecedBlockPiece>();

    m_backgroundPaint = new Paint();
    m_backgroundPaint.setStyle(Style.FILL);
    m_backgroundPaint.setColor(m_backgroundColor);

    m_backgroundPaintWhite = new Paint();
    m_backgroundPaintWhite.setStyle(Style.FILL);
    m_backgroundPaintWhite.setColor(Color.WHITE);
}

From source file:org.zaproxy.zap.model.StructuralTableNode.java

public StructuralTableNode(RecordStructure rs) {
    if (rs == null) {
        throw new InvalidParameterException("RecordStructure must not be null");
    }/*w  w  w.  j  a va  2  s .  co m*/
    this.rs = rs;
}

From source file:com.microsoft.azure.management.resources.fluentcore.arm.ResourceId.java

private ResourceId(final String id) {
    if (id == null) {
        // Protect against NPEs from null IDs, preserving legacy behavior for null IDs
        return;//from w w w. j a v a  2  s.c o m
    } else {
        // Skip the first '/' if any, and then split using '/'
        String[] splits = (id.startsWith("/")) ? id.substring(1).split("/") : id.split("/");
        if (splits.length % 2 == 1) {
            throw new InvalidParameterException(badIdErrorText(id));
        }

        // Save the ID itself
        this.id = id;

        // Format of id:
        // /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/<providerNamespace>(/<parentResourceType>/<parentName>)*/<resourceType>/<name>
        //  0             1                2              3                   4         5                                                        N-2            N-1

        // Extract resource type and name
        if (splits.length < 2) {
            throw new InvalidParameterException(badIdErrorText(id));
        } else {
            this.name = splits[splits.length - 1];
            this.resourceType = splits[splits.length - 2];
        }

        // Extract parent ID
        if (splits.length < 10) {
            this.parentId = null;
        } else {
            String[] parentSplits = new String[splits.length - 2];
            System.arraycopy(splits, 0, parentSplits, 0, splits.length - 2);
            this.parentId = "/" + StringUtils.join(parentSplits, "/");
        }

        for (int i = 0; i < splits.length && i < 6; i++) {
            switch (i) {
            case 0:
                // Ensure "subscriptions"
                if (!splits[i].equalsIgnoreCase("subscriptions")) {
                    throw new InvalidParameterException(badIdErrorText(id));
                }
                break;
            case 1:
                // Extract subscription ID
                this.subscriptionId = splits[i];
                break;
            case 2:
                // Ensure "resourceGroups"
                if (!splits[i].equalsIgnoreCase("resourceGroups")) {
                    throw new InvalidParameterException(badIdErrorText(id));
                }
                break;
            case 3:
                // Extract resource group name
                this.resourceGroupName = splits[i];
                break;
            case 4:
                // Ensure "providers"
                if (!splits[i].equalsIgnoreCase("providers")) {
                    throw new InvalidParameterException(badIdErrorText(id));
                }
                break;
            case 5:
                // Extract provider namespace
                this.providerNamespace = splits[i];
                break;
            default:
                break;
            }
        }
    }
}