com.sage.accpac.sm
Class StringTooLongException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.sage.accpac.sm.StringTooLongException
All Implemented Interfaces:
java.io.Serializable

public class StringTooLongException
extends java.lang.RuntimeException

The StringTooLongException class provides an unchecked exception that is thrown when a string is too long to fit into an Accpac field or similar.

Accpac is very heavily based upon fixed size buffers and so this exception is thrown when a String is offered that is too long for a fixed space.

Call getPermitted() to determine how much of the string would fit

See Also:
Serialized Form

Constructor Summary
StringTooLongException(java.lang.String string, int permitted)
           
 
Method Summary
 java.lang.String getPermitted()
          returns the portion of the string that would fit.
 java.lang.String getString()
          returns the string that did not fit
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringTooLongException

public StringTooLongException(java.lang.String string,
                              int permitted)
Parameters:
string - the string that was being processed
permitted - the number of characters of the string that were processed
Method Detail

getString

public java.lang.String getString()
returns the string that did not fit

Returns:
the string that was being processed and did not fit (or null)

getPermitted

public java.lang.String getPermitted()
returns the portion of the string that would fit.

Note that the length of the string that fits is not fixed. One 30-character string may fit while a different one does not fit. That is why this returns the portion that fits rather than specifying the length permitted.

Returns:
the portion of the string that would fit.
Throws:
java.lang.NullPointerException - if getString() returns null.


Copyright © 2011 Sage Software, Inc. All rights reserved.