auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String toString() { return "ConnectionPolicy{" + "requestTimeout=" + requestTimeout + ", connectionMode=" + connectionMode + ", maxConnectionPoolSize=" + maxConnectionPoolSize + ", idleConnectionTimeout=" + idleConnectionTimeout + ", userAgentSuffix='" + userAgentSuffix + '\'' + ", throttlingRetryOptions=" + throttlingRetryOptions + ", endpointDiscoveryEnabled=" + endpointDiscoveryEnabled + ", preferredRegions=" + preferredRegions + ", multipleWriteRegionsEnabled=" + multipleWriteRegionsEnabled + ", inetSocketProxyAddress=" + inetSocketProxyAddress + ", readRequestsFallbackEnabled=" + readRequestsFallbackEnabled + ", connectionTimeout=" + connectionTimeout + ", idleEndpointTimeout=" + idleEndpointTimeout + ", maxChannelsPerEndpoint=" + maxConnectionsPerEndpoint + ", maxRequestsPerChannel=" + maxRequestsPerConnection + '}'; }

Target:
public String toString() { return "ConnectionPolicy{" + "requestTimeout=" + requestTimeout + ", connectionMode=" + connectionMode + ", maxConnectionPoolSize=" + maxConnectionPoolSize + ", idleConnectionTimeout=" + idleConnectionTimeout + ", userAgentSuffix='" + userAgentSuffix + '\'' + ", throttlingRetryOptions=" + throttlingRetryOptions + ", endpointDiscoveryEnabled=" + endpointDiscoveryEnabled + ", preferredRegions=" + preferredRegions + ", multipleWriteRegionsEnabled=" + multipleWriteRegionsEnabled + ", proxyType=" + proxy.getType() + ", inetSocketProxyAddress=" + proxy.getAddress() + ", readRequestsFallbackEnabled=" + readRequestsFallbackEnabled + ", connectionTimeout=" + connectionTimeout + ", idleEndpointTimeout=" + idleEndpointTimeout + ", maxConnectionsPerEndpoint=" + maxConnectionsPerEndpoint + ", maxRequestsPerConnection=" + maxRequestsPerConnection + '}'; }
Source:
void recordGatewayResponse(RxDocumentServiceRequest rxDocumentServiceRequest, StoreResponse storeResponse, CosmosClientException exception) { ZonedDateTime responseTime = ZonedDateTime.now(ZoneOffset.UTC); connectionMode = ConnectionMode.GATEWAY; synchronized (this) { if (responseTime.isAfter(this.requestEndTime)) { this.requestEndTime = responseTime; } this.gatewayStatistic = new GatewayStatistic(); this.gatewayStatistic.operationType = rxDocumentServiceRequest.getOperationType(); if (storeResponse != null) { this.gatewayStatistic.statusCode = storeResponse.getStatus(); this.gatewayStatistic.subStatusCode = DirectBridgeInternal.getSubStatusCode(storeResponse); ISessionToken sessionToken = null; String headerValue; if ((headerValue = storeResponse.getHeaderValue(HttpConstants.HttpHeaders.SESSION_TOKEN)) != null) { sessionToken = SessionTokenHelper.parse(headerValue); } double requestCharge = 0; if ((headerValue = storeResponse.getHeaderValue(HttpConstants.HttpHeaders.REQUEST_CHARGE)) != null) { requestCharge = Double.parseDouble(headerValue); } this.gatewayStatistic.sessionToken = sessionToken; this.gatewayStatistic.requestCharge = requestCharge; } else if(exception != null){ this.gatewayStatistic.statusCode = exception.getStatusCode(); this.gatewayStatistic.subStatusCode = exception.getSubStatusCode(); } } }

Target:
void recordGatewayResponse(RxDocumentServiceRequest rxDocumentServiceRequest, StoreResponse storeResponse, CosmosClientException exception) { ZonedDateTime responseTime = ZonedDateTime.now(ZoneOffset.UTC); connectionMode = ConnectionMode.GATEWAY; synchronized (this) { if (responseTime.isAfter(this.requestEndTime)) { this.requestEndTime = responseTime; } this.gatewayStatistic = new GatewayStatistic(); this.gatewayStatistic.operationType = rxDocumentServiceRequest.getOperationType(); if (storeResponse != null) { this.gatewayStatistic.statusCode = storeResponse.getStatus(); this.gatewayStatistic.subStatusCode = DirectBridgeInternal.getSubStatusCode(storeResponse); this.gatewayStatistic.sessionToken = storeResponse.getHeaderValue(HttpConstants.HttpHeaders.SESSION_TOKEN); this.gatewayStatistic.requestCharge = storeResponse.getHeaderValue(HttpConstants.HttpHeaders.REQUEST_CHARGE); } else if(exception != null){ this.gatewayStatistic.statusCode = exception.getStatusCode(); this.gatewayStatistic.subStatusCode = exception.getSubStatusCode(); } } }
Source:
private boolean isFirstArgumentCredentials(CallExpression callExpression) { return callExpression.arguments().get(0).is(Tree.Kind.REGULAR_ARGUMENT) && ((RegularArgument) callExpression.arguments().get(0)).expression().is(Tree.Kind.NAME) && isCredential(((Name) ((RegularArgument) callExpression.arguments().get(0)).expression()).name(), variablePatterns()); }

Target:
private boolean isFirstArgumentCredentials(CallExpression callExpression) { Argument argument = callExpression.arguments().get(0); if (argument.is(Kind.REGULAR_ARGUMENT)) { RegularArgument regularArgument = (RegularArgument) argument; return regularArgument.expression().is(Kind.NAME) && isCredential(((Name) regularArgument.expression()).name(), variablePatterns()); } return false; }
Source:
public List<Long> getIds(final int size) { final Vector<Long> idVector = new Vector<>(); for (int i = 0; i < size; i++) { idVector.add(base + counter.getAndIncrement()); } return idVector; }

Target:
public List<Long> getIds(final int size) throws IdGenerationException { if (counter.get() + size > 0x100000000L) { throw new IdGenerationException("No more id available"); } final Vector<Long> idVector = new Vector<>(); for (int i = 0; i < size; i++) { idVector.add(base + counter.getAndIncrement()); } return idVector; }
Source:
public void run() { try { if (keepAliveSender.test(gameId)) { if (!lastAttemptWasSuccess) { reportReconnected(); } } else { final PostGameResponse postGameResponse = gamePoster.get(); gameId = postGameResponse.getGameId(); connectivityHandler.accept(postGameResponse.isSuccessfulConnectivityCheck()); if (keepAliveSender.test(gameId)) { gameIdSetter.accept(gameId); reportReconnected(); } } } catch (final FeignException e) { if (lastAttemptWasSuccess) { connectionLostReporter.accept( "Connection to lobby lost.\nWill automatically re-connect when it is available."); lastAttemptWasSuccess = false; } } }

Target:
public void run() { try { if (!keepAliveSender.test(gameId)) { gameId = gamePoster.get(); if (keepAliveSender.test(gameId)) { gameIdSetter.accept(gameId); } } } catch (final FeignException e) { log.log(Level.INFO, "Unable to connect to lobby (lobby is shut down?)", e); } }
Source:
private void emit(final MistDataEvent input, final EventStack<T> eventStack) { final Map<String, List<T>> output = new HashMap<>(); final long timeStamp = input.getTimestamp(); final int finalStateIndex = eventStack.getStack().peek().getIndex(); final EventStackEntry<T> finalEntry = eventStack.getStack().peek(); final int times = finalEntry.getlist().size(); final CepEventPattern<T> finalState = eventPatternList.get(finalStateIndex); if (!finalState.isTimes() || (times >= finalState.getMinTimes() && (finalState.getMaxTimes() == -1 || times <= finalState.getMaxTimes()))) { for (final EventStackEntry<T> iterEntry : eventStack.getStack()) { output.put(eventPatternList.get(iterEntry.getIndex()).getEventPatternName(), iterEntry.getlist()); } if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "{0} processes {1} to {2}", new Object[]{this.getClass().getName(), input, output}); } outputEmitter.emitData(new MistDataEvent(output, timeStamp)); eventStack.setAlreadyEmitted(); } }

Target:
private void emit(final MistDataEvent input, final EventStack<T> eventStack) { final Map<String, List<T>> output = new HashMap<>(); final long timeStamp = input.getTimestamp(); final int finalStateIndex = eventStack.getStack().peek().getIndex(); final EventStackEntry<T> finalEntry = eventStack.getStack().peek(); final int times = finalEntry.getlist().size(); final CepEventPattern<T> finalState = eventPatternList.get(finalStateIndex); if (!finalState.isRepeated() || (times >= finalState.getMinRepetition() && (finalState.getMaxRepetition() == -1 || times <= finalState.getMaxRepetition()))) { for (final EventStackEntry<T> iterEntry : eventStack.getStack()) { output.put(eventPatternList.get(iterEntry.getIndex()).getEventPatternName(), iterEntry.getlist()); } if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "{0} processes {1} to {2}", new Object[]{this.getClass().getName(), input, output}); } outputEmitter.emitData(new MistDataEvent(output, timeStamp)); eventStack.setAlreadyEmitted(); } }
Source:
public String toString() { return String.valueOf(firstDigitsCardNumber); }

Target:
public String toString() { return firstDigitsCardNumber; }
Source:
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); if (getVm().getis_stateless()) { for (DiskImage image : getVm().getDiskList()) { if (image.getQuotaId() != null) { list.add(new QuotaStorageConsumptionParameter(image.getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.CONSUME, image.getstorage_ids().get(0), image.getActualSize())); } } } return list; }

Target:
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); if (getVm().getis_stateless()) { for (DiskImage image : getVm().getDiskList()) { if (image.getQuotaId() != null) { list.add(new QuotaStorageConsumptionParameter(image.getQuotaId(), null, QuotaConsumptionParameter.QuotaAction.RELEASE, image.getstorage_ids().get(0), image.getActualSize())); } } } return list; }
Source:
private void filterFeedbackSessions(String courseId, List<FeedbackSessionAttributes> feedbacks, InstructorAttributes instructor, StudentAttributes student) { Iterator<FeedbackSessionAttributes> iterFs = feedbacks.iterator(); while (iterFs.hasNext()) { FeedbackSessionAttributes tempFs = iterFs.next(); if (!tempFs.courseId.equals(courseId)) { iterFs.remove(); } else if (!instructor.isAllowedForPrivilege(student.section, tempFs.getSessionName(), Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)) { iterFs.remove(); } } }

Target:
private void filterFeedbackSessions(String courseId, List<FeedbackSessionAttributes> feedbacks, InstructorAttributes instructor, StudentAttributes student) { Iterator<FeedbackSessionAttributes> iterFs = feedbacks.iterator(); while (iterFs.hasNext()) { FeedbackSessionAttributes tempFs = iterFs.next(); if (!tempFs.courseId.equals(courseId) || !instructor.isAllowedForPrivilege(student.section, tempFs.getSessionName(), Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)) { iterFs.remove(); } } }
Source:
private void startSync() { Configuration config = Configuration.get(); FileWatcher fileWatcher = new FileWatcher(config.getUsersFile(), config.getProjectsFile(), config.getRolesFile(), config.getAssignmentsFile()) { @Override protected void onFilesModified(Set<File> files) { syncFromFiles(files); } }; timer.schedule(fileWatcher, 0, 1000); }

Target:
private void startSync() { Configuration config = Configuration.get(); FileWatcher fileWatcher = new FileWatcher(config.getUsersFile(), config.getProjectsFile(), config.getRolesFile(), config.getAssignmentsFile()) { @Override protected void onFilesModified(Set<File> files) { syncFromFiles(files); } }; timer.schedule(fileWatcher, 5000, 1000); }
Source:
private static boolean testExpression(LiteralExpression inputStrLiteral, LiteralExpression localeIsoCodeLiteral, LiteralExpression upperCaseBooleanLiteral, LiteralExpression strengthLiteral, LiteralExpression decompositionLiteral, String expectedCollationKeyBytesHex) throws Exception { List<Expression> expressions = Lists.newArrayList((Expression) inputStrLiteral, (Expression) localeIsoCodeLiteral, (Expression) upperCaseBooleanLiteral, (Expression) strengthLiteral, (Expression) decompositionLiteral); Expression collationKeyFunction = new CollationKeyFunction(expressions); ImmutableBytesWritable ptr = new ImmutableBytesWritable(); boolean ret = collationKeyFunction.evaluate(null, ptr); if (ret) { byte[] result = (byte[]) collationKeyFunction.getDataType().toObject(ptr, collationKeyFunction.getSortOrder()); byte[] expectedCollationKeyByteArray = Hex.decodeHex(expectedCollationKeyBytesHex.toCharArray()); assertEquals( String.format("Size of collation key byte arrays was not as expected for [%s], [%s]", inputStrLiteral.getValue(), localeIsoCodeLiteral.getValue()), expectedCollationKeyByteArray.length, result.length); for (int i = 0; i < expectedCollationKeyByteArray.length; i++) { assertEquals( String.format( "Element " + i + " of collation key byte array was not as expected for [%s], [%s]", inputStrLiteral.getValue(), localeIsoCodeLiteral.getValue()), expectedCollationKeyByteArray[i], result[i]); } } else { fail(String.format("CollationKeyFunction.evaluate returned false for %s, %s", inputStrLiteral.getValue(), localeIsoCodeLiteral.getValue())); } return ret; }

