Re: mailer-taglib v1.1 error when changing database

"Rashmi Rubdi" <[email protected]>
Newsgroups gmane.comp.jakarta.taglibs.user
Message-ID <[email protected]>
Hi Philip,

On 5/2/07, [email protected] <[email protected]> wrote:
> -------------------------------------------------------------
> block of code around 265:sendtag.java
> -------------------------------------------------------------
>                 // check for more than one address
>                 if (ref.indexOf(',') != -1) {
>                     // position of the start of the error inducing address
>                     int pos = ref.substring(0, ae.getPos()).indexOf(',') + 1;
>                     // extract the error inducing address
>                     ref = ref.substring(pos, ref.indexOf(','));
>                 }

As Navas mentioned, the error is occurring, because the input data
changed and something in the input data is triggering the error. But,
we could patch SendTag.java in case it needs to be fixed.

In the above lines of code, ref is a String variable that contains
comma separated values.

I don't know what the variable ae holds, if ae.getPos() returns a
value that is either less than 0 or greater than ref.length() - 1 then
you'd get the java.lang.StringIndexOutOfBoundsException

Also if pos is greater than or equal to ref.length() , or less than 0
or if ref.indexOf(',') is 0 and pos is greater than 0 , you get
java.lang.StringIndexOutOfBoundsException

I would temporarily put System.out.println statements and see what's in the
ref, pos and ae variables --- but that might not be a good idea in
this case if there are thousands of e-mail addresses.

Another way to debug the above would be with a debugging tool (most
IDEs have them), set a breakpoint and watch the values of  ref, ae and
pos variables.


>
>
> -------------------------------------------------------------
> mt code:
> -------------------------------------------------------------
> <mt:mail server="mail.strangecargo.org.uk"
> to="[email protected]" authenticate="true"
> user="[email protected]" password="xxxxxxxx" subject="Strange
> Cargo Newsletter" >
>
> <c:forEach var="subs" items="${subscribers.rows}" varStatus="status">
> <mt:addrecipient type ="bcc">${subs.subscriberemail}</mt:addrecipient>
> </c:forEach>
>
> <mt:from>[email protected]</mt:from>
> <mt:message type="html">
> ${testhere}</mt:message>
> <mt:send/>
> </mt:mail>

The actual data that is being passed to SendTag.java would give clues here.

-Regards
Rashmi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.