auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void whenFirstCursorIsNotCommittedThenNextCursorsAreNotSkipped() throws Exception { final NakadiCursor c1 = new NakadiCursor(timeline, P1, OLDEST_OFFSET); final NakadiCursor c2 = new NakadiCursor(timeline, P2, NEW_OFFSET); testCursors = ImmutableList.of(c1, c2); final List<Boolean> result = cursorsService.commitCursors(streamId, sid, testCursors); assertEquals(Boolean.FALSE, result.get(0)); assertEquals(Boolean.TRUE, result.get(1)); checkCurrentOffsetInZk(P1, OLD_OFFSET); checkCurrentOffsetInZk(P2, NEW_OFFSET); }

Target:
public void whenFirstCursorIsNotCommittedThenNextCursorsAreNotSkipped() throws Exception { final NakadiCursor c1 = new NakadiCursor(timeline, P1, OLDEST_OFFSET); final NakadiCursor c2 = new NakadiCursor(timeline, P2, NEW_OFFSET); testCursors = ImmutableList.of(c1, c2); final List<Boolean> result = cursorsService.commitCursors(streamId, sid, testCursors); assertFalse(result.get(0)); assertTrue(result.get(1)); checkCurrentOffsetInZk(P1, OLD_OFFSET); checkCurrentOffsetInZk(P2, NEW_OFFSET); }
Source:
public IValue getValue(IASTNode point) { if (isValueDependent()) return IntegralValue.create(this); if (isTypeDependent()) return IntegralValue.create(this); if (fRepresentsNewExpression) return IntegralValue.UNKNOWN; if (fInputType instanceof ICPPClassType) { ICPPClassType classType = (ICPPClassType)fInputType; IBinding ctor = getConstructor(null); if(EvalUtil.isCompilerGeneratedCtor(ctor)) { return CompositeValue.create(classType); } else { EvalConstructor evalCtor = new EvalConstructor(classType, (ICPPConstructor)ctor, fArguments, getTemplateDefinition()); ICPPEvaluation computedEvalCtor = evalCtor.computeForFunctionCall(new ActivationRecord(), new ConstexprEvaluationContext(point)); return computedEvalCtor.getValue(point); } } if (fArguments.length == 0 || isEmptyInitializerList(fArguments)) { if (fInputType instanceof ICPPBasicType) { switch(((ICPPBasicType) fInputType).getKind()) { case eInt: case eInt128: case eDouble: case eBoolean: case eFloat: case eFloat128: case eNullPtr: return IntegralValue.create(0l); case eChar: case eChar16: case eChar32: case eUnspecified: case eVoid: case eWChar: default: return IntegralValue.UNKNOWN; } } } if (fArguments.length == 1) { return fArguments[0].getValue(point); } return IntegralValue.UNKNOWN; }

Target:
public IValue getValue(IASTNode point) { if (isValueDependent()) return IntegralValue.create(this); if (isTypeDependent()) return IntegralValue.create(this); if (fRepresentsNewExpression) return IntegralValue.UNKNOWN; if (fInputType instanceof ICPPClassType) { ICPPClassType classType = (ICPPClassType)fInputType; IBinding ctor = getConstructor(null); if(EvalUtil.isCompilerGeneratedCtor(ctor)) { return CompositeValue.create(classType); } else if (ctor == AGGREGATE_INITIALIZATION) { return IntegralValue.UNKNOWN; } else if (ctor != null) { EvalConstructor evalCtor = new EvalConstructor(classType, (ICPPConstructor)ctor, fArguments, getTemplateDefinition()); ICPPEvaluation computedEvalCtor = evalCtor.computeForFunctionCall(new ActivationRecord(), new ConstexprEvaluationContext(point)); return computedEvalCtor.getValue(point); } else { return IntegralValue.ERROR; } } if (fArguments.length == 0 || isEmptyInitializerList(fArguments)) { if (fInputType instanceof ICPPBasicType) { switch(((ICPPBasicType) fInputType).getKind()) { case eInt: case eInt128: case eDouble: case eBoolean: case eFloat: case eFloat128: case eNullPtr: return IntegralValue.create(0l); case eChar: case eChar16: case eChar32: case eUnspecified: case eVoid: case eWChar: default: return IntegralValue.UNKNOWN; } } } if (fArguments.length == 1) { return fArguments[0].getValue(point); } return IntegralValue.UNKNOWN; }
Source:
public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof RefreshType) { updateChannel(channelUID.getId()); } else { logger.info("The Weather Underground binding is a read-only binding and can not handle command {}", command); } }

Target:
public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof RefreshType) { updateChannel(channelUID.getId()); } else { logger.debug("The Weather Underground binding is a read-only binding and cannot handle command {}", command); } }
Source:
public void onAccountChanged(OnAccountChanged event) { if (event.isError()) { if (mIsUpdatingDisplayName) { mIsUpdatingDisplayName = false; AnalyticsTracker.track(mIsEmailSignup ? AnalyticsTracker.Stat.SIGNUP_EMAIL_EPILOGUE_UPDATE_DISPLAY_NAME_FAILED : AnalyticsTracker.Stat.SIGNUP_SOCIAL_EPILOGUE_UPDATE_DISPLAY_NAME_FAILED); } else if (mIsUpdatingPassword) { mIsUpdatingPassword = false; } AppLog.e(T.API, "SignupEpilogueFragment.onAccountChanged: " + event.error.type + " - " + event.error.message); endProgress(); if (isPasswordInErrorMessage(event.error.message)) { showErrorDialogWithCloseButton(event.error.message); } else { showErrorDialog(getString(R.string.signup_epilogue_error_generic)); } } else if (mIsEmailSignup && event.causeOfChange == AccountAction.FETCH_ACCOUNT && !TextUtils.isEmpty(mAccountStore.getAccount().getEmail())) { endProgress(); populateViews(); } else if (event.causeOfChange == AccountAction.PUSH_SETTINGS && mSignupEpilogueListener != null) { mHasMadeUpdates = true; if (mIsUpdatingDisplayName) { mIsUpdatingDisplayName = false; AnalyticsTracker.track(mIsEmailSignup ? AnalyticsTracker.Stat.SIGNUP_EMAIL_EPILOGUE_UPDATE_DISPLAY_NAME_SUCCEEDED : AnalyticsTracker.Stat.SIGNUP_SOCIAL_EPILOGUE_UPDATE_DISPLAY_NAME_SUCCEEDED); } else if (mIsUpdatingPassword) { mIsUpdatingPassword = false; mHasUpdatedPassword = true; } updateAccountOrContinue(); } }

