com.google.re2j.Pattern Java Examples

The following examples show how to use com.google.re2j.Pattern. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GempakParameterTable.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Get the input stream to the given resource
 *
 * @param resourceName The resource name. May be a file, url,
 *        java resource, etc.
 * @return The input stream to the resource
 */
private InputStream getInputStream(String resourceName) throws IOException {

  // Try class loader to get resource
  ClassLoader cl = GempakParameterTable.class.getClassLoader();
  InputStream s = cl.getResourceAsStream(resourceName);
  if (s != null) {
    return s;
  }

  // Try the file system
  File f = new File(resourceName);
  if (f.exists()) {
    s = new FileInputStream(f);
  }
  if (s != null) {
    return s;
  }

  // Try it as a url
  Matcher m = Pattern.compile(" ").matcher(resourceName);
  String encodedUrl = m.replaceAll("%20");
  URL dataUrl = new URL(encodedUrl);
  URLConnection connection = dataUrl.openConnection();
  return connection.getInputStream();
}
 
Example #2
Source File: Replace.java    From copybara with Apache License 2.0 6 votes vote down vote up
private Replace(RegexTemplateTokens before, RegexTemplateTokens after,
    Map<String, Pattern> regexGroups, boolean firstOnly, boolean multiline,
    boolean repeatedGroups,
    Glob paths,
    List<Pattern> patternsToIgnore,
    WorkflowOptions workflowOptions, Location location) {
  this.before = checkNotNull(before);
  this.after = checkNotNull(after);
  this.regexGroups = ImmutableMap.copyOf(regexGroups);
  this.firstOnly = firstOnly;
  this.multiline = multiline;
  this.repeatedGroups = repeatedGroups;
  this.paths = checkNotNull(paths);
  this.patternsToIgnore = ImmutableList.copyOf(patternsToIgnore);
  this.workflowOptions = checkNotNull(workflowOptions);
  this.location = checkNotNull(location);
}
 
Example #3
Source File: ReferenceMigrator.java    From copybara with Apache License 2.0 6 votes vote down vote up
public static ReferenceMigrator create(
    String before, String after, Pattern forward, @Nullable Pattern backward,
    ImmutableList<String> additionalLabels, Location location) throws EvalException {
  Map<String, Pattern> patterns = ImmutableMap.of("reference", forward);
  RegexTemplateTokens beforeTokens =
      new RegexTemplateTokens(location, before, patterns, /* repeatedGroups= */ false);
  beforeTokens.validateUnused();
  RegexTemplateTokens afterTokens =
      new RegexTemplateTokens(location, after, patterns, /* repeatedGroups= */ false);
  afterTokens.validateUnused();
  check(
      after.lastIndexOf("$1") == -1,
      "Destination format '%s' uses the reserved token '$1'.",
      after);
  return new ReferenceMigrator(beforeTokens, afterTokens, backward, additionalLabels,
      location);
}
 
Example #4
Source File: ClassGraphPreprocessorTest.java    From BUILD_file_generator with Apache License 2.0 6 votes vote down vote up
/**
 * Tests whether black listed classes names as well as their non-whitelisted dependencies are
 * removed from the class graph. In addition to not containing the black listed class, the
 * resulting graph should also not contain nonwhite listed classes only black listed classes are
 * dependent on. For example, say we were to have the following class graph
 *
 * <p>com.Whitelist --> com.Blacklist --> com.NonWhitelist
 *
 * <p>Then the resulting class graph should only contain com.Whitelist
 */
@Test
public void trimRemovesTransitiveDepsOfBlackListedClasses() {
  MutableGraph<String> graph = newGraph();
  graph.putEdge("com.BlackList", "com.OtherList");
  graph.putEdge("com.WhiteList", "com.BlackList");

  Pattern blackList = Pattern.compile("BlackList");
  Pattern whiteList = Pattern.compile("WhiteList");

  Graph<String> actual = preProcessClassGraph(ImmutableGraph.copyOf(graph), whiteList, blackList);

  MutableGraph<String> expected = newGraph();
  expected.addNode("com.WhiteList");

  assertEquivalent(actual, expected);
  assertThat(actual.nodes()).doesNotContain("com.BlackList");
  assertThat(actual.nodes()).doesNotContain("com.OtherList");
}
 
