StringUtils in ATG Dynamo

Home/Java/ATG/StringUtils in ATG Dynamo

A hidden gem in ATG Dynamo is the simple, but VERY useful, and totally undocumented StringUtils class. It lives in the atg.core.util package in DAS/lib/classes.jar. It has several methods, but the most commonly used are isEmpty(String) and isBlank(String). Both return a boolean, and are very useful for validating form input and the like.

One thing to note is the important difference between the two methods. isEmpty() will return true for a null or a String with a length of zero. isBlank() will return true for null, or a String with a length of zero, OR a String of just whitespace. It basically adds a trim() call to it’s checks.

So when you’re validating user input, use isBlank() not isEmpty() otherwise you can easily end up with a database full of single space, ” “, names, passwords, e-mails, etc….

Remember, using undocumented classes or APIs is at your own risk, however this class, and these methods have been around for ages and are pretty stable.

By | 2017-05-18T15:18:55+00:00 August 24th, 2007|ATG|2 Comments

About the Author:

2 Comments

  1. Monsoon March 1, 2012 at 9:48 am - Reply

    Thanks, nice explanation of this undocumented util class. I was looking for the differences between those two methods.

  2. Timothy March 5, 2015 at 7:46 pm - Reply

    thanks. It helps me a lot!

Leave A Comment