FYI: Logo
Hi, Just FYI, I have updated the OFBiz logo at https://www.apache.org/img/ which is used in the TLPs carousel (not automated, which is a pity, but not an itch I want to scratch) at https://www.apache.org I have also updated it long ago at https://github.com/justinmclean/ApacheLogos/pulls for https://rawgit.com/justinmclean/ApacheQuiz/master/compiled/index.html but the PR is still waiting (not a big deal, just asked again) If you know of any places we are missing please let us know Thanks Jacques
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
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
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: ‘MapStack’ weirdness.
Wow great information digging Scott. Maybe we have many other bits of redundant code that are just sitting out there for historical reasons. Anyway I think this settles the mystery and perhaps we should work on refactoring the code to attempt to get rid of it? On Fri, Jul 27, 2018, 12:49 AM Scott Gray wrote: > I looked back through an old copy of the pre-ASF repo and found that the > "context" references were added in 2006 and it had something to do with > making MapStack a LocalizedMap for screen/form widget internalization > rendering. The commit message and a small explanation in the mailing lists > didn't explain that specific addition unfortunately. Could be that it > isn't used there anymore, at the time freemarker macros weren't used for > widget rendering, so it's possible that a fix in the freemarker render > could remove the need for it. > > Regards > Scott > > On 21 July 2018 at 17:12, Mathieu Lirzin > wrote: > > > Hello Scott, > > > > Scott Gray writes: > > > > > I think it relates to the "context" variable that is frequently used in > > > groovy data prep scripts for the script output. > > > > > > I'm not in front of a computer, but looking at it in that light may > help. > > > > As shown by this snippet from ‘GroovyUtil.java’, the “context” binding > > is added explicitly so it doesn't require the ‘MapStack’ special case > > for the "context" key. In fact since the context is copied to an > > ‘HashMap’ before being passed to Groovy, the ‘MapStack’ implementation > > is not used at all from Groovy. > > > > --8<---cut here---start->8--- > > public static Binding getBinding(Map context, String > > expression) { > > Map vars = new HashMap<>(); > > if (context != null) { > > vars.putAll(context); > > if (UtilValidate.isNotEmpty(expression)) { > > ...; > > } > > vars.put("context", context); > > ...; > > } > > return new Binding(vars); > > } > > > > public static Object runScriptAtLocation(String location, String > > methodName, Map context) throws GeneralException { > > Script script = InvokerHelper.createScript( > > getScriptClassFromLocation(location), getBinding(context)); > > Object result = null; > > if (UtilValidate.isEmpty(methodName)) { > > result = script.run(); > > } else { > > result = script.invokeMethod(methodName, new Object[] { > > context }); > > } > > return result; > > } > > --8<---cut here---end--->8--- > > > > What is nice is that the ‘getBinding’ method has a javadoc explaining > > why the “context” binding is added explicitly. Thanks to Adrian Crum > > (RIP) for providing it. > > > > --8<---cut here---start->8--- > > The ‘context’ Map is added to the ‘Binding’ as a variable called > > "context" so that variables can be passed back to the caller. > > --8<---cut here---end--->8--- > > > > Thanks for your input. > > > > -- > > Mathieu Lirzin > > GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37 > > >