List of usage examples for java.lang Short Short
@Deprecated(since = "9") public Short(String s) throws NumberFormatException
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnToolSetRecHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {// w w w . j a v a 2 s . c om // Common XML Attributes String attrId = null; String attrRevision = null; // ToolSet Attributes String attrName = null; String attrDescr = null; String attrRevisionString = null; String attrIsSupported = null; String attrGenerate = null; String attrToolId0 = null; String attrToolId1 = null; String attrToolId2 = null; String attrToolId3 = null; String attrToolId4 = null; String attrToolId5 = null; String attrToolId6 = null; String attrToolId7 = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("ToolSet"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Descr")) { if (attrDescr != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescr = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RevisionString")) { if (attrRevisionString != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevisionString = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsSupported")) { if (attrIsSupported != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsSupported = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Generate")) { if (attrGenerate != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenerate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId0")) { if (attrToolId0 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId0 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId1")) { if (attrToolId1 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId1 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId2")) { if (attrToolId2 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId2 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId3")) { if (attrToolId3 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId3 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId4")) { if (attrToolId4 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId4 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId5")) { if (attrToolId5 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId5 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId6")) { if (attrToolId6 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId6 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId7")) { if (attrToolId7 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId7 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsSupported == null) || (attrIsSupported.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "IsSupported"); } if ((attrGenerate == null) || (attrGenerate.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Generate"); } if ((attrToolId0 == null) || (attrToolId0.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolId0"); } // Save named attributes to context CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext(); // Convert string attributes to native Java types short natId = Short.parseShort(attrId); String natName = attrName; String natDescr = attrDescr; String natRevisionString = attrRevisionString; boolean natIsSupported; if (attrIsSupported.equals("true") || attrIsSupported.equals("yes") || attrIsSupported.equals("1")) { natIsSupported = true; } else if (attrIsSupported.equals("false") || attrIsSupported.equals("no") || attrIsSupported.equals("0")) { natIsSupported = false; } else { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Unexpected IsSupported value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsSupported + "\""); } boolean natGenerate; if (attrGenerate.equals("true") || attrGenerate.equals("yes") || attrGenerate.equals("1")) { natGenerate = true; } else if (attrGenerate.equals("false") || attrGenerate.equals("no") || attrGenerate.equals("0")) { natGenerate = false; } else { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Unexpected Generate value, must be one of true, false, yes, no, 1, or 0, not \"" + attrGenerate + "\""); } short natToolId0 = Short.parseShort(attrToolId0); Short natToolId1; if ((attrToolId1 == null) || (attrToolId1.length() <= 0)) { natToolId1 = null; } else { natToolId1 = new Short(Short.parseShort(attrToolId1)); } Short natToolId2; if ((attrToolId2 == null) || (attrToolId2.length() <= 0)) { natToolId2 = null; } else { natToolId2 = new Short(Short.parseShort(attrToolId2)); } Short natToolId3; if ((attrToolId3 == null) || (attrToolId3.length() <= 0)) { natToolId3 = null; } else { natToolId3 = new Short(Short.parseShort(attrToolId3)); } Short natToolId4; if ((attrToolId4 == null) || (attrToolId4.length() <= 0)) { natToolId4 = null; } else { natToolId4 = new Short(Short.parseShort(attrToolId4)); } Short natToolId5; if ((attrToolId5 == null) || (attrToolId5.length() <= 0)) { natToolId5 = null; } else { natToolId5 = new Short(Short.parseShort(attrToolId5)); } Short natToolId6; if ((attrToolId6 == null) || (attrToolId6.length() <= 0)) { natToolId6 = null; } else { natToolId6 = new Short(Short.parseShort(attrToolId6)); } Short natToolId7; if ((attrToolId7 == null) || (attrToolId7.length() <= 0)) { natToolId7 = null; } else { natToolId7 = new Short(Short.parseShort(attrToolId7)); } int natRevision = Integer.parseInt(attrRevision); // Get the parent context CFLibXmlCoreContext parentContext = curContext.getPrevContext(); // Instantiate a buffer for the parsed information ICFGenKbToolSetObj obj = schemaObj.getToolSetTableObj().newInstance(); CFGenKbToolSetBuff dataBuff = obj.getToolSetBuff(); dataBuff.setRequiredId(natId); dataBuff.setRequiredName(natName); dataBuff.setOptionalDescr(natDescr); dataBuff.setOptionalRevisionString(natRevisionString); dataBuff.setRequiredIsSupported(natIsSupported); dataBuff.setRequiredGenerate(natGenerate); dataBuff.setRequiredToolId0(natToolId0); dataBuff.setOptionalToolId1(natToolId1); dataBuff.setOptionalToolId2(natToolId2); dataBuff.setOptionalToolId3(natToolId3); dataBuff.setOptionalToolId4(natToolId4); dataBuff.setOptionalToolId5(natToolId5); dataBuff.setOptionalToolId6(natToolId6); dataBuff.setOptionalToolId7(natToolId7); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); SortedMap<CFGenKbToolSetPKey, ICFGenKbToolSetObj> sortedMap = (SortedMap<CFGenKbToolSetPKey, ICFGenKbToolSetObj>) xmsgRspnHandler .getSortedMapOfObjects(); ICFGenKbToolSetObj realized = (ICFGenKbToolSetObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); if (sortedMap != null) { sortedMap.put(realized.getPKey(), realized); } } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:gedi.util.FileUtils.java
public static <T> T read(BinaryReader in) throws IOException, ClassNotFoundException { String clsName = in.getString(); if (clsName.length() == 1) { switch (clsName) { case "A": return (T) in.getString(); case "B": return (T) new Byte(in.get()); case "S": return (T) new Short(in.getShort()); case "I": return (T) new Integer(in.getInt()); case "L": return (T) new Long(in.getLong()); case "F": return (T) new Float(in.getFloat()); case "D": return (T) new Double(in.getDouble()); }//from ww w . java 2 s . c o m } Class<T> cls = (Class<T>) Class.forName(clsName); if (BinarySerializable.class.isAssignableFrom(cls)) { try { T re = cls.newInstance(); ((BinarySerializable) re).deserialize(in); return re; } catch (InstantiationException | IllegalAccessException e) { throw new IOException("Could not instantiate " + cls.getName(), e); } } else throw new RuntimeException("Only BinarySerializables can be deserialized right now!"); }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnToolSetLockedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from www .j a va 2s . c om // Common XML Attributes String attrId = null; String attrRevision = null; // ToolSet Attributes String attrName = null; String attrDescr = null; String attrRevisionString = null; String attrIsSupported = null; String attrGenerate = null; String attrToolId0 = null; String attrToolId1 = null; String attrToolId2 = null; String attrToolId3 = null; String attrToolId4 = null; String attrToolId5 = null; String attrToolId6 = null; String attrToolId7 = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnToolSetLocked"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Descr")) { if (attrDescr != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescr = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RevisionString")) { if (attrRevisionString != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevisionString = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsSupported")) { if (attrIsSupported != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsSupported = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Generate")) { if (attrGenerate != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenerate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId0")) { if (attrToolId0 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId0 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId1")) { if (attrToolId1 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId1 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId2")) { if (attrToolId2 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId2 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId3")) { if (attrToolId3 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId3 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId4")) { if (attrToolId4 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId4 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId5")) { if (attrToolId5 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId5 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId6")) { if (attrToolId6 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId6 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId7")) { if (attrToolId7 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId7 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsSupported == null) || (attrIsSupported.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "IsSupported"); } if ((attrGenerate == null) || (attrGenerate.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Generate"); } if ((attrToolId0 == null) || (attrToolId0.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolId0"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types short natId = Short.parseShort(attrId); String natName = attrName; String natDescr = attrDescr; String natRevisionString = attrRevisionString; boolean natIsSupported; if (attrIsSupported.equals("true") || attrIsSupported.equals("yes") || attrIsSupported.equals("1")) { natIsSupported = true; } else if (attrIsSupported.equals("false") || attrIsSupported.equals("no") || attrIsSupported.equals("0")) { natIsSupported = false; } else { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Unexpected IsSupported value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsSupported + "\""); } boolean natGenerate; if (attrGenerate.equals("true") || attrGenerate.equals("yes") || attrGenerate.equals("1")) { natGenerate = true; } else if (attrGenerate.equals("false") || attrGenerate.equals("no") || attrGenerate.equals("0")) { natGenerate = false; } else { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Unexpected Generate value, must be one of true, false, yes, no, 1, or 0, not \"" + attrGenerate + "\""); } short natToolId0 = Short.parseShort(attrToolId0); Short natToolId1; if ((attrToolId1 == null) || (attrToolId1.length() <= 0)) { natToolId1 = null; } else { natToolId1 = new Short(Short.parseShort(attrToolId1)); } Short natToolId2; if ((attrToolId2 == null) || (attrToolId2.length() <= 0)) { natToolId2 = null; } else { natToolId2 = new Short(Short.parseShort(attrToolId2)); } Short natToolId3; if ((attrToolId3 == null) || (attrToolId3.length() <= 0)) { natToolId3 = null; } else { natToolId3 = new Short(Short.parseShort(attrToolId3)); } Short natToolId4; if ((attrToolId4 == null) || (attrToolId4.length() <= 0)) { natToolId4 = null; } else { natToolId4 = new Short(Short.parseShort(attrToolId4)); } Short natToolId5; if ((attrToolId5 == null) || (attrToolId5.length() <= 0)) { natToolId5 = null; } else { natToolId5 = new Short(Short.parseShort(attrToolId5)); } Short natToolId6; if ((attrToolId6 == null) || (attrToolId6.length() <= 0)) { natToolId6 = null; } else { natToolId6 = new Short(Short.parseShort(attrToolId6)); } Short natToolId7; if ((attrToolId7 == null) || (attrToolId7.length() <= 0)) { natToolId7 = null; } else { natToolId7 = new Short(Short.parseShort(attrToolId7)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbToolSetObj obj = schemaObj.getToolSetTableObj().newInstance(); CFGenKbToolSetBuff dataBuff = obj.getToolSetBuff(); dataBuff.setRequiredId(natId); dataBuff.setRequiredName(natName); dataBuff.setOptionalDescr(natDescr); dataBuff.setOptionalRevisionString(natRevisionString); dataBuff.setRequiredIsSupported(natIsSupported); dataBuff.setRequiredGenerate(natGenerate); dataBuff.setRequiredToolId0(natToolId0); dataBuff.setOptionalToolId1(natToolId1); dataBuff.setOptionalToolId2(natToolId2); dataBuff.setOptionalToolId3(natToolId3); dataBuff.setOptionalToolId4(natToolId4); dataBuff.setOptionalToolId5(natToolId5); dataBuff.setOptionalToolId6(natToolId6); dataBuff.setOptionalToolId7(natToolId7); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbToolSetObj realized = (ICFGenKbToolSetObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnToolSetCreatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from w ww . j a va 2 s.co m // Common XML Attributes String attrId = null; String attrRevision = null; // ToolSet Attributes String attrName = null; String attrDescr = null; String attrRevisionString = null; String attrIsSupported = null; String attrGenerate = null; String attrToolId0 = null; String attrToolId1 = null; String attrToolId2 = null; String attrToolId3 = null; String attrToolId4 = null; String attrToolId5 = null; String attrToolId6 = null; String attrToolId7 = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnToolSetCreated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Descr")) { if (attrDescr != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescr = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RevisionString")) { if (attrRevisionString != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevisionString = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsSupported")) { if (attrIsSupported != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsSupported = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Generate")) { if (attrGenerate != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenerate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId0")) { if (attrToolId0 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId0 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId1")) { if (attrToolId1 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId1 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId2")) { if (attrToolId2 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId2 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId3")) { if (attrToolId3 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId3 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId4")) { if (attrToolId4 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId4 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId5")) { if (attrToolId5 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId5 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId6")) { if (attrToolId6 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId6 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId7")) { if (attrToolId7 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId7 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsSupported == null) || (attrIsSupported.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "IsSupported"); } if ((attrGenerate == null) || (attrGenerate.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Generate"); } if ((attrToolId0 == null) || (attrToolId0.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolId0"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types short natId = Short.parseShort(attrId); String natName = attrName; String natDescr = attrDescr; String natRevisionString = attrRevisionString; boolean natIsSupported; if (attrIsSupported.equals("true") || attrIsSupported.equals("yes") || attrIsSupported.equals("1")) { natIsSupported = true; } else if (attrIsSupported.equals("false") || attrIsSupported.equals("no") || attrIsSupported.equals("0")) { natIsSupported = false; } else { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Unexpected IsSupported value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsSupported + "\""); } boolean natGenerate; if (attrGenerate.equals("true") || attrGenerate.equals("yes") || attrGenerate.equals("1")) { natGenerate = true; } else if (attrGenerate.equals("false") || attrGenerate.equals("no") || attrGenerate.equals("0")) { natGenerate = false; } else { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Unexpected Generate value, must be one of true, false, yes, no, 1, or 0, not \"" + attrGenerate + "\""); } short natToolId0 = Short.parseShort(attrToolId0); Short natToolId1; if ((attrToolId1 == null) || (attrToolId1.length() <= 0)) { natToolId1 = null; } else { natToolId1 = new Short(Short.parseShort(attrToolId1)); } Short natToolId2; if ((attrToolId2 == null) || (attrToolId2.length() <= 0)) { natToolId2 = null; } else { natToolId2 = new Short(Short.parseShort(attrToolId2)); } Short natToolId3; if ((attrToolId3 == null) || (attrToolId3.length() <= 0)) { natToolId3 = null; } else { natToolId3 = new Short(Short.parseShort(attrToolId3)); } Short natToolId4; if ((attrToolId4 == null) || (attrToolId4.length() <= 0)) { natToolId4 = null; } else { natToolId4 = new Short(Short.parseShort(attrToolId4)); } Short natToolId5; if ((attrToolId5 == null) || (attrToolId5.length() <= 0)) { natToolId5 = null; } else { natToolId5 = new Short(Short.parseShort(attrToolId5)); } Short natToolId6; if ((attrToolId6 == null) || (attrToolId6.length() <= 0)) { natToolId6 = null; } else { natToolId6 = new Short(Short.parseShort(attrToolId6)); } Short natToolId7; if ((attrToolId7 == null) || (attrToolId7.length() <= 0)) { natToolId7 = null; } else { natToolId7 = new Short(Short.parseShort(attrToolId7)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbToolSetObj obj = schemaObj.getToolSetTableObj().newInstance(); CFGenKbToolSetBuff dataBuff = obj.getToolSetBuff(); dataBuff.setRequiredId(natId); dataBuff.setRequiredName(natName); dataBuff.setOptionalDescr(natDescr); dataBuff.setOptionalRevisionString(natRevisionString); dataBuff.setRequiredIsSupported(natIsSupported); dataBuff.setRequiredGenerate(natGenerate); dataBuff.setRequiredToolId0(natToolId0); dataBuff.setOptionalToolId1(natToolId1); dataBuff.setOptionalToolId2(natToolId2); dataBuff.setOptionalToolId3(natToolId3); dataBuff.setOptionalToolId4(natToolId4); dataBuff.setOptionalToolId5(natToolId5); dataBuff.setOptionalToolId6(natToolId6); dataBuff.setOptionalToolId7(natToolId7); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbToolSetObj realized = (ICFGenKbToolSetObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnToolSetUpdatedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from ww w . ja v a 2 s. c o m*/ // Common XML Attributes String attrId = null; String attrRevision = null; // ToolSet Attributes String attrName = null; String attrDescr = null; String attrRevisionString = null; String attrIsSupported = null; String attrGenerate = null; String attrToolId0 = null; String attrToolId1 = null; String attrToolId2 = null; String attrToolId3 = null; String attrToolId4 = null; String attrToolId5 = null; String attrToolId6 = null; String attrToolId7 = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnToolSetUpdated"); CFGenKbXMsgRspnHandler xmsgRspnHandler = (CFGenKbXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Descr")) { if (attrDescr != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrDescr = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RevisionString")) { if (attrRevisionString != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevisionString = attrs.getValue(idxAttr); } else if (attrLocalName.equals("IsSupported")) { if (attrIsSupported != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrIsSupported = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Generate")) { if (attrGenerate != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenerate = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId0")) { if (attrToolId0 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId0 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId1")) { if (attrToolId1 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId1 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId2")) { if (attrToolId2 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId2 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId3")) { if (attrToolId3 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId3 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId4")) { if (attrToolId4 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId4 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId5")) { if (attrToolId5 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId5 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId6")) { if (attrToolId6 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId6 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolId7")) { if (attrToolId7 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolId7 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrId == null) || (attrId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Id"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrIsSupported == null) || (attrIsSupported.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "IsSupported"); } if ((attrGenerate == null) || (attrGenerate.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Generate"); } if ((attrToolId0 == null) || (attrToolId0.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolId0"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types short natId = Short.parseShort(attrId); String natName = attrName; String natDescr = attrDescr; String natRevisionString = attrRevisionString; boolean natIsSupported; if (attrIsSupported.equals("true") || attrIsSupported.equals("yes") || attrIsSupported.equals("1")) { natIsSupported = true; } else if (attrIsSupported.equals("false") || attrIsSupported.equals("no") || attrIsSupported.equals("0")) { natIsSupported = false; } else { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Unexpected IsSupported value, must be one of true, false, yes, no, 1, or 0, not \"" + attrIsSupported + "\""); } boolean natGenerate; if (attrGenerate.equals("true") || attrGenerate.equals("yes") || attrGenerate.equals("1")) { natGenerate = true; } else if (attrGenerate.equals("false") || attrGenerate.equals("no") || attrGenerate.equals("0")) { natGenerate = false; } else { throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName, "Unexpected Generate value, must be one of true, false, yes, no, 1, or 0, not \"" + attrGenerate + "\""); } short natToolId0 = Short.parseShort(attrToolId0); Short natToolId1; if ((attrToolId1 == null) || (attrToolId1.length() <= 0)) { natToolId1 = null; } else { natToolId1 = new Short(Short.parseShort(attrToolId1)); } Short natToolId2; if ((attrToolId2 == null) || (attrToolId2.length() <= 0)) { natToolId2 = null; } else { natToolId2 = new Short(Short.parseShort(attrToolId2)); } Short natToolId3; if ((attrToolId3 == null) || (attrToolId3.length() <= 0)) { natToolId3 = null; } else { natToolId3 = new Short(Short.parseShort(attrToolId3)); } Short natToolId4; if ((attrToolId4 == null) || (attrToolId4.length() <= 0)) { natToolId4 = null; } else { natToolId4 = new Short(Short.parseShort(attrToolId4)); } Short natToolId5; if ((attrToolId5 == null) || (attrToolId5.length() <= 0)) { natToolId5 = null; } else { natToolId5 = new Short(Short.parseShort(attrToolId5)); } Short natToolId6; if ((attrToolId6 == null) || (attrToolId6.length() <= 0)) { natToolId6 = null; } else { natToolId6 = new Short(Short.parseShort(attrToolId6)); } Short natToolId7; if ((attrToolId7 == null) || (attrToolId7.length() <= 0)) { natToolId7 = null; } else { natToolId7 = new Short(Short.parseShort(attrToolId7)); } int natRevision = Integer.parseInt(attrRevision); // Instantiate a buffer for the parsed information ICFGenKbToolSetObj obj = schemaObj.getToolSetTableObj().newInstance(); CFGenKbToolSetBuff dataBuff = obj.getToolSetBuff(); dataBuff.setRequiredId(natId); dataBuff.setRequiredName(natName); dataBuff.setOptionalDescr(natDescr); dataBuff.setOptionalRevisionString(natRevisionString); dataBuff.setRequiredIsSupported(natIsSupported); dataBuff.setRequiredGenerate(natGenerate); dataBuff.setRequiredToolId0(natToolId0); dataBuff.setOptionalToolId1(natToolId1); dataBuff.setOptionalToolId2(natToolId2); dataBuff.setOptionalToolId3(natToolId3); dataBuff.setOptionalToolId4(natToolId4); dataBuff.setOptionalToolId5(natToolId5); dataBuff.setOptionalToolId6(natToolId6); dataBuff.setOptionalToolId7(natToolId7); dataBuff.setRequiredRevision(natRevision); obj.copyBuffToPKey(); ICFGenKbToolSetObj realized = (ICFGenKbToolSetObj) obj.realize(); xmsgRspnHandler.setLastObjectProcessed(realized); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstGenTruncUpdateHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*w w w .ja va 2 s. c om*/ // Common XML Attributes String attrId = null; String attrRevision = null; // GenItem Attributes String attrTenantId = null; String attrCartridgeId = null; String attrItemId = null; String attrRuleTypeId = null; String attrName = null; String attrToolSetId = null; String attrScopeDefId = null; String attrGenDefId = null; String attrGelExecutableId = null; // GenRule Attributes String attrBody = null; // GenTrunc Attributes String attrTruncateAt = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstGenTruncUpdate"); CFGenKbXMsgRqstHandler xmsgRqstHandler = (CFGenKbXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFGenKbSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CartridgeId")) { if (attrCartridgeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCartridgeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ItemId")) { if (attrItemId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrItemId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("RuleTypeId")) { if (attrRuleTypeId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRuleTypeId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Name")) { if (attrName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ToolSetId")) { if (attrToolSetId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrToolSetId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ScopeDefId")) { if (attrScopeDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrScopeDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GenDefId")) { if (attrGenDefId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGenDefId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("GelExecutableId")) { if (attrGelExecutableId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrGelExecutableId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Body")) { if (attrBody != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrBody = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TruncateAt")) { if (attrTruncateAt != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTruncateAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrCartridgeId == null) || (attrCartridgeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CartridgeId"); } if ((attrItemId == null) || (attrItemId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ItemId"); } if ((attrRuleTypeId == null) || (attrRuleTypeId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "RuleTypeId"); } if (attrName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Name"); } if ((attrToolSetId == null) || (attrToolSetId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ToolSetId"); } if ((attrGenDefId == null) || (attrGenDefId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "GenDefId"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } if (attrBody == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Body"); } if ((attrTruncateAt == null) || (attrTruncateAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TruncateAt"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Instantiate a PKey buffer for the parsed information CFGenKbGenItemPKey pkey = schemaObj.getBackingStore().getFactoryGenItem().newPKey(); long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); long natCartridgeId; natCartridgeId = Long.parseLong(attrCartridgeId); pkey.setRequiredCartridgeId(natCartridgeId); int natItemId; natItemId = Integer.parseInt(attrItemId); pkey.setRequiredItemId(natItemId); // Read the instance ICFGenKbGenTruncObj origBuff = schemaObj.getGenTruncTableObj().readGenTrunc(pkey); if (origBuff == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getGenTruncTableObj().readGenTrunc()"); } else { // Edit the instance ICFGenKbGenTruncEditObj editBuff = (ICFGenKbGenTruncEditObj) origBuff.beginEdit(); CFGenKbGenTruncBuff dataBuff = editBuff.getGenTruncBuff(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. short natRuleTypeId = Short.parseShort(attrRuleTypeId); dataBuff.setRequiredRuleTypeId(natRuleTypeId); String natName = attrName; dataBuff.setRequiredName(natName); short natToolSetId = Short.parseShort(attrToolSetId); dataBuff.setRequiredToolSetId(natToolSetId); Short natScopeDefId; if ((attrScopeDefId == null) || (attrScopeDefId.length() <= 0)) { natScopeDefId = null; } else { natScopeDefId = new Short(Short.parseShort(attrScopeDefId)); } dataBuff.setOptionalScopeDefId(natScopeDefId); short natGenDefId = Short.parseShort(attrGenDefId); dataBuff.setRequiredGenDefId(natGenDefId); Integer natGelExecutableId; if ((attrGelExecutableId == null) || (attrGelExecutableId.length() <= 0)) { natGelExecutableId = null; } else { natGelExecutableId = new Integer(Integer.parseInt(attrGelExecutableId)); } dataBuff.setOptionalGelExecutableId(natGelExecutableId); int natRevision = Integer.parseInt(attrRevision); dataBuff.setRequiredRevision(natRevision); String natBody = attrBody; dataBuff.setRequiredBody(natBody); int natTruncateAt = Integer.parseInt(attrTruncateAt); dataBuff.setRequiredTruncateAt(natTruncateAt); // Attempt the update editBuff.update(); editBuff.endEdit(); String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgGenTruncMessageFormatter.formatGenTruncRspnUpdated("\n\t\t\t", origBuff.getGenTruncBuff()) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); ((CFGenKbXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }
From source file:Unsigned.java
/** * Parse a binary number into a Number object. If up to 8 bits are parsed, * returns a Byte. If more than 8 and up to 16 bits are parsed, return a * Short. If more than 16 and up to 32 bits are parsed, return an Integer. * If more than 32 and up to 64 bits are parsed, return a Long. * //from w ww . j a v a2 s . co m * @param text * a binary number * @param parsePosition * position to start parsing from * @return return an integer form of Number object if parse is successful; * <CODE>null</CODE> otherwise * * @since 1.0 */ public Number parse(String text, ParsePosition parsePosition) { boolean skipWhitespace = true; int startIndex, bits; // remove whitespace StringCharacterIterator iter = new StringCharacterIterator(text, parsePosition.getIndex()); for (char c = iter.current(); c != CharacterIterator.DONE; c = iter.next()) { if (skipWhitespace && Character.isWhitespace(c)) { // skip whitespace continue; } } parsePosition.setIndex(iter.getIndex()); startIndex = parsePosition.getIndex(); Number result = (Number) parseObject(text, parsePosition); if (result == null) { return (result); } bits = parsePosition.getIndex() - startIndex; if (bits <= 8) { result = new Byte(result.byteValue()); } else if (bits <= 16) { result = new Short(result.shortValue()); } else if (bits <= 32) { result = new Integer(result.intValue()); } else if (bits <= 64) { result = new Long(result.longValue()); } return (result); }
From source file:com.examples.with.different.packagename.testcarver.NumberConverter.java
/** * Default String to Number conversion.//from ww w .ja v a2 s. c o m * <p> * This method handles conversion from a String to the following types: * <ul> * <li><code>java.lang.Byte</code></li> * <li><code>java.lang.Short</code></li> * <li><code>java.lang.Integer</code></li> * <li><code>java.lang.Long</code></li> * <li><code>java.lang.Float</code></li> * <li><code>java.lang.Double</code></li> * <li><code>java.math.BigDecimal</code></li> * <li><code>java.math.BigInteger</code></li> * </ul> * @param sourceType The type being converted from * @param targetType The Number type to convert to * @param value The String value to convert. * * @return The converted Number value. */ private Number toNumber(Class sourceType, Class targetType, String value) { // Byte if (targetType.equals(Byte.class)) { return new Byte(value); } // Short if (targetType.equals(Short.class)) { return new Short(value); } // Integer if (targetType.equals(Integer.class)) { return new Integer(value); } // Long if (targetType.equals(Long.class)) { return new Long(value); } // Float if (targetType.equals(Float.class)) { return new Float(value); } // Double if (targetType.equals(Double.class)) { return new Double(value); } // BigDecimal if (targetType.equals(BigDecimal.class)) { return new BigDecimal(value); } // BigInteger if (targetType.equals(BigInteger.class)) { return new BigInteger(value); } String msg = toString(getClass()) + " cannot handle conversion from '" + toString(sourceType) + "' to '" + toString(targetType) + "'"; throw new ConversionException(msg); }
From source file:net.sf.jrf.domain.PersistentObjectDynaProperty.java
/** Gets default value. * @return default value./* w w w .j av a2s .c o m*/ */ public Object getDefaultValue() { if (defaultValue != null) return this.defaultValue; Class cls = getType(); if (primitiveWrapperClass != null) { if (cls.equals(Boolean.TYPE)) return new Boolean(false); else if (cls.equals(Byte.TYPE)) return new Byte((byte) 0); else if (cls.equals(Character.TYPE)) return new Character((char) 0); else if (cls.equals(Double.TYPE)) return new Double((double) 0); else if (cls.equals(Float.TYPE)) return new Float((float) 0); else if (cls.equals(Integer.TYPE)) return new Integer((int) 0); else if (cls.equals(Long.TYPE)) return new Long((long) 0); else if (cls.equals(Short.TYPE)) return new Short((short) 0); else return null; } else return null; }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRqstHandler.CFAccXMsgRqstContactUpdateHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/* w w w .j a v a 2 s .co m*/ // Common XML Attributes String attrId = null; String attrRevision = null; // Contact Attributes String attrTenantId = null; String attrContactId = null; String attrContactListId = null; String attrISOTimezoneId = null; String attrFullName = null; String attrLastName = null; String attrFirstName = null; String attrCustom = null; String attrCustom2 = null; String attrCustom3 = null; String attrCreatedAt = null; String attrCreatedBy = null; String attrUpdatedAt = null; String attrUpdatedBy = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstContactUpdate"); CFAccXMsgRqstHandler xmsgRqstHandler = (CFAccXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFAccSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Revision")) { if (attrRevision != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrRevision = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedAt")) { if (attrCreatedAt != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("CreatedBy")) { if (attrCreatedBy != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCreatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedAt")) { if (attrUpdatedAt != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedAt = attrs.getValue(idxAttr); } else if (attrLocalName.equals("UpdatedBy")) { if (attrUpdatedBy != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrUpdatedBy = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContactId")) { if (attrContactId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContactId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ContactListId")) { if (attrContactListId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrContactListId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("ISOTimezoneId")) { if (attrISOTimezoneId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrISOTimezoneId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("FullName")) { if (attrFullName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFullName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("LastName")) { if (attrLastName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrLastName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("FirstName")) { if (attrFirstName != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrFirstName = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Custom")) { if (attrCustom != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCustom = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Custom2")) { if (attrCustom2 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCustom2 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("Custom3")) { if (attrCustom3 != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrCustom3 = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values if ((attrTenantId == null) || (attrTenantId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "TenantId"); } if ((attrContactId == null) || (attrContactId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ContactId"); } if ((attrContactListId == null) || (attrContactListId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "ContactListId"); } if (attrFullName == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "FullName"); } if ((attrRevision == null) || (attrRevision.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "Revision"); } if ((attrCreatedAt == null) || (attrCreatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CreatedAt"); } if ((attrCreatedBy == null) || (attrCreatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "CreatedBy"); } if ((attrUpdatedAt == null) || (attrUpdatedAt.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedAt"); } if ((attrUpdatedBy == null) || (attrUpdatedBy.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedBy"); } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Instantiate a PKey buffer for the parsed information CFAccContactPKey pkey = schemaObj.getBackingStore().getFactoryContact().newPKey(); long natTenantId; natTenantId = Long.parseLong(attrTenantId); pkey.setRequiredTenantId(natTenantId); long natContactId; natContactId = Long.parseLong(attrContactId); pkey.setRequiredContactId(natContactId); // Read the instance ICFAccContactObj origBuff = schemaObj.getContactTableObj().readContact(pkey); if (origBuff == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getContactTableObj().readContact()"); } else { // Edit the instance ICFAccContactEditObj editBuff = (ICFAccContactEditObj) origBuff.beginEdit(); CFAccContactBuff dataBuff = editBuff.getContactBuff(); // Convert string attributes to native Java types // and apply the converted attributes to the editBuff. long natContactListId = Long.parseLong(attrContactListId); dataBuff.setRequiredContactListId(natContactListId); Short natISOTimezoneId; if ((attrISOTimezoneId == null) || (attrISOTimezoneId.length() <= 0)) { natISOTimezoneId = null; } else { natISOTimezoneId = new Short(Short.parseShort(attrISOTimezoneId)); } dataBuff.setOptionalISOTimezoneId(natISOTimezoneId); String natFullName = attrFullName; dataBuff.setRequiredFullName(natFullName); String natLastName = attrLastName; dataBuff.setOptionalLastName(natLastName); String natFirstName = attrFirstName; dataBuff.setOptionalFirstName(natFirstName); String natCustom = attrCustom; dataBuff.setOptionalCustom(natCustom); String natCustom2 = attrCustom2; dataBuff.setOptionalCustom2(natCustom2); String natCustom3 = attrCustom3; dataBuff.setOptionalCustom3(natCustom3); int natRevision = Integer.parseInt(attrRevision); dataBuff.setRequiredRevision(natRevision); UUID createdBy = null; if (attrCreatedBy != null) { createdBy = UUID.fromString(attrCreatedBy); } Calendar createdAt = null; if (attrCreatedAt != null) { createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt); } UUID updatedBy = null; if (attrUpdatedBy != null) { updatedBy = UUID.fromString(attrUpdatedBy); } Calendar updatedAt = null; if (attrUpdatedAt != null) { updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt); } if (createdBy != null) { dataBuff.setCreatedByUserId(createdBy); } if (createdAt != null) { dataBuff.setCreatedAt(createdAt); } if (updatedBy != null) { dataBuff.setUpdatedByUserId(updatedBy); } if (updatedAt != null) { dataBuff.setUpdatedAt(updatedAt); } // Attempt the update editBuff.update(); editBuff.endEdit(); String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgContactMessageFormatter.formatContactRspnUpdated("\n\t\t\t", origBuff.getContactBuff()) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); ((CFAccXMsgRqstHandler) getParser()).appendResponse(response); } } catch (RuntimeException e) { String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble(); CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser()); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }