From 7219fdd007c5b8546f7c3aa15b0c5fe54d884f32 Mon Sep 17 00:00:00 2001 From: Gary O'Neall Date: Sun, 30 Oct 2022 11:00:26 -0700 Subject: [PATCH] Add filename to message for InvalidFileNameException Fixes #83 Signed-off-by: Gary O'Neall --- src/main/java/org/spdx/tools/SpdxToolsHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/spdx/tools/SpdxToolsHelper.java b/src/main/java/org/spdx/tools/SpdxToolsHelper.java index c651bf8..73c0e35 100644 --- a/src/main/java/org/spdx/tools/SpdxToolsHelper.java +++ b/src/main/java/org/spdx/tools/SpdxToolsHelper.java @@ -123,7 +123,7 @@ public static SerFileType fileToFileType(File file) String fileName = file.getName(); if (!fileName.contains(".")) { throw new InvalidFileNameException( - "Can not convert file to file type - no file extension"); + "Can not convert file to file type - no file extension for file "+file.getPath()); } String ext = fileName.substring(fileName.lastIndexOf(".") + 1) .toLowerCase(); @@ -140,7 +140,7 @@ public static SerFileType fileToFileType(File file) SerFileType retval = EXT_TO_FILETYPE.get(ext); if (Objects.isNull(retval)) { throw new InvalidFileNameException( - "Unrecognized file extension: " + ext); + "Unrecognized file extension: " + ext + " for file "+file.getPath()); } return retval; }