Skip to content

Commit 819ee4b

Browse files
authored
Fixed commons-vfs sandbox module not compiling due to missing imports and libraries (#634)
1 parent bbfcda1 commit 819ee4b

File tree

6 files changed

+18
-11
lines changed

6 files changed

+18
-11
lines changed

commons-vfs2-sandbox/pom.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
<groupId>commons-logging</groupId>
4343
<artifactId>commons-logging</artifactId>
4444
</dependency>
45+
<dependency>
46+
<groupId>commons-io</groupId>
47+
<artifactId>commons-io</artifactId>
48+
</dependency>
4549
<dependency>
4650
<groupId>jcifs</groupId>
4751
<artifactId>jcifs</artifactId>
@@ -79,11 +83,6 @@
7983
<artifactId>junit-vintage-engine</artifactId>
8084
<scope>test</scope>
8185
</dependency>
82-
<dependency>
83-
<groupId>commons-io</groupId>
84-
<artifactId>commons-io</artifactId>
85-
<scope>test</scope>
86-
</dependency>
8786
</dependencies>
8887

8988
<properties>

commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeAttributesMap.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
import org.apache.commons.logging.LogFactory;
3434

3535
import jakarta.mail.Address;
36+
import jakarta.mail.Header;
37+
import jakarta.mail.Message;
3638
import jakarta.mail.MessagingException;
39+
import jakarta.mail.Part;
3740
import jakarta.mail.internet.MimeMessage;
3841

3942
/**
@@ -136,19 +139,19 @@ private Map<String, Object> createMap() {
136139
if (part instanceof MimeMessage) {
137140
final MimeMessage message = (MimeMessage) part;
138141
try {
139-
final Address[] address = message.getRecipients(RecipientType.BCC);
142+
final Address[] address = message.getRecipients(Message.RecipientType.BCC);
140143
ret.put(OBJECT_PREFIX + "Recipients.BCC", address);
141144
} catch (final MessagingException e) {
142145
log.debug(e.getLocalizedMessage(), e);
143146
}
144147
try {
145-
final Address[] address = message.getRecipients(RecipientType.CC);
148+
final Address[] address = message.getRecipients(Message.RecipientType.CC);
146149
ret.put(OBJECT_PREFIX + "Recipients.CC", address);
147150
} catch (final MessagingException e) {
148151
log.debug(e.getLocalizedMessage(), e);
149152
}
150153
try {
151-
final Address[] address = message.getRecipients(RecipientType.TO);
154+
final Address[] address = message.getRecipients(Message.RecipientType.TO);
152155
ret.put(OBJECT_PREFIX + "Recipients.TO", address);
153156
} catch (final MessagingException e) {
154157
log.debug(e.getLocalizedMessage(), e);

commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileContentInfoFactory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import org.apache.commons.vfs2.impl.DefaultFileContentInfo;
2424

2525
import jakarta.mail.MessagingException;
26+
import jakarta.mail.Part;
27+
import jakarta.mail.internet.ContentType;
2628

2729
/**
2830
* Gets access to the content info stuff for mime objects.
@@ -31,7 +33,7 @@ public class MimeFileContentInfoFactory implements FileContentInfoFactory {
3133
@Override
3234
public FileContentInfo create(final FileContent fileContent) throws FileSystemException {
3335
final MimeFileObject mimeFile = (MimeFileObject) fileContent.getFile();
34-
final Part part = mimeFile.getPart();
36+
final Part part = (Part) mimeFile.getPart();
3537

3638
String contentTypeString = null;
3739
String charset = null;

commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileObject.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package org.apache.commons.vfs2.provider.mime;
1818

19+
import jakarta.mail.Header;
1920
import java.io.ByteArrayInputStream;
2021
import java.io.InputStream;
2122
import java.util.ArrayList;
@@ -37,6 +38,7 @@
3738
import jakarta.mail.Message;
3839
import jakarta.mail.MessagingException;
3940
import jakarta.mail.Multipart;
41+
import jakarta.mail.Part;
4042
import jakarta.mail.internet.MimeMultipart;
4143

4244
/**
@@ -64,7 +66,7 @@ protected void doAttach() throws Exception {
6466
return;
6567
}
6668

67-
setPart(((MimeFileSystem) getFileSystem()).createCommunicationLink());
69+
setPart((Part) ((MimeFileSystem) getFileSystem()).createCommunicationLink());
6870
}
6971
}
7072

commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/mime/MimeFileSystem.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.apache.commons.vfs2.util.SharedRandomContentInputStream;
3434

3535
import jakarta.mail.MessagingException;
36+
import jakarta.mail.Part;
3637
import jakarta.mail.internet.MimeMessage;
3738

3839
/**

commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/FileObjectDataSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.io.InputStream;
2121
import java.io.OutputStream;
2222

23-
import javax.activation.DataSource;
23+
import jakarta.activation.DataSource;
2424

2525
import org.apache.commons.vfs2.FileObject;
2626
import org.apache.commons.vfs2.FileSystemException;

0 commit comments

Comments
 (0)