auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected String processDistinctKeyword( String sql, QueryParameters parameters) { if ( !parameters.isPassDistinctThrough() ) { if ( sql.contains( SELECT_DISTINCT ) ) { return sql.replaceAll( SELECT_DISTINCT, SELECT ); } } return sql; }

Target:
protected String processDistinctKeyword( String sql, QueryParameters parameters) { if ( !parameters.isPassDistinctThrough() ) { int selectDistinctIndex = sql.indexOf( SELECT_DISTINCT ); if ( selectDistinctIndex > -1 ) { StringBuilder builder = ( selectDistinctIndex > 0 ) ? new StringBuilder( sql.substring( 0, selectDistinctIndex ) ) : new StringBuilder(); builder.append( SELECT ) .append( sql.substring( selectDistinctIndex + SELECT_DISTINCT.length() ) ); return builder.toString(); } } return sql; }
Source:
private void connectToOneServerWithRetry(String hostname, int port) { long sleep = m_initialRetryIntervalMS; while (m_shouldContinue.get()) { try { m_client.createConnection(hostname, port); LOG.info(String.format("Connected to VoltDB node at %s:%d.", hostname, port)); synchronized (m_client) { m_client.notifyAll(); } break; } catch (Exception e) { LOG.warn(String.format("Connection to VoltDB node at %s:%d failed - retrying in %d second(s).", hostname, port, TimeUnit.MILLISECONDS.toSeconds(sleep))); try { Thread.sleep(sleep); } catch (Exception ignored) { } if (sleep < m_maxRetryIntervalMS) { sleep = Math.min(sleep + sleep, m_maxRetryIntervalMS); } } } }

Target:
private void connectToOneServerWithRetry(String hostname, int port) { long sleep = m_initialRetryIntervalMS; while (m_shouldContinue.get()) { try { m_client.createConnection(hostname, port); LOG.info(String.format("Connected to VoltDB node at %s:%d.", hostname, port)); break; } catch (Exception e) { LOG.warn(String.format("Connection to VoltDB node at %s:%d failed - retrying in %d second(s).", hostname, port, TimeUnit.MILLISECONDS.toSeconds(sleep))); try { Thread.sleep(sleep); } catch (Exception ignored) { } if (sleep < m_maxRetryIntervalMS) { sleep = Math.min(sleep + sleep, m_maxRetryIntervalMS); } } } }
Source:
public void setup() { try { this.espConn = new Connection("http://" + testClusterIp + ":8010?test"); espConn.setUserName(""); espConn.setPassword(""); } catch (Exception e) }

Target:
public void setup() { try { this.espConn = new Connection("http://" + testClusterIp + ":8010"); espConn.setUserName(""); espConn.setPassword(""); } catch (Exception e) }
Source:
public ExtractionType getExtractionType(){ return (child != null) ? ((child.getExtractionType() == ExtractionType.MANY_TO_ONE) ? ExtractionType.MANY_TO_ONE : fn.getExtractionType() ) : fn.getExtractionType(); }

Target:
public ExtractionType getExtractionType(){ if (child != null && child.getExtractionType() == ExtractionType.MANY_TO_ONE) { return ExtractionType.MANY_TO_ONE; } else { return fn.getExtractionType(); } }
Source:
public void addControl(String id, Control control) { if (controls.containsKey(id)) { throw new IllegalArgumentException( MessageFormat.format("A control with id {0} already exists", id)); } controls.put(id, control); }

Target:
protected void addControl(String id, Control control) { if (controls.containsKey(id)) { throw new IllegalArgumentException( MessageFormat.format("A control with id {0} already exists", id)); } controls.put(id, control); }
Source:
public void test_ecb_eur_gbp_dates() { FxIndex test = FxIndices.ECB_EUR_GBP; assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 13)), date(2014, 10, 15)); assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 15)), date(2014, 10, 13)); assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 16)), date(2014, 10, 20)); assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 20)), date(2014, 10, 16)); assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 17)), date(2014, 10, 21)); assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 21)), date(2014, 10, 17)); assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 19)), date(2014, 10, 22)); assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 19)), date(2014, 10, 16)); }

Target:
public void test_ecb_eur_gbp_dates() { FxIndex test = FxIndices.ECB_EUR_GBP; assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 13)), date(2014, 10, 15)); assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 15)), date(2014, 10, 13)); assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 16)), date(2014, 10, 20)); assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 20)), date(2014, 10, 16)); assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 17)), date(2014, 10, 21)); assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 21)), date(2014, 10, 17)); assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 19)), date(2014, 10, 22)); assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 19)), date(2014, 10, 16)); assertEquals(test.calculateMaturityFromFixing(date(2014, 4, 30)), date(2014, 5, 6)); assertEquals(test.calculateFixingFromMaturity(date(2014, 5, 6)), date(2014, 4, 30)); }
Source:
default void moveTo(int paragraphIndex, int columnIndex, SelectionPolicy selectionPolicy) { int pos = getAbsoluteCharPosition(paragraphIndex, columnIndex); switch(selectionPolicy) { case CLEAR: selectRange(pos, pos); break; case ADJUST: selectRange(getAnchor(), pos); break; case EXTEND: IndexRange sel = getSelection(); int anchor; if(pos <= sel.getStart()) anchor = sel.getEnd(); else if(pos >= sel.getEnd()) anchor = sel.getStart(); else anchor = getAnchor(); selectRange(anchor, pos); break; } }

Target:
default void moveTo(int paragraphIndex, int columnIndex, SelectionPolicy selectionPolicy) { int pos = getAbsolutePosition(paragraphIndex, columnIndex); moveTo(pos, selectionPolicy); }
Source:
public void evict(AccountExternalId id) { byKey.remove(id.getKey()); byAccountId.remove(id.getAccountId()); byEmail.remove(new EmailWrapper(id.getEmailAddress())); }

Target:
public void evict(AccountExternalId id) { byKey.remove(id.getKey()); byAccountId.remove(id.getAccountId()); if (id.getEmailAddress() != null) { byEmail.remove(new EmailWrapper(id.getEmailAddress())); } }
Source:
public void singleHopGetAllShouldRetrySOECausedBySerialzationExp() { when(region.getFullPath()).thenReturn("/testRegion") .thenThrow(new ServerOperationException(new SerializationException("testRetry"))) .thenReturn("/testRegion"); VersionedObjectList vol = new VersionedObjectList(); when(pool.execute(any())).thenReturn(vol); GetAllOp.execute(pool, region, keys, -1, null); }

Target:
public void singleHopGetAllShouldRetrySOECausedBySerialzationExp() { when(region.getFullPath()).thenReturn("/testRegion") .thenThrow(new ServerOperationException(new SerializationException("testRetry"))) .thenReturn("/testRegion"); VersionedObjectList vol = new VersionedObjectList(); when(pool.execute(any())).thenReturn(vol); VersionedObjectList result = GetAllOp.execute(pool, region, keys, -1, null); assertThat(result.getKeys()).isEqualTo(keys); Mockito.verify(pool, times(1)).execute(any()); }
Source:
public void replaceTokens(ZestVariables tokens) { if (this.urlToken != null) { this.setUrlToken(tokens.replaceInString(this.urlToken, true)); try { this.setUrl(new URL(this.getUrlToken())); } catch (MalformedURLException e) { } } else if (this.url != null) { try { this.setUrl(new URL(tokens.replaceInString(this.url.toString(), true))); } catch (MalformedURLException e) { } } this.setMethod(tokens.replaceInString(this.getMethod(), false)); this.setHeaders(tokens.replaceInString(this.getHeaders(), false)); this.setData(tokens.replaceInString(this.getData(), false)); List<ZestCookie> replacedCookies = new ArrayList<>(); for (ZestCookie cookie : this.cookies) { replacedCookies.add(new ZestCookie(cookie.getDomain(), tokens.replaceInString(cookie.getName(), false), tokens.replaceInString(cookie.getValue(), false), cookie.getPath(), cookie.getExpiryDate(), cookie.getSecure())); } this.cookies = replacedCookies; }

Target:
public void replaceTokens(ZestVariables tokens) { if (this.urlToken != null) { this.setUrlToken(tokens.replaceInString(this.urlToken, true)); try { this.setUrl(new URL(this.getUrlToken())); } catch (MalformedURLException e) { } } else if (this.url != null) { try { this.setUrl(new URL(tokens.replaceInString(this.url.toString(), true))); } catch (MalformedURLException e) { } } this.setMethod(tokens.replaceInString(this.getMethod(), false)); this.setHeaders(tokens.replaceInString(this.getHeaders(), false)); this.setData(tokens.replaceInString(this.getData(), false)); for (ZestCookie cookie : this.cookies) { cookie.setDomain(tokens.replaceInString(cookie.getDomain(),false)); cookie.setName(tokens.replaceInString(cookie.getName(),false)); cookie.setValue(tokens.replaceInString(cookie.getValue(),false)); cookie.setPath(tokens.replaceInString(cookie.getPath(),false)); } }
Source:
public void startBridge() throws Exception { final Module module; if (moduleName != null) { ModuleIdentifier moduleID = ModuleIdentifier.create(moduleName); module = Module.getCallerModuleLoader().loadModule(moduleID); } else { module = Module.getCallerModule(); } ClassLoader oldTccl= WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader()); bridge.start(); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } MessagingLogger.MESSAGING_LOGGER.startedService("JMS Bridge", bridgeName); }

Target:
public void startBridge() throws Exception { final Module module; if (moduleName != null) { ModuleIdentifier moduleID = ModuleIdentifier.create(moduleName); module = Module.getContextModuleLoader().loadModule(moduleID); } else { module = Module.forClass(JMSBridgeService.class); } ClassLoader oldTccl= WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader()); bridge.start(); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } MessagingLogger.MESSAGING_LOGGER.startedService("JMS Bridge", bridgeName); }
Source:
static String getLiveChatId(YouTube youtube, String videoId) throws IOException { if (videoId != null && !videoId.isEmpty()) { YouTube.Videos.List videoList = youtube.videos() .list("liveStreamingDetails") .setFields("items/liveStreamingDetails/activeLiveChatId") .setId(videoId); VideoListResponse response = videoList.execute(); for (Video v : response.getItems()) { String liveChatId = v.getLiveStreamingDetails().getActiveLiveChatId(); if (liveChatId != null && !liveChatId.isEmpty()) { return liveChatId; } } } else { YouTube.LiveBroadcasts.List broadcastList = youtube .liveBroadcasts() .list("snippet") .setFields("items/snippet/liveChatId") .setBroadcastType("all") .setBroadcastStatus("active"); LiveBroadcastListResponse broadcastListResponse = broadcastList.execute(); for (LiveBroadcast b : broadcastListResponse.getItems()) { String liveChatId = b.getSnippet().getLiveChatId(); if (liveChatId != null && !liveChatId.isEmpty()) { return liveChatId; } } } return null; }

Target:
static String getLiveChatId(YouTube youtube, String videoId) throws IOException { YouTube.Videos.List videoList = youtube.videos() .list("liveStreamingDetails") .setFields("items/liveStreamingDetails/activeLiveChatId") .setId(videoId); VideoListResponse response = videoList.execute(); for (Video v : response.getItems()) { String liveChatId = v.getLiveStreamingDetails().getActiveLiveChatId(); if (liveChatId != null && !liveChatId.isEmpty()) { return liveChatId; } } return null; }
Source:
public static boolean matchesPartially(final MbusChannelElementsDto mbusChannelElements, final ChannelElementValuesDto channelElementValues) { if (!channelElementValues.isMbusSlaveDeviceConfigured()) { return false; } if (mbusChannelElements.hasMbusIdentificationNumber() && channelElementValues.hasIdentificationNumber() && !mbusChannelElements.getMbusIdentificationNumber() .equals(channelElementValues.getIdentificationNumber())) { return false; } if (mbusChannelElements.hasMbusManufacturerIdentification() && channelElementValues.hasManufacturerIdentification() && !mbusChannelElements.getMbusManufacturerIdentification() .equals(channelElementValues.getManufacturerIdentification())) { return false; } if (mbusChannelElements.hasMbusVersion() && channelElementValues.hasVersion() && !mbusChannelElements.getMbusVersion().equals(channelElementValues.getVersion())) { return false; } if (mbusChannelElements.hasMbusDeviceTypeIdentification() && channelElementValues.hasDeviceTypeIdentification() && !mbusChannelElements.getMbusDeviceTypeIdentification() .equals(channelElementValues.getDeviceTypeIdentification())) { return false; } return true; }

Target:
public static boolean matchesPartially(final MbusChannelElementsDto mbusChannelElements, final ChannelElementValuesDto channelElementValues) { if (!channelElementValues.isMbusSlaveDeviceConfigured()) { return false; } if (failPartialMatchOnMbusIdentificationNumber(mbusChannelElements, channelElementValues) || failPartialMatchOnMbusManufacturerIdentification(mbusChannelElements, channelElementValues) || failPartialMatchOnMbusVersion(mbusChannelElements, channelElementValues) || failPartialMatchOnMbusDeviceTypeIdentification(mbusChannelElements, channelElementValues)) { return false; } return true; }
Source:
public String getSourcePresentationName() { String result = StringUtils.EMPTY; if (getSourceExecutionCourse() != null) { result += getSourceExecutionCourse().getNameI18N().getContent(); final Set<DegreeCurricularPlan> plans; if (getDegree() != null) { plans = Sets.intersection(getDegree().getDegreeCurricularPlansSet(), Sets.newHashSet(getSourceExecutionCourse().getAssociatedDegreeCurricularPlans())); } else { plans = Sets.newHashSet(getSourceExecutionCourse().getAssociatedDegreeCurricularPlans()); } result += getDegreeCurricularPlansPresentationString(plans); } return result; }

Target:
public String getSourcePresentationName() { StringBuilder result = new StringBuilder(); if (getSourceExecutionCourse() != null) { result.append(getSourceExecutionCourse().getNameI18N().getContent()); final Set<DegreeCurricularPlan> plans; if (getDegree() != null) { plans = Sets.intersection(getDegree().getDegreeCurricularPlansSet(), Sets.newHashSet(getSourceExecutionCourse().getAssociatedDegreeCurricularPlans())); } else { plans = Sets.newHashSet(getSourceExecutionCourse().getAssociatedDegreeCurricularPlans()); } result.append(getDegreeCurricularPlansPresentationString(plans)); } return result.toString(); }
Source:
private void saveDirStrings(Set<String> gitDirStrings) { StringBuilder sb = new StringBuilder(); for (String gitDirString : gitDirStrings) { sb.append(gitDirString); sb.append(File.pathSeparatorChar); } IEclipsePreferences prefs = new InstanceScope().getNode(Activator .getPluginId()); prefs.put(PREFS_DIRECTORIES, sb.toString()); try { prefs.flush(); } catch (BackingStoreException e) { e.printStackTrace(); } }

Target:
private void saveDirStrings(Set<String> gitDirStrings) { StringBuilder sb = new StringBuilder(); for (String gitDirString : gitDirStrings) { sb.append(gitDirString); sb.append(File.pathSeparatorChar); } IEclipsePreferences prefs = new InstanceScope().getNode(Activator .getPluginId()); prefs.put(PREFS_DIRECTORIES, sb.toString()); try { prefs.flush(); } catch (BackingStoreException e) { IStatus error = new Status(IStatus.ERROR, Activator.getPluginId(), e.getMessage(), e); Activator.getDefault().getLog().log(error); } }
Source:
protected void startDebugger(final DebugSessionDto debugSessionDto) { List<BreakpointDto> breakpoints = new ArrayList<>(); for (Breakpoint breakpoint : breakpointManager.getBreakpointList()) { Location location = breakpoint.getLocation(); LocationDto locationDto = dtoFactory.createDto(LocationDto.class); locationDto.setLineNumber(location.getLineNumber()); locationDto.setTarget(location.getTarget()); locationDto.setResourceProjectPath(location.getResourceProjectPath()); BreakpointConfigurationDto conditions = dtoFactory .createDto(BreakpointConfigurationDto.class) .withCondition(breakpoint.getBreakpointConfiguration().getCondition()) .withHitCount(breakpoint.getBreakpointConfiguration().getHitCount()); BreakpointDto breakpointDto = dtoFactory.createDto(BreakpointDto.class); breakpointDto.setLocation(locationDto); breakpointDto.setEnabled(true); breakpointDto.setBreakpointConfiguration(conditions); breakpoints.add(breakpointDto); } StartActionDto action = dtoFactory.createDto(StartActionDto.class); action.setType(Action.TYPE.START); action.setBreakpoints(breakpoints); service.start(debugSessionDto.getId(), action); }

Target:
protected void startDebugger(final DebugSessionDto debugSessionDto) { List<BreakpointDto> breakpoints = new ArrayList<>(); for (Breakpoint breakpoint : breakpointManager.getBreakpointList()) { BreakpointDto breakpointDto = dtoFactory.createDto(BreakpointDto.class); breakpointDto.setLocation(toDto(breakpoint.getLocation())); breakpointDto.setEnabled(true); breakpointDto.setCondition(breakpoint.getCondition()); breakpoints.add(breakpointDto); } StartActionDto action = dtoFactory.createDto(StartActionDto.class); action.setType(Action.TYPE.START); action.setBreakpoints(breakpoints); service.start(debugSessionDto.getId(), action); }
Source:
protected Transferable createTransferable(JComponent c) { indices = list.getSelectedIndices(); if (list.isSelectionEmpty()) return null; return new ActionTransferable((ArrayList<Action>) list.getSelectedValuesList()); }

Target:
protected Transferable createTransferable(JComponent c) { if (list.isSelectionEmpty()) return null; indices = list.getSelectedIndices(); return new ActionTransferable((ArrayList<Action>) list.getSelectedValuesList()); }
Source:
public GraphBuilder setCHProfiles(List<CHProfile> chProfiles) { if (chProfiles.size() != new HashSet<>(chProfiles).size()) { throw new IllegalArgumentException("Duplicate CH profile: " + chProfiles); } this.chProfiles = chProfiles; return this; }

Target:
public GraphBuilder setCHProfiles(List<CHProfile> chProfiles) { if (chProfiles.size() != new HashSet<>(chProfiles).size()) { throw new IllegalArgumentException("Given CH profiles contain duplicates, given: " + chProfiles); } this.chProfiles = chProfiles; return this; }
Source:
synchronized void shutdown() { m_isShutdown = true; try { DeferredSerialization ds = null; while ((ds = m_queuedWrites.poll()) != null) { ds.cancel(); } int waitFor = 1 - Math.min(m_inFlight.availablePermits(), -4); for (int i = 0; i < waitFor; ++i) { try { if (m_inFlight.tryAcquire(1, TimeUnit.SECONDS)) { m_inFlight.release(); break; } } catch (InterruptedException e) { break; } } m_ecryptgw.die(); EncryptFrame frame = null; while ((frame = m_encrypted.poll()) != null) { frame.frame.release(); } for (EncryptFrame ef: m_partial) { ef.frame.release(); } m_partial.clear(); m_outbuf.release(); final int unqueue = -m_ledger; updateQueued(unqueue, false); } finally { m_inFlight.drainPermits(); m_inFlight.release(); } }

Target:
synchronized void shutdown() { m_isShutdown = true; try { DeferredSerialization ds = null; while ((ds = m_queuedWrites.poll()) != null) { ds.cancel(); } int waitFor = 1 - Math.min(m_inFlight.availablePermits(), -4); for (int i = 0; i < waitFor; ++i) { try { if (m_inFlight.tryAcquire(1, TimeUnit.SECONDS)) { m_inFlight.release(); break; } } catch (InterruptedException e) { break; } } m_ecryptgw.die(); EncryptFrame frame = null; while ((frame = m_encrypted.poll()) != null) { frame.frame.release(); } for (EncryptFrame ef: m_partial) { ef.frame.release(); } m_partial.clear(); m_outbuf.release(); final int unqueue = -m_queuedBytes; updateQueued(unqueue, false); } finally { m_inFlight.drainPermits(); m_inFlight.release(); } }
Source:
public static String getAtsId(Artifact art) throws OseeCoreException { String toReturn = art.getSoleAttributeValueAsString(AtsAttributeTypes.AtsId, AtsUtilCore.DEFAULT_ATS_ID_VALUE); if (AtsUtilCore.DEFAULT_ATS_ID_VALUE.equals(toReturn)) { toReturn = art.getGuid(); } return toReturn; }

Target:
public static String getAtsId(Artifact art) throws OseeCoreException { String toReturn = art.getSoleAttributeValueAsString(AtsAttributeTypes.AtsId, AtsUtilCore.DEFAULT_ATS_ID_VALUE); Conditions.checkNotNull("AtsId", "AtsId"); if (AtsUtilCore.DEFAULT_ATS_ID_VALUE.equals(toReturn)) { toReturn = art.getGuid(); } return toReturn; }
Source:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { Version vmCustomCompatibilityVersion = vm.getCustomCompatibilityVersion(); List<VDS> hostsToRunOn = new ArrayList<>(); if (vmCustomCompatibilityVersion == null) { return hosts; } for (VDS host : hosts) { if (host.getSupportedENGINESVersionsSet().contains(vmCustomCompatibilityVersion)) { hostsToRunOn.add(host); log.debug("Host wasn't filtered out as it supports the VM required compatibility version({})", host.getName(), vmCustomCompatibilityVersion); } else { log.debug("Host was filtered out as it doesn't support the VM required compatibility-version ({}). Host supported compatibility-versions are: {}.", host.getName(), vmCustomCompatibilityVersion, host.getSupportedEngines()); messages.addMessage(host.getId(), String.format("$vmCompatibilityVersions %1$s", vmCustomCompatibilityVersion)); messages.addMessage(host.getId(), String.format("$hostCompatibilityVersions %1$s", host.getSupportedEngines())); messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__UNSUPPORTED_COMPATIBILITY_VERSION.toString()); } } return hostsToRunOn; }

Target:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { Version vmCustomCompatibilityVersion = vm.getCustomCompatibilityVersion(); if (vmCustomCompatibilityVersion == null) { return hosts; } List<VDS> hostsToRunOn = new ArrayList<>(); for (VDS host : hosts) { if (host.getSupportedENGINESVersionsSet().contains(vmCustomCompatibilityVersion)) { hostsToRunOn.add(host); log.debug("Host wasn't filtered out as it supports the VM required compatibility version({})", host.getName(), vmCustomCompatibilityVersion); } else { log.debug("Host was filtered out as it doesn't support the VM required compatibility-version ({}). Host supported compatibility-versions are: {}.", host.getName(), vmCustomCompatibilityVersion, host.getSupportedEngines()); messages.addMessage(host.getId(), String.format("$vmCompatibilityVersions %1$s", vmCustomCompatibilityVersion)); messages.addMessage(host.getId(), String.format("$hostCompatibilityVersions %1$s", host.getSupportedEngines())); messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__UNSUPPORTED_COMPATIBILITY_VERSION.toString()); } } return hostsToRunOn; }
Source:
private PBDSegment peekFirstSegment() { Map.Entry<Long, PBDSegment> entry = m_segments.firstEntry(); return (entry!=null) ? entry.getValue() : null; }

Target:
private PBDSegment peekFirstSegment() { Map.Entry<Long, PBDSegment> entry = m_segments.firstEntry(); return (entry==null) ? null : entry.getValue(); }
Source:
public CompletableFuture<org.apache.bookkeeper.client.api.LedgerEntries> readUnconfirmed(long firstEntry, long lastEntry) { if (firstEntry < 0 || firstEntry > lastEntry) { LOG.error("IncorrectParameterException on ledgerId:{} firstEntry:{} lastEntry:{}", new Object[] { ledgerId, firstEntry, lastEntry }); return FutureUtils.exception(new BKIncorrectParameterException()); } return readEntriesInternalAsync(firstEntry, lastEntry); }

Target:
public CompletableFuture<LedgerEntries> readUnconfirmed(long firstEntry, long lastEntry) { if (firstEntry < 0 || firstEntry > lastEntry) { LOG.error("IncorrectParameterException on ledgerId:{} firstEntry:{} lastEntry:{}", new Object[] { ledgerId, firstEntry, lastEntry }); return FutureUtils.exception(new BKIncorrectParameterException()); } return readEntriesInternalAsync(firstEntry, lastEntry); }
Source:
public long calculateDuration() { if (!nodes.isEmpty()) { long endTimeNS = 0; for (int i = 0; i < getNodes().size(); i++) { Node node = getNodes().get(i); long et = node.overallEndTime(); if (et > endTimeNS) { endTimeNS = et; } } long elapsedTime = endTimeNS - getNodes().get(0).getBaseTime(); return elapsedTime; } return 0L; }

Target:
public long calculateDuration() { if (!nodes.isEmpty()) { long endTime = 0; for (int i = 0; i < getNodes().size(); i++) { Node node = getNodes().get(i); long nodeEndTime = node.overallEndTime(); if (nodeEndTime > endTime) { endTime = nodeEndTime; } } return endTime - getNodes().get(0).getBaseTime(); } return 0L; }
Source:
public Observable<Receive> openEventStream(@NotNull final Send subscription) { return createPost.call(subscription) .flatMap(httpClient::submit) .subscribeOn(Schedulers.io()) .flatMap(resp -> { final HttpResponseStatus status = resp.getStatus(); final int code = status.code(); if (code == 200) { return resp.getContent(); } else { final HttpResponseHeaders headers = resp.getHeaders(); final List<Map.Entry<String, String>> entries = headers.entries(); String errorMessage; if (headers.getContentLength() > 0) { errorMessage = resp.getContent() .map(r -> r.toString(CharsetUtil.UTF_8)) .toBlocking() .first(); } else { errorMessage = ""; } final MesosClientErrorContext context = new MesosClientErrorContext(code, errorMessage, entries); if (400 <= code && code < 500) { throw new MesosClientException(subscription, context); } else if (500 <= code && code < 600) { throw new MesosServerException(subscription, context); } else { LOGGER.warn("Unhandled error: context = {}", context); throw new IllegalStateException("Unhandled error"); } } }) .lift(new RecordIOOperator()) .observeOn(Schedulers.computation()) .buffer(250, TimeUnit.MILLISECONDS) .flatMap(Observable::from) .map(receiveCodec::decode) .doOnNext(event -> LOGGER.trace("Observed Event: {}", receiveCodec.show(event))) .doOnError(t -> LOGGER.warn("doOnError", t)) ; }

Target:
public Observable<Receive> openEventStream(@NotNull final Send subscription) { return createPost.call(subscription) .flatMap(httpClient::submit) .subscribeOn(Schedulers.io()) .flatMap(verifyResponseOk(subscription)) .lift(new RecordIOOperator()) .observeOn(Schedulers.computation()) .buffer(250, TimeUnit.MILLISECONDS) .flatMap(Observable::from) .map(receiveCodec::decode) .doOnNext(event -> LOGGER.trace("Observed Event: {}", receiveCodec.show(event))) .doOnError(t -> LOGGER.warn("doOnError", t)) ; }
Source:
public void setUp() throws IOException { FileUtils.forceMkdir(INDEX_DIR); int sequentialDocId = RANDOM.nextInt(32); int sparseDocId = RANDOM.nextInt(32); for (int i = 0; i < NUM_DOC_IDS; i++) { _sequentialDocIds[i] = sequentialDocId; sequentialDocId++; _sparseDocIds[i] = sparseDocId; sparseDocId += 5 + RANDOM.nextInt(6); _lastSequentialDocIds[i] = NUM_VALUES - NUM_DOC_IDS + i; } }

Target:
public void setUp() throws IOException { FileUtils.forceMkdir(INDEX_DIR); for (int i = 0; i < 32; i++) { int[] sequentialDocIds = new int[NUM_DOC_IDS]; _sequentialDocIds[i] = sequentialDocIds; for (int j = 0; j < NUM_DOC_IDS; j++) { sequentialDocIds[j] = i + j; } } int sparseDocId = RANDOM.nextInt(10); for (int i = 0; i < NUM_DOC_IDS; i++) { _sparseDocIds[i] = sparseDocId; sparseDocId += 5 + RANDOM.nextInt(6); _lastSequentialDocIds[i] = NUM_VALUES - NUM_DOC_IDS + i; } }
Source:
public void judgmentIndexingJob() throws Exception { Judgment firstJudgment = judgmentRepository.findOne(ccJudgments.get(1).getId()); firstJudgment.markAsIndexed(); judgmentRepository.save(firstJudgment); int alreadyIndexedCount = 1; JobExecution jobExecution = jobExecutor.forceStartNewJob(judgmentIndexingJob); JobExecutionAssertUtils.assertJobExecution(jobExecution, 0, ALL_JUDGMENTS_COUNT - alreadyIndexedCount); solrJudgmentsServer.commit(); assertAllMarkedAsIndexed(); assertAllInIndex(ALL_JUDGMENTS_COUNT - alreadyIndexedCount); assertCommonCourtJudgmentIndexed(ccJudgments.get(3)); assertCommonCourtJudgmentIndexed(ccJudgments.get(6)); assertSupremeCourtJudgmentIndexed(scJudgments.get(3)); assertSupremeCourtJudgmentIndexed(scJudgments.get(9)); assertConstitutionalTribunalJudgmentIndexed(ctJudgments.get(0)); }

Target:
public void judgmentIndexingJob() throws Exception { Judgment firstJudgment = judgmentRepository.findOne(ccJudgments.get(1).getId()); firstJudgment.markAsIndexed(); judgmentRepository.save(firstJudgment); int alreadyIndexedCount = 1; JobExecution jobExecution = jobExecutor.forceStartNewJob(judgmentIndexingJob); solrJudgmentsServer.commit(); JobExecutionAssertUtils.assertJobExecution(jobExecution, 0, ALL_JUDGMENTS_COUNT - alreadyIndexedCount); assertAllMarkedAsIndexed(); assertAllInIndex(ALL_JUDGMENTS_COUNT - alreadyIndexedCount); assertCommonCourtJudgmentIndexed(ccJudgments.get(3)); assertCommonCourtJudgmentIndexed(ccJudgments.get(6)); assertSupremeCourtJudgmentIndexed(scJudgments.get(3)); assertSupremeCourtJudgmentIndexed(scJudgments.get(9)); assertConstitutionalTribunalJudgmentIndexed(ctJudgments.get(0)); }
Source:
public SshKeyCacheEntryIterable(Iterable<SshKeyCacheEntry> sshKeyIter) { this.sshKeyIter = sshKeyIter; }

Target:
SshKeyCacheEntryIterable(Iterable<SshKeyCacheEntry> sshKeyIter) { this.sshKeyIter = sshKeyIter; }
Source:
private int getBucket(int count) { return (int) (Math.log(count) / Math.log(mLogBase)); }

Target:
private int getBucket(int count) { return (int) (Math.log(count) / mDivisor); }
Source:
public static void refreshEditor(AbstractDTableEditor tableEditor, IProgressMonitor theMonitor) { IProgressMonitor subMonitor = new SubProgressMonitor(theMonitor, 1); final IRunnableWithProgress op = new IRunnableWithProgress() { @Override public void run(final IProgressMonitor monitor) { TransactionalEditingDomain domain = tableEditor.getEditingDomain(); domain.getCommandStack().execute(new RefreshRepresentationsCommand(domain, monitor, tableEditor.getTableModel())); } }; final Shell activeShell = tableEditor.getSite().getShell(); final ProgressMonitorDialog monitorDialog = new ProgressMonitorDialog(activeShell); try { tableEditor.enablePropertiesUpdate(false); RefreshActionListenerRegistry.INSTANCE.notifyRepresentationIsAboutToBeRefreshed(tableEditor.getTableModel()); monitorDialog.run(true, false, op); subMonitor.worked(1); } catch (final InvocationTargetException e) { MessageDialog.openError(activeShell, Messages.Refresh_error, e.getTargetException().getMessage()); SiriusPlugin.getDefault().error(Messages.Refresh_errorDuringRefresh, e); } catch (final InterruptedException e) { MessageDialog.openInformation(activeShell, Messages.Refresh_cancelled, e.getMessage()); } finally { tableEditor.enablePropertiesUpdate(true); subMonitor.done(); } }

Target:
public static void refreshEditor(AbstractDTableEditor tableEditor, IProgressMonitor theMonitor) { theMonitor.beginTask("Refreshing", 1); IProgressMonitor subMonitor = new SubProgressMonitor(theMonitor, 1); final IRunnableWithProgress op = new IRunnableWithProgress() { @Override public void run(final IProgressMonitor monitor) { TransactionalEditingDomain domain = tableEditor.getEditingDomain(); domain.getCommandStack().execute(new RefreshRepresentationsCommand(domain, monitor, tableEditor.getTableModel())); } }; final Shell activeShell = tableEditor.getSite().getShell(); final ProgressMonitorDialog monitorDialog = new ProgressMonitorDialog(activeShell); try { tableEditor.enablePropertiesUpdate(false); RefreshActionListenerRegistry.INSTANCE.notifyRepresentationIsAboutToBeRefreshed(tableEditor.getTableModel()); monitorDialog.run(true, false, op); subMonitor.worked(1); } catch (final InvocationTargetException e) { MessageDialog.openError(activeShell, Messages.Refresh_error, e.getTargetException().getMessage()); SiriusPlugin.getDefault().error(Messages.Refresh_errorDuringRefresh, e); } catch (final InterruptedException e) { MessageDialog.openInformation(activeShell, Messages.Refresh_cancelled, e.getMessage()); } finally { tableEditor.enablePropertiesUpdate(true); subMonitor.done(); } }
Source:
public void should_not_change_other_organizations() throws Exception { OrganizationDto organization1 = OrganizationTesting.newOrganizationDto(); db.organizations().insert(organization1); OrganizationDto organization2 = OrganizationTesting.newOrganizationDto(); db.organizations().insert(organization2); userSessionRule .logIn() .addPermission(ADMINISTER_QUALITY_PROFILES, organization1.getUuid()); QualityProfileDto profileOrg1Old = QualityProfileTesting.newQualityProfileDto() .setOrganizationUuid(organization1.getUuid()) .setLanguage(xoo1Key) .setDefault(true); QualityProfileDto profileOrg1New = QualityProfileTesting.newQualityProfileDto() .setOrganizationUuid(organization1.getUuid()) .setLanguage(xoo1Key) .setDefault(false); QualityProfileDto profileOrg2 = QualityProfileTesting.newQualityProfileDto() .setOrganizationUuid(organization2.getUuid()) .setLanguage(xoo1Key) .setDefault(true); db.qualityProfiles().insertQualityProfiles(profileOrg1Old, profileOrg1New, profileOrg2); checkDefaultProfile(organization1, xoo1Key, profileOrg1Old.getKey()); checkDefaultProfile(organization2, xoo1Key, profileOrg2.getKey()); TestResponse response = tester.newRequest().setMethod("POST") .setParam("language", profileOrg1New.getLanguage()) .setParam("profileName", profileOrg1New.getName()) .setParam("organization", organization1.getKey()) .execute(); assertThat(response.getInput()).isEmpty(); assertThat(response.getStatus()).isEqualTo(204); checkDefaultProfile(organization1, xoo1Key, profileOrg1New.getKey()); checkDefaultProfile(organization2, xoo1Key, profileOrg2.getKee()); }

Target:
public void should_not_change_other_organizations() throws Exception { OrganizationDto organization1 = db.organizations().insert(); OrganizationDto organization2 = db.organizations().insert(); userSessionRule .logIn() .addPermission(ADMINISTER_QUALITY_PROFILES, organization1.getUuid()); QualityProfileDto profileOrg1Old = QualityProfileTesting.newQualityProfileDto() .setOrganizationUuid(organization1.getUuid()) .setLanguage(xoo1Key) .setDefault(true); QualityProfileDto profileOrg1New = QualityProfileTesting.newQualityProfileDto() .setOrganizationUuid(organization1.getUuid()) .setLanguage(xoo1Key) .setDefault(false); QualityProfileDto profileOrg2 = QualityProfileTesting.newQualityProfileDto() .setOrganizationUuid(organization2.getUuid()) .setLanguage(xoo1Key) .setDefault(true); db.qualityProfiles().insertQualityProfiles(profileOrg1Old, profileOrg1New, profileOrg2); checkDefaultProfile(organization1, xoo1Key, profileOrg1Old.getKey()); checkDefaultProfile(organization2, xoo1Key, profileOrg2.getKey()); TestResponse response = tester.newRequest().setMethod("POST") .setParam("language", profileOrg1New.getLanguage()) .setParam("profileName", profileOrg1New.getName()) .setParam("organization", organization1.getKey()) .execute(); assertThat(response.getInput()).isEmpty(); assertThat(response.getStatus()).isEqualTo(204); checkDefaultProfile(organization1, xoo1Key, profileOrg1New.getKey()); checkDefaultProfile(organization2, xoo1Key, profileOrg2.getKee()); }
Source:
public void createTransactionShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserCardService userCardService = adapter.create(UserCardService.class); userCardService.createTransaction("foobar", new TransactionRequest(new TransactionDenominationRequest("foo", "bar"), "bar"), new RetrofitPromise<Transaction>()); latch.await(); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/cards/%s/transactions", MOCK_URL, "foobar")); Assert.assertEquals(bodyRef.get().getMethod(), "POST"); }

