svn commit: r1860946 - in /ofbiz/ofbiz-framework/trunk/framework: datafile/src/main/java/org/apache/ofbiz/datafile/ minilang/src/main/java/org/apache/ofbiz/minilang/ minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1860946 - in /ofbiz/ofbiz-framework/trunk/framework: datafile/src/main/java/org/apache/ofbiz/datafile/ minilang/src/main/java/org/apache/ofbiz/minilang/ minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/

mthl
Author: mthl
Date: Mon Jun 10 14:11:20 2019
New Revision: 1860946

URL: http://svn.apache.org/viewvc?rev=1860946&view=rev
Log:
Improved: Add missing ‘static’ modifier for safe public methods
(OFBIZ-11098)

In order to make it clear when a method is not depending on the
internal state of an object, it is a good practice to declare it as
static.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
    ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java
    ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java

Modified: ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java?rev=1860946&r1=1860945&r2=1860946&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/datafile/src/main/java/org/apache/ofbiz/datafile/Record.java Mon Jun 10 14:11:20 2019
@@ -172,7 +172,7 @@ public class Record implements Serializa
     /**
      * little endian reader for 2 byte short.
      */
-    public final short readLEShort(byte[] byteArray) {
+    private static short readLEShort(byte[] byteArray) {
         return (short) ((byteArray[1] & 0xff) << 8 | (byteArray[0] & 0xff));
 
     }
@@ -180,14 +180,14 @@ public class Record implements Serializa
     /**
      * little endian reader for 4 byte int.
      */
-    public final int readLEInt(byte[] byteArray) {
+    private static int readLEInt(byte[] byteArray) {
         return (byteArray[3]) << 24 | (byteArray[2] & 0xff) << 16 | (byteArray[1] & 0xff) << 8 | (byteArray[0] & 0xff);
     }
 
     /**
      * little endian reader for 8 byte long.
      */
-    public final long readLELong(byte[] byteArray) {
+    private static long readLELong(byte[] byteArray) {
         return (long) (byteArray[7]) << 56 | /* long cast needed or shift done modulo 32 */
                (long) (byteArray[6] & 0xff) << 48 | (long) (byteArray[5] & 0xff) << 40 | (long) (byteArray[4] & 0xff) << 32 | (long) (byteArray[3] & 0xff) << 24
                | (long) (byteArray[2] & 0xff) << 16 | (long) (byteArray[1] & 0xff) << 8 | (byteArray[0] & 0xff);

Modified: ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java?rev=1860946&r1=1860945&r2=1860946&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java Mon Jun 10 14:11:20 2019
@@ -622,11 +622,11 @@ public final class SimpleMethod extends
         return this.defaultSuccessCode;
     }
 
-    public String getDelegatorEnvName() {
+    private static String getDelegatorEnvName() {
         return "delegator";
     }
 
-    public String getDispatcherEnvName() {
+    private static String getDispatcherEnvName() {
         return "dispatcher";
     }
 
@@ -683,11 +683,11 @@ public final class SimpleMethod extends
         return this.methodOperations;
     }
 
-    public String getParameterMapName() {
+    private static String getParameterMapName() {
         return "parameters";
     }
 
-    public String getSecurityEnvName() {
+    private static String getSecurityEnvName() {
         return "security";
     }
 
@@ -724,7 +724,7 @@ public final class SimpleMethod extends
         return this;
     }
 
-    public String getUserLoginEnvName() {
+    public static String getUserLoginEnvName() {
         return "userLogin";
     }
 

Modified: ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java?rev=1860946&r1=1860945&r2=1860946&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java Mon Jun 10 14:11:20 2019
@@ -55,7 +55,7 @@ public final class SetCurrentUserLogin e
         if (userLogin == null) {
             throw new MiniLangRuntimeException("Entity value not found with name: " + valueFma, this);
         }
-        methodContext.setUserLogin(userLogin, this.simpleMethod.getUserLoginEnvName());
+        methodContext.setUserLogin(userLogin, SimpleMethod.getUserLoginEnvName());
         return true;
     }