Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions java/src/com/swiftnav/sbp/SBPMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ protected void build(Builder builder) {
}

/** There is no exposed access to this class outside of libsbp. */
@SuppressWarnings("unchecked")
public class Parser {
private ByteBuffer buf;

Expand Down Expand Up @@ -212,11 +213,11 @@ public <T extends SBPStruct> T[] getArray(Class<T> t) {
LinkedList<T> l = new LinkedList<T>();
while (true) {
try {
T tmp = t.newInstance();
T tmp = t.getDeclaredConstructor().newInstance();
tmp.parse(this);
l.add(tmp);
} catch (BufferUnderflowException e) {
return (T[]) l.toArray((T[]) Array.newInstance(t, l.size()));
return l.toArray((T[]) Array.newInstance(t, l.size()));
} catch (Exception e) {
e.printStackTrace();
return null;
Expand All @@ -228,7 +229,7 @@ public <T extends SBPStruct> T[] getArray(Class<T> t, int n) {
T[] ret = (T[]) Array.newInstance(t, n);
for (int i = 0; i < n; i++) {
try {
ret[i] = t.newInstance();
ret[i] = t.getDeclaredConstructor().newInstance();
ret[i].parse(this);
} catch (Exception e) {
e.printStackTrace();
Expand Down
2 changes: 1 addition & 1 deletion java/src/com/swiftnav/sbp/SBPStruct.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected SBPStruct() {}

protected abstract void build(SBPMessage.Builder builder);

protected abstract <T> T parse(SBPMessage.Parser parser) throws SBPBinaryException;
protected abstract SBPStruct parse(SBPMessage.Parser parser) throws SBPBinaryException;

protected abstract JSONObject toJSON();

Expand Down
10 changes: 2 additions & 8 deletions java/src/com/swiftnav/sbp/client/SBPHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,7 @@ public void addCallbackMulti(int[] ids, Reference<SBPCallback> cb) {
public void removeCallback(SBPCallback cb) {
synchronized (callbacks) {
for (List<Reference<SBPCallback>> cblist : callbacks.values()) {
for (Reference<SBPCallback> ref : cblist) {
if (ref.get() == cb) {
cblist.remove(ref);
}
}
cblist.removeIf(ref -> ref.get() == cb);
}
strongCallbacks.remove(cb);
}
Expand Down Expand Up @@ -201,9 +197,7 @@ protected SBPMessage getNext() {
if (msg != null) {
return msg;
}
continue;
} catch (InterruptedException e) {
continue;
} catch (InterruptedException ignored) { // NOSONAR
}
}
// If we get here finished is set to true so there are no more messages available
Expand Down