adobe / bridgeService

The BridgeService is a library that allows your project to access java code to which you do not have implicite and normal access. Use cases are JS/Python/C++ accessing Java objects or java objects that are protected, and that you do not want to distribute as a library.
MIT License
6 stars 3 forks source link

Issue with multi-part emails #159

Closed baubakg closed 1 month ago

baubakg commented 2 months ago

It seems that multip-part emails cause the bridgeService to fail

{
    "title": "JSON Transformation issue : Problem processing request. The given json could not be mapped to a Java Call",
    "code": 404,
    "detail": "No serializer found for class javax.mail.Provider$Type and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.adobe.campaign.tests.bridge.service.JavaCallResults[\"returnValues\"]->java.util.HashMap[\"fetchEmail\"]->java.util.ArrayList[0]->java.util.HashMap[\"content\"]->javax.mail.internet.MimeMultipart[\"parent\"]->javax.mail.internet.MimeMessage[\"session\"]->javax.mail.Session[\"providers\"]->com.sun.mail.imap.IMAPProvider[0]->com.sun.mail.imap.IMAPProvider[\"type\"])",
    "bridgeServiceException": "com.fasterxml.jackson.databind.exc.InvalidDefinitionException",
    "originalException": "Not Set",
    "originalMessage": "Not Set",
    "failureAtStep": "Generating Response",
    "stackTrace": [
        "com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77)",
        "com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1330)",
        "com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:414)",
        "com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:53)",
        "com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:30)",
        "com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)",
        "com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)",
        "com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)",
        "com.fasterxml.jackson.databind.ser.std.ObjectArraySerializer.serializeContents(ObjectArraySerializer.java:253)",
        "com.fasterxml.jackson.databind.ser.std.ObjectArraySerializer.serialize(ObjectArraySerializer.java:214)",
        "com.fasterxml.jackson.databind.ser.std.ObjectArraySerializer.serialize(ObjectArraySerializer.java:23)",
        "com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)",
        "com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)",
        "com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)",
        "com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)",
        "com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)",
        "com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)",
        "com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)",
        "com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)",
        "com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)",
        "com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:808)",
        "com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeWithoutTypeInfo(MapSerializer.java:764)",
        "com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:720)",
        "com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:35)",
        "com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)",
        "com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)",
        "com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)",
        "com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:808)",
        "com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeWithoutTypeInfo(MapSerializer.java:764)",
        "com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:720)",
        "com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:35)",
        "com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)",
        "com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)",
        "com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:183)",
        "com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:502)",
        "com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:341)",
        "com.fasterxml.jackson.databind.ObjectMapper._writeValueAndClose(ObjectMapper.java:4799)",
        "com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:4040)",
        "com.adobe.campaign.tests.bridge.service.BridgeServiceFactory.transformJavaCallResultsToJSON(BridgeServiceFactory.java:43)",
        "com.adobe.campaign.tests.bridge.service.IntegroAPI.lambda$startServices$7(IntegroAPI.java:145)",
        "spark.RouteImpl$1.handle(RouteImpl.java:72)",
        "spark.http.matching.Routes.execute(Routes.java:61)",
        "spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:134)",
        "spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)",
        "org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1598)",
        "org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)",
        "org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)",
        "org.eclipse.jetty.server.Server.handle(Server.java:516)",
        "org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)",
        "org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)",
        "org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)",
        "org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)",
        "org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)",
        "org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)",
        "org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)",
        "org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)",
        "org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)",
        "org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)",
        "org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:137)",
        "org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)",
        "org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)",
        "java.base/java.lang.Thread.run(Thread.java:834)"
    ]
}
baubakg commented 1 month ago

Conclusion : MetaUtils#extractValuesFromObject should only extract serializeable data