Skip to content

Commit

Permalink
Merge branch 'master' into graphql-verbose-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
nmbryant authored Sep 5, 2024
2 parents 2cfdf8a + 59f9a4b commit e7f3e77
Show file tree
Hide file tree
Showing 7 changed files with 351 additions and 232 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.linkedin.util.Pair;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
Expand All @@ -22,23 +21,14 @@ public class ProtobufUtils {
private ProtobufUtils() {}

public static String collapseLocationComments(DescriptorProtos.SourceCodeInfo.Location location) {
String orig =
Stream.concat(
return Stream.concat(
location.getLeadingDetachedCommentsList().stream(),
Stream.of(location.getLeadingComments(), location.getTrailingComments()))
.filter(Objects::nonNull)
.flatMap(line -> Arrays.stream(line.split("\n")))
.map(line -> line.replaceFirst("^[*/ ]+", ""))
.collect(Collectors.joining("\n"))
.trim();

/*
* Sometimes DataHub doesn't like these strings. Not sure if its DataHub
* or protobuf issue: https://github.com/protocolbuffers/protobuf/issues/4691
*
* We essentially smash utf8 chars to ascii here
*/
return new String(orig.getBytes(StandardCharsets.ISO_8859_1));
}

/*
Expand Down
Loading

0 comments on commit e7f3e77

Please sign in to comment.