8373001: LauncherFromOptions.create() not properly handling FileAssociationNoExtensionsException

Reviewed-by: almatvee
This commit is contained in:
Alexey Semenyuk 2026-01-14 21:37:44 +00:00
parent 6ad9f4ef68
commit fb526c8f45
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -51,6 +51,7 @@ import jdk.jpackage.internal.FileAssociationGroup.FileAssociationNoMimesExceptio
import jdk.jpackage.internal.cli.Options;
import jdk.jpackage.internal.cli.StandardFaOption;
import jdk.jpackage.internal.model.CustomLauncherIcon;
import jdk.jpackage.internal.model.JPackageException;
import jdk.jpackage.internal.model.DefaultLauncherIcon;
import jdk.jpackage.internal.model.FileAssociation;
import jdk.jpackage.internal.model.Launcher;
@ -130,8 +131,7 @@ final class LauncherFromOptions {
.advice("error.no-content-types-for-file-association.advice", faID)
.create();
} catch (FileAssociationNoExtensionsException ex) {
// TODO: Must do something about this condition!
throw new AssertionError();
throw new JPackageException(I18N.format("error.no-extensions-for-file-association", faID));
} catch (FileAssociationException ex) {
// Should never happen
throw new UnsupportedOperationException(ex);

View File

@ -93,6 +93,7 @@ error.properties-parameter-not-path=The value "{0}" provided for property "{1}"
error.properties-parameter-not-file=The value "{0}" provided for property "{1}" in "{2}" file is not a file
error.properties-parameter-not-launcher-shortcut-dir=The value "{0}" provided for property "{1}" in "{2}" file is not a valid shortcut startup directory
error.no-extensions-for-file-association=No extensions were specified for File Association number {0}
error.no-content-types-for-file-association=No MIME types were specified for File Association number {0}
error.no-content-types-for-file-association.advice=Specify MIME type for File Association number {0}
error.too-many-content-types-for-file-association=More than one MIME types was specified for File Association number {0}