Target:
private static void testExpression(LiteralExpression inputStrLiteral, LiteralExpression localeIsoCodeLiteral, LiteralExpression upperCaseBooleanLiteral, LiteralExpression strengthLiteral, LiteralExpression decompositionLiteral, String expectedCollationKeyBytesHex) throws Exception { List<Expression> expressions = Lists.newArrayList((Expression) inputStrLiteral, (Expression) localeIsoCodeLiteral, (Expression) upperCaseBooleanLiteral, (Expression) strengthLiteral, (Expression) decompositionLiteral); Expression collationKeyFunction = new CollationKeyFunction(expressions); ImmutableBytesWritable ptr = new ImmutableBytesWritable(); boolean ret = collationKeyFunction.evaluate(null, ptr); if (ret) { byte[] result = (byte[]) collationKeyFunction.getDataType().toObject(ptr, collationKeyFunction.getSortOrder()); byte[] expectedCollationKeyByteArray = Hex.decodeHex(expectedCollationKeyBytesHex.toCharArray()); assertArrayEquals("COLLATION_KEY did not return the expected byte array", expectedCollationKeyByteArray, result); } else { fail(String.format("CollationKeyFunction.evaluate returned false for %s, %s", inputStrLiteral.getValue(), localeIsoCodeLiteral.getValue())); } }
Source:
public static boolean isComposedJobDefinition(String definition){ String patternString = "(\\|\\|(?=([^\\\"']*[\\\"'][^\\\"']*[\\\"'])*[^\\\"']*$)) " + "| (\\&(?=([^\\\"']*[\\\"'][^\\\"']*[\\\"'])*[^\\\"']*$)) "; Pattern pattern = Pattern.compile(patternString); Matcher matcher = pattern.matcher(definition); return matcher.find(); }

Target:
public static boolean isComposedJobDefinition(String definition){ Matcher matcher = pattern.matcher(definition); return matcher.find(); }
Source:
private boolean isWorktreeDirty(WorkingTreeIterator work) { if (inCore || work == null) return false; final int modeF = tw.getRawMode(T_FILE); final int modeO = tw.getRawMode(T_OURS); boolean isDirty = work.isModeDifferent(modeO); if (!isDirty && nonTree(modeF)) isDirty = !tw.idEqual(T_FILE, T_OURS); if (isDirty && modeF == FileMode.TYPE_TREE && modeO == FileMode.TYPE_MISSING) isDirty = false; if (isDirty) failingPaths.put(tw.getPathString(), MergeFailureReason.DIRTY_WORKTREE); return isDirty; }

Target:
private boolean isWorktreeDirty(WorkingTreeIterator work) { if (work == null) return false; final int modeF = tw.getRawMode(T_FILE); final int modeO = tw.getRawMode(T_OURS); boolean isDirty = work.isModeDifferent(modeO); if (!isDirty && nonTree(modeF)) isDirty = !tw.idEqual(T_FILE, T_OURS); if (isDirty && modeF == FileMode.TYPE_TREE && modeO == FileMode.TYPE_MISSING) isDirty = false; if (isDirty) failingPaths.put(tw.getPathString(), MergeFailureReason.DIRTY_WORKTREE); return isDirty; }
Source:
public MetadataValueList getPermissionFilteredMetadata(Context context, Item obj) { List<MetadataValue> fullList = itemService.getMetadata(obj, Item.ANY, Item.ANY, Item.ANY, Item.ANY, true); List<MetadataValue> returnList = new LinkedList<>(); try { if (context != null && authorizeService.isAdmin(context)) { return new MetadataValueList(fullList); } for (MetadataValue mv : fullList) { MetadataField metadataField = mv.getMetadataField(); if (!metadataExposureService .isHidden(context, metadataField.getMetadataSchema().getName(), metadataField.getElement(), metadataField.getQualifier())) { returnList.add(mv); } } } catch (SQLException e) { log.error(e); } return new MetadataValueList(returnList); }

Target:
public MetadataValueList getPermissionFilteredMetadata(Context context, Item obj) { List<MetadataValue> fullList = itemService.getMetadata(obj, Item.ANY, Item.ANY, Item.ANY, Item.ANY, true); List<MetadataValue> returnList = new LinkedList<>(); try { if (context != null && authorizeService.isAdmin(context)) { return new MetadataValueList(fullList); } for (MetadataValue mv : fullList) { MetadataField metadataField = mv.getMetadataField(); if (!metadataExposureService .isHidden(context, metadataField.getMetadataSchema().getName(), metadataField.getElement(), metadataField.getQualifier())) { returnList.add(mv); } } } catch (SQLException e) { log.error("Error filtering item metadata based on permissions", e); } return new MetadataValueList(returnList); }
Source:
ListenableFuture<PreparedStatement> getPreparedQueryAsync(QueryType type, Set<ColumnMapper<?>> columns, EnumMap<Option.Type, Option> options) { final MapperQueryKey pqk = new MapperQueryKey(type, columns, options); PreparedStatement stmt = preparedQueries.get(pqk); if (stmt == null) { String queryString = type.makePreparedQueryString(tableMetadata, mapper, manager, columns, options.values()); logger.debug("Preparing query {}", queryString); final SettableFuture<PreparedStatement> future = SettableFuture.create(); Futures.addCallback(session().prepareAsync(queryString), new FutureCallback<PreparedStatement>() { @Override public void onSuccess(PreparedStatement stmt) { PreparedStatement old = preparedQueries.putIfAbsent(pqk, stmt); if (old != null) stmt = old; future.set(stmt); } @Override public void onFailure(Throwable t) { future.setException(t); } }); return future; } else { return Futures.immediateFuture(stmt); } }

