Skip to content

Commit

Permalink
merge: merge 4.2.6 in geor-4.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Nov 15, 2023
1 parent 5be6c4f commit 56f1e0c
Show file tree
Hide file tree
Showing 2,313 changed files with 119,212 additions and 80,145 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
Empty file added .github/workflows/linux.yml
Empty file.
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
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ git*.properties
*/*/.*
*/*/target/
*/target/
.*/
GeoNetwork*
**/.idea
**/.settings
#GeoNetwork*
/geonetwork*
camel-harvesters/wfsfeature-harvester/logs
changes-*
Expand Down Expand Up @@ -81,6 +82,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
2 changes: 1 addition & 1 deletion cachingxslt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<groupId>org.geonetwork-opensource</groupId>
<artifactId>geonetwork</artifactId>
<version>4.2.2-georchestra</version>
<version>4.2.6-georchestra</version>
</parent>


Expand Down
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<groupId>org.geonetwork-opensource</groupId>
<artifactId>geonetwork</artifactId>
<version>4.2.2-georchestra</version>
<version>4.2.6-georchestra</version>
</parent>


Expand Down
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
22 changes: 4 additions & 18 deletions common/src/main/java/org/fao/geonet/utils/IO.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//=============================================================================
//=== Copyright (C) 2001-2005 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 @@ -30,38 +30,24 @@
import org.fao.geonet.utils.debug.DebuggingInputStream;
import org.fao.geonet.utils.debug.DebuggingReader;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystem;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

//=============================================================================

/**
Expand Down
Loading

0 comments on commit 56f1e0c

Please sign in to comment.