Target:
public void onAccountChanged(OnAccountChanged event) { if (event.isError()) { if (mIsUpdatingDisplayName) { mIsUpdatingDisplayName = false; AnalyticsTracker.track(mIsEmailSignup ? AnalyticsTracker.Stat.SIGNUP_EMAIL_EPILOGUE_UPDATE_DISPLAY_NAME_FAILED : AnalyticsTracker.Stat.SIGNUP_SOCIAL_EPILOGUE_UPDATE_DISPLAY_NAME_FAILED); } else if (mIsUpdatingPassword) { mIsUpdatingPassword = false; } AppLog.e(T.API, "SignupEpilogueFragment.onAccountChanged: " + event.error.type + " - " + event.error.message); endProgress(); if (isPasswordInErrorMessage(event.error.message)) { showErrorDialogWithCloseButton(event.error.message); } else { showErrorDialog(getString(R.string.signup_epilogue_error_generic)); } } else if (mIsEmailSignup && event.causeOfChange == AccountAction.FETCH_ACCOUNT && !TextUtils.isEmpty(mAccountStore.getAccount().getEmail())) { endProgress(); populateViews(); } else if (event.causeOfChange == AccountAction.PUSH_SETTINGS) { mHasMadeUpdates = true; if (mIsUpdatingDisplayName) { mIsUpdatingDisplayName = false; AnalyticsTracker.track(mIsEmailSignup ? AnalyticsTracker.Stat.SIGNUP_EMAIL_EPILOGUE_UPDATE_DISPLAY_NAME_SUCCEEDED : AnalyticsTracker.Stat.SIGNUP_SOCIAL_EPILOGUE_UPDATE_DISPLAY_NAME_SUCCEEDED); } else if (mIsUpdatingPassword) { mIsUpdatingPassword = false; mHasUpdatedPassword = true; } updateAccountOrContinue(); } }
Source:
public ChannelFuture writeSettingsAck(ChannelHandlerContext ctx, ChannelPromise promise) { if (outstandingRemoteSettingsQueue == null) { return frameWriter.writeSettingsAck(ctx, promise); } SimpleChannelPromiseAggregator aggregator = new SimpleChannelPromiseAggregator(promise, ctx.channel(), ctx.executor()); frameWriter.writeSettingsAck(ctx, aggregator); Http2Settings settings = outstandingRemoteSettingsQueue.poll(); if (settings == null) { aggregator.setFailure(connectionError(PROTOCOL_ERROR, "SETTINGS ACK sent with no pending SETTINGS frame")); } else { try { remoteSettings(settings); } catch (Throwable e) { aggregator.setFailure(e); lifecycleManager.onError(ctx, true, e); } } return aggregator.doneAllocatingPromises(); }

Target:
public ChannelFuture writeSettingsAck(ChannelHandlerContext ctx, ChannelPromise promise) { if (outstandingRemoteSettingsQueue == null) { return frameWriter.writeSettingsAck(ctx, promise); } Http2Settings settings = outstandingRemoteSettingsQueue.poll(); if (settings == null) { return promise.setFailure(new Http2Exception(INTERNAL_ERROR, "attempted to write a SETTINGS ACK with no " + " pending SETTINGS")); } SimpleChannelPromiseAggregator aggregator = new SimpleChannelPromiseAggregator(promise, ctx.channel(), ctx.executor()); frameWriter.writeSettingsAck(ctx, aggregator); ChannelPromise applySettingsPromise = aggregator.newPromise(); try { remoteSettings(settings); applySettingsPromise.setSuccess(); } catch (Throwable e) { applySettingsPromise.setFailure(e); lifecycleManager.onError(ctx, true, e); } return aggregator.doneAllocatingPromises(); }
Source:
private void setupGetExistingSensorTest(final Metrics metrics, final String level) { final String fullSensorName = INTERNAL_PREFIX + SENSOR_PREFIX_DELIMITER + level + SENSOR_NAME_DELIMITER + sensorName1; expect(metrics.getSensor(fullSensorName)).andStubReturn(sensor); replay(metrics); }

Target:
private void setupGetExistingSensorTest(final Metrics metrics, final String level) { final String fullSensorName = fullSensorName(level); expect(metrics.getSensor(fullSensorName)).andStubReturn(sensor); replay(metrics); }
Source:
protected TmfAbstractAnalysisModule createStatisticsAnalysiModule() { SystemCallLatencyStatisticsAnalysisModule module = new SystemCallLatencyStatisticsAnalysisModule(); return module; }

Target:
protected @Nullable TmfAbstractAnalysisModule createStatisticsAnalysiModule() { SystemCallLatencyStatisticsAnalysisModule module = new SystemCallLatencyStatisticsAnalysisModule(); return module; }
Source:
private AllowUpdate isUpdateFromClientAllowedByFilter(StateNode node, String key, boolean log) { if (node.hasFeature(ElementPropertyMap.class)) { ElementPropertyMap propertyMap = node .getFeature(ElementPropertyMap.class); if (propertyMap.updateFromClientFilter != null) { boolean allow = propertyMap.updateFromClientFilter.test(key); if (!allow && log) { getLogger().warn("Ignoring model update for {}. " + "For security reasons, the property must have a " + "two-way binding in the template, be annotated with @{} in the model, or be defined as synchronized.", key, ALLOW_CLIENT_UPDATES_POLYMER); } return allow ? AllowUpdate.EXPLICITLY_ALLOW : AllowUpdate.EXPLICITLY_DISALLOW; } } StateNode parent = node.getParent(); if (parent == null) { return AllowUpdate.NO_EXPLICIT_STATUS; } if (parent.hasFeature(ElementPropertyMap.class)) { ElementPropertyMap parentMap = parent .getFeature(ElementPropertyMap.class); Optional<String> parentProperty = parentMap.getPropertyNames() .filter(property -> node.equals(parentMap.get(property))) .findFirst(); if (parentProperty.isPresent()) { String property = new StringBuilder(parentProperty.get()) .append('.').append(key).toString(); return isUpdateFromClientAllowedByFilter(parent, property, log); } } if (parent.hasFeature(ModelList.class)) { ModelList list = parent.getFeature(ModelList.class); if (list.contains(node)) { return isUpdateFromClientAllowedByFilter(parent, key, log); } } return AllowUpdate.NO_EXPLICIT_STATUS; }

Target:
private AllowUpdate isUpdateFromClientAllowedByFilter(StateNode node, String key, boolean log) { if (node.hasFeature(ElementPropertyMap.class)) { ElementPropertyMap propertyMap = node .getFeature(ElementPropertyMap.class); if (propertyMap.updateFromClientFilter != null) { boolean allow = propertyMap.updateFromClientFilter.test(key); if (!allow && log) { getLogger().warn("Ignoring model update for {}. " + "For security reasons, the property must have a " + "two-way binding in the template, be annotated" + " with @AllowClientUpdates in the model, or be defined as synchronized.", key); } return allow ? AllowUpdate.EXPLICITLY_ALLOW : AllowUpdate.EXPLICITLY_DISALLOW; } } StateNode parent = node.getParent(); if (parent == null) { return AllowUpdate.NO_EXPLICIT_STATUS; } if (parent.hasFeature(ElementPropertyMap.class)) { ElementPropertyMap parentMap = parent .getFeature(ElementPropertyMap.class); Optional<String> parentProperty = parentMap.getPropertyNames() .filter(property -> node.equals(parentMap.get(property))) .findFirst(); if (parentProperty.isPresent()) { String property = new StringBuilder(parentProperty.get()) .append('.').append(key).toString(); return isUpdateFromClientAllowedByFilter(parent, property, log); } } if (parent.hasFeature(ModelList.class)) { ModelList list = parent.getFeature(ModelList.class); if (list.contains(node)) { return isUpdateFromClientAllowedByFilter(parent, key, log); } } return AllowUpdate.NO_EXPLICIT_STATUS; }
Source:
private Object createLogMessage(Message<?> message) { Assert.notNull(this.expression, "'expression' must not be null"); Assert.notNull(this.evaluationContext, "'evaluationContext' must not be null"); Object logMessage = this.expression.getValue(this.evaluationContext, message); return logMessage instanceof Throwable ? createLogMessage((Throwable) logMessage) : logMessage; }

Target:
private Object createLogMessage(Message<?> message) { Object logMessage = this.expression.getValue(this.evaluationContext, message); return logMessage instanceof Throwable ? createLogMessage((Throwable) logMessage) : logMessage; }
Source:
public void setRouteOverlay(int lineOverlayColor, ObaShape[] shapes, boolean clear) { if (mMap != null) { if (clear) mLineOverlay.clear(); PolylineOptions lineOptions; int totalPoints = 0; for (ObaShape s : shapes) { lineOptions = new PolylineOptions(); lineOptions.color(lineOverlayColor); for (Location l : s.getPoints()) { lineOptions.add(MapHelpV2.makeLatLng(l)); } mLineOverlay.add(mMap.addPolyline(lineOptions)); totalPoints += lineOptions.getPoints().size(); } Log.d(TAG, "Total points for route polylines = " + totalPoints); } }

Target:
public void setRouteOverlay(int lineOverlayColor, ObaShape[] shapes, boolean clear) { if (mMap != null) { if (clear) { mLineOverlay.clear(); } PolylineOptions lineOptions; int totalPoints = 0; for (ObaShape s : shapes) { lineOptions = new PolylineOptions(); lineOptions.color(lineOverlayColor); for (Location l : s.getPoints()) { lineOptions.add(MapHelpV2.makeLatLng(l)); } mLineOverlay.add(mMap.addPolyline(lineOptions)); totalPoints += lineOptions.getPoints().size(); } Log.d(TAG, "Total points for route polylines = " + totalPoints); } }
Source:
private static String toString(InputStream inputStream) throws IOException { final int bufferSize = 1024; final char[] buffer = new char[bufferSize]; final StringBuilder out = new StringBuilder(); Reader in = new InputStreamReader(inputStream, "UTF-8"); for (; ; ) { int rsz = in.read(buffer, 0, buffer.length); if (rsz < 0){ break; } out.append(buffer, 0, rsz); } return out.toString(); }

