Skip to content

Commit f7863d8

Browse files
committed
Some annotations
1 parent 9e69eae commit f7863d8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/express/http/response/Response.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public List<String> getHeader(String key) {
7070
*
7171
* @param location The location.
7272
*/
73-
public void redirect(String location) {
73+
public void redirect(@NotNull String location) {
7474
HEADER.add("Location", location);
7575
setStatus(Status._302);
7676
send();
@@ -82,7 +82,7 @@ public void redirect(String location) {
8282
* @param cookie The cookie.
8383
* @return This Response instance.
8484
*/
85-
public Response setCookie(Cookie cookie) {
85+
public Response setCookie(@NotNull Cookie cookie) {
8686
if (checkIfClosed()) return this;
8787
this.HEADER.add("Set-Cookie", cookie.toString());
8888
return this;
@@ -131,7 +131,7 @@ public String getContentType() {
131131
*
132132
* @param contentType - The contentType
133133
*/
134-
public void setContentType(MediaType contentType) {
134+
public void setContentType(@NotNull MediaType contentType) {
135135
this.contentType = contentType.getMIME();
136136
}
137137

@@ -140,7 +140,7 @@ public void setContentType(MediaType contentType) {
140140
*
141141
* @param contentType - The contentType
142142
*/
143-
public void setContentType(String contentType) {
143+
public void setContentType(@NotNull String contentType) {
144144
this.contentType = contentType;
145145
}
146146

@@ -160,6 +160,11 @@ public void send() {
160160
* @param s The string.
161161
*/
162162
public void send(String s) {
163+
if (s == null) {
164+
send();
165+
return;
166+
}
167+
163168
if (checkIfClosed()) return;
164169
byte[] data = s.getBytes();
165170

@@ -183,7 +188,7 @@ public void send(String s) {
183188
* @param file The file.
184189
*/
185190
public void send(@NotNull Path file) {
186-
if (checkIfClosed())
191+
if (checkIfClosed() || !Files.isRegularFile(file))
187192
return;
188193

189194
try {

0 commit comments

Comments
 (0)