Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[problem-json] Update common files for branch master #112

Merged
merged 7 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
- name: Publish Test Report
if: always()
uses: mikepenz/action-junit-report@v2
uses: mikepenz/action-junit-report@v2.9.1
with:
check_name: GraalVM CE CI / Test Report (Java ${{ matrix.java }})
report_paths: '**/build/test-results/test/TEST-*.xml'
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
- name: Publish Test Report
if: always()
uses: mikepenz/action-junit-report@v2
uses: mikepenz/action-junit-report@v2.9.1
with:
check_name: Java CI / Test Report (${{ matrix.java }})
report_paths: '**/build/test-results/test/TEST-*.xml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- '[1-9]+.[0-9]+.x'
jobs:
release_notes:
if: github.repository != 'micronaut-projects/micronaut-project-template'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# WARNING: Do not edit this file directly. Instead, go to:
#
# https://github.com/micronaut-projects/micronaut-project-template/tree/master/.github/workflows
#
# and edit them there. Note that it will be sync'ed to all the Micronaut repos
name: Static Analysis
on:
push:
branches:
- master
- '[1-9]+.[0-9]+.x'
pull_request:
branches:
- master
- '[1-9]+.[0-9]+.x'
jobs:
build:
if: github.repository != 'micronaut-projects/micronaut-project-template'
runs-on: ubuntu-latest
steps:
# https://github.com/actions/virtual-environments/issues/709
- name: Free disk space
run: |
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo apt-get clean
df -h
- uses: actions/checkout@v2
- uses: actions/[email protected]
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
- name: Optional setup step
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
run: |
[ -f ./setup.sh ] && ./setup.sh || true
- name: Analyse with Gradle
run: |
./gradlew check sonarqube --no-daemon --parallel --continue
env:
TESTCONTAINERS_RYUK_DISABLED: true
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

[![Maven Central](https://img.shields.io/maven-central/v/io.micronaut.problem/micronaut-problem-json.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22io.micronaut.problem%22%20AND%20a:%22micronaut-problem%22)
[![Build Status](https://github.com/micronaut-projects/micronaut-problem-json/workflows/Java%20CI/badge.svg)](https://github.com/micronaut-projects/micronaut-problem/actions)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=micronaut-projects_micronaut-problem-json&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=micronaut-projects_micronaut-problem-json)
[![Revved up by Gradle Enterprise](https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.micronaut.io/scans)


Micronaut Problem JSON helps produce application/problem+json responses from a Micronaut application.

## Documentation
Expand Down
16 changes: 16 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Security Policy

We release patches for security vulnerabilities. Which versions are eligible
receiving such patches depend on the CVSS v3.0 Rating:

| CVSS v3.0 | Supported Versions |
| --------- | ----------------------------------------- |
| 9.0-10.0 | Releases within the previous three months |
| 4.0-8.9 | Most recent release |

## Reporting a Vulnerability

Please responsibly disclose (suspected) security vulnerabilities to
**[The Micronaut Foundation]([email protected])**. You will receive a response from
us within 48 hours. If the issue is confirmed, we will release a patch as soon
as possible depending on complexity but historically within a few days.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
id "io.micronaut.build.internal.docs"
id "io.micronaut.build.internal.dependency-updates"
id "io.micronaut.build.internal.quality-reporting"
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class ProblemErrorResponseProcessor implements ErrorResponseProcessor<Pro
*/
@Deprecated
public ProblemErrorResponseProcessor() {
this.stackTraceConfig = ProblemConfigurationProperties.DEFAULT_STACK_TRACKE;
this(() -> ProblemConfigurationProperties.DEFAULT_STACK_TRACKE);
}

/**
Expand All @@ -78,8 +78,10 @@ public MutableHttpResponse<Problem> processResponse(@NonNull ErrorContext errorC
if (errorContext.getRequest().getMethod() == HttpMethod.HEAD) {
return (MutableHttpResponse<Problem>) baseResponse;
}
ThrowableProblem throwableProblem = (errorContext.getRootCause().isPresent() && errorContext.getRootCause().get() instanceof ThrowableProblem) ?
((ThrowableProblem) errorContext.getRootCause().get()) : defaultProblem(errorContext, baseResponse.getStatus());
ThrowableProblem throwableProblem = errorContext.getRootCause()
.filter(t -> t instanceof ThrowableProblem)
.map(t -> (ThrowableProblem) t)
.orElseGet(() -> defaultProblem(errorContext, baseResponse.getStatus()));
Problem body;
if (stackTraceConfig) {
body = throwableProblem;
Expand All @@ -103,13 +105,9 @@ protected ThrowableProblem defaultProblem(@NonNull ErrorContext errorContext,
org.zalando.problem.ProblemBuilder problemBuilder = Problem.builder().withStatus(new HttpStatusType(httpStatus));
if (!errorContext.getErrors().isEmpty()) {
Error error = errorContext.getErrors().get(0);
if (error.getTitle().isPresent()) {
problemBuilder.withTitle(error.getTitle().get());
}
error.getTitle().ifPresent(problemBuilder::withTitle);
problemBuilder.withDetail(error.getMessage());
if (error.getPath().isPresent()) {
problemBuilder.with("path", error.getPath().get());
}
error.getPath().ifPresent(path -> problemBuilder.with("path", path));
}
return problemBuilder.build();
}
Expand Down