Commit Graph
1481 Commits
Author SHA1 Message Date
Jacques Le Roux 06092ae0af Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
As advised by SpotBugs:

<<This code creates a java.util.Random object, uses it to generate one random
number, and then discards the Random object. This produces mediocre quality
random numbers and is inefficient. If possible, rewrite the code so that the
Random object is created once and saved, and each time a new random number is
required invoke a method on the existing Random object to obtain it.

If it is important that the generated Random numbers not be guessable, you must
not create a new Random for each random number; the values are too easily
guessable. You should strongly consider using a java.security.SecureRandom
instead (and avoid allocating a new SecureRandom for each random number needed).

Rank: Troubling (14), confidence: High
Pattern: DMI_RANDOM_USED_ONLY_ONCE
Type: DMI, Category: BAD_PRACTICE (Bad practice)>>

uses <<private static final SecureRandom SECURE_RANDOM = new SecureRandom();>>
in classes:
PaymentGatewayServices
ValueLinkApi
ContactMechServices
ProductStoreWorker
DesCrypt
HashCrypt
EntityCrypto
ContextFilter.java

Despite doing so SpotButs still reports the same error for those classes.
As it's obviously an error I prefer to not excludes those cases that will maybe
not be reported in a future version of SpotButs in Eclipse. For instance they
are not reported at all in previous version (4.5.1) but are in 4.5.2
2021-12-26 14:50:32 +01:00
Jacques Le Roux 5a64c3d27d Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
In exclude.xml:
removes Confidence lines, no need to complicate things
Adds 2 DC_DOUBLECHECK false reports; synchronized is used there (maybe not the
best way but it's OK as is)

In ProductConfigWrapper::equals fixes use of == instead of equals (tested)
In UspsServices::uspsPriorityMailInternationalLabel fixes 2 possible null
dereferencements

In EntityExpr::checkRhsType fixes a possible null dereferencement
2021-12-09 07:25:25 +01:00
Jacques Le Roux ca03e21ae8 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
Rearranges order of modifiers after transient insertion, in classes
ProductConfigWrapper, ModelEntity, ModelViewEntity and ModelService
2021-12-06 09:42:47 +01:00
Jacques Le Roux ed6241cb52 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
transient is needed for not serialisable fields of a Serializable class
2021-12-06 09:23:55 +01:00
Jacques Le Roux 36b82f2b16 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
GenericEntity::getBoolean can't return null, so false

CommunicationEventServices::sendEmailToContactList handles correctly
tmpResult != null
2021-12-03 12:37:46 +01:00
Jacques Le Roux 997cf16ed3 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
Useless self assignment
2021-11-19 17:51:30 +01:00
Jacques Le Roux f126bae89c Fixed: Fix some bugs Spotbugs reports (OFBIZ-12386)
Char arrays can't use toString()

Thanks: Spotbugs :)
2021-11-16 16:02:51 +01:00
Pierre Smits 24fb8a99e7 Improved: entity element descriptions (OFBIZ-12383) (#343)
added:
entitymodel.xsd: desriptions for
1. table-name
2. default-resource-name
3. dependent-on
2021-11-16 12:11:58 +01:00
Jacques Le Roux 9f822ab337 Improved: removes Java compilation unchecked] and deprecation warnings 2021-10-18 13:33:52 +02:00
Jacques Le Roux c85f60279b Improved: Remove Checkstyle warning related to double parenthesis at start of lines (OFBIZ-12340)
At https://markmail.org/message/3mhzlqew3igad3r2 I reported an issue that I was
not able to really qualify. After exchanging with a Checkstyle expert
(see markmail thread).

I was unable to find what in our checkstyle.xml file was wrongly throwing these
warnings. I decided that there was no reason to throw those warnings.

So I decided to put the SuppressionCommentFilter in our checkstyle.xml file and
use CHECKSTYLE_OFF: ALMOST_ALL/CHECKSTYLE_ON: ALMOST_ALL around
the concerned lines as documented here
https://checkstyle.sourceforge.io/config_filters.html#SuppressionCommentFilter_Examples
2021-10-17 15:38:30 +02:00
Jacques Le Roux 87f9981f71 Improved: Handle remaining checkstyle errors (OFBIZ-12169)
Fixes wrong methods names in EntityFunction class
2021-10-17 10:49:51 +02:00
Jacques Le Roux 2525377569 Improved: switch link from Nabble (no longer reachable) to Markmail
Only trunk is concerned (OFBIZ-11998)
2021-08-11 17:08:38 +02:00
Jacques Le Roux 2c421cedfb Fixed: Add http to https redirect rule for ofbiz.apache.org (OFBIZ-10590)
This prevented to run the stable demo, hence the next, weirdly the trunk had
not this problem. Anyway better safe than sorry... Maybe related to Gradle
version or rather libs loaded?

The reason why the stable (and old) demos were not running is because the
EntitySaxReaderTests did not pass
2021-07-20 07:47:32 +02:00
Eugen Stan dbaed189b1 Improved: Cleaned commented code from entity component (OFBIZ-8038) (#308) 2021-07-06 17:02:20 +02:00
Xin Wang 46722b713f Improved: Upgrade Shiro to 1.7.1 (OFBIZ-12275) (#309)
The default padding scheme of ECB mode for
org.apache.shiro.crypto.AesCipherService is different between v1.4.1 and
v1.7.1, i.e.:

v1.4.1 getPaddingSchemeName() result is "PKCS5Padding"

v1.7.1 getPaddingSchemeName() result is "NoPadding"

This patch specify padding scheme explicitly, after that exception
mentioned in build.gradle does not raise anymore, and initial data can
load successfully.
2021-07-04 19:18:38 +02:00
fehnomenal d288e12030 Make latitude and longitude numeric fields for correct comparisons (#220) 2021-05-29 12:07:19 +02:00
bjugl e786da42e8 Fixed: Induction from DB does not represent relations properly. (#290) (OFBIZ-12178)
As encountered in OFBIZ-6510, the ModelInduceFromDb does currently not include entity relations and foreign key constraints. Since they are an important part of the database model, we should fix that.

I could track down the problem to an incomplete invocation of the ModelEntity through the constructor used in the DatabaseUtil.induceModelFromDb() Methods. This constructor does not initialize the Relations.

Problem is, that the ModelEntity initialized through the "DB Names Constructor" does not cover references in its current state at all.

While working on an implementation I realized, that the API is not very congruent in this regards. I would expect that I could initialize ModelRelations the same way ModelFields are initialized in this context:

The create() Method takes a ModelEntity, DatabaseUtil.ColumnCheckInfo (respectively a DatabaseUtil.ReferenceCheckInfo) and a ModelFieldTypeReader (that could be left out for references) and creates ModelField (ModelRelation) objects that are added to the ModelEntity.

But that is not the case at the moment. On one hand not all fields that would be necessary are covered in the DatabaseUtil.ReferenceCheckInfo Objects (e.g. "type" is missing), on the other the object is missing public getters to make the values available in the first place.

Thanks a bunch Benjamin, nice add !
2021-04-02 11:12:42 +02:00
Jacques Le Roux 2c1a395df6 Improved: Remove deprecated ByteWrapper class (OFBIZ-12194)
Removes SqlJdbcUtil::deserializeField and its usage

BY accident I formatted the whole. I had to complete it by hand and I think
it's better as is
2021-03-11 16:59:38 +01:00
Jacques Le Roux 9f8ff6255c Improved: Remove deprecated ByteWrapper class (OFBIZ-12194)
This due for many years

NOTE DEJ20071022: the use of ByteWrapper is not recommended and is deprecated,
only old data should be stored that way.

I have still to verify the implication of removing
deserializeField() in SqlJdbcUtil.getValue()
2021-03-11 12:08:40 +01:00
Deepak Dixit 574bf8fa31 Fixed: Corrected property name as defined in general.properties
(OFBIZ-10008)
2021-02-17 12:43:06 +05:30
Wiebke Pätzold 82a15c70e3 Improved: Removed inner assignments (OFBIZ-12169) 2021-02-10 11:38:04 +01:00
Wiebke Pätzold 3cd7cf1cea Improved: Changed modifier order (OFBIZ-12169) 2021-02-10 11:31:12 +01:00
Wiebke Pätzold 03960053a8 Improved: Replaced '.*' import form (OFBIZ-12169) 2021-02-09 11:30:18 +01:00
Wiebke Pätzold c1c0813da2 Improved: Removes illegal character as shown by checkstyle (OFBIZ-12169) 2021-02-09 10:19:49 +01:00
Wiebke Pätzold 95d37d2189 Removes and adds whitespaces as suggested by checkstyle (OFBIZ-12169) 2021-02-09 08:46:20 +01:00
Michael Brohl bae3628501 Declare classes final as suggested by checkstyle (OFBIZ-12169)
Helper and Worker classes which are likely to be extended by custom
projects where left as is.
2021-02-08 17:09:56 +01:00
Jacques Le Roux a234f8e201 Improved: fixes a Java doc issue reported by checkstyle
Also removes unused ModelEntity::toXmlElement and ModelEntity::toGroupXmlElement

tasks.checkstyleMain.maxErrors from 278 to 277
2021-02-05 11:26:34 +01:00
Benjamin Jugl 8fac07ad0a Improved: Replaces ModelInduceFromDb with widgets (OFBIZ-6510) 2021-02-03 12:39:15 +01:00
Benjamin Jugl 17864a11e9 Fixed: Possible NPE in DatabaseUtil.getColumnInfo(...) (OFBIZ-11385) 2021-01-25 18:11:54 +01:00
Daniel Watford 7830328bb4 Improved: Removed deprecated ExpectedException.none from tests
(OFBIZ-12137)

Prevents logging of deprecation warnings during the build.
2021-01-14 17:07:40 +00:00
Nicolas Malin 816068335c Improved: Improve makeRangeCondition in file EntityDateFilterCondition.java
(OFBIZ-12051)

When we have a value with both from and thrudate greater than given range

Thanks to Leila Mekika for this improvement
2020-11-29 19:21:23 +01:00
Jacques Le Roux a8b252f7dd Reverted: "description" and "comment" datatypes unnecessarily limited to 255 char (OFBIZ-12021)
This reverts commit 8736162c74.

We have test integration issues to fix

Due to TortoiseGIt, something weird happened, confused me to revert the revert :/
2020-10-03 13:41:41 +02:00
Jacques Le Roux 8736162c74 Reverted: "description" and "comment" datatypes unnecessarily limited to 255 char (OFBIZ-12021)
This reverts commit 686f01c8cf.

We have test integration issues to fix
2020-10-03 13:30:15 +02:00
Jacques Le Roux 8ef3b54c22 Reverted: "description" and "comment" datatypes unnecessarily limited to 255 char (OFBIZ-12021)
This reverts commit 686f01c8cf.

We have test integration issues to fix
2020-10-03 13:28:10 +02:00
Jacques Le Roux 686f01c8cf Improved: "description" and "comment" datatypes unnecessarily limited to 255 char (OFBIZ-12021)
"Description" and "comment" fields are restricted to 255 char.

However after some research I found that all the supported databases support
longer then 255 char
I would expect users to want to write more then 255 char in a comment
(I know I personally can).

A discussion has been started on dev ML:
https://markmail.org/message/7utrgejc2c44i37u

Also adds a note in DATAMODEL_CHANGES.adoc

Thanks: ddev
2020-10-03 11:26:27 +02:00
Jacques Le Roux ae8b2d89b0 Improved: Checkstyle: Variable name must match pattern (OFBIZ-11926)
Removes last remaining "Must have at least one statement" issues by using
Debug.logVerbose

Decreases tasks.checkstyleMain.maxErrors from 543 to 535

Thanks: Suraj for report
2020-09-16 10:30:37 +02:00
Jacques Le Roux 231f97f030 Improved: Demo Data in conflict with Entity Unique Index when loading data during creation (OFBIZ-11998)
This is a known issue with MsSQL since
http://ofbiz.135035.n4.nabble.com/Unique-constraint-on-Person-cardId-breaks-ofbiz-on-SQL-Server-td4656840.html
The problem does not exist with Derby, nor with the mostly open source DBMS
used with OFBiz: Postres, MySQL, MariaDB, etc.
So we will not change the current OOTB setting and suggest to simply change
your own configuration

Thanks: Schumann Ye for report
2020-09-16 09:09:06 +02:00
Jacques Le Roux 346c63bfdf Improved: Checkstyle: Variable name must match pattern (OFBIZ-11926)
We have a lot of "do nothing" in Java code. In case of catch we should at least
have Debug.logError(e, MODULE); and maybe an explanation in the comment.
2020-09-15 15:24:45 +02:00
Suraj Khurana a5619831eb Improved: Added missing Javadocs for remaining methods in framework component, this is required for all classes which looks like designed for extension (can be subclassed).
(OFBIZ-11947)
Thanks Jacques for review.
2020-09-13 11:28:00 +05:30
Suraj Khurana 97b1688b0d Improved: Make data members of class as private and added accessor methods for the same, also corrected occurences of the same in framework component.
(OFBIZ-11963)
Also made some related checkstyle code enhancements. Thanks Jacques for review.
2020-09-12 12:05:16 +05:30
Suraj Khurana bc5e945ded Improved: Corrected line is longer than 150 characters checkstyle issues in framework component.
(OFBIZ-11921)
Also fixed some other extra space and naming related checkstyle issues observed.
Thanks Jacques for review.
2020-09-04 12:25:12 +05:30
Suraj Khurana ca9fa4fba4 Improved: Corrected line is longer than 150 characters checkstyle issues in framework and applications component.
(OFBIZ-11921)
Also fixed some extra spaces and naming conventions related checkstyle issues.
Thanks Jacques for review.
2020-08-31 19:54:54 +05:30
Akash Jain 66a76ffd5a Improved: Fix Literals comparisons with variable to avoid NPE (OFBIZ-11929)
Thanks, Devanshu Vyas for your contribution.
2020-08-30 17:20:23 +05:30
Suraj Khurana f98f5ebb86 Improved: Added missing Javadocs for some methods, this is required for all classes which looks like designed for extension (can be subclassed).
(OFBIZ-11947)
Also fixed some other checkstyle issues that requires re-factoring.
Thanks Jacques for review.
2020-08-28 16:54:15 +05:30
Suraj Khurana f357b997c0 Improved: Corrected class names, method names, data members of class and variables names in framework component.
(OFBIZ-11926)
Also corrected some formatting and line length related checkstyle issues.
2020-08-26 21:40:40 +05:30
Pawan Verma 6cb67c1a40 Improved: Replace .size() == 0 with isEmpty() in Java files(OFBIZ-11944)
Thanks, priya for the report and patch and jacques for the review.
2020-08-22 19:17:10 +05:30
Suraj Khurana 9689201b84 Improved: Make data members of class as private and added accessor methods for the same, also corrected occurences of the same in framework component.
(OFBIZ-11963)
Also made some related checkstyle code enhancements.
Thanks jacques for finalizing Javadoc pattern during this effort.
2020-08-22 13:20:39 +05:30
Suraj Khurana 8c10d4ae72 Improved: Added missing Javadocs for some methods, this is required for all classes which looks like designed for extension (can be subclassed).
(OFBIZ-11947)
This is done for framework component. Also corrected some variables as per naming convention best practices.
Thanks Jacques for review.
2020-08-17 12:30:26 +05:30
Priya Sharma 3fe72d440f Improved: Remove unused imports from Java files (OFBIZ-11930) (#222)
Improved: Remove unused imports from Java files
(OFBIZ-11930)
Thanks: Priya Sharma
2020-08-06 19:51:09 +05:30
Suraj Khurana 33f05c1684 Improved: Corrected all redundant modifiers occurences in framework component. Also, fixed some other checkstyle line formatting and spacing issues.
(OFBIZ-11925)
2020-08-06 18:53:13 +05:30