From 86f00968b4ba59f756bb4fe01e4fb1cc61bd4f1d Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Fri, 20 Oct 2023 14:39:16 +0200 Subject: [PATCH] Add missing license headers (#3003) --- .../io/sentry/android/core/ANRWatchDog.java | 27 +++++++++++++++++-- .../internal/util/FirstDrawDoneListener.java | 22 ++++++++++++--- .../java/io/sentry/CircularFifoQueue.java | 19 +++++++++++++ .../io/sentry/SynchronizedCollection.java | 2 ++ .../java/io/sentry/SynchronizedQueue.java | 2 ++ .../sentry/transport/ReusableCountLatch.java | 25 ++++++++++++----- .../main/java/io/sentry/vendor/Base64.java | 18 +++++++++++++ .../gson/internal/bind/util/ISO8601Utils.java | 20 ++++++++++++-- .../transport/ReusableCountLatchTest.kt | 21 ++++++++++++--- .../internal/bind/util/ISO8601UtilsTest.java | 23 ++++++++++++---- 10 files changed, 157 insertions(+), 22 deletions(-) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ANRWatchDog.java b/sentry-android-core/src/main/java/io/sentry/android/core/ANRWatchDog.java index 88075a4551..24ecba953a 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ANRWatchDog.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ANRWatchDog.java @@ -1,5 +1,28 @@ -// https://github.com/SalomonBrys/ANR-WatchDog/blob/1969075f75f5980e9000eaffbaa13b0daf282dcb/anr-watchdog/src/main/java/com/github/anrwatchdog/ANRWatchDog.java -// Based on the class above. The API unnecessary here was removed. +/* + * Adapted from https://github.com/SalomonBrys/ANR-WatchDog/blob/1969075f75f5980e9000eaffbaa13b0daf282dcb/anr-watchdog/src/main/java/com/github/anrwatchdog/ANRWatchDog.java + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Salomon BRYS + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + package io.sentry.android.core; import static android.app.ActivityManager.ProcessErrorStateInfo.NOT_RESPONDING; diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java index 10c160377b..0b1d1f303d 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/internal/util/FirstDrawDoneListener.java @@ -1,3 +1,21 @@ +/* + * https://github.com/firebase/firebase-android-sdk/blob/master/firebase-perf/src/main/java/com/google/firebase/perf/util/FirstDrawDoneListener.java + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.sentry.android.core.internal.util; import android.annotation.SuppressLint; @@ -14,10 +32,6 @@ /** * OnDrawListener that unregisters itself and invokes callback when the next draw is done. This API * 16+ implementation is an approximation of the initial-display-time defined by Android Vitals. - * - *

Adapted from Firebase - * under the Apache License, Version 2.0. */ @SuppressLint("ObsoleteSdkInt") @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) diff --git a/sentry/src/main/java/io/sentry/CircularFifoQueue.java b/sentry/src/main/java/io/sentry/CircularFifoQueue.java index 87c126b508..8fa72e39d5 100644 --- a/sentry/src/main/java/io/sentry/CircularFifoQueue.java +++ b/sentry/src/main/java/io/sentry/CircularFifoQueue.java @@ -1,3 +1,22 @@ +/* + * Adapted from https://github.com/apache/commons-collections/blob/fce46cdcc6fa33ba9472921d4b3ec3f548d8cbcc/src/main/java/org/apache/commons/collections4/queue/CircularFifoQueue.java + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.sentry; import java.io.IOException; diff --git a/sentry/src/main/java/io/sentry/SynchronizedCollection.java b/sentry/src/main/java/io/sentry/SynchronizedCollection.java index 3d430952ee..8693b45eca 100644 --- a/sentry/src/main/java/io/sentry/SynchronizedCollection.java +++ b/sentry/src/main/java/io/sentry/SynchronizedCollection.java @@ -1,4 +1,6 @@ /* + * Adapted from https://github.com/apache/commons-collections/blob/fce46cdcc6fa33ba9472921d4b3ec3f548d8cbcc/src/main/java/org/apache/commons/collections4/collection/SynchronizedCollection.java + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/sentry/src/main/java/io/sentry/SynchronizedQueue.java b/sentry/src/main/java/io/sentry/SynchronizedQueue.java index 5e07606cfb..68b75c1953 100644 --- a/sentry/src/main/java/io/sentry/SynchronizedQueue.java +++ b/sentry/src/main/java/io/sentry/SynchronizedQueue.java @@ -1,4 +1,6 @@ /* + * Adapted from https://github.com/apache/commons-collections/blob/fce46cdcc6fa33ba9472921d4b3ec3f548d8cbcc/src/main/java/org/apache/commons/collections4/queue/SynchronizedQueue.java + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. diff --git a/sentry/src/main/java/io/sentry/transport/ReusableCountLatch.java b/sentry/src/main/java/io/sentry/transport/ReusableCountLatch.java index 1193d3c88f..79543a3702 100644 --- a/sentry/src/main/java/io/sentry/transport/ReusableCountLatch.java +++ b/sentry/src/main/java/io/sentry/transport/ReusableCountLatch.java @@ -1,5 +1,21 @@ -// Apache-2: -// https://github.com/MatejTymes/JavaFixes/blob/37e74b9d0a29f7a47485c6d1bb1307f01fb93634/LICENSE +/* + * Adapted from https://github.com/MatejTymes/JavaFixes/blob/37e74b9d0a29f7a47485c6d1bb1307f01fb93634/src/main/java/javafixes/concurrency/ReusableCountLatch.java + * + * Copyright (C) 2016 Matej Tymes + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.sentry.transport; import java.util.concurrent.TimeUnit; @@ -7,10 +23,7 @@ import org.jetbrains.annotations.NotNull; /** - * Class originally copied from ReusableCountLatch.java. - * - *

A synchronization aid that allows one or more threads to wait until a set of operations being + * A synchronization aid that allows one or more threads to wait until a set of operations being * performed in other threads completes. * *

A {@code ReusableCountLatch} is initialized with a given count. The {@link diff --git a/sentry/src/main/java/io/sentry/vendor/Base64.java b/sentry/src/main/java/io/sentry/vendor/Base64.java index aff0e0ae1a..0e5664379a 100644 --- a/sentry/src/main/java/io/sentry/vendor/Base64.java +++ b/sentry/src/main/java/io/sentry/vendor/Base64.java @@ -1,3 +1,21 @@ +/* + * Adapted from https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/util/Base64.java + * + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.sentry.vendor; import java.io.UnsupportedEncodingException; diff --git a/sentry/src/main/java/io/sentry/vendor/gson/internal/bind/util/ISO8601Utils.java b/sentry/src/main/java/io/sentry/vendor/gson/internal/bind/util/ISO8601Utils.java index b00aff52c6..50fe378a89 100644 --- a/sentry/src/main/java/io/sentry/vendor/gson/internal/bind/util/ISO8601Utils.java +++ b/sentry/src/main/java/io/sentry/vendor/gson/internal/bind/util/ISO8601Utils.java @@ -1,3 +1,21 @@ +/* + * Adapted from https://github.com/FasterXML/jackson-databind/blob/c1e92435c6942386394a2a7733065bb047773107/src/main/java/com/fasterxml/jackson/databind/util/ISO8601Utils.java + * + * Copyright (C) 2007-, Tatu Saloranta + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.sentry.vendor.gson.internal.bind.util; import org.jetbrains.annotations.ApiStatus; @@ -19,8 +37,6 @@ * * @see this specification */ -//Date parsing code from Jackson databind ISO8601Utils.java -// https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/util/ISO8601Utils.java @SuppressWarnings({"TryWithIdenticalCatches", "UnusedAssignment", "MagicConstant"}) // Ignore warnings to preserve original code. @ApiStatus.Internal public class ISO8601Utils diff --git a/sentry/src/test/java/io/sentry/transport/ReusableCountLatchTest.kt b/sentry/src/test/java/io/sentry/transport/ReusableCountLatchTest.kt index 8aa99ed2ff..86fce99e85 100644 --- a/sentry/src/test/java/io/sentry/transport/ReusableCountLatchTest.kt +++ b/sentry/src/test/java/io/sentry/transport/ReusableCountLatchTest.kt @@ -1,3 +1,21 @@ +/* + * Adapted from https://github.com/MatejTymes/JavaFixes/blob/37e74b9d0a29f7a47485c6d1bb1307f01fb93634/src/test/java/javafixes/concurrency/ReusableCountLatchTest.java + * + * Copyright (C) 2016 Matej Tymes + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.sentry.transport import java.util.concurrent.Executors.newScheduledThreadPool @@ -10,9 +28,6 @@ import kotlin.test.assertFailsWith import kotlin.test.assertFalse import kotlin.test.assertTrue -/** - * Tests originally copied from ReusableCountLatchTest. - */ class ReusableCountLatchTest { @Test fun `should reflect initial value`() { diff --git a/sentry/src/test/java/io/sentry/vendor/gson/internal/bind/util/ISO8601UtilsTest.java b/sentry/src/test/java/io/sentry/vendor/gson/internal/bind/util/ISO8601UtilsTest.java index d5795aaced..70a209f1fe 100644 --- a/sentry/src/test/java/io/sentry/vendor/gson/internal/bind/util/ISO8601UtilsTest.java +++ b/sentry/src/test/java/io/sentry/vendor/gson/internal/bind/util/ISO8601UtilsTest.java @@ -1,9 +1,22 @@ -package io.sentry.vendor.gson.internal.bind.util; +/* + * Adapted from https://github.com/FasterXML/jackson-databind/blob/c1e92435c6942386394a2a7733065bb047773107/src/test/java/com/fasterxml/jackson/databind/util/ISO8601UtilsTest.java + * + * Copyright (C) 2007-, Tatu Saloranta + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -// Source: https://github.com/google/gson -// Tag: gson-parent-2.8.9 -// Commit Hash: 6a368d89da37917be7714c3072b8378f4120110a -// Changes: -- +package io.sentry.vendor.gson.internal.bind.util; import org.junit.Test;