关闭

fix协议封装挑战-数据有效性校验

932人阅读 评论(0) 收藏 举报
分类:

数据校验要校验每个字段还有头和尾。

校验包过数据类型校验,特殊值校验。

数据类型校验统一写,特殊值校验写在每个消息实体里。

数据校验采用递归的方式,减少代码编写难度。

Tag类(类型校验没写完,有些特殊类型暂时没写):

package cs.mina.codec.msg;

import java.util.HashSet;
import java.util.Set;

import cs.mina.exception.InValidDataException;

/*
 *@author(huangxiaoping)
 *@date 2013-10-24
 */
public class Tag {
	private String tagId;
	private String tagValue;
	private String format;
	private boolean must;
	
	public  boolean isTagIdInThisObject(String tagId){
		if(tagId.equals(this.tagId)){
			return true;
		}else {
			return false;
		}
	}
	
	public String encode(){
		if(tagValue==null){
			return "";
		}
		return this.tagId+"="+this.tagValue+BaseMsg.SOH;
	}
	
	public String decode(String input,Set<String> already){
		String myItem=input.substring(0, input.indexOf(BaseMsg.SOH));
		String returnStr=input.substring(input.indexOf(BaseMsg.SOH)+1);
		String [] tagItems=myItem.split("=");
		if(tagItems.length!=2){
			throw new InValidDataException("消息格式错误");
		}
		if(already.contains(tagId)){
			throw new InValidDataException(tagId+"消息已被解析");
		}
		if(this.getTagId().equals(tagItems[0])){
			this.tagValue=tagItems[1];
			already.add(tagItems[0]);
			return returnStr;
		}else{
			throw new InValidDataException("解析错误["+tagId+"-"+tagItems[0]+"]");
		}
	}
	
	public Tag(String tagId,String format,boolean must){
		this.tagId=tagId;
		this.format=format;
		this.must=must;
	}
	
