本文整理汇总了Java中org.dom4j.DocumentException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentException.getMessage方法的具体用法?Java DocumentException.getMessage怎么用?Java DocumentException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dom4j.DocumentException
的用法示例。
在下文中一共展示了DocumentException.getMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nullSafeGet
import org.dom4j.DocumentException; //导入方法依赖的package包/类
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws SQLException {
Clob clob = rs.getClob(names[0]);
if (clob==null) return null;
try {
SAXReader reader = new SAXReader();
Document document = reader.read(clob.getCharacterStream());
return document;
} catch (DocumentException e) {
throw new HibernateException(e.getMessage(),e);
}
}
示例2: assemble
import org.dom4j.DocumentException; //导入方法依赖的package包/类
public Object assemble(Serializable cached, Object owner) throws HibernateException {
try {
if (cached==null) return null;
ByteArrayInputStream in = new ByteArrayInputStream((byte[])cached);
SAXReader reader = new SAXReader();
// GZIPInputStream gzipInput = new GZIPInputStream(in);
Document document = reader.read(in);
// gzipInput.close();
return document;
} catch (DocumentException e) {
throw new HibernateException(e.getMessage(),e);
// } catch (IOException e) {
// throw new HibernateException(e.getMessage(),e);
}
}
示例3: getRequest
import org.dom4j.DocumentException; //导入方法依赖的package包/类
@Override
public Document getRequest(Type requestType) throws IOException {
Reader reader = iRequest.getReader();
try {
return new SAXReader().read(reader);
} catch (DocumentException e) {
throw new IOException(e.getMessage(), e);
} finally {
reader.close();
}
}
示例4: main
import org.dom4j.DocumentException; //导入方法依赖的package包/类
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
QLog.initial(args, 17);
Locale.setDefault(Locales.getInstance().getLangCurrent());
// проверить есть ли файл /config/clientboard.xml и если есть отправить его на редактирование
if (args.length < 2) {
throw new ServerException("No param '-tcfg' file for context.");
}
file = new File(QConfig.cfg().getTabloBoardCfgFile());
if (!file.exists()) {
throw new ServerException(
"File context \"" + QConfig.cfg().getTabloBoardCfgFile() + "\" not exist.");
}
QLog.l().logger().info("Load file: " + file.getAbsolutePath());
final SAXReader reader = new SAXReader(false);
try {
root = reader.read(file).getRootElement();
} catch (DocumentException ex) {
throw new ServerException("Wrong xml file. " + ex.getMessage());
}
/*
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {*/
final FBoardConfig bc = new FBoardConfigImpl(null, false);
bc.setTitle(bc.getTitle() + " " + file.getAbsolutePath());
bc.setParams(root);
Uses.setLocation(bc);
bc.setVisible(true);
/* }
});*/
}
示例5: getEditableDocument1
import org.dom4j.DocumentException; //导入方法依赖的package包/类
Document getEditableDocument1 (String filePath, MetaDataFramework framework) throws Exception, DocumentException {
String rawXml;
try {
rawXml = Files.readFile (filePath).toString();
} catch (IOException e) {
throw new Exception (e.getMessage());
}
rawXml = SchemEditUtils.expandAmpersands(rawXml);
// prtln (rawXml);
Document doc = null;
try {
doc = Dom4jUtils.getXmlDocument(rawXml);
} catch (DocumentException de) {
throw new Exception (de.getMessage());
}
// pp (doc);
Element root = doc.getRootElement();
Attribute schemaLocAtt = root.attribute ("schemaLocation");
if (schemaLocAtt == null) {
throw new Exception ("couldn't find schemaLocation attribute") ;
}
String targetNameSpace = schemaLocAtt.getText().split("\\s")[0];
// prtln ("Document target namespace: " + targetNameSpace);
String schemaLoc = schemaLocAtt.getText().split("\\s")[1];
// prtln ("Document schema location: " + schemaLoc);
String schemaHelperTNS = framework.getSchemaHelper().getTargetNamespace();
if (!targetNameSpace.equals(schemaHelperTNS)) {
throw new Exception ("document target namespace does not match schema helper (" + schemaHelperTNS + ")");
}
if (!schemaLoc.equals(framework.getSchemaURI())) {
throw new Exception ("schema location does not match metadata framework (" + framework.getSchemaURI() + ")");
}
// doc = Dom4jUtils.localizeXml(doc, root.getName());
doc = Dom4jUtils.localizeXml(doc);
pp (doc);
return doc;
}