serge 01/11/01 09:45:38
Modified: src/java/org/apache/james/mailrepository
JDBCMailRepository.java
Log:
The way URL segments were being parsed wouldn't work with a repository name with a /
in it, which is what's expected to work with inboxes
Revision Changes Path
1.8 +21 -14
jakarta-james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
Index: JDBCMailRepository.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JDBCMailRepository.java 2001/11/01 04:55:32 1.7
+++ JDBCMailRepository.java 2001/11/01 17:45:38 1.8
@@ -132,18 +132,25 @@
}
// Build SqlParameters and get datasource name from URL parameters
- switch ( urlParams.size() ) {
- case 3:
- repositoryName = (String)urlParams.get(2);
- case 2:
- tableName = (String)urlParams.get(1);
- case 1:
- datasourceName = (String)urlParams.get(0);
- break;
- default:
+ if (urlParams.size() == 0) {
throw new ConfigurationException
- ("Malformed destinationURL - Must be of the format \"" +
- "db://<data-source>[/<table>[/<repositoryName>]]\".");
+ ("Malformed destinationURL - Must be of the format '" +
+ "db://<data-source>[/<table>[/<repositoryName>]]'. Was passed " +
conf.getAttribute("destinationURL"));
+ }
+ if (urlParams.size() >= 1) {
+ datasourceName = (String)urlParams.get(0);
+ }
+ if (urlParams.size() >= 2) {
+ tableName = (String)urlParams.get(1);
+ }
+ if (urlParams.size() >= 3) {
+ repositoryName = "";
+ for (int i = 2; i < urlParams.size(); i++) {
+ if (i >= 3) {
+ repositoryName += '/';
+ }
+ repositoryName += (String)urlParams.get(i);
+ }
}
getLogger().debug("Parsed URL: table = '" + tableName +
@@ -153,7 +160,7 @@
sqlFileName = conf.getChild("sqlFile").getValue();
if (!sqlFileName.startsWith("file://")) {
throw new ConfigurationException
- ("Malformed sqlFile - Must be of the format
\"file://<filename>\".");
+ ("Malformed sqlFile - Must be of the format 'file://<filename>'.");
}
}
@@ -248,8 +255,8 @@
createStatement.execute();
createStatement.close();
- getLogger().info("JdbcMailRepository: Created table \'" +
- tableName + "\'.");
+ getLogger().info("JdbcMailRepository: Created table '" +
+ tableName + "'.");
}
} finally {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>