Skip to content

Commit 10e0c32

Browse files
authored
Merge pull request #167 from eclipse/spring2
Update rest-backend and rest-lib-utils to SpringBoot 2.5.1
2 parents 51525a8 + 5460636 commit 10e0c32

30 files changed

+331
-552
lines changed

lang-java/src/main/java/org/eclipse/steady/java/JarWriter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ public Path rewrite(Path _todir) throws JarAnalysisException {
543543
}
544544

545545
// Add additional files
546+
546547
for (Map.Entry<String, Path> e : this.additionalFiles.entrySet()) {
547548
if (e.getValue().toFile().exists()) {
548549
new_entry = new JarEntry(e.getKey());

lang-java/src/main/java/org/eclipse/steady/java/sign/gson/ASTSignatureChangeSerializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ private void writeSourceCodeEntityElement(
6767
jgen.writeObjectFieldStart(_property_name);
6868
jgen.writeStringField("UniqueName", _entity.getUniqueName().toString());
6969
jgen.writeStringField("EntityType", _entity.getType().toString());
70+
7071
jgen.writeStringField("Modifiers", Integer.toString(_entity.getModifiers()));
7172
jgen.writeObjectFieldStart("SourceCodeRange");
7273
jgen.writeStringField("Start", Integer.toString(_entity.getSourceRange().getStart()));

rest-backend/pom.xml

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
<parent>
2727
<groupId>org.springframework.boot</groupId>
2828
<artifactId>spring-boot-starter-parent</artifactId>
29-
<version>1.5.22.RELEASE</version>
30-
<relativePath/>
29+
<version>2.5.1</version>
30+
<relativePath />
3131
</parent>
3232

3333
<groupId>org.eclipse.steady</groupId>
@@ -111,19 +111,9 @@
111111
<maven.install.skip>${skip.install.deploy}</maven.install.skip>
112112
<maven.deploy.skip>${skip.install.deploy}</maven.deploy.skip>
113113

114-
<!-- Fix vulnerable dependencies in spring-boot-dependencies -->
115-
<commons-beanutils.version>1.9.4</commons-beanutils.version><!-- from 1.9.3 -->
116-
<hibernate.version>5.4.25.Final</hibernate.version><!-- from 5.0.12.Final, which includes vulnerable dom4j 1.6.1 -->
117-
<jackson.version>2.9.10.20210106</jackson.version><!-- from 2.8.11.20181123 -->
118-
<logback.version>1.2.3</logback.version><!-- from 1.1.11 -->
119-
<log4j2.version>2.13.3</log4j2.version><!-- from 2.7 -->
120-
<snakeyaml.version>1.26</snakeyaml.version><!-- from 1.17 -->
121-
<spring.version>4.3.29.RELEASE</spring.version><!-- from 4.3.25.RELEASE -->
122-
<tomcat.version>8.5.63</tomcat.version><!-- from 8.5.43 -->
123114
</properties>
124115

125116
<dependencies>
126-
127117
<dependency>
128118
<groupId>org.eclipse.steady</groupId>
129119
<artifactId>shared</artifactId>
@@ -168,31 +158,14 @@
168158
<artifactId>json-path</artifactId>
169159
<version>2.4.0</version>
170160
</dependency>
171-
172-
<!-- Swagger core dependencies -->
173-
<dependency>
174-
<groupId>io.swagger</groupId>
175-
<artifactId>swagger-annotations</artifactId>
176-
<version>1.5.22</version>
177-
</dependency>
178-
<dependency>
179-
<groupId>io.swagger</groupId>
180-
<artifactId>swagger-core</artifactId>
181-
<version>1.5.22</version>
182-
</dependency>
183-
184-
<!-- SpringFox dependencies -->
185-
<dependency>
186-
<groupId>io.springfox</groupId>
187-
<artifactId>springfox-swagger2</artifactId>
188-
<version>2.9.2</version>
189-
</dependency>
161+
162+
<!-- Swagger dependencies -->
190163
<dependency>
191-
<groupId>io.springfox</groupId>
192-
<artifactId>springfox-swagger-ui</artifactId>
193-
<version>2.9.2</version>
194-
</dependency>
195-
164+
<groupId>org.springdoc</groupId>
165+
<artifactId>springdoc-openapi-ui</artifactId>
166+
<version>1.2.32</version>
167+
</dependency>
168+
196169
<dependency>
197170
<groupId>com.sun.mail</groupId>
198171
<artifactId>javax.mail</artifactId>
@@ -204,6 +177,12 @@
204177
<artifactId>javax.activation-api</artifactId>
205178
<version>1.2.0</version>
206179
</dependency>
180+
181+
<dependency>
182+
<groupId>com.google.guava</groupId>
183+
<artifactId>guava</artifactId>
184+
<version>28.2-jre</version>
185+
</dependency>
207186

208187
<!-- Test dependencies -->
209188
<dependency>
@@ -218,6 +197,25 @@
218197
<artifactId>spring-boot-starter-test</artifactId>
219198
<scope>test</scope>
220199
</dependency>
200+
<dependency>
201+
<groupId>org.springframework</groupId>
202+
<artifactId>spring-mock</artifactId>
203+
<version>2.0.8</version>
204+
<scope>test</scope>
205+
</dependency>
206+
<!-- to allow tests written with JUnit 4 to be run by JUnit 5, see https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.4-Release-Notes#junit-5s-vintage-engine-removed-from-spring-boot-starter-test -->
207+
<dependency>
208+
<groupId>org.junit.vintage</groupId>
209+
<artifactId>junit-vintage-engine</artifactId>
210+
<scope>test</scope>
211+
<exclusions>
212+
<exclusion>
213+
<groupId>org.hamcrest</groupId>
214+
<artifactId>hamcrest-core</artifactId>
215+
</exclusion>
216+
</exclusions>
217+
</dependency>
218+
221219

222220
<!-- Used to mock REST services -->
223221
<dependency>
@@ -237,9 +235,9 @@
237235
<dependency>
238236
<groupId>org.flywaydb</groupId>
239237
<artifactId>flyway-core</artifactId>
240-
<version>5.0.7</version>
238+
<version>6.5.7</version> <!-- overriding managed version 7.7.3 to avoid 1 migration checksum mismatch -->
241239
</dependency>
242-
240+
243241
<!-- To prevent javadoc error "class file for javax.interceptor.InterceptorBinding not found" -->
244242
<dependency>
245243
<groupId>javax.interceptor</groupId>

rest-backend/src/main/java/org/eclipse/steady/backend/model/Dependency.java

100644100755
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public class Dependency implements Serializable {
119119
@Column(columnDefinition = "text")
120120
private String path;
121121

122-
@Column(columnDefinition = "text")
122+
@Column(length = 1024)
123123
private String relativePath;
124124

125125
@ManyToMany(
@@ -134,22 +134,23 @@ public class Dependency implements Serializable {
134134
private Set<TouchPoint> touchPoints;
135135

136136
/**
137-
* Only set when single dependencies are returned by {@link ApplicationController#getDependency(String, String, String, String)}.
138-
* TODO: Maybe check if they can always bet set (depending on performance and memory).
137+
* Only set when single dependencies are returned by {@link
138+
* ApplicationController#getDependency(String, String, String, String)}. TODO: Maybe check if they
139+
* can always bet set (depending on performance and memory).
139140
*/
140141
@Transient private Collection<Trace> traces;
141142

142143
/**
143-
* Contains collections of reachable dependency constructs per {@link ConstructType}.
144-
* It MUST be a subset of what can be obtained from the library via {@link Library#countConstructTypes()}.
144+
* Contains collections of reachable dependency constructs per {@link ConstructType}. It MUST be a
145+
* subset of what can be obtained from the library via {@link Library#countConstructTypes()}.
145146
*/
146147
@Transient private ConstructIdFilter reachableFilter = null;
147148

148149
/**
149-
* Contains collections of traced dependency constructs per {@link ConstructType}.
150-
* It MUST be a subset of what can be obtained from the library via {@link Library#countConstructTypes()}.
151-
* Depending on the quality of the reachability analysis, it SHOULD be a subset of what can be obtained
152-
* via {@link Dependency#countReachableConstructTypes()}.
150+
* Contains collections of traced dependency constructs per {@link ConstructType}. It MUST be a
151+
* subset of what can be obtained from the library via {@link Library#countConstructTypes()}.
152+
* Depending on the quality of the reachability analysis, it SHOULD be a subset of what can be
153+
* obtained via {@link Dependency#countReachableConstructTypes()}.
153154
*/
154155
@Transient private ConstructIdFilter tracedFilter = null;
155156

rest-backend/src/main/java/org/eclipse/steady/backend/repo/ApplicationRepository.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@ public interface ApplicationRepository
5656
/** Constant <code>FILTER</code> */
5757
public static final ResultSetFilter<Application> FILTER = new ResultSetFilter<Application>();
5858

59-
/**
60-
* <p>findById.</p>
61-
*
62-
* @param id a {@link java.lang.Long} object.
63-
* @return a {@link java.util.List} object.
64-
*/
65-
List<Application> findById(@Param("id") Long id);
66-
6759
/**
6860
* <p>findByGA.</p>
6961
*

rest-backend/src/main/java/org/eclipse/steady/backend/repo/ApplicationRepositoryImpl.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,11 @@ public TreeSet<VulnerableDependency> findAppVulnerableDependencies(
541541

542542
for (Object[] e : bundledDigests) {
543543
Dependency depWithBundledLibId =
544-
DependencyRepository.FILTER.findOne(
545-
this.depRepository.findById(((BigInteger) e[0]).longValue()));
544+
this.depRepository.findById(((BigInteger) e[0]).longValue()).orElse(null);
546545

547546
Library bundledDigest =
548-
LibraryRepository.FILTER.findOne(
549-
this.libRepository.findById(((BigInteger) e[1]).longValue()));
547+
this.libRepository.findById(((BigInteger) e[1]).longValue()).orElse(null);
548+
550549
List<Bug> vulns_cc = this.bugRepository.findByLibrary(bundledDigest);
551550

552551
for (Bug b : vulns_cc) {
@@ -570,12 +569,10 @@ public TreeSet<VulnerableDependency> findAppVulnerableDependencies(
570569
for (Object[] e : bundledLibIds) {
571570

572571
Dependency depWithBundledLibId =
573-
DependencyRepository.FILTER.findOne(
574-
this.depRepository.findById(((BigInteger) e[0]).longValue()));
572+
this.depRepository.findById(((BigInteger) e[0]).longValue()).orElse(null);
575573

576574
LibraryId bundledLibId =
577-
LibraryIdRepository.FILTER.findOne(
578-
this.libIdRepository.findById(((BigInteger) e[1]).longValue()));
575+
this.libIdRepository.findById(((BigInteger) e[1]).longValue()).orElse(null);
579576

580577
List<Bug> vulns_av_true = this.bugRepository.findByLibId(bundledLibId, true);
581578

rest-backend/src/main/java/org/eclipse/steady/backend/repo/BugRepository.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@ public interface BugRepository extends CrudRepository<Bug, Long>, BugRepositoryC
4343
/** Constant <code>FILTER</code> */
4444
public static final ResultSetFilter<Bug> FILTER = new ResultSetFilter<Bug>();
4545

46-
/**
47-
* <p>findById.</p>
48-
*
49-
* @param id a {@link java.lang.Long} object.
50-
* @return a {@link java.util.List} object.
51-
*/
52-
@Query("SELECT b FROM Bug b JOIN FETCH b.constructChanges WHERE b.id=:id")
53-
List<Bug> findById(@Param("id") Long id);
54-
5546
/**
5647
* <p>findByBugId.</p>
5748
*

rest-backend/src/main/java/org/eclipse/steady/backend/repo/DependencyRepository.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ public interface DependencyRepository
4242
/** Constant <code>FILTER</code> */
4343
public static final ResultSetFilter<Dependency> FILTER = new ResultSetFilter<Dependency>();
4444

45-
/**
46-
* <p>findById.</p>
47-
*
48-
* @param id a {@link java.lang.Long} object.
49-
* @return a {@link java.util.List} object.
50-
*/
51-
@Query("SELECT dep FROM Dependency dep JOIN FETCH dep.lib l WHERE dep.id = :id")
52-
List<Dependency> findById(@Param("id") Long id);
53-
5445
/**
5546
* <p>findByDigest.</p>
5647
*

rest-backend/src/main/java/org/eclipse/steady/backend/repo/GoalExecutionRepositoryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public GoalExecution findLatestGoalExecution(Application _app, GoalType _type) {
9696
Long id = null;
9797
if (_type != null) id = this.gexeRepository.findLatestForApp(_app.getId(), _type.toString());
9898
else id = this.gexeRepository.findLatestForApp(_app.getId());
99-
if (id != null) return this.gexeRepository.findOne(id);
99+
if (id != null) return this.gexeRepository.findById(id).orElse(null);
100100
else return null;
101101
}
102102

rest-backend/src/main/java/org/eclipse/steady/backend/repo/LibraryIdRepository.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ public interface LibraryIdRepository extends CrudRepository<LibraryId, Long> {
3838
/** Constant <code>FILTER</code> */
3939
public static final ResultSetFilter<LibraryId> FILTER = new ResultSetFilter<LibraryId>();
4040

41-
@Query("SELECT l FROM LibraryId l WHERE l.id=:id")
42-
List<LibraryId> findById(@Param("id") Long id);
43-
4441
/**
4542
* <p>findBySecondaryKey.</p>
4643
*

0 commit comments

Comments
 (0)