本文整理汇总了Java中java.security.InvalidParameterException类的典型用法代码示例。如果您正苦于以下问题:Java InvalidParameterException类的具体用法?Java InvalidParameterException怎么用?Java InvalidParameterException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InvalidParameterException类属于java.security包,在下文中一共展示了InvalidParameterException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFromMarc4j
import java.security.InvalidParameterException; //导入依赖的package包/类
public static MarcRecord createFromMarc4j(Record marc4jRecord, Leader.Type defaultType, MarcVersion marcVersion, boolean fixAlephseq) {
MarcRecord record = new MarcRecord();
if (defaultType == null)
record.setLeader(new Leader(marc4jRecord.getLeader().marshal()));
else
record.setLeader(new Leader(marc4jRecord.getLeader().marshal(), defaultType));
if (record.getType() == null) {
throw new InvalidParameterException(
String.format(
"Error in '%s': no type has been detected. Leader: '%s'",
marc4jRecord.getControlNumberField(), record.getLeader().getLeaderString()));
}
importMarc4jControlFields(marc4jRecord, record, fixAlephseq);
importMarc4jDataFields(marc4jRecord, record, marcVersion);
return record;
}
示例2: setBaseOid
import java.security.InvalidParameterException; //导入依赖的package包/类
/**
* Asettaa base oid:in, jota käytetään root oid:n generointiin.<br/>
* <b>Huom. Luokka on singleton ja muutenkin muutetaan staattista muuttujaa, joten tämä vaikuttaa kaikkiin luokan
* instansseihin.</b>
*
* @param baseOid
* Root oid:n generointiin käytetty 'base oid'
*/
public static void setBaseOid(String baseOid) {
if ( baseOid != null && baseOid.trim().length() > 0 ) {
if ( !baseOid.endsWith(Character.toString(OidGenerator.SEPR)) ) {
OidGenerator.baseOid = baseOid + OidGenerator.SEPR;
}
else {
OidGenerator.baseOid = baseOid;
}
}
else {
// Ei muuteta arvoa jos annettu tyhjä String
throw new InvalidParameterException("Base oid ei saa olla tyhjä");
}
}
示例3: getRepeatingReminderNextCalendar
import java.security.InvalidParameterException; //导入依赖的package包/类
public static Calendar getRepeatingReminderNextCalendar(RepeatingReminder repeatingReminder) {
Calendar today = Calendar.getInstance();
Calendar endDate = getRepeatingReminderEndCalendar(repeatingReminder);
Calendar cal = CalendarUtil.getCalendarFromDateAndTime( repeatingReminder.getDate(), repeatingReminder.getTime());
//TODO: Cant use getDateFieldFromRepeatType(), Gives off a weird warning
//final int dateField = getDateFieldFromRepeatType(repeatingReminder.getRepeatType());
while(true) {
if (cal.compareTo(endDate) >= 0) //If cal passed endDate, reminder is overdue, return null
return null;
if(cal.compareTo(today) >= 0) {
return cal;
}
//TODO: Cant use getDateFieldFromRepeatType(), Gives off a weird warning
//cal.add(dateField, repeatingReminder.getRepeatInterval()); break;
switch (repeatingReminder.getRepeatType()) {
case DAILY: cal.add(Calendar.DAY_OF_WEEK, repeatingReminder.getRepeatInterval()); break;
case WEEKLY: cal.add(Calendar.WEEK_OF_YEAR, repeatingReminder.getRepeatInterval()); break;
case MONTHLY: cal.add(Calendar.MONTH, repeatingReminder.getRepeatInterval()); break;
case YEARLY: cal.add(Calendar.YEAR, repeatingReminder.getRepeatInterval()); break;
default: throw new InvalidParameterException("Invalid RepeatType parameter in TaskUtil.getRepeatingReminderEndCalendar()");
}
}
}
示例4: onBindViewHolder
import java.security.InvalidParameterException; //导入依赖的package包/类
@Override
final public void onBindViewHolder(ViewHolder holder, int position) {
if (mSections == null) {
calculateSections();
}
final int section = mSectionIndices[position];
final int internalType = internalViewType(holder.getItemViewType());
final int externalType = externalViewType(holder.getItemViewType());
switch (internalType) {
case TYPE_HEADER:
onBindHeaderViewHolder((HeaderViewHolder)holder, section);
break;
case TYPE_ITEM:
final ItemViewHolder itemHolder = (ItemViewHolder)holder;
final int offset = getItemSectionOffset(section, position);
onBindItemViewHolder((ItemViewHolder)holder, section, offset);
break;
default:
throw new InvalidParameterException("invalid viewType: " + internalType);
}
}
示例5: floatString
import java.security.InvalidParameterException; //导入依赖的package包/类
/**
* Formats a floating point value with the specified number of decimals.
*
* @param value
* Value to convert into string.
* @param decimals
* Number of decimals.
* @return
*/
protected static String floatString(float value, int decimals) {
String res = (value >= 0 ? " " : "") + String.valueOf(value);
int point = res.indexOf(".") + 1;
if (decimals < 0) {
throw new InvalidParameterException("decimals < 0");
} else if (decimals == 0) {
return res.substring(0, point - 2);
} else {
while (res.length() - point < decimals) {
res += "0";
}
if (res.length() - point > decimals) {
res = res.substring(0, point + decimals);
}
return res;
}
}
示例6: logout
import java.security.InvalidParameterException; //导入依赖的package包/类
/**
* Log the current user out.
* @param logoutCallback The callback to be called when the logout is complete.
*/
@Override
public void logout(final ICallback<Void> logoutCallback) {
if (!mInitialized) {
throw new IllegalStateException("init must be called");
}
if (logoutCallback == null) {
throw new InvalidParameterException("logoutCallback");
}
mLogger.logDebug("Starting logout async");
mExecutors.performOnBackground(new Runnable() {
@Override
public void run() {
try {
logout();
mExecutors.performOnForeground((Void) null, logoutCallback);
} catch (final ClientException e) {
mExecutors.performOnForeground(e, logoutCallback);
}
}
});
}
示例7: ECCKeyGenParameterSpec
import java.security.InvalidParameterException; //导入依赖的package包/类
/**
* Constructor.
*
* @param keysize the length of a Goppa code
* @throws InvalidParameterException if <tt>keysize < 1</tt>.
*/
public ECCKeyGenParameterSpec(int keysize)
throws InvalidParameterException
{
if (keysize < 1)
{
throw new InvalidParameterException("key size must be positive");
}
m = 0;
n = 1;
while (n < keysize)
{
n <<= 1;
m++;
}
t = n >>> 1;
t /= m;
fieldPoly = PolynomialRingGF2.getIrreduciblePolynomial(m);
}
示例8: engineInit
import java.security.InvalidParameterException; //导入依赖的package包/类
/**
* 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
*/
@Override
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(
"Unexpected strength (size of prime): " + strength + ". " +
"Prime size should be 512 - 1024, or 2048, 3072");
}
this.valueL = strength;
this.seedLen = valueN;
this.random = random;
}
示例9: getReminderEndCalendar
import java.security.InvalidParameterException; //导入依赖的package包/类
public static Calendar getReminderEndCalendar(Reminder reminder) {
switch (reminder.getType()) {
case NONE:
case LOCATION_BASED:
return null;
case ONE_TIME:
return CalendarUtil.getCalendarFromDateAndTime( ((OneTimeReminder)reminder).getDate(), ((OneTimeReminder)reminder).getTime() );
case REPEATING:
return getRepeatingReminderEndCalendar(((RepeatingReminder)reminder));
default:
throw new InvalidParameterException("Invalid ReminderType param on TaskUtil.getReminderEndCalendar()");
}
}
示例10: addBestGuess
import java.security.InvalidParameterException; //导入依赖的package包/类
/**
* When we don't come up with any suggestions (probably because the threshold was too strict),
* then pick the best guesses from the those words that have the same phonetic code.
* @param word - the word we are trying spell correct
* @param Two dimensional array of int used to calculate
* edit distance. Allocating this memory outside of the function will greatly improve efficiency.
* @param wordList - the linked list that will get the best guess
*/
private void addBestGuess(String word, Vector<Word> wordList, int[][] matrix) {
if(matrix == null)
matrix = new int[0][0];
if (wordList.size() != 0)
throw new InvalidParameterException("the wordList vector must be empty");
int bestScore = Integer.MAX_VALUE;
String code = getCode(word);
List<String> simwordlist = getWords(code);
LinkedList<Word> candidates = new LinkedList<Word>();
for (String similar : simwordlist) {
int distance = EditDistance.getDistance(word, similar, matrix);
if (distance <= bestScore) {
bestScore = distance;
Word goodGuess = new Word(similar, distance);
candidates.add(goodGuess);
}
}
//now, only pull out the guesses that had the best score
for (Iterator<Word> iter = candidates.iterator(); iter.hasNext();) {
Word candidate = iter.next();
if (candidate.getCost() == bestScore)
wordList.add(candidate);
}
}
示例11: initialize
import java.security.InvalidParameterException; //导入依赖的package包/类
public void initialize(
int strength,
SecureRandom random)
{
this.strength = strength;
this.random = random;
if (ecParams != null)
{
try
{
initialize((ECGenParameterSpec)ecParams, random);
}
catch (InvalidAlgorithmParameterException e)
{
throw new InvalidParameterException("key size not configurable.");
}
}
else
{
throw new InvalidParameterException("unknown key size.");
}
}
示例12: hsErrorIntToException
import java.security.InvalidParameterException; //导入依赖的package包/类
static Throwable hsErrorIntToException(int hsError) {
switch (hsError) {
case -1: return new InvalidParameterException("An invalid parameter has been passed. Is scratch allocated?");
case -2: return new OutOfMemoryError("Hyperscan was unable to allocate memory");
case -3: return new Exception("The engine was terminated by callback.");
case -4: return new Exception("The pattern compiler failed.");
case -5: return new Exception("The given database was built for a different version of Hyperscan.");
case -6: return new Exception("The given database was built for a different platform.");
case -7: return new Exception("The given database was built for a different mode of operation.");
case -8: return new Exception("A parameter passed to this function was not correctly aligned.");
case -9: return new Exception("The allocator did not return memory suitably aligned for the largest representable data type on this platform.");
case -10: return new Exception("The scratch region was already in use.");
case -11: return new UnsupportedOperationException("Unsupported CPU architecture. At least SSE3 is needed");
case -12: return new Exception("Provided buffer was too small.");
default: return new Exception("Unexpected error: " + hsError);
}
}
示例13: createPositioner
import java.security.InvalidParameterException; //导入依赖的package包/类
@WorkerThread
int createPositioner(PositionerOptions positionerOptions, Positioner.AllowHandleAccess allowHandleAccess) throws InvalidParameterException {
if (allowHandleAccess == null)
throw new NullPointerException("Null access token. Method is intended for internal use by Positioner");
LatLng location = positionerOptions.getPosition();
if (location == null)
throw new InvalidParameterException("PositionerOptions position must be set");
return nativeCreatePositioner(
m_jniEegeoMapApiPtr,
location.latitude,
location.longitude,
positionerOptions.getElevation(),
positionerOptions.getElevationMode().ordinal(),
positionerOptions.getIndoorMapId(),
positionerOptions.getIndoorMapFloorId()
);
}
示例14: processClass
import java.security.InvalidParameterException; //导入依赖的package包/类
private static void processClass(@NotNull PhpClass clazz, @NotNull Set<PhpClass> processed) {
if (clazz.isInterface()) {
throw new InvalidParameterException("Interface shall not be provided");
}
processed.add(clazz);
/* re-delegate interface handling */
for (PhpClass anInterface : clazz.getImplementedInterfaces()) {
processInterface(anInterface, processed);
}
/* handle parent class */
if (null != clazz.getSuperClass()) {
processClass(clazz.getSuperClass(), processed);
}
}
示例15: create
import java.security.InvalidParameterException; //导入依赖的package包/类
@WorkerThread
public int create(PolygonOptions polygonOptions, Polygon.AllowHandleAccess allowHandleAccess) throws InvalidParameterException {
if (allowHandleAccess == null)
throw new NullPointerException("Null access token. Method is intended for internal use by Polygon");
if (polygonOptions.getPoints().size() < 2)
throw new InvalidParameterException("PolygonOptions points must contain at least two elements");
List<LatLng> exteriorPoints = polygonOptions.getPoints();
List<List<LatLng>> holes = polygonOptions.getHoles();
final int[] ringVertexCounts = buildRingVertexCounts(exteriorPoints, holes);
final double[] allPointsDoubleArray = buildPointsArray(exteriorPoints, holes, ringVertexCounts);
return nativeCreatePolygon(
m_jniEegeoMapApiPtr,
polygonOptions.getIndoorMapId(),
polygonOptions.getIndoorFloorId(),
polygonOptions.getElevation(),
polygonOptions.getElevationMode().ordinal(),
allPointsDoubleArray,
ringVertexCounts,
polygonOptions.getFillColor()
);
}