Skip to content

Commit

Permalink
Merge branch 'release/1.12'
Browse files Browse the repository at this point in the history
  • Loading branch information
wlfgang committed Oct 12, 2022
2 parents c65c5d1 + 12edf84 commit d898f53
Show file tree
Hide file tree
Showing 1,918 changed files with 146,072 additions and 215,349 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ develop, main ]
branches: [ 1.x, main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop, main ]
branches: [ 1.x, main ]
schedule:
- cron: '25 13 * * 2'

Expand All @@ -43,7 +43,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -54,7 +54,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,4 +68,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
4 changes: 2 additions & 2 deletions .github/workflows/jdk11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: JDK11 Build (Ubuntu 20.04 default)

on:
push:
branches: [ develop, main ]
branches: [ 1.x, main ]
pull_request:
branches: [ develop, main ]
branches: [ 1.x, main ]

jobs:
build:
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/jdk14.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/jdk8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: JDK8 Build (Ubuntu 18.04)

on:
push:
branches: [ develop, main ]
branches: [ 1.x, main ]
pull_request:
branches: [ develop, main ]
branches: [ 1.x, main ]

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: macOS Build

on:
push:
branches: [ develop, main ]
branches: [ 1.x, main ]
pull_request:
branches: [ develop, main ]
branches: [ 1.x, main ]

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Quality Assurance Checks

on:
push:
branches: [ develop, main ]
branches: [ 1.x, main ]
pull_request:
branches: [ develop, main ]
branches: [ 1.x, main ]

jobs:
build:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Windows Build

on:
push:
branches: [ develop, main ]
branches: [ 1.x, main ]
pull_request:
branches: [ develop, main ]
branches: [ 1.x, main ]

jobs:
build:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### October 12, 2022, version 1.12.0
* The majority of development over the past year has been on 2.x, so
this is primarily a maintenance release
* Added support for top-level ST 0903 messages in MisbMessageFactory
* Numerous dependency updates

### December 29, 2021, version 1.11.0
* Completed ST 0805 implementation and added `cotconverter` example
* Implemented ST 1108, Interpretability and Quality Metadata Local Set
Expand Down
16 changes: 9 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# How to Contribute

