Skip to content

Commit

Permalink
[GR-34891] Fix SpotBugs warning.
Browse files Browse the repository at this point in the history
PullRequest: graal/10235
  • Loading branch information
dougxc committed Nov 4, 2021
2 parents 762ed11 + 24655e5 commit 227100f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ private static String generateSecureToken() {
return Base64.getEncoder().withoutPadding().encodeToString(tokenRaw).replace('/', '_').replace('+', '-');
}

@SuppressFBWarnings(value = "DMI_RANDOM_USED_ONLY_ONCE", justification = "avoiding a static field which would cache the random seed in a native image")
private static byte[] generateSecureRawToken() {
// 256 bits of entropy ought to be enough for everybody
final byte[] tokenRaw = new byte[32];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.truffle.tools.chromeinspector.instrument;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
* Used to suppress <a href="https://spotbugs.readthedocs.io">SpotBugs</a> warnings.
*/
@Retention(RetentionPolicy.CLASS)
@interface SuppressFBWarnings {
/**
* @see "https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html"
*/
String[] value();

/**
* Reason why the warning is suppressed. Use a SpotBugs issue id where appropriate.
*/

String justification();
}

0 comments on commit 227100f

Please sign in to comment.