	public void validate(){
		if(must){
			if(tagValue==null){
				throw new InValidDataException(tagId+"的值不可以为空");
			}else{
				if(format==null){
					throw new InValidDataException("format的不可以为空");
				}else{
					if(format.equals("int")){
						try{
							Integer.parseInt(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值不是int类型");
						}
						
					}else if(format.equals("Length")){
						try{
							int value=Integer.parseInt(tagValue);
							if(value<=0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(Length)不是正的int类型");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Length)不是int类型");
						}
					}else if(format.equals("TagNum")){
						try{
							if(tagValue.startsWith("0")){
								throw new InValidDataException(tagId+"-"+tagValue+":TagNum类型不能以0开头");
							}
							int value=Integer.parseInt(tagValue);
							if(value<=0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TagNum)不是正的int类型");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TagNum)不是int类型");
						}
					}else if(format.equals("SeqNum")){
						try{
							int value=Integer.parseInt(tagValue);
							if(value<0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(SeqNum)小于0");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(SeqNum)不是int类型");
						}
					}else if(format.equals("NumInGroup")){
						try{
							int value=Integer.parseInt(tagValue);
							if(value<=0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(NumInGroup)不是正的int类型");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(NumInGroup)不是int类型");
						}
					}else if(format.equals("DayOfMonth")){
						try{
							int value=Integer.parseInt(tagValue);
							if(!(value<=31&&value>=1)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(DayOfMonth)不在1和31之间");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(DayOfMonth)不是int类型");
						}
					}else if(format.equals("float")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(float)不是float类型");
						}
						
					}else if(format.equals("Qty")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Qty)不是float类型");
						}
					}else if(format.equals("Price")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Price)不是float类型");
						}
					}else if(format.equals("PriceOffset")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(PriceOffset)不是float类型");
						}
					}else if(format.equals("Amt")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Amt)不是float类型");
						}
					}else if(format.equals("Percentage")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Percentage)不是float类型");
						}
					}else if(format.equals("char")){
						if(tagValue.length()>1||tagValue.length()==0){
							throw new InValidDataException(tagId+"-"+tagValue+":值(char)长度大于1或等于0");
						}
						if(tagValue.equals(BaseMsg.SOH)){
							throw new InValidDataException(tagId+"-"+tagValue+":值(char)不能是分隔符");
						}
						
					}else if(format.equals("Boolean")){
						if(tagValue.length()>1||tagValue.length()==0){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Boolean)长度大于1或等于0");
						}
						if(!(tagValue.equals("N")||tagValue.equals("Y"))){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Boolean)不是N或Y");
						}
					}else if(format.equals("String")){
						int index=tagValue.indexOf(BaseMsg.SOH);
						if(index!=-1){
							throw new InValidDataException(tagId+"-"+tagValue+":值(String)不能包含分隔符");
						}
					}else if(format.equals("MultipleCharValue")){
						int index=tagValue.indexOf(BaseMsg.SOH);
						if(index!=-1){
							throw new InValidDataException(tagId+"-"+tagValue+":值(String)不能包含分隔符");
						}
						String[] valueArray=tagValue.split(" ");
						for(int i=0;i<valueArray.length;i++){
							String value=valueArray[i];
							if(value.length()>1){
								throw new InValidDataException(tagId+"-"+tagValue+":值(MultipleCharValue)包含String小单元了");
							}
						}
					}else if(format.equals("MultipleStringValue")){
						int index=tagValue.indexOf(BaseMsg.SOH);
						if(index!=-1){
							throw new InValidDataException(tagId+"-"+tagValue+":值(String)不能包含分隔符");
						}
					}else if(format.equals("Country")){
						if(tagValue.length()!=2){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Country)长度错误");
						}
						//TODO country比较
					}else if(format.equals("Currency")){
						if(tagValue.length()!=3){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Currency)长度错误");
						}
						//TODO Currency比较
					}else if(format.equals("Exchange")){		
						//TODO Exchange
					}else if(format.equals("MonthYear")){		
						 if(!(tagValue.length()==6||tagValue.length()==8)){
							 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)长度错误");
						 }
						 String year=tagValue.substring(0, 4);
						 String month=tagValue.substring(4, 6);
						 if(tagValue.length()==8){
							 String weekOrDay=tagValue.substring(6, 8);
							 try{
								int y= Integer.parseInt(year);
								if(y<0){
									throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)年份错误");
								}
							 }catch(Exception e){
								 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)年份错误");
							 }
							 try{
								 int mon= Integer.parseInt(month);
								 if(!(mon>=1&&mon<=12)){
									 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)月份错误");
								 }
							 }catch(Exception e){
								 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)月份错误");
							 }
							 if(weekOrDay.startsWith("w")){
								 try{
									int week= Integer.parseInt(weekOrDay.substring(1));
									if(!(week>=1&&week<=5)){
										throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)星期错误");
									}
								 }catch(Exception e){
									 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)星期错误");
								 }
							 }else{
								 try{
									 int day=Integer.parseInt(weekOrDay);
									 if(!(day>=1&&day<=31)){
										 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)day错误");
									 }
								 }catch(Exception e){
									 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)day错误");
								 }
							 }
							 
						 }else{
							 try{
								 int y= Integer.parseInt(year);
									if(y<0){
										throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)年份错误");
									}
							 }catch(Exception e){
								 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)年份错误");
							 }
							 try{
								 int mon= Integer.parseInt(month);
								 if(!(mon>=1&&mon<=12)){
									 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)月份错误");
								 }
							 }catch(Exception e){
								 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)月份错误");
							 }
							
						 }
					}else if(format.equals("UTCTimestamp")){
						if(tagValue.length()==17){
							String yearStr=tagValue.substring(0, 4);
							String monthStr=tagValue.substring(4, 6);
							String dayStr=tagValue.substring(6, 8);
							String seperator1=tagValue.substring(8, 9);
							String hourStr=tagValue.substring(9, 11);
							String seperaotr2=tagValue.substring(11, 12);
							String minuteStr=tagValue.substring(12, 14);
							String seperator3=tagValue.substring(14, 15);
							String secondStr=tagValue.substring(15, 17);
							if(!seperator1.equals("-")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							if(!seperaotr2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							if(!seperator3.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							try{
								int year=Integer.parseInt(yearStr);
								if(year<0){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)年份错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)年份错误");
							}
							try{
								int month=Integer.parseInt(monthStr);
								if(!(month>=1&&month<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)月份错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)月份错误");
							}
							try{
								int day=Integer.parseInt(dayStr);
								if(!(day>=1&&day<=31)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=60)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)秒钟错误");
							}
							
						}else if(tagValue.length()==21){
							String yearStr=tagValue.substring(0, 4);
							String monthStr=tagValue.substring(4, 6);
							String dayStr=tagValue.substring(6, 8);
							String seperator1=tagValue.substring(8, 9);
							String hourStr=tagValue.substring(9, 11);
							String seperaotr2=tagValue.substring(11, 12);
							String minuteStr=tagValue.substring(12, 14);
							String seperator3=tagValue.substring(14, 15);
							String secondStr=tagValue.substring(15, 17);
							String seperater4=tagValue.substring(17, 18);
							String miliSecondStr=tagValue.substring(18, 21);
							if(!seperator1.equals("-")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							if(!seperaotr2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							if(!seperator3.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							if(!seperater4.equals(".")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							try{
								int year=Integer.parseInt(yearStr);
								if(year<0){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)年份错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)年份错误");
							}
							try{
								int month=Integer.parseInt(monthStr);
								if(!(month>=1&&month<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)月份错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)月份错误");
							}
							try{
								int day=Integer.parseInt(dayStr);
								if(!(day>=1&&day<=31)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=60)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)秒钟错误");
							}
							try{
								int miliSecond=Integer.parseInt(miliSecondStr);
								if(miliSecond<0){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)毫秒错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)毫秒错误");
							}
							
						}else{
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)长度错误");
						}
					}else if(format.equals("UTCTimeOnly")){
						if(tagValue.length()==8){
							String hourStr=tagValue.substring(0, 2);
							String seperator1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String seperator2=tagValue.substring(5, 6);
							String secondStr=tagValue.substring(6, 8);
							if(!seperator1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)时间错误");
							}
							if(!seperator2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=60)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)秒钟错误");
							}
						}else if(tagValue.length()==12){
							String hourStr=tagValue.substring(0, 2);
							String seperator1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String seperator2=tagValue.substring(5, 6);
							String secondStr=tagValue.substring(6, 8);
							String seperator3=tagValue.substring(8,9);
							String milliSecondStr=tagValue.substring(9, 12);
							if(!seperator1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)时间错误");
							}
							if(!seperator2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)时间错误");
							}
							if(!seperator3.equals(".")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=60)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)秒钟错误");
							}
							try{
								int milliSecond=Integer.parseInt(milliSecondStr);
								if(milliSecond<0){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)毫秒错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)毫秒错误");
							}
						}else{
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)长度错误");
						}
					}else if(format.equals("UTCDateOnly")){
						if(tagValue.length()!=8){
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)长度错误");
						}
						String yearStr=tagValue.substring(0, 4);
						String monthStr=tagValue.substring(4, 6);
						String dayStr=tagValue.substring(6, 8);
						try{
							int year=Integer.parseInt(yearStr);
							if(year<0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)年份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)年份错误");
						}
						try{
							int month=Integer.parseInt(monthStr);
							if(!(month>=1&&month<=12)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)月份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)月份错误");
						}
						try{
							int day=Integer.parseInt(dayStr);
							if(!(day>=1&&day<=31)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)日期错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)日期错误");
						}
					}else if(format.equals("LocalMktDate")){
						if(tagValue.length()!=8){
							throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)长度错误");
						}
						String yearStr=tagValue.substring(0, 4);
						String monthStr=tagValue.substring(4, 6);
						String dayStr=tagValue.substring(6, 8);
						try{
							int year=Integer.parseInt(yearStr);
							if(year<0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)年份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)年份错误");
						}
						try{
							int month=Integer.parseInt(monthStr);
							if(!(month>=1&&month<=12)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)月份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)月份错误");
						}
						try{
							int day=Integer.parseInt(dayStr);
							if(!(day>=1&&day<=31)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)日期错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)日期错误");
						}
					}else if(format.equals("TZTimeOnly")){
						if(tagValue.length()==6){
							String hourStr=tagValue.substring(0, 2);
							String seperate1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String Z=tagValue.substring(5, 6);
							if(!seperate1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							if(!Z.equals("Z")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)Z错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
							}
							
						}else if(tagValue.length()==9){
							String hourStr=tagValue.substring(0, 2);
							String seperate1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String seperate2=tagValue.substring(5,6);
							String secondStr=tagValue.substring(6, 8);
							String Z=tagValue.substring(8, 9);
							if(!seperate1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							if(!Z.equals("Z")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)Z错误");
							}
							if(!seperate2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
							}
						}else if(tagValue.length()==8){
							String hourStr=tagValue.substring(0, 2);
							String seperate1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String seperate2=tagValue.substring(5,6);
							String offsetHourStr=tagValue.substring(6, 8);
							
							if(!seperate1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							
							if(!(seperate2.equals("-")||seperate2.equals("+"))){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
							}
							try{
								int offsetHour=Integer.parseInt(offsetHourStr);
								if(!(offsetHour>=1&&offsetHour<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
							}
						}else if(tagValue.length()==11){
							String seperator1=tagValue.substring(5, 6);
							String hourStr=tagValue.substring(0,2);
							String seperator2=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							if(!seperator2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
							}
							if(seperator1.equals(":")){
								String secondStr=tagValue.substring(6, 8);
								String seperator3=tagValue.substring(8,9);
								String offsetHourStr=tagValue.substring(9, 11);
								if(!(seperator3.equals("-")||seperator3.equals("+"))){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
								}
								try{
									int second=Integer.parseInt(secondStr);
									if(!(second>=0&&second<=59)){
										throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
									}
								}catch(Exception e){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
								}
								try{
									int offsetHour=Integer.parseInt(offsetHourStr);
									if(!(offsetHour>=1&&offsetHour<=12)){
										throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
									}
								}catch(Exception e){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
							}else if(seperator1.equals("-")||seperator1.equals("+")){
								String offsetHourStr=tagValue.substring(6,8);
								String seperator3=tagValue.substring(8, 9);
								String offsetMinuteStr=tagValue.substring(9, 11);
								if(!seperator3.equals(":")){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
								}
								try{
									int offsetHour=Integer.parseInt(offsetHourStr);
									if(!(offsetHour>=1&&offsetHour<=12)){
										throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
									}
								}catch(Exception e){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
								try{
									int offsetMinute=Integer.parseInt(offsetMinuteStr);
									if(!(offsetMinute>=0&&offsetMinute<=59)){
										throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
									}
								}catch(Exception e){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
								}
							}else{
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
						}else if(tagValue.length()==14){
							String hourStr=tagValue.substring(0,2);
							String seperator1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String seperator2=tagValue.substring(5, 6);
							String secondStr=tagValue.substring(6, 8);
							String seperator3=tagValue.substring(8,9);
							String offsetHourStr=tagValue.substring(9, 11);
							String seperator4=tagValue.substring(11, 12);
							String offsetMinuteStr=tagValue.substring(12, 14);
							if(!seperator1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							if(!seperator2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							if(!(seperator3.equals("+")||seperator3.equals("-"))){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							if(!seperator4.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
							}
							try{
								int offsetHour=Integer.parseInt(offsetHourStr);
								if(!(offsetHour>=1&&offsetHour<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
							}
							try{
								int offsetMinute=Integer.parseInt(offsetMinuteStr);
								if(!(offsetMinute>=0&&offsetMinute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
							}
						}else {
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)长度错误");
						}
					}else if(format.equals("TZTimestamp")){
						if(tagValue.length()<15){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)长度错误");
						}
						String yearStr=tagValue.substring(0, 4);
						String monthStr=tagValue.substring(4, 6);
						String dayStr=tagValue.substring(6, 8);
						String seperator1=tagValue.substring(8, 9);
						String hourStr=tagValue.substring(9, 11);
						String seperator2=tagValue.substring(11, 12);
						String minuteStr=tagValue.substring(12, 14);
						if(!seperator1.equals("-")){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
						}
						if(!seperator2.equals(":")){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
						}
						try{
							int year=Integer.parseInt(yearStr);
							if(year<0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)年份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)年份错误");
						}
						try{
							int month=Integer.parseInt(monthStr);
							if(!(month>=1&&month<=12)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)月份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)月份错误");
						}
						try{
							int day=Integer.parseInt(dayStr);
							if(!(day>=1&&day<=31)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
						}
						try{
							int hour=Integer.parseInt(hourStr);
							if(!(hour>=0&&hour<=23)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)小时错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)小时错误");
						}
						try{
							int minute=Integer.parseInt(minuteStr);
							if(!(minute>=0&&minute<=59)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)分钟错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)分钟错误");
						}
						
						if(tagValue.length()==15){
							String Z=tagValue.substring(14, 15);
							if(!Z.equals("Z")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)Z错误");
							}
						}else if(tagValue.length()==17){
							String seperator3=tagValue.substring(14, 15);
							String offsetHourStr=tagValue.substring(15, 17);
							if(!(seperator3.equals("-")||seperator3.equals("+"))){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
							}
							try{
								int offsetHour=Integer.parseInt(offsetHourStr);
								if(!(offsetHour>=1&&offsetHour<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
							}
						}else if(tagValue.length()==20){
							String seperator3=tagValue.substring(14, 15);
							String offsetHourStr=tagValue.substring(15, 17);
							String seperator4=tagValue.substring(17, 18);
							String offsetMinuteStr=tagValue.substring(18, 20);
							if(!(seperator3.equals("-")||seperator3.equals("+"))){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
							}
							if(!(seperator4.equals("-")||seperator3.equals(":"))){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
							}
							try{
								int offsetHour=Integer.parseInt(offsetHourStr);
								if(!(offsetHour>=1&&offsetHour<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
							}
							try{
								int offsetMinute=Integer.parseInt(offsetMinuteStr);
								if(!(offsetMinute>=0&&offsetMinute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
							}
						}else {
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)长度错误");
						}
					}else if(format.equals("data")){
						//TODO
					}else if(format.equals("Pattern")){
						
					}else if(format.equals("Tenor")){
						
					}else if(format.equals("Reserved100Plus")){
						
					}else if(format.equals("Reserved1000Plus")){
						
					}else if(format.equals("Reserved4000Plus")){
						
					}else if(format.equals("XMLData")){
						
					}else if(format.equals("Language")){
						
					}else{
						throw new InValidDataException(tagId+"-"+tagValue+"-"+format+":format类型错误");
					}
				}
			}
		}else{
			if(tagValue!=null){
				if(format==null){
					throw new InValidDataException("format的不可以为空");
				}else{
					if(format.equals("int")){
						try{
							Integer.parseInt(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值不是int类型");
						}
						
					}else if(format.equals("Length")){
						try{
							int value=Integer.parseInt(tagValue);
							if(value<=0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(Length)不是正的int类型");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Length)不是int类型");
						}
					}else if(format.equals("TagNum")){
						try{
							if(tagValue.startsWith("0")){
								throw new InValidDataException(tagId+"-"+tagValue+":TagNum类型不能以0开头");
							}
							int value=Integer.parseInt(tagValue);
							if(value<=0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TagNum)不是正的int类型");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TagNum)不是int类型");
						}
					}else if(format.equals("SeqNum")){
						try{
							int value=Integer.parseInt(tagValue);
							if(value<0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(SeqNum)小于0");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(SeqNum)不是int类型");
						}
					}else if(format.equals("NumInGroup")){
						try{
							int value=Integer.parseInt(tagValue);
							if(value<=0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(NumInGroup)不是正的int类型");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(NumInGroup)不是int类型");
						}
					}else if(format.equals("DayOfMonth")){
						try{
							int value=Integer.parseInt(tagValue);
							if(!(value<=31&&value>=1)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(DayOfMonth)不在1和31之间");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(DayOfMonth)不是int类型");
						}
					}else if(format.equals("float")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(float)不是float类型");
						}
						
					}else if(format.equals("Qty")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Qty)不是float类型");
						}
					}else if(format.equals("Price")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Price)不是float类型");
						}
					}else if(format.equals("PriceOffset")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(PriceOffset)不是float类型");
						}
					}else if(format.equals("Amt")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Amt)不是float类型");
						}
					}else if(format.equals("Percentage")){
						try{
							Float.parseFloat(tagValue);
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Percentage)不是float类型");
						}
					}else if(format.equals("char")){
						if(tagValue.length()>1||tagValue.length()==0){
							throw new InValidDataException(tagId+"-"+tagValue+":值(char)长度大于1或等于0");
						}
						if(tagValue.equals(BaseMsg.SOH)){
							throw new InValidDataException(tagId+"-"+tagValue+":值(char)不能是分隔符");
						}
						
					}else if(format.equals("Boolean")){
						if(tagValue.length()>1||tagValue.length()==0){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Boolean)长度大于1或等于0");
						}
						if(!(tagValue.equals("N")||tagValue.equals("Y"))){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Boolean)不是N或Y");
						}
					}else if(format.equals("String")){
						int index=tagValue.indexOf(BaseMsg.SOH);
						if(index!=-1){
							throw new InValidDataException(tagId+"-"+tagValue+":值(String)不能包含分隔符");
						}
					}else if(format.equals("MultipleCharValue")){
						int index=tagValue.indexOf(BaseMsg.SOH);
						if(index!=-1){
							throw new InValidDataException(tagId+"-"+tagValue+":值(String)不能包含分隔符");
						}
						String[] valueArray=tagValue.split(" ");
						for(int i=0;i<valueArray.length;i++){
							String value=valueArray[i];
							if(value.length()>1){
								throw new InValidDataException(tagId+"-"+tagValue+":值(MultipleCharValue)包含String小单元了");
							}
						}
					}else if(format.equals("MultipleStringValue")){
						int index=tagValue.indexOf(BaseMsg.SOH);
						if(index!=-1){
							throw new InValidDataException(tagId+"-"+tagValue+":值(String)不能包含分隔符");
						}
					}else if(format.equals("Country")){
						if(tagValue.length()!=2){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Country)长度错误");
						}
						//TODO country比较
					}else if(format.equals("Currency")){
						if(tagValue.length()!=3){
							throw new InValidDataException(tagId+"-"+tagValue+":值(Currency)长度错误");
						}
						//TODO Currency比较
					}else if(format.equals("Exchange")){		
						//TODO Exchange
					}else if(format.equals("MonthYear")){		
						 if(!(tagValue.length()==6||tagValue.length()==8)){
							 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)长度错误");
						 }
						 String year=tagValue.substring(0, 4);
						 String month=tagValue.substring(4, 6);
						 if(tagValue.length()==8){
							 String weekOrDay=tagValue.substring(6, 8);
							 try{
								int y= Integer.parseInt(year);
								if(y<0){
									throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)年份错误");
								}
							 }catch(Exception e){
								 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)年份错误");
							 }
							 try{
								 int mon= Integer.parseInt(month);
								 if(!(mon>=1&&mon<=12)){
									 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)月份错误");
								 }
							 }catch(Exception e){
								 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)月份错误");
							 }
							 if(weekOrDay.startsWith("w")){
								 try{
									int week= Integer.parseInt(weekOrDay.substring(1));
									if(!(week>=1&&week<=5)){
										throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)星期错误");
									}
								 }catch(Exception e){
									 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)星期错误");
								 }
							 }else{
								 try{
									 int day=Integer.parseInt(weekOrDay);
									 if(!(day>=1&&day<=31)){
										 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)day错误");
									 }
								 }catch(Exception e){
									 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)day错误");
								 }
							 }
							 
						 }else{
							 try{
								 int y= Integer.parseInt(year);
									if(y<0){
										throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)年份错误");
									}
							 }catch(Exception e){
								 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)年份错误");
							 }
							 try{
								 int mon= Integer.parseInt(month);
								 if(!(mon>=1&&mon<=12)){
									 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)月份错误");
								 }
							 }catch(Exception e){
								 throw new InValidDataException(tagId+"-"+tagValue+":值(MonthYear)月份错误");
							 }
							
						 }
					}else if(format.equals("UTCTimestamp")){
						if(tagValue.length()==17){
							String yearStr=tagValue.substring(0, 4);
							String monthStr=tagValue.substring(4, 6);
							String dayStr=tagValue.substring(6, 8);
							String seperator1=tagValue.substring(8, 9);
							String hourStr=tagValue.substring(9, 11);
							String seperaotr2=tagValue.substring(11, 12);
							String minuteStr=tagValue.substring(12, 14);
							String seperator3=tagValue.substring(14, 15);
							String secondStr=tagValue.substring(15, 17);
							if(!seperator1.equals("-")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							if(!seperaotr2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							if(!seperator3.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							try{
								int year=Integer.parseInt(yearStr);
								if(year<0){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)年份错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)年份错误");
							}
							try{
								int month=Integer.parseInt(monthStr);
								if(!(month>=1&&month<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)月份错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)月份错误");
							}
							try{
								int day=Integer.parseInt(dayStr);
								if(!(day>=1&&day<=31)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=60)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)秒钟错误");
							}
							
						}else if(tagValue.length()==21){
							String yearStr=tagValue.substring(0, 4);
							String monthStr=tagValue.substring(4, 6);
							String dayStr=tagValue.substring(6, 8);
							String seperator1=tagValue.substring(8, 9);
							String hourStr=tagValue.substring(9, 11);
							String seperaotr2=tagValue.substring(11, 12);
							String minuteStr=tagValue.substring(12, 14);
							String seperator3=tagValue.substring(14, 15);
							String secondStr=tagValue.substring(15, 17);
							String seperater4=tagValue.substring(17, 18);
							String miliSecondStr=tagValue.substring(18, 21);
							if(!seperator1.equals("-")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							if(!seperaotr2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							if(!seperator3.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							if(!seperater4.equals(".")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							try{
								int year=Integer.parseInt(yearStr);
								if(year<0){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)年份错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)年份错误");
							}
							try{
								int month=Integer.parseInt(monthStr);
								if(!(month>=1&&month<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)月份错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)月份错误");
							}
							try{
								int day=Integer.parseInt(dayStr);
								if(!(day>=1&&day<=31)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)日期错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=60)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)秒钟错误");
							}
							try{
								int miliSecond=Integer.parseInt(miliSecondStr);
								if(miliSecond<0){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)毫秒错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)毫秒错误");
							}
							
						}else{
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimestamp)长度错误");
						}
					}else if(format.equals("UTCTimeOnly")){
						if(tagValue.length()==8){
							String hourStr=tagValue.substring(0, 2);
							String seperator1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String seperator2=tagValue.substring(5, 6);
							String secondStr=tagValue.substring(6, 8);
							if(!seperator1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)时间错误");
							}
							if(!seperator2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=60)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)秒钟错误");
							}
						}else if(tagValue.length()==12){
							String hourStr=tagValue.substring(0, 2);
							String seperator1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String seperator2=tagValue.substring(5, 6);
							String secondStr=tagValue.substring(6, 8);
							String seperator3=tagValue.substring(8,9);
							String milliSecondStr=tagValue.substring(9, 12);
							if(!seperator1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)时间错误");
							}
							if(!seperator2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)时间错误");
							}
							if(!seperator3.equals(".")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=60)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)秒钟错误");
							}
							try{
								int milliSecond=Integer.parseInt(milliSecondStr);
								if(milliSecond<0){
									throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)毫秒错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)毫秒错误");
							}
						}else{
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCTimeOnly)长度错误");
						}
					}else if(format.equals("UTCDateOnly")){
						if(tagValue.length()!=8){
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)长度错误");
						}
						String yearStr=tagValue.substring(0, 4);
						String monthStr=tagValue.substring(4, 6);
						String dayStr=tagValue.substring(6, 8);
						try{
							int year=Integer.parseInt(yearStr);
							if(year<0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)年份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)年份错误");
						}
						try{
							int month=Integer.parseInt(monthStr);
							if(!(month>=1&&month<=12)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)月份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)月份错误");
						}
						try{
							int day=Integer.parseInt(dayStr);
							if(!(day>=1&&day<=31)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)日期错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(UTCDateOnly)日期错误");
						}
					}else if(format.equals("LocalMktDate")){
						if(tagValue.length()!=8){
							throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)长度错误");
						}
						String yearStr=tagValue.substring(0, 4);
						String monthStr=tagValue.substring(4, 6);
						String dayStr=tagValue.substring(6, 8);
						try{
							int year=Integer.parseInt(yearStr);
							if(year<0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)年份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)年份错误");
						}
						try{
							int month=Integer.parseInt(monthStr);
							if(!(month>=1&&month<=12)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)月份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)月份错误");
						}
						try{
							int day=Integer.parseInt(dayStr);
							if(!(day>=1&&day<=31)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)日期错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(LocalMktDate)日期错误");
						}
					}else if(format.equals("TZTimeOnly")){
						if(tagValue.length()==6){
							String hourStr=tagValue.substring(0, 2);
							String seperate1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String Z=tagValue.substring(5, 6);
							if(!seperate1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							if(!Z.equals("Z")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)Z错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
							}
							
						}else if(tagValue.length()==9){
							String hourStr=tagValue.substring(0, 2);
							String seperate1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String seperate2=tagValue.substring(5,6);
							String secondStr=tagValue.substring(6, 8);
							String Z=tagValue.substring(8, 9);
							if(!seperate1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							if(!Z.equals("Z")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)Z错误");
							}
							if(!seperate2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
							}
						}else if(tagValue.length()==8){
							String hourStr=tagValue.substring(0, 2);
							String seperate1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String seperate2=tagValue.substring(5,6);
							String offsetHourStr=tagValue.substring(6, 8);
							
							if(!seperate1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							
							if(!(seperate2.equals("-")||seperate2.equals("+"))){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
							}
							try{
								int offsetHour=Integer.parseInt(offsetHourStr);
								if(!(offsetHour>=1&&offsetHour<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
							}
						}else if(tagValue.length()==11){
							String seperator1=tagValue.substring(5, 6);
							String hourStr=tagValue.substring(0,2);
							String seperator2=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							if(!seperator2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
							}
							if(seperator1.equals(":")){
								String secondStr=tagValue.substring(6, 8);
								String seperator3=tagValue.substring(8,9);
								String offsetHourStr=tagValue.substring(9, 11);
								if(!(seperator3.equals("-")||seperator3.equals("+"))){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
								}
								try{
									int second=Integer.parseInt(secondStr);
									if(!(second>=0&&second<=59)){
										throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
									}
								}catch(Exception e){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
								}
								try{
									int offsetHour=Integer.parseInt(offsetHourStr);
									if(!(offsetHour>=1&&offsetHour<=12)){
										throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
									}
								}catch(Exception e){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
							}else if(seperator1.equals("-")||seperator1.equals("+")){
								String offsetHourStr=tagValue.substring(6,8);
								String seperator3=tagValue.substring(8, 9);
								String offsetMinuteStr=tagValue.substring(9, 11);
								if(!seperator3.equals(":")){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
								}
								try{
									int offsetHour=Integer.parseInt(offsetHourStr);
									if(!(offsetHour>=1&&offsetHour<=12)){
										throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
									}
								}catch(Exception e){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
								try{
									int offsetMinute=Integer.parseInt(offsetMinuteStr);
									if(!(offsetMinute>=0&&offsetMinute<=59)){
										throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
									}
								}catch(Exception e){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
								}
							}else{
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
						}else if(tagValue.length()==14){
							String hourStr=tagValue.substring(0,2);
							String seperator1=tagValue.substring(2, 3);
							String minuteStr=tagValue.substring(3, 5);
							String seperator2=tagValue.substring(5, 6);
							String secondStr=tagValue.substring(6, 8);
							String seperator3=tagValue.substring(8,9);
							String offsetHourStr=tagValue.substring(9, 11);
							String seperator4=tagValue.substring(11, 12);
							String offsetMinuteStr=tagValue.substring(12, 14);
							if(!seperator1.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							if(!seperator2.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							if(!(seperator3.equals("+")||seperator3.equals("-"))){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							if(!seperator4.equals(":")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)时间错误");
							}
							try{
								int hour=Integer.parseInt(hourStr);
								if(!(hour>=0&&hour<=23)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)小时错误");
							}
							try{
								int minute=Integer.parseInt(minuteStr);
								if(!(minute>=0&&minute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)分钟错误");
							}
							try{
								int second=Integer.parseInt(secondStr);
								if(!(second>=0&&second<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)秒钟错误");
							}
							try{
								int offsetHour=Integer.parseInt(offsetHourStr);
								if(!(offsetHour>=1&&offsetHour<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
							}
							try{
								int offsetMinute=Integer.parseInt(offsetMinuteStr);
								if(!(offsetMinute>=0&&offsetMinute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
							}
						}else {
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)长度错误");
						}
					}else if(format.equals("TZTimestamp")){
						if(tagValue.length()<15){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)长度错误");
						}
						String yearStr=tagValue.substring(0, 4);
						String monthStr=tagValue.substring(4, 6);
						String dayStr=tagValue.substring(6, 8);
						String seperator1=tagValue.substring(8, 9);
						String hourStr=tagValue.substring(9, 11);
						String seperator2=tagValue.substring(11, 12);
						String minuteStr=tagValue.substring(12, 14);
						if(!seperator1.equals("-")){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
						}
						if(!seperator2.equals(":")){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
						}
						try{
							int year=Integer.parseInt(yearStr);
							if(year<0){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)年份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)年份错误");
						}
						try{
							int month=Integer.parseInt(monthStr);
							if(!(month>=1&&month<=12)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)月份错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)月份错误");
						}
						try{
							int day=Integer.parseInt(dayStr);
							if(!(day>=1&&day<=31)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
						}
						try{
							int hour=Integer.parseInt(hourStr);
							if(!(hour>=0&&hour<=23)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)小时错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)小时错误");
						}
						try{
							int minute=Integer.parseInt(minuteStr);
							if(!(minute>=0&&minute<=59)){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)分钟错误");
							}
						}catch(Exception e){
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)分钟错误");
						}
						
						if(tagValue.length()==15){
							String Z=tagValue.substring(14, 15);
							if(!Z.equals("Z")){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)Z错误");
							}
						}else if(tagValue.length()==17){
							String seperator3=tagValue.substring(14, 15);
							String offsetHourStr=tagValue.substring(15, 17);
							if(!(seperator3.equals("-")||seperator3.equals("+"))){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
							}
							try{
								int offsetHour=Integer.parseInt(offsetHourStr);
								if(!(offsetHour>=1&&offsetHour<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
							}
						}else if(tagValue.length()==20){
							String seperator3=tagValue.substring(14, 15);
							String offsetHourStr=tagValue.substring(15, 17);
							String seperator4=tagValue.substring(17, 18);
							String offsetMinuteStr=tagValue.substring(18, 20);
							if(!(seperator3.equals("-")||seperator3.equals("+"))){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
							}
							if(!(seperator4.equals("-")||seperator3.equals(":"))){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)日期错误");
							}
							try{
								int offsetHour=Integer.parseInt(offsetHourStr);
								if(!(offsetHour>=1&&offsetHour<=12)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移小时错误");
							}
							try{
								int offsetMinute=Integer.parseInt(offsetMinuteStr);
								if(!(offsetMinute>=0&&offsetMinute<=59)){
									throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
								}
							}catch(Exception e){
								throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimeOnly)偏移分钟错误");
							}
						}else {
							throw new InValidDataException(tagId+"-"+tagValue+":值(TZTimestamp)长度错误");
						}
					}else if(format.equals("data")){
						//TODO
					}else if(format.equals("Pattern")){
						
					}else if(format.equals("Tenor")){
						
					}else if(format.equals("Reserved100Plus")){
						
					}else if(format.equals("Reserved1000Plus")){
						
					}else if(format.equals("Reserved4000Plus")){
						
					}else if(format.equals("XMLData")){
						
					}else if(format.equals("Language")){
						
					}else{
						throw new InValidDataException(tagId+"-"+tagValue+"-"+format+":format类型错误");
					}
				}
			}
			
		}
	}
	
	public String getTagId() {
		return tagId;
	}

	public void setTagId(String tagId) {
		this.tagId = tagId;
	}

	public String getTagValue() {
		return tagValue;
	}

	public void setTagValue(String tagValue) {
		this.tagValue = tagValue;
	}

	public String getFormat() {
		return format;
	}

	public void setFormat(String format) {
		this.format = format;
	}

	public boolean isMust() {
		return must;
	}

	public void setMust(boolean must) {
		this.must = must;
	}

}


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:596223次
    • 积分:8602
    • 等级:
    • 排名:第2214名
    • 原创:289篇
    • 转载:332篇
    • 译文:1篇
    • 评论:122条
    博客专栏
    文章分类
    最新评论