Benoit Tellier created JAMES-3828:
-------------------------------------

             Summary: ava.lang.ClassCastException: class [B cannot be cast to 
class org.apache.mailet.AttributeValue ([B is in module java.base of loader 
'bootstrap'; org.apache.mailet.AttributeValue is in unnamed module of loader 
'app')
                 Key: JAMES-3828
                 URL: https://issues.apache.org/jira/browse/JAMES-3828
             Project: James Server
          Issue Type: Bug
          Components: Mailet Contributions
    Affects Versions: master
            Reporter: Benoit Tellier
             Fix For: 3.8.0


Got the following error today


{code:java}
exception       java.lang.ClassCastException: class [B cannot be cast to class 
org.apache.mailet.AttributeValue ([B is in module java.base of loader 
'bootstrap'; org.apache.mailet.AttributeValue is in unnamed module of loader 
'app')
 at 
org.apache.mailet.Serializer$MapSerializer.lambda$serialize$0(Serializer.java:507)
  at 
com.google.common.collect.CollectCollectors.lambda$toImmutableMap$6(CollectCollectors.java:185)
   at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(Unknown Source)
    at 
java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown 
Source)
     at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown 
Source)
       at 
java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
        at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
         at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
          at 
org.apache.mailet.Serializer$MapSerializer.serialize(Serializer.java:507)
           at 
org.apache.mailet.Serializer$MapSerializer.serialize(Serializer.java:503)
            at org.apache.mailet.AttributeValue.toJson(AttributeValue.java:256)
             at 
org.apache.mailet.AttributeValue.duplicate(AttributeValue.java:250)
              at org.apache.mailet.Attribute.duplicate(Attribute.java:62)
               at 
java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
                at 
java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(Unknown Source)
                 at 
java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
                  at 
java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
                   at 
java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
                    at 
java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
                     at 
java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
                      at 
org.apache.james.server.core.MailImpl.duplicateAttributes(MailImpl.java:117)
                       at 
org.apache.james.server.core.MailImpl.duplicateWithoutMessage(MailImpl.java:111)
                        at 
org.apache.james.server.core.MailImpl.duplicate(MailImpl.java:97)
                         at 
org.apache.james.mailetcontainer.impl.MatcherSplitter.split(MatcherSplitter.java:149)
                          at 
org.apache.james.mailetcontainer.impl.MailetProcessorImpl.lambda$executeProcessingStep$3(MailetProcessorImpl.java:158)
{code}

The postmortem is that for XYZ reason, we ingested a Map that do not have the 
good actual types thus we fail serializing the associate attribute. This 
prevent us from duplicating the attributes and causes the mail not to be split, 
thus aborting mail processing.

We do not know where invalid data was first generated.

That's weaknesses of the Java parameter type systems.

We shall:
 - Avoid serializing / deserializing attributes to duplicate them and instead 
do something smarter
 - Reject invalid collections/bad type parameters as early as possible.

This is potentially due to a custom extension.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to