Closed BrenoTrancoso closed 7 years ago
Thank you for finding and reporting this! I have written a unit test, seen it fail, and fixed the issue. I'm currently looking for other possible instances of this same bug and hope to have a build in a few hours.
I use arrays in Paguro so we don't have to use them anywhere else. What are you doing that you need an array? Why would you pass a shorter array to this method? You don't need to answer, I just like to understand when people use Paguro in ways I never thought to.
This issue is fixed in 2.1.1. Please upgrade at your earliest convenience. I could not find any other place where the issue occurs. Thanks again!
mensagem.setRecipients(RecipientType.TO, destinatario.map(e -> Email.getInternetAddress(e.getKey(), e.getValue())).toImList().stream().toArray(InternetAddress[]::new));
javax.mail.internet.MimeMessage.setRecipients needs a array. A empty array is just to get a typed array.
I've used stream as alternative.
String[] array = vec("A", "B", "C").toArray(new String[0]); -> java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;
String[] array = vec("A", "B", "C").toArray(new String[3]); -> This works.
UnmodCollection.toArray(T[] as):
to