当前位置: 首页>>代码示例>>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;未经允许,请勿转载。