當前位置: 首頁>>代碼示例>>Java>>正文


Java IllegalArgumentException類代碼示例

本文整理匯總了Java中java.lang.IllegalArgumentException的典型用法代碼示例。如果您正苦於以下問題:Java IllegalArgumentException類的具體用法?Java IllegalArgumentException怎麽用?Java IllegalArgumentException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IllegalArgumentException類屬於java.lang包,在下文中一共展示了IllegalArgumentException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setWkday

import java.lang.IllegalArgumentException; //導入依賴的package包/類
/**
 * Set the wkday member
 * @param w String to set
 * @throws IllegalArgumentException if w is not a valid day.
 */
public void setWkday(String w) throws IllegalArgumentException {
    sipWkDay = w;
    if (sipWkDay.compareToIgnoreCase(MON) == 0) {
        wkday = Calendar.MONDAY;
    } else if (sipWkDay.compareToIgnoreCase(TUE) == 0) {
        wkday = Calendar.TUESDAY;
    } else if (sipWkDay.compareToIgnoreCase(WED) == 0) {
        wkday = Calendar.WEDNESDAY;
    } else if (sipWkDay.compareToIgnoreCase(THU) == 0) {
        wkday = Calendar.THURSDAY;
    } else if (sipWkDay.compareToIgnoreCase(FRI) == 0) {
        wkday = Calendar.FRIDAY;
    } else if (sipWkDay.compareToIgnoreCase(SAT) == 0) {
        wkday = Calendar.SATURDAY;
    } else if (sipWkDay.compareToIgnoreCase(SUN) == 0) {
        wkday = Calendar.SUNDAY;
    } else {
        throw new IllegalArgumentException("Illegal Week day :" + w);
    }
}
 
開發者ID:YunlongYang,項目名稱:LightSIP,代碼行數:26,代碼來源:SIPDate.java

示例2: detachWindow

import java.lang.IllegalArgumentException; //導入依賴的package包/類
/** Stops to track given window (RootPaneContainer).
 */
