Skip to content
Permalink
Browse files

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.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860946 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jun 10, 2019
1 parent ffe2e7f commit 8a681cd3478e6f1806f69e74e9eeca066c784c35
@@ -172,22 +172,22 @@ public synchronized void set(String name, Object value, boolean setIfNull) {
/**
* 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));

}

/**
* 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);
@@ -622,11 +622,11 @@ public String getDefaultSuccessCode() {
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 String getMethodName() {
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 SimpleMethod getSimpleMethod() {
return this;
}

public String getUserLoginEnvName() {
public static String getUserLoginEnvName() {
return "userLogin";
}

@@ -55,7 +55,7 @@ public boolean exec(MethodContext methodContext) throws MiniLangException {
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;
}

0 comments on commit 8a681cd

Please sign in to comment.
You can’t perform that action at this time.