Target:
private static String toString(InputStream inputStream) throws IOException { char[] buffer = new char[1024]; StringBuilder out = new StringBuilder(); Reader in = new InputStreamReader(inputStream, UTF_8); for (int rsz; (rsz = in.read(buffer, 0, buffer.length)) >= 0;) { out.append(buffer, 0, rsz); } return out.toString(); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((LVER == null) ? 0 : LVER.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((comment == null) ? 0 : comment.hashCode()); result = prime * result + ((compatibilityVersion == null) ? 0 : compatibilityVersion.hashCode()); result = prime * result + masterDomainVersion; result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((recovery_mode == null) ? 0 : recovery_mode.hashCode()); result = prime * result + ((spmVdsId == null) ? 0 : spmVdsId.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((storagePoolFormatType == null) ? 0 : storagePoolFormatType.hashCode()); result = prime * result + ((quotaEnforcementType == null) ? 0 : quotaEnforcementType.hashCode()); return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((LVER == null) ? 0 : LVER.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((comment == null) ? 0 : comment.hashCode()); result = prime * result + ((compatibilityVersion == null) ? 0 : compatibilityVersion.hashCode()); result = prime * result + masterDomainVersion; result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((recovery_mode == null) ? 0 : recovery_mode.hashCode()); result = prime * result + ((spmVdsId == null) ? 0 : spmVdsId.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + (isLocal ? 1231 : 1237); result = prime * result + ((storagePoolFormatType == null) ? 0 : storagePoolFormatType.hashCode()); result = prime * result + ((quotaEnforcementType == null) ? 0 : quotaEnforcementType.hashCode()); return result; }
Source:
public Color getBackground(Object element, int columnIndex) { String legendItemText = (String) element; if (legendItemText.equals("Population > 1,000,000")) { return Display.getCurrent().getSystemColor(SWT.COLOR_RED); } else if (legendItemText.equals("Population > 500,000")) { return Display.getCurrent().getSystemColor(SWT.COLOR_GRAY); } else if (legendItemText.equals("Population > 250,000")) { return Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW); } else if (legendItemText.equals("Population > 50,000")) { return Display.getCurrent().getSystemColor(SWT.COLOR_BLUE); } else if (legendItemText.equals("Population > 25,000")) { return Display.getCurrent().getSystemColor(SWT.COLOR_GREEN); } else if (legendItemText.equals("Population > 5000")) { return Display.getCurrent().getSystemColor(SWT.COLOR_CYAN); } else if (legendItemText.equals("Population <= 5000")) { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } return null; }

Target:
public Color getBackground(Object element, int columnIndex) { String legendItemText = (String) element; Display display = Display.getCurrent(); if (legendItemText.equals("Population > 1,000,000")) { return display.getSystemColor(SWT.COLOR_RED); } else if (legendItemText.equals("Population > 500,000")) { return display.getSystemColor(SWT.COLOR_GRAY); } else if (legendItemText.equals("Population > 250,000")) { return display.getSystemColor(SWT.COLOR_YELLOW); } else if (legendItemText.equals("Population > 50,000")) { return display.getSystemColor(SWT.COLOR_BLUE); } else if (legendItemText.equals("Population > 25,000")) { return display.getSystemColor(SWT.COLOR_GREEN); } else if (legendItemText.equals("Population > 5000")) { return display.getSystemColor(SWT.COLOR_CYAN); } else if (legendItemText.equals("Population <= 5000")) { return display.getSystemColor(SWT.COLOR_WHITE); } return null; }
Source:
public <E> CacheQuery<E> buildLuceneQuery(IckleParsingResult<TypeMetadata> ickleParsingResult, Map<String, Object> namedParameters, long startOffset, int maxResults, IndexedQueryMode queryMode) { CacheQuery<E> cacheQuery = (CacheQuery<E>) makeCacheQuery(ickleParsingResult, queryMode, namedParameters); if (startOffset >= 0) { cacheQuery = cacheQuery.firstResult((int) startOffset); } if (maxResults > 0) { cacheQuery = cacheQuery.maxResults(maxResults); } return cacheQuery; }

Target:
public <E> IndexedQuery<E> buildLuceneQuery(IckleParsingResult<TypeMetadata> ickleParsingResult, Map<String, Object> namedParameters, long startOffset, int maxResults, IndexedQueryMode queryMode) { if (log.isDebugEnabled()) { log.debugf("Building Lucene query for : %s", ickleParsingResult.getQueryString()); } if (!isIndexed) { throw CONTAINER.cannotRunLuceneQueriesIfNotIndexed(cache.getName()); } SearchQueryBuilder searchQuery = transformParsingResult(ickleParsingResult, namedParameters); if (queryMode == null) queryMode = detectQueryMode(); IndexedQuery<?> cacheQuery = makeCacheQuery(ickleParsingResult, searchQuery, queryMode, namedParameters); if (startOffset >= 0) { cacheQuery = (IndexedQuery<?>) cacheQuery.firstResult((int) startOffset); } if (maxResults > 0) { cacheQuery = (IndexedQuery<?>) cacheQuery.maxResults(maxResults); } return (IndexedQuery<E>) cacheQuery; }
Source:
public void notifyAllLifespansFinishedExecution() { checkState(groupedExecution); state = State.FINISHED; splitSource.close(); whenFinishedOrNewLifespanAdded.set(null); }

Target:
public synchronized void notifyAllLifespansFinishedExecution() { checkState(groupedExecution); state = State.FINISHED; splitSource.close(); whenFinishedOrNewLifespanAdded.set(null); }
Source:
public Object getEvent(){ return event; }

Target:
public SCMEvent getEvent(){ return event; }
Source:
public final long doLong(final long receiver, final long right) { assert right >= 0; if (Long.SIZE - Long.numberOfLeadingZeros(receiver) + right > Long.SIZE - 1) { CompilerDirectives.transferToInterpreter(); throw new ArithmeticException("shift overflows long"); } return receiver << right; }

Target:
public final long doLong(final long receiver, final long right) { assert right >= 0; if (Long.SIZE - Long.numberOfLeadingZeros(receiver) + right > Long.SIZE - 1) { CompilerDirectives.transferToInterpreterAndInvalidate(); throw new ArithmeticException("shift overflows long"); } return receiver << right; }
Source:
private void addMarkers() { Icon lightningBoltIcon = IconFactory.getInstance(MatrixApiActivity.this) .fromResource(R.drawable.lightning_bolt); for (com.mapbox.geojson.Feature feature : featureCollection.features()) { mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(feature.getProperty("Latitude").getAsDouble(), feature.getProperty("Longitude").getAsDouble())) .snippet(feature.getStringProperty("Station_Name")) .icon(lightningBoltIcon)); } }

Target:
private void addMarkers() { Icon lightningBoltIcon = IconFactory.getInstance(MatrixApiActivity.this) .fromResource(R.drawable.lightning_bolt); for (Feature feature : featureCollection.features()) { mapboxMap.addMarker(new MarkerOptions() .position(new LatLng(feature.getProperty("Latitude").getAsDouble(), feature.getProperty("Longitude").getAsDouble())) .snippet(feature.getStringProperty("Station_Name")) .icon(lightningBoltIcon)); } }
Source:
private List<SimpleInterval> prepareTargetSegments(final Genome genome, final List<ModeledSegment> targetSegmentsWithCalls) { final List<SimpleInterval> targetSegmentsUnfixed; if (!useAllCopyRatioSegments) { logger.info("Merging copy-neutral and uncalled target-coverage segments..."); targetSegmentsUnfixed = SegmentMergeUtils.mergeNeutralSegments(targetSegmentsWithCalls); logger.info("Number of segments after copy-neutral merging: " + targetSegmentsUnfixed.size()); } else { targetSegmentsUnfixed = targetSegmentsWithCalls.stream().map(ModeledSegment::getSimpleInterval) .collect(Collectors.toList()); } return SegmentUtils.fixTargetSegmentStarts(targetSegmentsUnfixed, genome.getTargets()); }

Target:
private List<SimpleInterval> prepareTargetSegments(final Genome genome, final List<ModeledSegment> targetSegmentsWithCalls) { final List<SimpleInterval> targetSegmentsWithUnfixedStarts; if (!useAllCopyRatioSegments) { logger.info("Merging copy-neutral and uncalled target-coverage segments..."); targetSegmentsWithUnfixedStarts = SegmentMergeUtils.mergeNeutralSegments(targetSegmentsWithCalls); logger.info("Number of segments after copy-neutral merging: " + targetSegmentsWithUnfixedStarts.size()); } else { targetSegmentsWithUnfixedStarts = targetSegmentsWithCalls.stream().map(ModeledSegment::getSimpleInterval) .collect(Collectors.toList()); } return SegmentUtils.fixTargetSegmentStarts(targetSegmentsWithUnfixedStarts, genome.getTargets()); }
Source:
private void turnTheRadioOn(Thing radioThing) { radioHandler.handleCommand(radioThing.getChannel(FSInternetRadioBindingConstants.CHANNEL_POWER).getUID(), OnOffType.ON); FrontierSiliconRadio radio; try { Field f = radioHandler.getClass().getDeclaredField("radio"); f.setAccessible(true); radio = (FrontierSiliconRadio) f.get(radioHandler); } catch (IllegalStateException | NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) { throw new IllegalStateException("Cannot access radio per reflection.", ex); } waitForAssert(() -> { try { assertThat("The radio was not turned on successfully", radio.getPower(), is(true)); } catch (IOException ex) { throw new AssertionError("I/O error", ex); } }); }

Target:
private void turnTheRadioOn(Thing radioThing) { radioHandler.handleCommand(radioThing.getChannel(FSInternetRadioBindingConstants.CHANNEL_POWER).getUID(), OnOffType.ON); final FrontierSiliconRadio radio = HandlerUtils.getRadio(radioHandler); waitForAssert(() -> { try { assertTrue(radio.getPower()); } catch (IOException ex) { throw new AssertionError("I/O error", ex); } }); }
Source:
@Override public void changeKey(@Nullable State outgoingState, State incomingState, Flow.Direction direction, Context incomingStateContext, Flow.TraversalCallback callback) { if (textView == null) { textView = new TextView(activity); textView.setGravity(Gravity.CENTER); } textView.setText(incomingState.getKey().toString()); activity.setContentView(textView); callback.onTraversalCompleted(); }

Target:
@Override public void changeKey(@Nullable State outgoingState, State incomingState, Flow.Direction direction, Context incomingStateContext, Flow.TraversalCallback callback) { if (textView == null) { textView = new TextView(activity); textView.setGravity(Gravity.CENTER); activity.setContentView(textView); } textView.setText(incomingState.getKey().toString()); callback.onTraversalCompleted(); }
Source:
public void testIsComplexNestedExpression() { assertTrue(!isComplexTemplate("${a:${b:c}}")); }

Target:
public void testIsComplexNestedExpression() { assertFalse(isComplexTemplate("${a:${b:c}}")); }
Source:
public void run(@Nonnull JSession session) throws Exception { OutputJackLibrary ojl = session.getJackOutputLibrary(); List<Meta> metas = session.getMetas(); for (Meta meta : metas) { addMetaToOutputJackLib(meta, ojl); } List<InputLibrary> importedLibraries = session.getImportedLibraries(); for (InputLibrary importedLibrary : importedLibraries) { if (importedLibrary.containsFileType(FileType.JPP)) { Iterator<InputVFile> jppIter = importedLibrary.iterator(FileType.JPP); while (jppIter.hasNext()) { InputVFile jppFile = jppIter.next(); Location loc = jppFile.getLocation(); String name; if (loc instanceof ZipLocation) { name = ((ZipLocation) jppFile.getLocation()).getEntryName(); if (importedLibrary.getMajorVersion() != 0) { name = name.substring( FileType.JPP.getVPathPrefix().split().iterator().next().length() + 1); } } else { name = ((FileLocation) jppFile.getLocation()).getPath(); if (importedLibrary.getMajorVersion() != 0) { String prefix = FileType.JPP.getVPathPrefix().split().iterator().next() + '/'; name = name.substring(name.lastIndexOf(prefix) + prefix.length()); } } Meta meta = new Meta(new VPath(name, '/'), jppFile); addMetaToOutputJackLib(meta, ojl); } } } }

Target:
public void run(@Nonnull JSession session) throws Exception { OutputJackLibrary ojl = session.getJackOutputLibrary(); List<Meta> metas = session.getMetas(); for (Meta meta : metas) { addMetaToOutputJackLib(meta, ojl); } List<InputLibrary> importedLibraries = session.getImportedLibraries(); for (InputLibrary importedLibrary : importedLibraries) { if (importedLibrary.containsFileType(FileType.JPP)) { Iterator<InputVFile> jppIter = importedLibrary.iterator(FileType.JPP); while (jppIter.hasNext()) { InputVFile jppFile = jppIter.next(); String name = getNameFromInputVFile(importedLibrary, jppFile); Meta meta = new Meta(new VPath(name, '/'), jppFile); addMetaToOutputJackLib(meta, ojl); } } } }
Source:
static public String updateScriptFile(String line) { String newFile = ""; newFile += "# newFile += "csarRoot=$(find ~ -maxdepth 1 -path \"*.csar\");"; newFile += "\n"; newFile += "IFS=';' read -ra NAMES <<< \"$DAs\";"; newFile += "\n"; newFile += "for i in \"${NAMES[@]}\"; do"; newFile += "\n"; newFile += " IFS=',' read -ra PATH <<< \"$i\"; "; newFile += "\n"; newFile += " dirName=$(/usr/bin/sudo /usr/bin/dirname $csarRoot${PATH[1]})"; newFile += "\n"; newFile += " baseName=$(/usr/bin/sudo /usr/bin/basename $csarRoot${PATH[1]})"; newFile += "\n"; newFile += " filename=\"${baseName%.*}\""; newFile += "\n"; newFile += " if [[ \"${PATH[1]}\" == *.tar ]];"; newFile += "\n"; newFile += " then"; newFile += "\n"; newFile += " cd $dirName"; newFile += "\n"; newFile += " /usr/bin/sudo mkdir -p $filename"; newFile += "\n"; newFile += " /bin/tar -xvzf $baseName -C $filename"; newFile += "\n"; newFile += " fi"; newFile += "\n"; newFile += "done"; newFile += "\n"; newFile += "export DEBIAN_FRONTEND=noninteractive"; newFile += "\n"; newFile += "/usr/bin/sudo -E /usr/bin/dpkg -i -R -E -B $filename"; newFile += "\n"; return newFile; }

Target:
static public String updateScriptFile(String line) { return "# "csarRoot=$(find ~ -maxdepth 1 -path \"*.csar\");" + "\n" + "IFS=';' read -ra NAMES <<< \"$DAs\";" + "\n" + "for i in \"${NAMES[@]}\"; do" + "\n" + " IFS=',' read -ra PATH <<< \"$i\"; " + "\n" + " dirName=$(/usr/bin/sudo /usr/bin/dirname $csarRoot${PATH[1]})" + "\n" + " baseName=$(/usr/bin/sudo /usr/bin/basename $csarRoot${PATH[1]})" + "\n" + " filename=\"${baseName%.*}\"" + "\n" + " if [[ \"${PATH[1]}\" == *.tar ]];" + "\n" + " then" + "\n" + " cd $dirName" + "\n" + " /usr/bin/sudo mkdir -p $filename" + "\n" + " /bin/tar -xvzf $baseName -C $filename" + "\n" + " fi" + "\n" + "done" + "\n" + "export DEBIAN_FRONTEND=noninteractive" + "\n" + "/usr/bin/sudo -E /usr/bin/dpkg -i -R -E -B $filename"; }
Source:
public void responseListener() throws Exception { HTTP2Client http2Client = new HTTP2Client(); http2Client.start(); SocketAddress serverAddress = new InetSocketAddress("localhost", 8080); CompletableFuture<Session> sessionCF = http2Client.connect(serverAddress, new Session.Listener.Adapter()); Session session = sessionCF.get(); HttpFields.Mutable requestHeaders = HttpFields.build() .put(HttpHeader.USER_AGENT, "Jetty HTTP2Client {version}"); MetaData.Request request = new MetaData.Request("GET", HttpURI.from("http://localhost:8080/path"), HttpVersion.HTTP_2, requestHeaders); HeadersFrame headersFrame = new HeadersFrame(request, null, true); session.newStream(headersFrame, new Stream.Listener.Adapter() { @Override public void onHeaders(Stream stream, HeadersFrame frame) { MetaData metaData = frame.getMetaData(); if (metaData.isResponse()) { MetaData.Response response = (MetaData.Response)metaData; System.getLogger("http2").log(INFO, "Received response {0}", response); } else { System.getLogger("http2").log(INFO, "Received trailers {0}", metaData.getFields()); } } @Override public void onData(Stream stream, DataFrame frame, Callback callback) { ByteBuffer buffer = frame.getData(); System.getLogger("http2").log(INFO, "Consuming buffer {0}", buffer); callback.succeeded(); } }); }

Target:
public void responseListener() throws Exception { HTTP2Client http2Client = new HTTP2Client(); http2Client.start(); SocketAddress serverAddress = new InetSocketAddress("localhost", 8080); CompletableFuture<Session> sessionCF = http2Client.connect(serverAddress, new Session.Listener.Adapter()); Session session = sessionCF.get(); HttpFields requestHeaders = HttpFields.build() .put(HttpHeader.USER_AGENT, "Jetty HTTP2Client {version}"); MetaData.Request request = new MetaData.Request("GET", HttpURI.from("http://localhost:8080/path"), HttpVersion.HTTP_2, requestHeaders); HeadersFrame headersFrame = new HeadersFrame(request, null, true); session.newStream(headersFrame, new Stream.Listener.Adapter() { @Override public void onHeaders(Stream stream, HeadersFrame frame) { MetaData metaData = frame.getMetaData(); if (metaData.isResponse()) { MetaData.Response response = (MetaData.Response)metaData; System.getLogger("http2").log(INFO, "Received response {0}", response); } else { System.getLogger("http2").log(INFO, "Received trailers {0}", metaData.getFields()); } } @Override public void onData(Stream stream, DataFrame frame, Callback callback) { ByteBuffer buffer = frame.getData(); System.getLogger("http2").log(INFO, "Consuming buffer {0}", buffer); callback.succeeded(); } }); }
Source:
private void probeCallBack(Probe probe, boolean success) { LOG.debug("Probe datanode: result: {}, type: {}", probe.getDatanodeInfo(), success, probe.getType()); probeInProg.remove(probe.getDatanodeInfo().getDatanodeUuid()); if (success) { if (probe.getType() == ProbeType.CHECK_DEAD) { LOG.info("Remove the node out from dead node list: {}.", probe.getDatanodeInfo()); removeDeadNode(probe.getDatanodeInfo()); } else if (probe.getType() == ProbeType.CHECK_SUSPECT) { LOG.info("Remove the node out from suspect node list: {}.", probe.getDatanodeInfo()); removeNodeFromDeadNodeDetector(probe.getDatanodeInfo()); } } else { if (probe.getType() == ProbeType.CHECK_SUSPECT) { LOG.warn("Probe failed, add suspect node to dead node list: {}.", probe.getDatanodeInfo()); addToDead(probe.getDatanodeInfo()); } } }

Target:
private void probeCallBack(Probe probe, boolean success) { LOG.debug("Probe datanode: result: {}, type: {}", probe.getDatanodeInfo(), success, probe.getType()); probeInProg.remove(probe.getDatanodeInfo().getDatanodeUuid()); if (success) { if (probe.getType() == ProbeType.CHECK_DEAD) { LOG.info("Remove the node out from dead node list: {}.", probe.getDatanodeInfo()); removeDeadNode(probe.getDatanodeInfo()); } else if (probe.getType() == ProbeType.CHECK_SUSPECT) { LOG.debug("Remove the node out from suspect node list: {}.", probe.getDatanodeInfo()); removeNodeFromDeadNodeDetector(probe.getDatanodeInfo()); } } else { if (probe.getType() == ProbeType.CHECK_SUSPECT) { LOG.warn("Probe failed, add suspect node to dead node list: {}.", probe.getDatanodeInfo()); addToDead(probe.getDatanodeInfo()); } } }
Source:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof HttpHost) { final HttpHost that = (HttpHost) obj; final String thisAddressValue = this.address==null ? this.lcHostname : this.address.getHostAddress().toLowerCase(Locale.ENGLISH); final String thatAddressValue = that.address==null ? that.lcHostname : that.address.getHostAddress().toLowerCase(Locale.ENGLISH); return this.lcHostname.equals(that.lcHostname) && this.port == that.port && this.schemeName.equals(that.schemeName) && thisAddressValue.equals(thatAddressValue); } else { return false; } }

Target:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof HttpHost) { final HttpHost that = (HttpHost) obj; return this.lcHostname.equals(that.lcHostname) && this.port == that.port && this.schemeName.equals(that.schemeName) && (this.address==null ? that.address== null : this.address.equals(that.address)); } else { return false; } }
Source:
public void getLatestDisplay_CurrentIsNull_DisplayUnchanged() { DisplaySafe safe = new DisplaySafe(null); DisplaySafe safeSpy = spy(safe); when(safeSpy.getCurrent()).thenReturn(null); boolean nullDisplayExceptionThrown = false; try { safeSpy.getLatestDisplay(); } catch (DisplaySafe.NullDisplayException nde) { nullDisplayExceptionThrown = true; } assertTrue(nullDisplayExceptionThrown); }

Target:
public void getLatestDisplay_CurrentIsNull_DisplayUnchanged() throws DisplaySafe.NullDisplayException { DisplaySafe safe = new DisplaySafe(null); DisplaySafe safeSpy = spy(safe); when(safeSpy.getCurrent()).thenReturn(null); safeSpy.getLatestDisplay(); }
Source:
public static Bbox getBoundingBoxFromFgdcMetadata(String inMetadata) throws JAXBException, UnsupportedEncodingException{ Bbox bbox = new Bbox(); Metadata metadata = null; try { JAXBContext jaxbContext = JAXBContext.newInstance(Metadata.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); metadata = (Metadata) jaxbUnmarshaller.unmarshal(new ByteArrayInputStream(inMetadata.getBytes("UTF-8"))); } catch (JAXBException e) { log.error("Unable to parse xml file. Has the schema changed? https:www.fgdc.gov/schemas/metadata/fgdc-std-001-1998-sect01.xsd :" + e.getMessage()); throw e; } Idinfo idinfo = metadata.getIdinfo(); Spdom spdom = idinfo.getSpdom(); Bounding bounding = spdom.getBounding(); double minx = bounding.getWestbc(); double miny = bounding.getSouthbc(); double maxx = bounding.getEastbc(); double maxy = bounding.getNorthbc(); Bbox result = new Bbox(); result.setBbox(minx, miny, maxx, maxy); bbox.setBbox(minx, miny, maxx, maxy); return bbox; }

Target:
public static Bbox getBoundingBoxFromFgdcMetadata(String inMetadata) throws JAXBException, UnsupportedEncodingException{ Bbox bbox = new Bbox(); Metadata metadata = null; try { JAXBContext jaxbContext = JAXBContext.newInstance(Metadata.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); metadata = (Metadata) jaxbUnmarshaller.unmarshal(new ByteArrayInputStream(inMetadata.getBytes("UTF-8"))); } catch (JAXBException e) { log.error("Unable to parse xml file. Has the schema changed? <LINK_0> :" + e.getMessage()); throw e; } Idinfo idinfo = metadata.getIdinfo(); Spdom spdom = idinfo.getSpdom(); Bounding bounding = spdom.getBounding(); double minx = bounding.getWestbc(); double miny = bounding.getSouthbc(); double maxx = bounding.getEastbc(); double maxy = bounding.getNorthbc(); Bbox result = new Bbox(); result.setBbox(minx, miny, maxx, maxy); bbox.setBbox(minx, miny, maxx, maxy); return bbox; }
Source:
public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player you = game.getPlayer(source.getControllerId()); if (targetPlayer == null || you == null) { return false; } int amountToDiscard = source.getManaCostsToPay().getX(); TargetCard target = new TargetCardInHand(amountToDiscard, StaticFilters.FILTER_CARD_CARDS); targetPlayer.discard(new CardsImpl(target.getTargets()), source, game); return true; }

Target:
public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(source.getFirstTarget()); Player you = game.getPlayer(source.getControllerId()); if (targetPlayer == null || you == null) { return false; } int amountToDiscard = source.getManaCostsToPay().getX(); TargetCard target = new TargetCardInHand(amountToDiscard, StaticFilters.FILTER_CARD_CARDS); you.choose(outcome, targetPlayer.getHand(), target, game); targetPlayer.discard(new CardsImpl(target.getTargets()), source, game); return true; }
Source:
protected ServiceIndex createServiceIndex() { Stack stack = context.objectManager.loadResource(Stack.class, service.getStackId()); String serviceIndex = ServiceDiscoveryUtil.getGeneratedServiceIndex(stack, service, launchConfigName, instanceName); ServiceIndex serviceIndexObj = context.serviceDao.createServiceIndex(service, launchConfigName, serviceIndex); if (DataAccessor.fieldBool(service, ServiceConstants.FIELD_SERVICE_RETAIN_IP)) { Object requestedIpObj = ServiceDiscoveryUtil.getLaunchConfigObject(service, launchConfigName, InstanceConstants.FIELD_REQUESTED_IP_ADDRESS); String requestedIp = null; if (requestedIpObj != null) { List<String> availableIPs = new ArrayList<>(); if (requestedIpObj instanceof List<?>) { for (Object item : (List<?>) requestedIpObj) { availableIPs.add(ObjectUtils.toString(item, null)); } } List<String> usedIPs = context.serviceDao.getUsedIPsFromServiceIndexByServiceID(service); for (String candidateIP: availableIPs) { if (usedIPs.isEmpty() || !usedIPs.contains(candidateIP)) { requestedIp = candidateIP; break; } } } else { Object labels = ServiceDiscoveryUtil.getLaunchConfigObject(service, launchConfigName, InstanceConstants.FIELD_LABELS); if (labels != null) { requestedIp = ((Map<String, String>) labels).get(SystemLabels.LABEL_REQUESTED_IP); } } context.sdService.allocateIpToServiceIndex(service, serviceIndexObj, requestedIp); } return serviceIndexObj; }

Target:
protected ServiceIndex createServiceIndex() { Stack stack = context.objectManager.loadResource(Stack.class, service.getStackId()); String serviceIndex = ServiceDiscoveryUtil.getGeneratedServiceIndex(stack, service, launchConfigName, instanceName); ServiceIndex serviceIndexObj = context.serviceDao.createServiceIndex(service, launchConfigName, serviceIndex); if (DataAccessor.fieldBool(service, ServiceConstants.FIELD_SERVICE_RETAIN_IP)) { List<String> requestedIps = new ArrayList<>(); Object requestedIpObj = ServiceDiscoveryUtil .getLaunchConfigObject(service, launchConfigName, InstanceConstants.FIELD_REQUESTED_IP_ADDRESS); if (requestedIpObj != null && !StringUtils.isEmpty(requestedIpObj.toString())) { requestedIps.addAll(Arrays.asList(StringUtils.stripAll(StringUtils.split(requestedIpObj.toString(), ",")))); } else { Object labels = ServiceDiscoveryUtil.getLaunchConfigObject( service, launchConfigName, InstanceConstants.FIELD_LABELS); if (labels != null) { String requestedIp = ((Map<String, String>) labels) .get(SystemLabels.LABEL_REQUESTED_IP); if (!StringUtils.isEmpty(requestedIp)) { requestedIps.addAll(Arrays.asList(StringUtils.stripAll(StringUtils.split(requestedIp, ",")))); } } } context.sdService.allocateIpToServiceIndex(service, serviceIndexObj, requestedIps); } return serviceIndexObj; }
Source:
public static List<Rule> compose(Collection<ExternalDependency> dependencies) { return dependencies .stream() .sorted(ExternalDependency.compareByName) .map( dependency -> { Rule rule = new HttpFile() .mavenCoords(dependency.getMavenCoords()) .sha256(DependencyUtils.sha256(dependency.getRealDependencyFile())) .name(dependency.getTargetName()); rule.name(dependency.getTargetName()); return rule; }) .collect(Collectors.toList()); }

Target:
public static List<Rule> compose(Collection<ExternalDependency> dependencies) { return dependencies .stream() .sorted(ExternalDependency.compareByName) .map( dependency -> { Rule rule = new HttpFile() .mavenCoords(dependency.getMavenCoords()) .sha256(DependencyUtils.shaSum256(dependency.getRealDependencyFile())) .name(dependency.getTargetName()); rule.name(dependency.getTargetName()); return rule; }) .collect(Collectors.toList()); }
Source:
public void onFailedResponse(ReplicaId replicaId) { failedRequests.add(replicaId); onReplicaResponse(replicaId); }

Target:
public void onFailedResponse(ReplicaId replicaId) { super.onFailedResponse(replicaId); onReplicaResponse(replicaId); }
Source:
public void selectionChanged(SelectionChangedEvent event) { CounterChartViewer counterChartViewer = fCounterChartViewer; if (counterChartViewer == null) { return; } if (counterChartViewer.getTrace() == null) { return; } ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object entry = ((IStructuredSelection) selection).getFirstElement(); if (entry instanceof CounterTreeViewerEntry) { @NonNull Set<@NonNull Integer> quark = new TreeSet<>(); quark.add(((CounterTreeViewerEntry) entry).getQuark()); TmfQuarkSignal signal = new TmfQuarkSignal(this, quark); broadcast(signal); } } }

Target:
public void selectionChanged(SelectionChangedEvent event) { CounterChartViewer counterChartViewer = fCounterChartViewer; if (counterChartViewer == null) { return; } if (getTrace() == null) { return; } ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { Object entry = ((IStructuredSelection) selection).getFirstElement(); if (entry instanceof CounterTreeViewerEntry) { @NonNull Set<@NonNull Integer> quark = new TreeSet<>(); quark.add(((CounterTreeViewerEntry) entry).getQuark()); counterChartViewer.updateChart(quark); } } }
Source:
public Integer parse(CharSequence text) throws ParseException { MatchResult match = RegExp.compile("^(\\d+)\\s*(\\w*)$").exec(text.toString().trim()); MatchResult match_megabytes = RegExp.compile("^(\\d+)\\s*(\\w*)$").exec(messages.megabytes("0")); if (match == null) { return 0; } String prefix = match.getGroup(1); String suffix = match.getGroup(2); String suffix_megabytes = match_megabytes != null ? match_megabytes.getGroup(2) : null; Integer size = null; try { size = Integer.parseInt(prefix); } catch (NumberFormatException e) { return 0; } if (suffix.equalsIgnoreCase("TB") || suffix.equalsIgnoreCase("T")) { return size * 1024 * 1024; } else if (suffix.equalsIgnoreCase("GB") || suffix.equalsIgnoreCase("G")) { return size * 1024; } else if (suffix.equalsIgnoreCase("MB") || suffix.equalsIgnoreCase("M") || suffix.equalsIgnoreCase(suffix_megabytes)) { return size; } else if (StringHelper.isNullOrEmpty(suffix)) { return size; } else { return 0; } }

Target:
public Integer parse(CharSequence text) throws ParseException { MatchResult match = RegExp.compile("^(\\d+)\\s*(\\w*)$").exec(text.toString().trim()); if (match == null) { return 0; } String prefix = match.getGroup(1); String suffix = match.getGroup(2); Integer size = null; try { size = Integer.parseInt(prefix); } catch (NumberFormatException e) { return 0; } if (suffix.equalsIgnoreCase("TB") || suffix.equalsIgnoreCase("T")) { return size * 1024 * 1024; } else if (suffix.equalsIgnoreCase("GB") || suffix.equalsIgnoreCase("G")) { return size * 1024; } else if (suffix.equalsIgnoreCase("MB") || suffix.equalsIgnoreCase("M") || suffix.equalsIgnoreCase(constant.mb())) { return size; } else if (StringHelper.isNullOrEmpty(suffix)) { return size; } else { return 0; } }
Source:
public void sliceLengthIsToolarge() { expectedException.expect(IllegalArgumentException.class); Series series = new Series("12345"); List<List<Integer>> actual = series.slices(6); }

Target:
public void sliceLengthIsToolarge() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Slice size is too big."); Series series = new Series("12345"); series.slices(6); }
Source:
public void testMetadataIsClearedAfterQueryCanceled() throws Exception { ExecutorService queryExecutor = Executors.newSingleThreadExecutor(); DistributedQueryRunner distributedQueryRunner = createQueryRunner(); MetadataManager metadata = (MetadataManager) distributedQueryRunner.getMetadata(); TestingPrestoServer coordinator = distributedQueryRunner.getCoordinator(); queryExecutor.submit(() -> distributedQueryRunner.execute("SELECT COUNT(*) FROM lineitem")); while (true) { List<QueryInfo> queries = coordinator.getQueryManager().getAllQueryInfo(); if(!queries.isEmpty() && Iterators.getOnlyElement(queries.iterator()).getState() == RUNNING) { break; } Thread.sleep(100); } distributedQueryRunner.close(); assertEquals(metadata.getCatalogsByQueryId().size(), 0); }

Target:
public void testMetadataIsClearedAfterQueryCanceled() throws Exception { QueryManager queryManager = queryRunner.getCoordinator().getQueryManager(); QueryId queryId = queryManager.createQuery(new TestingSessionFactory(TEST_SESSION), "SELECT * FROM lineitem").getQueryId(); while (true) { if (queryManager.getQueryInfo(queryId).getState() == RUNNING) { break; } Thread.sleep(100); } queryManager.cancelQuery(queryId); assertEquals(metadataManager.getCatalogsByQueryId().size(), 0); }
Source:
public UsageStats getUsage(final Object o) { if (!(o instanceof Identifiable) || !(o instanceof Locatable)) { return null; } final String id = ((Identifiable) o).getIdentifier(); final String url = ((Locatable) o).getLocation(); if (!stats.containsKey(id)) stats.put(id, new UsageStats(id, url)); return stats.get(id); }

Target:
public UsageStats getUsage(final Object o) { if (!(o instanceof Identifiable && o instanceof Locatable)) { return null; } final String id = ((Identifiable) o).getIdentifier(); final String url = ((Locatable) o).getLocation(); if (!stats.containsKey(id)) stats.put(id, new UsageStats(id, url)); return stats.get(id); }
Source:
private String truncateMessageLength(String message, int maxLength) { if (message.length() > maxLength) { message = message.substring(0, maxLength + 1); } return message; }

Target:
private String truncateMessageLength(String message, int maxLength) { if (message.length() > maxLength) { message = message.substring(0, maxLength); } return message; }
Source:
public PagedFlux<String> query(String query) { return new PagedFlux<>( () -> withContext(context -> queryFirstPage(query, context)), nextLink -> withContext(context -> queryNextPage(query, nextLink, context))); }

Target:
public PagedFlux<String> query(String query) { return new PagedFlux<>( () -> withContext(context -> queryFirstPage(query, context)), nextLink -> withContext(context -> queryNextPage(nextLink, context))); }
Source:
private void handlePropertyChangeEvent(PropertyChangeEvent event) { if (fPreferenceStore == null) { return; } if (fEditor != null && fEditor.affectsJavaCodeMining(event, false)) { if (isJavaCodeMiningEnabled()) { enable(); } else { disable(); } } }

Target:
private void handlePropertyChangeEvent(PropertyChangeEvent event) { if (fPreferenceStore == null) { return; } if (fEditor != null && fEditor.affectsJavaCodeMining(event)) { if (isJavaCodeMiningEnabled()) { enable(); } else { disable(); } } }