summaryrefslogtreecommitdiffstats
path: root/vpp-api/java/jvpp/gen/jvpp_impl_gen.py
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-api/java/jvpp/gen/jvpp_impl_gen.py')
-rw-r--r--vpp-api/java/jvpp/gen/jvpp_impl_gen.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/vpp-api/java/jvpp/gen/jvpp_impl_gen.py b/vpp-api/java/jvpp/gen/jvpp_impl_gen.py
index 4e408c364b1..dfec6a743de 100644
--- a/vpp-api/java/jvpp/gen/jvpp_impl_gen.py
+++ b/vpp-api/java/jvpp/gen/jvpp_impl_gen.py
@@ -39,8 +39,10 @@ public interface JVpp extends java.lang.AutoCloseable {
/**
* Generic dispatch method for sending requests to VPP
+ *
+ * @throws org.openvpp.jvpp.VppInvocationException if send request had failed
*/
- int send($base_package.$dto_package.JVppRequest request);
+ int send($base_package.$dto_package.JVppRequest request) throws org.openvpp.jvpp.VppInvocationException;
@Override
void close();
@@ -76,7 +78,7 @@ public final class JVppImpl implements $base_package.JVpp {
}
@Override
- public int send($base_package.$dto_package.JVppRequest request) {
+ public int send($base_package.$dto_package.JVppRequest request) throws org.openvpp.jvpp.VppInvocationException {
return request.send(this);
}
@@ -84,23 +86,29 @@ $methods
}
""")
-method_template = Template(""" int $name($base_package.$dto_package.$request request);""")
+method_template = Template(""" int $name($base_package.$dto_package.$request request) throws org.openvpp.jvpp.VppInvocationException;""")
method_native_template = Template(
""" private static native int ${name}0($base_package.$dto_package.$request request);""")
-method_impl_template = Template(""" public final int $name($base_package.$dto_package.$request request) {
- if(request == null) {
- throw new java.lang.NullPointerException("Null request object");
- }
+method_impl_template = Template(""" public final int $name($base_package.$dto_package.$request request) throws org.openvpp.jvpp.VppInvocationException {
+ java.util.Objects.requireNonNull(request,"Null request object");
connection.checkActive();
- return ${name}0(request);
+ int result=${name}0(request);
+ if(result<0){
+ throw new org.openvpp.jvpp.VppInvocationException("${name}",result);
+ }
+ return result;
}
""")
-no_arg_method_template = Template(""" int $name();""")
-no_arg_method_native_template = Template(""" private static native int ${name}0();""")
-no_arg_method_impl_template = Template(""" public final int $name() {
+no_arg_method_template = Template(""" int $name() throws org.openvpp.jvpp.VppInvocationException;""")
+no_arg_method_native_template = Template(""" private static native int ${name}0() throws org.openvpp.jvpp.VppInvocationException;""")
+no_arg_method_impl_template = Template(""" public final int $name() throws org.openvpp.jvpp.VppInvocationException {
connection.checkActive();
- return ${name}0();
+ int result=${name}0();
+ if(result<0){
+ throw new org.openvpp.jvpp.VppInvocationException("${name}",result);
+ }
+ return result;
}
""")