Skip to content

Instantly share code, notes, and snippets.

View maciejwalkowiak's full-sized avatar

Maciej Walkowiak maciejwalkowiak

View GitHub Profile
package com.example.custombodyannotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
@maciejwalkowiak
maciejwalkowiak / FooTest.java
Created April 8, 2022 08:29
JDK-8141508 failing in 8.0.322
// https://bugs.openjdk.java.net/browse/JDK-8141508
package com.maciejwalkowiak;
import java.util.Optional;
import org.junit.jupiter.api.Test;
public class FooTest {
@Test
public class VatChecker {
static VatCheckResponse checkVat(String vat) {
return null;
}
}
class VatCheckResponse {
private VatCheckResponse() {}
boolean isValid() {
@maciejwalkowiak
maciejwalkowiak / SentryStackTraceFactory.java
Created September 30, 2021 11:07
Sentry suppressed exceptions workaround
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import io.sentry.protocol.SentryStackFrame;
/** class responsible for converting Java StackTraceElements to SentryStackFrames */

Installation

Create a Sentry module in <jboss-path>/modules/io/sentry/main/module.xml:

<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="io.sentry">
  <resources>
    <resource-root path="sentry-4.3.0.jar"/>
 
@maciejwalkowiak
maciejwalkowiak / diagram.sh
Created January 24, 2020 09:12
Generate Maven modules dependency graph
./mvnw com.github.ferstl:depgraph-maven-plugin:3.0.1:aggregate -DcustomStyleConfiguration=./styles.json -DcreateImage=true -Dscope=compile "-Dincludes=org.springframework.boot:*"
@maciejwalkowiak
maciejwalkowiak / indexes.sql
Created November 8, 2019 10:41
PostgreSQL: How to list all indexes?
SELECT
tablename,
indexname,
indexdef
FROM
pg_indexes
WHERE
schemaname = 'public'
ORDER BY
tablename,
@maciejwalkowiak
maciejwalkowiak / Analytics.kt
Created June 15, 2017 12:26
mockito-kotlin
interface Analytics<in T> {
fun send(event : T)
}
@maciejwalkowiak
maciejwalkowiak / SomeService.java
Created March 9, 2016 22:00
Class dependencies
class SomeService {
private final DependencyA dependencyA;
private final DependencyB dependencyB;
private final Optional<DependencyC> dependencyC;
@Autowired
public SomeService(DependencyA dependencyA,
DependencyB dependencyB,
Optional<DependencyC> dependencyC) {
Assert.notNull(dependencyA);
@maciejwalkowiak
maciejwalkowiak / SampleWsApplicationSmokeTests.java
Created June 9, 2014 15:22
Spring WS Starter Sample Tests
package sample.ws;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;