File: explicit-exception-messages.patch

package info (click to toggle)
tycho 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,508 kB
  • sloc: java: 62,811; xml: 29,982; sh: 50; makefile: 10
file content (46 lines) | stat: -rw-r--r-- 2,468 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Description: Modifies DefaultEquinoxEmbedder to throw exceptions with a more explicit messages when an error occurs
Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: no
--- a/sisu-equinox/sisu-equinox-embedder/src/main/java/org/eclipse/sisu/equinox/embedder/internal/DefaultEquinoxEmbedder.java
+++ b/sisu-equinox/sisu-equinox-embedder/src/main/java/org/eclipse/sisu/equinox/embedder/internal/DefaultEquinoxEmbedder.java
@@ -80,7 +80,7 @@
             @Override
             public void addExtraSystemPackage(String systemPackage) {
                 if (systemPackage == null || systemPackage.length() == 0) {
-                    throw new IllegalArgumentException();
+                    throw new IllegalArgumentException("System package is null or empty");
                 }
                 extraSystemPackages.add(systemPackage);
             }
@@ -88,7 +88,7 @@
             @Override
             public void addPlatformProperty(String property, String value) {
                 if (property == null || property.length() == 0) {
-                    throw new IllegalArgumentException();
+                    throw new IllegalArgumentException("Property name not specified");
                 }
                 platformProperties.put(property, value);
             }
@@ -96,11 +96,11 @@
             @Override
             public void addInstallation(File location) {
                 if (location == null || !location.isDirectory() || !new File(location, "plugins").isDirectory()) {
-                    throw new IllegalArgumentException();
+                    throw new IllegalArgumentException("Invalid installation location: " + location);
                 }
                 if (!installationLocations.isEmpty()) {
                     // allow only one installation for now
-                    throw new IllegalStateException();
+                    throw new IllegalStateException("Only one installation is allowed");
                 }
                 installationLocations.add(location);
             }
@@ -108,7 +108,7 @@
             @Override
             public void addBundle(File location) {
                 if (location == null || !location.exists()) {
-                    throw new IllegalArgumentException();
+                    throw new IllegalArgumentException("Invalid bundle location: " + location);
                 }
                 if (!isFrameworkBundle(location)) {
                     bundleLocations.add(location);