+ /**
+ * isHideSystemRuntime
+ *
+ * Return false as default, otherwise, parsing from ini and return it.
+ */
+ public boolean isHideSystemRuntime() {
+ if (!sHideSystemRuntime.equals(CONSTANT_STRING_INITIAL_VALUE)) {
+ return Boolean.parseBoolean(sHideSystemRuntime);
+ }
+ if (sProjectConfigs == null) {
+ Log.d(TAG, SERVICE_FAILED + "just return true for isHideSystemRuntime");
+ return true;
+ }
+ String hideSystemRuntime = getConfig(MENU_CATEGORY, HIDE_SYS_RUN_TIME_KEY);
+ Log.d(TAG, "hideSystemRuntime : " + hideSystemRuntime);
+ if (hideSystemRuntime != null) {
+ sHideSystemRuntime = hideSystemRuntime;
+ return Boolean.parseBoolean(hideSystemRuntime);
+ }
+ return false;
+ }
getConfig(MENU_CATEGORY, HIDE_SYS_RUN_TIME_KEY); // 이놈이 null이 아닌 "" 값을 할당합니다...
여튼 null 아닌 빈 값이죠.
결국 매번
if (hideSystemRuntime != null) { // 무의미하게 실행될테고 (null 은 항상 아닙니다..)
sHideSystemRuntime = hideSystemRuntime; // sHideSystemRuntime 는 애초에 초기값으로 CONSTANT_STRING_INITIAL_VALUE, 즉 null이 아닌 그냥 빈 값이 할당되었네요.
이미 빈 값에 다시 빈 값을 할당하는 셈인데, 실행시간에서 무의미한 코드실행은 있겠지만
(컴파일러가 최적화를 어느정도까지 하는지는 모르겠네요)
결국 코드 흐름상으로는 변화가 없는 셈이고..
return Boolean.parseBoolean(hideSystemRuntime);
여기서..
public static boolean parseBoolean(String s )
Parses the string argument as a boolean. The boolean returned represents the value true if the string argument is not null and is equal, ignoring case, to the string "true".
Example: Boolean.parseBoolean("True") returns true. Example: Boolean.parseBoolean("yes") returns false.
parseBoolean(문자열) 이 true 가 아니면 죄다 false 를 반환함으로써..
결국은 return false 가 성립되게 되네요.
...
if (hideSystemRuntime != null) {
이거를
if (!CONSTANT_STRING_INITIAL_VALUE.equals(hideSystemRuntime)) {
이거나
if (!TextUtils.isEmpty(hideSystemRuntime) {
이거 였다면 바로 return false 가 실행되고, 이걸 의도했을꺼 같은데..
흠..
매니저도 아닌데, 외주 개발사의 코드 리뷰를 왜 제가 하고 있는지 모르겠습니다.
정작 개발 업무 비중이 대폭 떨어졌어요..
외주 개발사 개발자들 짬밥이 더 높을텐데 말이죠.
퇴사하고 싶다...
public boolean isHideSystemRuntime() {
if (sHideSystemRuntime == null || sHideSystemRuntime.equals(CONSTANT_STRING_INITIAL_VALUE)) {
if (sProjectConfigs == null) {
Log.w(TAG, "sProjectConfigs is null, defaulting to hide system runtime");
return true;
}
String hideSystemRuntime = getConfig(MENU_CATEGORY, HIDE_SYS_RUN_TIME_KEY);
if (hideSystemRuntime == null) {
Log.w(TAG, "hideSystemRuntime is null, defaulting to show system runtime");
return false;
}
sHideSystemRuntime = hideSystemRuntime;
}
return Boolean.parseBoolean(sHideSystemRuntime);
}
충성 충성
변경 사항은 다음과 같습니다. 확인은 개발자의 몫입니다.
1. sHideSystemRuntime이 null인 경우를 확인하도록 변경하였다.
2. sProjectConfigs가 null인 경우를 처리할 때, 경고 메시지를 출력하도록 변경하였다.
3. hideSystemRuntime이 null인 경우를 처리할 때, 경고 메시지를 출력하도록 변경하였다.
4. sHideSystemRuntime에 값을 할당하도록 변경하였다.