List of usage examples for java.security InvalidParameterException InvalidParameterException
public InvalidParameterException(String msg)
From source file:org.xwoot.xwootUtil.FileUtil.java
/** * Convenience method./*from w w w. ja va 2 s . co m*/ * * @param directoryPath the path of the directory to delete. * @see #deleteDirectory(File) */ public static void deleteDirectory(String directoryPath) { if (directoryPath == null || directoryPath.length() == 0) { throw new InvalidParameterException("An empty or null value was provided for directory path."); } deleteDirectory(new File(directoryPath)); }
From source file:org.transdroid.search.hdtorrents.HdTorrentsAdapter.java
private DefaultHttpClient prepareRequest(Context context) throws Exception { Log.d(LOG_TAG, "Preparing login attempt."); // retrieve stored login info String username = SettingsHelper.getSiteUser(context, TorrentSite.HdTorrents); String password = SettingsHelper.getSitePass(context, TorrentSite.HdTorrents); // verify we have login credentials. does this ever get hit? if (username == null || password == null) { throw new InvalidParameterException( "No username or password was provided, while this is required for this private site."); }//from www . jav a 2 s. c o m // setup our http client HttpParams params = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(params, CONNECTION_TIMEOUT); HttpConnectionParams.setSoTimeout(params, CONNECTION_TIMEOUT); DefaultHttpClient client = new DefaultHttpClient(params); // login to HD-Torrents.org populating the HttpClient with the required cookies login(client, username, password); return client; }
From source file:eu.bittrade.libs.steemj.protocol.operations.FeedPublishOperation.java
@Override public void validate(ValidationType validationType) { if (!ValidationType.SKIP_VALIDATION.equals(validationType) && (!ValidationType.SKIP_ASSET_VALIDATION.equals(validationType)) && (!(exchangeRate.getBase().getSymbol().equals(SteemJConfig.getInstance().getTokenSymbol()) && exchangeRate.getQuote().getSymbol().equals(SteemJConfig.getInstance().getDollarSymbol()) || exchangeRate.getBase().getSymbol().equals(SteemJConfig.getInstance().getDollarSymbol()) && exchangeRate.getQuote().getSymbol() .equals(SteemJConfig.getInstance().getTokenSymbol())))) { throw new InvalidParameterException("The Price feed must be a STEEM/SBD price."); }//from w w w.j a v a 2 s . c om }
From source file:org.flite.cach3.aop.L2UpdateMultiCacheAdvice.java
static AnnotationInfo getAnnotationInfo(final L2UpdateMultiCache annotation, final String targetMethodName) { final AnnotationInfo result = new AnnotationInfo(); if (annotation == null) { throw new InvalidParameterException( String.format("No annotation of type [%s] found.", L2UpdateMultiCache.class.getName())); }// ww w .j a v a 2 s . co m final String namespace = annotation.namespace(); if (AnnotationConstants.DEFAULT_STRING.equals(namespace) || namespace == null || namespace.length() < 1) { throw new InvalidParameterException( String.format("Namespace for annotation [%s] must be defined on [%s]", L2UpdateMultiCache.class.getName(), targetMethodName)); } result.add(new AType.Namespace(namespace)); final String keyPrefix = annotation.keyPrefix(); if (!AnnotationConstants.DEFAULT_STRING.equals(keyPrefix)) { if (StringUtils.isBlank(keyPrefix)) { throw new InvalidParameterException(String.format( "KeyPrefix for annotation [%s] must not be defined as an empty string on [%s]", L2UpdateMultiCache.class.getName(), targetMethodName)); } result.add(new AType.KeyPrefix(keyPrefix)); } final Integer keyIndex = annotation.keyIndex(); if (keyIndex < -1) { throw new InvalidParameterException( String.format("KeyIndex for annotation [%s] must be -1 or greater on [%s]", L2UpdateMultiCache.class.getName(), targetMethodName)); } result.add(new AType.KeyIndex(keyIndex)); final String keyTemplate = annotation.keyTemplate(); if (!AnnotationConstants.DEFAULT_STRING.equals(keyTemplate)) { if (StringUtils.isBlank(keyTemplate)) { throw new InvalidParameterException(String.format( "KeyTemplate for annotation [%s] must not be defined as an empty string on [%s]", L2UpdateMultiCache.class.getName(), targetMethodName)); } result.add(new AType.KeyTemplate(keyTemplate)); } final int dataIndex = annotation.dataIndex(); if (dataIndex < -1) { throw new InvalidParameterException( String.format("DataIndex for annotation [%s] must be -1 or greater on [%s]", L2UpdateMultiCache.class.getName(), targetMethodName)); } result.add(new AType.DataIndex(dataIndex)); final Duration window = annotation.window(); if (window == Duration.UNDEFINED) { throw new InvalidParameterException( String.format("Window for annotation [%s] must be a defined value on [%s]", L2UpdateMultiCache.class.getName(), targetMethodName)); } result.add(new AType.Window(window)); return result; }
From source file:org.transdroid.search.hdbitsorg.HdBitsOrgAdapter.java
private DefaultHttpClient prepareRequest(Context context) throws Exception { Log.d(LOG_TAG, "Preparing login attempt."); // retrieve stored login info String username = SettingsHelper.getSiteUser(context, TorrentSite.HdBitsOrg); String password = SettingsHelper.getSitePass(context, TorrentSite.HdBitsOrg); // verify we have login credentials. does this ever get hit? if (username == null || password == null) { throw new InvalidParameterException( "No username or password was provided, while this is required for this private site."); }/*from www. ja v a 2 s.c om*/ // setup our http client HttpParams params = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(params, CONNECTION_TIMEOUT); HttpConnectionParams.setSoTimeout(params, CONNECTION_TIMEOUT); DefaultHttpClient client = new DefaultHttpClient(params); // grab our unique login token String token = grabToken(client); // login to hdbits populating the HttpClient with the required cookies login(client, username, password, token); return client; }
From source file:eu.bittrade.libs.steemj.protocol.operations.WithdrawVestingOperation.java
@Override public void validate(ValidationType validationType) { if ((!ValidationType.SKIP_ASSET_VALIDATION.equals(validationType) && !ValidationType.SKIP_VALIDATION.equals(validationType)) && (!SteemJConfig.getInstance().getVestsSymbol().equals(this.getVestingShares().getSymbol()))) { throw new InvalidParameterException("The vesting shares needs to be provided in VESTS."); }/*from w w w . j av a 2s. c om*/ }
From source file:org.openqa.grid.internal.utils.SelfRegisteringRemote.java
/** * Adding the browser described by the capability, automatically finding out what platform the * node is launched from ( and overriding it if it was specified ) * /*from www .ja va 2s. c om*/ * @param cap describing the browser * @param instances number of times this browser can be started on the node. */ public void addBrowser(DesiredCapabilities cap, int instances) { String s = cap.getBrowserName(); if (s == null || "".equals(s)) { throw new InvalidParameterException(cap + " does seems to be a valid browser."); } cap.setPlatform(Platform.getCurrent()); cap.setCapability(RegistrationRequest.MAX_INSTANCES, instances); nodeConfig.getCapabilities().add(cap); }
From source file:org.onexus.resource.manager.internal.providers.AbstractProjectProvider.java
public synchronized void loadProject() { File projectOnx = new File(projectFolder, ONEXUS_PROJECT_FILE); if (!projectOnx.exists()) { throw new InvalidParameterException("No Onexus project in " + projectFolder.getAbsolutePath()); }/* w w w .j a v a 2 s .c om*/ this.project = (Project) loadResource(projectOnx); this.project.setName(projectName); this.bundleDependencies.clear(); if (project.getPlugins() != null) { for (Plugin plugin : project.getPlugins()) { //TODO Remove this property if (plugin.getParameter("location") == null && plugin.getParameters() != null) { plugin.getParameters().add(new Parameter("location", projectFolder.getAbsolutePath())); } try { long bundleId = pluginLoader.load(plugin); bundleDependencies.add(bundleId); } catch (InvalidParameterException e) { LOGGER.error(e.getMessage()); } } } if (project.getAlias() != null && !project.getAlias().isEmpty()) { this.projectAlias = new Properties(); try { this.projectAlias.load(new StringReader(project.getAlias())); } catch (IOException e) { LOGGER.error("Malformed project alias", e); this.projectAlias = null; } } this.resources = null; }
From source file:org.flite.cach3.aop.L2ReadThroughMultiCacheAdvice.java
static AnnotationInfo getAnnotationInfo(final L2ReadThroughMultiCache annotation, final String targetMethodName) { final AnnotationInfo result = new AnnotationInfo(); if (annotation == null) { throw new InvalidParameterException( String.format("No annotation of type [%s] found.", L2ReadThroughMultiCache.class.getName())); }//from w w w . j a v a2 s .c om final String namespace = annotation.namespace(); if (AnnotationConstants.DEFAULT_STRING.equals(namespace) || namespace == null || namespace.length() < 1) { throw new InvalidParameterException( String.format("Namespace for annotation [%s] must be defined on [%s]", L2ReadThroughMultiCache.class.getName(), targetMethodName)); } result.add(new AType.Namespace(namespace)); final String keyPrefix = annotation.keyPrefix(); if (!AnnotationConstants.DEFAULT_STRING.equals(keyPrefix)) { if (StringUtils.isBlank(keyPrefix)) { throw new InvalidParameterException(String.format( "KeyPrefix for annotation [%s] must not be defined as an empty string on [%s]", L2ReadThroughMultiCache.class.getName(), targetMethodName)); } result.add(new AType.KeyPrefix(keyPrefix)); } final Integer keyIndex = annotation.keyIndex(); if (keyIndex < 0) { throw new InvalidParameterException( String.format("KeyIndex for annotation [%s] must be 0 or greater on [%s]", L2ReadThroughMultiCache.class.getName(), targetMethodName)); } result.add(new AType.KeyIndex(keyIndex)); final String keyTemplate = annotation.keyTemplate(); if (!AnnotationConstants.DEFAULT_STRING.equals(keyTemplate)) { if (StringUtils.isBlank(keyTemplate)) { throw new InvalidParameterException(String.format( "KeyTemplate for annotation [%s] must not be defined as an empty string on [%s]", L2ReadThroughMultiCache.class.getName(), targetMethodName)); } result.add(new AType.KeyTemplate(keyTemplate)); } final Duration window = annotation.window(); if (window == Duration.UNDEFINED) { throw new InvalidParameterException( String.format("Window for annotation [%s] must be a defined value on [%s]", L2ReadThroughMultiCache.class.getName(), targetMethodName)); } result.add(new AType.Window(window)); return result; }
From source file:org.flite.cach3.aop.ReadThroughSingleCacheAdvice.java
protected String generateBaseKeySingle(final Object[] args, final AnnotationInfo info, final String methodString) throws Exception { final String keyTemplate = info.getAsString(AType.KEY_TEMPLATE, null); if (StringUtils.isBlank(keyTemplate)) { return getObjectId(getIndexObject(info.getAsInteger(AType.KEY_INDEX), args, methodString)); }/*from ww w. j av a 2 s . c o m*/ final VelocityContext context = factory.getNewExtendedContext(); context.put("args", args); final StringWriter writer = new StringWriter(250); Velocity.evaluate(context, writer, this.getClass().getSimpleName(), keyTemplate); final String result = writer.toString(); if (keyTemplate.equals(result)) { throw new InvalidParameterException("Calculated key is equal to the velocityTemplate."); } return result; }