/** * Returns an instance of the named implementation of {@code DatatypeFactory}. * * @throws DatatypeConfigurationException if {@code factoryClassName} is not available or cannot * be instantiated. * @since 1.6 */ public static DatatypeFactory newInstance(String factoryClassName, ClassLoader classLoader) throws DatatypeConfigurationException { if (factoryClassName == null) { throw new DatatypeConfigurationException("factoryClassName == null"); } if (classLoader == null) { classLoader = Thread.currentThread().getContextClassLoader(); } try { Class<?> type = classLoader != null ? classLoader.loadClass(factoryClassName) : Class.forName(factoryClassName); return (DatatypeFactory) type.newInstance(); } catch (ClassNotFoundException e) { throw new DatatypeConfigurationException(e); } catch (InstantiationException e) { throw new DatatypeConfigurationException(e); } catch (IllegalAccessException e) { throw new DatatypeConfigurationException(e); } }
/** * <p>Create a new <code>DatatypeConfigurationException</code> with * the specified detail message and cause.</p> * * @param message The detail message. * @param cause The cause. A <code>null</code> value is permitted, and indicates that the cause is nonexistent or unknown. */ public DatatypeConfigurationException(String message, Throwable cause) { super(message); initCauseByReflection(cause); }
/** * Print the the trace of methods from where the error * originated. This will trace all nested exception * objects, as well as this object. * @param s The writer where the dump will be sent to. */ public void printStackTrace(PrintWriter s) { if (!isJDK14OrAbove && causeOnJDK13OrBelow != null) { printStackTrace0(s); } else { super.printStackTrace(s); } }
private static DatatypeFactory getDatatypeFactory() { if (datatypeFactory == null) { try { datatypeFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException ex) { throw new IllegalStateException("Cannot construct DatatypeFactory: " + ex.getMessage(), ex); } } return datatypeFactory; }
/** * This method loads and caches the reference to the XML data type factory object. * * @return The XML Data Type Factory object */ public static DatatypeFactory getDatatypeFactory() { if (xmlDatatypeFactory == null) { try { xmlDatatypeFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { e.printStackTrace(System.err); } } return xmlDatatypeFactory; }
/** * Converts java.util.Date to javax.xml.datatype.XMLGregorianCalendar. * * @param date * Date parameter. * @return a XMLGregorianCalendar for date. */ private XMLGregorianCalendar toXMLGregorianCalendar(final DateTime date) { GregorianCalendar gCalendar = new GregorianCalendar(date.getZone().toTimeZone()); gCalendar.setTime(date.toDate()); XMLGregorianCalendar xmlGrogerianCalendar = null; try { xmlGrogerianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gCalendar); } catch (DatatypeConfigurationException ex) { log.error(ex.getMessage()); System.out.println(ex.getStackTrace()); } return xmlGrogerianCalendar; }
protected static CustomReportType createBlankCR(String createID) throws RaptorException { ObjectFactory objFactory = new ObjectFactory(); CustomReportType cr = objFactory.createCustomReportType(); //CustomReport cr = null; try { //cr = (CustomReport) objFactory.createCustomReport(customReportType); cr.setReportName(""); cr.setReportDescr(""); cr.setChartType(""); cr.setPublic(false); cr.setCreateId(createID); cr.setCreateDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar())); // cr.setReportSQL(""); cr.setReportType(""); cr.setPageSize(50); DataSourceList dataSourceList = objFactory.createDataSourceList(); cr.setDataSourceList(dataSourceList); } catch (DatatypeConfigurationException ex) { throw new RaptorException (ex.getMessage(), ex.getCause()); } return cr; } // createBlank
private static DatatypeFactory getDatatypeFactory() { if (datatypeFactory == null) { try { datatypeFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException ex) { throw new IllegalStateException("Cannot construct DatatypeFactory: " + ex.getMessage(), ex); } } return datatypeFactory; }
/** * Gets a static instance of a JAXP DatatypeFactory. * * @return the factory or null if the factory could not be created */ private static DatatypeFactory getDataTypeFactory() { if ( datatypeFactory == null ) { try { datatypeFactory = DatatypeFactory.newInstance(); } catch ( DatatypeConfigurationException e ) { e.printStackTrace(); } } return datatypeFactory; }
private static DatatypeFactory getDatatypeFactory() { if (datatypeFactory == null) { try { datatypeFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException ex) { throw new IllegalStateException("Cannot construct DatatypeFactory: " + ex.getMessage(), ex); } } return datatypeFactory; }
/** * This method loads and caches the reference to the XML data type factory object. * * @return The XML Data Type Factory object */ public static DatatypeFactory getDatatypeFactory() { if (xmlDatatypeFactory == null) { try { xmlDatatypeFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { e.printStackTrace(System.err); System.exit(1); } } return xmlDatatypeFactory; }
/** * <p>Obtain a new instance of a <code>DatatypeFactory</code>.</p> * * <p>The implementation resolution mechanisms are <a href="#DatatypeFactory.newInstance">defined</a> in this * <code>Class</code>'s documentation.</p> * <p>Note that you must supply your own implementation (such as Xerces); Android does not ship with a default implementation. * * @return New instance of a <code>DocumentBuilderFactory</code> * * @throws DatatypeConfigurationException If the implementation is not * available or cannot be instantiated. */ public static DatatypeFactory newInstance() throws DatatypeConfigurationException { try { return (DatatypeFactory) FactoryFinder.find( /* The default property name according to the JAXP spec */ DATATYPEFACTORY_PROPERTY, /* The fallback implementation class name */ DATATYPEFACTORY_IMPLEMENTATION_CLASS); } catch (FactoryFinder.ConfigurationError e) { throw new DatatypeConfigurationException(e.getMessage(), e.getException()); } }
/** * Print the the trace of methods from where the error * originated. This will trace all nested exception * objects, as well as this object. */ public void printStackTrace() { if (!isJDK14OrAbove && causeOnJDK13OrBelow != null) { printStackTrace0(new PrintWriter(System.err, true)); } else { super.printStackTrace(); } }
/** * <p>Create a new <code>DatatypeConfigurationException</code> with * the specified cause.</p> * * @param cause The cause. A <code>null</code> value is permitted, and indicates that the cause is nonexistent or unknown. */ public DatatypeConfigurationException(Throwable cause) { super(cause == null ? null : cause.toString()); initCauseByReflection(cause); }
private XMLGregorianCalendar convertDateToXmlGregorianCalendar(Date date) { GregorianCalendar c = new GregorianCalendar(); c.setTime(date); XMLGregorianCalendar cal = null; try { cal = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); } catch (DatatypeConfigurationException ex) { //Logger.getLogger(OrganisaatioServiceMock.class.getName()).log(Level.SEVERE, null, ex); log.log(Level.INFO, ex.getMessage()); } return cal; }
/** * Get the current timestamp. * @return */ public XMLGregorianCalendar getTimeStamp() { GregorianCalendar cal = new GregorianCalendar(); DatatypeFactory dt; try { dt = DatatypeFactory.newInstance(); return dt.newXMLGregorianCalendar(cal); } catch (DatatypeConfigurationException e) { e.printStackTrace(); } return null; } /**
/** * Returns an instance of the named implementation of {@code DatatypeFactory}. * * @throws DatatypeConfigurationException if {@code factoryClassName} is not available or cannot * be instantiated. * @since 1.6 */ public static DatatypeFactory newInstance(String factoryClassName, ClassLoader classLoader) throws DatatypeConfigurationException { if (factoryClassName == null) { throw new DatatypeConfigurationException("factoryClassName == null"); } if (classLoader == null) { classLoader = Thread.currentThread().getContextClassLoader(); } try { Class<?> type = classLoader != null ? classLoader.loadClass(factoryClassName) : Class.forName(factoryClassName); return (DatatypeFactory) type.newInstance(); } catch (ClassNotFoundException e) { throw new DatatypeConfigurationException(e); } catch (InstantiationException e) { throw new DatatypeConfigurationException(e); } catch (IllegalAccessException e) { throw new DatatypeConfigurationException(e); } }
/** * Print the the trace of methods from where the error * originated. This will trace all nested exception * objects, as well as this object. * @param s The stream where the dump will be sent to. */ public void printStackTrace(PrintStream s) { if (!isJDK14OrAbove && causeOnJDK13OrBelow != null) { printStackTrace0(new PrintWriter(s)); } else { super.printStackTrace(s); } }
/** * <p>Create a new <code>DatatypeConfigurationException</code> with * the specified detail message and cause.</p> * * @param message The detail message. * @param cause The cause. A <code>null</code> value is permitted, and indicates that the cause is nonexistent or unknown. */ public DatatypeConfigurationException(String message, Throwable cause) { super(message); initCauseByReflection(cause); }
public static XMLGregorianCalendar paraXMLGregorianCalendar(Calendar calendar) { XMLGregorianCalendar xmlGC = null; if (calendar != null) { final DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); final String data = df.format(calendar.getTime()); try { xmlGC = DatatypeFactory.newInstance().newXMLGregorianCalendar(data); } catch (DatatypeConfigurationException e) { LOGGER.error(e.getMessage(), e); } } return xmlGC; }