Commit e488e53a by onuma

#47940 前回の入力内容をデフォルトに設定 仕様ミスを修正

parent c2cfed5a
...@@ -157,8 +157,6 @@ public class ABVEnvironment { ...@@ -157,8 +157,6 @@ public class ABVEnvironment {
public static final String ContinuousTaskReportJsonDirFormat = ContentCacheDirectoryFormat + "/processList/phaseList/phase_%d"; public static final String ContinuousTaskReportJsonDirFormat = ContentCacheDirectoryFormat + "/processList/phaseList/phase_%d";
// アルコールチェッカー(userDataKey)を保存する場所 // アルコールチェッカー(userDataKey)を保存する場所
public static final String userDataDir = "/userData/"; public static final String userDataDir = "/userData/";
// 保存するファイル名
public static final String userDataKeyFile = "userDataKey";
/** /**
* コンテンツのファイルを暗号化するときに、暗号化するサイズをバイト単位で指定します。 * コンテンツのファイルを暗号化するときに、暗号化するサイズをバイト単位で指定します。
......
...@@ -88,6 +88,7 @@ public class ABookKeys { ...@@ -88,6 +88,7 @@ public class ABookKeys {
public static final String ATTACHED_CHANGE_FLAG = "attachedChangeFlag"; public static final String ATTACHED_CHANGE_FLAG = "attachedChangeFlag";
public static final String ROUTINE_TASK_FLAG = "routineTaskFlag"; public static final String ROUTINE_TASK_FLAG = "routineTaskFlag";
public static final String UPDATE_HOTSPOT_ONLY_FLAG = "updateHotSpotOnlyFlag"; public static final String UPDATE_HOTSPOT_ONLY_FLAG = "updateHotSpotOnlyFlag";
public static final String USER_DATA = "userData";
//Webviewから呼び出すApiキー //Webviewから呼び出すApiキー
public static final class CMD_KEY{ public static final class CMD_KEY{
......
...@@ -1209,7 +1209,8 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1209,7 +1209,8 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
} else if (mCmd.equals(ABookKeys.CMD_SAVE_USER_DATA)) { } else if (mCmd.equals(ABookKeys.CMD_SAVE_USER_DATA)) {
// 入力内容を保存する // 入力内容を保存する
Logger.i(TAG,"save taskKey = " + abookCheckParam.get(ABookKeys.TASK_KEY)); Logger.i(TAG,"save taskKey = " + abookCheckParam.get(ABookKeys.TASK_KEY));
saveUserDataKey(abookCheckParam.get(ABookKeys.TASK_KEY)); Logger.i(TAG,"save userData = " + abookCheckParam.get(ABookKeys.USER_DATA));
saveUserDataKey(abookCheckParam.get(ABookKeys.TASK_KEY), abookCheckParam.get(ABookKeys.USER_DATA));
} }
} }
...@@ -1226,12 +1227,14 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1226,12 +1227,14 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
/** /**
* JSから送られてきたキーデータを保存する * JSから送られてきたキーデータを保存する
* @param userDataKey 保存するユーザーキー * @param userKeyFileName 保存するユーザーキーファイル名
* @param userData 保存するデータ
*/ */
private void saveUserDataKey(String userDataKey) { private void saveUserDataKey(String userKeyFileName, String userData) {
if (StringUtil.isNullOrEmpty(userDataKey)) { if (StringUtil.isNullOrEmpty(userKeyFileName)) {
Logger.d(TAG,"userKeyFileName is null or empty.");
// 読み込むためのキーがない // 読み込むためのキーがない
afterABookCheckApi(ABookKeys.CMD_SAVE_USER_DATA, userDataKey, 1, "", ""); afterABookCheckApi(ABookKeys.CMD_SAVE_USER_DATA, userKeyFileName, 1, "", "");
return; return;
} }
...@@ -1251,46 +1254,50 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1251,46 +1254,50 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
if (!ABVDataCache.getInstance().getMemberInfo().loginId.equals(userId)) { if (!ABVDataCache.getInstance().getMemberInfo().loginId.equals(userId)) {
// ログインしているユーザー以外のものは削除 // ログインしているユーザー以外のものは削除
FileUtil.delete(dir); FileUtil.delete(dir);
continue;
} }
BufferedWriter bw = null; BufferedWriter bw = null;
if (userDataKey != null) { if (userData != null) {
try { try {
FileOutputStream fo = new FileOutputStream(userDataFolderRoot + "/" + userId + "/" + ABVEnvironment.getInstance().userDataKeyFile); FileOutputStream fo = new FileOutputStream(userDataFolderRoot + "/" + userId + "/" + userKeyFileName);
OutputStreamWriter osw = new OutputStreamWriter(fo, StandardCharsets.UTF_8); OutputStreamWriter osw = new OutputStreamWriter(fo, StandardCharsets.UTF_8);
bw = new BufferedWriter(osw); bw = new BufferedWriter(osw);
bw.write(userDataKey); bw.write(userData);
bw.close(); bw.close();
} catch (IOException e) { } catch (IOException e) {
Logger.e(TAG, "" + e);
} finally { } finally {
try { try {
bw.close(); if (bw != null) {
bw.close();
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); Logger.e(TAG,"" + e);
} }
} }
afterABookCheckApi(ABookKeys.CMD_SAVE_USER_DATA, userDataKey, 0, "", ""); afterABookCheckApi(ABookKeys.CMD_SAVE_USER_DATA, userKeyFileName, 0, "", "");
break;
} }
} catch (IndexOutOfBoundsException iobex) { } catch (IndexOutOfBoundsException iobex) {
Logger.e(TAG,"" + iobex);
} }
} }
} }
/** /**
* キーデータファイルを読み込んで、JSにわたす * キーデータファイルを読み込んで、JSにわたす
* @param userKeyFileName ファイル名
*/ */
private void loadUserDataKey(String userDataKey) { private void loadUserDataKey(String userKeyFileName) {
if (StringUtil.isNullOrEmpty(userDataKey)) { if (StringUtil.isNullOrEmpty(userKeyFileName)) {
Logger.d(TAG,"key is not found."); Logger.d(TAG,"userKeyFileName is null or Empty");
// 読み込むためのキーがない // ファイル名が指定されていない
afterABookCheckApi(ABookKeys.CMD_LOAD_USER_DATA, userDataKey, 1, "", ""); afterABookCheckApi(ABookKeys.CMD_LOAD_USER_DATA, userKeyFileName, 1, "", "");
return; return;
} }
String keyFilePath = getUserDataDirRoot() + "/" + ABVDataCache.getInstance().getMemberInfo().loginId + "/" + ABVEnvironment.getInstance().userDataKeyFile;
String keyFilePath = getUserDataDirRoot() + "/" + ABVDataCache.getInstance().getMemberInfo().loginId + "/" + userKeyFileName;
Logger.d(TAG,"keyFilePath = " + keyFilePath); Logger.d(TAG,"keyFilePath = " + keyFilePath);
FileInputStream fi = null; FileInputStream fi = null;
...@@ -1308,11 +1315,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1308,11 +1315,12 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
} }
isr.close(); isr.close();
Logger.d(TAG,"result = " + sb.toString()); Logger.d(TAG,"result = " + sb.toString());
afterABookCheckApi(ABookKeys.CMD_LOAD_USER_DATA, userDataKey, 0, "", sb.toString()); afterABookCheckApi(ABookKeys.CMD_LOAD_USER_DATA, userKeyFileName, 0, "", sb.toString());
} catch (FileNotFoundException fnfex) { return;
} catch (FileNotFoundException fex) {
Logger.e(TAG,"" + fex);
} catch (IOException e) { } catch (IOException e) {
Logger.e(TAG,"" + e);
} finally { } finally {
try { try {
if (isr != null) { if (isr != null) {
...@@ -1322,6 +1330,8 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -1322,6 +1330,8 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
e.printStackTrace(); e.printStackTrace();
} }
} }
// 何かしらのExceptionが発生した
afterABookCheckApi(ABookKeys.CMD_LOAD_USER_DATA, userKeyFileName, 1, "", "");
} }
public void commonAttachedDataUrl (String taskKey, String data) { public void commonAttachedDataUrl (String taskKey, String data) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment