Skip to content

Commit

Permalink
Fixed check conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
merlimat committed Apr 2, 2024
1 parent a38ee56 commit c416e7b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
package org.apache.bookkeeper.common.util.affinity.impl;

import com.google.common.base.Preconditions;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.File;
import java.io.FileNotFoundException;
Expand All @@ -28,6 +29,7 @@
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Objects;
import lombok.experimental.UtilityClass;

/**
Expand All @@ -47,10 +49,13 @@ public class NativeUtils {
value = "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE",
justification = "work around for java 9: https://github.com/spotbugs/spotbugs/issues/493")
public static void loadLibraryFromJar(String path) throws Exception {
com.google.common.base.Preconditions.checkArgument(path.startsWith("/"), "absolute path must start with /");
Preconditions.checkArgument(path.startsWith("/"), "absolute path must start with /");

String[] parts = path.split("/");
String filename = (parts.length > 0) ? parts[parts.length - 1] : null;
Preconditions.checkArgument(parts.length > 0, "absolute path must contain file name");

String filename = parts[parts.length - 1];
Preconditions.checkArgument(path.startsWith("/"), "absolute path must start with /");

Path dir = Files.createTempDirectory("native");
dir.toFile().deleteOnExit();
Expand Down

0 comments on commit c416e7b

Please sign in to comment.