You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2010/02/27 16:40:21 UTC

svn commit: r916973 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java

Author: lektran
Date: Sat Feb 27 15:40:21 2010
New Revision: 916973

URL: http://svn.apache.org/viewvc?rev=916973&view=rev
Log:
Minor code cleanup: removed unnecessary cast and changed how a static field was being accessed

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java?rev=916973&r1=916972&r2=916973&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java Sat Feb 27 15:40:21 2010
@@ -385,7 +385,7 @@
 
     public static Transaction suspend() throws GenericTransactionException {
         try {
-            if (TransactionUtil.getStatus() != TransactionUtil.STATUS_NO_TRANSACTION) {
+            if (TransactionUtil.getStatus() != STATUS_NO_TRANSACTION) {
                 TransactionManager txMgr = TransactionFactory.getTransactionManager();
                 if (txMgr != null) {
                     pushTransactionBeginStackSave(clearTransactionBeginStack());
@@ -668,7 +668,7 @@
         }
 
         for (Map.Entry<Long, Exception> attbsMapEntry : allThreadsTransactionBeginStack.entrySet()) {
-            Long curThreadId = (Long) attbsMapEntry.getKey();
+            Long curThreadId = attbsMapEntry.getKey();
             Exception transactionBeginStack = attbsMapEntry.getValue();
             List<Exception> txBeginStackList = allThreadsTransactionBeginStackSave.get(curThreadId);
 



Re: svn commit: r916973 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java

Posted by Adam Heath <do...@brainfood.com>.
lektran@apache.org wrote:
> Author: lektran
> Date: Sat Feb 27 15:40:21 2010
> New Revision: 916973
> 
> URL: http://svn.apache.org/viewvc?rev=916973&view=rev
> Log:
> Minor code cleanup: removed unnecessary cast and changed how a static field was being accessed
> 
> Modified:
>     ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
> 
> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java?rev=916973&r1=916972&r2=916973&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java Sat Feb 27 15:40:21 2010
> @@ -385,7 +385,7 @@
>  
>      public static Transaction suspend() throws GenericTransactionException {
>          try {
> -            if (TransactionUtil.getStatus() != TransactionUtil.STATUS_NO_TRANSACTION) {
> +            if (TransactionUtil.getStatus() != STATUS_NO_TRANSACTION) {
>                  TransactionManager txMgr = TransactionFactory.getTransactionManager();
>                  if (txMgr != null) {
>                      pushTransactionBeginStackSave(clearTransactionBeginStack());

Yeah, this really grinds my gears.  FooUtil continually referring to
itself for static variables and methods.  It makes renaming/copying
the class more difficult.

There are lots of classes in ofbiz that follow this anti-pattern(I
think it is anti, anyways).