EMMA Coverage Report (generated Wed Feb 13 07:49:24 ICT 2008)
[all classes][net.sourceforge.hiveboard.util]

COVERAGE SUMMARY FOR SOURCE FILE [ErrorHelper.java]

nameclass, %method, %block, %line, %
ErrorHelper.java100% (1/1)67%  (2/3)30%  (38/128)34%  (10/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ErrorHelper100% (1/1)67%  (2/3)30%  (38/128)34%  (10/29)
ErrorHelper (): void 0%   (0/1)0%   (0/3)0%   (0/2)
handle (HiveGuiApplicationMain, Throwable): void 100% (1/1)28%  (34/121)35%  (9/26)
<static initializer> 100% (1/1)100% (4/4)100% (1/1)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hiveboard.util;
16 
17import org.apache.commons.logging.Log;
18import org.apache.commons.logging.LogFactory;
19 
20import net.sourceforge.hiveboard.ServerErrorException;
21import net.sourceforge.hivegui.application.HiveGuiApplicationMain;
22import net.sourceforge.hivelock.SecurityException;
23 
24import com.caucho.hessian.client.HessianRuntimeException;
25 
26final public class ErrorHelper
27{
28        static private final Log        _logger = LogFactory.getLog(ErrorHelper.class);
29 
30        private ErrorHelper()
31        {
32        }
33        
34        static public void        handle(HiveGuiApplicationMain app, Throwable e)
35        {
36                _logger.error("handle()", e);
37                if (app != null && !(e instanceof ExitException))
38                {
39                        if (e instanceof SecurityException)
40                        {
41                                app.showMessage("security-error", e.getMessage());
42                        }
43                        else if (e instanceof OutOfMemoryError)
44                        {
45                                app.showMessage("memory-error");
46                        }
47                        else if (e instanceof VersionMismatchException)
48                        {
49                                VersionMismatchException ex = (VersionMismatchException) e;
50                                app.showMessage("version-problem", 
51                                                                ex.getMessage(), 
52                                                                ex.getClientVersion(),
53                                                                ex.getServerVersion(),
54                                                                ex.getSupportedClientVersions());
55                        }
56                        else if (e instanceof HessianRuntimeException)
57                        {
58                                app.showMessage("connection-problem", e.getMessage());
59                        }
60                        else if (e instanceof ServerErrorException)
61                        {
62                                if (e.getCause() instanceof OutOfMemoryError)
63                                {
64                                        app.showMessage("server-memory-error");
65                                }
66                                else
67                                {
68                                        app.showMessage("server-unexpected-error");
69                                }
70                        }
71                        else if (e instanceof Error && e.getCause() != null)
72                        {
73                                // Workaround Swing AppFW JIRA-42
74                                handle(app, e.getCause());
75                        }
76                        else
77                        {
78                                app.showMessage("unexpected-error");
79                        }
80                }
81        }
82}

[all classes][net.sourceforge.hiveboard.util]
EMMA 2.0.5312 (C) Vladimir Roubtsov