java.security.InvalidParameterException Java Examples
The following examples show how to use
java.security.InvalidParameterException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KeyPairGeneratorSpi.java From RipplePower with Apache License 2.0 | 6 votes |
public void initialize( int strength, SecureRandom random) { this.strength = strength; this.random = random; ECGenParameterSpec ecParams = (ECGenParameterSpec)ecParameters.get(Integers.valueOf(strength)); if (ecParams == null) { throw new InvalidParameterException("unknown key size."); } try { initialize(ecParams, random); } catch (InvalidAlgorithmParameterException e) { throw new InvalidParameterException("key size not configurable."); } }
Example #2
Source File: DataIndexBuilder.java From simple-spring-memcached with MIT License | 6 votes |
@Override protected void build(final AnnotationData data, final Annotation annotation, final Class<? extends Annotation> expectedAnnotationClass, final Method targetMethod) { if (isReturnDataUpdateContent(targetMethod)) { data.setReturnDataIndex(true); return; } final Integer foundIndex = getIndexOfAnnotatedParam(targetMethod, ParameterDataUpdateContent.class); if (foundIndex == null) { throw new InvalidParameterException(String.format( "No ReturnDataUpdateContent or ParameterDataUpdateContent annotation found on method [%s]", targetMethod.getName())); } data.setDataIndex(foundIndex); }
Example #3
Source File: SunProvider.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public Object newInstance(Object ctrParamObj) throws NoSuchAlgorithmException { String type = getType(); if (ctrParamObj != null) { throw new InvalidParameterException ("constructorParameter not used with " + type + " engines"); } String algo = getAlgorithm(); try { if (type.equals("GssApiMechanism")) { if (algo.equals("1.2.840.113554.1.2.2")) { return new Krb5MechFactory(); } else if (algo.equals("1.3.6.1.5.5.2")) { return new SpNegoMechFactory(); } } } catch (Exception ex) { throw new NoSuchAlgorithmException ("Error constructing " + type + " for " + algo + " using SunJGSS", ex); } throw new ProviderException("No impl for " + algo + " " + type); }
Example #4
Source File: GridPosition.java From chart-fx with Apache License 2.0 | 6 votes |
public static HexagonMap.Direction getDirectionFromNumber(final int i) { switch (i) { case 0: return HexagonMap.Direction.NORTHWEST; case 1: return HexagonMap.Direction.NORTHEAST; case 2: return HexagonMap.Direction.EAST; case 3: return HexagonMap.Direction.SOUTHEAST; case 4: return HexagonMap.Direction.SOUTHWEST; case 5: return HexagonMap.Direction.WEST; default: } throw new InvalidParameterException("unknown direction: " + i); }
Example #5
Source File: ECCKeyGenParameterSpec.java From RipplePower with Apache License 2.0 | 6 votes |
/** * Constructor. * * @param m degree of the finite field GF(2^m) * @param t error correction capability of the code * @throws InvalidParameterException if <tt>m < 1</tt> or <tt>m > 32</tt> or * <tt>t < 0</tt> or <tt>t > n</tt>. */ public ECCKeyGenParameterSpec(int m, int t) throws InvalidParameterException { if (m < 1) { throw new InvalidParameterException("m must be positive"); } if (m > 32) { throw new InvalidParameterException("m is too large"); } this.m = m; n = 1 << m; if (t < 0) { throw new InvalidParameterException("t must be positive"); } if (t > n) { throw new InvalidParameterException("t must be less than n = 2^m"); } this.t = t; fieldPoly = PolynomialRingGF2.getIrreduciblePolynomial(m); }
Example #6
Source File: EventNotificationService.java From lams with GNU General Public License v2.0 | 6 votes |
/** * See {@link IEventNotificationService#unsubscribe(String, String, Long, Long) */ protected void unsubscribe(Event event, Integer userId) throws InvalidParameterException { if (userId == null) { throw new InvalidParameterException("User ID can not be null."); } Iterator<Subscription> subscriptionIterator = event.getSubscriptions().iterator(); while (subscriptionIterator.hasNext()) { Subscription subscription = subscriptionIterator.next(); if (subscription.getUserId().equals(userId)) { subscriptionIterator.remove(); } } if (event.getSubscriptions().isEmpty()) { eventDAO.delete(event); } else { eventDAO.insertOrUpdate(event); } }
Example #7
Source File: DSAParameterGenerator.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Initializes this parameter generator for a certain strength * and source of randomness. * * @param strength the strength (size of prime) in bits * @param random the source of randomness */ protected void engineInit(int strength, SecureRandom random) { if ((strength >= 512) && (strength <= 1024) && (strength % 64 == 0)) { this.valueN = 160; } else if (strength == 2048) { this.valueN = 224; // } else if (strength == 3072) { // this.valueN = 256; } else { throw new InvalidParameterException ("Prime size should be 512 - 1024, or 2048"); } this.valueL = strength; this.seedLen = valueN; this.random = random; }
Example #8
Source File: PullRefreshLayout.java From UltimateAndroid with Apache License 2.0 | 6 votes |
public void setRefreshStyle(int type){ setRefreshing(false); switch (type){ case STYLE_CIRCLES: mRefreshDrawable = new CirclesDrawable(getContext(), this); break; case STYLE_WATER_DROP: mRefreshDrawable = new WaterDropDrawable(getContext(), this); break; case STYLE_RING: mRefreshDrawable = new RingDrawable(getContext(), this); break; default: throw new InvalidParameterException("Type does not exist"); } mRefreshDrawable.setColorSchemeColors(mColorSchemeColors); mRefreshView.setImageDrawable(mRefreshDrawable); }
Example #9
Source File: EccUtil.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
/** * Determines the name of the domain parameters that were used for generating the key. * * @param key An EC key * @return The name of the domain parameters that were used for the EC key, * or an empty string if curve is unknown. */ public static String getNamedCurve(Key key) { if (!(key instanceof ECKey)) { throw new InvalidParameterException("Not a EC private key."); } ECKey ecKey = (ECKey) key; ECParameterSpec params = ecKey.getParams(); if (!(params instanceof ECNamedCurveSpec)) { return ""; } ECNamedCurveSpec ecPrivateKeySpec = (ECNamedCurveSpec) params; String namedCurve = ecPrivateKeySpec.getName(); return namedCurve; }
Example #10
Source File: Calculator.java From tutorials with MIT License | 5 votes |
public void calculate(CalculatorOperation operation) { if (operation == null) { throw new InvalidParameterException("Can not perform operation"); } operation.perform(); }
Example #11
Source File: HensonManager.java From dart with Apache License 2.0 | 5 votes |
public TaskProvider<GenerateHensonNavigatorTask> createHensonNavigatorGenerationTask( BaseVariant variant, File destinationFolder) { if (hensonExtension == null || hensonExtension.getNavigatorPackageName() == null) { throw new InvalidParameterException( "The property 'henson.navigatorPackageName' must be defined in your build.gradle"); } String hensonNavigatorPackageName = hensonExtension.getNavigatorPackageName(); TaskProvider<GenerateHensonNavigatorTask> generateHensonNavigatorTask = taskManager.createHensonNavigatorGenerationTask( variant, hensonNavigatorPackageName, destinationFolder); return generateHensonNavigatorTask; }
Example #12
Source File: FontUtil.java From letterpress with Apache License 2.0 | 5 votes |
@NonNull public static SpannableString applyTypeface(@NonNull String text, @NonNull Context context, @NonNull String fontName) { final Typeface typeface = getTypeface(context, fontName); if (typeface == null) { throw new InvalidParameterException("Font '" + fontName + "' not found"); } return applyTypeface(text, typeface); }
Example #13
Source File: AESKeyGenerator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Initializes this key generator for a certain keysize, using the given * source of randomness. * * @param keysize the keysize. This is an algorithm-specific * metric specified in number of bits. * @param random the source of randomness for this key generator */ protected void engineInit(int keysize, SecureRandom random) { if (((keysize % 8) != 0) || (!AESCrypt.isKeySizeValid(keysize/8))) { throw new InvalidParameterException ("Wrong keysize: must be equal to 128, 192 or 256"); } this.keySize = keysize/8; this.engineInit(random); }
Example #14
Source File: AndroidDebugBridge.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Creates a new bridge. * @param osLocation the location of the command line tool * @throws InvalidParameterException */ private AndroidDebugBridge(String osLocation) throws InvalidParameterException { if (osLocation == null || osLocation.isEmpty()) { throw new InvalidParameterException(); } mAdbOsLocation = osLocation; }
Example #15
Source File: BoxRepresentation.java From box-android-sdk with Apache License 2.0 | 5 votes |
/** * Helper method to generate representation hint string * @param repType the type of representation * @param repSize the size of representation, used for image types. (please refer to dimension string * @return string that can be used on server requests hinting the type of representation to return */ public static String getRepresentationHintString(String repType, String repSize) { StringBuffer sb = new StringBuffer(repType); if(TYPE_JPG.equals(repType) || TYPE_PNG.equals(repType)) { if(TextUtils.isEmpty(repSize)) { throw new InvalidParameterException("Size is not optional when creating representation hints for images"); } sb.append("?" + BoxRepPropertiesMap.FIELD_PROPERTIES_DIMENSIONS + "=" + repSize); } return sb.toString(); }
Example #16
Source File: ThreadExecutor.java From ThreadDebugger with Apache License 2.0 | 5 votes |
public Exposed(IExecutor threadExecutor) { if (threadExecutor instanceof ThreadExecutor) { this.mThreadExecutor = (ThreadExecutor) threadExecutor; } else { throw new InvalidParameterException("The exposed only support the ThreadExecutor instance!"); } }
Example #17
Source File: Convolution.java From chart-fx with Apache License 2.0 | 5 votes |
/** * computes low-pass filter (Fourier Domain) * * @param length the length of the filter * @param frequency cut-off frequency * @return array containing low-pass filter kernel */ public static double[] getLowPassFilter(final int length, double frequency) { if (length <= 0 || length % 2 != 0) { throw new InvalidParameterException( "getLowPassFilter(" + length + ")" + " - length has to be positive and a power of two"); } if (frequency > 0.5) { frequency = 0.5; } final double[] ret = new double[length]; final int half = length >> 1; final double TwoPiTau = TMathConstants.TwoPi() / frequency; for (int i = 0; i < half; i++) { final int i2 = i << 1; final double f = (double) i / (double) length; /* * double val = 1.0; double phi = TMath.TwoPi() * f; * * if (frequency != 0.5) { if (f >= frequency && f < 1.2 * frequency) { double val2 = * (1.0-Math.sin(TMath.Pi() * (f - frequency)/(0.4*frequency))); val = Math.pow(val2,2); } else if (f > 1.2 * * frequency) { val = 0.0; } } ret[i2] = +val; ret[i2 + 1] = 0; */ final double Re = 1.0 / (1 + TMathConstants.Sqr(TwoPiTau * f)); final double Im = Re * TwoPiTau * f; // first order ret[i2] = Re; ret[i2 + 1] = Im; // second order // ret[i2] = Re*Re-Im*Im; // ret[i2 + 1] = 2*Im*Re; } // ret[0] = 1.0; // ret[1] = 0.0; return ret; }
Example #18
Source File: LinearRegressionFitter.java From chart-fx with Apache License 2.0 | 5 votes |
/** * Value of fitted parameter. * * @param index of parameter * @return parameter value */ public double getParameter(final int index) { if (flastFitResult == null) { throw new InvalidParameterException("LinearRegressionFitter::getParameter(int) - " + NULL_FUNCTION_WARN); } if (index < 0 || index >= flastFitResult.getRowDimension()) { throw new InvalidParameterException("LinearRegressionFitter::getParameter(" + index + ") - " + "requested invalid parameter index [0," + flastFitResult.getRowDimension() + "]"); } return flastFitResult.get(index, 0); }
Example #19
Source File: CustomJsonOperation.java From steem-java-api-wrapper with GNU General Public License v3.0 | 5 votes |
@Override public void validate(List<ValidationType> validationsToSkip) { if (!validationsToSkip.contains(ValidationType.SKIP_VALIDATION)) { if (requiredPostingAuths.isEmpty() && requiredAuths.isEmpty()) { throw new InvalidParameterException( "At least one authority type (POSTING or ACTIVE) needs to be provided."); } else if (id.length() > 32) { throw new InvalidParameterException("The ID must be less than 32 characters long."); } else if (json != null && !json.isEmpty() && !SteemJUtils.verifyJsonString(json)) { throw new InvalidParameterException("The given String is no valid JSON"); } } }
Example #20
Source File: EventUseCases.java From hesperides with GNU General Public License v3.0 | 5 votes |
@NotNull private static Module.Key parseModuleKey(String streamName, String moduleName) { String versionAndVersionType = streamName.replace(moduleName + "-", ""); Matcher matcher = Pattern.compile("(.*)-([^-]+)$").matcher(versionAndVersionType); if (!matcher.matches()) { throw new IllegalArgumentException(INVALID_STREAM_NAME_ERROR_MSG); } TemplateContainer.VersionType versionType; try { versionType = TemplateContainer.VersionType.fromMinimizedForm(matcher.group(2)); } catch (InvalidParameterException e) { throw new IllegalArgumentException(INVALID_STREAM_NAME_ERROR_MSG); } return new Module.Key(moduleName, matcher.group(1), versionType); }
Example #21
Source File: AdeConfigPropertiesImpl.java From ade with GNU General Public License v3.0 | 5 votes |
@Override public SortedMap<String, String> create(String propVal) { final String[] parts = propVal.trim().split(","); final TreeMap<String, String> res = new TreeMap<String, String>(); if (parts == null || parts.length == 0) { return res; } for (String part : parts) { String src; String dst; if (part.contains("->")) { final String[] pp = part.split("->"); if (pp.length != MAX_PP_LENGTH) { throw new InvalidParameterException("Invalid usage of -> in result mapping \"" + part + "\""); } src = pp[0]; dst = pp[1]; } else { src = dst = part; } if (src == null || src.length() == 0 || dst == null || dst.length() == 0) { throw new InvalidParameterException("Invalding result mapping \"" + part + "\""); } if (res.containsKey(src) || res.containsValue(dst)) { throw new InvalidParameterException("Duplicate mapping \"" + part + "\""); } res.put(src, dst); } return res; }
Example #22
Source File: ChainPropertiesTest.java From steem-java-api-wrapper with GNU General Public License v3.0 | 5 votes |
/** * Test the validation of the * {@link eu.bittrade.libs.steemj.base.models.ChainProperties} object. */ @Test(expected = InvalidParameterException.class) public void testChainPropertiesValidationInterestRate() { LegacyAsset accountCreationFee = new LegacyAsset(5000, LegacyAssetSymbolType.STEEM); long maximumBlockSize = 65570; int sbdInterestRate = -1; new ChainProperties(accountCreationFee, maximumBlockSize, sbdInterestRate); }
Example #23
Source File: MerkleTree.java From md_blockchain with Apache License 2.0 | 5 votes |
public List<MerkleProofHash> auditProof(MerkleHash leafHash) { List<MerkleProofHash> auditTrail = new ArrayList<>(); MerkleNode leafNode = this.findLeaf(leafHash); if (leafNode != null) { if (leafNode.getParent() == null) throw new InvalidParameterException("Expected leaf to have a parent!"); MerkleNode parent = leafNode.getParent(); this.buildAuditTrail(auditTrail, parent, leafNode); } return auditTrail; }
Example #24
Source File: DefaultSQLCreateTableAction.java From components with Apache License 2.0 | 5 votes |
public DefaultSQLCreateTableAction(final String[] fullTableName, final Schema schema, boolean createIfNotExists, boolean drop, boolean dropIfExists) { if (fullTableName == null || fullTableName.length < 1) { throw new InvalidParameterException("Table name can't be null or empty"); } this.fullTableName = fullTableName; this.schema = schema; this.createIfNotExists = createIfNotExists; this.drop = drop || dropIfExists; this.dropIfExists = dropIfExists; }
Example #25
Source File: CertificateValidator.java From deprecated-security-ssl with Apache License 2.0 | 5 votes |
/** * creates an instance of the certificate validator * * @param trustStore the truststore to use * @param crls the Certificate Revocation List to use */ public CertificateValidator(KeyStore trustStore, Collection<? extends CRL> crls) { if (trustStore == null) { throw new InvalidParameterException("TrustStore must be specified for CertificateValidator."); } _trustStore = trustStore; _crls = crls; }
Example #26
Source File: EventNotificationService.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void trigger(String scope, String name, Long eventSessionId) throws InvalidParameterException { if (scope == null) { throw new InvalidParameterException("Scope should not be null."); } if (StringUtils.isBlank(name)) { throw new InvalidParameterException("Name should not be blank."); } Event event = eventDAO.getEvent(scope, name, eventSessionId); if (event == null) { throw new InvalidParameterException("An event with the given parameters does not exist."); } trigger(event, null, null); }
Example #27
Source File: SubtitleRegion.java From subtitle with GNU Lesser General Public License v3.0 | 5 votes |
public void setX(float x) { if (x < 0.0f || x > 100.0f) { throw new InvalidParameterException("X value must be defined in percentage between 0 and 100"); } this.x = x; }
Example #28
Source File: Price.java From steem-java-api-wrapper with GNU General Public License v3.0 | 5 votes |
/** * Validate this <code>Price</code> object. * * @throws InvalidParameterException * If the <code>base</code>, the <code>quote</code> or both * objects have not been provided, contain the same symbol or * have an amount less than 1. */ private void validate() { if (SteemJUtils.setIfNotNull(this.base, "The base asset needs to be provided.").getSymbol() == SteemJUtils .setIfNotNull(this.quote, "The quote asset needs to be provided.").getSymbol()) { throw new InvalidParameterException("The base asset needs to have a different type than the quote asset."); } else if (this.base.getAmount() <= 0) { throw new InvalidParameterException("The base asset amount needs to be greater than 0."); } else if (this.quote.getAmount() <= 0) { throw new InvalidParameterException("The quote asset amount needs to be greater than 0."); } }
Example #29
Source File: BlowfishKeyGenerator.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Initializes this key generator for a certain keysize, using the given * source of randomness. * * @param keysize the keysize. This is an algorithm-specific * metric specified in number of bits. * @param random the source of randomness for this key generator */ protected void engineInit(int keysize, SecureRandom random) { if (((keysize % 8) != 0) || (keysize < 32) || (keysize > 448)) { throw new InvalidParameterException("Keysize must be " + "multiple of 8, and can " + "only range from 32 to 448 " + "(inclusive)"); } this.keysize = keysize / 8; this.engineInit(random); }
Example #30
Source File: SettingsController.java From Library-Assistant with Apache License 2.0 | 5 votes |
private MailServerInfo readMailSererInfo() { try { MailServerInfo mailServerInfo = new MailServerInfo(serverName.getText(), Integer.parseInt(smtpPort.getText()), emailAddress.getText(), emailPassword.getText(), sslCheckbox.isSelected()); if (!mailServerInfo.validate() || !LibraryAssistantUtil.validateEmailAddress(emailAddress.getText())) { throw new InvalidParameterException(); } return mailServerInfo; } catch (Exception exp) { AlertMaker.showErrorMessage("Invalid Entries Found", "Correct input and try again"); LOGGER.log(Level.WARN, exp); } return null; }