8172288: Fix Jigsaw related module/package error messages and throw correct exceptions

Reword error messages and throw IllegalStateExceptions where appropriate

Reviewed-by: alanb, acorn, lfoltan, gtriantafill
This commit is contained in:
Harold Seigel 2017-01-13 10:45:53 -05:00
parent a68e4067d9
commit a3946e30e3

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -458,7 +458,7 @@ public final class Layer {
loader.initRemotePackageMap(cf, parents); loader.initRemotePackageMap(cf, parents);
Layer layer = new Layer(cf, parents, mn -> loader); Layer layer = new Layer(cf, parents, mn -> loader);
return new Controller(layer); return new Controller(layer);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException | IllegalStateException e) {
throw new LayerInstantiationException(e.getMessage()); throw new LayerInstantiationException(e.getMessage());
} }
} }
@ -526,7 +526,7 @@ public final class Layer {
try { try {
Layer layer = new Layer(cf, parents, pool::loaderFor); Layer layer = new Layer(cf, parents, pool::loaderFor);
return new Controller(layer); return new Controller(layer);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException | IllegalStateException e) {
throw new LayerInstantiationException(e.getMessage()); throw new LayerInstantiationException(e.getMessage());
} }
} }
@ -610,9 +610,8 @@ public final class Layer {
try { try {
Layer layer = new Layer(cf, parents, clf); Layer layer = new Layer(cf, parents, clf);
return new Controller(layer); return new Controller(layer);
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException | IllegalStateException e) {
// IAE is thrown by VM when defining the module fails throw new LayerInstantiationException(e.getMessage());
throw new LayerInstantiationException(iae.getMessage());
} }
} }