Skip to content

Commit

Permalink
Merge branch 'dev' into 92-memory-leak-in-sharedmqttclient
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineThreepwood authored Jan 21, 2023
2 parents a73f54c + 2b82c71 commit 86ff906
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 67 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version = 3.2-SNAPSHOT
version = 3.3-SNAPSHOT
org.gradle.caching = true
org.gradle.parallel = true
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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}.
*
Expand Down Expand Up @@ -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) {
Expand All @@ -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.
*/
Expand All @@ -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.
*/
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 86ff906

Please sign in to comment.