Example #5
Source File: DateFromString.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * The same as getDateUsingRegExp() except the date format string to be used
 * must be specified.
 *
 * @param dateString the String to be parsed
 * @param matchPattern the regular expression String on which to match.
 * @param substitutionPattern the String to use in the capture group replacement.
 * @param dateFormatString the date format string to use in the parsing of the date string.
 * @return the calculated Date
 */
public static Date getDateUsingRegExpAndDateFormat(String dateString, String matchPattern, String substitutionPattern,
    String dateFormatString) {
  // Match the given date string against the regular expression.
  Pattern pattern = Pattern.compile(matchPattern);
  Matcher matcher = pattern.matcher(dateString);
  if (!matcher.matches()) {
    return null;
  }

  // Build date string to use with date format string by
  // substituting the capture groups into the substitution pattern.
  StringBuffer dateStringFormatted = new StringBuffer();
  matcher.appendReplacement(dateStringFormatted, substitutionPattern);
  if (dateStringFormatted.length() == 0) {
    return null;
  }

  return getDateUsingCompleteDateFormat(dateStringFormatted.toString(), dateFormatString);
}
 
Example #6
Source File: ProjectClassToRuleResolverTest.java    From BUILD_file_generator with Apache License 2.0 6 votes vote down vote up
/**
 * Tests behavior of resolver when there are no classes that match white list pattern. The
 * resulting map should contain no entries.
 */
@Test
public void noMatchingClassNames() throws IOException {
  MutableGraph<String> classgraph = newGraph(String.class);
  classgraph.putEdge("com.A", "com.B");
  classgraph.putEdge("com.B", "com.C");

  ProjectClassToRuleResolver resolver =
      newResolver(
          classgraph,
          Pattern.compile("com.hello.*"),
          ImmutableMap.of(
              "com.A",
              workspace.resolve("java/com/A.java"),
              "com.B",
              workspace.resolve("java/com/B.java"),
              "com.C",
              workspace.resolve("java/com/C.java")));

  ImmutableMap<String, BuildRule> actual = resolver.resolve(classgraph.nodes());
  assertThat(actual).isEmpty();
}
 
Example #7
Source File: ClassGraphPreprocessor.java    From BUILD_file_generator with Apache License 2.0 6 votes vote down vote up
/** Removes all outgoing edges from classes that are not white listed. */
private static ImmutableGraph<String> trimClassGraph(
    ImmutableGraph<String> classGraph, Pattern whiteList, Pattern blackList) {
  MutableGraph<String> graph = GraphBuilder.directed().allowsSelfLoops(false).build();
  for (String src : classGraph.nodes()) {
    if (!whiteList.matcher(src).find() || blackList.matcher(src).find()) {
      continue;
    }
    graph.addNode(src);
    for (String dst : classGraph.successors(src)) {
      if (blackList.matcher(dst).find()) {
        continue;
      }
      graph.putEdge(src, dst);
    }
  }
  return ImmutableGraph.copyOf(graph);
}
 
Example #8
Source File: ProxyHttpTransparent.java    From PacketProxy with Apache License 2.0 6 votes vote down vote up
private HostPort parseHostName(byte[] buffer) throws Exception {
	int start = 0;
	if ((start = StringUtils.binaryFind(buffer, "Host:".getBytes())) > 0) {
		start += 5;
	} else if ((start = StringUtils.binaryFind(buffer, "host:".getBytes())) > 0) {
		start += 5;
	} else {
		throw new Exception("Host: header field is not found in beginning of 4096 bytes of packets.");
	}
	int end = StringUtils.binaryFind(buffer, "\n".getBytes(), start);
	String serverCand = new String(ArrayUtils.subarray(buffer, start, end));
	String server = "";
	int port = 80;
	Pattern pattern = Pattern.compile("^ *([^:\n\r]+)(?::([0-9]+))?");
	Matcher matcher = pattern.matcher(serverCand);
	if (matcher.find()) {
		if (matcher.group(1) != null)
			server = matcher.group(1);
		if (matcher.group(2) != null)
			port = Integer.parseInt(matcher.group(2));
	} else {
		throw new Exception("Host: header field format is not recognized.");
	}
	return new HostPort(server, port);
}
 
Example #9
Source File: RegexTemplateTokens.java    From copybara with Apache License 2.0 6 votes vote down vote up
private Replacer(Pattern before, RegexTemplateTokens after,
    @Nullable AlterAfterTemplate callback,
    boolean firstOnly, boolean multiline, @Nullable List<Pattern> patternsToIgnore) {
  this.before = before;
  this.after = after;
  afterReplaceTemplate = this.after.after(RegexTemplateTokens.this);
  // Precomputed the repeated groups as this should be used only on rare occasions and we
  // don't want to iterate over the map for every line.
  for (Entry<String, Collection<Integer>> e : groupIndexes.asMap().entrySet()) {
    if (e.getValue().size() > 1) {
      repeatedGroups.putAll(e.getKey(), e.getValue());
    }
  }
  this.firstOnly = firstOnly;
  this.multiline = multiline;
  this.callback = callback;
  this.patternsToIgnore = patternsToIgnore;
}
 
Example #10
Source File: RegexTemplateTokens.java    From copybara with Apache License 2.0 6 votes vote down vote up
/**
 * Converts this sequence of tokens into a regex which can be used to search a string. It
 * automatically quotes literals and represents interpolations as named groups.
 *
 * <p>It also fills groupIndexes with all the interpolation locations.
 *
 * @param regexesByInterpolationName map from group name to the regex to interpolate when the
 * group is mentioned
 * @param repeatedGroups true if a regex group is allowed to be used multiple times
 */
private Pattern buildBefore(Map<String, Pattern> regexesByInterpolationName,
    boolean repeatedGroups) throws EvalException {
  int groupCount = 1;
  StringBuilder fullPattern = new StringBuilder();
  for (Token token : tokens) {
    switch (token.getType()) {
      case INTERPOLATION:
        Pattern subPattern = regexesByInterpolationName.get(token.getValue());
        check(subPattern != null, "Interpolation is used but not defined: %s", token.getValue());
        fullPattern.append(String.format("(%s)", subPattern.pattern()));
        check(
            groupIndexes.get(token.getValue()).isEmpty() || repeatedGroups,
            "Regex group is used in template multiple times: %s",
            token.getValue());
        groupIndexes.put(token.getValue(), groupCount);
        groupCount += subPattern.groupCount() + 1;
        break;
      case LITERAL:
        fullPattern.append(Pattern.quote(token.getValue()));
        break;
    }
  }
  return Pattern.compile(fullPattern.toString(), Pattern.MULTILINE);
}
 
Example #11
Source File: FilterReplace.java    From copybara with Apache License 2.0 6 votes vote down vote up
private String replaceString(String originalContent) {
  Pattern pattern = Pattern.compile(before.pattern());
  Matcher matcher = pattern.matcher(originalContent);

  boolean anyReplace = false;
  StringBuilder result = new StringBuilder(originalContent.length());
  while (matcher.find()) {
    String val = matcher.group(FilterReplace.this.group);
    String res = mapping.apply(val);
    anyReplace |= !val.equals(res);
    if (group == 0) {
      matcher.appendReplacement(result, Matcher.quoteReplacement(res));
    } else {
      String prefix = originalContent.substring(matcher.start(), matcher.start(group));
      String suffix = originalContent.substring(matcher.end(group), matcher.end());
      matcher.appendReplacement(result, Matcher.quoteReplacement((prefix + res + suffix)));
    }
  }

  if (!anyReplace) {
    return originalContent;
  }

  matcher.appendTail(result);
  return result.toString();
}
 
Example #12
Source File: Ghcnm2.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private StructureDataRegexp.Vinfo setVinfo(RandomAccessFile raff, NetcdfFile ncfile, Pattern p, String seqName) {
  Sequence seq = (Sequence) ncfile.findVariable(seqName);
  StructureMembers sm = seq.makeStructureMembers();
  StructureDataRegexp.Vinfo result = new StructureDataRegexp.Vinfo(raff, sm, p);
  seq.setSPobject(result);

  int fldno = 1;
  for (StructureMembers.Member m : sm.getMembers()) {
    StructureDataRegexp.VinfoField vf = new StructureDataRegexp.VinfoField(fldno++);
    Variable v = seq.findVariable(m.getName());
    Attribute att = v.findAttribute("iosp_scale");
    if (att != null) {
      vf.hasScale = true;
      vf.scale = att.getNumericValue().floatValue();
      v.remove(att);
    }
    m.setDataObject(vf);
  }

  return result;
}
 
Example #13
Source File: Ghcnm2.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private boolean isValidFile(RandomAccessFile raf, Pattern p) throws IOException {
  raf.seek(0);
  String line;
  while (true) {
    line = raf.readLine();
    if (line == null)
      break;
    if (line.startsWith("#"))
      continue;
    if (line.trim().isEmpty())
      continue;
    Matcher matcher = p.matcher(line);
    return matcher.matches();
  }
  return false;
}
 
Example #14
Source File: RevisionMigratorTest.java    From copybara with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  FileSystem fs = Jimfs.newFileSystem();
  checkoutDir = fs.getPath("/test-checkoutDir");
  origin = new DummyOrigin();
  destinationReader = new MockReader();
  location = Location.fromFileLineColumn("file", 1, 2);
  referenceMigrator = ReferenceMigrator.create(
      "http://internalReviews.com/${reference}",
      "http://externalreviews.com/view?${reference}",
      Pattern.compile("[0-9]+"),
      Pattern.compile("[0-9a-f]+"),
      ImmutableList.of(),
      location);
  OptionsBuilder options = new OptionsBuilder();
  console = new TestingConsole();
  options.setConsole(console);
  skylark = new SkylarkTestExecutor(options);

}
 
Example #15
Source File: MarkdownGenerator.java    From copybara with Apache License 2.0 5 votes vote down vote up
private String simplerJavaTypes(TypeMirror typeMirror) {
  String s = typeMirror.toString();
  Matcher m = Pattern.compile("(?:[A-z.]*\\.)*([A-z]+)").matcher(s);
  StringBuilder sb = new StringBuilder();
  while(m.find()) {
    String replacement = deCapitalize(m.group(1));
    m.appendReplacement(sb, replacement);
  }
  m.appendTail(sb);

  return HtmlEscapers.htmlEscaper().escape(sb.toString());
}
 
Example #16
Source File: XjcObjectTest.java    From nomulus with Apache License 2.0 5 votes vote down vote up
@Test
public void testMarshalUtf8() throws Exception {
  XjcRdeDeposit deposit = unmarshalFullDeposit();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  deposit.marshal(out, UTF_8);
  String xml = out.toString(UTF_8.toString());
  Pattern pat = Pattern.compile("^<\\?xml version=\"1\\.0\" encoding=\"UTF[-_]?8\"");
  assertWithMessage("bad xml declaration: " + xml).that(pat.matcher(xml).find()).isTrue();
  assertWithMessage("encode/decode didn't work: " + xml).that(xml).contains("Jane Doe");
}
 
Example #17
Source File: XjcObjectTest.java    From nomulus with Apache License 2.0 5 votes vote down vote up
@Test
public void testMarshalUtf16() throws Exception {
  XjcRdeDeposit deposit = unmarshalFullDeposit();
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  deposit.marshal(out, UTF_16);
  String xml = out.toString(UTF_16.toString());
  Pattern pat = Pattern.compile("^<\\?xml version=\"1\\.0\" encoding=\"UTF[-_]?16\"");
  assertWithMessage(xml).that(pat.matcher(xml).find()).isTrue();
  assertWithMessage("encode/decode didn't work: " + xml).that(xml).contains("Jane Doe");
}
 
Example #18
Source File: RegexTemplateTokens.java    From copybara with Apache License 2.0 5 votes vote down vote up
public Replacer replacer(
    RegexTemplateTokens after, boolean firstOnly, boolean multiline,
    List<Pattern> patternsToIgnore) {
  // TODO(malcon): Remove reconstructing pattern once RE2J doesn't synchronize on matching.
  return new Replacer(Pattern.compile(before.pattern(), before.flags()), after, null, firstOnly,
                      multiline, patternsToIgnore);
}
 
