Search in sources :

Example 6 with InvalidParameterException

use of java.security.InvalidParameterException in project UltimateAndroid by cymcsg.

the class SimpleMonthView method setMonthParams.

public void setMonthParams(HashMap<String, Integer> params) {
    if (!params.containsKey(VIEW_PARAMS_MONTH) && !params.containsKey(VIEW_PARAMS_YEAR)) {
        throw new InvalidParameterException("You must specify month and year for this view");
    }
    setTag(params);
    if (params.containsKey(VIEW_PARAMS_HEIGHT)) {
        mRowHeight = params.get(VIEW_PARAMS_HEIGHT);
        if (mRowHeight < MIN_HEIGHT) {
            mRowHeight = MIN_HEIGHT;
        }
    }
    if (params.containsKey(VIEW_PARAMS_SELECTED_BEGIN_DAY)) {
        mSelectedBeginDay = params.get(VIEW_PARAMS_SELECTED_BEGIN_DAY);
    }
    if (params.containsKey(VIEW_PARAMS_SELECTED_LAST_DAY)) {
        mSelectedLastDay = params.get(VIEW_PARAMS_SELECTED_LAST_DAY);
    }
    if (params.containsKey(VIEW_PARAMS_SELECTED_BEGIN_MONTH)) {
        mSelectedBeginMonth = params.get(VIEW_PARAMS_SELECTED_BEGIN_MONTH);
    }
    if (params.containsKey(VIEW_PARAMS_SELECTED_LAST_MONTH)) {
        mSelectedLastMonth = params.get(VIEW_PARAMS_SELECTED_LAST_MONTH);
    }
    if (params.containsKey(VIEW_PARAMS_SELECTED_BEGIN_YEAR)) {
        mSelectedBeginYear = params.get(VIEW_PARAMS_SELECTED_BEGIN_YEAR);
    }
    if (params.containsKey(VIEW_PARAMS_SELECTED_LAST_YEAR)) {
        mSelectedLastYear = params.get(VIEW_PARAMS_SELECTED_LAST_YEAR);
    }
    mMonth = params.get(VIEW_PARAMS_MONTH);
    mYear = params.get(VIEW_PARAMS_YEAR);
    mHasToday = false;
    mToday = -1;
    mCalendar.set(Calendar.MONTH, mMonth);
    mCalendar.set(Calendar.YEAR, mYear);
    mCalendar.set(Calendar.DAY_OF_MONTH, 1);
    mDayOfWeekStart = mCalendar.get(Calendar.DAY_OF_WEEK);
    if (params.containsKey(VIEW_PARAMS_WEEK_START)) {
        mWeekStart = params.get(VIEW_PARAMS_WEEK_START);
    } else {
        mWeekStart = mCalendar.getFirstDayOfWeek();
    }
    mNumCells = CalendarUtils.getDaysInMonth(mMonth, mYear);
    for (int i = 0; i < mNumCells; i++) {
        final int day = i + 1;
        if (sameDay(day, today)) {
            mHasToday = true;
            mToday = day;
        }
        mIsPrev = prevDay(day, today);
    }
    mNumRows = calculateNumRows();
}
Also used : InvalidParameterException(java.security.InvalidParameterException) Paint(android.graphics.Paint)

Example 7 with InvalidParameterException

use of java.security.InvalidParameterException in project MaterialDateTimePicker by wdullaer.

the class MonthView method setMonthParams.

/**
     * Sets all the parameters for displaying this week. The only required
     * parameter is the week number. Other parameters have a default value and
     * will only update if a new value is included, except for focus month,
     * which will always default to no focus month if no value is passed in. See
     * {@link #VIEW_PARAMS_HEIGHT} for more info on parameters.
     *
     * @param params A map of the new parameters, see
     *            {@link #VIEW_PARAMS_HEIGHT}
     */
public void setMonthParams(HashMap<String, Integer> params) {
    if (!params.containsKey(VIEW_PARAMS_MONTH) && !params.containsKey(VIEW_PARAMS_YEAR)) {
        throw new InvalidParameterException("You must specify month and year for this view");
    }
    setTag(params);
    // We keep the current value for any params not present
    if (params.containsKey(VIEW_PARAMS_HEIGHT)) {
        mRowHeight = params.get(VIEW_PARAMS_HEIGHT);
        if (mRowHeight < MIN_HEIGHT) {
            mRowHeight = MIN_HEIGHT;
        }
    }
    if (params.containsKey(VIEW_PARAMS_SELECTED_DAY)) {
        mSelectedDay = params.get(VIEW_PARAMS_SELECTED_DAY);
    }
    // Allocate space for caching the day numbers and focus values
    mMonth = params.get(VIEW_PARAMS_MONTH);
    mYear = params.get(VIEW_PARAMS_YEAR);
    // Figure out what day today is
    //final Time today = new Time(Time.getCurrentTimezone());
    //today.setToNow();
    final Calendar today = Calendar.getInstance(mController.getTimeZone());
    mHasToday = false;
    mToday = -1;
    mCalendar.set(Calendar.MONTH, mMonth);
    mCalendar.set(Calendar.YEAR, mYear);
    mCalendar.set(Calendar.DAY_OF_MONTH, 1);
    mDayOfWeekStart = mCalendar.get(Calendar.DAY_OF_WEEK);
    if (params.containsKey(VIEW_PARAMS_WEEK_START)) {
        mWeekStart = params.get(VIEW_PARAMS_WEEK_START);
    } else {
        mWeekStart = mCalendar.getFirstDayOfWeek();
    }
    mNumCells = mCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);
    for (int i = 0; i < mNumCells; i++) {
        final int day = i + 1;
        if (sameDay(day, today)) {
            mHasToday = true;
            mToday = day;
        }
    }
    mNumRows = calculateNumRows();
    // Invalidate cached accessibility information.
    mTouchHelper.invalidateRoot();
}
Also used : InvalidParameterException(java.security.InvalidParameterException) Calendar(java.util.Calendar) Paint(android.graphics.Paint)

