Be more specific in declaration of thrown Exceptions
This commit is contained in:
parent
a9aab2798a
commit
01016e6236
3 changed files with 21 additions and 14 deletions
|
@ -18,6 +18,9 @@ package helma.objectmodel;
|
|||
|
||||
import helma.objectmodel.INode;
|
||||
import helma.objectmodel.db.IDGenerator;
|
||||
import java.io.IOException;
|
||||
import org.xml.sax.SAXException;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
/**
|
||||
* Interface that is implemented by Database wrappers
|
||||
|
@ -36,10 +39,10 @@ public interface IDatabase {
|
|||
*
|
||||
* @return ...
|
||||
*
|
||||
* @throws Exception ...
|
||||
* @throws IOException ...
|
||||
*/
|
||||
public IDGenerator getIDGenerator(ITransaction transaction)
|
||||
throws Exception;
|
||||
throws IOException, ObjectNotFoundException;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -47,14 +50,15 @@ public interface IDatabase {
|
|||
* @param transaction ...
|
||||
* @param idgen ...
|
||||
*
|
||||
* @throws Exception ...
|
||||
* @throws IOException ...
|
||||
*/
|
||||
public void saveIDGenerator(ITransaction transaction, IDGenerator idgen)
|
||||
throws Exception;
|
||||
throws IOException;
|
||||
|
||||
// node-related
|
||||
public INode getNode(ITransaction transaction, String key)
|
||||
throws Exception;
|
||||
throws IOException, ObjectNotFoundException,
|
||||
SAXException, ParserConfigurationException;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -63,10 +67,10 @@ public interface IDatabase {
|
|||
* @param key ...
|
||||
* @param node ...
|
||||
*
|
||||
* @throws Exception ...
|
||||
* @throws IOException ...
|
||||
*/
|
||||
public void saveNode(ITransaction transaction, String key, INode node)
|
||||
throws Exception;
|
||||
throws IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -74,10 +78,10 @@ public interface IDatabase {
|
|||
* @param transaction ...
|
||||
* @param key ...
|
||||
*
|
||||
* @throws Exception ...
|
||||
* @throws IOException ...
|
||||
*/
|
||||
public void deleteNode(ITransaction transaction, String key)
|
||||
throws Exception;
|
||||
throws IOException;
|
||||
|
||||
// transaction-related
|
||||
public ITransaction beginTransaction();
|
||||
|
|
|
@ -22,6 +22,8 @@ import org.w3c.dom.Document;
|
|||
import org.w3c.dom.Element;
|
||||
import java.io.*;
|
||||
import java.util.Date;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* A simple XML-database
|
||||
|
@ -138,7 +140,7 @@ public final class XmlDatabase implements IDatabase {
|
|||
* @throws Exception ...
|
||||
*/
|
||||
public void saveIDGenerator(ITransaction txn, IDGenerator idgen)
|
||||
throws Exception {
|
||||
throws IOException {
|
||||
File file = new File(dbBaseDir, "idgen.xml");
|
||||
|
||||
IDGenParser.saveIDGenerator(idgen, file);
|
||||
|
@ -157,7 +159,8 @@ public final class XmlDatabase implements IDatabase {
|
|||
* @throws ObjectNotFoundException ...
|
||||
*/
|
||||
public INode getNode(ITransaction txn, String kstr)
|
||||
throws Exception {
|
||||
throws IOException, ObjectNotFoundException,
|
||||
ParserConfigurationException, SAXException {
|
||||
File f = new File(dbBaseDir, kstr + ".xml");
|
||||
|
||||
if (!f.exists()) {
|
||||
|
@ -185,7 +188,7 @@ public final class XmlDatabase implements IDatabase {
|
|||
* @throws Exception ...
|
||||
*/
|
||||
public void saveNode(ITransaction txn, String kstr, INode node)
|
||||
throws Exception {
|
||||
throws IOException {
|
||||
XmlWriter writer = null;
|
||||
File file = new File(dbBaseDir, kstr + ".xml");
|
||||
|
||||
|
@ -211,7 +214,7 @@ public final class XmlDatabase implements IDatabase {
|
|||
* @throws Exception ...
|
||||
*/
|
||||
public void deleteNode(ITransaction txn, String kstr)
|
||||
throws Exception {
|
||||
throws IOException {
|
||||
File f = new File(dbBaseDir, kstr + ".xml");
|
||||
|
||||
f.delete();
|
||||
|
|
|
@ -64,7 +64,7 @@ public class IDGenParser {
|
|||
* @throws Exception ...
|
||||
*/
|
||||
public static IDGenerator saveIDGenerator(IDGenerator idgen, File file)
|
||||
throws Exception {
|
||||
throws IOException {
|
||||
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file));
|
||||
|
||||
out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue