Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-2734

AbstractDataSqueezerFilter needs to be more helpful on errors ( patch included )

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.1.6
    • Fix Version/s: None
    • Component/s: Framework
    • Labels:
      None

      Description

      /**

      • A useful superclass for data squeezer filters. Subclasses only have
      • to implement the single object versions of the squeeze/unsqueeze methods.
      • @author jcarman
        */
        public abstract class AbstractDataSqueezerFilter implements DataSqueezerFilter
        {

      /**

      • Merely calls squeeze(Object,DataSqueezer) on each object in
      • the array.
        */
        public String[] squeeze( Object[] objects, DataSqueezer next )
        {
        final String[] squeezed = new String[objects.length];

      for( int i = 0; i < squeezed.length; i++ ) {
      try

      { squeezed[i] = squeeze( objects[i], next ); }

      catch(RuntimeException e) {
      if ( objects[i] != null )

      { throw new ApplicationRuntimeException("A "+objects[i].getClass()+": ( the "+i+"th element) when squeezed, threw an exception",e); }

      else

      { throw e; }

      }
      }

      return squeezed;
      }

      /**

      • Merely calls unsqueeze(String,DataSqueezer) on each object in
      • the array.
        */
        public Object[] unsqueeze( String[] strings, DataSqueezer next )
        {
        final Object[] unsqueezed = new Object[strings.length];

      for( int i = 0; i < unsqueezed.length; i++ ) {
      try

      { unsqueezed[i] = unsqueeze( strings[i], next ); }

      catch(RuntimeException e)

      { throw new ApplicationRuntimeException(Arrays.toString(strings)+": unsqueezing the "+i+"th element threw an exception",e); }

      }

      return unsqueezed;
      }
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              patmoore@ieee.org Patrick Moore
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: