(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
Notes:
* Also removes empty framework/base/lib/scripting and useless applications\content\lib\uno\README (miss doc in wiki)
* When jpim-0.1.jar will be (hopefully) replaced we can drop lib ref in framework/base/ofbiz-component.xml
* I wonder if we should let the geronimo component alone with only 2 classes, could we not put that in entity or entityext?
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1755306 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
This is the first patch that takes OFBiz to the point of no return
in terms of switching from Ant to Gradle build system. Specifically
this patch applies the following items:
- Delete all old Ant and Maven build scripts
- Delete 169 Jar libraries and replace them with remote ones in the
gradle build script
- update the gradle build scripts for the dependencies and other minor
changes needed for the script work correctly
All tests pass with the command ./gradlew cleanAll loadDefault testIntegration
Again, thank you for everyone who contributed valueble time and effort in this
process.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1752033 13f79535-47bb-0310-9956-ffa450edef68
This feature has been contributed a long time ago as an experimental feature but never really matured into a production ready artifact: since it was contributed, no users asked about how to use it, or tested it, or reported bugs or enhancement requests.
More importantly, the feature has always been disabled in the OFBiz framework (i.e. the widget code and the entity engine code were not using it).
This removal should not impact our user base; however, after the removal, an entry to the Attic will be created to keep track of it and to make it easier, to interested users, to get this code, improve it (e.g. by making it dependent on a live external jar, for example MapDB instead of JDBM) and possibly contribute it back to the project.
The most compelling reason for its removal is that the feature was based on a snapshot, unreleased version of JDBM, which is now a mostly dead project: for licensing reasons we are no more allowed to bundle jars in our releases. Additionally, having code that relies an old jar from a no more active project represents a maintenance issue for the community.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1751817 13f79535-47bb-0310-9956-ffa450edef68
This improvement add a control to not update or delete an EntityStatus by entity-auto (for help developer) and complete unit test
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1751530 13f79535-47bb-0310-9956-ffa450edef68
===========================================
Error adding foreign key: ModelEntity was null for related entity name Tenant
===========================================
Thanks Nameet Jain for your contribution.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1751423 13f79535-47bb-0310-9956-ffa450edef68
I have uploaded a patch for the simple methods schema.
In general, the top level attributes are converted to simpleType, and attributeGroups to complexType.
Changed the following attribute name
1. ‘field’ to ‘fieldType’
2. ‘level’ to ‘levelType'
Denormalize the following attributeGroups
1. attlist.compare
2. attlist.compare-field
Left attributeGroup ‘typeDefaultString’ unchanged, cos it doesn’t matter. Not in use, it seem.
jleroux: we also fixed an issue with
<xs:element name="field" type="fieldType"/>
to
<xs:element ref="field"/>
In the patch
And I found a small issue (not minilang related) in ExampleCompoundWidgets.xml
- <sm:log message="CompoundWidgetsFunc runs" sm:level="info"/>
+ <sm:log message="CompoundWidgetsFunc runs" level="info"/>
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1750647 13f79535-47bb-0310-9956-ffa450edef68
Reverts the simple method to use the original schema without namespace. "Duplicates" simple-methods.xsd in simple-methods-ns.xsd as we did, to get the simple-method namespace for compound-widgets.
For myself: when we will do the 3rd more elegant option (no schema duplication), have been changed also:
minilang-catalog.xml
compound-widgets.xsd
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1749938 13f79535-47bb-0310-9956-ffa450edef68
This is the 2nd step: puts back the original names, so it will be transparent for remaining references in xml catalogs, Java code, etc.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1749489 13f79535-47bb-0310-9956-ffa450edef68
This is a 1st step, in a 2nd I will put back the original names, so it will be transparent for remaining reference in xml catalogs, Java code, etc.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1749488 13f79535-47bb-0310-9956-ffa450edef68
Connection pooling does not seem to work. Connections are created fine but as the close() method is called (outside of transaction) or the transaction is committed the connections are closed to the db server and not returned to the pool.
I believe the issue is with org.apache.commons.dbcp2.PoolableConnectionFactory passivateObject method. This will call rollback() when rollbackOnReturn is set to true even if the transaction is committed. This is because any connection wrappers extending org.apache.commons.dbcp2.DelegatingConnection cache autoCommit status. At some point, this cached autoCommit is different from the underlying connection autoCommit. The rollback() method will throw an exception and the connection is destroyed rather than put back to the pool
Environment this has been tested on:
ofbiz: rev 1725574 and latest trunk (as of 2016-06-14)
db: postgresql 9.1
jdbc driver: postgresql-9.3-1101.jdbc4
os: linux and windows
jleroux: this issue doest not exist with Derby, it's a matter of driver (DBMS actually) see Derby vs Postgres
https://db.apache.org/derby/docs/10.9/devguide/cdevconcepts29416.htmlhttps://www.postgresql.org/docs/9.1/static/ecpg-sql-set-autocommit.html
Another solution would be to force Postgres to autocommit but I'd not do that, better not change this DBMS dependent behaviour.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1748837 13f79535-47bb-0310-9956-ffa450edef68
Completes the work I did in r1748689. Actually I worked on different editors and mixed things so not all was committed previously, here they are
Removes now useless commented out line about DebugManagedDataSource (// Useful to debug the usage of connections in the pool). I put more information in the class head while fixing the type warnings
Fixes other type warnings I missed previously
Eventually removes the old comment
// Hmm... then how do we close the JDBC connections?
Because "we" don't close JDBC connections, DBPC takes care of that (or at least should, I did not check).
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1748693 13f79535-47bb-0310-9956-ffa450edef68
The Connection Pool Status feature was introduced by OFBIZ-4864 hence 1st in R13.07 where it still work well (see demo), as the connection pooling. But has been broken since, with the pooling.
Fortunately, it's easy to fix and has no implications has long has you don't enable verbose logging (the DebugManagedDataSource only extends ManagedDataSource for verbose logging and to generate the info needed for the Connection Pool Status feature).
I fixed it by using directly the DebugManagedDataSource. It's not an issue as long as you don't set the logging level to verbose which is anyway not something you would do in production. In case you do so and don't want to be disturbed in the log (focusing on something else), it's still easy to comment out the line from DebugManagedDataSource. I also fixed some type warnings while at it.
I also removed this old comment
// Hmm... then how do we close the JDBC connections?
Because "we" don't close JDBC connections, DBPC takes care of that (or at least should, I did not check).
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1748689 13f79535-47bb-0310-9956-ffa450edef68
OFBiz reads properties from either a properties file or the entity:SystemProperty. The way it worked previously is that OFBiz reads from the entity:SystemProperty first and if there is no value associated with the target propertyname, it would then locate the value from the relevant properties file.
In other words, if there is a database entry for a property, the database entry should override the associated properties file.
The issue is that if a database entry exist but the value is empty, it would look for a value from the properties file. It should not do so. If a database entry exists for the propertyname of interest, the value should be taken from the database even if it holds an empty value.
"isExistInDb" is first defined in Map<String, String> getSystemPropertyValue(String, String, Delegator). This method is call by many other methods. "isExistInDb" is used to indicate whether the method is returning an empty value for the property that 'exists' in the database rather than as a result of an absent database entry for the property.
The other methods...
boolean propertyValueEqualsIgnoreCase(String, String, String, Delegator)
String getPropertyValue(String, String, String, Delegator)
String getPropertyValue(String, String, Delegator)
String getMessage(String, String, Locale, Delegator)
uses the above method and needs to decide whether to use the empty value returned (ie. empty value from an existing property entry in database) or decide if it needs to read from the property file (ie. property entry does not exist in database)
jleroux: this also add systemPropertyValue data in CommonSystemPropertyData.xml
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1748560 13f79535-47bb-0310-9956-ffa450edef68
When ofbiz starts and checks the database, it will leave open connections and they will not get reused.
If you run Check/Update database from webtools, you can see a new connection is created for your selected group
As far as I can tell, the problem lies in DatabaseUtil.getDatabaseMetaData. If the parameter connection is null, a new connection object is created but not closed (like any resource should be!)
jleroux: I was unable to "see a new connection is created for your selected group" when running "Check/Update database from webtools". But I tested with Postgres while and after discussing with Gareth about this.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1748543 13f79535-47bb-0310-9956-ffa450edef68
(resource == null || resource.length() <= 0)
From Java spec. a String, Collection, Map or CharSequence can't have a negative length, so the pattern above can be reduced to
(resource == null || resource.length() == 0)
which can be replaced using
UtilValidate.isEmpty()
I checked, there are several other occurrences of this pattern (some very old, I guess most were routinely copied from an initial occurrence). I decided to replace all of them, here they are.
I did that already long ago for the
(resource == null || resource.length() == 0)
pattern. It remains 4 of them. Three are justified (because of the dependency on base component or because using isEmpty() on Object is disputable for performance reasons). I took care of the remaining one right aways (in SplashScreen.java)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1747976 13f79535-47bb-0310-9956-ffa450edef68
I removed duplicate paths were componentname was uselessly repeated after component://componentname/script/org/ofbiz (projectmngr was the only one using there project instead)
I had few typos, easily fixed thanks to the tests. There could be still typos but they are unexpected and anyway no-brainer to fix
I'm still wondering about specialpurpose/example/minilang/README.txt.
I changed its content to
"The minilang directory is for static resources that are interpreted at run time rather than being compiled. This goes on the classpath, but does not get built or put into a JAR file."
not sure it makes any sense, I don't see how this relates to the classpath.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1747712 13f79535-47bb-0310-9956-ffa450edef68
Because using SecureRandom comes with a cost, I have identified the places where it's reasonable to keep the non secured Random (like tests, internal sequences, etc.).
Ant to use UUID.randomUUID to generate the external link id
Also, though there are no real proven vulnerabilities, I decided to backport as much as possible since it's now public.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1741684 13f79535-47bb-0310-9956-ffa450edef68
The exception is caused by foreign key constraint violation between ShipmentCostEstimate and CarrierShipmentMethod entities.
Currently, when creating a new product store using ofbizsetup component default data associated with the product store is loaded into the database using the following steps.
1. read default data from entity xml file and replace specific items in the read data and write to temp file.
2. use service=parseEntityXmlFile to load the processed file into database.
The issue with this method is that the temp file can present a problem when ofbiz is operating in multitenant mode.
The solution is to modify the relevant services so that no temp file needs generated.
jleroux: I simply used an UtilValidate.isNotEmpty() method in EntitySaxReader class
I was initially reluctant to these changes because you can no longer load the content of the GlAccountData.xml and ProductStoreData.xml files, or the files themselves, using the import XML feature of webtools. But those files are specific to the setup component, so they should not be missed, they are supposed to be used in this context only.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1740008 13f79535-47bb-0310-9956-ffa450edef68
Implements a PagedList object (stores list of data items, resultset size, viewSize, viewIndex, lowIndex (called startIndex) and highIndex (called endIndex), also a utils class that returns the PagedList object based on a EntityListIterator, viewSize and viewIndex.
And implements a queryPagedList method in EntityQuery, used as an example in findOrders service Java implementation
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1738900 13f79535-47bb-0310-9956-ffa450edef68
This error raise by james yong on the issue OFBIZ-6987. Thanks to him for the issue and Deepak Dixit to spot the source
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1738258 13f79535-47bb-0310-9956-ffa450edef68