Target:
ListenableFuture<PreparedStatement> getPreparedQueryAsync(QueryType type, Set<ColumnMapper<?>> columns, EnumMap<Option.Type, Option> options) { final MapperQueryKey pqk = new MapperQueryKey(type, columns, options); ListenableFuture<PreparedStatement> existingFuture = preparedQueries.get(pqk); if (existingFuture == null) { final SettableFuture<PreparedStatement> future = SettableFuture.create(); ListenableFuture<PreparedStatement> old = preparedQueries.putIfAbsent(pqk, future); if (old != null) { return old; } else { String queryString = type.makePreparedQueryString(tableMetadata, mapper, manager, columns, options.values()); logger.debug("Preparing query {}", queryString); SimpleStatement s = new SimpleStatement(queryString); s.setIdempotent(true); Futures.addCallback(session().prepareAsync(s), new FutureCallback<PreparedStatement>() { @Override public void onSuccess(PreparedStatement stmt) { future.set(stmt); } @Override public void onFailure(Throwable t) { future.setException(t); } }); return future; } } else { return existingFuture; } }
Source:
public void initializeFrameworks() { NotificationUtils.createNotificationChannel(context); try { JobManager .create(context) .addJobCreator(collectJobCreator); } catch (JobManagerCreateException e) { Timber.e(e); } JodaTimeAndroid.init(context); if (BuildConfig.BUILD_TYPE.equals("odkCollectRelease")) { Timber.plant(new CrashReportingTree()); } else { Timber.plant(new Timber.DebugTree()); } AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); }

Target:
public void initializeFrameworks() { NotificationUtils.createNotificationChannel(context); initializeJobManager(); JodaTimeAndroid.init(context); initializeLogging(); AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); initializeMapFrameworks(); }
Source:
public void writeCherryPickHead(ObjectId head) throws IOException { List<ObjectId> heads = (head == null) ? null : Arrays.asList(head); writeHeadsFile(heads, Constants.CHERRY_PICK_HEAD); }

Target:
public void writeCherryPickHead(ObjectId head) throws IOException { List<ObjectId> heads = (head != null) ? Collections.singletonList(head) : null; writeHeadsFile(heads, Constants.CHERRY_PICK_HEAD); }
Source:
public void addJWTAuthentication(UserEntity userEntity, String key, boolean persist) throws AmbariException { addAuthentication(userEntity, UserAuthenticationType.JWT, key, new Validator() { @Override public void validate(UserEntity userEntity, String key) throws AmbariException { List<UserAuthenticationEntity> authenticationEntities = userEntity.getAuthenticationEntities(); for (UserAuthenticationEntity entity : authenticationEntities) { if ((entity.getAuthenticationType() == UserAuthenticationType.JWT) && ((key == null) ? (entity.getAuthenticationKey() == null) : key.equals(entity.getAuthenticationKey()))) { throw new AmbariException("The authentication type already exists for this user"); } } } }, persist); }

Target:
public void addJWTAuthentication(UserEntity userEntity, String key, boolean persist) throws AmbariException { addAuthentication(userEntity, UserAuthenticationType.JWT, key, (user, authKey) -> { List<UserAuthenticationEntity> authenticationEntities = user.getAuthenticationEntities(); for (UserAuthenticationEntity entity : authenticationEntities) { if ((entity.getAuthenticationType() == UserAuthenticationType.JWT) && ((authKey == null) ? (entity.getAuthenticationKey() == null) : authKey.equals(entity.getAuthenticationKey()))) { throw new AmbariException("The authentication type already exists for this user"); } } }, persist); }
Source:
protected static ILaunchConfiguration findLaunchConfiguration(String name) throws CoreException { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(); for (ILaunchConfiguration lConf : launchConfigurations) { if (lConf.getName().equals(name)) { return lConf; } } return null; }

Target:
protected static ILaunchConfiguration findLaunchConfiguration(String name) throws CoreException { ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(); for (ILaunchConfiguration config : launchConfigurations) { if (config.getName().equals(name)) { return config; } } return null; }
Source:
public String toString() { return element.getSimpleName().toString() + "( . )"; }

Target:
public String toString() { return element.toString(); }
Source:
public void errorDelayedSubscriptionDisposeBeforeTime() { TestScheduler scheduler = new TestScheduler(); Completable result = Completable.complete() .delaySubscription(100, TimeUnit.MILLISECONDS, scheduler); Observer<Void> o = TestHelper.mockObserver(); TestObserver<Void> to = new TestObserver<Void>(o); result.subscribe(to); to.assertEmpty(); scheduler.advanceTimeBy(90, TimeUnit.MILLISECONDS); to.dispose(); scheduler.advanceTimeBy(15, TimeUnit.MILLISECONDS); to.assertEmpty(); verify(o, never()).onComplete(); verify(o, never()).onError(any(Throwable.class)); }

Target:
public void errorDelayedSubscriptionDisposeBeforeTime() { TestScheduler scheduler = new TestScheduler(); Completable result = Completable.complete() .delaySubscription(100, TimeUnit.MILLISECONDS, scheduler); TestObserver<Void> to = result.test(); to.assertEmpty(); scheduler.advanceTimeBy(90, TimeUnit.MILLISECONDS); to.dispose(); scheduler.advanceTimeBy(15, TimeUnit.MILLISECONDS); to.assertEmpty(); }
Source:
public void getUploadById() throws Exception { TestUtils.mockPlayContext(); doReturn(researcherSession).when(controller).getAuthenticatedSession(RESEARCHER, ADMIN); DynamoHealthDataRecord record = new DynamoHealthDataRecord(); record.setHealthCode("healthCode"); DynamoUpload2 upload = new DynamoUpload2(); upload.setStudyId("researcher-study-id"); upload.setCompletedBy(UploadCompletionClient.S3_WORKER); UploadView uploadView = new UploadView.Builder().withUpload(upload).withHealthDataRecord(record).build(); when(uploadService.getUploadView(UPLOAD_ID)).thenReturn(uploadView); Result result = controller.getUpload(UPLOAD_ID); assertEquals(200, result.status()); JsonNode node = TestUtils.getJson(result); assertEquals("s3_worker", node.get("completedBy").textValue()); assertEquals("Upload", node.get("type").textValue()); }

