Re: svn commit: r1813640 - in /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity: GenericDelegator.java GenericEntity.java GenericPK.java GenericValue.java

2018-07-27 Thread Scott Gray
Thanks Michael!

On Fri, 27 Jul 2018, 08:48 Michael Brohl,  wrote:

> Hi Scott,
>
> thanks for spotting this, I will fix it!
>
> Regards,
>
> Michael
>
>
> Am 26.07.18 um 23:40 schrieb Scott Gray:
> > FYI, I think this commit accidentally introduced a weird import into
> > GenericPK:
> > import org.apache.sis.internal.jdk7.Objects
> >
> > probably intended to be java.util.Objects
> >
> > Regards
> > Scott
> >
> > On 28 October 2017 at 15:19,  wrote:
> >
> >> Author: mbrohl
> >> Date: Sat Oct 28 15:19:56 2017
> >> New Revision: 1813640
> >>
> >> URL: http://svn.apache.org/viewvc?rev=1813640&view=rev
> >> Log:
> >> Improved: Fixing defects reported by FindBugs, package
> >> org.apache.ofbiz.entity.
> >> (OFBIZ-9716)
> >>
> >> I modified the patch slightly.
> >>
> >> Thanks Julian Leichert for reporting and providing the patch.
> >>
> >> Modified:
> >>  ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> >> java/org/apache/ofbiz/entity/GenericDelegator.java
> >>  ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> >> java/org/apache/ofbiz/entity/GenericEntity.java
> >>  ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> >> java/org/apache/ofbiz/entity/GenericPK.java
> >>  ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> >> java/org/apache/ofbiz/entity/GenericValue.java
> >>
> >> Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> >> java/org/apache/ofbiz/entity/GenericDelegator.java
> >> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/
> >> framework/entity/src/main/java/org/apache/ofbiz/entity/
> >> GenericDelegator.java?rev=1813640&r1=1813639&r2=1813640&view=diff
> >> 
> >> ==
> >> --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> >> java/org/apache/ofbiz/entity/GenericDelegator.java (original)
> >> +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> >> java/org/apache/ofbiz/entity/GenericDelegator.java Sat Oct 28 15:19:56
> >> 2017
> >> @@ -114,9 +114,9 @@ public class GenericDelegator implements
> >>   protected EntityCrypto crypto = null;
> >>
> >>   /** A ThreadLocal variable to allow other methods to specify a
> user
> >> identifier (usually the userLoginId, though technically the Entity
> Engine
> >> doesn't know anything about the UserLogin entity) */
> >> -protected static ThreadLocal> userIdentifierStack =
> new
> >> ThreadLocal>();
> >> +private static final ThreadLocal> userIdentifierStack
> =
> >> new ThreadLocal>();
> >>   /** A ThreadLocal variable to allow other methods to specify a
> >> session identifier (usually the visitId, though technically the Entity
> >> Engine doesn't know anything about the Visit entity) */
> >> -protected static ThreadLocal> sessionIdentifierStack =
> >> new ThreadLocal>();
> >> +private static final ThreadLocal>
> sessionIdentifierStack
> >> = new ThreadLocal>();
> >>
> >>   private boolean testMode = false;
> >>   private boolean testRollbackInProgress = false;
> >> @@ -786,7 +786,7 @@ public class GenericDelegator implements
> >>   value.setDelegator(this);
> >>
> >>   // if audit log on for any fields, save new value with no
> old
> >> value because it's a create
> >> -if (value != null &&
> value.getModelEntity().getHasFieldWithAuditLog())
> >> {
> >> +if (value.getModelEntity().getHasFieldWithAuditLog()) {
> >>   createEntityAuditLogAll(value, false, false);
> >>   }
> >>
> >> @@ -796,7 +796,7 @@ public class GenericDelegator implements
> >>   if (testMode) {
> >>   storeForTestRollback(new
> TestOperation(OperationType.INSERT,
> >> value));
> >>   }
> >> -} catch (GenericEntityException e) {
> >> +} catch (IllegalStateException | GenericEntityException e)
> {
> >>   // see if this was caused by an existing record before
> >> resetting the sequencer and trying again
> >>   // NOTE: use the helper directly so ECA rules, etc
> won't
> >> be run
> >>
> >> @@ -843,7 +843,7 @@ public class GenericDelegator implements
> >>
> >>   TransactionUtil.commit(beganTransaction);
> >>   return value;
> >> -} catch (Exception e) {
> >> +} catch (GenericEntityException e) {
> >>   String entityName = value != null ? value.getEntityName()
> :
> >> "invalid Generic Value";
> >>   String errMsg = "Failure in createSetNextSeqId operation
> for
> >> entity [" + entityName + "]: " + e.toString() + ". Rolling back
> >> transaction.";
> >>   Debug.logError(e, errMsg, module);
> >> @@ -877,7 +877,7 @@ public class GenericDelegator implements
> >>   value.setDelegator(this);
> >>
> >>   // if audit log on for any fields, save new value with no
> old
> >> value because it's a create
> >> -if (value 

Re: svn commit: r1813640 - in /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity: GenericDelegator.java GenericEntity.java GenericPK.java GenericValue.java

2018-07-27 Thread Michael Brohl

Hi Scott,

thanks for spotting this, I will fix it!

Regards,

Michael


Am 26.07.18 um 23:40 schrieb Scott Gray:

FYI, I think this commit accidentally introduced a weird import into
GenericPK:
import org.apache.sis.internal.jdk7.Objects

probably intended to be java.util.Objects

Regards
Scott

On 28 October 2017 at 15:19,  wrote:


Author: mbrohl
Date: Sat Oct 28 15:19:56 2017
New Revision: 1813640

URL: http://svn.apache.org/viewvc?rev=1813640&view=rev
Log:
Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.entity.
(OFBIZ-9716)

I modified the patch slightly.

Thanks Julian Leichert for reporting and providing the patch.

Modified:
 ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
java/org/apache/ofbiz/entity/GenericDelegator.java
 ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
java/org/apache/ofbiz/entity/GenericEntity.java
 ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
java/org/apache/ofbiz/entity/GenericPK.java
 ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
java/org/apache/ofbiz/entity/GenericValue.java

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
java/org/apache/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/
framework/entity/src/main/java/org/apache/ofbiz/entity/
GenericDelegator.java?rev=1813640&r1=1813639&r2=1813640&view=diff

==
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
java/org/apache/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
java/org/apache/ofbiz/entity/GenericDelegator.java Sat Oct 28 15:19:56
2017
@@ -114,9 +114,9 @@ public class GenericDelegator implements
  protected EntityCrypto crypto = null;

  /** A ThreadLocal variable to allow other methods to specify a user
identifier (usually the userLoginId, though technically the Entity Engine
doesn't know anything about the UserLogin entity) */
-protected static ThreadLocal> userIdentifierStack = new
ThreadLocal>();
+private static final ThreadLocal> userIdentifierStack =
new ThreadLocal>();
  /** A ThreadLocal variable to allow other methods to specify a
session identifier (usually the visitId, though technically the Entity
Engine doesn't know anything about the Visit entity) */
-protected static ThreadLocal> sessionIdentifierStack =
new ThreadLocal>();
+private static final ThreadLocal> sessionIdentifierStack
= new ThreadLocal>();

  private boolean testMode = false;
  private boolean testRollbackInProgress = false;
@@ -786,7 +786,7 @@ public class GenericDelegator implements
  value.setDelegator(this);

  // if audit log on for any fields, save new value with no old
value because it's a create
-if (value != null && 
value.getModelEntity().getHasFieldWithAuditLog())
{
+if (value.getModelEntity().getHasFieldWithAuditLog()) {
  createEntityAuditLogAll(value, false, false);
  }

@@ -796,7 +796,7 @@ public class GenericDelegator implements
  if (testMode) {
  storeForTestRollback(new 
TestOperation(OperationType.INSERT,
value));
  }
-} catch (GenericEntityException e) {
+} catch (IllegalStateException | GenericEntityException e) {
  // see if this was caused by an existing record before
resetting the sequencer and trying again
  // NOTE: use the helper directly so ECA rules, etc won't
be run

@@ -843,7 +843,7 @@ public class GenericDelegator implements

  TransactionUtil.commit(beganTransaction);
  return value;
-} catch (Exception e) {
+} catch (GenericEntityException e) {
  String entityName = value != null ? value.getEntityName() :
"invalid Generic Value";
  String errMsg = "Failure in createSetNextSeqId operation for
entity [" + entityName + "]: " + e.toString() + ". Rolling back
transaction.";
  Debug.logError(e, errMsg, module);
@@ -877,7 +877,7 @@ public class GenericDelegator implements
  value.setDelegator(this);

  // if audit log on for any fields, save new value with no old
value because it's a create
-if (value != null && 
value.getModelEntity().getHasFieldWithAuditLog())
{
+if (value.getModelEntity().getHasFieldWithAuditLog()) {
  createEntityAuditLogAll(value, false, false);
  }

@@ -900,7 +900,7 @@ public class GenericDelegator implements

  TransactionUtil.commit(beganTransaction);
  return value;
-} catch (Exception e) {
+} catch (IllegalStateException | GenericEntityException e) {
  String errMsg = "Failure in create operation for entity [" +
(value != null ? value.getEntityName() : "value is null") + "]: " +
e.toString(

Re: svn commit: r1813640 - in /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity: GenericDelegator.java GenericEntity.java GenericPK.java GenericValue.java

2018-07-26 Thread Scott Gray
FYI, I think this commit accidentally introduced a weird import into
GenericPK:
import org.apache.sis.internal.jdk7.Objects

probably intended to be java.util.Objects

Regards
Scott

On 28 October 2017 at 15:19,  wrote:

> Author: mbrohl
> Date: Sat Oct 28 15:19:56 2017
> New Revision: 1813640
>
> URL: http://svn.apache.org/viewvc?rev=1813640&view=rev
> Log:
> Improved: Fixing defects reported by FindBugs, package
> org.apache.ofbiz.entity.
> (OFBIZ-9716)
>
> I modified the patch slightly.
>
> Thanks Julian Leichert for reporting and providing the patch.
>
> Modified:
> ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> java/org/apache/ofbiz/entity/GenericDelegator.java
> ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> java/org/apache/ofbiz/entity/GenericEntity.java
> ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> java/org/apache/ofbiz/entity/GenericPK.java
> ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> java/org/apache/ofbiz/entity/GenericValue.java
>
> Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> java/org/apache/ofbiz/entity/GenericDelegator.java
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/
> framework/entity/src/main/java/org/apache/ofbiz/entity/
> GenericDelegator.java?rev=1813640&r1=1813639&r2=1813640&view=diff
> 
> ==
> --- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> java/org/apache/ofbiz/entity/GenericDelegator.java (original)
> +++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/
> java/org/apache/ofbiz/entity/GenericDelegator.java Sat Oct 28 15:19:56
> 2017
> @@ -114,9 +114,9 @@ public class GenericDelegator implements
>  protected EntityCrypto crypto = null;
>
>  /** A ThreadLocal variable to allow other methods to specify a user
> identifier (usually the userLoginId, though technically the Entity Engine
> doesn't know anything about the UserLogin entity) */
> -protected static ThreadLocal> userIdentifierStack = new
> ThreadLocal>();
> +private static final ThreadLocal> userIdentifierStack =
> new ThreadLocal>();
>  /** A ThreadLocal variable to allow other methods to specify a
> session identifier (usually the visitId, though technically the Entity
> Engine doesn't know anything about the Visit entity) */
> -protected static ThreadLocal> sessionIdentifierStack =
> new ThreadLocal>();
> +private static final ThreadLocal> sessionIdentifierStack
> = new ThreadLocal>();
>
>  private boolean testMode = false;
>  private boolean testRollbackInProgress = false;
> @@ -786,7 +786,7 @@ public class GenericDelegator implements
>  value.setDelegator(this);
>
>  // if audit log on for any fields, save new value with no old
> value because it's a create
> -if (value != null && 
> value.getModelEntity().getHasFieldWithAuditLog())
> {
> +if (value.getModelEntity().getHasFieldWithAuditLog()) {
>  createEntityAuditLogAll(value, false, false);
>  }
>
> @@ -796,7 +796,7 @@ public class GenericDelegator implements
>  if (testMode) {
>  storeForTestRollback(new 
> TestOperation(OperationType.INSERT,
> value));
>  }
> -} catch (GenericEntityException e) {
> +} catch (IllegalStateException | GenericEntityException e) {
>  // see if this was caused by an existing record before
> resetting the sequencer and trying again
>  // NOTE: use the helper directly so ECA rules, etc won't
> be run
>
> @@ -843,7 +843,7 @@ public class GenericDelegator implements
>
>  TransactionUtil.commit(beganTransaction);
>  return value;
> -} catch (Exception e) {
> +} catch (GenericEntityException e) {
>  String entityName = value != null ? value.getEntityName() :
> "invalid Generic Value";
>  String errMsg = "Failure in createSetNextSeqId operation for
> entity [" + entityName + "]: " + e.toString() + ". Rolling back
> transaction.";
>  Debug.logError(e, errMsg, module);
> @@ -877,7 +877,7 @@ public class GenericDelegator implements
>  value.setDelegator(this);
>
>  // if audit log on for any fields, save new value with no old
> value because it's a create
> -if (value != null && 
> value.getModelEntity().getHasFieldWithAuditLog())
> {
> +if (value.getModelEntity().getHasFieldWithAuditLog()) {
>  createEntityAuditLogAll(value, false, false);
>  }
>
> @@ -900,7 +900,7 @@ public class GenericDelegator implements
>
>  TransactionUtil.commit(beganTransaction);
>  return value;
> -} catch (Exception e) {
> +} catch (IllegalStateException | GenericEntityException e) {
>  String errMsg = "Failure in create operation for entity [" +
> (value != null