View Javadoc

1   /*
2    * Jour - bytecode instrumentation library
3    *
4    * Copyright (C) 2007 Vlad Skarzhevskyy
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Library General Public
8    * License as published by the Free Software Foundation; either
9    * version 2 of the License, or (at your option) any later version.
10   *
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Library General Public License for more details.
15   *
16   * You should have received a copy of the GNU Library General Public
17   * License along with this library; if not, write to the
18   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19   * Boston, MA  02111-1307, USA.
20   * 
21   * @version $Id: ChangeDetectedException.java 58 2007-10-13 00:48:59Z vlads $
22   * 
23   */
24  package net.sf.jour.signature;
25  
26  import java.util.Iterator;
27  import java.util.List;
28  
29  /**
30   * @author vlads
31   *
32   */
33  public class ChangeDetectedException extends Exception {
34  
35      private static final long serialVersionUID = 1L;
36  
37      public ChangeDetectedException(String message) {
38          super(message);
39      }
40      
41      ChangeDetectedException(List changed) {
42          this(chageList(changed));
43      }
44      
45      public static String chageList(List changed) {
46          StringBuffer b = new StringBuffer();
47          for (Iterator iterator = changed.iterator(); iterator.hasNext();) {
48              String v = (String) iterator.next();
49              if (b.length() > 0) {
50                  b.append("\n");    
51              }
52              b.append(v);
53          }
54          return b.toString();
55      }
56  
57  }