Skip to content

Commit

Permalink
Addressed an issue determining the version number if the .jar file name
Browse files Browse the repository at this point in the history
is changed.
  • Loading branch information
Kevin McCluney committed Dec 7, 2023
1 parent 2f8c382 commit f30eda7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
Binary file modified CCDD.jar
Binary file not shown.
23 changes: 7 additions & 16 deletions src/CCDD/CcddMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -1609,20 +1609,13 @@ private void findVersionAndBuildDate()
String jarFileName = URLDecoder.decode(new File(CcddMain.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath(),
"UTF-8");

// Sometimes the name of the jar is not appended. Attempt to add it if the name does
// not end with '.jar'
if (!jarFileName.endsWith(".jar"))
if (jarFileName != null)
{
jarFileName = new File(ClassLoader.getSystemClassLoader().getResource(".").getPath()).getAbsolutePath();
jarFileName = jarFileName + File.separator + "CCDD.jar";
}

// Check if the .jar file name exists. This is false if the application is executed
// from within the IDE
if (jarFileName != null && jarFileName.endsWith(".jar"))
{
//Replace instances of %20 with a space in case running in Windows
jarFileName = jarFileName.replaceAll("%20", " ");
// Add the .jar file name if not present
if (!jarFileName.endsWith(".jar"))
{
jarFileName = jarFileName + File.separator + System.getProperty("sun.java.command");
}

// Get the manifest in the .jar file
JarFile jar = new JarFile(jarFileName);
Expand All @@ -1642,9 +1635,7 @@ private void findVersionAndBuildDate()
}
catch (Exception e)
{
// Ignore the exception if an I/O exception occurs accessing the manifest in the .jar
// file
e.printStackTrace();
// Ignore the exception if an I/O exception occurs
}

// Check if no version number or build date was found in the manifest
Expand Down

0 comments on commit f30eda7

Please sign in to comment.