Skip to content

Commit

Permalink
Updates from review.
Browse files Browse the repository at this point in the history
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
  • Loading branch information
sbordet committed Aug 13, 2024
1 parent 6b307e1 commit e11ab97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.eclipse.jetty.io.CyclicTimeouts;
import org.eclipse.jetty.util.Attachable;
import org.eclipse.jetty.util.NanoTime;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.thread.AutoLock;
import org.eclipse.jetty.util.thread.Scheduler;
import org.slf4j.Logger;
Expand Down Expand Up @@ -145,7 +146,7 @@ protected void normalizeRequest(HttpRequest request)

// Make sure the path is there
String path = request.getPath();
if (path.trim().isEmpty())
if (StringUtil.isBlank(path))
{
path = "/";
request.path(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,21 +657,7 @@ public static int indexOfControlChars(String str)
*/
public static boolean isBlank(String str)
{
if (str == null)
{
return true;
}
int len = str.length();
for (int i = 0; i < len; i++)
{
if (!Character.isWhitespace(str.codePointAt(i)))
{
// found a non-whitespace, we can stop searching now
return false;
}
}
// only whitespace
return true;
return str == null || str.isBlank();
}

/**
Expand Down Expand Up @@ -727,21 +713,7 @@ public static int getLength(String s)
*/
public static boolean isNotBlank(String str)
{
if (str == null)
{
return false;
}
int len = str.length();
for (int i = 0; i < len; i++)
{
if (!Character.isWhitespace(str.codePointAt(i)))
{
// found a non-whitespace, we can stop searching now
return true;
}
}
// only whitespace
return false;
return !isBlank(str);
}

public static boolean isHex(String str, int offset, int length)
Expand Down

0 comments on commit e11ab97

Please sign in to comment.