Skip to content

Commit

Permalink
Merge tag '4.2.6' into georchestra-gn4.2.x-rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Nov 14, 2023
2 parents 5be6c4f + d7b4ae6 commit f66d486
Show file tree
Hide file tree
Showing 2,325 changed files with 126,401 additions and 74,152 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
12 changes: 7 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: [ main ]
branches: [ 4.2.x ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [ 4.2.x ]
schedule:
- cron: '44 20 * * 5'

Expand All @@ -38,10 +38,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3

uses: actions/checkout@v4
with:
show-progress: 'false'

- name: Setup Java JDK
uses: actions/setup-java@v3.5.1
uses: actions/setup-java@v3.12.0
with:
java-version: 8
# Java distribution. See the list of supported distributions in README file
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Linux GitHub CI

on: [pull_request,push,workflow_dispatch]

env:
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 -Xmx512m -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS
TAKARI_SMART_BUILDER_VERSION: 0.6.1

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
jdk: 8
steps:
- uses: actions/checkout@v4
with:
# 500 commits, set to 0 to get all
fetch-depth: 500
submodules: 'recursive'
show-progress: 'false'
- name: Set up JDK
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: ${{ matrix.jdk }}
cache: 'maven'
- name: Build with Maven
run: mvn -B -V install -DskipTests=true -Dmaven.javadoc.skip=true
- name: Remove SNAPSHOT jars from repository
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
- name: Remove Schema 3.8 jars from repository
run: |
find ~/.m2/repository -name "*3.8*" -type d | xargs rm -rf {}
QA:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
# 500 commits, set to 0 to get all
fetch-depth: 500
submodules: 'recursive'
show-progress: 'false'
- name: Set up JDK
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: 8
cache: 'maven'
- name: Set up Maven
uses: stCarolas/setup-maven@v4
with:
maven-version: 3.6.3
- name: Test with maven
run: |
mvn resources:resources@copy-index-schema-to-source -f web
mvn -B -V -fae verify -Pit
- name: Remove SNAPSHOT jars from repository
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
- name: Remove Schema 3.8 jars from repository
run: |
find ~/.m2/repository -name "*3.8*" -type d | xargs rm -rf {}
33 changes: 33 additions & 0 deletions .github/workflows/mvn-dep-tree.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This job sends the maven dependency tree of the project to Github
# for further security analysis.

name: "MavenDepTreeSubmission"

on:
push:
branches: [ 4.2.x ]
schedule:
- cron: '44 22 * * 5'

jobs:
update-maven-dep-tree:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
show-progress: 'false'

- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 8
# Java distribution. See the list of supported distributions in README file
distribution: temurin
# The package type (jdk, jre, jdk+fx, jre+fx)
java-package: jdk
cache: maven

- name: Submit Dependency Snapshot
uses: advanced-security/maven-dependency-submission-action@v3
49 changes: 49 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: SonarCloud QA
on:
push:
branches:
- 4.2.x
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
# Only analyze with Sonar on non-fork repos:
# https://github.community/t/how-to-detect-a-pull-request-from-a-fork/18363/4
if: github.event.pull_request.head.repo.fork != true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: 'recursive'
show-progress: 'false'
# For building GeoNetwork, JDK8 is necessary, but for running
# the SonarQube plugin, JDK11 is necessary.
# So, first install JDK 8, build GeoNetwork, then install JDK11
# and run SonarQube:
- name: Set up JDK 8
uses: actions/[email protected]
with:
java-version: 8
distribution: 'temurin'
cache: 'maven'
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build GN
run: mvn -B package -DskipTests
- name: Set up JDK 11
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: '11'
- name: Analyze with Sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
#TODO: Enable tests, if reliable:
run: mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=geonetwork_core-geonetwork -Dsonar.organization=geonetwork -DskipTests=true -Dmaven.javadoc.skip=true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ git*.properties
*/*/target/
*/target/
.*/
GeoNetwork*
#GeoNetwork*
/geonetwork*
camel-harvesters/wfsfeature-harvester/logs
changes-*
Expand Down Expand Up @@ -81,6 +81,7 @@ web/src/main/webapp/WEB-INF/data/wro4j-cache*
web/src/main/webapp/WEB-INF/data_*
web/src/main/webapp/WEB-INF/metadata_subversion/
web/src/main/webapp/WEB-INF/server.prop
web/src/main/webapp/WEB-INF/prebuilt
web/src/main/webapp/data/
web/src/main/webapp/doc/en
web/src/main/webapp/doc/fr
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@
[submodule "web-ui/src/main/resources/catalog/lib/bootstrap-table"]
path = web-ui/src/main/resources/catalog/lib/bootstrap-table
url = https://github.com/wenzhixin/bootstrap-table.git
[submodule "docs/manuals"]
path = docs/manuals
url = https://github.com/geonetwork/doc.git
24 changes: 12 additions & 12 deletions common/src/main/java/org/fao/geonet/utils/AbstractHttpRequest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2001-2016 Food and Agriculture Organization of the
* Copyright (C) 2001-2023 Food and Agriculture Organization of the
* United Nations (FAO-UN), United Nations World Food Programme (WFP)
* and United Nations Environment Programme (UNEP)
*
Expand Down Expand Up @@ -83,7 +83,7 @@ public class AbstractHttpRequest {
private boolean useProxy;
private String proxyHost;
private int proxyPort;
private ArrayList<NameValuePair> alSimpleParams = new ArrayList<NameValuePair>();
private ArrayList<NameValuePair> alSimpleParams = new ArrayList<>();
private String postData;
private boolean preemptiveBasicAuth;
private HttpClientContext httpClientContext;
Expand Down Expand Up @@ -303,9 +303,9 @@ protected HttpRequestBase setupHttpMethod() throws IOException {
}

if (host == null || protocol == null) {
throw new IllegalStateException(String.format(getClass().getSimpleName() + " is not ready to be executed: \n\tprotocol: '%s' " +
throw new IllegalStateException(String.format("%s is not ready to be executed: \n\tprotocol: '%s' " +
"\n\tuserinfo: '%s'\n\thost: '%s' \n\tport: '%s' \n\taddress: '%s'\n\tquery '%s'" +
"\n\tfragment: '%s'", protocol, userInfo, host, port, address, query, fragment));
"\n\tfragment: '%s'", getClass().getSimpleName(), protocol, userInfo, host, port, address, query, fragment));
}

HttpRequestBase httpMethod;
Expand Down Expand Up @@ -352,25 +352,25 @@ protected HttpRequestBase setupHttpMethod() throws IOException {

protected String getSentData(HttpRequestBase httpMethod) {
URI uri = httpMethod.getURI();
StringBuilder sentData = new StringBuilder(httpMethod.getMethod()).append(" ").append(uri.getPath());
StringBuilder sentDataValue = new StringBuilder(httpMethod.getMethod()).append(" ").append(uri.getPath());

if (uri.getQuery() != null) {
sentData.append("?" + uri.getQuery());
sentDataValue.append("?" + uri.getQuery());
}

sentData.append("\r\n");
sentDataValue.append("\r\n");

for (Header h : httpMethod.getAllHeaders()) {
sentData.append(h);
sentDataValue.append(h);
}

sentData.append("\r\n");
sentDataValue.append("\r\n");

if (httpMethod instanceof HttpPost) {
sentData.append(postData);
sentDataValue.append(postData);
}

return sentData.toString();
return sentDataValue.toString();
}

private Element soapEmbed(Element elem) {
Expand All @@ -393,7 +393,7 @@ protected Element soapUnembed(Element envelope) throws BadSoapResponseEx {

List<Element> list = body.getChildren();

if (list.size() == 0)
if (list.isEmpty())
throw new BadSoapResponseEx(envelope);

return list.get(0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2001-2016 Food and Agriculture Organization of the
* Copyright (C) 2001-2023 Food and Agriculture Organization of the
* United Nations (FAO-UN), United Nations World Food Programme (WFP)
* and United Nations Environment Programme (UNEP)
*
Expand Down Expand Up @@ -200,6 +200,7 @@ public HttpClientBuilder getDefaultHttpClientBuilder() {
final HttpClientBuilder builder = HttpClientBuilder.create();
builder.setRedirectStrategy(new LaxRedirectStrategy());
builder.disableContentCompression();
builder.useSystemProperties();

synchronized (this) {
if (connectionManager == null) {
Expand Down Expand Up @@ -249,40 +250,40 @@ public void closeIdleConnections(long idleTimeout, TimeUnit tunit) {

private static class AdaptingResponse extends AbstractClientHttpResponse {

private final CloseableHttpResponse _response;
private final CloseableHttpClient _client;
private final CloseableHttpResponse response;
private final CloseableHttpClient client;

public AdaptingResponse(CloseableHttpClient client, CloseableHttpResponse response) {
this._response = response;
this._client = client;
this.response = response;
this.client = client;
}

@Override
public int getRawStatusCode() throws IOException {
return _response.getStatusLine().getStatusCode();
return response.getStatusLine().getStatusCode();
}

@Override
public String getStatusText() throws IOException {
return _response.getStatusLine().getReasonPhrase();
return response.getStatusLine().getReasonPhrase();
}

@Override
public void close() {
IOUtils.closeQuietly(_response);
IOUtils.closeQuietly(_client);
IOUtils.closeQuietly(response);
IOUtils.closeQuietly(client);
}

@Override
public InputStream getBody() throws IOException {
return _response.getEntity().getContent();
return response.getEntity().getContent();
}

@Override
public HttpHeaders getHeaders() {
final HttpHeaders httpHeaders = new HttpHeaders();

final Header[] headers = _response.getAllHeaders();
final Header[] headers = response.getAllHeaders();

for (Header header : headers) {
final HeaderElement[] elements = header.getElements();
Expand Down
Loading

0 comments on commit f66d486

Please sign in to comment.