EMMA Coverage Report (generated Sun Sep 18 11:34:27 PHT 2011)
[all classes][org.apache.continuum.utils]

COVERAGE SUMMARY FOR SOURCE FILE [ContinuumUtils.java]

nameclass, %method, %block, %line, %
ContinuumUtils.java100% (1/1)50%  (2/4)57%  (36/63)53%  (10/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ContinuumUtils100% (1/1)50%  (2/4)57%  (36/63)53%  (10/19)
ContinuumUtils (): void 0%   (0/1)0%   (0/3)0%   (0/1)
throwableToString (Throwable): String 0%   (0/1)0%   (0/22)0%   (0/7)
throwableMessagesToString (Throwable): String 100% (1/1)94%  (32/34)90%  (9/10)
<static initializer> 100% (1/1)100% (4/4)100% (1/1)

1package org.apache.continuum.utils;
2 
3/*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21 
22import java.io.PrintWriter;
23import java.io.StringWriter;
24 
25/**
26 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
27 * @version $Id: ContinuumUtils.java 734441 2009-01-14 16:31:04Z ctan $
28 */
29public class ContinuumUtils
30{
31    public static final String EOL = System.getProperty( "line.separator" );
32 
33    public static String throwableToString( Throwable error )
34    {
35        if ( error == null )
36        {
37            return "";
38        }
39 
40        StringWriter writer = new StringWriter();
41 
42        PrintWriter printer = new PrintWriter( writer );
43 
44        error.printStackTrace( printer );
45 
46        printer.flush();
47 
48        return writer.getBuffer().toString();
49    }
50 
51    public static String throwableMessagesToString( Throwable error )
52    {
53        if ( error == null )
54        {
55            return "";
56        }
57 
58        StringBuffer buffer = new StringBuffer();
59 
60        buffer.append( error.getMessage() );
61 
62        error = error.getCause();
63 
64        while ( error != null )
65        {
66            buffer.append( EOL );
67 
68            buffer.append( error.getMessage() );
69 
70            error = error.getCause();
71        }
72 
73        return buffer.toString();
74    }
75}

[all classes][org.apache.continuum.utils]
EMMA 2.0.5312 (C) Vladimir Roubtsov