Example usage for java.lang Short Short

List of usage examples for java.lang Short Short

Introduction

In this page you can find the example usage for java.lang Short Short.

Prototype

@Deprecated(since = "9")
public Short(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Short object that represents the short value indicated by the String parameter.

Usage

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstInt64FormatterReadByAltIdxHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {//from   w  w  w  .j  a  v a 2s  .  com
        // Common XML Attributes
        String attrId = null;
        String attrName = null;
        String attrToolSetId = null;
        String attrScopeDefId = null;
        String attrGenDefId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstInt64FormatterReadByAltIdx");

        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("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("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Ensure that required attributes have values$implRqstTableReadByHandlerCheckReqKeyAttrs$

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.

        String natName;
        natName = attrName;

        short natToolSetId;
        natToolSetId = Short.parseShort(attrToolSetId);

        Short natScopeDefId;
        natScopeDefId = new Short(Short.parseShort(attrScopeDefId));

        short natGenDefId;
        natGenDefId = Short.parseShort(attrGenDefId);

        // Read the object
        ICFGenKbInt64FormatterObj read = schemaObj.getInt64FormatterTableObj()
                .readInt64FormatterByAltIdx(natName, natToolSetId, natScopeDefId, natGenDefId, true);
        if (read != null) {
            String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                    + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnSingleOpenTag()
                    + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnDerivedRec("\n\t\t",
                            read.getGenItemBuff())
                    + "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnSingleCloseTag()
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
            ((CFGenKbXMsgRqstHandler) getParser()).appendResponse(response);
        } else {
            String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n"
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
            xmsgRqstHandler.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:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstDoubleFormatterReadByAltIdxHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*from www . j a  v  a 2  s .com*/
        // Common XML Attributes
        String attrId = null;
        String attrName = null;
        String attrToolSetId = null;
        String attrScopeDefId = null;
        String attrGenDefId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstDoubleFormatterReadByAltIdx");

        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("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("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Ensure that required attributes have values$implRqstTableReadByHandlerCheckReqKeyAttrs$

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.

        String natName;
        natName = attrName;

        short natToolSetId;
        natToolSetId = Short.parseShort(attrToolSetId);

        Short natScopeDefId;
        natScopeDefId = new Short(Short.parseShort(attrScopeDefId));

        short natGenDefId;
        natGenDefId = Short.parseShort(attrGenDefId);

        // Read the object
        ICFGenKbDoubleFormatterObj read = schemaObj.getDoubleFormatterTableObj()
                .readDoubleFormatterByAltIdx(natName, natToolSetId, natScopeDefId, natGenDefId, true);
        if (read != null) {
            String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                    + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnSingleOpenTag()
                    + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnDerivedRec("\n\t\t",
                            read.getGenItemBuff())
                    + "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnSingleCloseTag()
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
            ((CFGenKbXMsgRqstHandler) getParser()).appendResponse(response);
        } else {
            String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n"
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
            xmsgRqstHandler.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:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstNmTokenFormatterReadByAltIdxHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {//from   w  w w  .  j  a v  a  2  s . c o m
        // Common XML Attributes
        String attrId = null;
        String attrName = null;
        String attrToolSetId = null;
        String attrScopeDefId = null;
        String attrGenDefId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstNmTokenFormatterReadByAltIdx");

        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("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("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Ensure that required attributes have values$implRqstTableReadByHandlerCheckReqKeyAttrs$

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.

        String natName;
        natName = attrName;

        short natToolSetId;
        natToolSetId = Short.parseShort(attrToolSetId);

        Short natScopeDefId;
        natScopeDefId = new Short(Short.parseShort(attrScopeDefId));

        short natGenDefId;
        natGenDefId = Short.parseShort(attrGenDefId);

        // Read the object
        ICFGenKbNmTokenFormatterObj read = schemaObj.getNmTokenFormatterTableObj()
                .readNmTokenFormatterByAltIdx(natName, natToolSetId, natScopeDefId, natGenDefId, true);
        if (read != null) {
            String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                    + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnSingleOpenTag()
                    + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnDerivedRec("\n\t\t",
                            read.getGenItemBuff())
                    + "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnSingleCloseTag()
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
            ((CFGenKbXMsgRqstHandler) getParser()).appendResponse(response);
        } else {
            String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n"
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
            xmsgRqstHandler.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:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstTimestampFormatterReadByAltIdxHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*from   w w w  .  j  a  v a  2 s .  c  o m*/
        // Common XML Attributes
        String attrId = null;
        String attrName = null;
        String attrToolSetId = null;
        String attrScopeDefId = null;
        String attrGenDefId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstTimestampFormatterReadByAltIdx");

        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("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("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Ensure that required attributes have values$implRqstTableReadByHandlerCheckReqKeyAttrs$

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.

        String natName;
        natName = attrName;

        short natToolSetId;
        natToolSetId = Short.parseShort(attrToolSetId);

        Short natScopeDefId;
        natScopeDefId = new Short(Short.parseShort(attrScopeDefId));

        short natGenDefId;
        natGenDefId = Short.parseShort(attrGenDefId);

        // Read the object
        ICFGenKbTimestampFormatterObj read = schemaObj.getTimestampFormatterTableObj()
                .readTimestampFormatterByAltIdx(natName, natToolSetId, natScopeDefId, natGenDefId, true);
        if (read != null) {
            String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                    + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnSingleOpenTag()
                    + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnDerivedRec("\n\t\t",
                            read.getGenItemBuff())
                    + "\n" + "\t" + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnSingleCloseTag()
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
            ((CFGenKbXMsgRqstHandler) getParser()).appendResponse(response);
        } else {
            String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnNoDataFound() + "\n"
                    + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
            xmsgRqstHandler.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:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstDefClassCreateHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {//from www.  j a  va2 s.co m
        // Common XML Attributes
        String attrId = null;
        String attrRevision = null;
        // DefClass Attributes
        String attrName = null;
        String attrBaseId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstDefClassCreate");

        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()");
        }

        // Instantiate an edit buffer for the parsed information
        ICFGenKbDefClassEditObj editBuff = (ICFGenKbDefClassEditObj) schemaObj.getDefClassTableObj()
                .newInstance().beginEdit();
        CFGenKbDefClassBuff dataBuff = editBuff.getDefClassBuff();
        // 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("schemaLocation")) {
                // ignored
            } 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("BaseId")) {
                if (attrBaseId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBaseId = attrs.getValue(idxAttr);
            } 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");
        }

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();

        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.
        String natName = attrName;

        dataBuff.setRequiredName(natName);

        Short natBaseId;
        if ((attrBaseId == null) || (attrBaseId.length() <= 0)) {
            natBaseId = null;
        } else {
            natBaseId = new Short(Short.parseShort(attrBaseId));
        }

        dataBuff.setOptionalBaseId(natBaseId);

        //   Attempt the create
        editBuff.copyBuffToPKey(); // Allow for predefined ids
        ICFGenKbDefClassObj created = (ICFGenKbDefClassObj) editBuff.create();
        editBuff.endEdit();
        String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGenKbXMsgDefClassMessageFormatter.formatDefClassRspnCreated("\n\t\t\t",
                        created.getDefClassBuff())
                + "\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:de.odysseus.calyxo.base.util.ParseUtils.java

public void testNullPrimitive() throws Exception {
        assertEquals(Boolean.FALSE, ParseUtils.parse(boolean.class, null));
        assertEquals(new Character((char) 0), ParseUtils.parse(char.class, null));
        assertEquals(new Byte((byte) 0), ParseUtils.parse(byte.class, null));
        assertEquals(new Short((short) 0), ParseUtils.parse(short.class, null));
        assertEquals(new Integer(0), ParseUtils.parse(int.class, null));
        assertEquals(new Long(0), ParseUtils.parse(long.class, null));
        assertEquals(new Float(0), ParseUtils.parse(float.class, null));
        assertEquals(new Double(0), ParseUtils.parse(double.class, null));
    }//from   w w  w.  j  a  v  a2s.  c o m

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSaxLoader.CFAsteriskSaxLoaderISOLanguageHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*w  ww  .ja v  a 2s.c o  m*/
        // Common XML Attributes
        String attrId = null;
        // Primary Key Attributes for Constant Enum support
        // ISOLanguage Attributes
        String attrISOCode = null;
        String attrBaseLanguageCode = null;
        String attrISOCountryId = null;
        // ISOLanguage References
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("ISOLanguage");

        CFAsteriskSaxLoader saxLoader = (CFAsteriskSaxLoader) getParser();
        if (saxLoader == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFAsteriskSchemaObj schemaObj = saxLoader.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Instantiate an edit buffer for the parsed information
        ICFAsteriskISOLanguageEditObj editBuff = (ICFAsteriskISOLanguageEditObj) schemaObj
                .getISOLanguageTableObj().newInstance().beginEdit();

        // 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("ISOCode")) {
                if (attrISOCode != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrISOCode = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("BaseLanguageCode")) {
                if (attrBaseLanguageCode != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrBaseLanguageCode = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ISOCountryId")) {
                if (attrISOCountryId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrISOCountryId = 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 (attrISOCode == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "ISOCode");
        }
        if (attrBaseLanguageCode == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "BaseLanguageCode");
        }

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        curContext.putNamedValue("Id", attrId);
        curContext.putNamedValue("ISOCode", attrISOCode);
        curContext.putNamedValue("BaseLanguageCode", attrBaseLanguageCode);
        curContext.putNamedValue("ISOCountryId", attrISOCountryId);

        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.

        short natId;
        natId = Short.parseShort(attrId);
        editBuff.getPKey().setRequiredId(natId);
        editBuff.getISOLanguageBuff().setRequiredId(natId);

        String natISOCode = attrISOCode;
        editBuff.setRequiredISOCode(natISOCode);

        String natBaseLanguageCode = attrBaseLanguageCode;
        editBuff.setRequiredBaseLanguageCode(natBaseLanguageCode);

        Short natISOCountryId;
        if ((attrISOCountryId == null) || (attrISOCountryId.length() <= 0)) {
            natISOCountryId = null;
        } else {
            natISOCountryId = new Short(Short.parseShort(attrISOCountryId));
        }
        editBuff.setOptionalISOCountryId(natISOCountryId);

        // Get the scope/container object

        CFLibXmlCoreContext parentContext = curContext.getPrevContext();
        Object scopeObj;
        if (parentContext != null) {
            scopeObj = parentContext.getNamedValue("Object");
        } else {
            scopeObj = null;
        }

        CFAsteriskSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getISOLanguageLoaderBehaviour();
        ICFAsteriskISOLanguageEditObj editISOLanguage = null;
        ICFAsteriskISOLanguageObj origISOLanguage = (ICFAsteriskISOLanguageObj) schemaObj
                .getISOLanguageTableObj().readISOLanguageByCodeIdx(editBuff.getRequiredISOCode());
        editBuff.getPKey().setRequiredId(natId);
        editBuff.getISOLanguageBuff().setRequiredId(natId);
        if (origISOLanguage == null) {
            editISOLanguage = editBuff;
        } else {
            switch (loaderBehaviour) {
            case Insert:
                break;
            case Update:
                editISOLanguage = (ICFAsteriskISOLanguageEditObj) origISOLanguage.beginEdit();
                editISOLanguage.setRequiredISOCode(editBuff.getRequiredISOCode());
                editISOLanguage.setRequiredBaseLanguageCode(editBuff.getRequiredBaseLanguageCode());
                editISOLanguage.setOptionalISOCountryId(editBuff.getOptionalISOCountryId());
                break;
            case Replace:
                editISOLanguage = (ICFAsteriskISOLanguageEditObj) origISOLanguage.beginEdit();
                editISOLanguage.delete();
                editISOLanguage.endEdit();
                origISOLanguage = null;
                editISOLanguage = editBuff;
                break;
            }
        }

        if (editISOLanguage != null) {
            if (origISOLanguage != null) {
                editISOLanguage.update();
            } else {
                origISOLanguage = (ICFAsteriskISOLanguageObj) editISOLanguage.create();
            }
            editISOLanguage.endEdit();
        }

        curContext.putNamedValue("Object", origISOLanguage);
    } 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:com.yahoo.semsearch.fastlinking.EntityContextFastEntityLinker.java

/**
 * Reads a type mapping file (from short integer to string). Useful for display
 *
 * @param types type remapping//from w  w w .j  a v  a  2  s .c  o m
 * @return hashmap with the remmaped types
 * @throws IOException
 */
public static HashMap<Short, String> readTypeMapping(String types) throws IOException {
    HashMap<Short, String> typeMapping = new HashMap<>();
    final BufferedReader lines = new BufferedReader(new FileReader(types));
    String line;
    while ((line = lines.readLine()) != null) {
        String[] parts = line.split("\t");
        try {
            typeMapping.put(new Short(parts[1]), parts[0]);
        } catch (NumberFormatException e) {
            System.out.println("Wrong line: " + line);
            e.printStackTrace();
        }
    }
    lines.close();
    return typeMapping;
}

From source file:com.jaspersoft.jasperserver.remote.utils.RepositoryHelper.java

/**
 *  This method get a string and tries to convert the string into the requested object.
 *  Valid classes are:/* w w w  . j  av  a 2s. c  o m*/
 *    java.util.Date (the string is supposed to represent a number of milliseconds)
 *    Number
 *    BigDecimal
 *    Byte
 *    Short
 *    Integer
 *    Long
 *    Float
 *    Double
 *    Boolean
 *    String
 *    java.util.Locale
 * 
 *  The default returned object is of type String
 * @param str the string representing the value
 * @param clazz The class of the result (not garanteed)
 * @return return an Object hopefully of the requested class (or a String)
 * 
 */
public static Object stringToValue(String str, Class clazz) {
    Object value = str;
    if (value == null) {
        return value;
    }

    if (java.util.Date.class.getName().equals(clazz.getName())) {
        value = new java.util.Date(Long.valueOf(value.toString()).longValue());
    } else if (java.sql.Date.class.getName().equals(clazz.getName())) {
        value = new java.sql.Date(Long.valueOf(value.toString()).longValue());
    } else if (java.sql.Timestamp.class.getName().equals(clazz.getName())) {
        value = new java.sql.Timestamp(Long.valueOf(value.toString()).longValue());
    } else if (Number.class.isAssignableFrom(clazz)) {
        value = new java.math.BigDecimal(value.toString());
        if (Byte.class.getName().equals(clazz.getName())) {
            value = new Byte(((Number) value).byteValue());
        } else if (Short.class.getName().equals(clazz.getName())) {
            value = new Short(((Number) value).shortValue());
        } else if (Integer.class.getName().equals(clazz.getName())) {
            value = new Integer(((Number) value).intValue());
        } else if (Long.class.getName().equals(clazz.getName())) {
            value = new Long(((Number) value).longValue());
        } else if (Float.class.getName().equals(clazz.getName())) {
            value = new Float(((Number) value).floatValue());
        } else if (Double.class.getName().equals(clazz.getName())) {
            value = new Double(((Number) value).doubleValue());
        }
    } else if (Boolean.class.getName().equals(clazz.getName())) {
        value = Boolean.valueOf(value.toString());
    } else if (Locale.class.getName().equals(clazz.getName())) {
        value = LocaleHelper.getInstance().getLocale(str);
    } else if (DateRange.class.equals(clazz)) {
        try {
            value = DateRangeFactory.getInstance(str, Date.class);
        } catch (InvalidDateRangeExpressionException e) {
            //if DateRange passed as string with milliseconds we need to parse it
            Date dateValue = (Date) stringToValue(str, Date.class);
            value = DateRangeFactory.getInstance(dateValue);
        }
    } else if (TimestampRange.class.equals(clazz)) {
        try {
            value = DateRangeFactory.getInstance(str, Timestamp.class);
        } catch (InvalidDateRangeExpressionException e) {
            //if TimestampRange passed as string with milliseconds we need to parse it
            Timestamp timestamp = (Timestamp) stringToValue(str, Timestamp.class);
            value = DateRangeFactory.getInstance(timestamp);
        }
    }
    return value;
}

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRspnHandler.CFGenKbXMsgRspnToolRecHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*from  w ww. j a v  a 2  s  .  co m*/
        // Common XML Attributes
        String attrId = null;
        String attrRevision = null;
        // Tool Attributes
        String attrName = null;
        String attrReplacesId = null;
        String attrIsSupported = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("Tool");

        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("ReplacesId")) {
                if (attrReplacesId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrReplacesId = 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("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");
        }

        // Save named attributes to context
        CFLibXmlCoreContext curContext = xmsgRspnHandler.getCurContext();

        // Convert string attributes to native Java types

        short natId = Short.parseShort(attrId);

        String natName = attrName;

        Short natReplacesId;
        if ((attrReplacesId == null) || (attrReplacesId.length() <= 0)) {
            natReplacesId = null;
        } else {
            natReplacesId = new Short(Short.parseShort(attrReplacesId));
        }

        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 + "\"");
        }

        int natRevision = Integer.parseInt(attrRevision);
        // Get the parent context
        CFLibXmlCoreContext parentContext = curContext.getPrevContext();
        // Instantiate a buffer for the parsed information
        ICFGenKbToolObj obj = schemaObj.getToolTableObj().newInstance();
        CFGenKbToolBuff dataBuff = obj.getToolBuff();
        dataBuff.setRequiredId(natId);
        dataBuff.setRequiredName(natName);
        dataBuff.setOptionalReplacesId(natReplacesId);
        dataBuff.setRequiredIsSupported(natIsSupported);
        dataBuff.setRequiredRevision(natRevision);
        obj.copyBuffToPKey();
        SortedMap<CFGenKbToolPKey, ICFGenKbToolObj> sortedMap = (SortedMap<CFGenKbToolPKey, ICFGenKbToolObj>) xmsgRspnHandler
                .getSortedMapOfObjects();
        ICFGenKbToolObj realized = (ICFGenKbToolObj) 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);
    }
}