OSDN Git Service

動画番号を指定したコンテンツ情報取得関数追加.
authoryuki <yuki@bdf3b611-c98c-6041-8292-703d9c9adbe7>
Sat, 9 Feb 2008 20:21:00 +0000 (20:21 +0000)
committeryuki <yuki@bdf3b611-c98c-6041-8292-703d9c9adbe7>
Sat, 9 Feb 2008 20:21:00 +0000 (20:21 +0000)
git-svn-id: http://192.168.11.7/svn/repository/NicoBrowser@21 bdf3b611-c98c-6041-8292-703d9c9adbe7

nbproject/project.properties
src/nicobrowser/MainWindow.form
src/nicobrowser/MainWindow.java
src/nicobrowser/NicoContent.java
src/nicobrowser/NicoHttpClient.java
test/nicobrowser/NicoHttpClientTest.java

index 7bd07a1..72c2bba 100644 (file)
@@ -2,7 +2,7 @@ application.homepage=http://feather.cocolog-nifty.com/
 application.title=DEMO:\u30cb\u30b3\u30cb\u30b3\u52d5\u753bRSS\u30d6\u30e9\u30a6\u30b6\r
 application.vendor=yukihane\r
 build.classes.dir=${build.dir}/classes\r
-build.classes.excludes=**/*.java,**/*.form\r
+build.classes.excludes=\r
 # This directory is removed when the project is cleaned:\r
 build.dir=build\r
 build.generated.dir=${build.dir}/generated\r
@@ -49,7 +49,7 @@ javadoc.windowtitle=
 jnlp.codebase.type=user\r
 jnlp.codebase.user=http://www.example.com\r
 jnlp.enabled=true\r
-jnlp.offline-allowed=false\r
+jnlp.offline-allowed=true\r
 jnlp.signed=true\r
 # Property libs.Codec.classpath is set here just to make sharing of project simpler.\r
 # The library definition has always preference over this property.\r
index 3902b21..e396afb 100644 (file)
     <DimensionLayout dim="0">
       <Group type="103" groupAlignment="0" attributes="0">
           <Group type="102" alignment="0" attributes="0">
-              <EmptySpace max="-2" attributes="0"/>
+              <EmptySpace min="-2" max="-2" attributes="0"/>
               <Group type="103" groupAlignment="0" attributes="0">
-                  <Component id="jScrollPane1" alignment="1" pref="755" max="32767" attributes="0"/>
-                  <Component id="jPanel1" alignment="0" min="-2" max="-2" attributes="1"/>
-                  <Component id="jPanel2" alignment="0" min="-2" max="-2" attributes="1"/>
+                  <Component id="jScrollPane1" alignment="1" pref="876" max="32767" attributes="0"/>
+                  <Component id="jPanel1" min="-2" max="-2" attributes="1"/>
+                  <Component id="jPanel2" min="-2" max="-2" attributes="2"/>
               </Group>
-              <EmptySpace max="-2" attributes="0"/>
+              <EmptySpace min="-2" max="-2" attributes="0"/>
           </Group>
       </Group>
     </DimensionLayout>
     <DimensionLayout dim="1">
       <Group type="103" groupAlignment="0" attributes="0">
           <Group type="102" alignment="1" attributes="0">
-              <EmptySpace max="-2" attributes="0"/>
-              <Component id="jScrollPane1" pref="395" max="32767" attributes="0"/>
-              <EmptySpace max="-2" attributes="0"/>
+              <EmptySpace min="-2" max="-2" attributes="0"/>
+              <Component id="jScrollPane1" pref="313" max="32767" attributes="0"/>
+              <EmptySpace min="-2" max="-2" attributes="0"/>
               <Component id="jPanel1" min="-2" max="-2" attributes="0"/>
