changeset 1801:32e77b071e09

webserver logging
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 12 Mar 2024 09:28:39 -0600
parents a045f30fa67d
children ca98dee04e08
files src/goodjava/webserver/Connection.java
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
diff -r a045f30fa67d -r 32e77b071e09 src/goodjava/webserver/Connection.java
--- a/src/goodjava/webserver/Connection.java	Fri Mar 08 10:24:00 2024 -0700
+++ b/src/goodjava/webserver/Connection.java	Tue Mar 12 09:28:39 2024 -0600
@@ -69,7 +69,12 @@
 	
 				String lenStr = (String)request.headers.get("content-length");
 				if( lenStr != null ) {
-					int len = Integer.parseInt(lenStr);
+					int len;
+					try {
+						len = Integer.parseInt(lenStr);
+					} catch(NumberFormatException e) {
+						throw new WrappedRuntimeException(e);
+					}
 					byte[] body = new byte[len];
 					size -= endOfHeader;
 					try {