OSDN Git Service

fixed findbugs warnings.
[stigmata/stigmata.git] / src / main / java / jp / sourceforge / stigmata / command / LicenseCommand.java
1 package jp.sourceforge.stigmata.command;
2
3 import java.io.BufferedReader;
4 import java.io.IOException;
5 import java.io.InputStream;
6 import java.io.InputStreamReader;
7
8 import jp.sourceforge.stigmata.BirthmarkContext;
9 import jp.sourceforge.stigmata.Stigmata;
10
11 /**
12  * 
13  * @author Haruaki Tamada
14  */
15 public class LicenseCommand extends AbstractStigmataCommand{
16     @Override
17     public String getCommandString(){
18         return "license";
19     }
20
21     @Override
22     public boolean perform(Stigmata stigmata, BirthmarkContext context, String[] args){
23         BufferedReader reader = null;
24         try{
25             InputStream in = getClass().getResourceAsStream("/META-INF/license.txt");
26             reader = new BufferedReader(new InputStreamReader(in, "utf-8"));
27             String line;
28
29             while((line = reader.readLine()) != null){
30                 System.out.println(line);
31             }
32             reader.close();
33             return true;
34         }catch(IOException ex){
35             return false;
36         } finally{
37             if(reader != null){
38                 try{
39                     reader.close();
40                 } catch(IOException e){
41                     throw new InternalError(e.getMessage());
42                 }
43             }
44         }
45     }
46 }