Example #19
Source File: RegexTemplateTokens.java    From copybara with Apache License 2.0 5 votes vote down vote up
public RegexTemplateTokens(Location location, String template, Map<String, Pattern> regexGroups,
    boolean repeatedGroups) throws EvalException {
  this.template = Preconditions.checkNotNull(template);

  this.tokens = ImmutableList.copyOf(new Parser().parse(template));
  this.before = buildBefore(regexGroups, repeatedGroups);

  this.unusedGroups = Sets.difference(regexGroups.keySet(), groupIndexes.keySet());
}
 
Example #20
Source File: TodoReplace.java    From copybara with Apache License 2.0 5 votes vote down vote up
private Set<FileState> run(Iterable<FileState> files, Console console)
    throws IOException, ValidationException {
  Set<FileState> modifiedFiles = new HashSet<>();
  // TODO(malcon): Remove reconstructing pattern once RE2J doesn't synchronize on matching.
  Pattern batchPattern = Pattern.compile(pattern.pattern(), pattern.flags());
  for (FileState file : files) {
    if (Files.isSymbolicLink(file.getPath())) {
      continue;
    }
    String content = new String(Files.readAllBytes(file.getPath()), UTF_8);
    Matcher matcher = batchPattern.matcher(content);
    StringBuffer sb = new StringBuffer();
    boolean modified = false;
    while (matcher.find()) {
      if (matcher.group(2).trim().isEmpty()){
        matcher.appendReplacement(sb, matcher.group(0));
        continue;
      }
      List<String> users = Splitter.on(",").splitToList(matcher.group(2));
      List<String> mappedUsers = mapUsers(users, matcher.group(0), file.getPath(), console);
      modified |= !users.equals(mappedUsers);
      String result = matcher.group(1);
      if (!mappedUsers.isEmpty()) {
        result += "(" + Joiner.on(",").join(mappedUsers) + ")";
      }
      matcher.appendReplacement(sb, Matcher.quoteReplacement(result));
    }
    matcher.appendTail(sb);

    if (modified) {
      modifiedFiles.add(file);
      Files.write(file.getPath(), sb.toString().getBytes(UTF_8));
    }
  }
  return modifiedFiles;
}
 
Example #21
Source File: RegexTemplateTokens.java    From copybara with Apache License 2.0 5 votes vote down vote up
public Replacer callbackReplacer(
    RegexTemplateTokens after, AlterAfterTemplate callback, boolean firstOnly,
    boolean multiline,
    @Nullable List<Pattern> patternsToIgnore) {
  return new Replacer(Pattern.compile(before.pattern()), after, callback, firstOnly, multiline,
                      patternsToIgnore);
}
 
Example #22
Source File: FormFieldTest.java    From nomulus with Apache License 2.0 5 votes vote down vote up
@Test
public void testAsList_trimmedEmptyToNullOnItems() {
  assertThat(FormField.named("lol")
      .trimmed()
      .emptyToNull()
      .matches(Pattern.compile("[a-z]+"))
      .asList()
      .range(closed(1, 2))
      .build()
      .convert(ImmutableList.of("lol\n", "\tcat "))
      .get())
          .containsExactly("lol", "cat").inOrder();
}
 
Example #23
Source File: VerifyMatch.java    From copybara with Apache License 2.0 5 votes vote down vote up
public static VerifyMatch create(Location location, String regEx, Glob paths,
    boolean verifyNoMatch, boolean alsoOnReversal, LocalParallelizer parallelizer)
    throws EvalException {
  Pattern parsed;
  try {
    parsed = Pattern.compile(regEx, Pattern.MULTILINE);
  } catch (PatternSyntaxException e) {
    throw new EvalException(location, String.format("Regex '%s' is invalid.", regEx), e);
  }
  return new VerifyMatch(parsed, verifyNoMatch, alsoOnReversal, paths, parallelizer, location);
}
 
