You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2004/08/16 14:21:37 UTC
cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/publication DefaultDocument.java
andreas 2004/08/16 05:21:37
Modified: src/java/org/apache/lenya/cms/publication
DefaultDocument.java
Log:
replaced important assertions with exceptions
Revision Changes Path
1.43 +23 -10 cocoon-lenya/src/java/org/apache/lenya/cms/publication/DefaultDocument.java
Index: DefaultDocument.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/publication/DefaultDocument.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- DefaultDocument.java 21 May 2004 12:26:34 -0000 1.42
+++ DefaultDocument.java 16 Aug 2004 12:21:37 -0000 1.43
@@ -39,11 +39,16 @@
* @deprecated Use {@link DefaultDocumentBuilder} instead.
*/
public DefaultDocument(Publication publication, String id) {
- assert id != null;
- assert id.startsWith("/");
+
+ if (id == null) {
+ throw new IllegalArgumentException("The document ID must not be null!");
+ }
+ if (!id.startsWith("/")) {
+ throw new IllegalArgumentException("The document ID must start with a slash!");
+ }
this.id = id;
- assert(publication != null) && !"".equals(publication);
+ assert(publication != null) && !"".equals(publication.getId());
this.publication = publication;
this.dublincore = new DublinCoreProxy(this);
}
@@ -57,11 +62,15 @@
* @param area The area.
*/
protected DefaultDocument(Publication publication, String id, String area) {
- assert id != null;
- assert id.startsWith("/");
+ if (id == null) {
+ throw new IllegalArgumentException("The document ID must not be null!");
+ }
+ if (!id.startsWith("/")) {
+ throw new IllegalArgumentException("The document ID must start with a slash!");
+ }
this.id = id;
- assert(publication != null) && !"".equals(publication);
+ assert(publication != null) && !"".equals(publication.getId());
this.publication = publication;
setArea(area);
@@ -80,11 +89,15 @@
* @param language the language
*/
protected DefaultDocument(Publication publication, String id, String area, String language) {
- assert id != null;
- assert id.startsWith("/");
+ if (id == null) {
+ throw new IllegalArgumentException("The document ID must not be null!");
+ }
+ if (!id.startsWith("/")) {
+ throw new IllegalArgumentException("The document ID must start with a slash!");
+ }
this.id = id;
- assert(publication != null) && !"".equals(publication);
+ assert(publication != null) && !"".equals(publication.getId());
this.publication = publication;
this.language = language;
setArea(area);
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org