OSDN Git Service

Cookieにユーザセッションが保存されていなかった場合には空文字列を返す.
[coroid/inqubus.git] / frontend / src / saccubus / net / CookieWinOpera.java
index ff69736..c2c7166 100644 (file)
@@ -5,7 +5,10 @@ import java.io.IOException;
 import org.apache.commons.lang.StringUtils;
 
 /**
- * Windows Opera用.
+ * WindowsのOpera cookie ディレクトリを決め打ちして扱います.
+ * @author rankingloid (nicorank)
+ * @author hazychill (nicorank)
+ * @author orz (saccubus)
  * @author yuki
  */
 public class CookieWinOpera extends Cookie {
@@ -16,13 +19,14 @@ public class CookieWinOpera extends Cookie {
      * @throws IOException 取得失敗.
      */
     @Override
-    public String getUserSessionString() throws IOException {
+    public String getNicoUserSession() throws IOException {
         final String appData = System.getenv("APPDATA");
-        if (StringUtils.isEmpty(appData)) {
-            throw new IOException("APPDATA not defined");
+
+        if (StringUtils.isNotEmpty(appData)) {
+            final File cookieFile = new File(appData + "/Opera/Opera/cookies4.dat");
+            return getUserSession("UTF-8", cookieFile);
         }
 
-        final File cookieFile = new File(appData + "\\Opera\\Opera\\cookies4.dat");
-        return getUserSession("UTF-8", cookieFile);
+        return "";
     }
 }