本文整理汇总了Java中javax.xml.bind.JAXBException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java JAXBException.printStackTrace方法的具体用法?Java JAXBException.printStackTrace怎么用?Java JAXBException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.bind.JAXBException
的用法示例。
在下文中一共展示了JAXBException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadLayerQuery
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
public QueryConfiguration loadLayerQuery() {
QueryConfiguration queryConfiguration;
if (this.geodirLayerManager.getLayerConfiguration().getLayer() != null) {
File file = new File(this.geodirLayerManager.getLayerConfiguration().getLayer().getPath() + "/"
+ this.queryDirectory + "/" + this.queryFileConf + ".xml");
if (file.exists()) {
try {
JAXBContext jaxbContext = JAXBContext.newInstance(QueryConfiguration.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
queryConfiguration = (QueryConfiguration) jaxbUnmarshaller.unmarshal(file);
} catch (JAXBException e) {
e.printStackTrace();
queryConfiguration = new QueryConfiguration();
}
} else {
queryConfiguration = new QueryConfiguration();
}
} else {
queryConfiguration = new QueryConfiguration();
}
return queryConfiguration;
}
示例2: objectToXMLFile
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
public static void objectToXMLFile(ObjectLanguageInstance o)
{
String concept = o.uniqueID;
int ind = concept.indexOf("/");
String instance = concept.substring(ind+1);
concept = concept.substring(0,ind);
String instancepath = "Concepts/"+concept+"/instances/"+instance;
String datapath = instancepath+"/data.xml";
try {
JAXBContext context = JAXBContext.newInstance(ObjectLanguageInstance.class);
Marshaller m = context.createMarshaller();
//for pretty-print XML in JAXB
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
// Write to System.out for debugging
// m.marshal(emp, System.out);
// Write to File
m.marshal(o, new File(datapath));
} catch (JAXBException e) {
e.printStackTrace();
}
}
示例3: convertToObject
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
/**
* XML to Object
* @param <T> T
* @param clazz clazz
* @param reader reader
* @return T
*/
@SuppressWarnings("unchecked")
public static <T> T convertToObject(Class<T> clazz,Reader reader){
try {
Map<Class<?>, Unmarshaller> uMap = uMapLocal.get();
if(!uMap.containsKey(clazz)){
JAXBContext jaxbContext = JAXBContext.newInstance(clazz);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
uMap.put(clazz, unmarshaller);
}
return (T) uMap.get(clazz).unmarshal(reader);
} catch (JAXBException e) {
e.printStackTrace();
}
return null;
}
示例4: printLogAndReturn
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
/**
* Print the created XML to verify. Usage: return printLogAndReturn(new JAXBElement(rootElementName, StoreOperationInput.class, input));
*
* @return JAXBElement - same object which came as input.
*/
private static JAXBElement printLogAndReturn(JAXBElement jaxbElement) {
try {
// Create a String writer object which will be
// used to write jaxbElment XML to string
StringWriter writer = new StringWriter();
// create JAXBContext which will be used to update writer
JAXBContext context = JAXBContext.newInstance(StoreOperationInput.class);
// marshall or convert jaxbElement containing student to xml format
context.createMarshaller().marshal(jaxbElement, writer);
// print XML string representation of Student object
System.out.println(writer.toString());
}
catch (JAXBException e) {
e.printStackTrace();
}
return jaxbElement;
}
示例5: main
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
public static void main(String[] args) {
Customer customer = new Customer();
customer.setId(100);
customer.setName("mkyong");
customer.setAge(29);
try {
File file = new File("file.xml");
JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
// output pretty printed
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
jaxbMarshaller.marshal(customer, file);
jaxbMarshaller.marshal(customer, System.out);
} catch (JAXBException e) {
e.printStackTrace();
}
}
示例6: AddToHighScore
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
public static void AddToHighScore(int celban, int lepes, LocalDateTime datum, String nev) {
Player player = new Player();
player.setCelban(celban);
player.setNev(nev);
player.setDatum(datum.toString());
player.setLepes(lepes);
players.getPlayers().add(player);
try {
jaxbMarshaller.marshal(players, file);
jaxbMarshaller.marshal(players, System.out);
} catch (JAXBException e) {
e.printStackTrace();
}
}
示例7: serialize
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
private String serialize() {
try {
JAXBContext jc = JAXBContext.newInstance(MintleafXmlConfiguration.class);
Marshaller marshaller = jc.createMarshaller();
StringWriter sw = new StringWriter();
marshaller.marshal(this, sw);
return sw.toString();
} catch (JAXBException e) {
e.printStackTrace();
}
return null;
}
示例8: parse
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
/**
* Parses the given XML document to a valid message object.
* @param doc the XML message to parse
* @param context specific message content classes used for this message
* @return a message object according to the XML file or null if sth. went wrong
*/
public static Message parse(Document doc, Class... context) {
if (doc == null) return null;
try {
Class[] contextClasses = Arrays.copyOf(context, context.length + 1);
contextClasses[contextClasses.length - 1] = Message.class;
JAXBContext jc = JAXBContext.newInstance(contextClasses);
return (Message) jc.createUnmarshaller().unmarshal(doc);
} catch (JAXBException e) {
e.printStackTrace();
}
return null;
}
示例9: main
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
public static void main(String args[]){
try {
SumoAnnotationReader reader=new SumoAnnotationReader("C://tmp//sumo_images//S1_PRF_SWATH_DEVEL//S1A_IW_GRDH_1SDV_20150219T053530_20150219T053555_004688_005CB5_3904.SAFE//annotation//s1a-iw-grd-vv-20150219t053530-20150219t053555-004688-005cb5-001.xml");
List<OrbitType>orbits=reader.getOrbits();
//List<SwathMergeType> o=reader.getSwathMerges();
System.out.println(orbits.toString());
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例10: getSingletons
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
@Override
public Set<Object> getSingletons() {
try {
return new HashSet<Object>(Arrays.asList(new WebDavContextResolver(Win32LastAccessTime.class)));
} catch (JAXBException e) {
e.printStackTrace();
return null;
}
}
示例11: unmarshall
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
/**
* @param is
* @return ODM object
* @throws JAXBException
*/
public static ODM unmarshall(InputStream is) throws JAXBException {
ODM odm = new ODM();
try {
JAXBContext context = JAXBContext.newInstance("org.cdisc.ns.odm.v1");
Unmarshaller unmarshaller = context.createUnmarshaller();
odm = (ODM) unmarshaller.unmarshal(is);
} catch (JAXBException jaxbEx) {
jaxbEx.printStackTrace();
}
return odm;
}
示例12: marshall
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
/**
* @param odm
* @param writer
* @throws JAXBException
*/
public static void marshall(Object odm, Writer writer) throws JAXBException {
try {
JAXBContext context = JAXBContext.newInstance("org.cdisc.ns.odm.v1");
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty("jaxb.formatted.output", Boolean.TRUE);
// marshaller.marshal(odm, System.out);
marshaller.marshal(odm, writer);
} catch (JAXBException jaxbEx) {
jaxbEx.printStackTrace();
}
}
示例13: createJaxbContext
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
private static JAXBContext createJaxbContext(boolean disableXmlSecurity) {
Class[] cls = {ObjectFactory.class};
try {
if (disableXmlSecurity) {
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(JAXBRIContext.DISABLE_XML_SECURITY, disableXmlSecurity);
return JAXBContext.newInstance(cls, properties);
} else {
return JAXBContext.newInstance(cls);
}
} catch (JAXBException e) {
e.printStackTrace();
return null;
}
}
示例14: parseXml
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
private static PairFunction<Tuple2<String, String>, String, ExampleXML> parseXml() {
ParseXML parser = new ParseXML();
return tuple -> {
try {
return new Tuple2<>(tuple._1(), parser.call(tuple._2()));
} catch(JAXBException badXML) {
System.err.printf("Bad XML at %s\n", tuple._1());
badXML.printStackTrace();
return null;
}
};
}
示例15: configure
import javax.xml.bind.JAXBException; //导入方法依赖的package包/类
public void configure(){
try {
loadMenu();
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Command command = new Command("--script-help all");
CommandExecutor executor = new CommandExecutorImpl(command);
executor.addObserver(this);
executor.execute();
}