Skip to content

Commit

Permalink
use .equalsIgnoreCase instaed of .toLowerCase().equals
Browse files Browse the repository at this point in the history
  • Loading branch information
codeconsole committed Dec 7, 2023
1 parent 6a23375 commit c0853bd
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public CharBuffer getBuffer() throws IOException {

/**
* Whether the underlying buffer was written to using {@link #getOutputStream()}
* (as opposed to {@link #getWriter()}. If buffering was not enabled, false will be returned.
* (as opposed to {@link #getWriter()}.) If buffering was not enabled, false will be returned.
*/
public boolean isBufferStreamBased() {
return buffer != null && buffer.isUsingStream();
Expand Down Expand Up @@ -212,33 +212,33 @@ public void setHeader(String name, String value) {
@Override
public void addHeader(String name, String value) {
// Prevent content-length being set if buffering.
if (name.toLowerCase().equals("content-type")) {
if (name.equalsIgnoreCase("content-type")) {
// ensure ContentType is always set through setContentType()
setContentType(value);
} else if (buffer == null || !name.toLowerCase().equals("content-length")) {
} else if (buffer == null || !name.equalsIgnoreCase("content-length")) {
super.addHeader(name, value);
}
}

@Override
public void setIntHeader(String name, int value) {
// Prevent content-length being set if buffering.
if (buffer == null || !name.toLowerCase().equals("content-length")) {
if (buffer == null || !name.equalsIgnoreCase("content-length")) {
super.setIntHeader(name, value);
}
}

@Override
public void addIntHeader(String name, int value) {
// Prevent content-length being set if buffering.
if (buffer == null || !name.toLowerCase().equals("content-length")) {
if (buffer == null || !name.equalsIgnoreCase("content-length")) {
super.addIntHeader(name, value);
}
}

@Override
public void setDateHeader(String name, long value) {
if (name.toLowerCase().equals("last-modified")) {
if (name.equalsIgnoreCase("last-modified")) {
metaData.updateLastModified(value);
} else {
super.setDateHeader(name, value);
Expand All @@ -247,7 +247,7 @@ public void setDateHeader(String name, long value) {

@Override
public void addDateHeader(String name, long value) {
if (name.toLowerCase().equals("last-modified")) {
if (name.equalsIgnoreCase("last-modified")) {
metaData.updateLastModified(value);
} else {
super.addDateHeader(name, value);
Expand Down

0 comments on commit c0853bd

Please sign in to comment.