[java] [PATCH 1/2] Fix compilation error for unreported exceptions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In Java 1.6 source mode, javac reported the error:

```
src/main/java/org/libvirt/Library.java:93: unreported exception java.lang.Exception; must be caught or declared to be thrown
```

Since the code inside the try block does not throw any checked
exceptions, we only need to handle unchecked exceptions on the catch
side, ie. RuntimeExceptions.
---
 src/main/java/org/libvirt/Library.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/libvirt/Library.java b/src/main/java/org/libvirt/Library.java
index 7ce986d..8e054c6 100644
--- a/src/main/java/org/libvirt/Library.java
+++ b/src/main/java/org/libvirt/Library.java
@@ -86,7 +86,7 @@ public final class Library {
                 result[i] = cstrarr[i].toString();
             }
             return result;
-        } catch (Exception e) {
+        } catch (RuntimeException e) {
             for (; i < size; ++i) {
                 if (cstrarr[i] != null) cstrarr[i].free();
             }
-- 
2.5.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]