-              <EmptySpace max="-2" attributes="0"/>
-              <Component id="jPanel2" min="-2" max="-2" attributes="0"/>
+              <EmptySpace min="-2" max="-2" attributes="0"/>
+              <Component id="jPanel2" min="-2" max="-2" attributes="2"/>
               <EmptySpace max="-2" attributes="0"/>
           </Group>
       </Group>
           <Group type="103" groupAlignment="0" attributes="0">
               <Group type="102" alignment="0" attributes="0">
                   <EmptySpace max="-2" attributes="0"/>
-                  <Component id="loadButton" min="-2" max="-2" attributes="0"/>
+                  <Group type="103" groupAlignment="1" max="-2" attributes="0">
+                      <Component id="unitLoadButton" alignment="0" min="0" pref="0" max="32767" attributes="1"/>
+                      <Component id="listLoadButton" alignment="0" max="32767" attributes="1"/>
+                  </Group>
                   <EmptySpace max="-2" attributes="0"/>
-                  <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
+                  <Group type="103" groupAlignment="0" attributes="0">
+                      <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
+                      <Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/>
+                  </Group>
                   <EmptySpace max="-2" attributes="0"/>
-                  <Component id="listNoField" min="-2" pref="70" max="-2" attributes="0"/>
-                  <EmptySpace pref="52" max="32767" attributes="0"/>
+                  <Group type="103" groupAlignment="0" max="-2" attributes="0">
+                      <Component id="unitNoField" max="32767" attributes="1"/>
+                      <Component id="listNoField" alignment="0" pref="70" max="32767" attributes="1"/>
+                  </Group>
+                  <EmptySpace type="separate" max="-2" attributes="0"/>
                   <Component id="clearButton" min="-2" max="-2" attributes="0"/>
-                  <EmptySpace max="-2" attributes="0"/>
+                  <EmptySpace pref="36" max="32767" attributes="0"/>
               </Group>
           </Group>
         </DimensionLayout>
               <Group type="102" alignment="0" attributes="0">
                   <EmptySpace max="-2" attributes="0"/>
                   <Group type="103" groupAlignment="3" attributes="0">
-                      <Component id="loadButton" alignment="3" min="-2" max="-2" attributes="0"/>
+                      <Component id="listLoadButton" alignment="3" min="-2" max="-2" attributes="0"/>
                       <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
                       <Component id="listNoField" alignment="3" min="-2" max="-2" attributes="0"/>
                       <Component id="clearButton" alignment="3" min="-2" max="-2" attributes="0"/>
                   </Group>
+                  <EmptySpace max="-2" attributes="0"/>
+                  <Group type="103" groupAlignment="2" attributes="0">
+                      <Component id="jLabel4" alignment="2" min="-2" max="-2" attributes="0"/>
+                      <Component id="unitLoadButton" alignment="2" min="-2" max="-2" attributes="0"/>
+                      <Component id="unitNoField" alignment="2" min="-2" max="-2" attributes="0"/>
+                  </Group>
                   <EmptySpace max="32767" attributes="0"/>
               </Group>
           </Group>
         </DimensionLayout>
       </Layout>
       <SubComponents>
-        <Component class="javax.swing.JButton" name="loadButton">
+        <Component class="javax.swing.JButton" name="listLoadButton">
           <Properties>
             <Property name="text" type="java.lang.String" value="Load"/>
           </Properties>
           <Events>
-            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="loadButtonActionPerformed"/>
+            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="listLoadButtonActionPerformed"/>
           </Events>
         </Component>
         <Component class="javax.swing.JLabel" name="jLabel3">
             <Property name="text" type="java.lang.String" value="1923688"/>
           </Properties>
         </Component>
+        <Component class="javax.swing.JButton" name="unitLoadButton">
+          <Properties>
+            <Property name="text" type="java.lang.String" value="Load"/>
+          </Properties>
+          <Events>
+            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="unitLoadButtonActionPerformed"/>
+          </Events>
+        </Component>
+        <Component class="javax.swing.JLabel" name="jLabel4">
+          <Properties>
+            <Property name="text" type="java.lang.String" value="No"/>
+          </Properties>
+        </Component>
+        <Component class="javax.swing.JTextField" name="unitNoField">
+          <Properties>
+            <Property name="text" type="java.lang.String" value="sm9"/>
+          </Properties>
+        </Component>
         <Component class="javax.swing.JButton" name="clearButton">
           <Properties>
             <Property name="text" type="java.lang.String" value="Clear"/>
