Message-ID: From: "sehrope (@sehrope)" To: "pgjdbc/pgjdbc" Date: Wed, 12 May 2021 13:03:57 +0000 Subject: Re: [pgjdbc/pgjdbc] PR #2148: Avoid leaking server error details through BatchUpdateException when logServerErrorDetail=false In-Reply-To: References: List-Id: X-GitHub-Author-Login: sehrope X-GitHub-Comment-Id: 631020924 X-GitHub-Comment-Type: review_comment X-GitHub-Commit: 064513cb6ee26993c24aa31374665899d7b07ea7 X-GitHub-Issue: 2148 X-GitHub-Path: pgjdbc/src/main/java/org/postgresql/jdbc/BatchResultHandler.java X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: review_comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/2148#discussion_r631020924 Content-Type: text/plain; charset=utf-8 (on pgjdbc/src/main/java/org/postgresql/jdbc/BatchResultHandler.java) Let's wrap the new if-block on the outside. That way it's clear that the default of `""` would only be replaced if it's detailed logging is enabled: ```java String queryString = ""; if (pgStatement.getPGConnection().getLogServerErrorDetail()) { if (resultIndex < queries.length) { queryString = queries[resultIndex].toString( parameterLists == null ? null : parameterLists[resultIndex]); } } ```