An exception of type DatatypeConfigurationException can occur only when a static method is called
DataTypeFatory factory = DataTypeFactory.newInstance();
Therefore, you should consider it only once . But you have to process it once , otherwise you will not be able to instantiate XMLGregorianCalendar at all.
Clear call
XMLGregorianCalendar xmlCal = factory.newXMLGregorianCalendar(new GregorianCalendar());
never throws a DatatypeConfigurationException , so you don't need to handle it when creating the XML views of your GregorianCalendar instances. - As from the Java SE API in the last call, only NullPointerException can appear.
source share