[jira] [Commented] (OFBIZ-9230) Missing reference to the delegator in framework/widget/templates/HtmlFormMacroLibrary.ftl
[ https://issues.apache.org/jira/browse/OFBIZ-9230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15900907#comment-15900907 ] Jacques Le Roux commented on OFBIZ-9230: Completed for other macro types at revision: 1785925 Backported both in R16.11 r1785926 > Missing reference to the delegator in > framework/widget/templates/HtmlFormMacroLibrary.ftl > - > > Key: OFBIZ-9230 > URL: https://issues.apache.org/jira/browse/OFBIZ-9230 > Project: OFBiz > Issue Type: Bug > Components: ALL COMPONENTS >Affects Versions: Trunk >Reporter: Wei Zhang >Assignee: Jacques Le Roux >Priority: Minor > Fix For: Upcoming Release > > Attachments: OFBIZ-9230.patch > > > To reproduce > 1. Load test data systemPropertyId="widget.autocompleter.defaultMinLength" > systemPropertyValue="3"/> > 2. Open https://localhost:8443/partymgr/control/main > 3. You will still get warning below in log file > {quote} > 2017-02-24 12:56:16,348 |http-nio-8443-exec-7 |EntityUtilProperties > |I| Could not get a system property for widget.autocompleter.defaultMinLength > : null > {quote} -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (OFBIZ-9230) Missing reference to the delegator in framework/widget/templates/HtmlFormMacroLibrary.ftl
[ https://issues.apache.org/jira/browse/OFBIZ-9230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15894602#comment-15894602 ] Jacques Le Roux commented on OFBIZ-9230: Pierre, No, and that is the problem > Missing reference to the delegator in > framework/widget/templates/HtmlFormMacroLibrary.ftl > - > > Key: OFBIZ-9230 > URL: https://issues.apache.org/jira/browse/OFBIZ-9230 > Project: OFBiz > Issue Type: Bug > Components: ALL COMPONENTS >Affects Versions: Trunk >Reporter: Wei Zhang >Assignee: Jacques Le Roux >Priority: Minor > Attachments: OFBIZ-9230.patch > > > To reproduce > 1. Load test data systemPropertyId="widget.autocompleter.defaultMinLength" > systemPropertyValue="3"/> > 2. Open https://localhost:8443/partymgr/control/main > 3. You will still get warning below in log file > {quote} > 2017-02-24 12:56:16,348 |http-nio-8443-exec-7 |EntityUtilProperties > |I| Could not get a system property for widget.autocompleter.defaultMinLength > : null > {quote} -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (OFBIZ-9230) Missing reference to the delegator in framework/widget/templates/HtmlFormMacroLibrary.ftl
[ https://issues.apache.org/jira/browse/OFBIZ-9230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15893856#comment-15893856 ] Jacques Le Roux commented on OFBIZ-9230: Let's think about the situation in all its aspects (and be ready to dive in ;)). First your proposition for WidgetWorker would be actually something like this {code} Index: framework/widget/src/main/java/org/apache/ofbiz/widget/WidgetWorker.java === --- framework/widget/src/main/java/org/apache/ofbiz/widget/WidgetWorker.java (revision 1785155) +++ framework/widget/src/main/java/org/apache/ofbiz/widget/WidgetWorker.java (working copy) @@ -35,6 +35,7 @@ import org.apache.ofbiz.base.util.UtilHttp; import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.entity.Delegator; +import org.apache.ofbiz.entity.DelegatorFactory; import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.webapp.control.ConfigXMLReader; import org.apache.ofbiz.webapp.control.RequestHandler; @@ -410,6 +411,16 @@ public static Delegator getDelegator(Mapcontext) { Delegator delegator = (Delegator) context.get("delegator"); +if (delegator == null) { +// this will be the common case for now as the delegator isn't available where we want to do this +// we'll cheat a little here and assume the default delegator +Debug.logError("Could not get a delegator using the 'default' delegator", module); +delegator = DelegatorFactory.getDelegator("default"); +if (delegator == null) { +Debug.logError("Could not get a delegator even trying with the 'default' delegator", module); +return null; +} +} return delegator; } } {code} In the convo, you suggested {code} delegator = DelegatorFactory.getDelegator(delegatorName); {code} I asked you what should be in delegatorName, but you did not answer and that's the crux of the problem. We will see that later I suggested to use in EntityUtilProperties.getSystemPropertyValue() {code} delegator = DelegatorFactory.getDelegator("default"); {code} because it fixes the problem at hand while the patch above for getDelegator() does not (simply try it w/o the getSystemPropertyValue() patch). So far so good, we saw that we have the same kind of think in checkRhsType(), which should then actually be patched with {code} Index: framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityExpr.java === --- framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityExpr.java (revision 1785155) +++ framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityExpr.java (working copy) @@ -18,11 +18,13 @@ ***/ package org.apache.ofbiz.entity.condition; +import java.io.IOException; import java.util.Collection; import java.util.List; import java.util.Map; import org.apache.ofbiz.base.util.Debug; +import org.apache.ofbiz.base.util.GeneralException; import org.apache.ofbiz.base.util.ObjectType; import org.apache.ofbiz.base.util.UtilGenerics; import org.apache.ofbiz.entity.Delegator; @@ -161,7 +163,7 @@ visitor.acceptEntityExpr(this); } -public void checkRhsType(ModelEntity modelEntity, Delegator delegator) { +public void checkRhsType(ModelEntity modelEntity, Delegator delegator) throws IOException, GeneralException { if (this.rhs == null || this.rhs == GenericEntity.NULL_FIELD || modelEntity == null) return; Object value = this.rhs; @@ -179,9 +181,13 @@ } if (delegator == null) { -// this will be the common case for now as the delegator isn't available where we want to do this -// we'll cheat a little here and assume the default delegator delegator = DelegatorFactory.getDelegator("default"); +Debug.logError("Could not get a delegator using the 'default' delegator", module); +if (delegator == null) { +Debug.logError("Could not get a delegator even trying with the 'default' delegator", module); +GeneralException exception = new GeneralException("Could not get a delegator even trying with the 'default' delegator"); +throw exception; +} } String fieldName = null; {code} And now I get to the reason for this analysis: *multitenant*! My patch for getSystemPropertyValue() works in a simple tenant context. But in a multitenant context it will always refer to the "default" tenant, which can be a problem. Same for the other patches above including the checkRhsType() one. BTW the change introduced there is prior (2008) to multitenant
[jira] [Commented] (OFBIZ-9230) Missing reference to the delegator in framework/widget/templates/HtmlFormMacroLibrary.ftl
[ https://issues.apache.org/jira/browse/OFBIZ-9230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15892108#comment-15892108 ] Rishi Solanki commented on OFBIZ-9230: -- Thanks for putting all things together and I'm good with the fix provided. The patch attached will fix the issue reported. Also I like the idea of logging the message that system lost the delegator and now using the default delegator, Thanks! == Debug.logError("Could not get delegator using the 'default' delegator", module); == Apart from the patch provided, can we consider the WidgetWorker class fix suggested over ML. I think it would cover the #3 point mentioned by Wei, that means systel will have the capability to get the delegator again if some how it drops due to some reason. I don't have very strong recommendations see if we can consider this. > Missing reference to the delegator in > framework/widget/templates/HtmlFormMacroLibrary.ftl > - > > Key: OFBIZ-9230 > URL: https://issues.apache.org/jira/browse/OFBIZ-9230 > Project: OFBiz > Issue Type: Bug > Components: ALL COMPONENTS >Affects Versions: Trunk >Reporter: Wei Zhang >Assignee: Rishi Solanki >Priority: Minor > Attachments: OFBIZ-9230.patch > > > To reproduce > 1. Load test data systemPropertyId="widget.autocompleter.defaultMinLength" > systemPropertyValue="3"/> > 2. Open https://localhost:8443/partymgr/control/main > 3. You will still get warning below in log file > {quote} > 2017-02-24 12:56:16,348 |http-nio-8443-exec-7 |EntityUtilProperties > |I| Could not get a system property for widget.autocompleter.defaultMinLength > : null > {quote} -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (OFBIZ-9230) Missing reference to the delegator in framework/widget/templates/HtmlFormMacroLibrary.ftl
[ https://issues.apache.org/jira/browse/OFBIZ-9230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15891068#comment-15891068 ] Jacques Le Roux commented on OFBIZ-9230: I put a proposition in the thread > Missing reference to the delegator in > framework/widget/templates/HtmlFormMacroLibrary.ftl > - > > Key: OFBIZ-9230 > URL: https://issues.apache.org/jira/browse/OFBIZ-9230 > Project: OFBiz > Issue Type: Bug > Components: ALL COMPONENTS >Affects Versions: Trunk >Reporter: Wei Zhang >Assignee: Jacques Le Roux >Priority: Minor > > To reproduce > 1. Load test data systemPropertyId="widget.autocompleter.defaultMinLength" > systemPropertyValue="3"/> > 2. Open https://localhost:8443/partymgr/control/main > 3. You will still get warning below in log file > {quote} > 2017-02-24 12:56:16,348 |http-nio-8443-exec-7 |EntityUtilProperties > |I| Could not get a system property for widget.autocompleter.defaultMinLength > : null > {quote} -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (OFBIZ-9230) Missing reference to the delegator in framework/widget/templates/HtmlFormMacroLibrary.ftl
[ https://issues.apache.org/jira/browse/OFBIZ-9230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15887113#comment-15887113 ] Wei Zhang commented on OFBIZ-9230: -- See http://ofbiz.135035.n4.nabble.com/Should-not-catch-Exception-in-EntityUtilProperties-getSystemPropertyValue-td4702833.html > Missing reference to the delegator in > framework/widget/templates/HtmlFormMacroLibrary.ftl > - > > Key: OFBIZ-9230 > URL: https://issues.apache.org/jira/browse/OFBIZ-9230 > Project: OFBiz > Issue Type: Bug > Components: ALL COMPONENTS >Affects Versions: Trunk >Reporter: Wei Zhang >Assignee: Jacques Le Roux >Priority: Minor > > To reproduce > 1. Load test data systemPropertyId="widget.autocompleter.defaultMinLength" > systemPropertyValue="3"/> > 2. Open https://localhost:8443/partymgr/control/main > 3. You will still get warning below in log file > {quote} > 2017-02-24 12:56:16,348 |http-nio-8443-exec-7 |EntityUtilProperties > |I| Could not get a system property for widget.autocompleter.defaultMinLength > : null > {quote} -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (OFBIZ-9230) Missing reference to the delegator in framework/widget/templates/HtmlFormMacroLibrary.ftl
[ https://issues.apache.org/jira/browse/OFBIZ-9230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15885479#comment-15885479 ] Jacques Le Roux commented on OFBIZ-9230: Hi Wei, Yes maybe indeed. Since nobody else interacted here I suggest we discuss that with the community on the dev ML. Could you please start the thread? > Missing reference to the delegator in > framework/widget/templates/HtmlFormMacroLibrary.ftl > - > > Key: OFBIZ-9230 > URL: https://issues.apache.org/jira/browse/OFBIZ-9230 > Project: OFBiz > Issue Type: Bug > Components: ALL COMPONENTS >Affects Versions: Trunk >Reporter: Wei Zhang >Assignee: Jacques Le Roux >Priority: Minor > > To reproduce > 1. Load test data systemPropertyId="widget.autocompleter.defaultMinLength" > systemPropertyValue="3"/> > 2. Open https://localhost:8443/partymgr/control/main > 3. You will still get warning below in log file > {quote} > 2017-02-24 12:56:16,348 |http-nio-8443-exec-7 |EntityUtilProperties > |I| Could not get a system property for widget.autocompleter.defaultMinLength > : null > {quote} -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (OFBIZ-9230) Missing reference to the delegator in framework/widget/templates/HtmlFormMacroLibrary.ftl
[ https://issues.apache.org/jira/browse/OFBIZ-9230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15885073#comment-15885073 ] Wei Zhang commented on OFBIZ-9230: -- Hi Jacques, I found you commit in revision 1784258. Maybe we should catch GenericEntityException rather than Exception in line 85. If so, you can got a NPE in log file. Kind Regards, Wei > Missing reference to the delegator in > framework/widget/templates/HtmlFormMacroLibrary.ftl > - > > Key: OFBIZ-9230 > URL: https://issues.apache.org/jira/browse/OFBIZ-9230 > Project: OFBiz > Issue Type: Bug > Components: ALL COMPONENTS >Affects Versions: Trunk >Reporter: Wei Zhang >Assignee: Jacques Le Roux >Priority: Minor > > To reproduce > 1. Load test data systemPropertyId="widget.autocompleter.defaultMinLength" > systemPropertyValue="3"/> > 2. Open https://localhost:8443/partymgr/control/main > 3. You will still get warning below in log file > {quote} > 2017-02-24 12:56:16,348 |http-nio-8443-exec-7 |EntityUtilProperties > |I| Could not get a system property for widget.autocompleter.defaultMinLength > : null > {quote} -- This message was sent by Atlassian JIRA (v6.3.15#6346)