ソースを参照

Don't allow TextFile to be initialised with null inputs

Issue 3703

Change-Id: I5b58a915dee69bb88abc63771114562d96d4e5b5
Reviewed-on: http://gerrit.dmdirc.com/916
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
tags/0.6.3
Chris Smith 14年前
コミット
c8f4552cb7
1個のファイルの変更8行の追加0行の削除
  1. 8
    0
      src/com/dmdirc/util/TextFile.java

+ 8
- 0
src/com/dmdirc/util/TextFile.java ファイルの表示

92
      * @since 0.6.3m1
92
      * @since 0.6.3m1
93
      */
93
      */
94
     public TextFile(final File file, final Charset charset) {
94
     public TextFile(final File file, final Charset charset) {
95
+        if (file == null) {
96
+            throw new NullPointerException("file");
97
+        }
98
+
95
         this.file = file;
99
         this.file = file;
96
         this.charset = charset;
100
         this.charset = charset;
97
     }
101
     }
105
      * @since 0.6.3m1
109
      * @since 0.6.3m1
106
      */
110
      */
107
     public TextFile(final InputStream is, final Charset charset) {
111
     public TextFile(final InputStream is, final Charset charset) {
112
+        if (is == null) {
113
+            throw new NullPointerException("is");
114
+        }
115
+
108
         this.is = is;
116
         this.is = is;
109
         this.charset = charset;
117
         this.charset = charset;
110
     }
118
     }

読み込み中…
キャンセル
保存