blob: 9f45b4427eb7acb278f51c47b948bfba12fac075 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>James Server - CPD Results</title>
<style type="text/css" media="all">
@import url("./css/maven-base.css");
@import url("./css/maven-theme.css");
@import url("./css/site.css");
</style>
<link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body class="composite">
<div id="banner">
<a href="http://james.apache.org/index.html" id="bannerLeft">
<img src="images/james-server-logo.gif" alt="" />
</a>
<a href="http://www.apache.org/index.html" id="bannerRight">
<img src="images/asf-logo-reduced.gif" alt="" />
</a>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
Last Published: 09/02/2009
</div>
<div class="xright"> <a href="../../index.html">JAMES Project</a>
|
<a href="../../server/index.html">Server</a>
|
<a href="../../mailet/index.html">Mailets</a>
|
<a href="../../jspf/index.html">jSPF</a>
|
<a href="../../mime4j/index.html">Mime4J</a>
|
<a href="../../jsieve/index.html">JSieve</a>
|
<a href="../../postage/index.html">Postage</a>
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>James Server</h5>
<ul>
<li class="none">
<a href="../index.html">Overview</a>
</li>
<li class="none">
<a href="../design_objectives.html">Objectives</a>
</li>
<li class="expanded">
<a href="../FAQ.html">James FAQ</a>
<ul>
<li class="none">
<a href="../james_and_sendmail.html">James and Sendmail</a>
</li>
</ul>
</li>
<li class="none">
<a href="http://wiki.apache.org/james">Wiki</a>
</li>
<li class="none">
<a href="../rfclist.html">Useful RFCs</a>
</li>
</ul>
<h5>Overview</h5>
<ul>
<li class="none">
<a href="index.html">Introduction</a>
</li>
<li class="none">
<a href="release-notes.html">Release Notes</a>
</li>
</ul>
<h5>Concepts</h5>
<ul>
<li class="none">
<a href="summary.html">Summary</a>
</li>
<li class="none">
<a href="spoolmanager.html">SpoolManager</a>
</li>
<li class="none">
<a href="repositories.html">Repositories</a>
</li>
<li class="none">
<a href="mailet_api.html">The Mailet API</a>
</li>
</ul>
<h5>How to...</h5>
<ul>
<li class="none">
<a href="build_instructions.html">Build James</a>
</li>
<li class="none">
<a href="installation_instructions.html">Install James</a>
</li>
</ul>
<h5>Configuration</h5>
<ul>
<li class="none">
<a href="dns_configuration.html">DNS Server</a>
</li>
<li class="none">
<a href="pop3_configuration.html">POP3 Server</a>
</li>
<li class="none">
<a href="smtp_configuration.html">SMTP Server</a>
</li>
<li class="none">
<a href="nntp_configuration.html">NNTP Server</a>
</li>
<li class="none">
<a href="fetchmail_configuration.html">FetchMail</a>
</li>
<li class="none">
<a href="remotemanager_configuration.html">RemoteManager</a>
</li>
<li class="none">
<a href="spoolmanager_configuration.html">SpoolManager</a>
</li>
<li class="none">
<a href="serverwide_configuration.html">Server-wide</a>
</li>
<li class="none">
<a href="adding_users.html">Adding Users</a>
</li>
<li class="none">
<a href="provided_matchers.html">Provided Matchers</a>
</li>
<li class="none">
<a href="provided_mailets.html">Provided Mailets</a>
</li>
</ul>
<h5>Common Configurations</h5>
<ul>
<li class="none">
<a href="smtp_auth.html">Using SMTP AUTH</a>
</li>
<li class="none">
<a href="using_database.html">Using a Database with James</a>
</li>
<li class="none">
<a href="usingTLS.html">Using TLS/SSL</a>
</li>
<li class="none">
<a href="mailing_lists.html">Creating Mailing Lists</a>
</li>
</ul>
<h5>Customization</h5>
<ul>
<li class="none">
<a href="custom_matcher.html">How to write a custom Matcher</a>
</li>
<li class="none">
<a href="custom_mailet.html">How to write a custom Mailet</a>
</li>
</ul>
<h5>Project</h5>
<ul>
<li class="none">
<a href="changelog.html">Changelog</a>
</li>
</ul>
<h5>Project Documentation</h5>
<ul>
<li class="collapsed">
<a href="project-info.html">Project Information</a>
</li>
<li class="expanded">
<a href="project-reports.html">Project Reports</a>
<ul>
<li class="none">
<strong>CPD Report</strong>
</li>
<li class="none">
<a href="apidocs/index.html">JavaDocs</a>
</li>
<li class="none">
<a href="pmd.html">PMD Report</a>
</li>
<li class="none">
<a href="jxr.html">Source Xref</a>
</li>
<li class="none">
<a href="testapidocs/index.html">Test JavaDocs</a>
</li>
</ul>
</li>
</ul>
<h5>Project</h5>
<ul>
<li class="none">
<a href="http://issues.apache.org/jira/browse/JAMES">Bug Database</a>
</li>
<li class="none">
<a href="http://svn.apache.org/viewvc/james/server/">Source Code</a>
</li>
<li class="none">
<a href="../todo.html">TODO</a>
</li>
</ul>
<h5>Downloads</h5>
<ul>
<li class="none">
<a href="../../download.cgi">Stable releases</a>
</li>
<li class="none">
<a href="../../downloadunstable.cgi">Unstable releases</a>
</li>
<li class="none">
<a href="http://people.apache.org/builds/james/nightly/">Nightly builds</a>
</li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" id="poweredBy">
<img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<div class="section"><h2>CPD Results</h2><p>The following document contains the results of PMD's <a href="http://pmd.sourceforge.net/cpd.html">CPD</a> 3.9.</p></div><div class="section"><h2>Duplications</h2><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/BayesianAnalysis.java</td><td><a href="./xref/org/apache/james/transport/mailets/BayesianAnalysis.html#387">387</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#682">682</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> }
}
private void sendReplyFromPostmaster(Mail mail, String stringContent) throws MessagingException {
try {
MailAddress notifier = getMailetContext().getPostmaster();
MailAddress senderMailAddress = mail.getSender();
MimeMessage message = mail.getMessage();
//Create the reply message
MimeMessage reply = new MimeMessage(Session.getDefaultInstance(System.getProperties(), null));
//Create the list of recipients in the Address[] format
InternetAddress[] rcptAddr = new InternetAddress[1];
rcptAddr[0] = senderMailAddress.toInternetAddress();
reply.setRecipients(Message.RecipientType.TO, rcptAddr);
//Set the sender...
reply.setFrom(notifier.toInternetAddress());
//Create the message body
MimeMultipart multipart = new MimeMultipart();
//Add message as the first mime body part
MimeBodyPart part = new MimeBodyPart();
part.setContent(stringContent, &quot;text/plain&quot;);
part.setHeader(RFC2822Headers.CONTENT_TYPE, &quot;text/plain&quot;);
multipart.addBodyPart(part);
reply.setContent(multipart);
reply.setHeader(RFC2822Headers.CONTENT_TYPE, multipart.getContentType());
//Create the list of recipients in our MailAddress format
Set recipients = new HashSet();
recipients.add(senderMailAddress);
//Set additional headers
if (reply.getHeader(RFC2822Headers.DATE)==null){
reply.setHeader(RFC2822Headers.DATE, rfc822DateFormat.format(new java.util.Date()));
}
String subject = message.getSubject();
if (subject == null) {
subject = &quot;&quot;;
}
if (subject.indexOf(&quot;Re:&quot;) == 0){
reply.setSubject(subject);
} else {
reply.setSubject(&quot;Re:&quot; + subject);
}
reply.setHeader(RFC2822Headers.IN_REPLY_TO, message.getMessageID());
//Send it off...
getMailetContext().sendMail(notifier, recipients, reply);
}
catch (Exception e) {
log(&quot;Exception found sending reply&quot;, e);
}
}
/** Gets the main name of a local customer, handling alias */
private String getPrimaryName(String originalUsername) {</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/CommandListservProcessor.java</td><td><a href="./xref/org/apache/james/transport/mailets/CommandListservProcessor.html#418">418</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/GenericListserv.java</td><td><a href="./xref/org/apache/james/transport/mailets/GenericListserv.html#86">86</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> }
/**
* &lt;p&gt;This takes the subject string and reduces (normailzes) it.
* Multiple &quot;Re:&quot; entries are reduced to one, and capitalized. The
* prefix is always moved/placed at the beginning of the line, and
* extra blanks are reduced, so that the output is always of the
* form:&lt;/p&gt;
* &lt;code&gt;
* &amp;lt;prefix&amp;gt; + &amp;lt;one-optional-&quot;Re:&quot;*gt; + &amp;lt;remaining subject&amp;gt;
* &lt;/code&gt;
* &lt;p&gt;I have done extensive testing of this routine with a standalone
* driver, and am leaving the commented out debug messages so that
* when someone decides to enhance this method, it can be yanked it
* from this file, embedded it with a test driver, and the comments
* enabled.&lt;/p&gt;
*/
static private String normalizeSubject(final String subj, final String prefix) {
// JDK IMPLEMENTATION NOTE! When we require JDK 1.4+, all
// occurrences of subject.toString.().indexOf(...) can be
// replaced by subject.indexOf(...).
StringBuffer subject = new StringBuffer(subj);
int prefixLength = prefix.length();
// System.err.println(&quot;In: &quot; + subject);
// If the &quot;prefix&quot; is not at the beginning the subject line, remove it
int index = subject.toString().indexOf(prefix);
if (index != 0) {
// System.err.println(&quot;(p) index: &quot; + index + &quot;, subject: &quot; + subject);
if (index &gt; 0) {
subject.delete(index, index + prefixLength);
}
subject.insert(0, prefix); // insert prefix at the front
}
// Replace Re: with RE:
String match = &quot;Re:&quot;;
index = subject.toString().indexOf(match, prefixLength);
while(index &gt; -1) {
// System.err.println(&quot;(a) index: &quot; + index + &quot;, subject: &quot; + subject);
subject.replace(index, index + match.length(), &quot;RE:&quot;);
index = subject.toString().indexOf(match, prefixLength);
// System.err.println(&quot;(b) index: &quot; + index + &quot;, subject: &quot; + subject);
}
// Reduce them to one at the beginning
match =&quot;RE:&quot;;
int indexRE = subject.toString().indexOf(match, prefixLength) + match.length();
index = subject.toString().indexOf(match, indexRE);
while(index &gt; 0) {
// System.err.println(&quot;(c) index: &quot; + index + &quot;, subject: &quot; + subject);
subject.delete(index, index + match.length());
index = subject.toString().indexOf(match, indexRE);
// System.err.println(&quot;(d) index: &quot; + index + &quot;, subject: &quot; + subject);
}
// Reduce blanks
match = &quot; &quot;;
index = subject.toString().indexOf(match, prefixLength);
while(index &gt; -1) {
// System.err.println(&quot;(e) index: &quot; + index + &quot;, subject: &quot; + subject);
subject.replace(index, index + match.length(), &quot; &quot;);
index = subject.toString().indexOf(match, prefixLength);
// System.err.println(&quot;(f) index: &quot; + index + &quot;, subject: &quot; + subject);
}
// System.err.println(&quot;Out: &quot; + subject);
return subject.toString();
}</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/mailrepository/AvalonMailRepository.java</td><td><a href="./xref/org/apache/james/mailrepository/AvalonMailRepository.html#183">183</a></td></tr><tr class="a"><td>org/apache/james/mailrepository/JDBCMailRepository.java</td><td><a href="./xref/org/apache/james/mailrepository/JDBCMailRepository.html#483">483</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> }
}
/**
* Releases a lock on a message identified by a key
*
* @param key the key of the message to be unlocked
*
* @return true if successfully released the lock, false otherwise
*/
public boolean unlock(String key) {
if (lock.unlock(key)) {
if ((DEEP_DEBUG) &amp;&amp; (getLogger().isDebugEnabled())) {
StringBuffer debugBuffer =
new StringBuffer(256)
.append(&quot;Unlocked &quot;)
.append(key)
.append(&quot; for &quot;)
.append(Thread.currentThread().getName())
.append(&quot; @ &quot;)
.append(new java.util.Date(System.currentTimeMillis()));
getLogger().debug(debugBuffer.toString());
}
return true;
} else {
return false;
}
}
/**
* Obtains a lock on a message identified by a key
*
* @param key the key of the message to be locked
*
* @return true if successfully obtained the lock, false otherwise
*/
public boolean lock(String key) {
if (lock.lock(key)) {
if ((DEEP_DEBUG) &amp;&amp; (getLogger().isDebugEnabled())) {
StringBuffer debugBuffer =
new StringBuffer(256)
.append(&quot;Locked &quot;)
.append(key)
.append(&quot; for &quot;)
.append(Thread.currentThread().getName())
.append(&quot; @ &quot;)
.append(new java.util.Date(System.currentTimeMillis()));
getLogger().debug(debugBuffer.toString());
}
return true;
} else {
return false;
}
}
/**
* Store this message to the database. Optionally stores the message
* body to the filesystem and only writes the headers to the database.
*/
public void store(Mail mc) throws MessagingException {</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#459">459</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#582">582</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> out.println(&quot;Removing from the white list of &quot; + (new MailAddress(senderUser, senderHost)) + &quot; ...&quot;);
out.println();
MimeMessage message = mail.getMessage() ;
Object content= message.getContent();
if (message.getContentType().startsWith(&quot;text/plain&quot;)
&amp;&amp; content instanceof String) {
StringTokenizer st = new StringTokenizer((String) content, &quot; \t\n\r\f,;:&lt;&gt;&quot;);
while (st.hasMoreTokens()) {
ResultSet selectRS = null;
try {
MailAddress recipientMailAddress;
try {
recipientMailAddress = new MailAddress(st.nextToken());
}
catch (javax.mail.internet.ParseException pe) {
continue;
}
String recipientUser = recipientMailAddress.getUser().toLowerCase(Locale.US);
String recipientHost = recipientMailAddress.getHost().toLowerCase(Locale.US);
if (getMailetContext().isLocalServer(recipientHost)) {
// not a remote recipient, so skip
continue;
}
if (conn == null) {
conn = datasource.getConnection();
}
if (selectStmt == null) {
selectStmt = conn.prepareStatement(selectByPK);
}
selectStmt.setString(1, senderUser);
selectStmt.setString(2, senderHost);
selectStmt.setString(3, recipientUser);
selectStmt.setString(4, recipientHost);
selectRS = selectStmt.executeQuery();
if (!selectRS.next()) {</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/ClamAVScan.java</td><td><a href="./xref/org/apache/james/transport/mailets/ClamAVScan.html#719">719</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/smime/SMIMEAbstractSign.java</td><td><a href="./xref/org/apache/james/transport/mailets/smime/SMIMEAbstractSign.html#565">565</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> private void checkInitParameters(String[] allowedArray) throws MessagingException {
// if null then no check is requested
if (allowedArray == null) {
return;
}
Collection allowed = new HashSet();
Collection bad = new ArrayList();
for (int i = 0; i &lt; allowedArray.length; i++) {
allowed.add(allowedArray[i]);
}
Iterator iterator = getInitParameterNames();
while (iterator.hasNext()) {
String parameter = (String) iterator.next();
if (!allowed.contains(parameter)) {
bad.add(parameter);
}
}
if (bad.size() &gt; 0) {
throw new MessagingException(&quot;Unexpected init parameters found: &quot;
+ arrayToString(bad.toArray()));
}
}
/**
* Utility method for obtaining a string representation of an array of Objects.
*/
private final String arrayToString(Object[] array) {
if (array == null) {
return &quot;null&quot;;
}
StringBuffer sb = new StringBuffer(1024);
sb.append(&quot;[&quot;);
for (int i = 0; i &lt; array.length; i++) {
if (i &gt; 0) {
sb.append(&quot;,&quot;);
}
sb.append(array[i]);
}
sb.append(&quot;]&quot;);
return sb.toString();
}
/**
* Utility method that checks if there is at least one address in the &quot;From:&quot; header
* same as the &lt;i&gt;reverse-path&lt;/i&gt;.
* @param mail The mail to check.
* @return True if an address is found, false otherwise.
*/
protected final boolean fromAddressSameAsReverse(Mail mail) {</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#208">208</a></td></tr><tr class="a"><td>org/apache/james/transport/matchers/IsInWhiteList.java</td><td><a href="./xref/org/apache/james/transport/matchers/IsInWhiteList.html#120">120</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> if (repositoryPath != null) {
log(&quot;repositoryPath: &quot; + repositoryPath);
}
else {
throw new MessagingException(&quot;repositoryPath is null&quot;);
}
ServiceManager serviceManager = (ServiceManager) getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
try {
// Get the DataSourceSelector block
DataSourceSelector datasources = (DataSourceSelector) serviceManager.lookup(DataSourceSelector.ROLE);
// Get the data-source required.
int stindex = repositoryPath.indexOf(&quot;://&quot;) + 3;
String datasourceName = repositoryPath.substring(stindex);
datasource = (DataSourceComponent) datasources.select(datasourceName);
} catch (Exception e) {
throw new MessagingException(&quot;Can't get datasource&quot;, e);
}
try {
// Get the UsersRepository
usersStore = (UsersStore)serviceManager.lookup(UsersStore.ROLE);
localusers = (UsersRepository)usersStore.getRepository(&quot;LocalUsers&quot;);
} catch (Exception e) {
throw new MessagingException(&quot;Can't get the local users repository&quot;, e);
}
try {
initSqlQueries(datasource.getConnection(), getMailetContext());
} catch (Exception e) {
throw new MessagingException(&quot;Exception initializing queries&quot;, e);
}
selectByPK = sqlQueries.getSqlString(&quot;selectByPK&quot;, true);</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/AbstractRedirect.java</td><td><a href="./xref/org/apache/james/transport/mailets/AbstractRedirect.html#397">397</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/Redirect.java</td><td><a href="./xref/org/apache/james/transport/mailets/Redirect.html#333">333</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> String addressList = getInitParameter(&quot;recipients&quot;,getInitParameter(&quot;to&quot;));
// if nothing was specified, return &lt;CODE&gt;null&lt;/CODE&gt; meaning no change
if (addressList == null) {
return null;
}
try {
InternetAddress[] iaarray = InternetAddress.parse(addressList, false);
for (int i = 0; i &lt; iaarray.length; i++) {
String addressString = iaarray[i].getAddress();
MailAddress specialAddress = getSpecialAddress(addressString,
new String[] {&quot;postmaster&quot;, &quot;sender&quot;, &quot;from&quot;, &quot;replyTo&quot;, &quot;reversePath&quot;, &quot;unaltered&quot;, &quot;recipients&quot;, &quot;to&quot;, &quot;null&quot;});
if (specialAddress != null) {
newRecipients.add(specialAddress);
} else {
newRecipients.add(new MailAddress(iaarray[i]));
}
}
} catch (Exception e) {
throw new MessagingException(&quot;Exception thrown in getRecipients() parsing: &quot; + addressList, e);
}
if (newRecipients.size() == 0) {
throw new MessagingException(&quot;Failed to initialize \&quot;recipients\&quot; list; empty &lt;recipients&gt; init parameter found.&quot;);
}
return newRecipients;
}
/**
* @return the &lt;CODE&gt;to&lt;/CODE&gt; init parameter
* or the postmaster address
* or &lt;CODE&gt;SpecialAddress.SENDER&lt;/CODE&gt;
* or &lt;CODE&gt;SpecialAddress.REVERSE_PATH&lt;/CODE&gt;
* or &lt;CODE&gt;SpecialAddress.UNALTERED&lt;/CODE&gt;
* or the &lt;CODE&gt;recipients&lt;/CODE&gt; init parameter if missing
* or &lt;CODE&gt;null&lt;/CODE&gt; if also the latter is missing
*/
protected InternetAddress[] getTo() throws MessagingException {</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/Forward.java</td><td><a href="./xref/org/apache/james/transport/mailets/Forward.html#118">118</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/Redirect.java</td><td><a href="./xref/org/apache/james/transport/mailets/Redirect.html#338">338</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> }
try {
InternetAddress[] iaarray = InternetAddress.parse(addressList, false);
for (int i = 0; i &lt; iaarray.length; i++) {
String addressString = iaarray[i].getAddress();
MailAddress specialAddress = getSpecialAddress(addressString,
new String[] {&quot;postmaster&quot;, &quot;sender&quot;, &quot;from&quot;, &quot;replyTo&quot;, &quot;reversePath&quot;, &quot;unaltered&quot;, &quot;recipients&quot;, &quot;to&quot;, &quot;null&quot;});
if (specialAddress != null) {
newRecipients.add(specialAddress);
} else {
newRecipients.add(new MailAddress(iaarray[i]));
}
}
} catch (Exception e) {
throw new MessagingException(&quot;Exception thrown in getRecipients() parsing: &quot; + addressList, e);
}
if (newRecipients.size() == 0) {
throw new MessagingException(&quot;Failed to initialize \&quot;recipients\&quot; list; empty &lt;recipients&gt; init parameter found.&quot;);
}
return newRecipients;
}
/**
* @return the &lt;CODE&gt;to&lt;/CODE&gt; init parameter
* or the postmaster address
* or &lt;CODE&gt;SpecialAddress.SENDER&lt;/CODE&gt;
* or &lt;CODE&gt;SpecialAddress.REVERSE_PATH&lt;/CODE&gt;
* or &lt;CODE&gt;SpecialAddress.UNALTERED&lt;/CODE&gt;
* or the &lt;CODE&gt;recipients&lt;/CODE&gt; init parameter if missing
* or &lt;CODE&gt;null&lt;/CODE&gt; if also the latter is missing
*/
protected InternetAddress[] getTo() throws MessagingException {</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/pop3server/POP3Handler.java</td><td><a href="./xref/org/apache/james/pop3server/POP3Handler.html#664">664</a></td></tr><tr class="a"><td>org/apache/james/pop3server/POP3Handler.java</td><td><a href="./xref/org/apache/james/pop3server/POP3Handler.html#746">746</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> .append(mc.getName());
responseString = responseBuffer.toString();
writeLoggedFlushedResponse(responseString);
} else {
StringBuffer responseBuffer =
new StringBuffer(64)
.append(ERR_RESPONSE)
.append(&quot; Message (&quot;)
.append(num)
.append(&quot;) already deleted.&quot;);
responseString = responseBuffer.toString();
writeLoggedFlushedResponse(responseString);
}
} catch (IndexOutOfBoundsException npe) {
StringBuffer responseBuffer =
new StringBuffer(64)
.append(ERR_RESPONSE)
.append(&quot; Message (&quot;)
.append(num)
.append(&quot;) does not exist.&quot;);
responseString = responseBuffer.toString();
writeLoggedFlushedResponse(responseString);
} catch (NumberFormatException nfe) {
StringBuffer responseBuffer =
new StringBuffer(64)
.append(ERR_RESPONSE)
.append(&quot; &quot;)
.append(argument)
.append(&quot; is not a valid number&quot;);
responseString = responseBuffer.toString();
writeLoggedFlushedResponse(responseString);
}</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/util/BayesianAnalyzer.java</td><td><a href="./xref/org/apache/james/util/BayesianAnalyzer.html#371">371</a></td></tr><tr class="a"><td>org/apache/james/util/BayesianAnalyzer.java</td><td><a href="./xref/org/apache/james/util/BayesianAnalyzer.html#423">423</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> String token;
String header = &quot;&quot;;
//Build a Map of tokens encountered.
while ((token = nextToken(stream)) != null) {
boolean endingLine = false;
if (token.length() &gt; 0 &amp;&amp; token.charAt(token.length() - 1) == '\n') {
endingLine = true;
token = token.substring(0, token.length() - 1);
}
if (token.length() &gt; 0 &amp;&amp; header.length() + token.length() &lt; 90 &amp;&amp; !allDigits(token)) {
if (token.equals(&quot;From:&quot;)
|| token.equals(&quot;Return-Path:&quot;)
|| token.equals(&quot;Subject:&quot;)
|| token.equals(&quot;To:&quot;)
) {
header = token;
if (!endingLine) {
continue;
}
}
token = header + token;</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/AbstractRedirect.java</td><td><a href="./xref/org/apache/james/transport/mailets/AbstractRedirect.html#402">402</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/Forward.java</td><td><a href="./xref/org/apache/james/transport/mailets/Forward.html#118">118</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> }
try {
InternetAddress[] iaarray = InternetAddress.parse(addressList, false);
for (int i = 0; i &lt; iaarray.length; i++) {
String addressString = iaarray[i].getAddress();
MailAddress specialAddress = getSpecialAddress(addressString,
new String[] {&quot;postmaster&quot;, &quot;sender&quot;, &quot;from&quot;, &quot;replyTo&quot;, &quot;reversePath&quot;, &quot;unaltered&quot;, &quot;recipients&quot;, &quot;to&quot;, &quot;null&quot;});
if (specialAddress != null) {
newRecipients.add(specialAddress);
} else {
newRecipients.add(new MailAddress(iaarray[i]));
}
}
} catch (Exception e) {
throw new MessagingException(&quot;Exception thrown in getRecipients() parsing: &quot; + addressList, e);
}
if (newRecipients.size() == 0) {
throw new MessagingException(&quot;Failed to initialize \&quot;recipients\&quot; list; empty &lt;recipients&gt; init parameter found.&quot;);
}
return newRecipients;
}
/**
* @return null
*/
protected InternetAddress[] getTo() throws MessagingException {</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#737">737</a></td></tr><tr class="a"><td>org/apache/james/transport/matchers/IsInWhiteList.java</td><td><a href="./xref/org/apache/james/transport/matchers/IsInWhiteList.html#226">226</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> theJDBCUtil.closeJDBCConnection(conn);
}
}
/** Gets the main name of a local customer, handling alias */
private String getPrimaryName(String originalUsername) {
String username;
try {
username = localusers.getRealName(originalUsername);
JamesUser user = (JamesUser) localusers.getUserByName(username);
if (user.getAliasing()) {
username = user.getAlias();
}
}
catch (Exception e) {
username = originalUsername;
}
return username;
}
/**
* Initializes the sql query environment from the SqlResources file.
* Will look for conf/sqlResources.xml.
* Will &lt;I&gt;not&lt;/I&gt; create the database resources, if missing
* (this task is done, if needed, in the {@link WhiteListManager}
* initialization routine).
* @param conn The connection for accessing the database
* @param mailetContext The current mailet context,
* for finding the conf/sqlResources.xml file
* @throws Exception If any error occurs
*/
public void initSqlQueries(Connection conn, org.apache.mailet.MailetContext mailetContext) throws Exception {
try {
if (conn.getAutoCommit()) {
conn.setAutoCommit(false);
}
this.sqlFile = new File((String) mailetContext.getAttribute(&quot;confDir&quot;), &quot;sqlResources.xml&quot;).getCanonicalFile();
sqlQueries.init(this.sqlFile, &quot;WhiteList&quot; , conn, getSqlParameters());</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#787">787</a></td></tr><tr class="a"><td>org/apache/james/util/JDBCBayesianAnalyzer.java</td><td><a href="./xref/org/apache/james/util/JDBCBayesianAnalyzer.html#377">377</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> dbUpdated = createTable(conn, &quot;messageCountsTableName&quot;, &quot;createMessageCountsTable&quot;);
//Commit our changes if necessary.
if (conn != null &amp;&amp; dbUpdated &amp;&amp; !conn.getAutoCommit()) {
conn.commit();
dbUpdated = false;
}
}
private boolean createTable(Connection conn, String tableNameSqlStringName, String createSqlStringName) throws SQLException {
String tableName = sqlQueries.getSqlString(tableNameSqlStringName, true);
DatabaseMetaData dbMetaData = conn.getMetaData();
// Try UPPER, lower, and MixedCase, to see if the table is there.
if (theJDBCUtil.tableExists(dbMetaData, tableName)) {
return false;
}
PreparedStatement createStatement = null;
try {
createStatement =
conn.prepareStatement(sqlQueries.getSqlString(createSqlStringName, true));
createStatement.execute();
StringBuffer logBuffer = null;
logBuffer =
new StringBuffer(64)
.append(&quot;Created table '&quot;)
.append(tableName)
.append(&quot;' using sqlResources string '&quot;)
.append(createSqlStringName)
.append(&quot;'.&quot;);</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/AbstractRedirect.java</td><td><a href="./xref/org/apache/james/transport/mailets/AbstractRedirect.html#477">477</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/Redirect.java</td><td><a href="./xref/org/apache/james/transport/mailets/Redirect.html#373">373</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> String addressList = getInitParameter(&quot;to&quot;,getInitParameter(&quot;recipients&quot;));
// if nothing was specified, return null meaning no change
if (addressList == null) {
return null;
}
try {
iaarray = InternetAddress.parse(addressList, false);
for(int i = 0; i &lt; iaarray.length; ++i) {
String addressString = iaarray[i].getAddress();
MailAddress specialAddress = getSpecialAddress(addressString,
new String[] {&quot;postmaster&quot;, &quot;sender&quot;, &quot;from&quot;, &quot;replyTo&quot;, &quot;reversePath&quot;, &quot;unaltered&quot;, &quot;recipients&quot;, &quot;to&quot;, &quot;null&quot;});
if (specialAddress != null) {
iaarray[i] = specialAddress.toInternetAddress();
}
}
} catch (Exception e) {
throw new MessagingException(&quot;Exception thrown in getTo() parsing: &quot; + addressList, e);
}
if (iaarray.length == 0) {
throw new MessagingException(&quot;Failed to initialize \&quot;to\&quot; list; empty &lt;to&gt; init parameter found.&quot;);
}
return iaarray;
}
/**
* @return the &lt;CODE&gt;reversePath&lt;/CODE&gt; init parameter
* or the postmaster address
* or &lt;CODE&gt;SpecialAddress.SENDER&lt;/CODE&gt;
* or &lt;CODE&gt;SpecialAddress.NULL&lt;/CODE&gt;
* or &lt;CODE&gt;null&lt;/CODE&gt; if missing
*/
protected MailAddress getReversePath() throws MessagingException {</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/nntpserver/NNTPHandler.java</td><td><a href="./xref/org/apache/james/nntpserver/NNTPHandler.html#939">939</a></td></tr><tr class="a"><td>org/apache/james/nntpserver/NNTPHandler.java</td><td><a href="./xref/org/apache/james/nntpserver/NNTPHandler.html#1002">1002</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> .append(&quot;221 0 &quot;)
.append(param);
writeLoggedFlushedResponse(respBuffer.toString());
}
} else {
int newArticleNumber = currentArticleNumber;
if ( group == null ) {
writeLoggedFlushedResponse(&quot;412 no newsgroup selected&quot;);
return;
} else {
if ( param == null ) {
if ( currentArticleNumber &lt; 0 ) {
writeLoggedFlushedResponse(&quot;420 no current article selected&quot;);
return;
} else {
article = group.getArticle(currentArticleNumber);
}
}
else {
newArticleNumber = Integer.parseInt(param);
article = group.getArticle(newArticleNumber);
}
if ( article == null ) {
writeLoggedFlushedResponse(&quot;423 no such article number in this group&quot;);
return;
} else {
currentArticleNumber = newArticleNumber;
String articleID = article.getUniqueID();
if (articleID == null) {
articleID = &quot;&lt;0&gt;&quot;;
}
StringBuffer respBuffer =
new StringBuffer(128)
.append(&quot;221 &quot;)</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#522">522</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#645">645</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> log(&quot;Removal request issued by &quot; + senderMailAddress);
}
//Commit our changes if necessary.
if (conn != null &amp;&amp; dbUpdated &amp;&amp; !conn.getAutoCommit()) {
conn.commit() ;
dbUpdated = false;
}
}
else {
out.println(&quot;The message must be plain - no action&quot;);
}
out.println();
out.println(&quot;Finished&quot;);
sendReplyFromPostmaster(mail, sout.toString());
} catch (SQLException sqle) {
out.println(&quot;Error accessing the database&quot;);
sendReplyFromPostmaster(mail, sout.toString());
throw new MessagingException(&quot;Error accessing the database&quot;, sqle);
} catch (IOException ioe) {
out.println(&quot;Error getting message content&quot;);
sendReplyFromPostmaster(mail, sout.toString());
throw new MessagingException(&quot;Error getting message content&quot;, ioe);
} finally {
theJDBCUtil.closeJDBCStatement(selectStmt);
theJDBCUtil.closeJDBCStatement(deleteStmt);</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/AbstractRedirect.java</td><td><a href="./xref/org/apache/james/transport/mailets/AbstractRedirect.html#1430">1430</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/smime/SMIMEAbstractSign.java</td><td><a href="./xref/org/apache/james/transport/mailets/smime/SMIMEAbstractSign.html#565">565</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> private void checkInitParameters(String[] allowedArray) throws MessagingException {
// if null then no check is requested
if (allowedArray == null) {
return;
}
Collection allowed = new HashSet();
Collection bad = new ArrayList();
for (int i = 0; i &lt; allowedArray.length; i++) {
allowed.add(allowedArray[i]);
}
Iterator iterator = getInitParameterNames();
while (iterator.hasNext()) {
String parameter = (String) iterator.next();
if (!allowed.contains(parameter)) {
bad.add(parameter);
}
}
if (bad.size() &gt; 0) {
throw new MessagingException(&quot;Unexpected init parameters found: &quot;
+ arrayToString(bad.toArray()));
}
}</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/AbstractRedirect.java</td><td><a href="./xref/org/apache/james/transport/mailets/AbstractRedirect.html#1430">1430</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/ClamAVScan.java</td><td><a href="./xref/org/apache/james/transport/mailets/ClamAVScan.html#719">719</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> protected final void checkInitParameters(String[] allowedArray) throws MessagingException {
// if null then no check is requested
if (allowedArray == null) {
return;
}
Collection allowed = new HashSet();
Collection bad = new ArrayList();
for (int i = 0; i &lt; allowedArray.length; i++) {
allowed.add(allowedArray[i]);
}
Iterator iterator = getInitParameterNames();
while (iterator.hasNext()) {
String parameter = (String) iterator.next();
if (!allowed.contains(parameter)) {
bad.add(parameter);
}
}
if (bad.size() &gt; 0) {
throw new MessagingException(&quot;Unexpected init parameters found: &quot;
+ arrayToString(bad.toArray()));
}
}</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/nntpserver/NNTPHandler.java</td><td><a href="./xref/org/apache/james/nntpserver/NNTPHandler.html#941">941</a></td></tr><tr class="a"><td>org/apache/james/nntpserver/NNTPHandler.java</td><td><a href="./xref/org/apache/james/nntpserver/NNTPHandler.html#1140">1140</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> writeLoggedResponse(respBuffer.toString());
}
} else {
int newArticleNumber = currentArticleNumber;
if ( group == null ) {
writeLoggedFlushedResponse(&quot;412 no newsgroup selected&quot;);
return;
} else {
if ( param == null ) {
if ( currentArticleNumber &lt; 0 ) {
writeLoggedFlushedResponse(&quot;420 no current article selected&quot;);
return;
} else {
article = group.getArticle(currentArticleNumber);
}
}
else {
newArticleNumber = Integer.parseInt(param);
article = group.getArticle(newArticleNumber);
}
if ( article == null ) {
writeLoggedFlushedResponse(&quot;423 no such article number in this group&quot;);
return;
} else {
currentArticleNumber = newArticleNumber;
String articleID = article.getUniqueID();
if (articleID == null) {
articleID = &quot;&lt;0&gt;&quot;;
}
StringBuffer respBuffer =
new StringBuffer(128)
.append(&quot;220 &quot;)</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/AbstractRedirect.java</td><td><a href="./xref/org/apache/james/transport/mailets/AbstractRedirect.html#1033">1033</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/DSNBounce.java</td><td><a href="./xref/org/apache/james/transport/mailets/DSNBounce.html#223">223</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> setRecipients(newMail, getRecipients(originalMail), originalMail);
setTo(newMail, getTo(originalMail), originalMail);
setSubjectPrefix(newMail, getSubjectPrefix(originalMail), originalMail);
if(newMail.getMessage().getHeader(RFC2822Headers.DATE) == null) {
newMail.getMessage().setHeader(RFC2822Headers.DATE,rfc822DateFormat.format(new Date()));
}
setReplyTo(newMail, getReplyTo(originalMail), originalMail);
setReversePath(newMail, getReversePath(originalMail), originalMail);
setSender(newMail, getSender(originalMail), originalMail);
setIsReply(newMail, isReply(originalMail), originalMail);
newMail.getMessage().saveChanges();</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/util/SqlResources.java</td><td><a href="./xref/org/apache/james/util/SqlResources.html#138">138</a></td></tr><tr class="a"><td>org/apache/james/util/XMLResources.java</td><td><a href="./xref/org/apache/james/util/XMLResources.html#142">142</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> .append(group)
.append(&quot;\' does not exist.&quot;);
throw new RuntimeException(exceptionBuffer.toString());
}
// Get parameters defined within the file as defaults,
// and use supplied parameters as overrides.
Map parameters = new HashMap();
// First read from the &lt;params&gt; element, if it exists.
Element parametersElement =
(Element)(sectionElement.getElementsByTagName(&quot;parameters&quot;).item(0));
if ( parametersElement != null ) {
NamedNodeMap params = parametersElement.getAttributes();
int paramCount = params.getLength();
for (int i = 0; i &lt; paramCount; i++ ) {
Attr param = (Attr)params.item(i);
String paramName = param.getName();
String paramValue = param.getValue();
parameters.put(paramName, paramValue);
}
}
// Then copy in the parameters supplied with the call.
parameters.putAll(configParameters);
// 2 maps - one for storing default statements,
// the other for statements with a &quot;for&quot; attribute matching this
// connection.
Map defaultStrings = new HashMap();</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/AbstractRedirect.java</td><td><a href="./xref/org/apache/james/transport/mailets/AbstractRedirect.html#1089">1089</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/DSNBounce.java</td><td><a href="./xref/org/apache/james/transport/mailets/DSNBounce.html#585">585</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> protected String newName(Mail mail) throws MessagingException {
String oldName = mail.getName();
// Checking if the original mail name is too long, perhaps because of a
// loop caused by a configuration error.
// it could cause a &quot;null pointer exception&quot; in AvalonMailRepository much
// harder to understand.
if (oldName.length() &gt; 76) {
int count = 0;
int index = 0;
while ((index = oldName.indexOf('!', index + 1)) &gt;= 0) {
count++;
}
// It looks like a configuration loop. It's better to stop.
if (count &gt; 7) {
throw new MessagingException(&quot;Unable to create a new message name: too long.&quot;
+ &quot; Possible loop in config.xml.&quot;);
}
else {
oldName = oldName.substring(0, 76);
}
}
StringBuffer nameBuffer =
new StringBuffer(64)
.append(oldName)
.append(&quot;-!&quot;)
.append(random.nextInt(1048576));
return nameBuffer.toString();
}</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#327">327</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#479">479</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> String recipientUser = recipientMailAddress.getUser().toLowerCase(Locale.US);
String recipientHost = recipientMailAddress.getHost().toLowerCase(Locale.US);
if (getMailetContext().isLocalServer(recipientHost)) {
// not a remote recipient, so skip
continue;
}
if (conn == null) {
conn = datasource.getConnection();
}
if (selectStmt == null) {
selectStmt = conn.prepareStatement(selectByPK);
}
selectStmt.setString(1, senderUser);
selectStmt.setString(2, senderHost);
selectStmt.setString(3, recipientUser);
selectStmt.setString(4, recipientHost);
selectRS = selectStmt.executeQuery();
if (selectRS.next()) {</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/BayesianAnalysis.java</td><td><a href="./xref/org/apache/james/transport/mailets/BayesianAnalysis.html#229">229</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/BayesianAnalysisFeeder.java</td><td><a href="./xref/org/apache/james/transport/mailets/BayesianAnalysisFeeder.html#187">187</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> initDb();
}
private void initDb() throws MessagingException {
try {
ServiceManager serviceManager = (ServiceManager) getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
// Get the DataSourceSelector block
DataSourceSelector datasources = (DataSourceSelector) serviceManager.lookup(DataSourceSelector.ROLE);
// Get the data-source required.
int stindex = repositoryPath.indexOf(&quot;://&quot;) + 3;
String datasourceName = repositoryPath.substring(stindex);
datasource = (DataSourceComponent) datasources.select(datasourceName);
} catch (Exception e) {
throw new MessagingException(&quot;Can't get datasource&quot;, e);
}
try {
analyzer.initSqlQueries(datasource.getConnection(), getMailetContext());
} catch (Exception e) {
throw new MessagingException(&quot;Exception initializing queries&quot;, e);
} </pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/JDBCAlias.java</td><td><a href="./xref/org/apache/james/transport/mailets/JDBCAlias.html#87">87</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/JDBCVirtualUserTable.java</td><td><a href="./xref/org/apache/james/transport/mailets/JDBCVirtualUserTable.html#125">125</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> try {
ServiceManager componentManager = (ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
// Get the DataSourceSelector service
DataSourceSelector datasources = (DataSourceSelector)componentManager.lookup(DataSourceSelector.ROLE);
// Get the data-source required.
datasource = (DataSourceComponent)datasources.select(datasourceName);
conn = datasource.getConnection();
// Check if the required table exists. If not, complain.
DatabaseMetaData dbMetaData = conn.getMetaData();
// Need to ask in the case that identifiers are stored, ask the DatabaseMetaInfo.
// Try UPPER, lower, and MixedCase, to see if the table is there.
if (!(theJDBCUtil.tableExists(dbMetaData, tableName))) {
StringBuffer exceptionBuffer =
new StringBuffer(128)
.append(&quot;Could not find table '&quot;)
.append(tableName)
.append(&quot;' in datasource '&quot;)
.append(datasourceName)
.append(&quot;'&quot;);
throw new MailetException(exceptionBuffer.toString());
}</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#327">327</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/WhiteListManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/WhiteListManager.html#602">602</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> String recipientUser = recipientMailAddress.getUser().toLowerCase(Locale.US);
String recipientHost = recipientMailAddress.getHost().toLowerCase(Locale.US);
if (getMailetContext().isLocalServer(recipientHost)) {
// not a remote recipient, so skip
continue;
}
if (conn == null) {
conn = datasource.getConnection();
}
if (selectStmt == null) {
selectStmt = conn.prepareStatement(selectByPK);
}
selectStmt.setString(1, senderUser);
selectStmt.setString(2, senderHost);
selectStmt.setString(3, recipientUser);
selectStmt.setString(4, recipientHost);
selectRS = selectStmt.executeQuery();
if (!selectRS.next()) {</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/mailrepository/JDBCMailRepository.java</td><td><a href="./xref/org/apache/james/mailrepository/JDBCMailRepository.html#620">620</a></td></tr><tr class="a"><td>org/apache/james/mailrepository/JDBCMailRepository.java</td><td><a href="./xref/org/apache/james/mailrepository/JDBCMailRepository.html#724">724</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
try {
if (mc instanceof MailImpl) {
oos.writeObject(((MailImpl)mc).getAttributesRaw());
} else {
HashMap temp = new HashMap();
for (Iterator i = mc.getAttributeNames(); i.hasNext(); ) {
String hashKey = (String) i.next();
temp.put(hashKey,mc.getAttribute(hashKey));
}
oos.writeObject(temp);
}
oos.flush();
ByteArrayInputStream attrInputStream =
new ByteArrayInputStream(baos.toByteArray());</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/pop3server/POP3Handler.java</td><td><a href="./xref/org/apache/james/pop3server/POP3Handler.html#904">904</a></td></tr><tr class="a"><td>org/apache/james/pop3server/POP3Handler.java</td><td><a href="./xref/org/apache/james/pop3server/POP3Handler.html#984">984</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> writeMessageContentTo(mc.getMessage(),nouts,lines);
nouts.flush();
edouts.checkCRLFTerminator();
edouts.flush();
} finally {
out.println(&quot;.&quot;);
out.flush();
}
} else {
StringBuffer responseBuffer =
new StringBuffer(64)
.append(ERR_RESPONSE)
.append(&quot; Message (&quot;)
.append(num)
.append(&quot;) already deleted.&quot;);
responseString = responseBuffer.toString();
writeLoggedFlushedResponse(responseString);
}
} catch (IOException ioe) {
responseString = ERR_RESPONSE + &quot; Error while retrieving message.&quot;;
writeLoggedFlushedResponse(responseString);
} catch (MessagingException me) {
responseString = ERR_RESPONSE + &quot; Error while retrieving message.&quot;;
writeLoggedFlushedResponse(responseString);
} catch (IndexOutOfBoundsException iob) {
StringBuffer exceptionBuffer =</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/smtpserver/DataCmdHandler.java</td><td><a href="./xref/org/apache/james/smtpserver/DataCmdHandler.html#150">150</a></td></tr><tr class="a"><td>org/apache/james/smtpserver/SendMailHandler.java</td><td><a href="./xref/org/apache/james/smtpserver/SendMailHandler.html#95">95</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> StringBuffer errorBuffer =
new StringBuffer(256)
.append(&quot;Rejected message from &quot;)
.append(session.getState().get(SMTPSession.SENDER).toString())
.append(&quot; from host &quot;)
.append(session.getRemoteHost())
.append(&quot; (&quot;)
.append(session.getRemoteIPAddress())
.append(&quot;) exceeding system maximum message size of &quot;)
.append(session.getConfigurationData().getMaxMessageSize());
getLogger().error(errorBuffer.toString());
} else {
responseString = &quot;451 &quot;+DSNStatus.getStatus(DSNStatus.TRANSIENT,DSNStatus.UNDEFINED_STATUS)+&quot; Error processing message.&quot;;</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/util/SqlResources.java</td><td><a href="./xref/org/apache/james/util/SqlResources.html#303">303</a></td></tr><tr class="a"><td>org/apache/james/util/XMLResources.java</td><td><a href="./xref/org/apache/james/util/XMLResources.html#278">278</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> static private String substituteSubString( String input,
String find,
String replace )
{
int find_length = find.length();
int replace_length = replace.length();
StringBuffer output = new StringBuffer(input);
int index = input.indexOf(find);
int outputOffset = 0;
while ( index &gt; -1 ) {
output.replace(index + outputOffset, index + outputOffset + find_length, replace);
outputOffset = outputOffset + (replace_length - find_length);
index = input.indexOf(find, index + find_length);
}
String result = output.toString();
return result;
}
/**
* Returns a named string for the specified key.
*
* @param name the name of the String resource required.
* @return the requested resource
*/
public String getString(String name)</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/transport/mailets/CommandListservManager.java</td><td><a href="./xref/org/apache/james/transport/mailets/CommandListservManager.html#416">416</a></td></tr><tr class="a"><td>org/apache/james/transport/mailets/CommandListservProcessor.java</td><td><a href="./xref/org/apache/james/transport/mailets/CommandListservProcessor.html#518">518</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> }
/**
* Retrieves a data field, potentially defined by a super class.
* @return null if not found, the object otherwise
*/
protected static Object getField(Object instance, String name) throws IllegalAccessException {
Class clazz = instance.getClass();
Field[] fields;
while (clazz != null) {
fields = clazz.getDeclaredFields();
for (int index = 0; index &lt; fields.length; index++) {
Field field = fields[index];
if (field.getName().equals(name)) {
field.setAccessible(true);
return field.get(instance);
}
}
clazz = clazz.getSuperclass();
}
return null;
}</pre></div></td></tr><table class="bodyTable"></p><p><table class="bodyTable"><tr class="a"><th>File</th><th>Line</th></tr><tr class="b"><td>org/apache/james/pop3server/POP3Handler.java</td><td><a href="./xref/org/apache/james/pop3server/POP3Handler.html#570">570</a></td></tr><tr class="a"><td>org/apache/james/pop3server/POP3Handler.java</td><td><a href="./xref/org/apache/james/pop3server/POP3Handler.html#613">613</a></td></tr><tr class="b"><td colspan='2'><div class="source"><pre> if (argument == null) {
long size = 0;
int count = 0;
try {
for (Iterator i = userMailbox.iterator(); i.hasNext(); ) {
Mail mc = (Mail) i.next();
if (mc != DELETED) {
size += mc.getMessageSize();
count++;
}
}
StringBuffer responseBuffer =
new StringBuffer(32)
.append(OK_RESPONSE)
.append(&quot; &quot;)
.append(count)
.append(&quot; &quot;)
.append(size);
responseString = responseBuffer.toString();
writeLoggedFlushedResponse(responseString);</pre></div></td></tr><table class="bodyTable"></p></div>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">&#169;
2002-2009
The Apache Software Foundation
</div>
<div class="clear">
<hr/>
</div>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1384591-1";
urchinTracker();
</script>
</body>
</html>