Skip to content

Commit

Permalink
fixup! [UPGRADE] - Maven commons-io:commons-io 2.11.0 -> 2.13.0 - ada…
Browse files Browse the repository at this point in the history
…pt new version
  • Loading branch information
vttranlina committed Jul 18, 2023
1 parent 601ccd2 commit 902e991
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
import javax.mail.Flags.Flag;

import org.apache.commons.io.input.TeeInputStream;
import org.apache.commons.io.input.UnsynchronizedBufferedInputStream;
import org.apache.commons.io.input.UnsynchronizedFilterInputStream;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.james.events.EventBus;
Expand Down Expand Up @@ -107,7 +109,6 @@
import org.apache.james.mime4j.stream.RecursionMode;
import org.apache.james.util.io.BodyOffsetInputStream;
import org.apache.james.util.io.InputStreamConsummer;
import org.apache.james.util.io.UnsynchronizedBufferedInputStream;
import org.apache.james.util.streams.Iterators;
import org.reactivestreams.Publisher;

Expand Down Expand Up @@ -358,7 +359,10 @@ public AppendResult appendMessage(InputStream msgIn, Date internalDate, final Ma
file = Files.createTempFile("imap", ".msg").toFile();
try (FileOutputStream out = new FileOutputStream(file);
BufferedOutputStream bufferedOut = new BufferedOutputStream(out);
UnsynchronizedBufferedInputStream tmpMsgIn = new UnsynchronizedBufferedInputStream(new TeeInputStream(msgIn, bufferedOut));
UnsynchronizedFilterInputStream tmpMsgIn = UnsynchronizedBufferedInputStream.builder()
.setInputStream(new TeeInputStream(msgIn, bufferedOut))
.setBufferSize(8192)
.get();
BodyOffsetInputStream bIn = new BodyOffsetInputStream(tmpMsgIn)) {
Pair<PropertyBuilder, HeaderImpl> pair = parseProperties(bIn);
PropertyBuilder propertyBuilder = pair.getLeft();
Expand Down Expand Up @@ -405,8 +409,10 @@ private Mono<AppendResult> appendMessage(Content msgIn, Date internalDate, final
}

try (InputStream contentStream = msgIn.getInputStream();
UnsynchronizedBufferedInputStream bufferedContentStream = new UnsynchronizedBufferedInputStream(contentStream);
BodyOffsetInputStream bIn = new BodyOffsetInputStream(bufferedContentStream)) {
UnsynchronizedFilterInputStream bufferedContentStream = UnsynchronizedBufferedInputStream.builder()
.setInputStream(contentStream)
.get();
BodyOffsetInputStream bIn = new BodyOffsetInputStream(bufferedContentStream)) {
Pair<PropertyBuilder, HeaderImpl> pair = parseProperties(bIn);
PropertyBuilder propertyBuilder = pair.getLeft();
HeaderImpl headers = pair.getRight();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

import javax.mail.MessagingException;

import org.apache.james.util.io.UnsynchronizedBufferedInputStream;
import org.apache.commons.io.input.UnsynchronizedBufferedInputStream;
import org.bouncycastle.cert.jcajce.JcaCertStoreBuilder;
import org.bouncycastle.cert.selector.X509CertificateHolderSelector;
import org.bouncycastle.cert.selector.jcajce.JcaX509CertSelectorConverter;
Expand Down Expand Up @@ -101,7 +101,10 @@ public KeyStoreHolder(String keyStoreFileName, String keyStorePassword, String k
}

keyStore = KeyStore.getInstance(keyStoreType);
keyStore.load(new UnsynchronizedBufferedInputStream(new FileInputStream(keyStoreFileName)), keyStorePassword.toCharArray());
keyStore.load(UnsynchronizedBufferedInputStream
.builder()
.setInputStream(new FileInputStream(keyStoreFileName))
.get(), keyStorePassword.toCharArray());
if (keyStore.size() == 0) {
throw new KeyStoreException("The keystore must be not empty");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;

import org.apache.james.util.io.UnsynchronizedBufferedInputStream;
import org.apache.commons.io.input.UnsynchronizedBufferedInputStream;
import org.bouncycastle.cert.jcajce.JcaCertStore;
import org.bouncycastle.cms.SignerInfoGenerator;
import org.bouncycastle.cms.jcajce.JcaSimpleSignerInfoGeneratorBuilder;
Expand Down Expand Up @@ -128,7 +128,11 @@ public SMIMEKeyHolder(String keyStoreFileName, String keyStorePassword, String k
}

KeyStore keyStore = KeyStore.getInstance(keyStoreType);
keyStore.load(new UnsynchronizedBufferedInputStream(new FileInputStream(keyStoreFileName)), keyStorePassword.toCharArray());

keyStore.load(UnsynchronizedBufferedInputStream.builder()
.setInputStream(new FileInputStream(keyStoreFileName))
.get(),
keyStorePassword.toCharArray());

Enumeration<String> aliases = keyStore.aliases();
if (keyAlias == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;

import org.apache.james.util.io.UnsynchronizedBufferedInputStream;
import org.apache.commons.io.input.UnsynchronizedBufferedInputStream;
import org.apache.mailet.AttributeName;
import org.apache.mailet.AttributeUtils;
import org.apache.mailet.AttributeValue;
Expand Down Expand Up @@ -119,8 +119,9 @@ private void processAttachment(Mail mail, Map<String, AttributeValue<?>> attach
continue;
}
byte[] bytes = (byte[]) i.next().getValue();
InputStream is = new UnsynchronizedBufferedInputStream(
new ByteArrayInputStream(bytes));
InputStream is = UnsynchronizedBufferedInputStream.builder()
.setInputStream(new ByteArrayInputStream(bytes))
.get();
MimeBodyPart p = new MimeBodyPart(is);
if (!(message.isMimeType("multipart/*") && (message
.getContent() instanceof MimeMultipart))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.input.UnsynchronizedBufferedInputStream;
import org.apache.commons.io.output.DeferredFileOutputStream;
import org.apache.james.lifecycle.api.Disposable;
import org.apache.james.util.SizeFormat;
import org.apache.james.util.io.UnsynchronizedBufferedInputStream;

/**
* Takes an input stream and creates a repeatable input stream source for a
Expand Down Expand Up @@ -186,7 +186,10 @@ public InputStream getInputStream() throws IOException {
if (getResource().getOut().isInMemory()) {
return new ByteArrayInputStream(getResource().getOut().getData());
} else {
InputStream in = new UnsynchronizedBufferedInputStream(new FileInputStream(getResource().getOut().getFile()), 2048);
InputStream in = UnsynchronizedBufferedInputStream.builder()
.setInputStream(new FileInputStream(getResource().getOut().getFile()))
.setBufferSize(2048)
.get();
getResource().streams.add(in);
return in;
}
Expand Down

This file was deleted.

0 comments on commit 902e991

Please sign in to comment.