Increase Plumtree Studio Character Limit

We don’t write much about Aqualogic Interaction Studio ’round these here parts anymore. That’s because Studio has long since been end-of-life’d (by BEA, even before the Oracle acquisition!). But, that doesn’t mean it isn’t alive and gasping its last breath in many of your portal sites. Sure, it’s an over-the-hill product but it does serve a functional need: the ability to easily create forms, polls, and other data entry forms.

So, it’s with reluctant enthusiasm that I start the first of a three-part series on “How to increase the 1,000 character limit in Plumtree Studio”. Even if you don’t actually use Studio, hopefully you’ll find the journey interesting and informative for your other portal diagnostic needs. I’ll walk you through the process of identifying the code here, recompiling and reintegrating in Part dos, then some SQL Server diagnostics in Part tres.

The problem, as recently presented by a client, was that Studio has a 1,000 character limit on text fields. If an end user tries to type more than 1,000 characters, they get this lovely message:

But, we needed to increase that value. While it would be really nice if there was just some configuration file somewhere, sadly, the 1,000 character limit is hard-coded. So we first need to find the file that’s producing this alert.

By observing the JavaScript on a portal page that has a Studio portlet, we find this:

<TEXTAREA ONBLUR="if (this.value.length > 1000) {alert('Values may not exceed 1,000 characters. Only the first 1,000 characters will be used.'); this.value = this.value.substring(0,999); }" CLASS="formTextboxText" ROWS="10" COLS="40" STYLE="width:210;height:65;overflow:auto;" NAME="PTS_Long_Text"></TEXTAREA>

Typically HTML like this is generated in a .JSP file. So, we download and crack open studio.war (extracting the entire file as if it was any other type of .zip file), and do a text search for some of the text above, such as “this.value.length”. No dice there, so we expand our search to .class files. Now, keep in mind that unlike .jsp files, .class files are compiled, and as such can’t be opened in a regular text editor. However, the string values appear in plain text, so this kind of search will at least help us find the correct file.

It was with this text search that I found: WEB-INF\classes\ com\plumtree\ studio\view\ html\HTMLFormField.class. Now, that sounds right – it is a form field we’re dealing with, after all – so I used jd-gui to decompile it, and found the following:

public static String genMaxLengthValidationJS(int maxLength)
{
  Object[] args = { new Integer(maxLength) };
  String js = "if (this.value.length > " + maxLength + ") {" + "alert('" + Server.getLocalStringJS("view.MAX_LENGTH_EXCEEDED", args) + "'); " + "this.value = this.value.substring(0," + (maxLength - 1) + "); }";

  return js;
}

public static String genMaxLengthValidationJS()
{
  int maxLength = Server.getTableDAO().getUserColumnWidthChars();
  return genMaxLengthValidationJS(maxLength);
}

So far so good. Now we need to track down the getUserColumnWidthChars() method, which was in the TableDAO.class file – at least this constant seems to exist in only one file without us having to change it all over the place!

  protected int mUserColumnWidth = 1000;
  protected int mUserColumnWidthChars = 1000;

Stay tuned for some tricks on re-compilation of the repaired code, and some insight into how the Studio database functions.

Tags: , , , ,

Leave a Reply