Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Handle primitive type arrays correctly #60

Open
tobiasstamann opened this issue Mar 10, 2017 · 0 comments
Open

Handle primitive type arrays correctly #60

tobiasstamann opened this issue Mar 10, 2017 · 0 comments

Comments

@tobiasstamann
Copy link
Member

tobiasstamann commented Mar 10, 2017

Using the context logger with primitive arrays like float[], char[], byte[] currently triggers a ClassCastException:

Exception in thread "main" java.lang.ClassCastException: [F cannot be cast to [Ljava.lang.Object;
at io.tracee.contextlogger.outputgenerator.RecursiveOutputElementTreeBuilderImpl.convertInstanceRecursively(RecursiveOutputElementTreeBuilderImpl.java:93)
at io.tracee.contextlogger.outputgenerator.RootOutputElementTreeBuilder.buildOutputElementTreeMain(RootOutputElementTreeBuilder.java:35)
at io.tracee.contextlogger.outputgenerator.RootOutputElementTreeBuilder.buildOutputElementTree(RootOutputElementTreeBuilder.java:69)
at io.tracee.contextlogger.outputgenerator.TraceeContextStringRepresentationBuilderImpl.createStringRepresentation(TraceeContextStringRepresentationBuilderImpl.java:18)
at io.tracee.contextlogger.TraceeContextLogger.provideOutput(TraceeContextLogger.java:92)
at io.tracee.contextlogger.connector.LogConnector.sendErrorReport(LogConnector.java:40)
at io.tracee.contextlogger.ConnectorFactory.sendErrorReportToConnectors(ConnectorFactory.java:82)
at io.tracee.contextlogger.TraceeContextLogger.logWithPrefixedMessage(TraceeContextLogger.java:67)
at io.tracee.contextlogger.TraceeContextLogger.log(TraceeContextLogger.java:58)

tobiasstamann added a commit that referenced this issue Mar 10, 2017
atomic type arrays are now handled via an context provider.

This approach currently has a drawback.
Atomic type arrays will be outputted like this:

17:04:30.642 [main] ERROR i.t.c.connector.LogConnector - {
  "<TYPE>":"char[]",
  "value":"String<'['A', 'B', 'C', 'A', 'D', 'A', 'D', 'A', 'D', 'D', 'A', 'D', 'A', 'D', 'A', 'D', 'A', 'D', 'D', 'A', 'D', 'A', 'D', 'A']'>"
}

So we still need to add some kind of AtomicTraceeContextProvider which returns exactly one value.
@tobiasstamann tobiasstamann changed the title Handle atomic type arrays correctly Handle primitive type arrays correctly Mar 13, 2017
tobiasstamann added a commit that referenced this issue Mar 14, 2017
Now they will be printed like a primitve type. Multiple output of the same primitive array will be done via references.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant