Buggy code:
private final JmxConnectionFactory jmxFactory ; public RepairRunResource ( ReaperApplicationConfiguration config , IStorage storage ) { } public RepairRunResource ( ReaperApplicationConfiguration config , IStorage storage , JmxConnectionFactory jmxFactory ) { } @ POST public Response addRepairRun ( @ Context UriInfo uriInfo , @ QueryParam ( "clusterName" ) Optional < String > clusterName , @ QueryParam ( "keyspace" ) Optional < String > keyspace , @ QueryParam ( "tables" ) Optional < String > tableNamesParam , @ QueryParam ( "owner" ) Optional < String > owner , @ QueryParam ( "cause" ) Optional < String > cause , @ QueryParam ( "segmentCount" ) Optional < Integer > segmentCount ) { RepairRunResource . LOG . info ( ( "add<seq2seq4repair_space>repair<seq2seq4repair_space>run<seq2seq4repair_space>called<seq2seq4repair_space>with:<seq2seq4repair_space>clusterName<seq2seq4repair_space>=<seq2seq4repair_space>{},<seq2seq4repair_space>keyspace<seq2seq4repair_space>=<seq2seq4repair_space>{},<seq2seq4repair_space>tables<seq2seq4repair_space>=<seq2seq4repair_space>{},<seq2seq4repair_space>owner<seq2seq4repair_space>=<seq2seq4repair_space>{}," + "<seq2seq4repair_space>cause<seq2seq4repair_space>=<seq2seq4repair_space>{}" ) , clusterName , keyspace , tableNamesParam , owner , cause ) ; try { if ( ! ( clusterName . isPresent ( ) ) ) { return Response . status ( BAD_REQUEST ) . entity ( "missing<seq2seq4repair_space>query<seq2seq4repair_space>parameter<seq2seq4repair_space>\"clusterName\"" ) . build ( ) ; } if ( ! ( keyspace . isPresent ( ) ) ) { return Response . status ( BAD_REQUEST ) . entity ( "missing<seq2seq4repair_space>query<seq2seq4repair_space>parameter<seq2seq4repair_space>\"keyspace\"" ) . build ( ) ; } if ( ! ( owner . isPresent ( ) ) ) { return Response . status ( BAD_REQUEST ) . entity ( "missing<seq2seq4repair_space>query<seq2seq4repair_space>parameter<seq2seq4repair_space>\"owner\"" ) . build ( ) ; } Optional < Cluster > cluster = storage . getCluster ( clusterName . get ( ) ) ; if ( ! ( cluster . isPresent ( ) ) ) { return Response . status ( NOT_FOUND ) . entity ( ( ( "no<seq2seq4repair_space>cluster<seq2seq4repair_space>found<seq2seq4repair_space>with<seq2seq4repair_space>name<seq2seq4repair_space>'" + clusterName ) + "'" ) ) . build ( ) ; } JmxProxy jmxProxy = jmxFactory . connect ( cluster . get ( ) . getSeedHosts ( ) . iterator ( ) . next ( ) ) ; Set < String > knownTables = jmxProxy . getTableNamesForKeyspace ( keyspace . get ( ) ) ; if ( ( knownTables . size ( ) ) == 0 ) { RepairRunResource . LOG . debug ( "no<seq2seq4repair_space>known<seq2seq4repair_space>tables<seq2seq4repair_space>for<seq2seq4repair_space>keyspace<seq2seq4repair_space>{}<seq2seq4repair_space>in<seq2seq4repair_space>cluster<seq2seq4repair_space>{}" , keyspace . get ( ) , clusterName . get ( ) ) ; return Response . status ( NOT_FOUND ) . entity ( "no<seq2seq4repair_space>column<seq2seq4repair_space>families<seq2seq4repair_space>found<seq2seq4repair_space>for<seq2seq4repair_space>keyspace" ) . build ( ) ; } jmxProxy . close ( ) ; Set < String > tableNames ; if ( ( tableNamesParam . isPresent ( ) ) && ( ! ( tableNamesParam . get ( ) . isEmpty ( ) ) ) ) { tableNames = Sets . newHashSet ( RepairRunResource . COMMA_SEPARATED_LIST_SPLITTER . split ( tableNamesParam . get ( ) ) ) ; for ( String name : tableNames ) { if ( ! ( knownTables . contains ( name ) ) ) { return Response . status ( NOT_FOUND ) . entity ( ( ( "keyspace<seq2seq4repair_space>doesn\'t<seq2seq4repair_space>contain<seq2seq4repair_space>a<seq2seq4repair_space>table<seq2seq4repair_space>named<seq2seq4repair_space>\"" + name ) + "\"" ) ) . build ( ) ; } } } else { tableNames = Collections . emptySet ( ) ; } Optional < RepairUnit > storedRepairUnit = storage . getRepairUnit ( clusterName . get ( ) , keyspace . get ( ) , tableNames ) ; RepairUnit theRepairUnit ; if ( storedRepairUnit . isPresent ( ) ) { if ( segmentCount . isPresent ( ) ) { RepairRunResource . LOG . warn ( ( "stored<seq2seq4repair_space>repair<seq2seq4repair_space>unit<seq2seq4repair_space>already<seq2seq4repair_space>exists,<seq2seq4repair_space>and<seq2seq4repair_space>segment<seq2seq4repair_space>count<seq2seq4repair_space>given,<seq2seq4repair_space>" + "which<seq2seq4repair_space>is<seq2seq4repair_space>thus<seq2seq4repair_space>ignored" ) ) ; } RepairRunResource . LOG . info ( "use<seq2seq4repair_space>existing<seq2seq4repair_space>repair<seq2seq4repair_space>unit<seq2seq4repair_space>for<seq2seq4repair_space>cluster<seq2seq4repair_space>'{}',<seq2seq4repair_space>keyspace<seq2seq4repair_space>'{}',<seq2seq4repair_space>and<seq2seq4repair_space>column<seq2seq4repair_space>families:<seq2seq4repair_space>{}" , clusterName . get ( ) , keyspace . get ( ) , tableNames ) ; theRepairUnit = storedRepairUnit . get ( ) ; } else { int segments = config . getSegmentCount ( ) ; if ( segmentCount . isPresent ( ) ) { RepairRunResource . LOG . debug ( "using<seq2seq4repair_space>given<seq2seq4repair_space>segment<seq2seq4repair_space>count<seq2seq4repair_space>{}<seq2seq4repair_space>instead<seq2seq4repair_space>of<seq2seq4repair_space>configured<seq2seq4repair_space>value<seq2seq4repair_space>{}" , segmentCount . get ( ) , config . getSegmentCount ( ) ) ; segments = segmentCount . get ( ) ; } RepairRunResource . LOG . info ( "create<seq2seq4repair_space>new<seq2seq4repair_space>repair<seq2seq4repair_space>unit<seq2seq4repair_space>for<seq2seq4repair_space>cluster<seq2seq4repair_space>'{}',<seq2seq4repair_space>keyspace<seq2seq4repair_space>'{}',<seq2seq4repair_space>and<seq2seq4repair_space>column<seq2seq4repair_space>families:<seq2seq4repair_space>{}" , clusterName . get ( ) , keyspace . get ( ) , tableNames ) ; <START_BUG> theRepairUnit = storage . addRepairUnit ( new RepairUnit . Builder ( clusterName . get ( ) , keyspace . get ( ) , tableNames , segments , RepairParallelism . valueOf ( config . getRepairParallelism ( ) ) ) ) ; <END_BUG> } RepairRun newRepairRun = registerRepairRun ( cluster . get ( ) , theRepairUnit , cause , owner . get ( ) ) ; return Response . created ( buildRepairRunURI ( uriInfo , newRepairRun ) ) . entity ( new RepairRunStatus ( newRepairRun , theRepairUnit ) ) . build ( ) ; } catch ( ReaperException e ) { RepairRunResource . LOG . error ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; return Response . status ( 500 ) . entity ( e . getMessage ( ) ) . build ( ) ; } } @ PUT @ Path ( "//{id}" ) public Response modifyRunState ( @ Context UriInfo uriInfo , @ PathParam ( "id" ) Long repairRunId , @ QueryParam ( "state" ) Optional < String > state ) { } private boolean isStarting ( RepairRun . RunState oldState , RepairRun . RunState newState ) { } private boolean isPausing ( RepairRun . RunState oldState , RepairRun . RunState newState ) { } private boolean isResuming ( RepairRun . RunState oldState , RepairRun . RunState newState ) { } private Response startRun ( RepairRun repairRun , RepairUnit repairUnit ) { } private Response pauseRun ( RepairRun repairRun , RepairUnit repairUnit ) { } private Response resumeRun ( RepairRun repairRun , RepairUnit repairUnit ) { } @ GET @ Path ( "//{id}" ) public Response getRepairRun ( @ PathParam ( "id" ) Long repairRunId ) { } @ GET @ Path ( "//cluster//{cluster_name}" ) public Response getRepairRunsForCluster ( @ PathParam ( "cluster_name" ) String clusterName ) { } private RepairRun registerRepairRun ( Cluster cluster , RepairUnit repairUnit , Optional < String > cause , String owner ) throws ReaperException { }

Fix:
theRepairUnit = storage . addRepairUnit ( new RepairUnit . Builder ( clusterName . get ( ) , keyspace . get ( ) , tableNames , segments , RepairParallelism . valueOf ( config . getRepairParallelism ( ) . toUpperCase ( ) ) ) ) ;