Example #24
Source File: VerifyMatch.java    From copybara with Apache License 2.0 5 votes vote down vote up
private VerifyMatch(Pattern pattern, boolean verifyNoMatch, boolean alsoOnReversal,
    Glob fileMatcherBuilder, LocalParallelizer parallelizer, Location location) {
  this.pattern = checkNotNull(pattern);
  this.verifyNoMatch = verifyNoMatch;
  this.alsoOnReversal = alsoOnReversal;
  this.fileMatcherBuilder = checkNotNull(fileMatcherBuilder);
  this.parallelizer = parallelizer;
  this.location = checkNotNull(location);
}
 
Example #25
Source File: Re2jRegexDeserializerTest.java    From bender with Apache License 2.0 5 votes vote down vote up
@Test(expected = DeserializationException.class)
public void testNoMatches() {
  List<ReFieldConfig> fields = new ArrayList<>();
  fields.add(new ReFieldConfig("foo", ReFieldType.STRING));

  Pattern p = Pattern.compile("(test i am)");
  Re2jRegexDeserializer deser = new Re2jRegexDeserializer(p, fields);
  DeserializedEvent event = deser.deserialize("i am a test");
}
 
Example #26
Source File: Re2jRegexDeserializerTest.java    From bender with Apache License 2.0 5 votes vote down vote up
@Test
public void testSingleMatch() throws FieldNotFoundException {
  List<ReFieldConfig> fields = new ArrayList<>();
  fields.add(new ReFieldConfig("foo", ReFieldType.STRING));

  Pattern p = Pattern.compile("(.*)");
  Re2jRegexDeserializer deser = new Re2jRegexDeserializer(p, fields);
  DeserializedEvent event = deser.deserialize("test i am");

  assertEquals("test i am", event.getField("foo"));
}
 
Example #27
Source File: RevisionMigratorTest.java    From copybara with Apache License 2.0 5 votes vote down vote up
@Test
public void testLegacyLabel() throws Exception {
  referenceMigrator = ReferenceMigrator.create(
      "http://internalReviews.com/${reference}",
      "http://externalreviews.com/view?${reference}",
      Pattern.compile("[0-9]+"),
      Pattern.compile("[0-9a-f]+"),
      ImmutableList.of("LegacyImporter"),
      location);
  String desc = "This is an awesome change, building on http://internalReviews.com/123";
  TransformWork work = getTransformWork(desc);
  referenceMigrator.transform(work);
  assertThat(work.getMessage())
      .isEqualTo("This is an awesome change, building on http://externalreviews.com/view?7b");
}
 
Example #28
Source File: Registrar.java    From nomulus with Apache License 2.0 5 votes vote down vote up
/**
 * Sets client certificate hash, but not the certificate.
 *
 * <p><b>Warning:</b> {@link #setClientCertificate(String, DateTime)} sets the hash for you and
 * is preferred. Calling this method will nullify the {@code clientCertificate} field.
 */
public Builder setClientCertificateHash(String clientCertificateHash) {
  if (clientCertificateHash != null) {
    checkArgument(
        Pattern.matches("[A-Za-z0-9+/]+", clientCertificateHash),
        "--cert_hash not a valid base64 (no padding) value");
    checkArgument(
        base64().decode(clientCertificateHash).length == 256 / 8,
        "--cert_hash base64 does not decode to 256 bits");
  }
  getInstance().clientCertificate = null;
  getInstance().clientCertificateHash = clientCertificateHash;
  return this;
}
 
Example #29
Source File: ProjectClassToRuleResolver.java    From BUILD_file_generator with Apache License 2.0 5 votes vote down vote up
ProjectClassToRuleResolver(
    ImmutableGraph<String> classGraph,
    Pattern whiteList,
    ImmutableMap<String, Path> classToFile,
    Path workspace) {
  checkNoInnerClassesPresent(classGraph.nodes());
  this.classToFile = classToFile;
  this.workspace = workspace;
  this.classGraph = classGraph;
  this.whiteList = whiteList;
}
 
Example #30
Source File: Bfg.java    From BUILD_file_generator with Apache License 2.0 5 votes vote down vote up
private static Pattern compilePattern(CmdLineParser cmdLineParser, String patternString) {
  try {
    return Pattern.compile(patternString);
  } catch (IllegalArgumentException e) {
    explainUsageErrorAndExit(cmdLineParser, String.format("Invalid regex: %s", e.getMessage()));
    return null;
  }
}