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


V6019. Unreachable code detected. It is possible that an error is present.


CUBA Platform

V6019 Unreachable code detected. It is possible that an error is present. TransactionTest.java(283)


private void throwException() {
  throw new RuntimeException(TEST_EXCEPTION_MSG);
}

@Test
public void testSuspendRollback() {
  Transaction tx = cont.persistence().createTransaction();
  try {
    ....
    Transaction tx1 = cont.persistence().createTransaction();
    try {
      EntityManager em1 = cont.persistence().getEntityManager();
      assertTrue(em != em1);
      Server server1 = em1.find(Server.class, server.getId());
      assertNull(server1);
      throwException();        // <=
      tx1.commit();            // <=
    } catch (Exception e) {
      //
    } finally {
      tx1.end();
    }

    tx.commit();
  } finally {
    tx.end();
  }
}

Similar errors can be found in some other places:

  • V6019 Unreachable code detected. It is possible that an error is present. TransactionTest.java(218)
  • V6019 Unreachable code detected. It is possible that an error is present. TransactionTest.java(163)
  • V6019 Unreachable code detected. It is possible that an error is present. TransactionTest.java(203)
  • And 4 additional diagnostic messages.


Найденные ошибки

Проверено проектов
346
Собрано ошибок
13 188

А ты совершаешь ошибки в коде?

Проверь с помощью
PVS-Studio

Статический анализ
кода для C, C++, C#
и Java

goto PVS-Studio;