EMMA Coverage Report (generated Wed Oct 03 05:00:03 CEST 2012)
[all classes][org.jdtaus.core.messages]

COVERAGE SUMMARY FOR SOURCE FILE [BugReportMessage.java]

nameclass, %method, %block, %line, %
BugReportMessage.java100% (1/1)75%  (3/4)56%  (53/94)69%  (11/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BugReportMessage100% (1/1)75%  (3/4)56%  (53/94)69%  (11/16)
getFormatArguments (Locale): Object [] 0%   (0/1)0%   (0/20)0%   (0/1)
BugReportMessage (File, URL, String): void 100% (1/1)50%  (21/42)69%  (9/13)
getBugReportMessage (Locale, String, String, String): String 100% (1/1)100% (20/20)100% (1/1)
getText (Locale): String 100% (1/1)100% (12/12)100% (1/1)

1/*
2 *  jDTAUS Core Messages
3 *  Copyright (C) 2005 Christian Schulte
4 *  <cs@schulte.it>
5 *
6 *  This library is free software; you can redistribute it and/or
7 *  modify it under the terms of the GNU Lesser General Public
8 *  License as published by the Free Software Foundation; either
9 *  version 2.1 of the License, or 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 *  Lesser General Public License for more details.
15 *
16 *  You should have received a copy of the GNU Lesser General Public
17 *  License along with this library; if not, write to the Free Software
18 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19 *
20 */
21package org.jdtaus.core.messages;
22 
23import java.io.File;
24import java.net.URL;
25import java.util.Locale;
26import org.jdtaus.core.container.ContainerFactory;
27import org.jdtaus.core.text.Message;
28 
29/**
30 * {@code Message} stating how to report a bug.
31 *
32 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
33 * @version $JDTAUS: BugReportMessage.java 8641 2012-09-27 06:45:17Z schulte $
34 */
35public final class BugReportMessage extends Message
36{
37    //--Contstants--------------------------------------------------------------
38 
39    /** Serial version UID for backwards compatibility with 1.0.x classes. */
40    private static final long serialVersionUID = -6031830488657149254L;
41 
42    //---------------------------------------------------------------Constants--
43    //--Message-----------------------------------------------------------------
44 
45    /**
46     * {@inheritDoc}
47     *
48     * @return Strings giving information for where to report bugs and where
49     * to find any data to attach to any bug reports.
50     * <ul>
51     * <li>[0]: the absolute path of the directory holding the application's
52     * logfiles.</li>
53     * <li>[1]: URL of the online bugtracking system.</li>
54     * <li>[2]: email address to alternatively send the bugreport to.</li>
55     * </ul>
56     */
57    public Object[] getFormatArguments( final Locale locale )
58    {
59        return new Object[]
60            {
61                this.logDirectory.getAbsolutePath(),
62                this.trackerUrl.toExternalForm(),
63                this.reportAddress
64            };
65    }
66 
67    /**
68     * {@inheritDoc}
69     *
70     * @return The corresponding text from the message's {@code ResourceBundle}:
71     * <blockquote><pre>
72     * Please report this at {1} or send
73     * an email to {2} including a copy of the logfiles located in directory
74     * {0}.
75     * </pre></blockquote>
76     */
77    public String getText( final Locale locale )
78    {
79        return this.getBugReportMessage( locale,
80                                         this.logDirectory.getAbsolutePath(),
81                                         this.trackerUrl.toExternalForm(),
82                                         this.reportAddress );
83 
84    }
85 
86    //-----------------------------------------------------------------Message--
87    //--BugReportMessage--------------------------------------------------------
88 
89    /**
90     * Directory holding the application's log files.
91     * @serial
92     */
93    private File logDirectory;
94 
95    /**
96     * URL of the online bugtracking system.
97     * @serial
98     */
99    private URL trackerUrl;
100 
101    /**
102     * Mail address to send the bugreport to.
103     * @serial
104     */
105    private String reportAddress;
106 
107    /**
108     * Creates a new {@code BugReportMessage} taking the application's logfile
109     * directory, an URL to the application's online bugtracking system, and
110     * an email address where to send bugreports to alternatively.
111     *
112     * @param logDirectory the directory holding the application's logfiles.
113     * @param trackerUrl an URL to the application's online bugtracking system.
114     * @param reportAddress an email address to alternatively send bugreports
115     * to.
116     *
117     * @throws NullPointerException if either {@code logDirectory},
118     * {@code trackerUrl} or {@code reportAddress} is {@code null}.
119     * @throws IllegalArgumentException if {@code logDirectory} is not a
120     * directory.
121     */
122    public BugReportMessage( final File logDirectory, final URL trackerUrl,
123                             final String reportAddress )
124    {
125        if ( logDirectory == null )
126        {
127            throw new NullPointerException( "logDirectory" );
128        }
129        if ( !logDirectory.isDirectory() )
130        {
131            throw new IllegalArgumentException( logDirectory.getAbsolutePath() );
132        }
133        if ( trackerUrl == null )
134        {
135            throw new NullPointerException( "trackerUrl" );
136        }
137        if ( reportAddress == null )
138        {
139            throw new NullPointerException( "reportAddress" );
140        }
141 
142        this.logDirectory = logDirectory;
143        this.trackerUrl = trackerUrl;
144        this.reportAddress = reportAddress;
145    }
146 
147    //--------------------------------------------------------BugReportMessage--
148    //--Messages----------------------------------------------------------------
149 
150// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:jdtausMessages
151    // This section is managed by jdtaus-container-mojo.
152 
153    /**
154     * Gets the text of message <code>bugReport</code>.
155     * <blockquote><pre>Bitte berichten Sie dieses Problem entweder unter {1} oder per eMail an {2}. Fügen Sie Ihrem Fehlerbericht bitte eine Kopie der aktuellen Protokolldateien der Anwendung aus Verzeichnis {0} bei.</pre></blockquote>
156     * <blockquote><pre>Please report this at {1} or send an email to {2} including a copy of the logfiles located in directory {0}.</pre></blockquote>
157     *
158     * @param locale The locale of the message instance to return.
159     * @param logDirectory Directory holding the application's logfiles.
160     * @param trackerUrl URL to the application's online bugtracking system.
161     * @param reportAddress Email address to alternatively send bugreports to.
162     *
163     * @return Information about how to report a bug.
164     */
165    private String getBugReportMessage( final Locale locale,
166            final java.lang.String logDirectory,
167            final java.lang.String trackerUrl,
168            final java.lang.String reportAddress )
169    {
170        return ContainerFactory.getContainer().
171            getMessage( this, "bugReport", locale,
172                new Object[]
173                {
174                    logDirectory,
175                    trackerUrl,
176                    reportAddress
177                });
178 
179    }
180 
181// </editor-fold>//GEN-END:jdtausMessages
182 
183    //----------------------------------------------------------------Messages--
184}

[all classes][org.jdtaus.core.messages]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov