Buggy code:
public class ReverseProxyResource extends CoapResource { protected static final Logger LOGGER = Logger . getLogger ( ReverseProxyResource . class . getCanonicalName ( ) ) ; private static final long WAIT_FACTOR = 10 ; private static final long PERIOD_RTT = 10000 ; private static final long THRESHOLD = 500 ; private final URI uri ; private final Map < ClientEndpoint , PeriodicRequest > subscriberList ; private final Scheduler scheduler ; private final ReverseProxyResource . NotificationTask notificationTask ; private final ScheduledExecutorService notificationExecutor ; private final ScheduledExecutorService rttExecutor ; private long notificationPeriodMin ; private long notificationPeriodMax ; private long rtt ; private long lastValidRtt ; private CoapClient client ; private CoapObserveRelation relation ; private ReverseProxy reverseProxy ; Lock lock ; Condition newNotification ; private ReverseProxyResource . RttTask rttTask ; private boolean observeEnabled = false ; public ReverseProxyResource ( String name , URI uri , ResourceAttributes resourceAttributes , NetworkConfig networkConfig , ReverseProxy reverseProxy ) { } @ Override public void handleRequest ( final Exchange exchange ) { } public void handlePOST ( CoapExchange exchange ) { } public void handleDELETE ( CoapExchange exchange ) { } public void handlePUT ( CoapExchange exchange ) { } public void handleGET ( CoapExchange exchange ) { } private Response getLast ( Request request , PeriodicRequest pr ) { Object [ ] params = new Object [ ] { request , pr } ; ReverseProxyResource . LOGGER . log ( Level . INFO , ( ( ( ( "getLast(" + request ) + ",<seq2seq4repair_space>" ) + pr ) + ")" ) ) ; lock . lock ( ) ; try { <START_BUG> while ( ( relation . getCurrent ( ) ) == null ) <END_BUG> newNotification . await ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } finally { lock . unlock ( ) ; } Response notification = relation . getCurrent ( ) . advanced ( ) ; pr . setLastNotificationSent ( notification ) ; Date now = new Date ( ) ; long timestamp = now . getTime ( ) ; pr . setTimestampLastNotificationSent ( timestamp ) ; Response responseForClients = new Response ( notification . getCode ( ) ) ; byte [ ] payload = notification . getPayload ( ) ; responseForClients . setPayload ( payload ) ; responseForClients . setOptions ( new org . eclipse . californium . core . coap . OptionSet ( notification . getOptions ( ) ) ) ; responseForClients . setDestination ( request . getSource ( ) ) ; responseForClients . setDestinationPort ( request . getSourcePort ( ) ) ; responseForClients . setToken ( request . getToken ( ) ) ; responseForClients . getOptions ( ) . setObserve ( notification . getOptions ( ) . getObserve ( ) ) ; return responseForClients ; } public void setTimestamp ( long timestamp ) { } public long getRtt ( ) { } public void setRtt ( long rtt ) { } public void deleteSubscriptionsFromClients ( ClientEndpoint clientEndpoint ) { } public Response forwardRequest ( Request request ) { } public void updateRTT ( long currentRTO ) { } private PeriodicRequest handleGETCoRE ( CoapExchange exchange ) { } private PeriodicRequest handlePUTCoRE ( CoapExchange exchange ) { } private synchronized void addSubscriber ( ClientEndpoint clientEndpoint , PeriodicRequest pr ) { } private synchronized void removeSubscriber ( ClientEndpoint clientEndpoint ) { } private synchronized PeriodicRequest getSubscriber ( ClientEndpoint clientEndpoint ) { } public synchronized Map < ClientEndpoint , PeriodicRequest > getSubscriberList ( ) { } private void setObservingQoS ( ) { } private void scheduleFeasibles ( ) { } private boolean updatePeriods ( ScheduleResults ret ) { } private ClientEndpoint minPmaxClient ( ) { } private boolean scheduleNewRequest ( QoSParameters params ) { } private synchronized ScheduleResults schedule ( ) { } private long evaluateRtt ( ) { } private Response getResponse ( final Response incomingResponse ) { } private Request getRequest ( final Request incomingRequest ) { } private class NotificationTask implements Runnable { @ Override public void run ( ) { } private void sendValidated ( ClientEndpoint cl , PeriodicRequest pr , long timestamp ) { } } public class RttTask implements Runnable { @ Override public void run ( ) { } } }

Fix:
while ( ( ( relation ) == null ) || ( ( relation . getCurrent ( ) ) == null ) )