Example 8 with InvalidParameterException

use of java.security.InvalidParameterException in project robovm by robovm.

the class SecurityTest method test_getProvidersLjava_lang_String.

/**
     * java.security.Security#getProviders(String)
     */
public void test_getProvidersLjava_lang_String() {
    try {
        Security.getProviders("");
        fail("No expected InvalidParameterException");
    } catch (InvalidParameterException e) {
    }
    try {
        Security.getProviders((String) null);
        fail("No expected NullPointerException");
    } catch (NullPointerException e) {
    }
    testGetProviders(Locale.US);
    testGetProviders(new Locale("tr", "TR"));
}
Also used : Locale(java.util.Locale) InvalidParameterException(java.security.InvalidParameterException)

Example 9 with InvalidParameterException

use of java.security.InvalidParameterException in project robovm by robovm.

the class Signature2Test method test_setParameterLjava_lang_StringLjava_lang_Object.

/**
     * java.security.Signature#setParameter(java.lang.String,
     *        java.lang.Object)
     */
@SuppressWarnings("deprecation")
public void test_setParameterLjava_lang_StringLjava_lang_Object() throws Exception {
    Signature sig = Signature.getInstance("DSA");
    try {
        sig.setParameter("r", BigInteger.ONE);
        sig.setParameter("s", BigInteger.ONE);
    } catch (InvalidParameterException e) {
    // Could be that it's an invalid param for the found algorithm
    } catch (UnsupportedOperationException e) {
    // Could be that the operation is not supported
    }
}
Also used : InvalidParameterException(java.security.InvalidParameterException) Signature(java.security.Signature)

Example 10 with InvalidParameterException

use of java.security.InvalidParameterException in project robovm by robovm.

the class KeyPairGenerator1Test method testKeyPairGenerator13.

/**
     * Test for methods: <code>initialize(int keysize)</code>
     * <code>initialize(int keysize, SecureRandom random)</code>
     * <code>initialize(AlgorithmParameterSpec param)</code>
     * <code>initialize(AlgorithmParameterSpec param, SecureRandom random)</code>
     * <code>generateKeyPair()</code>
     * <code>genKeyPair()</code>
     * Assertion: initialize(int ...) throws InvalidParameterException when
     * keysize in incorrect Assertion: initialize(AlgorithmParameterSpec
     * ...)throws UnsupportedOperationException Assertion: generateKeyPair() and
     * genKeyPair() return not null KeyPair Additional class MyKeyPairGenerator2
     * is used
     */
public void testKeyPairGenerator13() {
    int[] keys = { -1, -250, 1, 63, -512, -1024 };
    SecureRandom random = new SecureRandom();
    KeyPairGenerator mKPG = new MyKeyPairGenerator2(null);
    assertEquals("Algorithm must be null", mKPG.getAlgorithm(), MyKeyPairGenerator2.getResAlgorithm());
    assertNull("genKeyPair() must return null", mKPG.genKeyPair());
    assertNull("generateKeyPair() mut return null", mKPG.generateKeyPair());
    for (int i = 0; i < keys.length; i++) {
        try {
            mKPG.initialize(keys[i]);
            fail("InvalidParameterException must be thrown (key: " + Integer.toString(keys[i]) + ")");
        } catch (InvalidParameterException e) {
        }
        try {
            mKPG.initialize(keys[i], random);
            fail("InvalidParameterException must be thrown (key: " + Integer.toString(keys[i]) + ")");
        } catch (InvalidParameterException e) {
        }
    }
    try {
        mKPG.initialize(64);
    } catch (InvalidParameterException e) {
        fail("Unexpected InvalidParameterException was thrown");
    }
    try {
        mKPG.initialize(64, null);
    } catch (InvalidParameterException e) {
        fail("Unexpected InvalidParameterException was thrown");
    }
    try {
        mKPG.initialize(null, random);
    } catch (UnsupportedOperationException e) {
    // on j2se1.4 this exception is not thrown
    } catch (InvalidAlgorithmParameterException e) {
        fail("Unexpected InvalidAlgorithmParameterException was thrown");
    }
}
Also used : MyKeyPairGenerator2(org.apache.harmony.security.tests.support.MyKeyPairGenerator2) InvalidParameterException(java.security.InvalidParameterException) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) SecureRandom(java.security.SecureRandom) KeyPairGenerator(java.security.KeyPairGenerator)

Aggregations

InvalidParameterException (java.security.InvalidParameterException)280 IOException (java.io.IOException)34 ArrayList (java.util.ArrayList)24 ActionEvent (com.cloud.event.ActionEvent)22 SecureRandom (java.security.SecureRandom)19 LoadBalancerVO (com.cloud.network.dao.LoadBalancerVO)18 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)16 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)16 File (java.io.File)16 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)15 FirewallRule (com.cloud.network.rules.FirewallRule)14 DB (com.cloud.utils.db.DB)14 Map (java.util.Map)14 HashMap (java.util.HashMap)12 MalformedURLException (java.net.MalformedURLException)11 Paint (android.graphics.Paint)9 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)8 CommunicationException (com.globalcollect.gateway.sdk.client.android.sdk.exception.CommunicationException)8 HttpURLConnection (java.net.HttpURLConnection)8 Scanner (java.util.Scanner)8