You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by br...@apache.org on 2004/06/09 22:00:44 UTC
cvs commit: db-ojb/src/java/org/apache/ojb/broker/query QueryByCriteria.java ReportQueryByCriteria.java
brj 2004/06/09 13:00:44
Modified: src/java/org/apache/ojb/broker/query QueryByCriteria.java
ReportQueryByCriteria.java
Log:
fixed toString() to prevent NPE
Revision Changes Path
1.26 +9 -2 db-ojb/src/java/org/apache/ojb/broker/query/QueryByCriteria.java
Index: QueryByCriteria.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/query/QueryByCriteria.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- QueryByCriteria.java 4 Apr 2004 23:53:36 -0000 1.25
+++ QueryByCriteria.java 9 Jun 2004 20:00:44 -0000 1.26
@@ -286,7 +286,14 @@
*/
public String toString()
{
- return "Query from " + getBaseClass() + " where " + m_criteria;
+ StringBuffer buf = new StringBuffer("QueryByCriteria from ");
+ buf.append(getSearchClass() + " ");
+ if (getCriteria() != null && !getCriteria().isEmpty())
+ {
+ buf.append(" where " + getCriteria());
+ }
+
+ return buf.toString();
}
/**
1.10 +12 -6 db-ojb/src/java/org/apache/ojb/broker/query/ReportQueryByCriteria.java
Index: ReportQueryByCriteria.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/query/ReportQueryByCriteria.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ReportQueryByCriteria.java 4 Apr 2004 23:53:36 -0000 1.9
+++ ReportQueryByCriteria.java 9 Jun 2004 20:00:44 -0000 1.10
@@ -159,12 +159,18 @@
String[] cols = getAttributes();
StringBuffer buf = new StringBuffer("ReportQuery from ");
buf.append(getSearchClass() + " ");
- for (int i = 0; i < cols.length; i++)
+ if (cols != null)
{
- buf.append(cols[i] + " ");
- }
- buf.append(" where " + getCriteria());
-
+ for (int i = 0; i < cols.length; i++)
+ {
+ buf.append(cols[i] + " ");
+ }
+ }
+ if (getCriteria() != null && !getCriteria().isEmpty())
+ {
+ buf.append(" where " + getCriteria());
+ }
+
return buf.toString();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org