当前位置: 首页>>代码示例>>Java>>正文


Java IllegalFormatFlagsException类代码示例

本文整理汇总了Java中java.util.IllegalFormatFlagsException的典型用法代码示例。如果您正苦于以下问题:Java IllegalFormatFlagsException类的具体用法?Java IllegalFormatFlagsException怎么用?Java IllegalFormatFlagsException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IllegalFormatFlagsException类属于java.util包,在下文中一共展示了IllegalFormatFlagsException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkNumeric

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
private void checkNumeric() {
    if (width != -1 && width < 0)
        throw new IllegalFormatWidthException(width);

    if (precision != -1 && precision < 0)
        throw new IllegalFormatPrecisionException(precision);

    // '-' and '0' require a width
    if (width == -1
        && (f.contains(Flags.LEFT_JUSTIFY) || f.contains(Flags.ZERO_PAD)))
        throw new MissingFormatWidthException(toString());

    // bad combination
    if ((f.contains(Flags.PLUS) && f.contains(Flags.LEADING_SPACE))
        || (f.contains(Flags.LEFT_JUSTIFY) && f.contains(Flags.ZERO_PAD)))
        throw new IllegalFormatFlagsException(f.toString());
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:18,代码来源:F3Formatter.java

示例2: checkNumeric

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
private void checkNumeric() {
	if (width != -1 && width < 0)
		throw new IllegalFormatWidthException(width);

	if (precision != -1 && precision < 0)
		throw new IllegalFormatPrecisionException(precision);

	// '-' and '0' require a width
	if (width == -1
			&& (f.contains(Flags.LEFT_JUSTIFY) || f
					.contains(Flags.ZERO_PAD)))
		throw new MissingFormatWidthException(toString());

	// bad combination
	if ((f.contains(Flags.PLUS) && f.contains(Flags.LEADING_SPACE))
			|| (f.contains(Flags.LEFT_JUSTIFY) && f
					.contains(Flags.ZERO_PAD)))
		throw new IllegalFormatFlagsException(f.toString());
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:20,代码来源:FormatSpecifier.java

示例3: checkText

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
private void checkText() {
	if (precision != -1)
		throw new IllegalFormatPrecisionException(precision);
	switch (c) {
	case Conversion.PERCENT_SIGN:
		if (f.valueOf() != Flags.LEFT_JUSTIFY.valueOf()
				&& f.valueOf() != Flags.NONE.valueOf())
			throw new IllegalFormatFlagsException(f.toString());
		// '-' requires a width
		if (width == -1 && f.contains(Flags.LEFT_JUSTIFY))
			throw new MissingFormatWidthException(toString());
		break;
	case Conversion.LINE_SEPARATOR:
		if (width != -1)
			throw new IllegalFormatWidthException(width);
		if (f.valueOf() != Flags.NONE.valueOf())
			throw new IllegalFormatFlagsException(f.toString());
		break;
	default:
           throw new UnknownFormatConversionException(String.valueOf(c));
	}
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:23,代码来源:FormatSpecifier.java

示例4: getConnectInfo

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
/**
 * 从连接配置信息字符串中解析出主机、端口、密码
 *
 * @param ipPortPassword 连接配置信息
 * @return Gedis 初始化参数
 */
private static GedisInitParam getConnectInfo(String ipPortPassword) {
    if (isEmpty(ipPortPassword)) {
        return null;
    }
    Pattern pattern = Pattern.compile(Constants.CONNECT_CONFIG_REG);
    Matcher matcher = pattern.matcher(ipPortPassword);
    if (!matcher.matches() || matcher.groupCount() != 3) {
        throw new IllegalFormatFlagsException("Gedis connection config is not formated as: ip:port?password");
    }
    String ip = matcher.group(1);
    int port = Integer.parseInt(matcher.group(2));
    String password = matcher.group(3);
    return new GedisInitParam(ip, port, password);
}
 
开发者ID:ganpengyu,项目名称:gedis,代码行数:21,代码来源:Gedis.java

示例5: replacePort

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
private String replacePort(String portString,Iterator<Long> portIterator){
	if(portIterator.hasNext()){
		String [] tokens = portString.split(":");
		if(tokens.length > 1){
			return portIterator.next()+":"+tokens[1];
		}else{
			throw new IllegalFormatFlagsException("port mappings in docker-compose file not valid");
		}
	}else{
		throw new NoSuchElementException("Insufficient number of ports allocated");
	}
}
 
开发者ID:mohitsoni,项目名称:compose-executor,代码行数:13,代码来源:DockerRewriteHelper.java

示例6: test_illegalFormatFlagsException

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
/**
 * @tests java.util.IllegalFormatFlagsException#IllegalFormatFlagsException(String)
 */
public void test_illegalFormatFlagsException() {
    try {
        new IllegalFormatFlagsException(null);
        fail("should throw NullPointerException");
    } catch (NullPointerException e) {
        // expected
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:12,代码来源:IllegalFormatFlagsExceptionTest.java

示例7: test_getFlags

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
/**
 * @tests java.util.IllegalFormatFlagsException.getFlags()
 */
public void test_getFlags() {
    String flags = "TESTFLAGS";
    IllegalFormatFlagsException illegalFormatFlagsException = new IllegalFormatFlagsException(
            flags);
    assertEquals(flags, illegalFormatFlagsException.getFlags());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:10,代码来源:IllegalFormatFlagsExceptionTest.java

示例8: test_getMessage

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
/**
 * @tests java.util.IllegalFormatFlagsException.getMessage()
 */
public void test_getMessage() {
    String flags = "TESTFLAGS";
    IllegalFormatFlagsException illegalFormatFlagsException = new IllegalFormatFlagsException(
            flags);
    assertTrue(null != illegalFormatFlagsException.getMessage());

}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:11,代码来源:IllegalFormatFlagsExceptionTest.java

示例9: assertDeserialized

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
public void assertDeserialized(Serializable initial,
        Serializable deserialized) {

    SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
            deserialized);

    IllegalFormatFlagsException initEx = (IllegalFormatFlagsException) initial;
    IllegalFormatFlagsException desrEx = (IllegalFormatFlagsException) deserialized;

    assertEquals("Flags", initEx.getFlags(), desrEx.getFlags());
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:12,代码来源:IllegalFormatFlagsExceptionTest.java

示例10: RootFile

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
RootFile(String path) throws IllegalArgumentException{
    if(path==null) throw new IllegalArgumentException("File path can't be null");
    if(path.length()==0) throw new IllegalArgumentException("File path has zero length");
    if(path.charAt(0)!='/') throw new IllegalArgumentException("File path must start with /");
    if(path.contains("*")) throw new IllegalArgumentException("File path contains * character");

    if(path.charAt(path.length()-1)=='/' && path.length()>1) path = path.substring(0, path.length()-1);

    shell.run(busybox + " ls \"" + path + "\" -d -l; echo ENDOFLS");
    String buffer = getLastLine(out, "ENDOFLS");

    if(buffer.equals("ENDOFLS")){
        if(debug) Log.e("HIJACKER/RootFile", "Couldn't read shell output");
        return;
    }

    //Isolate absolute path and name
    this.name = path.substring(path.lastIndexOf('/') + 1);
    this.absolutePath = path;
    this.parentPath = absolutePath.substring(0, absolutePath.lastIndexOf('/') + 1);

    //Eliminate multiple spaces
    String before = "";
    while(!before.equals(buffer)){
        before = buffer;
        buffer = buffer.replace("  ", " ");
    }

    if(buffer.contains("No such") || buffer.startsWith("ls:")){
        this.isUnknownType = true;
        return;
    }

    exists = true;

    String temp[] = buffer.split(" ");
    //0: type & permissions, 4: size, 5,6,7: last edited date, rest is name
    if(temp[0].length()!=10){
        throw new IllegalFormatFlagsException(temp[0] + " is not how it should be\nbuffer: " + buffer + "\nbuffer before: " + before);
    }
    if(temp[0].charAt(0)=='d'){
        this.isDirectory = true;
    }else if(temp[0].charAt(0)=='-'){
        this.isFile = true;
    }else{
        this.isUnknownType = true;
    }

    try{
        this.length = Long.parseLong(temp[4]);
    }catch(NumberFormatException ignored){}
}
 
开发者ID:chrisk44,项目名称:Hijacker,代码行数:53,代码来源:RootFile.java

示例11: testSerializationSelf

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
/**
 * @tests serialization/deserialization.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new IllegalFormatFlagsException(
            "TESTFLAGS"), exComparator);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:9,代码来源:IllegalFormatFlagsExceptionTest.java

示例12: testSerializationCompatibility

import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new IllegalFormatFlagsException(
            "TESTFLAGS"), exComparator);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:9,代码来源:IllegalFormatFlagsExceptionTest.java


注:本文中的java.util.IllegalFormatFlagsException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。