diff --git a/gradle.properties b/gradle.properties index 451f23766..c6acea154 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ -version = 3.2-SNAPSHOT +version = 3.3-SNAPSHOT org.gradle.caching = true org.gradle.parallel = true diff --git a/module/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractControllerServer.java b/module/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractControllerServer.java index 45218eb4c..0148cd2fa 100644 --- a/module/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractControllerServer.java +++ b/module/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractControllerServer.java @@ -922,7 +922,7 @@ protected final Object getDataField(String name) throws NotAvailableException { } return dataClone.getField(findFieldByName); } catch (Exception ex) { - throw new NotAvailableException(name, this, ex); + throw new NotAvailableException(this.getClass(), name, ex); } } diff --git a/module/exception/src/main/java/org/openbase/jul/exception/NotAvailableException.java b/module/exception/src/main/java/org/openbase/jul/exception/NotAvailableException.java index e668ce8c9..3b037509c 100644 --- a/module/exception/src/main/java/org/openbase/jul/exception/NotAvailableException.java +++ b/module/exception/src/main/java/org/openbase/jul/exception/NotAvailableException.java @@ -46,155 +46,136 @@ public NotAvailableException(final Class identifier) { this(ContextType.CLASS, identifier.getSimpleName()); } - /** - * Method generates a suitable exception message with the given {@code identifier}. - * - * @param identifier an instance providing a toString() method to identify the missing context. - */ - public NotAvailableException(final Object identifier) { - this(identifier.toString()); - } - /** * Method generates a suitable exception message out of the given {@code context} and {@code identifier}. * * @param context a keyword which describes the type of what is missing. - * @param identifier an instance providing a toString() method to identify the missing context. + * @param identifier a class used as identifier of the missing context. */ - public NotAvailableException(final String context, final Object identifier) { - this(context, identifier.toString()); + public NotAvailableException(final String context, final Class identifier) { + this(context, identifier.getSimpleName()); } /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * * @param context a keyword which describes the type of what is missing. - * @param identifier an instance providing a toString() method to identify the missing context. + * @param identifier a class used as identifier of the missing context. * @param cause the cause of this exception. */ - public NotAvailableException(final String context, final Object identifier, final Throwable cause) { - this(context, identifier.toString(), cause); + public NotAvailableException(final String context, final Class identifier, final Throwable cause) { + this(context, identifier.getSimpleName(), cause); } /** * Method generates a suitable exception message out of the given {@code context} and {@code identifier}. * - * @param context a enum which describes the type of what is missing. - * @param identifier an instance providing a toString() method to identify the missing context. + * @param context an enum which describes the type of what is missing. + * @param identifier a class used as identifier of the missing context. */ - public NotAvailableException(final ContextType context, final Object identifier) { - this(context, identifier.toString()); + public NotAvailableException(final ContextType context, final Class identifier) { + this(context, identifier.getSimpleName()); } /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * - * @param context a enum which describes the type of what is missing. - * @param identifier an instance providing a toString() method to identify the missing context. + * @param context an enum which describes the type of what is missing. + * @param identifier a class used as identifier of the missing context. * @param cause the cause of this exception. */ - public NotAvailableException(final ContextType context, final Object identifier, final Throwable cause) { - this(context, identifier.toString(), cause); + public NotAvailableException(final ContextType context, final Class identifier, final Throwable cause) { + this(context, identifier.getSimpleName(), cause); } /** * Method generates a suitable exception message out of the given {@code context} and {@code identifier}. * * @param context a keyword which describes the type of what is missing. - * @param identifier an instance providing a toString() method to identify the missing context. + * @param identifier a class used as identifier of the missing context. */ - public NotAvailableException(final Class context, final Object identifier) { - this(context.getSimpleName(), identifier.toString()); + public NotAvailableException(final Class context, final Class identifier) { + this(context.getSimpleName(), identifier.getSimpleName()); } /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * * @param context a class to describe the missing context. - * @param identifier an identifier to describe the missing context. + * @param identifier a class used as identifier of the missing context. * @param cause the cause of this exception. */ - public NotAvailableException(final Class context, final Object identifier, final Throwable cause) { - this(context.getSimpleName(), identifier.toString(), cause); - } - - /** - * Method generates a suitable exception message out of the given {@code identifier} and {@code message}. - * - * @param identifier an instance providing a toString() method to identify the missing context. - * @param message an additional message which is added to the end of the generated message. - */ - public NotAvailableException(final Object identifier, final String message) { - this((String) null, identifier.toString(), message); + public NotAvailableException(final Class context, final Class identifier, final Throwable cause) { + this(context.getSimpleName(), identifier.getSimpleName(), cause); } /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * * @param context a keyword which describes the type of what is missing. - * @param identifier an instance providing a toString() method to identify the missing context. + * @param identifier a class used as identifier of the missing context. * @param message an additional message which is added to the end of the generated message. */ - public NotAvailableException(final String context, final Object identifier, final String message) { - this(context, identifier.toString(), message); + public NotAvailableException(final String context, final Class identifier, final String message) { + this(context, identifier.getSimpleName(), message); } /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * * @param context a keyword which describes the type of what is missing. - * @param identifier an instance providing a toString() method to identify the missing context. + * @param identifier a class used as identifier of the missing context. * @param message an additional message which is added to the end of the generated message. * @param cause the cause of this exception. */ - public NotAvailableException(final String context, final Object identifier, final String message, final Throwable cause) { - this(context, identifier.toString(), message, cause); + public NotAvailableException(final String context, final Class identifier, final String message, final Throwable cause) { + this(context, identifier.getSimpleName(), message, cause); } /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * - * @param context a enum which describes the type of what is missing. - * @param identifier an instance providing a toString() method to identify the missing context. + * @param context an enum which describes the type of what is missing. + * @param identifier a class used as identifier of the missing context. * @param message an additional message which is added to the end of the generated message. */ - public NotAvailableException(final ContextType context, final Object identifier, final String message) { - this(context, identifier.toString(), message); + public NotAvailableException(final ContextType context, final Class identifier, final String message) { + this(context, identifier.getSimpleName(), message); } /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * - * @param context a enum which describes the type of what is missing. - * @param identifier an instance providing a toString() method to identify the missing context. + * @param context an enum which describes the type of what is missing. + * @param identifier a class used as identifier of the missing context. * @param message an additional message which is added to the end of the generated message. * @param cause the cause of this exception. */ - public NotAvailableException(final ContextType context, final Object identifier, final String message, final Throwable cause) { - this(context, identifier.toString(), message, cause); + public NotAvailableException(final ContextType context, final Class identifier, final String message, final Throwable cause) { + this(context, identifier.getSimpleName(), message, cause); } /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * * @param context a class to describe the missing context. - * @param identifier an instance providing a toString() method to identify the missing context. + * @param identifier a class used as identifier of the missing context. * @param message an additional message which is added to the end of the generated message. */ - public NotAvailableException(final Class context, final Object identifier, final String message) { - this(context.getSimpleName(), identifier.toString(), message); + public NotAvailableException(final Class context, final Class identifier, final String message) { + this(context.getSimpleName(), identifier.getSimpleName(), message); } /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * * @param context a class to describe the missing context. - * @param identifier an instance providing a toString() method to identify the missing context. + * @param identifier a class used as identifier of the missing context. * @param message an additional message which is added to the end of the generated message. * @param cause the cause of this exception. */ - public NotAvailableException(final Class context, final Object identifier, final String message, final Throwable cause) { - this(context.getSimpleName(), identifier.toString(), message, cause); + public NotAvailableException(final Class context, final Class identifier, final String message, final Throwable cause) { + this(context.getSimpleName(), identifier.getSimpleName(), message, cause); } /** @@ -207,6 +188,17 @@ public NotAvailableException(final Class context, final String identifier) { this(context.getSimpleName(), identifier); } + /** + * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. + * + * @param context an object used to describe the missing context. + * @param identifier an identifier to identify the missing context. + * @param cause the cause of this exception. + */ + public NotAvailableException(final Object context, final String identifier, final Throwable cause) { + this(context.getClass(), identifier, cause); + } + /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * @@ -244,7 +236,7 @@ public NotAvailableException(final Class context, final String identifier, final /** * Method generates a suitable exception message out of the given {@code context} and {@code identifier}. * - * @param context a enum which describes the type of what is missing. + * @param context an enum which describes the type of what is missing. * @param identifier an identifier to describe the missing context. */ public NotAvailableException(final ContextType context, final String identifier) { @@ -254,7 +246,7 @@ public NotAvailableException(final ContextType context, final String identifier) /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * - * @param context a enum which describes the type of what is missing. + * @param context an enum which describes the type of what is missing. * @param identifier an identifier to describe the missing context. * @param cause the cause of this exception. */ @@ -265,7 +257,7 @@ public NotAvailableException(final ContextType context, final String identifier, /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * - * @param context a enum which describes the type of what is missing. + * @param context an enum which describes the type of what is missing. * @param identifier an identifier to describe the missing context. * @param message an additional message which is added to the end of the generated message. */ @@ -276,7 +268,7 @@ public NotAvailableException(final ContextType context, final String identifier, /** * Method generates a suitable exception message out of the given {@code context}, {@code identifier} and {@code message}. * - * @param context a enum which describes the type of what is missing. + * @param context an enum which describes the type of what is missing. * @param identifier an identifier to describe the missing context. * @param message an additional message which is added to the end of the generated message. * @param cause the cause of this exception. diff --git a/module/extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/processing/ProtoBufFieldProcessor.java b/module/extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/processing/ProtoBufFieldProcessor.java index d1f71a6aa..df357bae1 100644 --- a/module/extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/processing/ProtoBufFieldProcessor.java +++ b/module/extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/processing/ProtoBufFieldProcessor.java @@ -369,7 +369,7 @@ public static Object getMapEntry(final Object key, FieldDescriptor mapFieldDescr } throw new InvalidStateException("Key is unknown!"); } catch (Exception ex) { - throw new NotAvailableException("Entry of Key", key, ex); + throw new NotAvailableException("Entry of Key", key.toString(), ex); } } diff --git a/module/storage/src/main/java/org/openbase/jul/storage/file/FileSynchronizer.java b/module/storage/src/main/java/org/openbase/jul/storage/file/FileSynchronizer.java index 64e86925b..5a578e452 100644 --- a/module/storage/src/main/java/org/openbase/jul/storage/file/FileSynchronizer.java +++ b/module/storage/src/main/java/org/openbase/jul/storage/file/FileSynchronizer.java @@ -120,7 +120,7 @@ public final File save(final D data) throws CouldNotPerformException { this.data = data; if (!file.exists()) { - throw new NotAvailableException(File.class, file, "File does not exist!"); + throw new NotAvailableException(File.class, file.getAbsolutePath(), "File does not exist!"); } if (!file.canWrite()) {