Skip to content

Commit b5cb346

Browse files
author
Darren Greaves
committed
Upgrade various libraries and add dependency check
Upgraded scribe-java to `8.3.3` Added owasp dependency checker
1 parent baf7471 commit b5cb346

File tree

5 files changed

+78
-28
lines changed

5 files changed

+78
-28
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ An API key is required to use this API. You can [request one on Flickr](http://
4141

4242
#### Required libraries
4343

44-
- [scribejava-api (v 6.9.0 onwards)](https://github.com/scribejava/scribejava) (required for the OAuth functionality)
44+
- [scribejava-api (v8.3.3 onwards)](https://github.com/scribejava/scribejava) (required for the OAuth functionality)
4545
- [SLF4J](https://www.slf4j.org) (runtime dependency for logging)
4646

4747
[See here](https://www.slf4j.org/manual.html#swapping) for details on how to choose and configure an SLF4J logging library.
@@ -76,3 +76,10 @@ Run tests as follows.
7676

7777
Expect lots of failures and general flakiness as data has changed on Flickr and the tests or data need updating.
7878

79+
### Dependency checker
80+
81+
[OWASP dependency-check](https://github.com/jeremylong/DependencyCheck) is configured in the pom.xml.
82+
83+
To run a dependency check
84+
85+
mvn -U clean verify -P dependency-check

config/dependencyCheckSuppression.xml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<suppressions xmlns="https://www.owasp.org/index.php/OWASP_Dependency_Check_Suppression">
3+
4+
</suppressions>

pom.xml

+58-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45

56
<groupId>com.flickr4java</groupId>
@@ -11,20 +12,20 @@
1112
<url>https://github.com/boncey/Flickr4Java</url>
1213

1314
<developers>
14-
<developer>
15-
<id>boncey</id>
16-
<name>Darren Greaves</name>
17-
<roles>
18-
<role>developer</role>
19-
</roles>
20-
</developer>
21-
<developer>
22-
<id>callmeal</id>
23-
<name>Allan</name>
24-
<roles>
25-
<role>developer</role>
26-
</roles>
27-
</developer>
15+
<developer>
16+
<id>boncey</id>
17+
<name>Darren Greaves</name>
18+
<roles>
19+
<role>developer</role>
20+
</roles>
21+
</developer>
22+
<developer>
23+
<id>callmeal</id>
24+
<name>Allan</name>
25+
<roles>
26+
<role>developer</role>
27+
</roles>
28+
</developer>
2829
</developers>
2930

3031
<licenses>
@@ -37,9 +38,12 @@
3738

3839
<properties>
3940
<javaVersion>1.8</javaVersion>
40-
<junitVersion>4.13.1</junitVersion>
41-
<slf4j.version>1.7.30</slf4j.version>
42-
<scribe.version>6.9.0</scribe.version>
41+
<junitVersion>4.13.2</junitVersion>
42+
<slf4j.version>2.0.5</slf4j.version>
43+
<scribe.version>8.3.3</scribe.version>
44+
<dependency.check.suppression.file>config/dependencyCheckSuppression.xml</dependency.check.suppression.file>
45+
<dependency.check.version>8.2.1</dependency.check.version>
46+
4347
</properties>
4448

4549
<dependencies>
@@ -133,7 +137,7 @@
133137
<goal>jar</goal>
134138
</goals>
135139
<configuration>
136-
<additionalparam>-Xdoclint:none</additionalparam>
140+
<additionalOptions>-Xdoclint:none</additionalOptions>
137141
</configuration>
138142
</execution>
139143
</executions>
@@ -182,13 +186,21 @@
182186
</executions>
183187
</plugin>
184188
<plugin>
189+
<groupId>org.apache.maven.plugins</groupId>
185190
<artifactId>maven-javadoc-plugin</artifactId>
191+
<version>3.2.0</version>
192+
<configuration>
193+
<source>8</source>
194+
</configuration>
186195
<executions>
187196
<execution>
188197
<id>attach-javadocs</id>
189198
<goals>
190199
<goal>jar</goal>
191200
</goals>
201+
<configuration>
202+
<additionalOptions>-Xdoclint:none</additionalOptions>
203+
</configuration>
192204
</execution>
193205
</executions>
194206
</plugin>
@@ -233,6 +245,33 @@
233245
</plugins>
234246
</build>
235247
</profile>
248+
<profile>
249+
<id>dependency-check</id>
250+
<activation>
251+
<activeByDefault>false</activeByDefault>
252+
</activation>
253+
<build>
254+
<plugins>
255+
<plugin>
256+
<groupId>org.owasp</groupId>
257+
<artifactId>dependency-check-maven</artifactId>
258+
<version>${dependency.check.version}</version>
259+
<configuration>
260+
<suppressionFile>${dependency.check.suppression.file}</suppressionFile>
261+
<failBuildOnAnyVulnerability>true</failBuildOnAnyVulnerability>
262+
</configuration>
263+
<executions>
264+
<execution>
265+
<phase>package</phase>
266+
<goals>
267+
<goal>check</goal>
268+
</goals>
269+
</execution>
270+
</executions>
271+
</plugin>
272+
</plugins>
273+
</build>
274+
</profile>
236275
</profiles>
237276
<reporting>
238277
<plugins>

src/main/java/com/flickr4java/flickr/REST.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.flickr4java.flickr.util.IOUtilities;
99
import com.flickr4java.flickr.util.OAuthUtilities;
1010
import com.flickr4java.flickr.util.UrlUtilities;
11+
import com.github.scribejava.core.httpclient.multipart.FileByteArrayBodyPartPayload;
1112
import com.github.scribejava.core.model.OAuth1AccessToken;
1213
import com.github.scribejava.core.model.OAuthRequest;
1314
import com.github.scribejava.core.model.Parameter;
@@ -227,9 +228,8 @@ public com.flickr4java.flickr.Response postMultiPart(String path, UploadMetaData
227228
// Ensure all parameters (including oauth) are added to payload so signature matches
228229
uploadParameters.putAll(request.getOauthParameters());
229230

230-
request.addFileByteArrayBodyPartPayloadInMultipartPayload(payload.getPayload(), "photo", metaData.getFilename());
231-
uploadParameters.entrySet().forEach(e ->
232-
request.addFileByteArrayBodyPartPayloadInMultipartPayload(null, e.getValue().getBytes(), e.getKey()));
231+
request.addBodyPartPayloadInMultipartPayload(new FileByteArrayBodyPartPayload(payload.getPayload(), "photo", metaData.getFilename()));
232+
uploadParameters.forEach((param, uploadPayload) -> request.addBodyPartPayloadInMultipartPayload(new FileByteArrayBodyPartPayload(uploadPayload.getBytes(), param)));
233233

234234
try {
235235
return handleResponse(request, service);

src/main/java/com/flickr4java/flickr/groups/discuss/GroupDiscussInterface.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
import java.util.HashMap;
1212
import java.util.Map;
1313

14+
/**
15+
* Group.Discuss Interface.
16+
*
17+
* @author Jonathan Willis
18+
*/
1419
public class GroupDiscussInterface {
1520

16-
/**
17-
* Group.Discuss Interface.
18-
*
19-
* @author Jonathan Willis
20-
*/
2121
public static final String METHOD_TOPICS_GET_LIST = "flickr.groups.discuss.topics.getList";
2222

2323
public static final String METHOD_TOPICS_GET_INFO = "flickr.groups.discuss.topics.getInfo";

0 commit comments

Comments
 (0)