As a new project, there are many areas where jMISB could use your help.
There are many areas where jMISB could use your help.
To get an idea of some of the things on our road map, see the
[issues board](https://github.com/WestRidgeSystems/jmisb/issues). New contributors
are encouraged to get started on smaller tasks, which we will tag using the
`good first issue` label.

## Development Guidelines

* If you develop a new feature or enhancement, please create a branch off of
the `develop` branch for your changes, and create a pull request when you
believe it is ready for review.
* There are currently two development branches to which all pull requests should
go: `1.x` and `2.x`.

* If you are fixing a bug, you may either branch off `develop`, or
off `master` if you need to patch a prior release (perhaps because
you're using the release in your own project).
* `1.x` is in maintenance mode, so preferably PRs for new features should go into
`2.x`.

* If you are fixing a bug, you may submit the PR against either branch. Once
approved on that branch, we will ensure it gets merged into the other branch,
if appropriate.

* On your branch, please only make changes for the single issue you are
working on. If you find yourself tempted to make other enhancements along the
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# jMISB

![Build Status](https://github.com/WestRidgeSystems/jmisb/actions/workflows/jdk11.yml/badge.svg)
[![codecov](https://codecov.io/gh/WestRidgeSystems/jmisb/branch/develop/graph/badge.svg?token=SWXQJKERQY)](https://codecov.io/gh/WestRidgeSystems/jmisb)
[![codecov](https://codecov.io/gh/WestRidgeSystems/jmisb/branch/main/graph/badge.svg?token=SWXQJKERQY)](https://codecov.io/gh/WestRidgeSystems/jmisb)
[![CodeQL](https://github.com/WestRidgeSystems/jmisb/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/WestRidgeSystems/jmisb/actions/workflows/codeql-analysis.yml)
[![Maven Central](https://maven-badges-generator.herokuapp.com/maven-central/org.jmisb/jmisb/badge.svg)](https://maven-badges-generator.herokuapp.com/maven-central/org.jmisb/jmisb)
[![Gitter](https://badges.gitter.im/jmisb/community.svg)](https://gitter.im/jmisb/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Expand Down Expand Up @@ -77,15 +77,15 @@ jMISB as a dependency. For Maven, add the following to your `pom.xml`:
<dependency>
<groupId>org.jmisb</groupId>
<artifactId>jmisb-api</artifactId>
<version>1.11.0</version>
<version>1.12.0</version>
</dependency>
```

For Gradle, include the following:

```groovy
dependencies {
implementation 'org.jmisb:jmisb-api:1.11.0'
implementation 'org.jmisb:jmisb-api:1.12.0'
}
```

Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jmisb</groupId>
<artifactId>jmisb</artifactId>
<version>1.11.0</version>
<version>1.12.0</version>
</parent>
<artifactId>jmisb-api</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/org/jmisb/api/klv/MisbMessageFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.jmisb.api.klv.st0102.universalset.SecurityMetadataUniversalSetFactory;
import org.jmisb.api.klv.st0601.UasDatalinkMessageFactory;
import org.jmisb.api.klv.st0808.AncillaryTextLocalSetFactory;
import org.jmisb.api.klv.st0903.VmtiLocalSetFactory;
import org.jmisb.api.klv.st0903.vtrack.VTrackLocalSetFactory;
import org.jmisb.api.klv.st1108.InterpretabilityQualityLocalSetFactory;
import org.jmisb.api.klv.st1902.MimdLocalSetFactory;
Expand All @@ -34,6 +35,7 @@ private MisbMessageFactory() {
KlvConstants.SecurityMetadataLocalSetUl, new SecurityMetadataLocalSetFactory());
registerHandler(KlvConstants.PredatorMetadataLocalSetUl, new PredatorUavMessageFactory());
registerHandler(KlvConstants.VTrackLocalSetUl, new VTrackLocalSetFactory());
registerHandler(KlvConstants.VmtiLocalSetUl, new VmtiLocalSetFactory());
registerHandler(KlvConstants.MIMDLocalSetUl, new MimdLocalSetFactory());
registerHandler(
KlvConstants.InterpretabilityQualityLocalSetUl,
Expand Down
31 changes: 21 additions & 10 deletions api/src/main/java/org/jmisb/api/klv/st0903/VmtiLocalSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
import java.util.TreeMap;
import org.jmisb.api.common.InvalidDataHandler;
import org.jmisb.api.common.KlvParseException;
import org.jmisb.api.klv.Ber;
import org.jmisb.api.klv.BerEncoder;
import org.jmisb.api.klv.IKlvKey;
import org.jmisb.api.klv.IMisbMessage;
import org.jmisb.api.klv.LdsField;
import org.jmisb.api.klv.LdsParser;
import org.jmisb.api.klv.UniversalLabel;
import org.jmisb.api.klv.*;
import org.jmisb.api.klv.st0601.Checksum;
import org.jmisb.api.klv.st0903.shared.EncodingMode;
import org.jmisb.api.klv.st0903.shared.VmtiTextString;
Expand Down Expand Up @@ -119,9 +113,25 @@ public VmtiLocalSet(Map<VmtiMetadataKey, IVmtiMetadataValue> values) {
* @throws KlvParseException if parsing fails
*/
public VmtiLocalSet(byte[] bytes) throws KlvParseException {

int offset = 0;
int setLength = bytes.length;

// conditionally parse Universal Key if not embedded in 0601
if (setLength > UniversalLabel.LENGTH) {
byte[] ul = Arrays.copyOfRange(bytes, offset, UniversalLabel.LENGTH);
if (Arrays.equals(KlvConstants.VmtiLocalSetUl.getBytes(), ul)) {
BerField lengthField = BerDecoder.decode(bytes, UniversalLabel.LENGTH, false);
setLength = lengthField.getValue();
offset = UniversalLabel.LENGTH + lengthField.getLength();

if (setLength + offset > bytes.length)
throw new KlvParseException("VMTI BER length is greater than provided bytes");
}
}

EncodingMode encodingMode = EncodingMode.IMAPB;
List<LdsField> fields = LdsParser.parseFields(bytes, offset, bytes.length);
List<LdsField> fields = LdsParser.parseFields(bytes, offset, setLength);
for (LdsField field : fields) {
VmtiMetadataKey key = VmtiMetadataKey.getKey(field.getTag());
if (key.equals(VmtiMetadataKey.VersionNumber)) {
Expand All @@ -140,7 +150,8 @@ public VmtiLocalSet(byte[] bytes) throws KlvParseException {
break;
case Checksum:
byte[] expected = Checksum.compute(bytes, false);
byte[] actual = Arrays.copyOfRange(bytes, bytes.length - 2, bytes.length);
byte[] actual =
Arrays.copyOfRange(bytes, setLength + offset - 2, setLength + offset);
if (!Arrays.equals(expected, actual)) {
InvalidDataHandler.getInstance()
.handleInvalidChecksum(LOGGER, "Bad checksum");
Expand Down Expand Up @@ -249,7 +260,7 @@ public String displayHeader() {

private void updateVersion() {
ST0903Version version = (ST0903Version) getField(VmtiMetadataKey.VersionNumber);
// If we're missing a version, or its too old, update it to current. Otherwise leave it
// If we're missing a version, or it's too old, update it to current. Otherwise, leave it
// alone.
if ((version == null) || (version.getVersion() < 4)) {
version = new ST0903Version(VmtiMetadataConstants.ST_VERSION_NUMBER);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.jmisb.api.klv.st0903;

import org.jmisb.api.common.KlvParseException;
import org.jmisb.api.klv.IMisbMessageFactory;

/**
* VMTI Local Set Factory (ST 0903).
*
* <p>From ST:
*
* <blockquote>
*
* This standard defines Local Sets for VMTI and Track Metadata. These Local Sets may be embedded
* within a MISB ST0601LS, or they may stand alone. The latter permits VMTI and Track Metadata to be
* provided independent of Motion Imagery essence. This is useful in constrained bandwidth
* environments, where the Motion Imagery may be omitted in favor of the VMTI data.
*
* </blockquote>
*/
public class VmtiLocalSetFactory implements IMisbMessageFactory {

/**
* Create from bytes.
*
* @param bytes the VMTI byte data
*/
@Override
public VmtiLocalSet create(byte[] bytes) throws KlvParseException {
return new VmtiLocalSet(bytes);
}
}
Loading

0 comments on commit d898f53

Please sign in to comment.