Please, we need you to post your Animals.mailFetch() implementation in order to test your complete test case.
Regards
Isomorphic Software
Announcement
Collapse
No announcement yet.
X
-
Hi Isomorphic,
I could reproduce in v12.0p_2021-03-31 BuiltInDS SuperDevMode.
Please edit the "information" field of Elephant in the GUI to the text of #1, then click the "Send mail" button.
Build path: Add velocity-tools-generic-2.0.jar
server.properties: Add mailserver config
BuiltInDS.java:
Code:package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.Version; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.AdvancedCriteria; import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.OperatorId; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout mainLayout; private ListGrid animalsGrid; private IButton recreateBtn; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); mainLayout = new VLayout(20); mainLayout.setWidth100(); mainLayout.setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(); } }); mainLayout.addMember(recreateBtn); recreate(); mainLayout.draw(); } private void recreate() { Window w = new Window(); w.setWidth("95%"); w.setHeight("95%"); w.setMembersMargin(0); w.setModalMaskOpacity(70); w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); w.setTitle("\"outputs\" problem with Criteria" + w.getTitle()); w.setShowMinimizeButton(false); w.setIsModal(true); w.setShowModalMask(true); w.centerInPage(); animalsGrid = new ListGrid(DataSource.get("animals")); animalsGrid.setCanEdit(true); animalsGrid.setAutoFetchData(true); animalsGrid.setInitialCriteria(new AdvancedCriteria("commonName", OperatorId.STARTS_WITH, "E")); VLayout vL = new VLayout(10); IButton sendEmailBtn = new IButton("Send email about elephant", new ClickHandler() { @Override public void onClick(ClickEvent event) { DataSource.get("animals").fetchData(new AdvancedCriteria("commonName", OperatorId.EQUALS, "Elephant (African)"), null, new DSRequest() { { setOperationId("mailFetch"); } }); } }); sendEmailBtn.setWidth(600); vL.addMembers(animalsGrid, sendEmailBtn); w.addItem(vL); w.show(); } }
Code:<DataSource serverConstructor="com.smartgwt.sample.server.listener.MySQLDataSource" ID="animals" serverType="sql" tableName="animals" testFileName="animals.data.xml" useAnsiJoins="true" > <fields> <field name="commonName" title="Animal" type="text" /> <field name="scientificName" title="Scientific Name" type="text" primaryKey="true" required="true" /> <field name="status" title="Endangered Status" type="text"> <valueMap> <value>Threatened</value> <value>Endangered</value> <value>Not Endangered</value> <value>Not currently listed</value> <value>May become threatened</value> <value>Protected</value> </valueMap> </field> <field name="diet" title="Diet" type="text" customSQL="true" /> <field name="information" title="Interesting Facts" type="text" length="1000" escapeHTML="true" /> <field name="picture" title="Picture" type="image" detail="true" imageURLPrefix="/isomorphic/system/reference/inlineExamples/tiles/images/"/> <field name="lifeSpan" title="Life Span" type="integer" /> </fields> <serverObject lookupStyle="new" className="com.smartgwt.sample.server.listener.Animals" /> <operationBindings> <operationBinding operationType="fetch" operationId="mailFetch" serverMethod="mailFetch" progressiveLoading="true"> <mail contentType="text/html"> <from>MYADDRESS</from> <to>blama@gmx.net</to> <bcc>blama@gmx.net</bcc> <subject>My test mail</subject> <templateFile>mails/testmail.html</templateFile> </mail> </operationBinding> </operationBindings> </DataSource>
Code:<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style type="text/css"> body { font-family: 'Open Sans', Arial, sans-serif; font-size: 10pt; } </style> </head> <body> <table cellspacing="0" cellpadding="0" border="0" width="100%"> <tr> <td> <table cellspacing="0" cellpadding="10" border="1"> <tr> <td width="660" colspan="2" style="background-color: #FFFFFF;" border="0"> Some information about the selected animal: </td> </tr> <tr> <td width="160" style="background-color: gray"><b>Animal</b></td> <td width="500" style="background-color: white">$!esc.html($commonName)</td> </tr> <tr> <td width="160" style="background-color: gray"><b>Scientific Name</b></td> <td width="500" style="background-color: white">$!esc.html($scientificName)</td> </tr> <tr> <td width="160" style="background-color: gray"><b>Endangered Status</b></td> <td width="500" style="background-color: white">$!esc.html($status)</td> </tr> <tr> <td width="160" style="background-color: gray"><b>Diet</b></td> <td width="500" style="background-color: white">$!esc.html($diet)</td> </tr> <tr> <td width="160" style="background-color: gray"><b>Interesting Facts</b></td> <td width="500" style="background-color: white">$!esc.html($information)</td> </tr> <tr> <td width="160" style="background-color: gray"><b>Life Span</b></td> <td width="500" style="background-color: white">$!esc.html($lifeSpan)</td> </tr> </table> </td> </tr> </table> $!esc.html($information) </body> </html>
Code:=== 2021-07-21 12:10:20,545 [2-87] INFO RequestContext - URL: '/builtinds/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0': Moz (Gecko) with Accept-Encoding header === 2021-07-21 12:10:20,550 [2-87] DEBUG XML - Parsed XML from (in memory stream): 4ms === 2021-07-21 12:10:20,552 [2-87] DEBUG RPCManager - Processing 1 requests. === 2021-07-21 12:10:20,552 [2-87] DEBUG RPCManager - Request #1 (DSRequest) payload: { criteria:{ fieldName:"commonName", operator:"equals", value:"Elephant (African)", _constructor:"AdvancedCriteria" }, operationConfig:{ dataSource:"animals", repo:null, operationType:"fetch", textMatchStyle:"exact" }, appID:"builtinApplication", operation:"mailFetch", oldValues:{ fieldName:"commonName", operator:"equals", value:"Elephant (African)", _constructor:"AdvancedCriteria" } } === 2021-07-21 12:10:20,552 [2-87] INFO IDACall - Performing 1 operation(s) [UA: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0] === 2021-07-21 12:10:20,552 [2-87] INFO DSRequest - Executing animals.fetch[operationId: mailFetch] === 2021-07-21 12:10:20,552 [2-87] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2021-07-21 12:10:20,552 [2-87] DEBUG DeclarativeSecurity - DataSource animals is not in the pre-checked list, processing... === 2021-07-21 12:10:20,553 [2-87] INFO DSRequest - Executing animals.fetch[operationId: mailFetch] === 2021-07-21 12:10:20,553 [2-87] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2021-07-21 12:10:20,553 [2-87] DEBUG DeclarativeSecurity - DataSource animals is not in the pre-checked list, processing... === 2021-07-21 12:10:20,553 [2-87] DEBUG AppBase - [builtinApplication.mailFetch] No userTypes defined, allowing anyone access to all operations for this application === 2021-07-21 12:10:20,553 [2-87] DEBUG AppBase - [builtinApplication.mailFetch] No public zero-argument method named '_mailFetch' found, performing generic datasource operation === 2021-07-21 12:10:20,553 [2-87] INFO SQLDataSource - [builtinApplication.mailFetch] Performing fetch operation with criteria: {fieldName:"commonName",operator:"equals",value:"Elephant (African)",_constructor:"AdvancedCriteria"} values: {fieldName:"commonName",operator:"equals",value:"Elephant (African)",_constructor:"AdvancedCriteria"} === 2021-07-21 12:10:20,553 [2-87] INFO SQLDataSource - [builtinApplication.mailFetch] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause === 2021-07-21 12:10:20,554 [2-87] INFO SQLDataSource - [builtinApplication.mailFetch] 20: Executing SQL query on 'HSQLDB': SELECT animals.commonName, animals.scientificName, animals.status, animals.information, animals.picture, animals.lifeSpan FROM animals WHERE (animals.commonName = 'Elephant (African)' AND animals.commonName IS NOT NULL) === 2021-07-21 12:10:20,554 [2-87] DEBUG SQLConnectionManager - [builtinApplication.mailFetch] Borrowed connection '819445190' === 2021-07-21 12:10:20,554 [2-87] INFO SQLDriver - [builtinApplication.mailFetch] Executing SQL query on 'HSQLDB' using connection '819445190': SELECT animals.commonName, animals.scientificName, animals.status, animals.information, animals.picture, animals.lifeSpan FROM animals WHERE (animals.commonName = 'Elephant (African)' AND animals.commonName IS NOT NULL) === 2021-07-21 12:10:20,555 [2-87] INFO MailMessage - trying to connect to mail.myserver.net === 2021-07-21 12:10:21,009 [2-87] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 20 === 2021-07-21 12:10:21,009 [2-87] DEBUG SQLDriver - Freeing SQLDriver dbConnection 819445190 for SQLDriver instance 1812667079 === 2021-07-21 12:10:21,009 [2-87] DEBUG SQLConnectionManager - About to close connection with hashcode "819445190" === 2021-07-21 12:10:21,009 [2-87] DEBUG DataSourceDMI - Invocation threw exception javax.mail.internet.AddressException: Illegal semicolon, not in group in string ``Christian <christian.lastname@company.de>'' at position 13 at javax.mail.internet.InternetAddress.parse(InternetAddress.java:863) at javax.mail.internet.InternetAddress.parse(InternetAddress.java:575) at javax.mail.internet.InternetAddress.<init>(InternetAddress.java:107) at com.isomorphic.mail.MailMessage.buildMessage(MailMessage.java:516) at com.isomorphic.mail.TemplatedMailMessage.buildMessage(TemplatedMailMessage.java:260) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:3367) at com.smartgwt.sample.server.listener.Animals.mailFetch(Animals.java:11) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.isomorphic.base.Reflection._invokeMethod(Reflection.java:580) at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:895) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:434) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2874) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:226) at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:183) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:148) at com.isomorphic.servlet.IDACall._processRequest(IDACall.java:119) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:79) at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:175) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260) at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:93) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:95) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Unknown Source) === 2021-07-21 12:10:21,009 [2-87] WARN RequestContext - dsRequest.execute() failed: javax.mail.internet.AddressException: Illegal semicolon, not in group in string ``Christian <christian.lastname@company.de>'' at position 13 at javax.mail.internet.InternetAddress.parse(InternetAddress.java:863) at javax.mail.internet.InternetAddress.parse(InternetAddress.java:575) at javax.mail.internet.InternetAddress.<init>(InternetAddress.java:107) at com.isomorphic.mail.MailMessage.buildMessage(MailMessage.java:516) at com.isomorphic.mail.TemplatedMailMessage.buildMessage(TemplatedMailMessage.java:260) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:3367) at com.smartgwt.sample.server.listener.Animals.mailFetch(Animals.java:11) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.isomorphic.base.Reflection._invokeMethod(Reflection.java:580) at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:895) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:434) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2874) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:226) at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:183) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:148) at com.isomorphic.servlet.IDACall._processRequest(IDACall.java:119) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:79) at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:175) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260) at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:93) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:95) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Unknown Source) === 2021-07-21 12:10:21,010 [2-87] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8 === 2021-07-21 12:10:21,010 [2-87] DEBUG RPCManager - non-DMI response, dropExtraFields: false === 2021-07-21 12:10:21,010 [2-87] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 20 === 2021-07-21 12:10:21,010 [2-87] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 20 === 2021-07-21 12:10:21,010 [2-87] DEBUG SQLDataSource - About to clear SQLDriver state for DS instance 20 === 2021-07-21 12:10:21,010 [2-87] INFO Compression - /builtinds/sc/IDACall: 167 -> 149 bytes
Blama
Leave a comment:
-
Out of interest, what does TemplatedMailMessage.java:260 and surrounding code look like?
Leave a comment:
-
Interesting theory, but if true, it should be easy to isolate into a test case where there are not so many other possibilities for the failure. Can you do so?
Leave a comment:
-
12.0p Mail sending problem, perhaps mail header and content mixup (?)
Hi Isomorphic,
I have a super strange issue, where sending mails via your <mail> tags fails.
This is the exception stack trace (v12.0p_2020-03-11):
Code:javax.mail.internet.AddressException: Illegal semicolon, not in group in string ``Christian <christian.lastname@company.de>'' at position 13 at javax.mail.internet.InternetAddress.parse(InternetAddress.java:863) at javax.mail.internet.InternetAddress.parse(InternetAddress.java:575) at javax.mail.internet.InternetAddress.<init>(InternetAddress.java:107) at com.isomorphic.mail.MailMessage.buildMessage(MailMessage.java:516) at com.isomorphic.mail.TemplatedMailMessage.buildMessage(TemplatedMailMessage.java:260) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:3323) at com.lmscompany.lms.server.sendmail.RecurringMailsSender.processMailJob(RecurringMailsSender.java:112) at com.lmscompany.lms.server.sendmail.RecurringMailsSender.sendDueMails(RecurringMailsSender.java:50) at com.lmscompany.lms.server.sendmail.SendMailProcess.sendMails(SendMailProcess.java:12) at com.lmscompany.lms.server.jobs.SendMailJob.execute(SendMailJob.java:54) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Code:<td>$!esc.html($lead.STATUS_STATUSCOMMENT)</td>
Code:Von: otherLN, otherGN <otherGN.otherLN@company.de> Gesendet: Montag, 5. Juli 2021 19:15 An: Vertrieb <vertrieb@company.de> Cc: Lastname, Christian <christian.lastname@company.de> Betreff: WG: xxx Hallo Frau xxx, ... ...
Is it somehow possible that because of the way you try to build the mail in TemplatedMailMessage.java:260 the content is somehow interpreted as header further down the line and this "CC: ..." is not valid? (";" in HTML-encoded content for "<" etc.).
When I add customSelectExpression="null" in the .ds.xml for the STATUS_STATUSCOMMENT-field, and by this remove the content from the mail, the mail sending succeeds.
Thank you & Best regards
BlamaTags: None
Leave a comment: