Like that :
GenericValue product = from('Product').where(context).queryOne()
This improvement simulate the minilang element <entity-one entity-name=Product value-name=product/> for helping the minilang migration to groovy
Thanks Jacopo to help the conception, Taher for the review
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1802660 13f79535-47bb-0310-9956-ffa450edef68
As noted in code the EntityListIterator was not closed for a "good" reason: it
might be used later by the framework though not passed as a var. I think I found
1 case where it's closed after the returned list have been used (in
EntityAnd.getChildren() in ModelTree.java); but I have to check the whole thing
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1798086 13f79535-47bb-0310-9956-ffa450edef68
Improves EntityListIterator.close() warning
It was something like
ContentAssoc] has already been closed, not closing again.
It's now properly
This EntityListIterator for Entity [ContentAssoc] has already been closed,
not closing again.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1797356 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9385)
This is an improvement only because no cases were reported. But obviously in
case of unlucky exception after the EntityListIterator creation and before it's
closed the EntityListIterator remains in memory.
It should be closed in EntityListIterator.finalize() but the less happens there
the better.
The solution is to use try-with-ressources
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1797160 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9230)
This has been temporarily fixed with r1784259. After a discussion on dev ML and
a code analysis reported in the Jira issue, I decided to follow Rishi Solanki's
idea of using the delegatorName.
Since we have no context when executing a macro in the widget form, I decided
to pass it to the macro. I had though to create an
EntityUtilProperties.getPropertyValueFromDelegatorName() method to eventually
pass the delegatorName. Two macros were concerned renderLookupField and
renderTextField.
Note: while analysing the code I found that EntityExpr.checkRhsType() can face
a related kind of problem. I'll commit an improvement later...
Thanks: Wai for report and discussion and Rishi for pursuing his idea of using
the delegatorName
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1785882 13f79535-47bb-0310-9956-ffa450edef68
framework/widget/templates/HtmlFormMacroLibrary.ftl"
(OFBIZ-9230)
To reproduce
1. Load test data <SystemProperty systemResourceId="widget"
systemPropertyId="widget.autocompleter.defaultMinLength"
systemPropertyValue="3"/>
2. Open https://localhost:8443/partymgr/control/main
3. You will still get warning below in log file
|EntityUtilProperties |I| Could not get a system property for
widget.autocompleter.defaultMinLength : null
jleroux: the reason is in the context of a FTL macro we lose the delegator
(in context) when calling
executeMacro(writer, sr.toString());
from
MacroFormRenderer.renderTextField()
So we need to find a way to pass the delegator to be used when evaluating
the Freemarker template. For now I have simply added a clearer explanation
of the reason.
Thanks: Wei Zhang for report
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1784259 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9023) (OFBIZ-9026)(OFBIZ-9027)(OFBIZ-9032)(OFBIZ-9034)(OFBIZ-9036)(OFBIZ-9030)
Thanks: Divesh Dutta, Amit Gadaley and Shubham Agrawal for the contribution.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1768189 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8337)
This is a major refactoring exercise to simplify the startup sequence in
OFBiz. There are no functional changes, however, both the logic and the
API signatures of the core classes in OFBiz are changed to help simplify
the startup sequence. The changes insofar are summarized as:
- Rename ContainerConfig.Container to ContainerConfig.Configuration, the old
nameing was very confusing as it confuses it with actual containers
- Change the signature of ContainerLoader and Container to accept
List<StartupCommand> instead of String[]. And also migrate the adapter for
converting these args into a standalone class called
StartupCommandsToArgsAdapter
- Remove the LockedBy annotation as it is not used
- Substantially simplify the ContainerLoader load and unload logic and delete
the start logic (merge it with load). The interface StartupLoader was updated
accordingly
- Remove old logic to load containers in hot-deploy components
- Remove printThreadDump output from ContainerLoader which used to exist for
debugging purposes and is no longer necessary
- Cleanup the AdminServer startup logic
- Change the StartupControlPanel logic to use only one StartupLoader instead
of a list. The only implementation is ContainerLoader
- Remove the synchronized blocks in StartupControlPanel due to having only one
loader
- Update the startup .properties files to reflect the changes in the startup
logic
- Update the TestRunContainer to use List<StartupCommand> in its logic
We expect more commits (specifically to the containers) to complete this
refactoring initiative
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1765127 13f79535-47bb-0310-9956-ffa450edef68
This should not be a warning but an info. Also I wonder if we really need to
show all these, after all a default fallback should exist in a properties file
Still OFBIZ-7754 needs to be solved...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1763103 13f79535-47bb-0310-9956-ffa450edef68
of the legacy implementation from Javolution; removed a bunch of unused or
deprecated methods; created some unit tests to test the EntitySaxReader in
isolation. Removed the dependency from Javolution since this was the last class
dependent on it.
(OFBIZ-5169)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1762079 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8202)
These are a non functional changes for the accounting component
I forgot to commit the change in EntityListIterator.java, hence a lot of confusion, sorry guys
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1761047 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8179)
Without functional changes, this design removes a cyclic dependency between the "entity" and "geronimo" components.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1760376 13f79535-47bb-0310-9956-ffa450edef68
No functional changes, simply use the try-with-resources statement everywhere it's possible, mostly to clean the finally statements and have consistent code
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1759088 13f79535-47bb-0310-9956-ffa450edef68
At r1758927 I tried to fixe a bunch of closes missing, reported as warnings in Eclipse
Jacopo noticed and reported on dev ML http://markmail.org/message/b4hvzi7foftfq3j5 2 possible issues:
1) you are adding a close statement to code that already had the close statement in the "finally" block; your modification actually introduces a code pattern that is not correct (if an exception is thrown your close statement are not executed)
2) I suspect that you are closing the socket connection too early in PcChargeApi
1)The best option when closing resources (which implement AutoCloseable) is actually to use the try-with-resources statement. At least when there are no performance issues.
I have fixed the issue (only in DatabaseUtil.java) this way because
* there are not performance issues, we anyway create a Statement in both cases, we don't reuse one.
* The finally part is cleaner
I have also used the try-with-resources statement in other places where it fitted.
There is only 1 place where I was undecided: ScriptUtil.parseScript() which uses GroovyUtil.parseClass().
I put only a logError() there and returned null.
I did not throw an IOException because else it spreads everywhere in FlexibleStringExpander.
Here introducing Optional would be better, but I have no time or that today.
2) was not a problem
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1758951 13f79535-47bb-0310-9956-ffa450edef68
Fixes a bunch of small leaks (closes missing, only warnings in Eclipse)
By-product: automatically sort few imports
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1758927 13f79535-47bb-0310-9956-ffa450edef68
This is the first of two steps in the above mentioned JIRA. This
first step changes the java source directory for every component
from /src to /src/main/java. The next step will be adding unit
tests to every component in /src/test/java
Thank you to Deepak Dixit for tips on how to use the SVN commands
to make the appropriate file moving.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1752838 13f79535-47bb-0310-9956-ffa450edef68