Skip to content

Commit 916f3ec

Browse files
committed
Check if msgIdStr is number before parsing to avoid exceptions in Elog client
1 parent 7688580 commit 916f3ec

File tree

1 file changed

+4
-1
lines changed
  • app/logbook/elog/src/main/java/org/phoebus/elog/api

1 file changed

+4
-1
lines changed

app/logbook/elog/src/main/java/org/phoebus/elog/api/ElogApi.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,10 @@ private long validateResponse( Response<String> resp ) throws LogbookException {
541541
} else {
542542
URI loc = URI.create( location );
543543
String[] path = loc.getPath().split("/");
544-
msgId = Integer.parseInt( path[ path.length-1 ] );
544+
String msgIdStr = path[ path.length-1 ];
545+
if(msgIdStr != null && msgIdStr.matches("\\d+")) {
546+
msgId = Integer.parseInt( msgIdStr );
547+
}
545548
}
546549
}
547550
if( body.contains("form name=form1") || body.contains("type=password") ) {

0 commit comments

Comments
 (0)