Ding Yuan created CASSANDRA-6656: ------------------------------------ Summary: Exception logging Key: CASSANDRA-6656 URL: https://issues.apache.org/jira/browse/CASSANDRA-6656 Project: Cassandra Issue Type: Improvement Components: Core, Tools Reporter: Ding Yuan Fix For: 2.0.4
Reporting a few cases where informative exceptions can be silently swallowed. Attaching a proposed patch. ========================= Case 1 Line: 95, File: "org/apache/cassandra/utils/Hex.java" An actual failure in the underlying constructor will be lost. Propose to log it. try { s = stringConstructor.newInstance(0, c.length, c); + } + catch (InvocationTargetException ite) { + // The underlying constructor failed. Unwrapping the exception. + logger.info("Underlying constructor throws exception: ", ite.getCause()); } catch (Exception e) { // Swallowing as we'll just use a copying constructor } return s == null ? new String(c) : s; ========================================== ========================= Case 2 Line: 192, File: "org/apache/cassandra/db/marshal/DynamicCompositeType.java" The actual cause of comparator error can be lost as it can fail in multiple locations. AbstractType<?> comparator = null; int header = getShortLength(bb); if ((header & 0x8000) == 0) { ByteBuffer value = getBytes(bb, header); try { comparator = TypeParser.parse(ByteBufferUtil.string(value)); } catch (Exception e) { <--- can fail here // we'll deal with this below since comparator == null } } else { comparator = aliases.get((byte)(header & 0xFF)); <--- can fail here } if (comparator == null) throw new MarshalException("Cannot find comparator for component " + i); Propose to log the exception. ========================================== ========================= Case 3 Line: 239, File: "org/apache/cassandra/tools/NodeProbe.java" Exception ignored in finally. Propose log them with debug or trace. 232: finally 233: { 234: try 235: { 236: ssProxy.removeNotificationListener(runner); 236: ssProxy.removeNotificationListener(runner); 237: jmxc.removeConnectionNotificationListener(runner); 238: } 239: catch (Throwable ignored) {} 240: } Similar case is at line 264 in the same file. ========================================== -- This message was sent by Atlassian JIRA (v6.1.5#6160)