Java Code Examples for com.thoughtworks.xstream.converters.ConversionException#getMessage()
The following examples show how to use
com.thoughtworks.xstream.converters.ConversionException#getMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Tracer.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * decodes * <code>Tracer</code> from * <code>file</code> specified by argument * <code>filename</code> * * @param filename location to read data from * @param doValidate the value of doValidate * @return * <code>Object</code> - the * <code>Tracer</code> created from the specified XML * <code>file</code> * @throws java.io.FileNotFoundException * @throws org.earthtime.XMLExceptions.ETException * @throws org.earthtime.XMLExceptions.BadOrMissingXMLSchemaException @pre * <code>filename</code> references an XML * <code>file</code> @post * <code>Tracer</code> stored in * <code>filename</code> is returned */ @Override public Object readXMLObject ( String filename, boolean doValidate ) throws FileNotFoundException, ETException, BadOrMissingXMLSchemaException { Tracer myTracer = null; BufferedReader reader = URIHelper.getBufferedReader( filename ); if ( reader != null ) { XStream xstream = getXStreamReader(); boolean temp = URIHelper.validateXML( reader, filename, tracerXMLSchemaURL ); if ( temp ) { // re-create reader reader = URIHelper.getBufferedReader( filename ); try { myTracer = (Tracer) xstream.fromXML( reader ); } catch (ConversionException e) { throw new ETException( null, e.getMessage() ); } // System.out.println( "This is your Tracer that was just read successfully:\n" ); // String xml2 = getXStreamWriter().toXML( myTracer ); // // System.out.println( xml2 ); // System.out.flush(); } else { throw new ETException( null, "Badly formed XML data file." ); } } else { throw new FileNotFoundException( "Missing XML data file." ); } return myTracer; }
Example 2
Source File: SesarSample.java From ET_Redux with Apache License 2.0 | 5 votes |
public static Object readXMLObject(String filename) throws FileNotFoundException, ETException { SesarSample sesarSample = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { XStream xstream = getXStreamReader(); try { sesarSample = (SesarSample) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } // System.out.println("\nThis is your SesarSample that was just read successfully:\n"); // String xml2 = getXStreamWriter().toXML(sesarSample); // // System.out.println(xml2); // System.out.flush(); } else { throw new FileNotFoundException("Missing XML data file."); } return sesarSample; }
Example 3
Source File: ReportSettingsInterface.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * * @param filename * @param doValidate the value of doValidate * @return * @throws FileNotFoundException * @throws ETException * @throws BadOrMissingXMLSchemaException */ @Override public default Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { ReportSettingsInterface myReportSettings = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean isValidOrAirplaneMode = true; XStream xstream = getXStreamReader(); if (doValidate) { isValidOrAirplaneMode = URIHelper.validateXML(reader, filename, getReportSettingsXMLSchemaURL()); } if (isValidOrAirplaneMode) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { myReportSettings = (ReportSettingsInterface) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } } else { throw new ETException(null, "XML data file does not conform to schema."); } } else { throw new FileNotFoundException("Missing XML data file."); } return myReportSettings; }
Example 4
Source File: AbstractRatiosDataModel.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * decodes <code>AbstractRatiosDataModel</code> from <code>file</code> * specified by argument <code>filename</code> * * @throws org.earthtime.exceptions.ETException * @pre <code>filename</code> references an XML <code>file</code> * @post <code>AbstractRatiosDataModel</code> stored in * <code>filename</code> is returned * * @param filename location to read data from * @param doValidate * @return <code>Object</code> - the <code>AbstractRatiosDataModel</code> * created from the specified XML <code>file</code> * @throws java.io.FileNotFoundException * @throws org.earthtime.XMLExceptions.BadOrMissingXMLSchemaException */ @Override public AbstractRatiosDataModel readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, BadOrMissingXMLSchemaException { AbstractRatiosDataModel myModelClassInstance = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { XStream xstream = getXStream(); boolean isValidOrAirplaneMode = true; if (doValidate) { isValidOrAirplaneMode = URIHelper.validateXML(reader, filename, XMLSchemaURL); } if (isValidOrAirplaneMode) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { myModelClassInstance = (AbstractRatiosDataModel) xstream.fromXML(reader); myModelClassInstance.initializeModel(); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } } else { throw new ETException(null, "XML data file does not conform to schema."); } } else { throw new FileNotFoundException("Missing XML data file."); } return myModelClassInstance; }
Example 5
Source File: SESARSampleMetadata.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * decodes <code>SESARSampleMetadata</code> from <code>file</code> specified * by argument <code>filename</code> * * @param filename location to read data from * @param doValidate the value of doValidate * @return <code>Object</code> - the <code>SESARSampleMetadata</code> * created from the specified XML <code>file</code> * @throws java.io.FileNotFoundException * @throws org.earthtime.XMLExceptions.BadOrMissingXMLSchemaException * @pre <code>filename</code> references an XML <code>file</code> * @post <code>SESARSampleMetadata</code> stored in <code>filename</code> is * returned */ public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { SESARSampleMetadata SESARSampleMetadata = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean isValidOrAirplaneMode = true; XStream xstream = getXStreamReader(); if (doValidate) { isValidOrAirplaneMode = URIHelper.validateXML(reader, filename, SESARSampleMetadataSchemaURL); } if (isValidOrAirplaneMode) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { SESARSampleMetadata = (SESARSampleMetadata) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } // System.out.println("This is your SESARSampleMetadata that was just read successfully:\n"); // String xml2 = getXStreamWriter().toXML(SESARSampleMetadata); // // System.out.println(xml2); // System.out.flush(); } else { throw new ETException(null, "XML data file does not conform to schema."); } } else { throw new FileNotFoundException("Missing XML data file."); } return SESARSampleMetadata; }
Example 6
Source File: SampleMetaData.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * decodes <code>ValueModel</code> from <code>file</code> specified by * argument <code>filename</code> * * @param filename location to read data from * @param doValidate the value of doValidate * @return <code>Object</code> - the <code>ValueModel</code> created from * the specified XML <code>file</code> * @throws java.io.FileNotFoundException * @throws org.earthtime.XMLExceptions.BadOrMissingXMLSchemaException * @pre <code>filename</code> references an XML <code>file</code> * @post <code>ValueModel</code> stored in <code>filename</code> is returned */ public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { SampleMetaData mySampleMetaData = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean validXML = false; XStream xstream = getXStreamReader(); validXML = true;//URIHelper.validateXML(reader, getSampleMetaDataXMLSchemaURL()); if (validXML) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { mySampleMetaData = (SampleMetaData) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } // System.out.println("\nThis is your SampleMetaData that was just read successfully:\n"); // String xml2 = getXStreamWriter().toXML(mySampleMetaData); // // System.out.println(xml2); // System.out.flush(); } } else { throw new FileNotFoundException("Badly formed or missing XML data file."); } return mySampleMetaData; }
Example 7
Source File: UPbReduxAliquot.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * @param filename * @param doValidate * @return * @throws FileNotFoundException * @throws ETException * @throws BadOrMissingXMLSchemaException */ @Override public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { AliquotInterface myAliquot = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean isValidOrAirplaneMode = true; XStream xstream = getXStreamReader(); if (doValidate) { isValidOrAirplaneMode = URIHelper.validateXML(reader, filename, aliquotXMLSchemaURL); } if (isValidOrAirplaneMode) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { myAliquot = (AliquotInterface) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } } else { throw new ETException(null, "XML data file does not conform to schema."); } } else { throw new FileNotFoundException("Missing XML data file."); } return myAliquot; }
Example 8
Source File: UPbFraction.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * @param filename * @param doValidate * @return * @throws FileNotFoundException * @throws ETException * @throws BadOrMissingXMLSchemaException */ @Override public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { FractionI myUPbReduxFraction = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean isValidOrAirplaneMode = true; XStream xstream = getXStreamReader(); if (doValidate) { isValidOrAirplaneMode = URIHelper.validateXML(reader, filename, XMLSchemaURL); } if (isValidOrAirplaneMode) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { myUPbReduxFraction = (FractionI) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } } else { throw new ETException(null, "XML data file does not conform to schema."); } } else { throw new FileNotFoundException("Missing XML data file."); } return myUPbReduxFraction; }
Example 9
Source File: PhysicalConstants.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * * @param filename * @param doValidate the value of doValidate * @return * @throws FileNotFoundException * @throws ETException * @throws BadOrMissingXMLSchemaException */ public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, BadOrMissingXMLSchemaException { PhysicalConstants myPhysicalConstants = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean temp = false; XStream xstream = getXStreamReader(); temp = URIHelper.validateXML(reader, filename, physicalConstantsXMLSchemaURL); if (temp) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { myPhysicalConstants = (PhysicalConstants) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } // System.out.println("This is your PhysicalConstants that was just read successfully:\n"); // String xml2 = getXStreamWriter().toXML(myPhysicalConstants); // // System.out.println(xml2); // System.out.flush(); } else { throw new ETException(null, "Badly formed PhysicalConstants XML data file."); } } else { throw new FileNotFoundException("Missing XML data file."); } return myPhysicalConstants; }
Example 10
Source File: InitialPbModel.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * * @param filename * @param doValidate the value of doValidate * @return * @throws FileNotFoundException * @throws ETException * @throws BadOrMissingXMLSchemaException */ public Object readXMLObject ( String filename, boolean doValidate ) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { InitialPbModel myInitialPbModel = null; BufferedReader reader = URIHelper.getBufferedReader( filename ); if ( reader != null ) { boolean temp = false; XStream xstream = getXStreamReader(); temp = URIHelper.validateXML( reader, filename, initialPbModelXMLSchemaURL ); if ( temp ) { // re-create reader reader = URIHelper.getBufferedReader( filename ); try { myInitialPbModel = (InitialPbModel) xstream.fromXML( reader ); } catch (ConversionException e) { throw new ETException( null, e.getMessage() ); } // System.out.println( "This is your InitialPbModel that was just read successfully:\n" ); // // String xml2 = getXStreamWriter().toXML( myInitialPbModel ); // // System.out.println( xml2 ); // System.out.flush(); } } else { throw new FileNotFoundException( "Badly formed or missing XML data file." ); } return myInitialPbModel; }
Example 11
Source File: ValueModel.java From ET_Redux with Apache License 2.0 | 5 votes |
@Override public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { ValueModel myValueModel = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean isValidOrAirplaneMode = true; XStream xstream = getXStreamReader(); if (doValidate) { isValidOrAirplaneMode = validateXML(filename); } if (isValidOrAirplaneMode) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { myValueModel = (ValueModel) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } } else { throw new ETException(null, "XML data file does not conform to schema."); } } else { throw new FileNotFoundException("Missing XML data file."); } return myValueModel; }
Example 12
Source File: ValueModelReferenced.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * decodes <code>ValueModelReferenced</code> from <code>file</code> * specified by argument <code>filename</code> * * @param filename location to read data from * @param doValidate the value of doValidate * @return <code>Object</code> - the <code>ValueModelReferenced</code> * created from the specified XML <code>file</code> * @throws java.io.FileNotFoundException * @throws org.earthtime.XMLExceptions.BadOrMissingXMLSchemaException @pre * <code>filename</code> references an XML <code>file</code> @post * <code>ValueModelReferenced</code> stored in <code>filename</code> is * returned */ @Override public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { ValueModel myValueModel = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean isValidOrAirplaneMode = true; XStream xstream = getXStreamReader(); if (doValidate) { isValidOrAirplaneMode = URIHelper.validateXML(reader, filename, getValueModelXMLSchemaURL()); } if (isValidOrAirplaneMode) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { myValueModel = (ValueModelReferenced) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } // System.out.println( "\nThis is your ValueModelReferenced that was just read successfully:\n" ); // String xml2 = getXStreamWriter().toXML( myValueModel ); // // System.out.println( xml2 ); // System.out.flush(); } else { throw new ETException(null, "XML data file does not conform to schema."); } } else { throw new FileNotFoundException("Missing XML data file."); } return myValueModel; }
Example 13
Source File: MeasuredRatioModel.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * decodes <code>MeasuredRatioModel</code> from <code>file</code> specified * by argument <code>filename</code> * * @param filename location to read data from * @param doValidate the value of doValidate * @return <code>Object</code> - the <code>MeasuredRatioModel</code> created * from the specified XML <code>file</code> * @throws java.io.FileNotFoundException * @throws org.earthtime.XMLExceptions.BadOrMissingXMLSchemaException * @pre <code>filename</code> references an XML <code>file</code> * @post <code>MeasuredRatioModel</code> stored in <code>filename</code> is * returned */ @Override public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { ValueModel myValueModel = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean isValidOrAirplaneMode = true; XStream xstream = getXStreamReader(); if (doValidate) { isValidOrAirplaneMode = URIHelper.validateXML(reader, filename, getValueModelXMLSchemaURL()); } if (isValidOrAirplaneMode) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { myValueModel = (MeasuredRatioModel) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } //// System.out.println( "\nThis is your MeasuredRatioModel that was just read successfully:\n" ); // String xml2 = getXStreamWriter().toXML( myValueModel ); // // System.out.println( xml2 ); // System.out.flush(); } else { throw new ETException(null, "XML data file does not conform to schema."); } } else { throw new FileNotFoundException("Missing XML data file."); } return myValueModel; }
Example 14
Source File: MineralStandardModel.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * * @param filename * @param doValidate the value of doValidate * @return * @throws FileNotFoundException * @throws ETException * @throws BadOrMissingXMLSchemaException */ @Override public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { MineralStandardModel myMineralStandardModel = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean temp = true; XStream xstream = getXStreamReader(); if (doValidate) { temp = URIHelper.validateXML(reader, filename, mineralStandardModelXMLSchemaURL); } if (temp) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { myMineralStandardModel = (MineralStandardModel) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } } else { throw new FileNotFoundException("Badly formed or unvalidated XML data file."); } } else { throw new FileNotFoundException("Missing XML data file."); } return myMineralStandardModel; }
Example 15
Source File: PbBlank.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * decodes <code>PbBlank</code> from <code>file</code> specified by argument * <code>filename</code> * * @param filename location to read data from * @param doValidate the value of doValidate * @return <code>Object</code> - the <code>PbBlank</code> created from the * specified XML <code>file</code> * @throws java.io.FileNotFoundException * @throws org.earthtime.XMLExceptions.BadOrMissingXMLSchemaException @pre * <code>filename</code> references an XML <code>file</code> @post * <code>PbBlank</code> stored in <code>filename</code> is returned */ public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { PbBlank retPbBlank = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean validXML = true; XStream xstream = getXStreamReader(); if (doValidate) { validXML = URIHelper.validateXML(reader, filename, PbBlankXMLSchemaURL); } if (validXML) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { retPbBlank = (PbBlank) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } // System.out.println( "This is your PbBlank that was just read successfully:\n" ); // String xml2 = getXStreamWriter().toXML( retPbBlank ); // // System.out.println( xml2 ); // System.out.flush(); } } else { throw new FileNotFoundException("Badly formed or missing XML data file."); } return retPbBlank; }
Example 16
Source File: UThReduxAliquot.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * @param filename * @param doValidate * @return * @throws FileNotFoundException * @throws ETException * @throws BadOrMissingXMLSchemaException */ @Override public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { AliquotInterface myAliquot = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean isValidOrAirplaneMode = true; XStream xstream = getXStreamReader(); if (doValidate) { isValidOrAirplaneMode = URIHelper.validateXML(reader, filename, aliquotUThXMLSchemaURL); } if (isValidOrAirplaneMode) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { myAliquot = (AliquotInterface) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } } else { throw new ETException(null, "XML data file does not conform to schema."); } } else { throw new FileNotFoundException("Missing XML data file."); } return myAliquot; }
Example 17
Source File: AnalysisFraction.java From ET_Redux with Apache License 2.0 | 4 votes |
/** * * @param filename * @param doValidate * @return * @throws FileNotFoundException * @throws ETException * @throws BadOrMissingXMLSchemaException */ @Override public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, FileNotFoundException, BadOrMissingXMLSchemaException { FractionI myFraction = null; BufferedReader reader = URIHelper.getBufferedReader(filename); if (reader != null) { boolean isValidOrAirplaneMode = true; XStream xstream = getXStreamReader(); if (doValidate) { isValidOrAirplaneMode = URIHelper.validateXML(reader, filename, analysisFractionXMLSchemaURL); } if (isValidOrAirplaneMode) { // re-create reader reader = URIHelper.getBufferedReader(filename); try { myFraction = (FractionI) xstream.fromXML(reader); } catch (ConversionException e) { throw new ETException(null, e.getMessage()); } // System.out.println( "This is your AnalysisFraction that was just read successfully:\n" ); // // String xml2 = getXStreamWriter().toXML( myFraction ); // // System.out.println( xml2 ); // System.out.flush(); } else { throw new ETException(null, "XML data file does not conform to schema."); } } else { throw new FileNotFoundException("Missing XML data file."); } return myFraction; }