diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 139ea60030..1180c5cdfc 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 53974 - Avoid NPE when constructing HSSFWorbook on Google App Engine 53568 - Fixed null returned by XSSFPicture.getPictureData() 53950 - fixed setForceFormulaRecalculation to reset workbook-level "manual" flag 52211 - avoid unnessary re-coverting content types to US-ASCII, it can cause exceptions on ibm mainframes diff --git a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java index 3f421d99b6..7161e48f14 100644 --- a/src/java/org/apache/poi/hssf/model/InternalWorkbook.java +++ b/src/java/org/apache/poi/hssf/model/InternalWorkbook.java @@ -1094,12 +1094,17 @@ public final class InternalWorkbook { private static WriteAccessRecord createWriteAccess() { WriteAccessRecord retval = new WriteAccessRecord(); + String defaultUserName = "POI"; try { - retval.setUsername(System.getProperty("user.name")); + String username = System.getProperty("user.name"); + // Google App engine returns null for user.name, see Bug 53974 + if(username == null) username = defaultUserName; + + retval.setUsername(username); } catch (AccessControlException e) { // AccessControlException can occur in a restricted context // (client applet/jws application or restricted security server) - retval.setUsername("POI"); + retval.setUsername(defaultUserName); } return retval; }