Skip to content

Commit

Permalink
Improved: Add missing ‘static’ modifier for safe public methods
Browse files Browse the repository at this point in the history
(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 8a681cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down Expand Up @@ -683,11 +683,11 @@ public List<MethodOperation> getMethodOperations() {
return this.methodOperations;
}

public String getParameterMapName() {
private static String getParameterMapName() {
return "parameters";
}

public String getSecurityEnvName() {
private static String getSecurityEnvName() {
return "security";
}

Expand Down Expand Up @@ -724,7 +724,7 @@ public SimpleMethod getSimpleMethod() {
return this;
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 8a681cd

Please sign in to comment.