Мы используем куки, чтобы пользоваться сайтом было удобно.
Хорошо
to the top

Вебинар: Тимлид: ожидания, реальность и внутренние вопросы - 15.04

>
>
>
Примеры ошибок, обнаруженных с...

Примеры ошибок, обнаруженных с помощью диагностики V6127

V6127. Closeable object is not closed. This may lead to a resource leak.


OpenAPI Generator

V6127 The 'is' Closeable object is not closed. This may lead to a resource leak. TemplateManager.java 177


@Override
public File write(
  Map<String, Object> data,
  String template,
  File target
) throws IOException {
  ....
  } else {
    InputStream is;
    try {
      String fullTemplatePath = getFullTemplateFile(template);
      is = getInputStream(fullTemplatePath);
    } catch (TemplateNotFoundException ex) {
      is = new FileInputStream(Paths.get(template).toFile());  // <=
    }
    return writeToFile(
             target.getAbsolutePath(),
             IOUtils.toByteArray(is)
           );
  }
}

LanguageTool

V6127 The 'metadata' Closeable object is not closed. This may lead to a resource leak. MorfologikMultiSpeller.java 320


private Dictionary getDictionary(
  Supplier<List<byte[]>> lines,
  String dictPath,
  String infoPath,
  boolean isUserDict,
  int userDictSize
){
  ....
  InputStream metadata;
  if (new File(infoPath).exists()) {
    metadata = new FileInputStream(infoPath);  // <=
  } else {
    metadata = getDataBroker().getFromResourceDirAsStream(infoPath);
  }
  Dictionary dict = Dictionary.read(fsaInStream, metadata);
  if (!isUserDict) {
    dicPathToDict.put(cacheKey, dict);
  } else if (userDictCacheSize != null) {
    getUserDictCache().put(userDictName, dict);
  }
  return dict;
}