Skip to content

Commit b1f24ff

Browse files
authored
Merge pull request #88 from OpenCageData/release-3.0.0
Release 3.0.0
2 parents d0132f5 + bbc669b commit b1f24ff

31 files changed

+684
-82
lines changed

.github/workflows/java.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Java workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
tags-ignore:
8+
- "*.*"
9+
paths-ignore:
10+
- README.md
11+
- CHANGELOG.md
12+
13+
jobs:
14+
gradle_tests:
15+
name: Gradle Build
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout latest source
20+
uses: actions/checkout@v6
21+
22+
- name: Set up JDK
23+
uses: actions/setup-java@v5
24+
with:
25+
distribution: "temurin"
26+
java-version: 17
27+
cache: "gradle"
28+
29+
- name: Grant execute permission for gradlew
30+
run: chmod +x gradlew
31+
32+
- name: Run Tests
33+
run: ./gradlew -DOPENCAGE_API_KEY=${{ secrets.OPENCAGE_API_KEY }} test
34+
35+
- name: Run Build
36+
run: ./gradlew -DOPENCAGE_API_KEY=${{ secrets.OPENCAGE_API_KEY }} build

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
### Changed
10+
11+
- The methods `forward` and `reverse` can throw Exceptions [#32](https://github.com/OpenCageData/jopencage/issues/32)
12+
- updates gradle to 9.2
13+
- updates dependencies httpClient 5.6, jackson 2.19, junit 6
14+
15+
### Added
16+
17+
- Javadoc published on GH Pages, thanks to action [deploy-publish-javadoc](https://github.com/marketplace/a
918

1019
## [2.2.2] - 2024-08-14
1120

README.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# JOpenCage
22

3+
:warning: This is an unstable branch that only contains SNAPSHOT versions; it is still under development.
4+
35
[![Maven Central](https://img.shields.io/maven-central/v/com.opencagedata/jopencage.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/com.opencagedata/jopencage)
46
[![UnitTests](https://github.com/OpenCageData/jopencage/actions/workflows/unit-tests.yml/badge.svg?branch=master)](https://github.com/OpenCageData/jopencage/actions)
5-
[![Javadoc](https://img.shields.io/badge/JavaDoc-Online-green)](https://OpenCageData.github.io/jopencage/javadoc/)
7+
[![Javadoc](https://img.shields.io/badge/JavaDoc-Online-green)](https://opencagedata.github.io/jopencage/javadoc/)
68

79
[![security status](https://www.meterian.io/badge/gh/OpenCageData/jopencage/security?branch=master)](https://www.meterian.io/report/gh/OpenCageData/jopencage)
810
[![stability status](https://www.meterian.io/badge/gh/OpenCageData/jopencage/stability?branch=master)](https://www.meterian.io/report/gh/OpenCageData/jopencage)
@@ -35,9 +37,9 @@ Signup for a [free-trial API Key](https://opencagedata.com/users/sign_up).
3537
implementation "com.opencagedata:jopencage:REPLACE.WITH.VERSION"
3638
```
3739

38-
### Example
40+
### Examples
3941

40-
Forward
42+
#### Forward
4143

4244
```java
4345
// In real live application the JOpenCageGeocoder should be a Singleton
@@ -47,10 +49,10 @@ JOpenCageForwardRequest request = new JOpenCageForwardRequest("Graz");
4749
request.setMinConfidence(1);
4850
request.setNoAnnotations(false);
4951
request.setNoDedupe(true);
50-
JOpenCageResponse response = jOpenCageGeocoder.forward(request);
52+
JOpenCageResponse response = jOpenCageGeocoder.forward(request); // try..catch or throw JOpenCageException
5153
```
5254

53-
Reverse
55+
#### Reverse
5456

5557
```java
5658
// In real live application the JOpenCageGeocoder should be a Singleton
@@ -59,11 +61,23 @@ JOpenCageGeocoder jOpenCageGeocoder = new JOpenCageGeocoder(YOUR_API_KEY);
5961
JOpenCageReverseRequest request = new JOpenCageReverseRequest(-22.6792, 14.5272);
6062
request.setNoAnnotations(true);
6163

62-
JOpenCageResponse response = jOpenCageGeocoder.reverse(request);
64+
JOpenCageResponse response = jOpenCageGeocoder.reverse(request); // try..catch or throw JOpenCageException
6365
```
6466

67+
## Upgrading from 1.x or 2.x to 3.x
68+
69+
Starting with version 3.x, the methods `forward()` and `reverse()` can throw a `com.opencagedata.jopencage.JOpenCageException`.
70+
71+
## Javadoc
72+
73+
https://opencagedata.github.io/jopencage/javadoc/
74+
6575
## Libraries
6676

77+
- JDK 17+
78+
- Apache Http Client
79+
- FasterXml Jackson
80+
- Slf4j
6781
- JDK 8+
6882
- Apache Http Client
6983
- FasterXml Jackson
@@ -73,14 +87,14 @@ JOpenCageResponse response = jOpenCageGeocoder.reverse(request);
7387

7488
For running the tests you have to use your _OWN_ OpenCage Geocoding API Key. Get a free trial key at https://opencagedata.com
7589

76-
```
90+
```bash
7791
./gradlew -DOPENCAGE_API_KEY=<your apikey> test
7892
```
7993

8094
## Gradle
8195

8296
```bash
83-
./gradlew wrapper --gradle-version 9.0.0
97+
./gradlew wrapper --gradle-version 9.2.1
8498
```
8599

86100
## Contribute

build.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ repositories {
99
}
1010

1111
dependencies {
12-
1312
implementation "org.apache.httpcomponents.client5:httpclient5:${httpClientVersion}"
1413
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
1514
implementation "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
@@ -18,13 +17,16 @@ dependencies {
1817
// Tests
1918
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
2019

21-
testImplementation(platform("org.junit:junit-bom:${junitVersion}"))
22-
testImplementation("org.junit.jupiter:junit-jupiter:${junitVersion}")
20+
testImplementation platform("org.junit:junit-bom:${junitVersion}")
21+
testImplementation "org.junit.jupiter:junit-jupiter:${junitVersion}"
22+
23+
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j2-impl
24+
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j2-impl', version: "${slf4j2Version}"
2325
}
2426

2527
java {
26-
sourceCompatibility = JavaVersion.VERSION_1_8
27-
targetCompatibility = JavaVersion.VERSION_1_8
28+
sourceCompatibility = JavaVersion.VERSION_17
29+
targetCompatibility = JavaVersion.VERSION_17
2830

2931
withJavadocJar()
3032
withSourcesJar()

gradle.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
group=com.opencagedata
22
artifactId=jopencage
3-
version=2.2.2
3+
version=3.0.0-SNAPSHOT
44

55
httpClientVersion=5.6
66
jacksonVersion=2.19.2
77

8-
junitVersion=5.14.1
8+
junitVersion=6.0.1
9+
slf4j2Version=2.22.1
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.opencagedata.jopencage;
2+
3+
/**
4+
* BadRequestException
5+
*
6+
* @author Arnaud
7+
* @since 3.0
8+
*/
9+
10+
public class BadRequestException extends JOpenCageException {
11+
/**
12+
* Creates a new BadRequestException with a <code>null</code> detail message.
13+
*/
14+
public BadRequestException() {
15+
super();
16+
}
17+
18+
/**
19+
* Creates a new BadRequestException with the specified detail message.
20+
*
21+
* @param message The error message
22+
*/
23+
public BadRequestException(String message) {
24+
super(message);
25+
}
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.opencagedata.jopencage;
2+
3+
/**
4+
* ForbiddenException
5+
*
6+
* @author Arnaud
7+
* @since 3.0
8+
*/
9+
10+
public class ForbiddenException extends JOpenCageException {
11+
/**
12+
* Creates a new ForbiddenException with a <code>null</code> detail message.
13+
*/
14+
public ForbiddenException() {
15+
super();
16+
}
17+
18+
/**
19+
* Creates a new ForbiddenException with the specified detail message.
20+
*
21+
* @param message The error message
22+
*/
23+
public ForbiddenException(String message) {
24+
super(message);
25+
}
26+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.opencagedata.jopencage;
2+
3+
/**
4+
* HttpClientErrorException
5+
*
6+
* @author Arnaud
7+
* @since 3.0
8+
*/
9+
10+
public class HttpClientErrorException extends JOpenCageException {
11+
/**
12+
* Creates a new HttpClientErrorException with a <code>null</code> detail
13+
* message.
14+
*/
15+
public HttpClientErrorException() {
16+
super();
17+
}
18+
19+
/**
20+
* Creates a new HttpClientErrorException with the specified detail message.
21+
*
22+
* @param message The error message
23+
*/
24+
public HttpClientErrorException(String message) {
25+
super(message);
26+
}
27+
28+
/**
29+
* Creates a new HttpClientErrorException with the specified detail message and
30+
* its Throwable cause.
31+
*
32+
* @param message The error message
33+
* @param cause The cause
34+
*/
35+
public HttpClientErrorException(String message, Throwable cause) {
36+
super(message, cause);
37+
}
38+
}

0 commit comments

Comments
 (0)