Target:
public void getUploadById() throws Exception { TestUtils.mockPlayContext(); doReturn(researcherSession).when(controller).getAuthenticatedSession(ADMIN); HealthDataRecord record = HealthDataRecord.create(); record.setHealthCode(HEALTH_CODE); DynamoUpload2 upload = new DynamoUpload2(); upload.setStudyId("researcher-study-id"); upload.setCompletedBy(UploadCompletionClient.S3_WORKER); UploadView uploadView = new UploadView.Builder().withUpload(upload).withHealthDataRecord(record).build(); when(uploadService.getUploadView(UPLOAD_ID)).thenReturn(uploadView); Result result = controller.getUpload(UPLOAD_ID); assertEquals(200, result.status()); JsonNode node = TestUtils.getJson(result); assertEquals("s3_worker", node.get("completedBy").textValue()); assertEquals("Upload", node.get("type").textValue()); assertEquals(HEALTH_CODE, node.get("healthData").get("healthCode").textValue()); }
Source:
private void readHeader() { version = ""; this.lastReadEntry = "ovf:Envelope"; XmlNode node = _document.SelectSingleNode(" if (node != null) { this.lastReadEntry = "Envelope['versio']"; version = node.attributes.get("ovf:version").getValue(); } }

Target:
private void readHeader() { version = ""; XmlNode node = selectSingleNode(_document, " if (node != null) { version = node.attributes.get("ovf:version").getValue(); } }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { Repository repository = getRepository(event); if (repository == null) { Shell shell = getShell(event); RepositoryCache repositoryCache = Activator.getDefault() .getRepositoryCache(); Repository[] repositories = repositoryCache.getAllRepositories(); ElementListSelectionDialog repositorySelectionDialog = new ElementListSelectionDialog( shell, new NoRepositorySelectedLabelProvider()); repositorySelectionDialog.setElements(repositories); repositorySelectionDialog.setTitle( UIText.FetchChangeFromGerritCommand_noRepositorySelectedTitle); if (repositorySelectionDialog.open() != Window.OK) { return null; } else { repository = (Repository) repositorySelectionDialog .getResult()[0]; } } FetchGerritChangeWizard wiz = new FetchGerritChangeWizard(repository); NonBlockingWizardDialog dlg = new NonBlockingWizardDialog( HandlerUtil.getActiveShellChecked(event), wiz); dlg.setHelpAvailable(false); dlg.open(); return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Repository repository = getRepository(event); if (repository == null) { Shell shell = getShell(event); GerritSelectRepositoryPage page = new GerritSelectRepositoryPage(); Wizard wizard = new Wizard() { @Override public boolean performFinish() { return true; } }; wizard.addPage(page); WizardDialog wizardDialog = new WizardDialog(shell, wizard); int result = wizardDialog.open(); if (result != Window.OK) { return null; } repository = page.getRepository(); } FetchGerritChangeWizard wiz = new FetchGerritChangeWizard(repository); NonBlockingWizardDialog dlg = new NonBlockingWizardDialog( HandlerUtil.getActiveShellChecked(event), wiz); dlg.setHelpAvailable(false); dlg.open(); return null; }
Source:
protected CognitoUserSession getCachedSession() { synchronized (GET_CACHED_SESSION_LOCK) { if (userId == null) { throw new CognitoNotAuthorizedException("User-ID is null"); } if (cipSession != null) { if (cipSession.isValidForThreshold()) { return cipSession; } } final CognitoUserSession cachedTokens = readCachedTokens(); if (cachedTokens.isValidForThreshold()) { cipSession = cachedTokens; return cipSession; } if (cachedTokens.getRefreshToken() != null) { try { cipSession = refreshSession(cachedTokens); cacheTokens(cipSession); return cipSession; } catch (final NotAuthorizedException nae) { clearCachedTokens(); throw new CognitoNotAuthorizedException("User is not authenticated", nae); } catch (final Exception e) { clearCachedTokens(); throw new CognitoInternalErrorException("Failed to authenticate user", e); } } throw new CognitoNotAuthorizedException("User is not authenticated"); } }

Target:
protected CognitoUserSession getCachedSession() { synchronized (GET_CACHED_SESSION_LOCK) { if (userId == null) { throw new CognitoNotAuthorizedException("User-ID is null"); } if (cipSession != null) { if (cipSession.isValidForThreshold()) { return cipSession; } } final CognitoUserSession cachedTokens = readCachedTokens(); if (cachedTokens.isValidForThreshold()) { cipSession = cachedTokens; return cipSession; } if (cachedTokens.getRefreshToken() != null) { try { cipSession = refreshSession(cachedTokens); cacheTokens(cipSession); return cipSession; } catch (final NotAuthorizedException nae) { clearCachedTokens(); throw new CognitoNotAuthorizedException("User is not authenticated", nae); } catch (final UserNotFoundException unfe) { clearCachedTokens(); throw new CognitoNotAuthorizedException("User does not exist", unfe); }catch (final Exception e) { throw new CognitoInternalErrorException("Failed to authenticate user", e); } } throw new CognitoNotAuthorizedException("User is not authenticated"); } }
Source:
public void testMaxAllocation() throws Exception { int maxAllocation = 1024; EmbeddedChannel chDecoder = new EmbeddedChannel(createDecoder(ZlibWrapper.NONE, maxAllocation)); TestByteBufAllocator alloc = new TestByteBufAllocator(chDecoder.alloc()); chDecoder.config().setAllocator(alloc); try { chDecoder.writeInbound(Unpooled.copiedBuffer(BYTES_LARGE)); fail("decompressed size > maxAllocation, so should have thrown exception"); } catch (DecompressionException e) { assertEquals(maxAllocation, alloc.getMaxAllocation()); } }

Target:
public void testMaxAllocation() throws Exception { int maxAllocation = 1024; ZlibDecoder decoder = createDecoder(ZlibWrapper.ZLIB, maxAllocation); EmbeddedChannel chDecoder = new EmbeddedChannel(decoder); TestByteBufAllocator alloc = new TestByteBufAllocator(chDecoder.alloc()); chDecoder.config().setAllocator(alloc); try { chDecoder.writeInbound(Unpooled.wrappedBuffer(deflate(BYTES_LARGE))); fail("decompressed size > maxAllocation, so should have thrown exception"); } catch (DecompressionException e) { assertTrue(e.getMessage().startsWith("Decompression buffer has reached maximum size")); assertEquals(maxAllocation, alloc.getMaxAllocation()); assertTrue(decoder.isClosed()); assertFalse(chDecoder.finish()); } }
Source:
public IntervalStatistics(IntervalManager intervalManager, StatisticsInterval selectedInterval) { this.selectedInterval = selectedInterval; intervalPersister = intervalManager.getIntervalsStatisticsPersister(); addIntervals(intervalManager); filterIntervals(); calculateStatistics(); }

Target:
public IntervalStatistics(IntervalManager intervalManager, StatisticsInterval selectedInterval) { intervalPersister = intervalManager.getIntervalsStatisticsPersister(); this.selectedInterval = selectedInterval; addIntervals(intervalManager); filterIntervals(); calculateStatistics(); }
Source:
public Take route(final Request req) throws IOException { final String file; final Href href = new RqHref(req).href(); final String key = "file"; final Iterator<String> param = href.param(key).iterator(); if (param.hasNext()) { file = param.next(); } else { final String disposition = new RqHeaders( new RqMultipart(req).part(key).iterator().next() ).header("Content-Disposition").iterator().next(); file = StringUtils.substringBefore( StringUtils.substringAfter(disposition, "filename=\""), "\"" ); } final Doc doc = this.base.user( new RqAuth(req).identity().urn() ).docs().doc(file); return new TsFork( new FkRegex("/doc/read", new TkRead(doc)), new FkRegex("/doc/delete", new TkDelete(doc)), new FkRegex( "/doc/write", new Takes() { @Override public Take route(final Request request) { return new TkWrite(doc, req); } } ), new FkRegex( "/doc/add-friend", new Takes() { @Override public Take route(final Request request) { return new TkAddFriend( doc, href.param("friend").iterator().next() ); } } ) ).route(req); }

Target:
public Take route(final Request req) throws IOException { final String file; final Href href = new RqHref(req).href(); final String key = "file"; final Iterator<String> param = href.param(key).iterator(); if (param.hasNext()) { file = param.next(); } else { final String disposition = new RqHeaders( new RqMultipart(req).part(key).iterator().next() ).header("Content-Disposition").iterator().next(); file = StringUtils.substringBefore( StringUtils.substringAfter(disposition, "filename=\""), "\"" ); } final Doc doc = this.base.user( new RqAuth(req).identity().urn() ).docs().doc(file); return new TsFork( new FkRegex("/doc/read", new TkRead(doc)), new FkRegex("/doc/delete", new TkDelete(doc)), new FkRegex( "/doc/write", new Takes() { @Override public Take route(final Request request) { return new TkWrite(doc, req); } } ), new FkRegex( "/doc/add-friend", new Takes() { @Override public Take route(final Request rst) throws IOException { return new TkAddFriend( doc, new RqForm(rst).param("friend").iterator().next() ); } } ), new FkRegex( "/doc/eject-friend", new Takes() { @Override public Take route(final Request rst) { return new TkEjectFriend( doc, href.param("friend").iterator().next() ); } } ) ).route(req); }
Source:
public NetCDFFileImportMethod(@Nonnull File sourceFile, Predicate<MsScan> msScanPredicate) { this.sourceFile = sourceFile; this.msScanPredicate = msScanPredicate != null ? msScanPredicate : s -> true; }

Target:
public NetCDFFileImportMethod(@Nonnull File sourceFile, Predicate<MsScan> msScanPredicate) { this.sourceFile = sourceFile; this.msScanPredicate = this.msScanPredicate.and(msScanPredicate); }
Source:
protected void run() throws Failure { if (all && projectNames.size() > 0) { throw new UnloggedFailure(1, "error: cannot combine --all and PROJECT"); } ReplicationState state = new ReplicationState(this, ReplicationType.COMMAND); Future<?> future = null; if (all) { future = pushAllFactory.create(urlMatch, state).schedule(0, TimeUnit.SECONDS); } else { for (String name : projectNames) { Project.NameKey key = new Project.NameKey(name); if (projectCache.get(key) != null) { replication.scheduleFullSync(key, urlMatch, state); } else { writeStdErrSync("error: '" + name + "': not a Gerrit project"); } } state.allTaskScheduled(); } if (wait) { if (future != null) { try { future.get(); } catch (InterruptedException e) { log.warn("Thread was interrupted while waiting for PushAll operation to finish", e); } catch (ExecutionException e) { log.warn("An exception was thrown in PushAll operation", e); } } if (state.hasPushTask()) { state.waitForReplication(); } else { writeStdOutSync("Everything is up-to-date. No need to replicate."); } } }

Target:
protected void run() throws Failure { if (all && projectNames.size() > 0) { throw new UnloggedFailure(1, "error: cannot combine --all and PROJECT"); } ReplicationState state = new ReplicationState(ReplicationType.COMMAND, this); Future<?> future = null; if (all) { future = pushAllFactory.create(urlMatch, state).schedule(0, TimeUnit.SECONDS); } else { for (String name : projectNames) { Project.NameKey key = new Project.NameKey(name); if (projectCache.get(key) != null) { replication.scheduleFullSync(key, urlMatch, state); } else { writeStdErrSync("error: '" + name + "': not a Gerrit project"); } } state.markAllPushTasksScheduled(); } if (wait) { if (future != null) { try { future.get(); } catch (InterruptedException e) { log.warn("Thread was interrupted while waiting for PushAll operation to finish", e); } catch (ExecutionException e) { log.warn("An exception was thrown in PushAll operation", e); } } if (state.hasPushTask()) { state.waitForReplication(); } else { writeStdOutSync("Nothing to replicate"); } } }
Source:
protected boolean canDoAction() { boolean retValue = isVmExist(); if (retValue) { List<VM> listVms = getVmDAO().getForDisk(_oldDisk.getId()).get(Boolean.TRUE); sharedLockMap = listVms.isEmpty() ? null : new HashMap<Guid, String>(); for (VM vm : listVms) { sharedLockMap.put(vm.getId(), LockingGroup.VM.name()); if (vm.getstatus() != VMStatus.Down) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL); return false; } } ImagesHandler.setDiskAlias(getParameters().getDiskInfo(), getVm()); retValue = isDiskExist(_oldDisk) && checkCanPerformRegularUpdate(); } return retValue; }

Target:
protected boolean canDoAction() { boolean retValue = isVmExist(); if (retValue) { List<VM> listVms = getVmDAO().getForDisk(_oldDisk.getId()).get(Boolean.TRUE); sharedLockMap = listVms.isEmpty() ? null : new HashMap<Guid, String>(); for (VM vm : listVms) { sharedLockMap.put(vm.getId(), LockingGroup.VM.name()); if (vm.getstatus() != VMStatus.Down) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL); return false; } } retValue = acquireLockInternal() && isDiskExist(_oldDisk) && checkCanPerformRegularUpdate(); } return retValue; }
Source:
@Test public void testCastToTimestamp() { final String sql = "select cast(\"timestamp\" as timestamp) from \"foodmart\""; final String druidQuery = "{\"queryType\":\"scan\",\"dataSource\":\"foodmart\"," + "\"intervals\":[\"1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z\"]," + "\"virtualColumns\":[{\"type\":\"expression\",\"name\":\"vc\"," + "\"expression\":\"timestamp_parse(" + "timestamp_format(\\\"__time\\\",'yyyy-MM-dd\\\\u0027T\\\\u0027HH:mm:ss.SSS\\\\u0027Z\\\\u0027'," + "'America/New_York'),'yyyy-MM-dd\\\\u0027T\\\\u0027HH:mm:ss.SSS\\\\u0027Z\\\\u0027','UTC')\"," + "\"outputType\":\"LONG\"}]," + "\"columns\":[\"vc\"]," + "\"resultFormat\":\"compactedList\"}"; CalciteAssert.that() .enable(enabled()) .withModel(FOODMART) .with(CalciteConnectionProperty.TIME_ZONE.camelName(), "America/New_York") .query(sql) .runs() .queryContains(list -> { assertThat(list.size(), is(1)); DruidQuery.QuerySpec querySpec = (DruidQuery.QuerySpec) list.get(0); assertThat(querySpec.getQueryString(null, -1), containsString(druidQuery)); }); }

