Skip to content

Commit a8078f8

Browse files
authored
Create maven.yml (#46)
* Create maven.yml * improve reference resolver not found exception * add getters to ReferenceNotFoundException
1 parent cad753f commit a8078f8

3 files changed

Lines changed: 52 additions & 9 deletions

File tree

.github/workflows/maven.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Java CI with Maven
10+
11+
on:
12+
push:
13+
branches: [ "master" ]
14+
pull_request:
15+
branches: [ "master" ]
16+
17+
jobs:
18+
build:
19+
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Set up JDK 11
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: '11'
28+
distribution: 'temurin'
29+
cache: maven
30+
- name: Build with Maven
31+
run: mvn -B package --file pom.xml -DversionHash=$(git rev-parse --short HEAD)
32+
33+
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
34+
- name: Update dependency graph
35+
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6

src/main/java/net/alenzen/a2l/indexes/ReferenceNotFoundException.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,31 @@
88
public class ReferenceNotFoundException extends NoSuchElementException {
99
private static final long serialVersionUID = -4277935098528086486L;
1010

11-
private String reference;
12-
private IAsap2TreeElement source;
13-
private List<String> indexes;
11+
private final String reference;
12+
private final IAsap2TreeElement source;
13+
private final List<String> indexes;
1414

1515
public ReferenceNotFoundException(String referenceString, IAsap2TreeElement node, List<String> searchedIndexes) {
1616
this.reference = referenceString;
1717
this.source = node;
1818
this.indexes = searchedIndexes;
1919
}
2020

21+
public String getReference() {
22+
return reference;
23+
}
24+
25+
public IAsap2TreeElement getSource() {
26+
return source;
27+
}
28+
29+
public List<String> getIndexes() {
30+
return indexes;
31+
}
32+
2133
@Override
2234
public String toString() {
23-
return String.format("Cannot find reference '%s' of '%s' in index '%s'", reference, source.toString(),
35+
return String.format("Cannot find reference '%s' of '%s' in index(es) '%s'", reference, source.toString(),
2436
String.join(",", indexes));
2537
}
2638
}

src/main/java/net/alenzen/a2l/indexes/ReferenceResolver.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,8 @@ private void resolveReferencesOnFields(IAsap2TreeElement node, Map<String, Map<S
146146
}
147147

148148
if (!referenceFoundFlag) {
149-
new ReferenceNotFoundException(referenceString, node, searchedIndexes);
150-
referenceNotFound.accept( // TODO improve exception so the exception contains the actual data to
151-
// better debug and filter issues
152-
new NoSuchElementException());
149+
referenceNotFound.accept(new ReferenceNotFoundException(referenceString, node, searchedIndexes));
153150
}
154-
155151
}
156152

157153
// loop exit condition

0 commit comments

Comments
 (0)