1 10 package mondrian.olap; 11 12 import mondrian.calc.ExpCompiler.ResultStyle; 13 18 public class ResultStyleException extends MondrianException { 19 public static ResultStyleException generate(ResultStyle[] producer, 20 ResultStyle[] consumer) { 21 StringBuffer buf = new StringBuffer (); 22 buf.append("Producer expected ResultStyles: "); 23 buf.append('{'); 24 for (int i = 0; i < producer.length; i++) { 25 if (i > 0) { 26 buf.append(','); 27 } 28 buf.append(producer[i]); 29 } 30 buf.append('}'); 31 buf.append(" but Consumer wanted: "); 32 buf.append('{'); 33 for (int i = 0; i < consumer.length; i++) { 34 if (i > 0) { 35 buf.append(','); 36 } 37 buf.append(consumer[i]); 38 } 39 buf.append('}'); 40 throw new ResultStyleException(buf.toString()); 41 } 42 public static ResultStyleException generateBadType(ResultStyle[] wanted, 43 ResultStyle got) { 44 StringBuffer buf = new StringBuffer (); 45 buf.append("Wanted ResultStyles: "); 46 buf.append('{'); 47 for (int i = 0; i < wanted.length; i++) { 48 if (i > 0) { 49 buf.append(','); 50 } 51 buf.append(wanted[i]); 52 } 53 buf.append('}'); 54 buf.append(" but got: "); 55 buf.append(got); 56 throw new ResultStyleException(buf.toString()); 57 } 58 59 public ResultStyleException(String message) { 60 super(message); 61 } 62 } 63 64 | Popular Tags |