Target:
@Test public void testCastToTimestamp() { final String sql = "select cast(\"timestamp\" as timestamp) from \"foodmart\""; final String druidQuery = "timestamp_format(\\\"__time\\\"," + "'yyyy-MM-dd\\\\u0027T\\\\u0027HH:mm:ss.SSS\\\\u0027Z\\\\u0027'," + "'America/New_York'),'yyyy-MM-dd\\\\u0027T\\\\u0027HH:mm:ss.SSS\\\\u0027Z\\\\u0027','UTC')\""; CalciteAssert.that() .enable(enabled()) .withModel(FOODMART) .with(CalciteConnectionProperty.TIME_ZONE.camelName(), "America/New_York") .query(sql) .runs() .queryContains(list -> { assertThat(list.size(), is(1)); DruidQuery.QuerySpec querySpec = (DruidQuery.QuerySpec) list.get(0); assertThat(querySpec.getQueryString(null, -1), containsString(druidQuery)); }); }
Source:
public synchronized void init(ByteBuffer buffer, int position) { MergingDigest emptyDigest = new MergingDigest(compression); putSketch(buffer, position, emptyDigest); }

Target:
public void init(ByteBuffer buffer, int position) { MergingDigest emptyDigest = new MergingDigest(compression); addToCache(buffer, position, emptyDigest); }
Source:
public int readActiveCache() { if (!cacheActiveEnabled) { return 0; } int index = 0; synchronized (cacheActiveFile) { if (!cacheActiveFile.exists()) { return 0; } try (RandomAccessFile raf = new RandomAccessFile(cacheActiveFile, "rw"); FileChannel fc = raf.getChannel(); FileLock lock = fc.tryLock()) { if (lock != null) { index = Integer.parseInt(raf.readLine()) % proxies.size(); } } catch (Throwable e) { LOG.warn("Filed to read active index from cache file " + cacheActiveFile, e); } } return index; }