Target:
public void createTransactionShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final UserCardService userCardService = adapter.create(UserCardService.class); userCardService.createTransaction("foobar", new TransactionRequest(new TransactionDenominationRequest("foo", "bar"), "bar"), new RetrofitPromise<Transaction>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "POST"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/me/cards/%s/transactions", MOCK_URL, "foobar")); }
Source:
public List<PictureView> computeViewsFor(DocumentModel doc, Blob blob, ImageInfo imageInfo, boolean convert) { List<PictureConversion> pictureConversions = getPictureConversions(); List<PictureView> pictureViews = new ArrayList<>(pictureConversions.size()); for (PictureConversion pictureConversion : pictureConversions) { if (canApplyPictureConversion(pictureConversion, doc)) { try { PictureView pictureView = computeView(doc, blob, pictureConversion, imageInfo, convert); pictureViews.add(pictureView); } catch (NuxeoException e) { log.warn("Unable to compute view: for: {}: {}", pictureConversion::getId, doc::toString, e::getMessage); log.debug(e, e); } } } return pictureViews; }

Target:
public List<PictureView> computeViewsFor(DocumentModel doc, Blob blob, ImageInfo imageInfo, boolean convert) { List<PictureConversion> pictureConversions = getPictureConversions(); List<PictureView> pictureViews = new ArrayList<>(pictureConversions.size()); for (PictureConversion pictureConversion : pictureConversions) { if (canApplyPictureConversion(pictureConversion, doc)) { try { PictureView pictureView = computeView(doc, blob, pictureConversion, imageInfo, convert); pictureViews.add(pictureView); } catch (NuxeoException e) { log.warn("Unable to compute view: for document: exception message: {}", pictureConversion::getId, doc::toString, e::getMessage); log.debug(e, e); } } } return pictureViews; }
Source:
public static void resetRollingFileAppender(String pipeline, String rev, String suffix) { String loggerName = getLoggerName(pipeline, rev, suffix); Logger logger =Logger.getLogger(loggerName); Appender appender = logger.getAppender(loggerName); logger.removeAppender(loggerName); appender.close(); }

Target:
public static void resetRollingFileAppender(String pipeline, String rev, String suffix) { String loggerName = getLoggerName(pipeline, rev, suffix); Logger logger =Logger.getLogger(loggerName); Appender appender = logger.getAppender(loggerName); logger.removeAppender(appender); appender.close(); }
Source:
protected void validate() { if (!PlannerBenchmarkConfig.VALID_NAME_PATTERN.matcher(name).matches()) { throw new IllegalStateException("The solverBenchmark name (" + name + ") is invalid because it does not follow the nameRegex (" + PlannerBenchmarkConfig.VALID_NAME_PATTERN.pattern() + ")" + " which might cause an illegal filename."); } if (!name.trim().equals(name)) { throw new IllegalStateException("The solverBenchmark name (" + name + ") is invalid because it starts or ends with whitespace."); } if (subSingleCount == null || subSingleCount < 1) { throw new IllegalStateException("The solverBenchmark name (" + name + ") is invalid because the subSingleCount (" + subSingleCount + ") must be greater than 1."); } }

Target:
protected void validate() { if (!PlannerBenchmarkConfig.VALID_NAME_PATTERN.matcher(name).matches()) { throw new IllegalStateException("The solverBenchmark name (" + name + ") is invalid because it does not follow the nameRegex (" + PlannerBenchmarkConfig.VALID_NAME_PATTERN.pattern() + ")" + " which might cause an illegal filename."); } if (!name.trim().equals(name)) { throw new IllegalStateException("The solverBenchmark name (" + name + ") is invalid because it starts or ends with whitespace."); } if (subSingleCount != null && subSingleCount < 1) { throw new IllegalStateException("The solverBenchmark name (" + name + ") is invalid because the subSingleCount (" + subSingleCount + ") must be greater than 1."); } }
Source:
public String getString(String key, String defaultValue) { Object value = getRawProperty(key); if (value == null) { return notFound(key, defaultValue != null ? interpolator.create(getLookup()).resolve(defaultValue) : null); } if (value instanceof String) { return resolve(value.toString()); } else { return value.toString(); } }

Target:
public String getString(String key, String defaultValue) { Object value = getRawProperty(key); if (value == null) { return notFound(key, defaultValue != null ? interpolator.create(getLookup()).resolve(defaultValue) : null); } if (value instanceof String) { return resolve((String)value); } else { return value.toString(); } }
Source:
public ConfigLocation getConfigLocation() { Iterable<ConfigLocation> locations; locations = configLocationFileStore.getAll(); StringBuilder sb = new StringBuilder(""); for (ConfigLocation configLocation : locations) { sb.append(configLocation.getLocation()).append(' '); Resource configLocationResource = configLocation.toResource(); try { Resource motechSettings; motechSettings = configLocationResource.createRelative(ConfigurationConstants.SETTINGS_FILE_NAME); if (motechSettings.isReadable() && locations != null) { return configLocation; } LOGGER.warn("Could not read motech-settings.properties from: " + configLocationResource.toString()); } catch (IOException e) { LOGGER.warn("Problem reading motech-settings.properties from location: " + configLocationResource.toString(), e); } } throw new MotechConfigurationException(String.format("Could not read settings from any of the config locations. Searched directories: %s.", sb)); }

Target:
public ConfigLocation getConfigLocation() { Iterable<ConfigLocation> locations = configLocationFileStore.getAll(); StringBuilder sb = new StringBuilder(""); for (ConfigLocation configLocation : locations) { sb.append(configLocation.getLocation()).append(' '); Resource configLocationResource = configLocation.toResource(); try { Resource motechSettings = configLocationResource.createRelative(ConfigurationConstants.SETTINGS_FILE_NAME); if (motechSettings.isReadable() && locations != null) { return configLocation; } LOGGER.warn("Could not read motech-settings.properties from: " + configLocationResource.toString()); } catch (IOException e) { LOGGER.warn("Problem reading motech-settings.properties from location: " + configLocationResource.toString(), e); } } throw new MotechConfigurationException(String.format("Could not read settings from any of the config locations. Searched directories: %s.", sb)); }
Source:
public ProcessorExpressionRoute(String expression, Processor processor) { super(processor); requireNonNull(expression, "expression can't be null"); this.expression = expression; }

Target:
public ProcessorExpressionRoute(String expression, Processor processor) { super(processor); this.expression = requireNonNull(expression, "expression can't be null"); }
Source:
public Statement build() { final Map<String, Object> parameters = new HashMap<>(); final StringBuilder queryBuilder = new StringBuilder(); Edge firstEdge = deletedEdges.iterator().next(); if (deletedEdges != null && deletedEdges.size() > 0) { queryBuilder.append("UNWIND {rows} AS row MATCH ()-[r]-() WHERE ID(r) = row.relId "); if (firstEdge.hasVersionProperty()) { queryBuilder.append("AND r.`") .append(firstEdge.getVersion().getKey()) .append("` = row.version SET r.`") .append(firstEdge.getVersion().getKey()) .append("` = r.`") .append(firstEdge.getVersion().getKey()) .append("` + 1 WITH r,row WHERE r.`") .append(firstEdge.getVersion().getKey()) .append("` = row.version + 1 "); } queryBuilder.append("DELETE r RETURN ID(r) as ref, ID(r) as id, {type} as type"); List<Map> rows = new ArrayList<>(); for (Edge edge : deletedEdges) { Map<String, Object> rowMap = new HashMap<>(); rowMap.put("relId", edge.getId()); if (edge.hasVersionProperty()) { Property version = edge.getVersion(); rowMap.put((String) version.getKey(), version.getValue()); } rows.add(rowMap); } parameters.put("rows", rows); parameters.put("type", "rel"); } if (firstEdge.hasVersionProperty()) { return statementFactory.statement(queryBuilder.toString(), parameters, true, deletedEdges.size()); } else { return statementFactory.statement(queryBuilder.toString(), parameters); } }

Target:
public Statement build() { final Map<String, Object> parameters = new HashMap<>(); final StringBuilder queryBuilder = new StringBuilder(); Edge firstEdge = deletedEdges.iterator().next(); if (deletedEdges != null && deletedEdges.size() > 0) { queryBuilder.append("UNWIND {rows} AS row MATCH ()-[r]-() WHERE ID(r) = row.relId "); if (firstEdge.hasVersionProperty()) { appendVersionPropertyCheck(queryBuilder, firstEdge, "r"); } queryBuilder.append("DELETE r RETURN ID(r) as ref, ID(r) as id, {type} as type"); List<Map> rows = new ArrayList<>(); for (Edge edge : deletedEdges) { Map<String, Object> rowMap = new HashMap<>(); rowMap.put("relId", edge.getId()); if (edge.hasVersionProperty()) { Property version = edge.getVersion(); rowMap.put((String) version.getKey(), version.getValue()); } rows.add(rowMap); } parameters.put("rows", rows); parameters.put("type", "rel"); if (firstEdge.hasVersionProperty()) { OptimisticLockingConfig olConfig = new OptimisticLockingConfig(rows.size(), new String[] { firstEdge.getType() }, firstEdge.getVersion().getKey()); return statementFactory.statement(queryBuilder.toString(), parameters, olConfig); } } return statementFactory.statement(queryBuilder.toString(), parameters); }
Source:
public QualityProfileDto selectByNameAndLanguage(String name, String language, DbSession session) { return mapper(session).selectByNameAndLanguage(name, language); }

Target:
public QualityProfileDto selectByNameAndLanguage(String name, String language, DbSession session) { return mapper(session).selectByNameAndLanguage(null, name, language); }
Source:
private void advance() { while ((currentIterator == null || !currentIterator.hasNext()) && this.intervals.hasNext()) { if (currentIterator != null) currentCloseableIterator.close(); final Interval interval = this.intervals.next(); final Interval previousInterval = this.lastInterval; this.currentCloseableIterator = this.reader.query(interval.getContig(), interval.getStart(), interval.getEnd()); this.currentIterator = this.currentCloseableIterator.stream().filter ( ctx -> overlapsInterval(ctx, interval) && (null == previousInterval || !overlapsInterval(ctx, previousInterval)) ).iterator(); this.lastInterval = interval; } }

Target:
private void advance() { while ((currentIterator == null || !currentIterator.hasNext()) && this.intervals.hasNext()) { if (currentIterator != null) currentCloseableIterator.close(); final Interval interval = this.intervals.next(); final Interval previousInterval = this.lastInterval; this.currentCloseableIterator = this.reader.query(interval.getContig(), interval.getStart(), interval.getEnd()); this.currentIterator = this.currentCloseableIterator.stream().filter ( ctx -> null == previousInterval || !overlapsInterval(ctx, previousInterval) ).iterator(); this.lastInterval = interval; } }
Source:
public Edge(V from, V to, E label) { this.from = from; this.to = to; this.label = label; }

Target:
public Edge(V from, V to, E label) { fFrom = from; fTo = to; fLabel = label; }
Source:
public void evaluateRunnable(ThrowableRunnable<Throwable> runnable, ThrowableRunnable<Throwable> finisher) throws Throwable { Throwable error = null; try { runnable.run(); } catch (Throwable t) { error = t; } finally { try { finisher.run(); } catch (Throwable t) { if (error != null) { error.addSuppressed(t); } else { error = t; } } finally { if (error != null) { throw error; } } } }

Target:
public void evaluateRunnable(ThrowableRunnable<Throwable> runnable, ThrowableRunnable<Throwable> finisher) throws Throwable { Throwable error = null; try { runnable.run(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeServiceException(e); } catch (Throwable t) { throwSeriousError(t); error = t; } try { finisher.run(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeServiceException(e); } catch (Throwable t) { throwSeriousError(t); if (error == null) { error = t; } else { error.addSuppressed(t); } } if (error != null) { throw error; } }