index 979bad0..faf4651 100644 (file)
@@ -111,9 +111,12 @@ public class MainWindow extends javax.swing.JFrame {
         jScrollPane1 = new javax.swing.JScrollPane();
         jTable1 = new javax.swing.JTable();
         jPanel2 = new javax.swing.JPanel();
-        loadButton = new javax.swing.JButton();
+        listLoadButton = new javax.swing.JButton();
         jLabel3 = new javax.swing.JLabel();
         listNoField = new javax.swing.JTextField();
+        unitLoadButton = new javax.swing.JButton();
+        jLabel4 = new javax.swing.JLabel();
+        unitNoField = new javax.swing.JTextField();
         clearButton = new javax.swing.JButton();
         jPanel1 = new javax.swing.JPanel();
         jLabel1 = new javax.swing.JLabel();
@@ -131,10 +134,10 @@ public class MainWindow extends javax.swing.JFrame {
 
         jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
 
-        loadButton.setText("Load");
-        loadButton.addActionListener(new java.awt.event.ActionListener() {
+        listLoadButton.setText("Load");
+        listLoadButton.addActionListener(new java.awt.event.ActionListener() {
             public void actionPerformed(java.awt.event.ActionEvent evt) {
-                loadButtonActionPerformed(evt);
+                listLoadButtonActionPerformed(evt);
             }
         });
 
@@ -142,6 +145,17 @@ public class MainWindow extends javax.swing.JFrame {
 
         listNoField.setText("1923688");
 
+        unitLoadButton.setText("Load");
+        unitLoadButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                unitLoadButtonActionPerformed(evt);
+            }
+        });
+
+        jLabel4.setText("No");
+
+        unitNoField.setText("sm9");
+
         clearButton.setText("Clear");
         clearButton.addActionListener(new java.awt.event.ActionListener() {
             public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -155,24 +169,35 @@ public class MainWindow extends javax.swing.JFrame {
             jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(jPanel2Layout.createSequentialGroup()
                 .addContainerGap()
-                .addComponent(loadButton)
+                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+                    .addComponent(unitLoadButton, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
+                    .addComponent(listLoadButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addComponent(jLabel3)
+                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addComponent(jLabel3)
+                    .addComponent(jLabel4))
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addComponent(listNoField, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 52, Short.MAX_VALUE)
+                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+                    .addComponent(unitNoField)
+                    .addComponent(listNoField, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE))
+                .addGap(18, 18, 18)
                 .addComponent(clearButton)
-                .addContainerGap())
+                .addContainerGap(36, Short.MAX_VALUE))
         );
         jPanel2Layout.setVerticalGroup(
             jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(jPanel2Layout.createSequentialGroup()
                 .addContainerGap()
                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(loadButton)
+                    .addComponent(listLoadButton)
                     .addComponent(jLabel3)
                     .addComponent(listNoField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                     .addComponent(clearButton))
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+                    .addComponent(jLabel4)
+                    .addComponent(unitLoadButton)
+                    .addComponent(unitNoField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
         );
 
@@ -234,7 +259,7 @@ public class MainWindow extends javax.swing.JFrame {
             .addGroup(layout.createSequentialGroup()
                 .addContainerGap()
                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 755, Short.MAX_VALUE)
+                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 876, Short.MAX_VALUE)
                     .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                     .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                 .addContainerGap())
@@ -243,7 +268,7 @@ public class MainWindow extends javax.swing.JFrame {
             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                 .addContainerGap()
-                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 395, Short.MAX_VALUE)
+                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 313, Short.MAX_VALUE)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@@ -253,12 +278,12 @@ public class MainWindow extends javax.swing.JFrame {
 
         pack();
     }// </editor-fold>//GEN-END:initComponents
-    private void loadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadButtonActionPerformed
-        String listNo = listNoField.getText();
-        if (listNo.length() < 1) {
+    private void listLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_listLoadButtonActionPerformed
+        String no = listNoField.getText();
+        if (no.length() < 1) {
             return;
         }
-        List<NicoContent> contList = NicoHttpClient.getInstance().loadMyList(listNo);
+        List<NicoContent> contList = NicoHttpClient.getInstance().loadMyList(no);
         int rowHeight = -1;
         for (NicoContent cont : contList) {
             Vector<Object> v = new Vector<Object>();
@@ -278,7 +303,7 @@ public class MainWindow extends javax.swing.JFrame {
             tableModel.addRow(v);
         }
         jTable1.setRowHeight(rowHeight);
-    }//GEN-LAST:event_loadButtonActionPerformed
+}//GEN-LAST:event_listLoadButtonActionPerformed
 
     private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed
         String mail = mailField.getText();
@@ -297,6 +322,32 @@ public class MainWindow extends javax.swing.JFrame {
         }
 }//GEN-LAST:event_clearButtonActionPerformed
 
+    private void unitLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unitLoadButtonActionPerformed
+        String no = unitNoField.getText();
+        if (no.length() < 1) {
+            return;
+        }
+        NicoContent cont = NicoHttpClient.getInstance().loadMyMovie(no);
+        int rowHeight = -1;
+        Vector<Object> v = new Vector<Object>();
+        ImageIcon icon = new ImageIcon();
+        try {
+            icon = new ImageIcon(new URL(cont.getImageLink()));
+            if (rowHeight < 0) {
+                rowHeight = icon.getIconHeight();
+            }
+        } catch (MalformedURLException ex) {
+            Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
+        }
+        v.add(icon);
+        v.add(cont.getTitle());
+        v.add(cont.getDescription());
+        v.add(cont.getPageLink());
+        tableModel.addRow(v);
+        jTable1.setRowHeight(rowHeight);
+
+}//GEN-LAST:event_unitLoadButtonActionPerformed
+
     /**
      * @param args the command line arguments
      */
@@ -313,14 +364,17 @@ public class MainWindow extends javax.swing.JFrame {
     private javax.swing.JLabel jLabel1;
     private javax.swing.JLabel jLabel2;
     private javax.swing.JLabel jLabel3;
+    private javax.swing.JLabel jLabel4;
     private javax.swing.JPanel jPanel1;
     private javax.swing.JPanel jPanel2;
     private javax.swing.JScrollPane jScrollPane1;
     private javax.swing.JTable jTable1;
+    private javax.swing.JButton listLoadButton;
     private javax.swing.JTextField listNoField;
-    private javax.swing.JButton loadButton;
     private javax.swing.JButton loginButton;
     private javax.swing.JTextField mailField;
     private javax.swing.JTextField passwordField;
+    private javax.swing.JButton unitLoadButton;
+    private javax.swing.JTextField unitNoField;
     // End of variables declaration//GEN-END:variables
 }
index 6d09258..6f38ac1 100644 (file)
@@ -3,6 +3,9 @@ package nicobrowser;
 
 import java.util.Date;
 
+/**
+ * ニコニコ動画コンテンツ情報.
+ */
 public class NicoContent {
 
     private String pageLink;
index e3f282a..979da5a 100644 (file)
@@ -8,10 +8,14 @@ import com.sun.syndication.io.FeedException;
 import com.sun.syndication.io.SyndFeedInput;
 import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.io.StringReader;
+import java.text.DateFormat;
+import java.text.ParseException;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.logging.Level;
@@ -20,11 +24,18 @@ import javax.swing.text.MutableAttributeSet;
 import javax.swing.text.html.HTML;
 import javax.swing.text.html.HTMLEditorKit;
 import javax.swing.text.html.parser.ParserDelegator;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.cookie.CookiePolicy;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
 
 /**
  *
@@ -39,6 +50,8 @@ public class NicoHttpClient extends HttpClient {
             "https://secure.nicovideo.jp/secure/logout";
     private static final String MY_LIST_PAGE_HEADER =
             "http://www.nicovideo.jp/mylist/";
+    private static final String MOVIE_THUMBNAIL_PAGE_HEADER =
+            "http://www.nicovideo.jp/api/getthumbinfo/";
 
     private NicoHttpClient() {
         super();
@@ -143,6 +156,76 @@ public class NicoHttpClient extends HttpClient {
         return contList;
     }
 
+    /**
+     * 動画番号を指定したコンテンツ情報の取得.
+     * @param movieNo 動画番号.
+     * @return コンテンツ情報.
+     */
+    public NicoContent loadMyMovie(String movieNo) {
+        NicoContent cont = null;
+        InputStream re = null;
+        List<SyndEntryImpl> list = null;
+        String url = new String(MOVIE_THUMBNAIL_PAGE_HEADER + movieNo);
+        Logger.getLogger(NicoHttpClient.class.getName()).log(Level.INFO, "動画サムネイルURL: " + url);
+
+        GetMethod get = new GetMethod(url);
+
+        try {
+            int statusCode = executeMethod(get);
+            re = get.getResponseBodyAsStream();
+            // ドキュメントビルダーファクトリを生成
+            DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
+            // ドキュメントビルダーを生成
+            DocumentBuilder builder = dbfactory.newDocumentBuilder();
+            // パースを実行してDocumentオブジェクトを取得
+            Document doc = builder.parse(re);
+            // ルート要素を取得(タグ名:site)
+            Element root = doc.getDocumentElement();
+            System.out.println("ルート要素のタグ名:" + root.getTagName());
+
+            System.out.println("***** ページリスト *****");
+            // page要素のリストを取得
+            NodeList list2 = root.getElementsByTagName("thumb");
+            // page要素の数だけループ
+            cont = new NicoContent();
+            // page要素を取得
+            Element element = (Element) list2.item(0);
+
+            String watch_url = ((Element) element.getElementsByTagName("watch_url").item(0)).getFirstChild().getNodeValue();
+            cont.setPageLink(watch_url);
+
+            String thumbnail_url = ((Element) element.getElementsByTagName("thumbnail_url").item(0)).getFirstChild().getNodeValue();
+            cont.setImageLink(thumbnail_url);
+
+            String title = ((Element) element.getElementsByTagName("title").item(0)).getFirstChild().getNodeValue();
+            cont.setTitle(title);
+
+            String description = ((Element) element.getElementsByTagName("description").item(0)).getFirstChild().getNodeValue();
+            cont.setDescription(description);
+
+            // TODO 投稿日の設定
+//            String first_retrieve = ((Element) element.getElementsByTagName("first_retrieve").item(0)).getFirstChild().getNodeValue();
+//            cont.setPublishedDate(DateFormat.getInstance().parse(first_retrieve));
+//
+//        } catch (ParseException ex) {
+//            Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex);
+        } catch (SAXException ex) {
+            Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex);
+        } catch (IOException ex) {
+            Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex);
+        } catch (ParserConfigurationException ex) {
+            Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex);
+        } finally {
+            try {
+                re.close();
+            } catch (IOException ex) {
+                Logger.getLogger(NicoHttpClient.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        }
+        return cont;
+
+    }
+
     private List<NicoContent> createContentsList(List<SyndEntryImpl> list) {
         class CallBack extends HTMLEditorKit.ParserCallback {
 
@@ -200,8 +283,8 @@ public class NicoHttpClient extends HttpClient {
             public String getImageLink() {
                 return imageLink;
             }
-            
-            public String getDescription(){
+
+            public String getDescription() {
                 return description.toString();
             }
         }
index 50c2868..c12d5b3 100644 (file)
@@ -44,7 +44,6 @@ public class NicoHttpClientTest {
     @Test
     public void getInstance() {
         System.out.println("getInstance");
-        NicoHttpClient expResult = null;
         NicoHttpClient result = NicoHttpClient.getInstance();
         assertNotNull(result);