Target:
private int readActiveCache() { if (!cacheActiveEnabled) { return 0; } int index = 0; synchronized (cacheActiveFile) { if (!cacheActiveFile.exists()) { return 0; } try (RandomAccessFile raf = new RandomAccessFile(cacheActiveFile, "rw"); FileChannel fc = raf.getChannel(); FileLock lock = fc.tryLock(0, Long.MAX_VALUE, true)) { if (lock != null) { index = Integer.parseInt(raf.readLine()) % proxies.size(); if (index < 0) { return 0; } } } catch (Throwable e) { LOG.warn("Failed to read active index from cache file " + cacheActiveFile + ", It may be due to permission issues, the " + "dfs.client.failover.cache-active.dir must be properly " + "configured! Now we will begin from index 0.", e); } } return index; }
Source:
public DataCenter get() { StoragePoolQueryParametersBase params = new StoragePoolQueryParametersBase(guid); params.setFiltered(SessionUtils.isFiltered()); return performGet(VdcQueryType.GetStoragePoolById, params); }

Target:
public DataCenter get() { return performGet(VdcQueryType.GetStoragePoolById, new StoragePoolQueryParametersBase(guid)); }
Source:
public String getSlaveAgentHostAddress() throws IOException { return new InetSocketAddress(0).getAddress().getHostAddress(); }

Target:
public String getSlaveAgentHostAddress() throws IOException, InterruptedException { return channel.call(new GetWildcardAddress()); }
Source:
public void should_support_db_key() { ComponentDto project = db.components().insertMainBranch(); ComponentDto mergeBranch = db.components().insertProjectBranch(project, b -> b.setKey("mergeBranch")); ComponentDto branch1 = db.components().insertProjectBranch(project, b -> b.setKey("branch1")); ComponentDto mergeBranchFile = ComponentTesting.newFileDto(mergeBranch, null, "file").setUuid("mergeFile"); ComponentDto file = ComponentTesting.newFileDto(branch1, null, "file").setUuid("file1"); db.components().insertComponents(mergeBranchFile, file); when(branch.getMergeBranchUuid()).thenReturn(Optional.of(mergeBranch.uuid())); assertThat(underTest.getUuid(file.getDbKey())).isEqualTo(mergeBranchFile.uuid()); }

Target:
public void should_support_db_key() { when(branch.getMergeBranchUuid()).thenReturn(Optional.of(mergeBranch.uuid())); assertThat(underTest.getUuid(branchFile.getDbKey())).isEqualTo(mergeBranchFile.uuid()); }
Source:
public Signature build() { return new Signature( name, kind, typeVariableConstraints, argumentTypes, returnType, variableArityGroup, variableArity); }

