quintonm 2003/03/08 21:57:09
Modified: src/java/org/apache/turbine/util/template TemplateLink.java
Log:
toString() now calls assertInitialized() to ensure that init90
has been called.
Renamed parameter of setPage(String) to template
Revision Changes Path
1.5 +15 -9
jakarta-turbine-2/src/java/org/apache/turbine/util/template/TemplateLink.java
Index: TemplateLink.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/template/TemplateLink.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TemplateLink.java 9 Mar 2003 02:54:14 -0000 1.4
+++ TemplateLink.java 9 Mar 2003 05:57:08 -0000 1.5
@@ -81,6 +81,7 @@
{
/** the pathinfo key stored in the DynamicURI */
private static final String TEMPLATE_KEY = "template";
+
/** cache of the template name for getPage() */
private String template = null;
@@ -114,7 +115,7 @@
}
/**
- * This will initialise a TemplateLink object that was
+ * This will initialize a TemplateLink object that was
* constructed with the default constructor (ApplicationTool
* method).
*
@@ -122,9 +123,11 @@
*/
public void init(Object data)
{
- // we just blithely cast to RunData as if another object
- // or null is passed in we'll throw an appropriate runtime
- // exception.
+ if(!(data instanceof RunData) || data == null)
+ {
+ throw new IllegalArgumentException(
+ "Argument must be an instance of RunData");
+ }
super.init((RunData) data);
}
@@ -140,6 +143,8 @@
* This will turn off the execution of res.encodeURL()
* by making res == null. This is a hack for cases
* where you don't want to see the session information
+ *
+ * @return instance of TemplateLink
*/
public TemplateLink setEncodeURLOff()
{
@@ -150,13 +155,13 @@
/**
* Sets the template variable used by the Template Service.
*
- * @param t A String with the template name.
+ * @param template A String with the template name.
* @return A TemplateLink.
*/
- public TemplateLink setPage(String t)
+ public TemplateLink setPage(String template)
{
- template = t;
- addPathInfo(TEMPLATE_KEY, t);
+ this.template = template;
+ addPathInfo(TEMPLATE_KEY, template);
return this;
}
@@ -180,6 +185,7 @@
*/
public String toString()
{
+ assertInitialized();
String output = super.toString();
// This was added to allow multilple $link variables in one
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]