本文整理汇总了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());
}
示例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());
}
示例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));
}
}
示例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);
}
示例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");
}
}
示例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
}
}
示例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());
}
示例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());
}
示例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());
}
示例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){}
}
示例11: testSerializationSelf
import java.util.IllegalFormatFlagsException; //导入依赖的package包/类
/**
* @tests serialization/deserialization.
*/
public void testSerializationSelf() throws Exception {
SerializationTest.verifySelf(new IllegalFormatFlagsException(
"TESTFLAGS"), exComparator);
}
示例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);
}