Target:
public Signature build() { assert name != null : "Signature requires the 'name' to be set"; assert kind != null : "Signature requires the 'kind' to be set"; assert returnType != null : "Signature requires the 'returnType' to be set"; return new Signature( name, kind, typeVariableConstraints, argumentTypes, returnType, variableArityGroup, variableArity); }
Source:
public void testGetValue() { dateSelector.getValue(); verify(view).getValue(); }

Target:
public void testGetValue() { final String expectedValue = "value"; when(view.getValue()).thenReturn(expectedValue); final String actualValue = dateSelector.getValue(); assertEquals(expectedValue, actualValue); }
Source:
private void proposeLeadershipOrWaitForBackoff(LeadershipState currentState) throws InterruptedException { if (!leaderEligible.get()) { if (leaderEligibilityLoggingRateLimiter.tryAcquire()) { log.debug("Not eligible for leadership"); } return; } if (isSuccessfulPing(pingLeader(currentState.greatestLearnedValue()))) { Thread.sleep(updatePollingRate.toMillis()); return; } boolean learnedNewState = updateLearnedStateFromPeers(currentState.greatestLearnedValue()); if (learnedNewState) { return; } long backoffTime = (long) (randomWaitBeforeProposingLeadership.toMillis() * Math.random()); log.debug("Waiting for ms before proposing leadership", SafeArg.of("waitTimeMs", backoffTime)); Thread.sleep(backoffTime); proposeLeadershipAfter(currentState.greatestLearnedValue()); }

Target:
private void proposeLeadershipOrWaitForBackoff(LeadershipState currentState) throws InterruptedException { if (!leaderEligible.get()) { if (leaderEligibilityLoggingRateLimiter.tryAcquire()) { log.debug("Not eligible for leadership"); } throw new InterruptedException("leader no longer eligible"); } if (pingLeader(currentState.greatestLearnedValue()).isSuccessful()) { Thread.sleep(updatePollingRate.toMillis()); return; } boolean learnedNewState = updateLearnedStateFromPeers(currentState.greatestLearnedValue()); if (learnedNewState) { return; } long backoffTime = (long) (randomWaitBeforeProposingLeadership.toMillis() * Math.random()); log.debug("Waiting for ms before proposing leadership", SafeArg.of("waitTimeMs", backoffTime)); Thread.sleep(backoffTime); proposeLeadershipAfter(currentState.greatestLearnedValue()); }
Source:
public void testDoesNotOverRead() { class ReadInterceptingHandler extends ChannelDuplexHandler { private int readsTriggered; @Override public void read(ChannelHandlerContext ctx) throws Exception { readsTriggered++; super.read(ctx); } } ReadInterceptingHandler interceptor = new ReadInterceptingHandler(); EmbeddedChannel channel = new EmbeddedChannel(); channel.config().setAutoRead(false); channel.pipeline().addLast(interceptor, new FixedLengthFrameDecoder(3)); assertEquals(0, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 0, 1 })); assertEquals(1, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 2 }), wrappedBuffer(new byte[] { 3, 4, 5 })); assertEquals(1, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 6, 7, 8 }), wrappedBuffer(new byte[] { 9 })); assertEquals(1, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 10, 11 }), wrappedBuffer(new byte[] { 12 })); assertEquals(1, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 13 })); assertEquals(2, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 14 })); assertEquals(2, interceptor.readsTriggered); for (int i = 0; i < 5; i++) { ByteBuf read = channel.readInbound(); assertEquals(i * 3 + 0, read.getByte(0)); assertEquals(i * 3 + 1, read.getByte(1)); assertEquals(i * 3 + 2, read.getByte(2)); } assertFalse(channel.finish()); }

Target:
public void testDoesNotOverRead() { class ReadInterceptingHandler extends ChannelOutboundHandlerAdapter { private int readsTriggered; @Override public void read(ChannelHandlerContext ctx) throws Exception { readsTriggered++; super.read(ctx); } } ReadInterceptingHandler interceptor = new ReadInterceptingHandler(); EmbeddedChannel channel = new EmbeddedChannel(); channel.config().setAutoRead(false); channel.pipeline().addLast(interceptor, new FixedLengthFrameDecoder(3)); assertEquals(0, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 0, 1 })); assertEquals(1, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 2 }), wrappedBuffer(new byte[] { 3, 4, 5 })); assertEquals(1, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 6, 7, 8 }), wrappedBuffer(new byte[] { 9 })); assertEquals(1, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 10, 11 }), wrappedBuffer(new byte[] { 12 })); assertEquals(1, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 13 })); assertEquals(2, interceptor.readsTriggered); channel.writeInbound(wrappedBuffer(new byte[] { 14 })); assertEquals(2, interceptor.readsTriggered); for (int i = 0; i < 5; i++) { ByteBuf read = channel.readInbound(); assertEquals(i * 3 + 0, read.getByte(0)); assertEquals(i * 3 + 1, read.getByte(1)); assertEquals(i * 3 + 2, read.getByte(2)); read.release(); } assertFalse(channel.finish()); }
Source:
public boolean hasUnionPlan() throws Exception { boolean result = false; ExecutionBlock terminalBlock = plan.getTerminalBlock(); terminalBlock.setPlan(terminalBlock.getPlan()); if (plan.getChilds(terminalBlock.getId()).size() >= 2) { result = true; } return result; }

Target:
public boolean hasUnionPlan() throws Exception { boolean result = false; ExecutionBlock terminalBlock = plan.getTerminalBlock(); if (plan.getChilds(terminalBlock.getId()).size() >= 2) { result = true; } return result; }
Source:
private static int getIntOffset(WindowFrameBound bound, Value[] values, Session session) { Value v = bound.isVariable() ? values[bound.getExpressionIndex()] : bound.getValue().getValue(session); int value = v.getInt(); if (v == ValueNull.INSTANCE || value < 0) { throw DbException.getInvalidValueException("unsigned range", v.getTraceSQL()); } return value; }

Target:
private static int getIntOffset(WindowFrameBound bound, Value[] values, Session session) { Value v = bound.isVariable() ? values[bound.getExpressionIndex()] : bound.getValue().getValue(session); int value = v.getInt(); if (v == ValueNull.INSTANCE || value < 0) { throw DbException.get(ErrorCode.INVALID_PRECEDING_OR_FOLLOWING_1, v.getTraceSQL()); } return value; }