public boolean detachWindow (RootPaneContainer rpc) {
    logger.entering(getClass().getName(), "detachWindow");

    if (!(rpc instanceof Window)) {
        throw new IllegalArgumentException("Argument must be subclas of java.awt.Window: " + rpc);   //NOI18N
    }

    WeakReference<RootPaneContainer> ww = getWeak(rpc);
    if (ww == null) {
        return false;
    }

    ((Window)rpc).removeWindowListener(this);
    return zOrder.remove(ww);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:ZOrderManager.java

示例3: setMonth

import java.lang.IllegalArgumentException; //導入依賴的package包/類
/**
 * Set the month member
 * @param m String to set.
 * @throws IllegalArgumentException if m is not a valid month
 */
public void setMonth(String m) throws IllegalArgumentException {
    sipMonth = m;
    if (sipMonth.compareToIgnoreCase(JAN) == 0) {
        month = Calendar.JANUARY;
    } else if (sipMonth.compareToIgnoreCase(FEB) == 0) {
        month = Calendar.FEBRUARY;
    } else if (sipMonth.compareToIgnoreCase(MAR) == 0) {
        month = Calendar.MARCH;
    } else if (sipMonth.compareToIgnoreCase(APR) == 0) {
        month = Calendar.APRIL;
    } else if (sipMonth.compareToIgnoreCase(MAY) == 0) {
        month = Calendar.MAY;
    } else if (sipMonth.compareToIgnoreCase(JUN) == 0) {
        month = Calendar.JUNE;
    } else if (sipMonth.compareToIgnoreCase(JUL) == 0) {
        month = Calendar.JULY;
    } else if (sipMonth.compareToIgnoreCase(AUG) == 0) {
        month = Calendar.AUGUST;
    } else if (sipMonth.compareToIgnoreCase(SEP) == 0) {
        month = Calendar.SEPTEMBER;
    } else if (sipMonth.compareToIgnoreCase(OCT) == 0) {
        month = Calendar.OCTOBER;
    } else if (sipMonth.compareToIgnoreCase(NOV) == 0) {
        month = Calendar.NOVEMBER;
    } else if (sipMonth.compareToIgnoreCase(DEC) == 0) {
        month = Calendar.DECEMBER;
    } else {
        throw new IllegalArgumentException("Illegal Month :" + m);
    }
}
 
開發者ID:YunlongYang,項目名稱:LightSIP,代碼行數:36,代碼來源:SIPDate.java

示例4: getProperty

import java.lang.IllegalArgumentException; //導入依賴的package包/類
@Override
public final Property getProperty(String columnName) {
  columnName = QueryBuilder.quoteIfNeeded(columnName);
  switch ((columnName)) {
    case "`wId`":  {
      return wId;
    }
    case "`id`":  {
      return id;
    }
    case "`icon`":  {
      return icon;
    }
    case "`description`":  {
      return description;
    }
    case "`main`":  {
      return main;
    }
    default: {
      throw new IllegalArgumentException("Invalid column name passed. Ensure you are calling the correct table's column");
    }
  }
}
 
開發者ID:QuixomTech,項目名稱:WeatherStream,代碼行數:25,代碼來源:Weather_Table.java

示例5: getProperty

import java.lang.IllegalArgumentException; //導入依賴的package包/類
@Override
public final Property getProperty(String columnName) {
  columnName = QueryBuilder.quoteIfNeeded(columnName);
  switch ((columnName)) {
    case "`id`":  {
      return id;
    }
    case "`message`":  {
      return message;
    }
    case "`cnt`":  {
      return cnt;
    }
    case "`cod`":  {
      return cod;
    }
    case "`dt`":  {
      return dt;
    }
    default: {
      throw new IllegalArgumentException("Invalid column name passed. Ensure you are calling the correct table's column");
    }
  }
}
 
開發者ID:QuixomTech,項目名稱:WeatherStream,代碼行數:25,代碼來源:WeatherForecastData_Table.java

示例6: getProperty

import java.lang.IllegalArgumentException; //導入依賴的package包/類
@Override
public final Property getProperty(String columnName) {
  columnName = QueryBuilder.quoteIfNeeded(columnName);
  switch ((columnName)) {
    case "`id`":  {
      return id;
    }
    case "`dt`":  {
      return dt;
    }
    case "`rainCount`":  {
      return rainCount;
    }
    default: {
      throw new IllegalArgumentException("Invalid column name passed. Ensure you are calling the correct table's column");
    }
  }
}
 
開發者ID:QuixomTech,項目名稱:WeatherStream,代碼行數:19,代碼來源:Rain_Table.java

示例7: getProperty

import java.lang.IllegalArgumentException; //導入依賴的package包/類
@Override
public final Property getProperty(String columnName) {
  columnName = QueryBuilder.quoteIfNeeded(columnName);
  switch ((columnName)) {
    case "`id`":  {
      return id;
    }
    case "`dt`":  {
      return dt;
    }
    case "`dt_txt`":  {
      return dt_txt;
    }
    default: {
      throw new IllegalArgumentException("Invalid column name passed. Ensure you are calling the correct table's column");
    }
  }
}
 
開發者ID:QuixomTech,項目名稱:WeatherStream,代碼行數:19,代碼來源:ForecastList_Table.java

示例8: getProperty

import java.lang.IllegalArgumentException; //導入依賴的package包/類
@Override
public final Property getProperty(String columnName) {
  columnName = QueryBuilder.quoteIfNeeded(columnName);
  switch ((columnName)) {
    case "`id`":  {
      return id;
    }
    case "`speed`":  {
      return speed;
    }
    case "`deg`":  {
      return deg;
    }
    default: {
      throw new IllegalArgumentException("Invalid column name passed. Ensure you are calling the correct table's column");
    }
  }
}
 
開發者ID:QuixomTech,項目名稱:WeatherStream,代碼行數:19,代碼來源:Wind_Table.java

示例9: getProperty

import java.lang.IllegalArgumentException; //導入依賴的package包/類
@Override
public final Property getProperty(String columnName) {
  columnName = QueryBuilder.quoteIfNeeded(columnName);
  switch ((columnName)) {
    case "`id`":  {
      return id;
    }
    case "`lon`":  {
      return lon;
    }
    case "`lat`":  {
      return lat;
    }
    default: {
      throw new IllegalArgumentException("Invalid column name passed. Ensure you are calling the correct table's column");
    }
  }
}
 
開發者ID:QuixomTech,項目名稱:WeatherStream,代碼行數:19,代碼來源:Coord_Table.java

示例10: checkDateTimeCondition

import java.lang.IllegalArgumentException; //導入依賴的package包/類
private boolean checkDateTimeCondition(String op, String targetVal, String value) {
	ValueOperatorType opt = ValueOperatorType.textToValue(op);
	try {
		Date td = DatatypeConverter.parseDateTime(targetVal).getTime();
		Date vd = DatatypeConverter.parseDateTime(value).getTime();
		int result = vd.compareTo(td);

		if (opt == ValueOperatorType.EQUAL_TO)
			return result == 0;
		else if (opt == ValueOperatorType.NOT_EQUAL_TO)
			return result != 0;
		else if (opt == ValueOperatorType.GREATER_THAN)
			return result > 0;
		else if (opt == ValueOperatorType.GREATER_THAN_EQUAL_TO)
			return result >= 0;
		else if (opt == ValueOperatorType.LESS_THAN)
			return result < 0;
		else if (opt == ValueOperatorType.LESS_THEN_EQUAL_TO)
			return result <= 0;			
	} catch (IllegalArgumentException ex) {
		log.warn("illegal datetime format target=" + targetVal+" value="+value);
		return false;
	}
	
	return false;
}
 
開發者ID:dpinney,項目名稱:essence,代碼行數:27,代碼來源:ValueOutOfBoundDetector.java

示例11: getInstance

import java.lang.IllegalArgumentException; //導入依賴的package包/類
public LocationProvider getInstance (Integer locationProvider) {
    LocationProvider provider;
    switch (locationProvider) {
        case Config.ANDROID_DISTANCE_FILTER_PROVIDER:
            provider = new DistanceFilterLocationProvider(context);
            break;
        case Config.ANDROID_ACTIVITY_PROVIDER:
            provider = new ActivityRecognitionLocationProvider(context);
            break;
        default:
            throw new IllegalArgumentException("Provider not found");
    }

    provider.onCreate();
    return provider;
}
 
開發者ID:QuintechDevOps,項目名稱:cordova-plugin-quintech-background-geolocation,代碼行數:17,代碼來源:LocationProviderFactory.java

示例12: getByName

import java.lang.IllegalArgumentException; //導入依賴的package包/類
public static WorldGenerator getByName(String name) {
    WorldGenerator gen = generators.getOrDefault(name, null);

    if (gen == null) {
        try {
            throw new IllegalArgumentException("\"" + name + "\" is not a valid WorldGenerator");
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
            ArmadaCraft.getInstance().shutdown();
        }
    } else {
        return gen;
    }

    return null;
}
 
開發者ID:csnxs,項目名稱:armadacraft,代碼行數:17,代碼來源:WorldGenerator.java

示例13: sort

import java.lang.IllegalArgumentException; //導入依賴的package包/類
/**
 * Sort the integers in the buffer 
 * @param order (as of version 2.9) 
 * it can be either ASCENDING or DESCENDING
 */
public void sort(int order) {
	switch (order) {
	case ASCENDING:
		if (size > 0)
			quickSort_ascending(0, size - 1);
		break;
	case DESCENDING:
		if (size > 0)
			quickSort_descending(0, size - 1);
		break;
	default:
		throw new IllegalArgumentException("Sort type undefined");
	}

}
 
開發者ID:CoolBalance,項目名稱:vtd-xml,代碼行數:21,代碼來源:FastIntBuffer.java

示例14: service

import java.lang.IllegalArgumentException; //導入依賴的package包/類
public void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException, IllegalArgumentException {
    PrintWriter out = response.getWriter();

    long expectedResult = 946684801000L;
    String param = "If-Modified-Since";

    try {
        long result = request.getDateHeader( param );

        if ( result == expectedResult ) {
            out.println( "GetDateHeaderLCaseTest test PASSED" );
        } else {
            out.println( "GetDateHeaderLCaseTest test FAILED <BR>" );
            out.println( "     HttpServletRequest.getDateHeader(" + param + ") returned an incorrect result<BR>" );
            out.println( "     Expected result = " + expectedResult + " <BR>" );
            out.println( "     Actual result = |" + result + "| <BR>" );
        }
    } catch ( java.lang.IllegalArgumentException ex ) {
        out.println( "GetDateHeaderLCaseTest test FAILED <BR>" );
        out.println( "     HttpServletRequest.getDateHeader(" + param + ") Can't convert the sent header value to Date <BR>" );
        out.println( "     HttpServletRequest.getDateHeader(" + param + ") threw IllegalArgumentException exception<BR>" );
        throw ex;
    }
}
 
開發者ID:bboypscmylife,項目名稱:opengse,代碼行數:25,代碼來源:GetDateHeaderLCaseTestServlet.java

示例15: service

import java.lang.IllegalArgumentException; //導入依賴的package包/類
public void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException, IllegalArgumentException {
    PrintWriter out = response.getWriter();

    long expectedResult = 946684801000L;
    String param = "If-Modified-Since";

    try {
        long result = request.getDateHeader( param );

        if ( result == expectedResult ) {
            out.println( "GetDateHeaderTest test PASSED" );
        } else {
            out.println( "GetDateHeaderTest test FAILED <BR>" );
            out.println( "     HttpServletRequest.getDateHeader(" + param + ") returned an incorrect result<BR>" );
            out.println( "     Expected result = " + expectedResult + " <BR>" );
            out.println( "     Actual result = |" + result + "| <BR>" );
        }
    } catch ( java.lang.IllegalArgumentException ex ) {
        out.println( "GetDateHeaderTest test FAILED <BR>" );
        out.println( "     HttpServletRequest.getDateHeader(" + param + ") Can't convert the sent header value to Date <BR>" );
        out.println( "     HttpServletRequest.getDateHeader(" + param + ") threw IllegalArgumentException exception<BR>" );
        throw ex;
    }
}
 
開發者ID:bboypscmylife,項目名稱:opengse,代碼行數:25,代碼來源:GetDateHeaderTestServlet.java


注:本文中的java.lang.IllegalArgumentException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。