You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2009/04/08 10:43:20 UTC
svn commit: r763140 - in /james/imap/trunk: ./
processor/src/main/java/org/apache/james/imap/processor/fetch/
stage/org.apache.james/jars/ stage/org.apache.james/poms/
store/src/main/java/org/apache/james/imap/store/
torque/src/main/java/org/apache/jam...
Author: rdonkin
Date: Wed Apr 8 08:43:19 2009
New Revision: 763140
URL: http://svn.apache.org/viewvc?rev=763140&view=rev
Log:
Upgrade to latest Mime4j
Added:
james/imap/trunk/stage/org.apache.james/jars/apache-mime4j-0.6.jar (with props)
james/imap/trunk/stage/org.apache.james/poms/apache-mime4j-0.6.pom (with props)
Removed:
james/imap/trunk/stage/org.apache.james/jars/apache-mime4j-0.4.jar
Modified:
james/imap/trunk/include.properties
james/imap/trunk/pom.xml
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java
james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearcher.java
james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearches.java
james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MimeDescriptorImpl.java
james/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java
james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java
james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java
james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageRowUtils.java
james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearcher.java
james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearches.java
james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MimeDescriptorImpl.java
james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/PartContentBuilder.java
james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueResultIterator.java
Modified: james/imap/trunk/include.properties
URL: http://svn.apache.org/viewvc/james/imap/trunk/include.properties?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/include.properties (original)
+++ james/imap/trunk/include.properties Wed Apr 8 08:43:19 2009
@@ -147,7 +147,7 @@
serp.jar=${path.lib.serp}/${jarname.serp}
# ----- Mime4J-----
-jarname.mime4j.jar=apache-mime4j-0.4.jar
+jarname.mime4j.jar=apache-mime4j-0.6.jar
mime4j.jar=${path.lib.james}/${jarname.mime4j.jar}
# --------------------------------------------------
Modified: james/imap/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/imap/trunk/pom.xml?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/pom.xml (original)
+++ james/imap/trunk/pom.xml Wed Apr 8 08:43:19 2009
@@ -319,7 +319,7 @@
<dependency>
<groupId>org.apache.james</groupId>
<artifactId>apache-mime4j</artifactId>
- <version>0.4</version>
+ <version>0.6</version>
</dependency>
<!-- Declare javamail as provided to be able to easily switch -->
<!-- to different implementations (Geronimo) -->
Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java (original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/fetch/EnvelopeBuilder.java Wed Apr 8 08:43:19 2009
@@ -38,7 +38,6 @@
import org.apache.james.mime4j.field.address.DomainList;
import org.apache.james.mime4j.field.address.Group;
import org.apache.james.mime4j.field.address.MailboxList;
-import org.apache.james.mime4j.field.address.NamedMailbox;
import org.apache.james.mime4j.field.address.parser.ParseException;
final class EnvelopeBuilder {
@@ -150,17 +149,11 @@
private FetchResponse.Envelope.Address buildMailboxAddress(
final org.apache.james.mime4j.field.address.Mailbox mailbox) {
- final String name;
- if (mailbox instanceof NamedMailbox) {
- final NamedMailbox namedMailbox = (NamedMailbox) mailbox;
- name = namedMailbox.getName();
- } else {
- name = null;
- }
+ final String name = mailbox.getName();
final String domain = mailbox.getDomain();
final DomainList route = mailbox.getRoute();
final String atDomainList;
- if (route == null) {
+ if (route == null || route.size() == 0) {
atDomainList = null;
} else {
atDomainList = route.toRouteString();
Added: james/imap/trunk/stage/org.apache.james/jars/apache-mime4j-0.6.jar
URL: http://svn.apache.org/viewvc/james/imap/trunk/stage/org.apache.james/jars/apache-mime4j-0.6.jar?rev=763140&view=auto
==============================================================================
Binary file - no diff available.
Propchange: james/imap/trunk/stage/org.apache.james/jars/apache-mime4j-0.6.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: james/imap/trunk/stage/org.apache.james/poms/apache-mime4j-0.6.pom
URL: http://svn.apache.org/viewvc/james/imap/trunk/stage/org.apache.james/poms/apache-mime4j-0.6.pom?rev=763140&view=auto
==============================================================================
--- james/imap/trunk/stage/org.apache.james/poms/apache-mime4j-0.6.pom (added)
+++ james/imap/trunk/stage/org.apache.james/poms/apache-mime4j-0.6.pom Wed Apr 8 08:43:19 2009
@@ -0,0 +1,379 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+ <parent>
+ <artifactId>james-project</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>1.2</version>
+ <!-- Either this really points to the james-project/pom.xml or you
+ will have to tune the local repository, later, in this file -->
+ <relativePath>../james-project/project/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.james</groupId>
+ <artifactId>apache-mime4j</artifactId>
+ <name>Apache JAMES Mime4j</name>
+ <version>0.6</version>
+ <description>Java stream based MIME message parser</description>
+ <url>http://james.apache.org/mime4j</url>
+ <issueManagement>
+ <url>http://issues.apache.org/jira/browse/MIME4J</url>
+ </issueManagement>
+ <inceptionYear>2004</inceptionYear>
+ <distributionManagement>
+ <site>
+ <id>mime4j-website</id>
+ <url>scp://minotaur.apache.org/www/james.apache.org/mime4j/</url>
+ </site>
+ </distributionManagement>
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/james/mime4j/tags/apache-mime4j-0.6</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/james/mime4j/tags/apache-mime4j-0.6</developerConnection>
+ <url>http://svn.apache.org/viewvc/james/mime4j/tags/apache-mime4j-0.6</url>
+ </scm>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rat-maven-plugin</artifactId>
+ <version>1.0-alpha-3</version>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ <version>2.4.1</version>
+ <executions>
+ <execution>
+ <id>generate-jjtree</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>jjtree-javacc</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-javacc</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>javacc</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>${compileSource}</source>
+ <target>${compileSource}</target>
+ <encoding>iso8859-1</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <archive>
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ <manifestEntries>
+ <Specification-Title>Apache Mime4j</Specification-Title>
+ <Specification-Version>${pom.version}</Specification-Version>
+ <Specification-Vendor>The Apache Software Foundation</Specification-Vendor>
+ <Implementation-Title>Apache Mime4j</Implementation-Title>
+ <Implementation-Version>${pom.version}</Implementation-Version>
+ <Implementation-Vendor>The Apache Software Foundation</Implementation-Vendor>
+ <Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
+ <url>${pom.url}</url>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.5</version>
+ <executions>
+ <execution>
+ <id>create-javadocs</id> <!-- this is used for inheritance merges -->
+ <phase>package</phase> <!-- append to the packaging phase. -->
+ <goals>
+ <goal>javadoc</goal> <!-- goals == mojos -->
+ <goal>jar</goal> <!-- goals == mojos -->
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <excludePackageNames>org.apache.james.mime4j.field.address.parser:org.apache.james.mime4j.field.contentdisposition.parser:org.apache.james.mime4j.field.contenttype.parser:org.apache.james.mime4j.field.datetime.parser:org.apache.james.mime4j.field.language.parser:org.apache.james.mime4j.field.mimeversion.parser:org.apache.james.mime4j.field.structured.parser</excludePackageNames>
+ </configuration>
+ </plugin>
+ <!-- Add NOTICE and LICENSE to generated JAR -->
+ <plugin>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <resourceBundles>
+ <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle>
+ </resourceBundles>
+ <properties>
+ <addLicense>true</addLicense>
+ </properties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.0.4</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ </plugin>
+ -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.4.3</version>
+ <executions>
+ <execution>
+ <id>bundle-manifest</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ </execution>
+ </executions>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>org.apache.james.mime4j.*</Export-Package>
+ <Embed-Dependency>*;scope=runtime</Embed-Dependency>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-2</version>
+ <configuration>
+ <descriptorSourceDirectory>${basedir}/src/assemble/</descriptorSourceDirectory>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id> <!-- this is used for inheritance merges -->
+ <phase>package</phase> <!-- append to the packaging phase. -->
+ <goals>
+ <goal>attached</goal> <!-- goals == mojos -->
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>local-mime4j-stage-repository</id>
+ <name>Local mime4j stage repository</name>
+ <!-- Please note that due to http://jira.codehaus.org/browse/MNG-2896 -->
+ <!-- If you don't have james-project checked out in ../james-project -->
+ <!-- you will have to place your absolute path to the project instead -->
+ <!-- of ${basedir}, or, otherwise, manually install the parent poms -->
+ <!--
+ mvn -fignorepom.xml install:install-file
+ -Dfile=stage\org.apache.james\poms\james-parent-1.1.pom
+ -Dpackaging=pom
+ -DgroupId=org.apache.james
+ -DartifactId=james-parent
+ -Dversion=1.1
+ mvn -fignorepom.xml install:install-file
+ -Dfile=stage\org.apache.james\poms\james-project-1.2.pom
+ -Dpackaging=pom
+ -DgroupId=org.apache.james
+ -DartifactId=james-project
+ -Dversion=1.2
+ -->
+ <url>file://${basedir}/stage</url>
+ <layout>legacy</layout>
+ <snapshots>
+ <enabled>true</enabled>
+ <checksumPolicy>ignore</checksumPolicy>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <checksumPolicy>ignore</checksumPolicy>
+ </releases>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <type>jar</type>
+ <!-- Removed as a workaround for an unidentified M2 bug -->
+ <scope>test</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ <scope>test</scope>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-changes-plugin</artifactId>
+ <configuration>
+ <onlyCurrentVersion>true</onlyCurrentVersion>
+ <resolutionIds>Closed</resolutionIds>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>jira-report</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.4.3</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.5</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jxr-plugin</artifactId>
+ <version>2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <targetJdk>${compileSource}</targetJdk>
+ <rulesets>
+ <ruleset>/rulesets/basic.xml</ruleset>
+ <ruleset>/rulesets/controversial.xml</ruleset>
+ </rulesets>
+ <format>xml</format>
+ <linkXref>true</linkXref>
+ <sourceEncoding>utf-8</sourceEncoding>
+ <minimumTokens>100</minimumTokens>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>2.0-beta-7</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rat-maven-plugin</artifactId>
+ <version>1.0-alpha-3</version>
+ <configuration>
+ <excludes>
+ <!-- test resources created by JAMES committers / we can't include ALv2 headers there -->
+ <exclude>src/test/resources/testmsgs/*</exclude>
+ <exclude>benchmarks/resources/*.msg</exclude>
+ <!-- 3rd party descriptors distributed via maven repositories
+ and included "as is" -->
+ <exclude>stage/commons-io/poms/commons-io-1.2.pom</exclude>
+ <exclude>stage/commons-logging/poms/commons-logging-1.1.pom</exclude>
+ <exclude>stage/org.apache.james/xmls/james-parent-1.1-site.xml</exclude>
+ <exclude>stage/org.apache.james/xmls/james-parent-1.1-site_en.xml</exclude>
+ <exclude>stage/org.apache.james/xmls/james-project-1.2-site.xml</exclude>
+ <exclude>stage/org.apache.james/xmls/james-project-1.2-site_en.xml</exclude>
+ <exclude>release.properties</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>taglist-maven-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ <version>2.4.1</version>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <mailingLists>
+ <mailingList>
+ <name>Apache Mime4j Lists</name>
+ <subscribe>mime4j-dev-subscribe@james.apache.org</subscribe>
+ <unsubscribe>mime4j-dev-unsubscribe@james.apache.org</unsubscribe>
+ <post>mime4j-dev@james.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/james-mime4j-dev/</archive>
+ </mailingList>
+ </mailingLists>
+
+ <properties>
+ <compileSource>1.5</compileSource>
+ </properties>
+</project>
Propchange: james/imap/trunk/stage/org.apache.james/poms/apache-mime4j-0.6.pom
------------------------------------------------------------------------------
svn:eol-style = native
Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearcher.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearcher.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearcher.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearcher.java Wed Apr 8 08:43:19 2009
@@ -185,7 +185,7 @@
private boolean checkHeader(final boolean isCaseInsensitive,
final CharBuffer buffer, boolean result, MimeTokenStream parser)
throws IOException {
- final String value = parser.getFieldValue();
+ final String value = parser.getField().getBody();
final StringReader reader = new StringReader(value);
if (isFoundIn(reader, buffer, isCaseInsensitive)) {
result = true;
Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearches.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearches.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearches.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MessageSearches.java Wed Apr 8 08:43:19 2009
@@ -146,6 +146,8 @@
}
} catch (IOException e) {
throw new MailboxException(e);
+ } catch (MimeException e) {
+ throw new MailboxException(e);
}
}
Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MimeDescriptorImpl.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MimeDescriptorImpl.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MimeDescriptorImpl.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/MimeDescriptorImpl.java Wed Apr 8 08:43:19 2009
@@ -40,7 +40,7 @@
public class MimeDescriptorImpl implements MimeDescriptor {
- public static MimeDescriptorImpl build(final Document document) throws IOException {
+ public static MimeDescriptorImpl build(final Document document) throws IOException, MimeException {
final MimeDescriptorImpl result;
final String mediaType = document.getMediaType();
if (isComposite(mediaType)) {
@@ -83,7 +83,7 @@
return "message".equalsIgnoreCase(mediaType) || "multipart".equalsIgnoreCase(mediaType);
}
- public static MimeDescriptorImpl build(final InputStream stream) throws IOException {
+ public static MimeDescriptorImpl build(final InputStream stream) throws IOException, MimeException {
final MimeTokenStream parser = MimeTokenStream
.createMaximalDescriptorStream();
parser.parse(stream);
@@ -99,8 +99,8 @@
&& next != MimeTokenStream.T_END_OF_STREAM
&& next != MimeTokenStream.T_START_MULTIPART) {
if (next == MimeTokenStream.T_FIELD) {
- headers.add(new ResultHeader(parser.getFieldName(), parser
- .getFieldValue().trim()));
+ headers.add(new ResultHeader(parser.getField().getName(), parser
+ .getField().getBody().trim()));
}
next = parser.next();
}
@@ -123,7 +123,7 @@
private static MimeDescriptorImpl compositePartDescriptor(
final MimeTokenStream parser, final Collection headers)
- throws IOException {
+ throws IOException, MimeException {
MaximalBodyDescriptor descriptor = (MaximalBodyDescriptor) parser
.getBodyDescriptor();
MimeDescriptorImpl mimeDescriptor = createDescriptor(0, 0, descriptor,
@@ -141,7 +141,7 @@
private static MimeDescriptorImpl simplePartDescriptor(
final MimeTokenStream parser, final Collection headers)
- throws IOException {
+ throws IOException, MimeException {
MaximalBodyDescriptor descriptor = (MaximalBodyDescriptor) parser
.getBodyDescriptor();
final MimeDescriptorImpl mimeDescriptorImpl;
Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/PartContentBuilder.java Wed Apr 8 08:43:19 2009
@@ -55,7 +55,7 @@
topLevel = true;
}
- private void skipToStartOfInner(int position) throws IOException {
+ private void skipToStartOfInner(int position) throws IOException, MimeException {
final int state = parser.next();
switch (state) {
case MimeTokenStream.T_START_MULTIPART:
@@ -71,7 +71,7 @@
}
}
- public void to(int position) throws IOException {
+ public void to(int position) throws IOException, MimeException {
try {
if (topLevel) {
topLevel = false;
@@ -103,7 +103,7 @@
}
}
- private void ignoreInnerMessage() throws IOException {
+ private void ignoreInnerMessage() throws IOException, UnexpectedEOFException, MimeException {
for (int state = parser.next(); state != MimeTokenStream.T_END_MULTIPART; state = parser
.next()) {
switch (state) {
@@ -117,18 +117,18 @@
}
}
- public Content getFullContent() throws IOException {
+ public Content getFullContent() throws IOException, UnexpectedEOFException, MimeException {
final List headers = getMimeHeaders();
final byte[] content = mimeBodyContent();
return new FullContent(ByteBuffer.wrap(content), headers);
}
- public Content getMessageBodyContent() throws IOException {
+ public Content getMessageBodyContent() throws IOException, MimeException {
final byte[] content = messageBodyContent();
return new ByteContent(ByteBuffer.wrap(content));
}
- private byte[] messageBodyContent() throws IOException {
+ private byte[] messageBodyContent() throws IOException, MimeException {
final byte[] content;
if (empty) {
content = EMPTY;
@@ -163,12 +163,12 @@
return content;
}
- public Content getMimeBodyContent() throws IOException {
+ public Content getMimeBodyContent() throws IOException, MimeException {
final byte[] content = mimeBodyContent();
return new ByteContent(ByteBuffer.wrap(content));
}
- private byte[] mimeBodyContent() throws IOException {
+ private byte[] mimeBodyContent() throws IOException, MimeException {
final byte[] content;
if (empty) {
content = EMPTY;
@@ -193,7 +193,7 @@
}
@SuppressWarnings("unchecked")
- public List<MessageResult.Header> getMimeHeaders() throws IOException {
+ public List<MessageResult.Header> getMimeHeaders() throws IOException, UnexpectedEOFException, MimeException {
final List<MessageResult.Header> results;
if (empty) {
results = Collections.EMPTY_LIST;
@@ -206,8 +206,8 @@
throw new UnexpectedEOFException();
case MimeTokenStream.T_FIELD:
- final String fieldValue = parser.getFieldValue().trim();
- final String fieldName = parser.getFieldName();
+ final String fieldValue = parser.getField().getBody().trim();
+ final String fieldName = parser.getField().getName();
ResultHeader header = new ResultHeader(fieldName, fieldValue);
results.add(header);
break;
@@ -218,7 +218,7 @@
}
@SuppressWarnings("unchecked")
- public List<MessageResult.Header> getMessageHeaders() throws IOException {
+ public List<MessageResult.Header> getMessageHeaders() throws IOException, MimeException {
final List<MessageResult.Header> results;
if (empty) {
results = Collections.EMPTY_LIST;
@@ -234,9 +234,8 @@
throw new IOException("Unexpected EOF");
case MimeTokenStream.T_FIELD:
- final String fieldValue = parser.getFieldValue()
- .trim();
- final String fieldName = parser.getFieldName();
+ final String fieldValue = parser.getField().getBody().trim();
+ final String fieldName = parser.getField().getName();
ResultHeader header = new ResultHeader(fieldName, fieldValue);
results.add(header);
break;
@@ -249,7 +248,7 @@
return results;
}
- private void advancedToMessage() throws IOException {
+ private void advancedToMessage() throws IOException, UnexpectedEOFException, MimeException {
for (int state = parser.getState(); state != MimeTokenStream.T_START_MESSAGE; state = parser
.next()) {
if (state == MimeTokenStream.T_END_OF_STREAM) {
Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/ResultUtils.java Wed Apr 8 08:43:19 2009
@@ -119,12 +119,14 @@
addPartContent(fetchGroup, message, messageResult);
} catch (IOException e) {
throw new MailboxException(e);
+ } catch (MimeException e) {
+ throw new MailboxException(e);
}
}
return messageResult;
}
- private static void addMimeDescriptor(MailboxMembership message, MessageResultImpl messageResult) throws IOException {
+ private static void addMimeDescriptor(MailboxMembership message, MessageResultImpl messageResult) throws IOException, MimeException {
MimeDescriptor descriptor = MimeDescriptorImpl.build(message.getDocument());
messageResult.setMimeDescriptor(descriptor);
}
Modified: james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java (original)
+++ james/imap/trunk/store/src/main/java/org/apache/james/imap/store/StoreMailbox.java Wed Apr 8 08:43:19 2009
@@ -53,6 +53,7 @@
import org.apache.james.imap.store.mail.model.Mailbox;
import org.apache.james.imap.store.mail.model.MailboxMembership;
import org.apache.james.imap.store.mail.model.PropertyBuilder;
+import org.apache.james.mime4j.MimeException;
import org.apache.james.mime4j.descriptor.MaximalBodyDescriptor;
import org.apache.james.mime4j.parser.MimeTokenStream;
@@ -121,7 +122,7 @@
&& next != MimeTokenStream.T_END_OF_STREAM
&& next != MimeTokenStream.T_START_MULTIPART) {
if (next == MimeTokenStream.T_FIELD) {
- String fieldValue = parser.getFieldValue();
+ String fieldValue = parser.getField().getBody();
if (fieldValue.endsWith("\r\f")) {
fieldValue = fieldValue.substring(0,fieldValue.length() - 2);
}
@@ -129,7 +130,7 @@
fieldValue = fieldValue.substring(1);
}
final Header header
- = createHeader(++lineNumber, parser.getFieldName(),
+ = createHeader(++lineNumber, parser.getField().getName(),
fieldValue);
headers.add(header);
}
@@ -204,7 +205,9 @@
throw new MailboxException(e);
} catch (MessagingException e) {
throw new MailboxException(e);
- }
+ } catch (MimeException e) {
+ throw new MailboxException(e);
+ }
}
}
Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageRowUtils.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageRowUtils.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageRowUtils.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageRowUtils.java Wed Apr 8 08:43:19 2009
@@ -124,7 +124,7 @@
public static MessageResult loadMessageResult(final MessageRow messageRow,
final FetchGroup fetchGroup) throws TorqueException,
- MailboxException {
+ MailboxException, MimeException {
MessageResultImpl messageResult = new MessageResultImpl();
messageResult.setUid(messageRow.getUid());
@@ -160,13 +160,15 @@
addPartContent(fetchGroup, messageRow, messageResult);
} catch (IOException e) {
throw new TorqueException("Cannot parse message", e);
+ } catch (MimeException e) {
+ throw new TorqueException("Cannot parse message", e);
}
}
return messageResult;
}
private static void addMimeDescriptor(MessageRow messageRow,
- MessageResultImpl messageResult) throws TorqueException {
+ MessageResultImpl messageResult) throws TorqueException, MimeException {
try {
MimeDescriptor descriptor = MimeDescriptorImpl
.build(toInput(messageRow));
Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearcher.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearcher.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearcher.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearcher.java Wed Apr 8 08:43:19 2009
@@ -185,7 +185,7 @@
private boolean checkHeader(final boolean isCaseInsensitive,
final CharBuffer buffer, boolean result, MimeTokenStream parser)
throws IOException {
- final String value = parser.getFieldValue();
+ final String value = parser.getField().getBody();
final StringReader reader = new StringReader(value);
if (isFoundIn(reader, buffer, isCaseInsensitive)) {
result = true;
Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearches.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearches.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearches.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearches.java Wed Apr 8 08:43:19 2009
@@ -75,9 +75,10 @@
* <code>MessageRow</code>, not null
* @return true if the row matches the given criteria, false otherwise
* @throws TorqueException
+ * @throws MimeException
*/
public boolean isMatch(final SearchQuery query, final MessageRow row)
- throws TorqueException {
+ throws TorqueException, MimeException {
final List criteria = query.getCriterias();
final Collection recentMessageUids = query.getRecentMessageUids();
boolean result = true;
@@ -103,9 +104,10 @@
* <code>MessageRow</code>, not null
* @return true if the row matches the given criterion, false otherwise
* @throws TorqueException
+ * @throws MimeException
*/
public boolean isMatch(SearchQuery.Criterion criterion, MessageRow row,
- final Collection recentMessageUids) throws TorqueException {
+ final Collection recentMessageUids) throws TorqueException, MimeException {
final boolean result;
if (criterion instanceof SearchQuery.InternalDateCriterion) {
result = matches((SearchQuery.InternalDateCriterion) criterion, row);
@@ -132,7 +134,7 @@
}
private boolean matches(SearchQuery.TextCriterion criterion, MessageRow row)
- throws TorqueException {
+ throws TorqueException, MimeException {
try {
final SearchQuery.ContainsOperator operator = criterion
.getOperator();
@@ -177,7 +179,7 @@
private boolean matches(SearchQuery.ConjunctionCriterion criterion,
MessageRow row, final Collection recentMessageUids)
- throws TorqueException {
+ throws TorqueException, MimeException {
final List criteria = criterion.getCriteria();
switch (criterion.getType()) {
case NOR:
@@ -192,7 +194,7 @@
}
private boolean and(final List criteria, final MessageRow row,
- final Collection recentMessageUids) throws TorqueException {
+ final Collection recentMessageUids) throws TorqueException, MimeException {
boolean result = true;
for (Iterator it = criteria.iterator(); it.hasNext();) {
final SearchQuery.Criterion criterion = (SearchQuery.Criterion) it
@@ -207,7 +209,7 @@
}
private boolean or(final List criteria, final MessageRow row,
- final Collection recentMessageUids) throws TorqueException {
+ final Collection recentMessageUids) throws TorqueException, MimeException {
boolean result = false;
for (Iterator it = criteria.iterator(); it.hasNext();) {
final SearchQuery.Criterion criterion = (SearchQuery.Criterion) it
@@ -222,7 +224,7 @@
}
private boolean nor(final List criteria, final MessageRow row,
- final Collection recentMessageUids) throws TorqueException {
+ final Collection recentMessageUids) throws TorqueException, MimeException {
boolean result = true;
for (Iterator it = criteria.iterator(); it.hasNext();) {
final SearchQuery.Criterion criterion = (SearchQuery.Criterion) it
Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MimeDescriptorImpl.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MimeDescriptorImpl.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MimeDescriptorImpl.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/MimeDescriptorImpl.java Wed Apr 8 08:43:19 2009
@@ -38,7 +38,7 @@
public class MimeDescriptorImpl implements MimeDescriptor {
public static MimeDescriptorImpl build(final InputStream stream)
- throws IOException {
+ throws IOException, MimeException {
final MimeTokenStream parser = MimeTokenStream
.createMaximalDescriptorStream();
parser.parse(stream);
@@ -54,8 +54,8 @@
&& next != MimeTokenStream.T_END_OF_STREAM
&& next != MimeTokenStream.T_START_MULTIPART) {
if (next == MimeTokenStream.T_FIELD) {
- headers.add(new Header(parser.getFieldName(), parser
- .getFieldValue().trim()));
+ headers.add(new Header(parser.getField().getName(), parser
+ .getField().getBody().trim()));
}
next = parser.next();
}
@@ -78,7 +78,7 @@
private static MimeDescriptorImpl compositePartDescriptor(
final MimeTokenStream parser, final Collection headers)
- throws IOException {
+ throws IOException, MimeException {
MaximalBodyDescriptor descriptor = (MaximalBodyDescriptor) parser
.getBodyDescriptor();
MimeDescriptorImpl mimeDescriptor = createDescriptor(0, 0, descriptor,
@@ -96,7 +96,7 @@
private static MimeDescriptorImpl simplePartDescriptor(
final MimeTokenStream parser, final Collection headers)
- throws IOException {
+ throws IOException, MimeException {
MaximalBodyDescriptor descriptor = (MaximalBodyDescriptor) parser
.getBodyDescriptor();
final MimeDescriptorImpl mimeDescriptorImpl;
Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/PartContentBuilder.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/PartContentBuilder.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/PartContentBuilder.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/PartContentBuilder.java Wed Apr 8 08:43:19 2009
@@ -53,7 +53,7 @@
topLevel = true;
}
- private void skipToStartOfInner(int position) throws IOException {
+ private void skipToStartOfInner(int position) throws IOException, MimeException {
final int state = parser.next();
switch (state) {
case MimeTokenStream.T_START_MULTIPART:
@@ -69,7 +69,7 @@
}
}
- public void to(int position) throws IOException {
+ public void to(int position) throws IOException, MimeException {
try {
if (topLevel) {
topLevel = false;
@@ -101,7 +101,7 @@
}
}
- private void ignoreInnerMessage() throws IOException {
+ private void ignoreInnerMessage() throws IOException, UnexpectedEOFException, MimeException {
for (int state = parser.next(); state != MimeTokenStream.T_END_MULTIPART; state = parser
.next()) {
switch (state) {
@@ -115,18 +115,18 @@
}
}
- public Content getFullContent() throws IOException {
+ public Content getFullContent() throws IOException, MimeException {
final List headers = getMimeHeaders();
final byte[] content = mimeBodyContent();
return new FullContent(content, headers);
}
- public Content getMessageBodyContent() throws IOException {
+ public Content getMessageBodyContent() throws IOException, MimeException {
final byte[] content = messageBodyContent();
return new ByteContent(content);
}
- private byte[] messageBodyContent() throws IOException {
+ private byte[] messageBodyContent() throws IOException, MimeException {
final byte[] content;
if (empty) {
content = EMPTY;
@@ -161,12 +161,12 @@
return content;
}
- public Content getMimeBodyContent() throws IOException {
+ public Content getMimeBodyContent() throws IOException, MimeException {
final byte[] content = mimeBodyContent();
return new ByteContent(content);
}
- private byte[] mimeBodyContent() throws IOException {
+ private byte[] mimeBodyContent() throws IOException, MimeException {
final byte[] content;
if (empty) {
content = EMPTY;
@@ -190,7 +190,7 @@
return content;
}
- public List getMimeHeaders() throws IOException {
+ public List getMimeHeaders() throws IOException, MimeException {
final List results;
if (empty) {
results = Collections.EMPTY_LIST;
@@ -203,8 +203,8 @@
throw new UnexpectedEOFException();
case MimeTokenStream.T_FIELD:
- final String fieldValue = parser.getFieldValue().trim();
- final String fieldName = parser.getFieldName();
+ final String fieldValue = parser.getField().getBody().trim();
+ final String fieldName = parser.getField().getName();
Header header = new Header(fieldName, fieldValue);
results.add(header);
break;
@@ -214,7 +214,7 @@
return results;
}
- public List getMessageHeaders() throws IOException {
+ public List getMessageHeaders() throws IOException, MimeException {
final List results;
if (empty) {
results = Collections.EMPTY_LIST;
@@ -230,9 +230,9 @@
throw new IOException("Unexpected EOF");
case MimeTokenStream.T_FIELD:
- final String fieldValue = parser.getFieldValue()
+ final String fieldValue = parser.getField().getBody()
.trim();
- final String fieldName = parser.getFieldName();
+ final String fieldName = parser.getField().getName();
Header header = new Header(fieldName, fieldValue);
results.add(header);
break;
@@ -245,7 +245,7 @@
return results;
}
- private void advancedToMessage() throws IOException {
+ private void advancedToMessage() throws IOException, MimeException {
for (int state = parser.getState(); state != MimeTokenStream.T_START_MESSAGE; state = parser
.next()) {
if (state == MimeTokenStream.T_END_OF_STREAM) {
Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java Wed Apr 8 08:43:19 2009
@@ -62,6 +62,7 @@
import org.apache.james.mailboxmanager.torque.om.MessageHeader;
import org.apache.james.mailboxmanager.torque.om.MessageRow;
import org.apache.james.mailboxmanager.torque.om.MessageRowPeer;
+import org.apache.james.mime4j.MimeException;
import org.apache.torque.NoRowsException;
import org.apache.torque.TooManyRowsException;
import org.apache.torque.TorqueException;
@@ -339,7 +340,7 @@
public MessageResult fillMessageResult(MessageRow messageRow,
FetchGroup result) throws TorqueException, MessagingException,
- MailboxException {
+ MailboxException, MimeException {
return MessageRowUtils.loadMessageResult(messageRow, result);
}
@@ -429,6 +430,8 @@
throw new MailboxException(e);
} catch (MessagingException e) {
throw new MailboxException(e);
+ } catch (MimeException e) {
+ throw new MailboxException(e);
}
} finally {
lock.readLock().release();
@@ -660,6 +663,8 @@
return uids.iterator();
} catch (TorqueException e) {
throw new MailboxException(e);
+ } catch (MimeException e) {
+ throw new MailboxException(e);
} finally {
lock.readLock().release();
}
@@ -789,6 +794,8 @@
throw new MailboxException(e);
} catch (MessagingException e) {
throw new MailboxException(e);
+ } catch (MimeException e) {
+ throw new MailboxException(e);
}
}
Modified: james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueResultIterator.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueResultIterator.java?rev=763140&r1=763139&r2=763140&view=diff
==============================================================================
--- james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueResultIterator.java (original)
+++ james/imap/trunk/torque/src/main/java/org/apache/james/mailboxmanager/torque/TorqueResultIterator.java Wed Apr 8 08:43:19 2009
@@ -37,6 +37,7 @@
import org.apache.james.imap.mailbox.MessageResult.FetchGroup;
import org.apache.james.imap.mailbox.util.FetchGroupImpl;
import org.apache.james.mailboxmanager.torque.om.MessageRow;
+import org.apache.james.mime4j.MimeException;
import org.apache.torque.TorqueException;
public class TorqueResultIterator implements Iterator {
@@ -90,6 +91,8 @@
new MailboxException(e));
} catch (MailboxException e) {
result = new UnloadedMessageResult(messageRow, e);
+ } catch (MimeException e) {
+ result = new UnloadedMessageResult(messageRow, new MailboxException(e));
}
return result;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org