(OFBIZ-8341)
While reviewing r1812057 I spotted a bunch of swallowed ClassCastExceptions
I then reviewed all ClassCastExceptions and this fixes all of them with a
minimal logging
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1815797 13f79535-47bb-0310-9956-ffa450edef68
Reason: When the field is encrypted with the old algorithm (3-DES), the new Shiro code will fail to decrypt it (using AES) and then it will
throw an org.apache.shiro.crypto.CryptoException that is a RuntimeException.
For backward compatibility we want instead to catch the exception and decrypt the code using the old algorithm.
This has been discussed at https://s.apache.org/b520
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1814704 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9919)
Using a dynamic view entity containing groupBy clause and after calling
getCompleteList method, I am getting an error and it got fixed when I removed
that ArrayList sizing.
IMO, it might be occurring due to improper size initialization and I see no
reason for this and it is handled in ArrayList dynamically.
jleroux: moreover there is not much gain for cases where the pre-allocation
makes sense
Thanks: Suraj Khurana
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1814561 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9839)
Use try with resources for SQL objects like ResultSet and other objects.
SQL classes have AutoCloseable interface.
Thanks: Pradhan Yash Sharma
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1812466 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9841)
Added AutoCloseable interface to SQLProcessor class and overridden Close method
Added closing of ResultSet, PreparedStatement and Connection Objects.
While calling SQLProcessor object in GenericDAO used Try-with-Resources and
removed unnecessary calls of the same object before actual use, also removed
finally blocks for method invocation.
Thanks: Pradhan Yash Sharma
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1812144 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9839)
Use try with resources for SQL objects like ResultSet and other objects.
SQL classes have AutoCloseable interface.
Thanks: Pradhan Yash Sharma
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1812104 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-5701)
Reverts
trunk r1804319
R16.11 r1804320
R15.12 r1804321
R14.12 r1804322
R13.07 r1804323
This raised 2 issues:
MSSQL as reported by Wei Zhang in OFBIZ-9676
Dynamic View Entities as reported by Pawan Verma in OFBIZ-5701
I asked kieuanhvu to see if he can provide a new patch taking these 2 issues in
consideration
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1810054 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9624)
When performing EntityQuery#getFieldList without specifying distinct a
NullPointerException is thrown, because of the condition if (this.distinct).
It implicitly calls this.distinct.booleanValue() which throws the exception if
distinct is null.
Thanks: Tobias Laufkötter
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1806220 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9441)
A major refactoring patch that applies the following changes:
- Fully refactor the EntityDataLoadContainer
- Fully refactor the TestRunContainer
- In both above mentioned containers the logic is broken up into smaller
methods to enhance code readability. It also changes the signature of
the method calls to rely on StartupCommand instead of String[] arrays
- Remove most old documentation and commented out code where applicable
- Delete the StratupCommandToArgsAdapter as it is no longer needed
- Create a new feature in which OFBiz by default fails if any data file
fails to load. This can be overridden by passing a flag called
"continue-on-failure" e.g. ./gradlew "ofbiz --load-data continue-on-failure"
- Add a new property to --test called "loglevel" (old code but working properly)
- Add many new properties to the --load-data command including repair-columns,
try-inserts, maintain-txs, etc ... These properties are old, but somehow
did not make it into the command line arguments. This code is now exposed
through the command line to set a direction in the future of whether to
keep or delete these extra commands
- Update the documentation output of ./gradlew "ofbiz --help" to incorporate
the new mentioned properties
- Refactor README.md to incorporate the changes to the gradle commands for both
"-load-data" and "-test" properties. Also remove the gradle GUI
documentation as it is now deprecated.
- Also refactor README.md in other locations to cleanup and make it more
consistent. This icludes moving long notes into new sections and reducing
the verbosity of the security header. Furthermore, created a new header
called Miscellaneous documentation to house the newly created sections
- lots of small changes to remove EOL white space
Thanks: Jacques Le Roux for reviewing and testing
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1805947 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9578)
In a recent github mirror, I've found suspicious code.
Branch: master
path: framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
...
1588 protected final List<String> messages = new LinkedList<String>();
...
1596 protected int updateData(Collection<String> messages) {
1597 if (messages != null && UtilValidate.isNotEmpty(this.messages)) {
1598 messages.addAll(messages);
1599 }
1600 return count;
1601 }
1602 }
In Line 1598, `messages.addAll' should be `this.messages.addAll'?
This might not be an issue but I wanted to report this just in case.
Thanks: JC (jaechang.nam@gmail.com)for report
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1805143 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-9571)
No functional change.
We read at http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html :
<<Using the integer fields in this class (such as ROUND_HALF_UP) to represent
rounding mode is largely obsolete; the enumeration values of the RoundingMode
enum, (such as RoundingMode.HALF_UP) should be used instead.>>
That's an easy global replacement. But it also needs to import the RoundingMode
class. It was 26 files so I decided to rather clean all the imports in all files
with the help of Eclipse.
This is a 1st step. I will need to closely look at 2 special class: UtilNumber
and Calculate.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1804953 13f79535-47bb-0310-9956-ffa450edef68
Add a DAO helper class to use a datasource as readonly
This helper is disable by default. To enable it change the helper class on your datasource use in entityengine.xml like
<datasource name="localderby"
helper-class="org.ofbiz.entity.datasource.ReadOnlyHelperDAO"
schema-name="OFBIZ" ...
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1804826 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-5701)
jleroux: Kieuanhvu's explanation was not totally clear. So I rather provide
Renuka Srishti's at OFBIZ-9428 "getResultsSizeAfterPartialList() return wrong
count with distinct() for View Entity"
Here is the code sample to test the issue:
EntityListIterator productAssocListItr = null;
productAssocListItr = from("ProductAndAssoc").distinct().queryIterator();
productAssocListSize = productAssocListItr.getResultsSizeAfterPartialList();
productAssocListSize will differ from the actual distinct records in the
ProductAndAssoc View Entity.
This issue exists because it gives distinct records on the basis of the
first column in the table.
Thanks: Kieuanhvu for the patch, Renuka Srishti for a clear explanation and a
simple way to test (in a groovy for me)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1804319 13f79535-47bb-0310-9956-ffa450edef68
The warning message generated by OFBiz is a false positive caused by the fact that the way OFBiz performs the check is too simplistic: OFBiz parses for the content of the "()" in the fieldtype mapping and assumes that it is the column size.
However, in MySQL and possibly other database management systems, this is only true for varchar field definitions but not for datetime fields.
The column size for DATETIME(3) is not 3.
We should probably refactor the code in DatabaseUtil to compare the SQL field type from the JDBC driver, if possible to retrieve, (i.e. from the database) with the whole content (without any sting manipulation) of the attribute sql-type of the element field-type-def type (in fieldtype*.xml) i.e. "DATETIME(3)"; if they differ then a warning should be printed.
In this way we will have a more generic, simpler and more reliable tool to spot differences in the database
This is a workaround to fix the warning.
Thanks Jacopo.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1802693 13f79535-47bb-0310-9956-ffa450edef68
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