List of usage examples for org.xml.sax SAXException SAXException
public SAXException(Exception e)
From source file:com.jkoolcloud.tnt4j.streams.configure.sax.ConfigParserHandler.java
/** * Processes a {@code <field-locator>} element. * * @param attrs//from w w w.j a v a 2s . co m * List of element attributes * * @throws SAXException * if error occurs parsing element */ private void processFieldLocator(Attributes attrs) throws SAXException { if (currLocatorData != null) { throw new SAXParseException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.malformed.configuration", FIELD_LOC_ELMT), currParseLocation); } if (currField == null) { throw new SAXParseException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.malformed.configuration3", FIELD_LOC_ELMT, FIELD_ELMT, EMBEDDED_ACTIVITY_ELMT), currParseLocation); } if (!currField.hasDynamicAttrs() && currFieldHasLocValAttr) { throw new SAXException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.element.has.both", FIELD_ELMT, LOCATOR_ATTR, VALUE_ATTR, FIELD_LOC_ELMT, getLocationInfo())); } // if (currFieldHasMapElmt) { // throw new SAXException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, // "ConfigParserHandler.element.has.both2", FIELD_ELMT, FIELD_LOC_ELMT, FIELD_MAP_ELMT, // getLocationInfo())); // } currLocatorData = new FieldLocatorData(); for (int i = 0; i < attrs.getLength(); i++) { String attName = attrs.getQName(i); String attValue = attrs.getValue(i); if (DATA_TYPE_ATTR.equals(attName)) { currLocatorData.dataType = ActivityFieldDataType.valueOf(attValue); } else if (LOC_TYPE_ATTR.equals(attName)) { currLocatorData.locatorType = attValue; } else if (LOCATOR_ATTR.equals(attName)) { currLocatorData.locator = attValue; } else if (RADIX_ATTR.equals(attName)) { currLocatorData.radix = Integer.parseInt(attValue); } else if (UNITS_ATTR.equals(attName)) { currLocatorData.units = attValue; } else if (FORMAT_ATTR.equals(attName)) { currLocatorData.format = attValue; } else if (LOCALE_ATTR.equals(attName)) { currLocatorData.locale = attValue; } else if (TIMEZONE_ATTR.equals(attName)) { currLocatorData.timeZone = attValue; } else if (VALUE_ATTR.equals(attName)) { currLocatorData.value = attValue; } else if (REQUIRED_ATTR.equals(attName)) { currLocatorData.reqVal = attValue; } else if (ID_ATTR.equals(attName)) { currLocatorData.id = attValue; } } if (currLocatorData.value != null && currLocatorData.value.isEmpty()) { currLocatorData.value = null; } // make sure any fields that are required based on other fields are // specified if (ActivityFieldDataType.DateTime == currLocatorData.dataType) { if (currLocatorData.format == null) { throw new SAXParseException(StreamsResources.getStringFormatted( StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.missing.attribute2", FIELD_LOC_ELMT, FORMAT_ATTR, currLocatorData.dataType), currParseLocation); } // if (locale == null) // { // // } } else if (ActivityFieldDataType.Timestamp == currLocatorData.dataType) { if (currLocatorData.units == null) { throw new SAXParseException(StreamsResources.getStringFormatted( StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.missing.attribute2", FIELD_LOC_ELMT, UNITS_ATTR, currLocatorData.dataType), currParseLocation); } } // currFieldHasLocElmt = true; elementData = new StringBuilder(); }
From source file:net.sf.joost.stx.Processor.java
/** * Processes the upper most event on the event stack. *//*from ww w.j av a2s . co m*/ private void processEvent() throws SAXException { SAXEvent event = (SAXEvent) eventStack.peek(); if (DEBUG) if (log.isDebugEnabled()) { log.debug(event); log.debug(context.localVars); } if (dataStack.peek().lastProcStatus == PR_SIBLINGS) processSiblings(); TemplateFactory.Instance temp = findMatchingTemplate(); if (temp != null) { AbstractInstruction inst = temp; context.localVars.clear(); Hashtable currentParams = context.passedParameters; inst = doProcessLoop(inst, event, false); if (DEBUG) if (log.isDebugEnabled()) { log.debug("stop " + processStatus); log.debug(context.localVars); } switch (processStatus) { case PR_CONTINUE: // templated finished if (event.type == SAXEvent.ELEMENT || event.type == SAXEvent.ROOT) { skipDepth = 1; collectedCharacters.setLength(0); // clear text insideCDATA = false; // reset if there was a CDATA section } break; case PR_CHILDREN: // stx:process-children encountered dataStack.push(new Data(PR_CHILDREN, temp, inst, currentParams, context)); if (context.targetHandler != null) { // instruction had a filter attribute startExternDocument(); if (collectedCharacters.length() > 0) { context.targetHandler.characters(collectedCharacters.toString().toCharArray(), 0, collectedCharacters.length()); collectedCharacters.setLength(0); } skipDepth = 1; } break; case PR_SELF: // stx:process-self encountered dataStack.push(new Data(PR_SELF, temp, inst, currentParams, context)); if (context.targetHandler != null) { // instruction had a filter attribute switch (event.type) { case SAXEvent.ELEMENT: startExternDocument(); context.targetHandler.startElement(event.uri, event.lName, event.qName, event.attrs); skipDepth = 1; break; case SAXEvent.TEXT: startExternDocument(); context.targetHandler.characters(event.value.toCharArray(), 0, event.value.length()); endExternDocument(); break; case SAXEvent.CDATA: startExternDocument(); context.targetHandler.startCDATA(); context.targetHandler.characters(event.value.toCharArray(), 0, event.value.length()); context.targetHandler.endCDATA(); endExternDocument(); break; case SAXEvent.PI: startExternDocument(); context.targetHandler.processingInstruction(event.qName, event.value); endExternDocument(); break; case SAXEvent.COMMENT: startExternDocument(); context.targetHandler.comment(event.value.toCharArray(), 0, event.value.length()); endExternDocument(); break; case SAXEvent.ROOT: context.targetHandler.startDocument(); skipDepth = 1; break; case SAXEvent.ATTRIBUTE: // nothing to do break; default: if (log != null) log.error("Unexpected event: " + event); else System.err.println("Error - Unexpected event: " + event); } } else processEvent(); // recurse if (event.type == SAXEvent.TEXT || event.type == SAXEvent.CDATA || event.type == SAXEvent.COMMENT || event.type == SAXEvent.PI || event.type == SAXEvent.ATTRIBUTE) { // no children present, continue processing dataStack.pop(); inst = doProcessLoop(inst, event, false); if (DEBUG) if (log.isDebugEnabled()) log.debug("stop " + processStatus); switch (processStatus) { case PR_CHILDREN: case PR_SELF: NodeBase start = inst.getNode(); context.errorHandler.error("Encountered '" + start.qName + "' after stx:process-self", start.publicId, start.systemId, start.lineNo, start.colNo); // falls through, if the error handler returns case PR_ERROR: throw new SAXException("Non-recoverable error"); case PR_SIBLINGS: dataStack.push(new Data(PR_SIBLINGS, temp, inst, currentParams, context, event)); break; // case PR_ATTRIBUTES: won't happen // case PR_CONTINUE: nothing to do } } break; case PR_SIBLINGS: // stx:process-siblings encountered if (event.type == SAXEvent.ELEMENT || event.type == SAXEvent.ROOT) { // end of template reached, skip contents skipDepth = 1; collectedCharacters.setLength(0); // clear text } dataStack.push(new Data(PR_SIBLINGS, temp, inst, currentParams, context, event)); break; // case PR_ATTRIBUTES: won't happen case PR_ERROR: // errorHandler returned after a fatal error throw new SAXException("Non-recoverable error"); default: // Mustn't happen String msg = "Unexpected return value from process() " + processStatus; if (log != null) log.error(msg); throw new SAXException(msg); } } else { // no template found, default action GroupBase tg = context.targetGroup; Emitter emitter = context.emitter; switch (event.type) { case SAXEvent.ROOT: dataStack.push(new Data(dataStack.peek())); break; case SAXEvent.ELEMENT: if ((tg.passThrough & PASS_THROUGH_ELEMENT) != 0) emitter.startElement(event.uri, event.lName, event.qName, event.attrs, event.namespaces, tg); dataStack.push(new Data(dataStack.peek())); break; case SAXEvent.TEXT: if ((tg.passThrough & PASS_THROUGH_TEXT) != 0) { emitter.characters(event.value.toCharArray(), 0, event.value.length(), tg); } break; case SAXEvent.CDATA: if ((tg.passThrough & PASS_THROUGH_TEXT) != 0) { emitter.startCDATA(tg); emitter.characters(event.value.toCharArray(), 0, event.value.length(), tg); emitter.endCDATA(); } break; case SAXEvent.COMMENT: if ((tg.passThrough & PASS_THROUGH_COMMENT) != 0) emitter.comment(event.value.toCharArray(), 0, event.value.length(), tg); break; case SAXEvent.PI: if ((tg.passThrough & PASS_THROUGH_PI) != 0) emitter.processingInstruction(event.qName, event.value, tg); break; case SAXEvent.ATTRIBUTE: if ((tg.passThrough & PASS_THROUGH_ATTRIBUTE) != 0) emitter.addAttribute(event.uri, event.qName, event.lName, event.value, tg); break; default: if (log != null) log.error("no default action for " + event); else System.err.println("Error - no default action for " + event); } } }
From source file:XMLWriter.java
/** * Write a raw character.//from ww w. ja va 2 s. c o m * * @param c The character to write. * @exception org.xml.sax.SAXException If there is an error writing * the character, this method will throw an IOException * wrapped in a SAXException. */ private void write(char c) throws SAXException { try { output.write(c); } catch (IOException e) { throw new SAXException(e); } }
From source file:XMLWriter.java
/** * Write a raw string./*from w w w . j av a2s . c o m*/ * * @param s * @exception org.xml.sax.SAXException If there is an error writing * the string, this method will throw an IOException * wrapped in a SAXException */ private void write(String s) throws SAXException { try { output.write(s); } catch (IOException e) { throw new SAXException(e); } }
From source file:com.jkoolcloud.tnt4j.streams.configure.sax.ConfigParserHandler.java
/** * Processes a {@code <field-map>} element. * * @param attrs// www .j a v a 2 s.c o m * List of element attributes * * @throws SAXException * if error occurs parsing element */ private void processFieldMap(Attributes attrs) throws SAXException { if (currField == null) { throw new SAXParseException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.malformed.configuration3", FIELD_MAP_ELMT, FIELD_ELMT, FIELD_LOC_ELMT), currParseLocation); } // if (currFieldHasLocElmt && currLocatorData == null) { // throw new SAXException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, // "ConfigParserHandler.element.has.both2", FIELD_ELMT, FIELD_LOC_ELMT, FIELD_MAP_ELMT, // getLocationInfo())); // } if (CollectionUtils.isEmpty(currField.getLocators()) && currLocatorData == null) { throw new SAXException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.element.no.binding", FIELD_MAP_ELMT, FIELD_LOC_ELMT, getLocationInfo())); } String source = null; String target = null; String type = null; for (int i = 0; i < attrs.getLength(); i++) { String attName = attrs.getQName(i); String attValue = attrs.getValue(i); if (SOURCE_ATTR.equals(attName)) { source = attValue; } else if (TARGET_ATTR.equals(attName)) { target = attValue; } else if (TYPE_ATTR.equals(attName)) { type = attValue; } } notNull(source, FIELD_MAP_ELMT, SOURCE_ATTR); notNull(target, FIELD_MAP_ELMT, TARGET_ATTR); if (currLocatorData != null) { currLocatorData.valueMapItems.add(new FieldLocatorData.ValueMapData(source, target, StringUtils.isEmpty(type) ? null : ActivityFieldMappingType.valueOf(type))); } else { // currFieldHasMapElmt = true; List<ActivityFieldLocator> locators = currField.getLocators(); if (locators != null) { for (ActivityFieldLocator loc : locators) { loc.addValueMap(source, target, StringUtils.isEmpty(type) ? null : ActivityFieldMappingType.valueOf(type)); } } } }
From source file:com.jkoolcloud.tnt4j.streams.configure.sax.ConfigParserHandler.java
/** * Processes a {@code <field-map-ref>} element. * * @param attrs//from w w w .j a va 2 s. co m * List of element attributes * * @throws SAXException * if error occurs parsing element */ @SuppressWarnings("unchecked") private void processFieldMapReference(Attributes attrs) throws SAXException { if (currField == null) { throw new SAXParseException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.malformed.configuration3", FIELD_MAP_REF_ELMT, FIELD_ELMT, FIELD_LOC_ELMT), currParseLocation); } if (CollectionUtils.isEmpty(currField.getLocators()) && currLocatorData == null) { throw new SAXException(StreamsResources.getStringFormatted(StreamsResources.RESOURCE_BUNDLE_NAME, "ConfigParserHandler.element.no.binding", FIELD_MAP_REF_ELMT, FIELD_LOC_ELMT, getLocationInfo())); } String reference = null; for (int i = 0; i < attrs.getLength(); i++) { String attName = attrs.getQName(i); String attValue = attrs.getValue(i); if (RESOURCE_ATTR.equals(attName)) { reference = attValue; } } notEmpty(reference, FIELD_MAP_REF_ELMT, RESOURCE_ATTR); Object val = Utils.getMapValueByPath(reference, resourcesMap); if (val instanceof Map) { AttributesImpl mappingAttrs = new AttributesImpl(); for (Map.Entry<String, ?> entry : ((Map<String, ?>) val).entrySet()) { mappingAttrs.clear(); mappingAttrs.addAttribute(null, null, SOURCE_ATTR, null, entry.getKey()); mappingAttrs.addAttribute(null, null, TARGET_ATTR, null, String.valueOf(entry.getValue())); processFieldMap(mappingAttrs); } } }
From source file:it.greenvulcano.gvesb.datahandling.dbo.DBOCallSP.java
/** * @see it.greenvulcano.gvesb.datahandling.dbo.AbstractDBO#getStatement(java.lang.String) *///w ww . jav a 2 s.c o m @Override protected void getStatement(String id) throws SAXException { if (id == null) { id = "0"; } if ((sqlStatementInfo == null) || !getCurrentId().equals(id)) { try { if (sqlStatementInfo != null) { sqlStatementInfo.close(); } spCallDescriptor = spCallDescriptors.get(id); if (spCallDescriptor == null) { logger.error("SQL Call descriptor with id " + id + " not found."); throw new SAXException("SQL Call descriptor with id " + id + " not found."); } String expandedSQL = PropertiesHandler.expand(spCallDescriptor.getStatement(), getCurrentProps(), null, getInternalConn()); logger.debug("expandedSQL stmt: " + expandedSQL); Statement statement = getInternalConn().prepareCall(expandedSQL); sqlStatementInfo = new StatementInfo(id, expandedSQL, statement); spCallDescriptor.specifyOutputParameter((CallableStatement) statement); setCurrentId(id); } catch (SAXException exc) { throw exc; } catch (SQLException exc) { OracleError oerr = OracleExceptionHandler.handleSQLException(exc); oerr.printLoggerInfo(); throw new SAXException(exc); } catch (Exception exc) { throw new SAXException(exc); } } }
From source file:net.sf.joost.stx.Processor.java
/** * Clear consecutive pending <code>stx:process-siblings</code> * instructions on the top of {@link #dataStack} until * the passed object is encountered.//w w w .j a v a 2 s .c o m * @param stopData data for the last <code>stx:process-siblings</code> * instruction * @param clearLast <code>true</code> if the template in * <code>stopData</code> itself must be cleared */ private void clearProcessSiblings(Data stopData, boolean clearLast) throws SAXException { // replace top-most event and local variables Object topEvent = null; // if clearLast==true then there's no event to remove, // because the end of of the parent has been encountered if (clearLast) topEvent = eventStack.peek(); else topEvent = eventStack.pop(); Hashtable storedVars = context.localVars; Data data; do { data = dataStack.pop(); // put back stored event eventStack.push(data.sibEvent); context.position = data.contextPosition; // restore position context.localVars = data.localVars; // restore variables AbstractInstruction inst = data.instruction; do { inst = doProcessLoop(inst, (SAXEvent) topEvent, false); if (DEBUG) if (log.isDebugEnabled()) { log.debug("stop " + processStatus); log.debug(context.localVars); } switch (processStatus) { case PR_CHILDREN: case PR_SELF: NodeBase start = inst.getNode(); context.errorHandler.error("Encountered '" + start.qName + "' after stx:process-siblings", start.publicId, start.systemId, start.lineNo, start.colNo); // falls through, if the error handler returns case PR_ERROR: throw new SAXException("Non-recoverable error"); // case PR_ATTRIBUTES: won't happen // case PR_CONTINUE or PR_SIBLINGS: ok, nothing to do } // ignore further stx:process-siblings instructions in this // template if the processing was stopped by another // stx:process-siblings or clearLast==true } while (processStatus == PR_SIBLINGS && (clearLast || data != stopData)); if (processStatus == PR_SIBLINGS) { // put back the last stx:process-siblings instruction stopData.instruction = inst; // there might have been a group attribute stopData.targetGroup = context.targetGroup; stopData.psiblings = context.psiblings; stopData.localVars = context.localVars; context.localVars = storedVars; dataStack.push(stopData); } // remove this event eventStack.pop(); } while (data != stopData); // last object // If the instruction before the last cleared process-siblings is a // process-self, we have to clear it too if (dataStack.peek().lastProcStatus == PR_SELF) { SAXEvent selfEvent = data.sibEvent; // prepare the event stack eventStack.push(selfEvent); // put another namespace context on the stack because endElement() // will remove it namespaceContext.push(namespaceContext.peek()); // postpone the processing of character data StringBuffer postponedCharacters = collectedCharacters; collectedCharacters = new StringBuffer(); endElement(selfEvent.uri, selfEvent.lName, selfEvent.qName); collectedCharacters = postponedCharacters; } // restore old event stack if (!clearLast) eventStack.push(topEvent); }
From source file:net.sf.joost.stx.Processor.java
public void endDocument() throws SAXException { if (collectedCharacters.length() != 0) processCharacters();/*from w ww. j av a2 s . c o m*/ if (skipDepth == 1 && context.targetHandler != null && dataStack.peek().lastProcStatus == PR_CHILDREN) { // provisional fix for bug #765301 // (see comment in endElement below) skipDepth = 0; endExternDocument(); } if (skipDepth == 0) { clearProcessSiblings(); Data data = dataStack.pop(); context.currentGroup = data.currentGroup; context.targetGroup = data.targetGroup; short prStatus = data.lastProcStatus; if (data.template == null) { // default action: nothing to do } else if (prStatus == PR_CHILDREN || prStatus == PR_SELF) { context.position = data.contextPosition; // restore position context.localVars = data.localVars; AbstractInstruction inst = data.instruction; inst = doProcessLoop(inst, (SAXEvent) eventStack.peek(), true); switch (processStatus) { case PR_CHILDREN: case PR_SELF: NodeBase start = inst.getNode(); context.errorHandler.error("Encountered '" + start.qName + "' after stx:process-" + // prStatus must be either PR_CHILDREN or PR_SELF, see above (prStatus == PR_CHILDREN ? "children" : "self"), start.publicId, start.systemId, start.lineNo, start.colNo); // falls through if the error handler returns case PR_ERROR: throw new SAXException("Non-recoverable error"); // case PR_ATTRIBUTE: // case PR_SIBLINGS: // not possible because the context node is the document node } } else { if (log != null) log.error("encountered 'else' " + prStatus); else System.err.println("Error - encountered 'else' " + prStatus); } } else { // no stx:process-children in match="/" skipDepth--; if (skipDepth == 0 && context.targetHandler != null) endExternDocument(); } if (skipDepth == 0) { // look at the previous process status on the stack if (dataStack.peek().lastProcStatus == PR_SELF) endDocument(); // recurse (process-self) else { eventStack.pop(); if (innerProcStack.empty()) { transformNode.exitRecursionLevel(context); context.emitter.endDocument(transformNode); } else eventStack = context.ancestorStack = (Stack) innerProcStack.pop(); } } else if (log != null) log.error("skipDepth at document end: " + skipDepth); else System.err.println("Error - skipDepth at document end: " + skipDepth); }
From source file:it.greenvulcano.gvesb.datahandling.dbo.DBOCallSP.java
/** * @see org.xml.sax.ContentHandler#endElement(java.lang.String, * java.lang.String, java.lang.String) *///from w w w . j a v a 2 s .c om @Override public void endElement(String uri, String localName, String qName) throws SAXException { if (ROW_NAME.equals(localName)) { if (!currCriticalError) { executeStatement(); } else { rowDisc++; // aggiunta DiscardCause al dhr... String msg = currentXSLMessage; dhr.addDiscardCause(new DiscardCause(rowCounter, msg)); resultMessage.append("Data error on row ").append(rowCounter).append(": ").append(msg); resultMessage.append("SQL Statement Informations:\n").append(sqlStatementInfo); resultMessage.append("Record parameters:\n").append(dumpCurrentRowFields()); resultStatus = STATUS_PARTIAL; } } else if (COL_NAME.equals(localName)) { CallableStatement cs = (CallableStatement) sqlStatementInfo.getStatement(); try { if (!outOnly) { colDataExpecting = false; String text = textBuffer.toString(); if ((currentUUID != null) && (currentUUID.trim().length() > 0) && (text.length() == 0)) { text = uuids.get(currentUUID); if (text == null) { text = currentUUID; } } if (TIMESTAMP_TYPE.equals(currType) || DATE_TYPE.equals(currType) || TIME_TYPE.equals(currType)) { if (text.equals("")) { if (TIMESTAMP_TYPE.equals(currType)) setNull(cs, Types.TIMESTAMP); else if (DATE_TYPE.equals(currType)) setNull(cs, Types.DATE); else setNull(cs, Types.TIME); currentRowFields.add(null); } else { dateFormatter.applyPattern(currDateFormat); Date formattedDate = dateFormatter.parse(text); if (TIMESTAMP_TYPE.equals(currType)) { Timestamp ts = new Timestamp(formattedDate.getTime()); setTimestamp(cs, ts); currentRowFields.add(ts); } else if (DATE_TYPE.equals(currType)) { java.sql.Date d = new java.sql.Date(formattedDate.getTime()); setDate(cs, d); currentRowFields.add(d); } else { java.sql.Time t = new java.sql.Time(formattedDate.getTime()); setTime(cs, t); currentRowFields.add(t); } } } else if (INTEGER_TYPE.equals(currType) || SMALLINT_TYPE.equals(currType) || BIGINT_TYPE.equals(currType)) { if (text.equals("")) { if (INTEGER_TYPE.equals(currType)) setNull(cs, Types.INTEGER); else if (SMALLINT_TYPE.equals(currType)) setNull(cs, Types.SMALLINT); else setNull(cs, Types.BIGINT); currentRowFields.add(null); } else { if (INTEGER_TYPE.equals(currType)) setInt(cs, Integer.parseInt(text, 10)); else if (SMALLINT_TYPE.equals(currType)) setShort(cs, Short.parseShort(text, 10)); else setLong(cs, Long.parseLong(text, 10)); currentRowFields.add(text); } } else if (FLOAT_TYPE.equals(currType) || DOUBLE_TYPE.equals(currType) || DECIMAL_TYPE.equals(currType) || NUMERIC_TYPE.equals(currType)) { if (text.equals("")) { if (DECIMAL_TYPE.equals(currType) || NUMERIC_TYPE.equals(currType)) setNull(cs, Types.NUMERIC); else if (FLOAT_TYPE.equals(currType)) setNull(cs, Types.FLOAT); else setNull(cs, Types.DOUBLE); currentRowFields.add(null); } else { DecimalFormatSymbols dfs = numberFormatter.getDecimalFormatSymbols(); dfs.setDecimalSeparator(currDecSeparator.charAt(0)); dfs.setGroupingSeparator(currGroupSeparator.charAt(0)); numberFormatter.setDecimalFormatSymbols(dfs); numberFormatter.applyPattern(currNumberFormat); boolean isBigDecimal = numberFormatter.isParseBigDecimal(); try { numberFormatter.setParseBigDecimal(true); BigDecimal formattedNumber = (BigDecimal) numberFormatter.parse(text); if (DECIMAL_TYPE.equals(currType) || NUMERIC_TYPE.equals(currType)) { setBigDecimal(cs, formattedNumber); currentRowFields.add(formattedNumber); } else if (FLOAT_TYPE.equals(currType)) { setFloat(cs, formattedNumber.floatValue()); currentRowFields.add(formattedNumber.floatValue()); } else { setDouble(cs, formattedNumber.doubleValue()); currentRowFields.add(formattedNumber.doubleValue()); } } finally { numberFormatter.setParseBigDecimal(isBigDecimal); } } } else if (LONG_STRING_TYPE.equals(currType) || LONG_NSTRING_TYPE.equals(currType)) { if (text.equals("")) { if (LONG_STRING_TYPE.equals(currType)) setNull(cs, Types.CLOB); else setNull(cs, Types.NCLOB); currentRowFields.add(null); } else { if (LONG_STRING_TYPE.equals(currType)) { setCharacterStream(cs, new StringReader(text)); currentRowFields.add(text); } else { setNCharacterStream(cs, new StringReader(text)); currentRowFields.add(text); } } } else if (BASE64_TYPE.equals(currType)) { if (text.equals("")) { setNull(cs, Types.BLOB); currentRowFields.add(null); } else { byte[] data = text.getBytes(); data = Base64.getDecoder().decode(data); ByteArrayInputStream bais = new ByteArrayInputStream(data); setBinaryStream(cs, bais, data.length); currentRowFields.add(text); } } else if (BINARY_TYPE.equals(currType)) { if (text.equals("")) { setNull(cs, Types.BLOB); currentRowFields.add(null); } else { byte[] data = text.getBytes(); ByteArrayInputStream bais = new ByteArrayInputStream(data); setBinaryStream(cs, bais, data.length); currentRowFields.add(text); } } else if (BOOLEAN_TYPE.equals(currType)) { if (text.equals("")) { setNull(cs, Types.BOOLEAN); currentRowFields.add(null); } else { setBoolean(cs, TextUtils.parseBoolean(text)); currentRowFields.add(text); } } else if (XML_TYPE.equals(currType)) { if (text.equals("")) { setNull(cs, Types.SQLXML); currentRowFields.add(null); } else { SQLXML xml = cs.getConnection().createSQLXML(); xml.setString(text); setSQLXML(cs, xml); currentRowFields.add(text); } } else if (NSTRING_TYPE.equals(currType)) { if (text.equals("")) { setNull(cs, Types.NVARCHAR); currentRowFields.add(null); } else { setNString(cs, text); currentRowFields.add(text); } } else { if (text.equals("")) { setNull(cs, Types.VARCHAR); currentRowFields.add(null); } else { setString(cs, text); currentRowFields.add(text); } } } else { currentRowFields.add(currentUUID); } } catch (ParseException exc) { throw new SAXException(exc); } catch (SQLException exc) { OracleExceptionHandler.handleSQLException(exc); throw new SAXException(exc); } } }