auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String mapUser(String user) { log.info( "Profile='{}' authn='{}' authz='{}' mapping='{}'", getProfile(), getAuthnName(), getAuthzName(), getMappingName() ); if(getMappingExtension()!= null) { log.info("API: -->Mapping.InvokeCommands.MAP_USER user='{}'", user); user = getMappingExtension().invoke( new ExtMap().mput( Base.InvokeKeys.COMMAND, Mapping.InvokeCommands.MAP_USER ).mput( Mapping.InvokeKeys.USER, user ), true ).<String>get(Mapping.InvokeKeys.USER, user); log.info("API: <--Mapping.InvokeCommands.MAP_USER user='{}'", user); } return user; }

Target:
public String mapUser(String user) { if(getMappingExtension()!= null) { log.info("API: -->Mapping.InvokeCommands.MAP_USER profile='{}' user='{}'", getProfile(), user); user = getMappingExtension().invoke( new ExtMap().mput( Base.InvokeKeys.COMMAND, Mapping.InvokeCommands.MAP_USER ).mput( Mapping.InvokeKeys.USER, user ), true ).<String>get(Mapping.InvokeKeys.USER, user); log.info("API: <--Mapping.InvokeCommands.MAP_USER profile='{}' user='{}'", getProfile(), user); } return user; }
Source:
private static int chunkedRead(InflaterInputStream inflaterInputStream, byte[] buffer, int offset, int length) throws IOException { int position = offset; int bytesRead = 0; while (((position - offset) < length) && bytesRead != -1) { bytesRead = inflaterInputStream.read(buffer, position, offset + length - position); if (bytesRead > 0) { position += bytesRead; } } return position - offset; }

Target:
private static int chunkedRead(InflaterInputStream inflaterInputStream, byte[] buffer, int offset, int length) throws IOException { int position = offset; int bytesRead = 0; while (position - offset < length && bytesRead != -1) { bytesRead = inflaterInputStream.read(buffer, position, offset + length - position); if (bytesRead > 0) { position += bytesRead; } } return position - offset; }
Source:
public KubernetesController( String kubernetesURI, String kubernetesNamespace, String topologyName, boolean isVerbose ) { this.kubernetesURI = kubernetesURI; if (kubernetesNamespace == null) { LOG.log(Level.INFO, "Namespace not provided in configuration. Using default."); this.kubernetesNamespace = "default"; } else { this.kubernetesNamespace = kubernetesNamespace; } this.topologyName = topologyName; this.isVerbose = isVerbose; }

Target:
public KubernetesController(String kubernetesURI, String kubernetesNamespace, String topologyName, boolean isVerbose) { if (kubernetesNamespace == null) { this.baseUriPath = String.format("%s/api/v1/namespaces/default/pods", kubernetesURI); } else { this.baseUriPath = String.format("%s/api/v1/namespaces/%s/pods", kubernetesURI, kubernetesNamespace); } this.topologyName = topologyName; this.isVerbose = isVerbose; }
Source:
public void getUserInfo(Context context, SocialFactory.SOCIAL_SOURCE_TYPE socialType, String accessToken, final SocialLoginDelegate.SocialUserInfoCallback userInfoCallback) { final String url = "<LINK_0>" + accessToken; final OkHttpClientProvider okHttpClientProvider = RoboGuice.getInjector(context).getInstance(OkHttpClientProvider.class); okHttpClientProvider.get().newCall(new Request.Builder() .url(url) .get() .build()) .enqueue(new ErrorHandlingOkCallback<GoogleUserProfile>(context, GoogleUserProfile.class, CallTrigger.LOADING_UNCACHED) { @Override protected void onResponse(@NonNull GoogleUserProfile userProfile) { String name = userProfile.name; if (TextUtils.isEmpty(name)) { if (!TextUtils.isEmpty(userProfile.given_name)) { name = userProfile.given_name + " "; } if (!TextUtils.isEmpty(userProfile.family_name)) { name += userProfile.given_name; } } userInfoCallback.setSocialUserInfo(google.getEmail(), name); } }); }

Target:
public void getUserInfo(Context context, SocialFactory.SOCIAL_SOURCE_TYPE socialType, String accessToken, final SocialLoginDelegate.SocialUserInfoCallback userInfoCallback) { final OkHttpClientProvider okHttpClientProvider = RoboGuice.getInjector(context).getInstance(OkHttpClientProvider.class); okHttpClientProvider.get().newCall(new Request.Builder() .url(String.format(USER_INFO_URL, accessToken)) .get() .build()) .enqueue(new ErrorHandlingOkCallback<GoogleUserProfile>(context, GoogleUserProfile.class, CallTrigger.LOADING_UNCACHED) { @Override protected void onResponse(@NonNull GoogleUserProfile userProfile) { String name = userProfile.name; if (TextUtils.isEmpty(name)) { if (!TextUtils.isEmpty(userProfile.given_name)) { name = userProfile.given_name + " "; } if (!TextUtils.isEmpty(userProfile.family_name)) { if (TextUtils.isEmpty(name)) { name = userProfile.family_name; } else { name += userProfile.family_name; } } } userInfoCallback.setSocialUserInfo(google.getEmail(), name); } }); }
Source:
public void initializeFrom(ILaunchConfiguration config) { isInitializing = true; String remoteConnection = null; try { remoteConnection = config .getAttribute( IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION, ""); } catch (CoreException ce) { } String[] items = connectionCombo.getItems(); int i = 0; for (i = 0; i < items.length; i++) if (items[i].equals(remoteConnection)) break; if (i < items.length) connectionCombo.select(i); else if (items.length > 0) connectionCombo.select(0); super.initializeFrom(config); updateTargetProgFromConfig(config); updateSkipDownloadFromConfig(config); updateConnectionPulldown(); isInitializing = false; }

Target:
public void initializeFrom(ILaunchConfiguration config) { isInitializing = true; String remoteConnection = null; try { remoteConnection = config .getAttribute( IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION, ""); } catch (CoreException ce) { } String[] items = connectionCombo.getItems(); int i = 0; for (i = 0; i < items.length; i++) if (items[i].equals(remoteConnection)) break; if (i < items.length) connectionCombo.select(i); else if (items.length > 0) connectionCombo.select(0); super.initializeFrom(config); updateTargetProgFromConfig(config); updateSkipDownloadFromConfig(config); updateConnectionButtons(); isInitializing = false; }
Source:
public void inputObjectIsTransformedBeforeJdbcBindingWhenTransformerSpecifierTest() throws Exception { when(inputTransformer.transform(inputValue)).thenReturn(outputValue); when(inputTransformerFactory.getTransformer(inputValue.getClass())).thenReturn(inputTransformer); dbpa.set(inputValue); verify(statement).setObject(position, outputValue, sqlType, userDefinedTypeName); }

Target:
public void inputObjectIsTransformedBeforeJdbcBindingWhenTransformerSpecifierTest() throws Exception { TypeTransformer inputTransformer = mock(TypeTransformer.class); Integer outputValue = 5; when(inputTransformer.transform(inputValue)).thenReturn(outputValue); when(inputTransformerFactory.getTransformer(inputValue.getClass())).thenReturn(inputTransformer); dbpa.set(inputValue); verify(statement).setObject(position, outputValue, sqlType, userDefinedTypeName); }
Source:
private TypedResource getAndResolve(int resId, String qualifiers, boolean resolveRefs) { TypedResource value = resourceLoader.getValue(resId, qualifiers); if (resolveRefs) { value = resolve(value, qualifiers, resId); } if (value == null && "layout".equals(getResourceTypeName(resId))) { throw new UnsupportedOperationException("ugh, this doesn't work still?"); } return value; }

Target:
private TypedResource getAndResolve(int resId, String qualifiers, boolean resolveRefs) { TypedResource value = resourceTable.getValue(resId, qualifiers); if (resolveRefs) { value = resolve(value, qualifiers, resId); } return value; }
Source:
public static void sortSummarizedCoursesByCourseName(List<CourseSummaryBundle> courses) { Collections.sort(courses, new Comparator<CourseSummaryBundle>() { @Override public int compare(CourseSummaryBundle obj1, CourseSummaryBundle obj2) { return SanitizationHelper.desanitizeIfHtmlSanitized(obj1.course.getName()) .compareTo(SanitizationHelper.desanitizeIfHtmlSanitized(obj2.course.getName())); } }); }

Target:
public static void sortSummarizedCoursesByCourseName(List<CourseSummaryBundle> courses) { Collections.sort(courses, new Comparator<CourseSummaryBundle>() { @Override public int compare(CourseSummaryBundle obj1, CourseSummaryBundle obj2) { String courseName1 = obj1.course.getName(); String courseName2 = obj2.course.getName(); courseName1 = SanitizationHelper.desanitizeIfHtmlSanitized(courseName1); courseName2 = SanitizationHelper.desanitizeFromHtml(courseName2); return courseName1.compareTo(courseName2); } }); }
Source:
private void modifyDataTable(Admin admin, String tableName) throws IOException { TableDescriptorBuilder dataTableDescBuilder = TableDescriptorBuilder .newBuilder(admin.getDescriptor(TableName.valueOf(tableName))); if (upgrade) { if (admin.getDescriptor(TableName.valueOf(tableName)).hasCoprocessor(Indexer.class.getName())) { if (!dryRun) { dataTableDescBuilder.removeCoprocessor(Indexer.class.getName()); } LOGGER.info("Unloaded Indexer coprocessor on data table " + tableName); } else { LOGGER.info("Indexer coprocessor on data table " + tableName + " is already unloaded"); } if (!admin.getDescriptor(TableName.valueOf(tableName)).hasCoprocessor(IndexRegionObserver.class.getName())) { if (!dryRun) { dataTableDescBuilder.addCoprocessor(IndexRegionObserver.class.getName(), null, QueryServicesOptions.DEFAULT_COPROCESSOR_PRIORITY, prop); } LOGGER.info("Loaded IndexRegionObserver coprocessor on data table " + tableName); } else { LOGGER.info("IndexRegionObserver coprocessor on data table " + tableName + "is already loaded"); } } else { if (admin.getDescriptor(TableName.valueOf(tableName)) .hasCoprocessor(IndexRegionObserver.class.getName())) { if (!dryRun) { dataTableDescBuilder.removeCoprocessor(IndexRegionObserver.class.getName()); } LOGGER.info("Unloaded IndexRegionObserver coprocessor on data table " + tableName); } else { LOGGER.info("IndexRegionObserver coprocessor on data table " + tableName + " is already unloaded"); } if (!admin.getDescriptor(TableName.valueOf(tableName)).hasCoprocessor(Indexer.class.getName())) { if (!dryRun) { dataTableDescBuilder.addCoprocessor(Indexer.class.getName(), null, QueryServicesOptions.DEFAULT_COPROCESSOR_PRIORITY, prop); } LOGGER.info("Loaded Indexer coprocessor on data table " + tableName); } else { LOGGER.info("Indexer coprocessor on data table " + tableName + " is already loaded"); } } if (!dryRun) { admin.modifyTable(dataTableDescBuilder.build()); } }

Target:
private void modifyDataTable(Admin admin, String tableName) throws IOException { TableDescriptorBuilder tableDescBuilder = TableDescriptorBuilder .newBuilder(admin.getDescriptor(TableName.valueOf(tableName))); if (upgrade) { removeCoprocessor(admin, tableName, tableDescBuilder, Indexer.class.getName()); addCoprocessor(admin, tableName, tableDescBuilder, IndexRegionObserver.class.getName()); } else { removeCoprocessor(admin, tableName, tableDescBuilder, IndexRegionObserver.class.getName()); addCoprocessor(admin, tableName, tableDescBuilder, Indexer.class.getName()); } if (!dryRun) { admin.modifyTable(tableDescBuilder.build()); } }
Source:
public void maxRecordSize(int size) { Arguments.require(size > 0, "Size must be > 0"); maxRecordSize = size; }

Target:
public RecordParser maxRecordSize(int size) { Arguments.require(size > 0, "Size must be > 0"); maxRecordSize = size; return this; }
Source:
private void restoreKeyGroupsInStateHandle() throws IOException, StateMigrationException, RocksDBException { try { logger.info("Start to restore from state handle: {}.", currentKeyGroupsStateHandle); currentStateHandleInStream = currentKeyGroupsStateHandle.openInputStream(); cancelStreamRegistry.registerCloseable(currentStateHandleInStream); currentStateHandleInView = new DataInputViewStreamWrapper(currentStateHandleInStream); restoreKVStateMetaData(); restoreKVStateData(); logger.info("Finish to restore from state handle: {}.", currentKeyGroupsStateHandle); } finally { if (cancelStreamRegistry.unregisterCloseable(currentStateHandleInStream)) { IOUtils.closeQuietly(currentStateHandleInStream); } } }

Target:
private void restoreKeyGroupsInStateHandle() throws IOException, StateMigrationException, RocksDBException { try { logger.info("Starting to restore from state handle: {}.", currentKeyGroupsStateHandle); currentStateHandleInStream = currentKeyGroupsStateHandle.openInputStream(); cancelStreamRegistry.registerCloseable(currentStateHandleInStream); currentStateHandleInView = new DataInputViewStreamWrapper(currentStateHandleInStream); restoreKVStateMetaData(); restoreKVStateData(); logger.info("Finished restoring from state handle: {}.", currentKeyGroupsStateHandle); } finally { if (cancelStreamRegistry.unregisterCloseable(currentStateHandleInStream)) { IOUtils.closeQuietly(currentStateHandleInStream); } } }
Source:
public static void sinkToBottom(Entity entity) { IHex fallHex = entity.getGame().getBoard().getHex(entity.getPosition()); int waterDepth = 0; if (fallHex.containsTerrain(Terrains.WATER)) { waterDepth = fallHex.terrainLevel(Terrains.WATER); } entity.setElevation(-waterDepth); }

Target:
public static void sinkToBottom(Entity entity) { if((entity == null) || !entity.getGame().getBoard().contains(entity.getPosition())) { return; } IHex fallHex = entity.getGame().getBoard().getHex(entity.getPosition()); int waterDepth = 0; if (fallHex.containsTerrain(Terrains.WATER)) { boolean hexHasBridge = fallHex.containsTerrain(Terrains.BRIDGE_CF); boolean entityOnTopOfBridge = hexHasBridge && (entity.getElevation() == fallHex.ceiling()); if (!entityOnTopOfBridge) { waterDepth = fallHex.terrainLevel(Terrains.WATER); entity.setElevation(-waterDepth); } } }
Source:
public void testBuild() throws Exception { StdoutUploadStep step = new StdoutUploadStep(CREDENTIALS_ID, BUCKET_URI, new MockUploadModule(executor), LOG_NAME); FreeStyleProject project = jenkins.createFreeStyleProject("testBuild"); Bucket bucket = new Bucket(); bucket.setName(BUCKET_NAME); executor.throwWhen(Storage.Buckets.Get.class, notFoundException); executor.passThruWhen( Storage.Buckets.Insert.class, MockUploadModule.checkBucketName(BUCKET_NAME)); executor.passThruWhen(Storage.Objects.Insert.class, MockUploadModule.checkObjectName(LOG_NAME)); executor.throwWhen(Storage.Buckets.Get.class, notFoundException); executor.passThruWhen( Storage.Buckets.Insert.class, MockUploadModule.checkBucketName(BUCKET_NAME)); executor.passThruWhen(Storage.Objects.Insert.class, MockUploadModule.checkObjectName(LOG_NAME)); project.getBuildersList().add(step); FreeStyleBuild build = project.scheduleBuild2(0).get(); step.perform( build, build.getWorkspace(), build.getWorkspace().createLauncher(TaskListener.NULL), TaskListener.NULL); }

Target:
public void testBuild() throws Exception { StdoutUploadStep step = new StdoutUploadStep( CREDENTIALS_ID, BUCKET_URI, Optional.of(new MockUploadModule(executor)), LOG_NAME); FreeStyleProject project = jenkins.createFreeStyleProject("testBuild"); executor.throwWhen(Storage.Buckets.Get.class, notFoundException); executor.passThruWhen( Storage.Buckets.Insert.class, MockUploadModule.checkBucketName(BUCKET_NAME)); executor.passThruWhen(Storage.Objects.Insert.class, MockUploadModule.checkObjectName(LOG_NAME)); executor.throwWhen(Storage.Buckets.Get.class, notFoundException); executor.passThruWhen( Storage.Buckets.Insert.class, MockUploadModule.checkBucketName(BUCKET_NAME)); executor.passThruWhen(Storage.Objects.Insert.class, MockUploadModule.checkObjectName(LOG_NAME)); project.getPublishersList().add(step); FreeStyleBuild build = project.scheduleBuild2(0).get(); step.perform( build, build.getWorkspace(), build.getWorkspace().createLauncher(TaskListener.NULL), TaskListener.NULL); }
Source:
public Iterable<Chunk> getLoadedChunks() { IChunkProvider provider = this.getChunkProvider(); if (provider instanceof ChunkProviderServer) { return ((ChunkProviderServer) provider).loadedChunks; } return Collections.EMPTY_LIST; }

Target:
public Iterable<Chunk> getLoadedChunks() { return ((ChunkProviderServer) this.getChunkProvider()).loadedChunks; }
Source:
Mono<Response<TopicDescription>> updateTopicWithResponse(TopicDescription topic, Context context) { if (topic == null) { return monoError(logger, new NullPointerException("'topic' cannot be null")); } else if (topic.getName() == null || topic.getName().isEmpty()) { return monoError(logger, new IllegalArgumentException("'topic.getName' cannot be null or empty.")); } else if (context == null) { return monoError(logger, new NullPointerException("'context' cannot be null.")); } final CreateTopicBodyContent content = new CreateTopicBodyContent() .setType(CONTENT_TYPE) .setTopicDescription(topic); final CreateTopicBody createEntity = new CreateTopicBody() .setContent(content); final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, SERVICE_BUS_TRACING_NAMESPACE_VALUE); try { return entityClient.putWithResponseAsync(topic.getName(), createEntity, "*", withTracing) .onErrorMap(ServiceBusManagementAsyncClient::mapException) .map(response -> deserializeTopic(response)); } catch (RuntimeException ex) { return monoError(logger, ex); } }

Target:
Mono<Response<TopicDescription>> updateTopicWithResponse(TopicDescription topic, Context context) { if (topic == null) { return monoError(logger, new NullPointerException("'topic' cannot be null")); } else if (context == null) { return monoError(logger, new NullPointerException("'context' cannot be null.")); } final CreateTopicBodyContent content = new CreateTopicBodyContent() .setType(CONTENT_TYPE) .setTopicDescription(topic); final CreateTopicBody createEntity = new CreateTopicBody() .setContent(content); final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, SERVICE_BUS_TRACING_NAMESPACE_VALUE); try { return entityClient.putWithResponseAsync(topic.getName(), createEntity, "*", withTracing) .onErrorMap(ServiceBusManagementAsyncClient::mapException) .map(response -> deserializeTopic(response)); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
public Map<String, String> getError() { Map<String, String> error = new HashMap<String, String>(); if(row.has("key") && row.has("error")) { error.put(getKey().toString(), row.get("error").getAsString()); } return error; }

Target:
public String getError() { String error = null; if(row.has("key") && row.has("error")) { error = row.get("error").getAsString(); } return error; }
Source:
private void compactMoveChunks(Iterable<Chunk> move) { assert storeLock.isHeldByCurrentThread(); if (move != null) { long leftmostBlock = Long.MAX_VALUE; for (Chunk chunk : move) { leftmostBlock = Math.min(leftmostBlock, chunk.block); } writeStoreHeader(); sync(); long reservedAreaSize = getFileLengthInUse(); for (Iterator<Chunk> iter = move.iterator(); iter.hasNext(); ) { Chunk chunk = iter.next(); if (fileStore.predictAllocation(chunk.len) >= leftmostBlock) { break; } moveChunk(chunk, 0); iter.remove(); } for (Chunk chunk : move) { moveChunk(chunk, reservedAreaSize); } reuseSpace = false; commit(); sync(); Chunk chunk = lastChunk; reuseSpace = true; for (Chunk c : move) { moveChunk(c, 0); } commit(); sync(); if (moveChunk(chunk, 0)) { commit(); } shrinkFileIfPossible(0); sync(); } }

Target:
private void compactMoveChunks(Iterable<Chunk> move) { assert storeLock.isHeldByCurrentThread(); if (move != null) { assert lastChunk != null; writeStoreHeader(); sync(); Iterator<Chunk> iterator = move.iterator(); assert iterator.hasNext(); long leftmostBlock = iterator.next().block; long originalBlokCount = getAfterLastBlock(); for (Chunk chunk : move) { moveChunk(chunk, leftmostBlock, originalBlokCount); } store(leftmostBlock, originalBlokCount); sync(); Chunk chunkToMove = lastChunk; long postEvacuationBlockCount = getAfterLastBlock(); boolean chunkToMoveIsAlreadyInside = chunkToMove.block < leftmostBlock; boolean movedToEOF = !chunkToMoveIsAlreadyInside; for (Chunk c : move) { if (c.block >= originalBlokCount) { moveChunk(c, originalBlokCount, postEvacuationBlockCount); assert c.block < originalBlokCount; movedToEOF = true; } } assert postEvacuationBlockCount >= getAfterLastBlock(); if (movedToEOF) { boolean moved = moveChunkInside(chunkToMove, originalBlokCount); store(originalBlokCount, postEvacuationBlockCount); sync(); long lastBoundary = moved || chunkToMoveIsAlreadyInside ? postEvacuationBlockCount : chunkToMove.block; moved = !moved && moveChunkInside(chunkToMove, lastBoundary); if (moveChunkInside(lastChunk, lastBoundary) || moved) { store(lastBoundary, -1); } } shrinkFileIfPossible(0); sync(); } }
Source:
GHTreeBuilder(GHRepository repo) { this.repo = repo; req = repo.root.retrieve().method("POST"); }

Target:
GHTreeBuilder(GHRepository repo) { this.repo = repo; req = repo.root.createRequest(); }
Source:
public List<Biome.SpawnListEntry> getSpawns(List<Biome.SpawnListEntry> defaults, World world, EnumCreatureType creatureType, BlockPos pos) { if (spawn) { logger.info("Getting spawns {}", generator); spawn = false; } return defaults; }

Target:
public List<Biome.SpawnListEntry> getSpawns(List<Biome.SpawnListEntry> defaults, World world, EnumCreatureType creatureType, BlockPos pos) { if (spawn) { logger.info("Getting spawns {}", generator); spawn = false; } if(creatureType == EnumCreatureType.MONSTER){ return spawnList; } return defaults; }
Source:
public void shouldReturnTagByIdWithHttpCode200() throws Exception { Tag foundTag = TestTagBuilder.aTag().build(); when(tagServiceMock.findOne(foundTag.getId())).thenReturn(foundTag); mockMvc.perform(get("/api/v1/tags/{tagId}", foundTag.getId()) .accept(APPLICATION_JSON_UTF8)).andDo(print()) .andExpect(status().isOk()) .andExpect(content().contentType(APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$." + ID).value(is(((int) foundTag.getId())))) .andExpect(jsonPath("$.name").value(is(foundTag.getName()))) ; verify(tagServiceMock, times(1)).findOne(foundTag.getId()); verifyNoMoreInteractions(tagServiceMock); }

Target:
public void shouldReturnTagByIdWithHttpCode200() throws Exception { Tag foundTag = TestTagBuilder.aTag().build(); when(tagServiceMock.findOne(foundTag.getId())).thenReturn(foundTag); mockMvc.perform(get("/api/v1/tags/{tagId}", foundTag.getId()) .accept(APPLICATION_JSON_UTF8)).andDo(print()) .andExpect(status().isOk()) .andExpect(content().contentType(APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$." + ID).value(is(((int) foundTag.getId())))) .andExpect(jsonPath("$.name").value(is(foundTag.getName()))) .andExpect(jsonPath("$.links", hasSize(2))) .andExpect(jsonPath("$.links[0].rel").value(is(Link.REL_SELF))) .andExpect(jsonPath("$.links[0].href").value(containsString("/api/v1/tags/" + foundTag.getId()))) .andExpect(jsonPath("$.links[1].rel").value(is(TagResourceAsm.IDEAS_REL))) .andExpect(jsonPath("$.links[1].href").value(containsString("/api/v1/tags/" + foundTag.getId() + "/ideas"))); verify(tagServiceMock, times(1)).findOne(foundTag.getId()); verifyNoMoreInteractions(tagServiceMock); }
Source:
public void testStartFailure() { final Set<LongRange> rangesToMove = new HashSet<>(); rangesToMove.clear(); rangesToMove.add(new LongRange(0, 9)); try { migrationManager.startMigration("op", EVAL1, EVAL0, DATA_TYPE, rangesToMove, null); } catch (final RuntimeException e) { } try { migrationManager.startMigration("op", EVAL0, EVAL1, "Undefined", rangesToMove, null); fail(); } catch (final RuntimeException e) { } rangesToMove.add(new LongRange(110, 120)); try { migrationManager.startMigration("op", EVAL0, EVAL1, DATA_TYPE, rangesToMove, null); fail(); } catch (final RuntimeException e) { } }

Target:
public void testStartFailure() { final Set<LongRange> rangesToMove = new HashSet<>(); rangesToMove.clear(); rangesToMove.add(new LongRange(0, 9)); try { migrationManager.startMigration(OP_ID, EVAL1, EVAL0, DATA_TYPE, rangesToMove, null); fail(); } catch (final RuntimeException e) { } partitionManager.register(EVAL0, DATA_TYPE, INITIAL_RANGE0); partitionManager.register(EVAL1, DATA_TYPE, INITIAL_RANGE1); try { migrationManager.startMigration(OP_ID, EVAL0, EVAL1, "Undefined", rangesToMove, null); fail(); } catch (final RuntimeException e) { } rangesToMove.add(new LongRange(101, 110)); try { migrationManager.startMigration(OP_ID, EVAL0, EVAL1, DATA_TYPE, rangesToMove, null); fail(); } catch (final RuntimeException e) { } }
Source:
public final void dispose() { Binding[] bindingArray = (Binding[]) bindings.toArray(new Binding[bindings.size()]); for (Binding element : bindingArray) { element.dispose(); } ValidationStatusProvider[] statusProviderArray = (ValidationStatusProvider[]) validationStatusProviders .toArray(new ValidationStatusProvider[validationStatusProviders .size()]); for (int i = 0; i < statusProviderArray.length; i++) { if (!statusProviderArray[i].isDisposed()) statusProviderArray[i].dispose(); } }

Target:
public final void dispose() { Binding[] bindingArray = (Binding[]) bindings.toArray(new Binding[bindings.size()]); for (Binding binding : bindingArray) { binding.dispose(); } ValidationStatusProvider[] statusProviderArray = (ValidationStatusProvider[]) validationStatusProviders .toArray(new ValidationStatusProvider[validationStatusProviders .size()]); for (int i = 0; i < statusProviderArray.length; i++) { if (!statusProviderArray[i].isDisposed()) statusProviderArray[i].dispose(); } }
Source:
public void testA3UseCase() throws IOException { final Resource left = input.getLeft(); final Resource right = input.getRight(); PostProcessorDescriptorRegistryImpl registry = new PostProcessorDescriptorRegistryImpl(); registry.put(TestPostProcessor.class.getName(), new TestPostProcessorDescriptor(Pattern .compile(".*/nides"), null, new TestPostProcessor(), 10)); final IComparisonScope scope = EMFCompare.createDefaultScope(left, right); final Comparison comparison = EMFCompare.builder().setPostProcessorRegistry(registry).build() .compare(scope); assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getMatches().size())); }

Target:
public void testA3UseCase() throws IOException { final Resource left = input.getLeft(); final Resource right = input.getRight(); final Comparison comparison = compareWithPostProcessing(left, right, Pattern.compile(".*/nides"), null); assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getMatches().size())); }
Source:
public void serviceMethod(String string) { invoked = true; }

Target:
public Object serviceMethod(String string) { invoked = true; return new ObjectTest("testObject"); }
Source:
public VaultPackage getPackage() throws IOException { this.vltPkg = registry.open(installState.getFilePath().toFile()); return this.vltPkg; }

Target:
public VaultPackage getPackage() throws IOException { if (this.vltPkg == null) { this.vltPkg = registry.open(filepath.toFile()); } return this.vltPkg; }
Source:
public String[] getLines() { String fileContent = new String(uploadedFile.getContents(), StandardCharsets.UTF_8); if (null == fileContent || "".equals(fileContent.trim())) { return null; } return fileContent.split("[\\r\\n]+"); }

Target:
public String[] getLines() { String fileContent = new String(uploadedFile.getContents(), StandardCharsets.UTF_8); if (null == fileContent || fileContent.trim().length() == 0) { return null; } return fileContent.split("[\\r\\n]+"); }
Source:
public void onEntityBlockForm(final EntityBlockFormEvent event) { if (!Prism.getIgnore().event("entity-form", event.getBlock())) { return; } final Block block = event.getBlock(); final Location loc = block.getLocation(); final BlockState newState = event.getNewState(); if (event.getEntity() instanceof Player) { final OfflinePlayer player = (OfflinePlayer)event.getEntity(); RecordingQueue.addToQueue(ActionFactory.createBlockChange("entity-form", loc, block.getType(), block.getBlockData(), newState.getType(), newState.getBlockData(), player)); } else { final String entity = event.getEntity().getType().name().toLowerCase(); RecordingQueue.addToQueue(ActionFactory.createBlockChange("entity-form", loc, block.getType(), block.getBlockData(), newState.getType(), newState.getBlockData(), entity)); } }

Target:
public void onEntityBlockForm(final EntityBlockFormEvent event) { if (!Prism.getIgnore().event("entity-form", event.getBlock())) { return; } final Block block = event.getBlock(); final Location loc = block.getLocation(); final BlockState newState = event.getNewState(); if (event.getEntity() instanceof Player) { final Player player = (Player)event.getEntity(); RecordingQueue.addToQueue(ActionFactory.createBlockChange("entity-form", loc, block.getType(), block.getBlockData(), newState.getType(), newState.getBlockData(), player)); } else { final String entity = event.getEntity().getType().name().toLowerCase(); RecordingQueue.addToQueue(ActionFactory.createBlockChange("entity-form", loc, block.getType(), block.getBlockData(), newState.getType(), newState.getBlockData(), entity)); } }
Source:
public void start(ResourceManagerId newResourceManagerId, Executor newMainThreadExecutor, ResourceActions newResourceActions) { LOG.info("Starting the SlotManager."); this.resourceManagerId = Preconditions.checkNotNull(newResourceManagerId); mainThreadExecutor = Preconditions.checkNotNull(newMainThreadExecutor); resourceActions = Preconditions.checkNotNull(newResourceActions); started = true; taskManagerValidCheck = scheduledExecutor.scheduleWithFixedDelay( () -> mainThreadExecutor.execute( () -> checkValidTaskManagers()), 0L, taskManagerTimeout.toMilliseconds(), TimeUnit.MILLISECONDS); slotRequestTimeoutCheck = scheduledExecutor.scheduleWithFixedDelay( () -> mainThreadExecutor.execute( () -> checkSlotRequestTimeouts()), 0L, slotRequestTimeout.toMilliseconds(), TimeUnit.MILLISECONDS); registerSlotManagerMetrics(); allocateRedundantSlots(redundantSlotNum); }

Target:
public void start(ResourceManagerId newResourceManagerId, Executor newMainThreadExecutor, ResourceActions newResourceActions) { LOG.info("Starting the SlotManager."); this.resourceManagerId = Preconditions.checkNotNull(newResourceManagerId); mainThreadExecutor = Preconditions.checkNotNull(newMainThreadExecutor); resourceActions = Preconditions.checkNotNull(newResourceActions); started = true; taskManagerTimeoutsAndRedundancyCheck = scheduledExecutor.scheduleWithFixedDelay( () -> mainThreadExecutor.execute( () -> checkTaskManagerTimeoutsAndRedundancy()), 0L, taskManagerTimeout.toMilliseconds(), TimeUnit.MILLISECONDS); slotRequestTimeoutCheck = scheduledExecutor.scheduleWithFixedDelay( () -> mainThreadExecutor.execute( () -> checkSlotRequestTimeouts()), 0L, slotRequestTimeout.toMilliseconds(), TimeUnit.MILLISECONDS); registerSlotManagerMetrics(); }
Source:
public void sendMetricNotExceedCharLim(){ Metric metric = new Metric(METRIC_KEY_NOT_EXCEEDING, 1278, new Date(), "", ImmutableSet.of(), ImmutableMap.of("what", WHAT, "pod", TAG_VAL_NOT_EXCEEDING), "test_proc"); final List<Metric> metricsList = Collections.singletonList(metric); when(sender.createSession()).thenReturn(session); sink.start(); Future<Void> future = sink.sendMetrics(metricsList); while (!future.isDone()){ } sink.stop(); List<DataPoint> points = session.getDataPoints(); assertEquals(1, points.size()); DataPoint point = points.get(0); assertEquals(METRIC_KEY_NOT_EXCEEDING.length() + 1 + WHAT.length(), point.getMetric().length()); for (Dimension d : point.getDimensionsList()){ String dimVal = d.getValue(); assertTrue(dimVal.length() <= CHAR_LIMIT); } }

Target:
public void sendMetricNotExceedCharLim() throws ExecutionException, InterruptedException { Metric metric = new Metric(METRIC_KEY_NOT_EXCEEDING, 1278, new Date(), "", ImmutableSet.of(), ImmutableMap.of("what", WHAT, "pod", TAG_VAL_NOT_EXCEEDING), "test_proc"); final List<Metric> metricsList = Collections.singletonList(metric); ArgumentCaptor<DataPoint> captor = ArgumentCaptor.forClass(DataPoint.class); when(sender.createSession()).thenReturn(mockSession); when(mockSession.setDatapoint(captor.capture())).thenReturn(mockSession); sink.start(); Future<Void> future = sink.sendMetrics(metricsList); future.get(); sink.stop(); List<DataPoint> points = captor.getAllValues(); assertEquals(1, points.size()); DataPoint point = points.get(0); assertEquals(METRIC_KEY_NOT_EXCEEDING.length() + 1 + WHAT.length(), point.getMetric().length()); for (Dimension d : point.getDimensionsList()){ String dimVal = d.getValue(); assertTrue(dimVal.length() <= CHAR_LIMIT); } }
Source:
private String nextQuotedValue(char quote) throws IOException { char[] buffer = this.buffer; StringBuilder builder = null; while (true) { int p = pos; int l = limit; int start = p; while (p < l) { int c = buffer[p++]; if (c == quote) { pos = p; int len = p - start - 1; if(null == builder) { return new String(buffer, start, len); } else { builder.append(buffer, start, len); return builder.toString(); } } else if (c == '\\') { pos = p; int len = p - start - 1; char escapeChar = readEscapeCharacter(); if(null == builder) { int estimatedLength = (len + pos - p) * 2; builder = new StringBuilder(estimatedLength < 16 ? 16 : estimatedLength); } builder.append(buffer, start, len); builder.append(escapeChar); p = pos; l = limit; start = p; } else if (c == '\n') { lineNumber++; lineStart = p; } } if(null == builder) { int len = (p - start) * 2; builder = new StringBuilder(len < 16 ? 16 : len); } builder.append(buffer, start, p - start); pos = p; if (!fillBuffer(1)) { throw syntaxError("Unterminated string"); } } }

Target:
private String nextQuotedValue(char quote) throws IOException { char[] buffer = this.buffer; StringBuilder builder = null; while (true) { int p = pos; int l = limit; int start = p; while (p < l) { int c = buffer[p++]; if (c == quote) { pos = p; int len = p - start - 1; if (builder == null) { return new String(buffer, start, len); } else { builder.append(buffer, start, len); return builder.toString(); } } else if (c == '\\') { pos = p; int len = p - start - 1; char escapeChar = readEscapeCharacter(); if (builder == null) { int estimatedLength = (len + pos - p) * 2; builder = new StringBuilder(Math.max(estimatedLength, 16)); } builder.append(buffer, start, len); builder.append(escapeChar); p = pos; l = limit; start = p; } else if (c == '\n') { lineNumber++; lineStart = p; } } if (builder == null) { int estimatedLength = (p - start) * 2; builder = new StringBuilder(Math.max(estimatedLength, 16)); } builder.append(buffer, start, p - start); pos = p; if (!fillBuffer(1)) { throw syntaxError("Unterminated string"); } } }
Source:
public Optional<Map<String, HiveColumnStatistics>> getTableColumnStatistics(String databaseName, String tableName, Set<String> columnNames) { throw new GlueUnsupportedException(HIVE_METASTORE_ERROR, "getTableColumnStatistics is not supported by Glue, please set hive.table-statistics-enabled=false"); }

Target:
public Optional<Map<String, HiveColumnStatistics>> getTableColumnStatistics(String databaseName, String tableName, Set<String> columnNames) { return Optional.of(ImmutableMap.of()); }
Source:
private void fixSurveyAssignments(DatastoreService ds) { if (surveyAssignments.size() > 0) { for (Entity e : surveyAssignments) { ArrayList<Long> surveyIds = ((ArrayList<Long>) e.getProperty("formIds")); ArrayList<Long> fixedFormIds = new ArrayList<>(); for (Long id : surveyIds) { if (!forms.contains(id)) { fixedFormIds.add(id); } } if (fixedFormIds.size() != surveyIds.size()) { e.setProperty("formIds", fixedFormIds); surveyAssignmentsToSave.add(e); } } System.out.println("Found " + surveyAssignmentsToSave.size() + " SurveyAssignment to modify"); if (surveyAssignmentsToSave.size() > 0) { ds.put(surveyAssignmentsToSave); System.out.println("Fixed SurveyAssignment"); } } else { System.out.println("No SurveyAssignment found to fix"); } }

Target:
private void fixSurveyAssignments(DatastoreService ds) { if (surveyAssignments.size() > 0) { for (Entity e : surveyAssignments) { ArrayList<Long> formIds = ((ArrayList<Long>) e.getProperty("formIds")); ArrayList<Long> fixedFormIds = new ArrayList<>(); for (Long id : formIds) { if (!forms.contains(id)) { fixedFormIds.add(id); } } if (fixedFormIds.size() != formIds.size()) { e.setProperty("formIds", fixedFormIds); e.setProperty("lastUpdateDateTime", new Date()); surveyAssignmentsToSave.add(e); } } System.out.println("Found " + surveyAssignmentsToSave.size() + " SurveyAssignment to modify"); if (surveyAssignmentsToSave.size() > 0) { ds.put(surveyAssignmentsToSave); System.out.println("Fixed SurveyAssignment"); } } else { System.out.println("No SurveyAssignment found to fix"); } }
Source:
static void startMIDlet() { if (BGUtils.launchMIDletCalled) { return; } AmsUtil.executeWithArgs(MIDletSuiteStorage.getMIDletSuiteStorage(), 0, BGUtils.getFGMIDletNumber(), BGUtils.getFGMIDletClass(), null, null, null, null, -1, -1, 3, null, false); }

Target:
static void startMIDlet() { if (BGUtils.launchMIDletCalled) { return; } AmsUtil.executeWithArgs(MIDletSuiteStorage.getMIDletSuiteStorage(), 0, BGUtils.getFGMIDletNumber(), BGUtils.getFGMIDletClass(), null, null, null, null, -1, -1, Isolate.MAX_PRIORITY, null, false); }
Source:
String buildJson(VirtualGuest virtualGuest) { TemplateObject templateObject = null; String hostname = checkNotNull(virtualGuest.getHostname(), "hostname"); String domain = checkNotNull(virtualGuest.getDomain(), "domain"); int startCpus = checkNotNull(virtualGuest.getStartCpus(), "startCpus"); int maxMemory = checkNotNull(virtualGuest.getMaxMemory(), "maxMemory"); boolean localDiskFlag = checkNotNull(virtualGuest.isLocalDiskFlag(), "localDiskFlag"); String datacenterName = checkNotNull(virtualGuest.getDatacenter().getName(), "datacenterName"); Set<NetworkComponent> networkComponents = getNetworkComponents(virtualGuest); if(virtualGuest.getOperatingSystem() != null) { String operatingSystemReferenceCode = checkNotNull(virtualGuest.getOperatingSystem() .getOperatingSystemReferenceCode(), "operatingSystemReferenceCode"); templateObject = new TemplateObject(hostname, domain, startCpus, maxMemory, true, operatingSystemReferenceCode, null, localDiskFlag, new Datacenter(datacenterName), networkComponents, getBlockDevices(virtualGuest)); } else if(virtualGuest.getVirtualGuestBlockDeviceTemplateGroup() != null) { String globalIdentifier = checkNotNull(virtualGuest.getVirtualGuestBlockDeviceTemplateGroup() .getGlobalIdentifier(), "blockDeviceTemplateGroup.globalIdentifier"); templateObject = new TemplateObject(hostname, domain, startCpus, maxMemory, true, null, new BlockDeviceTemplateGroup(globalIdentifier), localDiskFlag, new Datacenter(datacenterName), networkComponents, null); } return json.toJson(ImmutableMap.of("parameters", ImmutableList.<TemplateObject> of(templateObject))); }

Target:
String buildJson(VirtualGuest virtualGuest) { TemplateObject templateObject = null; String hostname = checkNotNull(virtualGuest.getHostname(), "hostname"); String domain = checkNotNull(virtualGuest.getDomain(), "domain"); int startCpus = checkNotNull(virtualGuest.getStartCpus(), "startCpus"); int maxMemory = checkNotNull(virtualGuest.getMaxMemory(), "maxMemory"); boolean localDiskFlag = checkNotNull(virtualGuest.isLocalDiskFlag(), "localDiskFlag"); String datacenterName = checkNotNull(virtualGuest.getDatacenter().getName(), "datacenterName"); Set<NetworkComponent> networkComponents = getNetworkComponents(virtualGuest); if(virtualGuest.getOperatingSystem() != null) { String operatingSystemReferenceCode = checkNotNull(virtualGuest.getOperatingSystem() .getOperatingSystemReferenceCode(), "operatingSystemReferenceCode"); templateObject = new TemplateObject(hostname, domain, startCpus, maxMemory, true, operatingSystemReferenceCode, null, localDiskFlag, new Datacenter(datacenterName), networkComponents, getBlockDevices(virtualGuest)); } else if(virtualGuest.getVirtualGuestBlockDeviceTemplateGroup() != null) { String globalIdentifier = checkNotNull(virtualGuest.getVirtualGuestBlockDeviceTemplateGroup() .getGlobalIdentifier(), "blockDeviceTemplateGroup.globalIdentifier"); templateObject = new TemplateObject(hostname, domain, startCpus, maxMemory, true, null, new BlockDeviceTemplateGroup(globalIdentifier), localDiskFlag, new Datacenter(datacenterName), networkComponents, null); } return json.toJson(ImmutableMap.of("parameters", ImmutableList.of(templateObject))); }
Source:
private static void prepareResponseBuilderForPartialRequestWithSingleRange(ByteRange byteRange, long inputLength, HttpServletResponse response) { String contentRangeHeaderValue = String.format("bytes %d-%d/%d", byteRange.getOffset(), inputLength - 1L, inputLength); response.setHeader(HttpHeaders.CONTENT_RANGE, contentRangeHeaderValue); response.setHeader(HttpHeaders.PRAGMA, "no-cache"); response.setStatus(PARTIAL_CONTENT.value()); }

Target:
private static void prepareResponseBuilderForPartialRequestWithSingleRange(ByteRange byteRange, long inputLength, HttpServletResponse response) { String contentRangeHeaderValue = String.format("bytes %d-%d/%d", byteRange.getOffset(), inputLength - 1L, inputLength); response.setHeader(HttpHeaders.CONTENT_RANGE, contentRangeHeaderValue); response.setStatus(PARTIAL_CONTENT.value()); }
Source:
public void onEvent(MachineStatusEvent event) { try { final ChannelBroadcastMessage bm = new ChannelBroadcastMessage(); bm.setChannel("workspace:" + event.getWorkspaceId() + ":machines_statuses"); bm.setBody(DtoFactory.getInstance().toJson(event)); WSConnectionContext.sendMessage(bm); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } }

Target:
public void onEvent(MachineStatusEvent event) { try { final ChannelBroadcastMessage bm = new ChannelBroadcastMessage(); bm.setChannel(format(ENVIRONMENT_STATUS_CHANNEL_TEMPLATE, event.getWorkspaceId())); bm.setBody(DtoFactory.getInstance().toJson(event)); WSConnectionContext.sendMessage(bm); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } }
Source:
static XmlPullParser createParser(@IdRes int res) throws XmlPullParserException, IOException { InputStream stream = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getResources() .openRawResource(res); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser parser = factory.newPullParser(); parser.setInput(stream, null); parser.next(); return parser; }

Target:
static XmlPullParser createParser(@IdRes int res) throws XmlPullParserException, IOException { InputStream stream = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getResources() .openRawResource(res); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser parser = factory.newPullParser(); parser.setInput(stream, null); return parser; }
Source:
public static IMultipart createPart(ResourceLocation partType, NBTTagCompound tag) { IAdvancedPartFactory factory = GameRegistry.findRegistry(MultipartRegistryEntry.class).getValue(partType); return factory == null ? null : factory.createPart(partType, tag); }

Target:
public static IMultipart createPart(ResourceLocation partType, NBTTagCompound tag) { IAdvancedPartFactory factory = ForgeRegistries.MULTIPARTS.getValue(partType); return factory == null ? null : factory.createPart(partType, tag); }
Source:
private Row checkRealmObjectConstraints(String fieldName, @Nullable RealmModel value) { if (value != null) { if (!(RealmObject.isManaged(value) && RealmObject.isValid(value))) { throw new IllegalArgumentException("'value' is not a valid a valid, managed Realm object."); } ProxyState proxyState = ((RealmObjectProxy) value).realmGet$proxyState(); if (!proxyState.getRealm$realm().getPath().equals(realm.getPath())) { throw new IllegalArgumentException("'value' does not belong to the same Realm as the RealmResults."); } Table currentTable = osResults.getTable(); long columnIndex = currentTable.getColumnIndex(fieldName); Table expectedTable = currentTable.getLinkTarget(columnIndex); Table inputTable = proxyState.getRow$realm().getTable(); if (!expectedTable.hasSameSchema(inputTable)) { throw new IllegalArgumentException(String.format(Locale.US, "Type of object is wrong. Was '%s', expected '%s'", inputTable.getClassName(), expectedTable.getClassName())); } return proxyState.getRow$realm(); } return null; }

Target:
private Row checkRealmObjectConstraints(String fieldName, @Nullable RealmModel value) { if (value != null) { if (!(RealmObject.isManaged(value) && RealmObject.isValid(value))) { throw new IllegalArgumentException("'value' is not a valid, managed Realm object."); } ProxyState proxyState = ((RealmObjectProxy) value).realmGet$proxyState(); if (!proxyState.getRealm$realm().getPath().equals(realm.getPath())) { throw new IllegalArgumentException("'value' does not belong to the same Realm as the RealmResults."); } Table currentTable = osResults.getTable(); long columnIndex = currentTable.getColumnIndex(fieldName); Table expectedTable = currentTable.getLinkTarget(columnIndex); Table inputTable = proxyState.getRow$realm().getTable(); if (!expectedTable.hasSameSchema(inputTable)) { throw new IllegalArgumentException(String.format(Locale.US, "Type of object is wrong. Was '%s', expected '%s'", inputTable.getClassName(), expectedTable.getClassName())); } return proxyState.getRow$realm(); } return null; }
Source:
public void init(Command afterInit) { navServices.call((NavTree n) -> { navTree = n; afterInit.execute(); }).loadNavTree(); }

Target:
public void init(Command afterInit) { navServices.call((NavTree n) -> { navTree = n; if (afterInit != null) { afterInit.execute(); } }).loadNavTree(); }
Source:
private BroadcastTrimmer broadcastTrimmer() { return new ScheduleResolverBroadcastTrimmer( null, scheduleResolver, contentResolver, contentWriter ); }

Target:
private BroadcastTrimmer broadcastTrimmer() { return new ScheduleResolverBroadcastTrimmer( scheduleResolver, contentResolver, contentWriter ); }
Source:
public List<EngineMessage> validate(VmInit vmInit) { if (vmInit != null) { setDefaultNetworkProtocolIfNeeded(vmInit); switch (vmInit.getCloudInitNetworkProtocol()) { case OPENSTACK_METADATA: return new VmInitToOpenStackMetadataAdapter().validate(vmInit); case ENI: } } return Collections.emptyList(); }

Target:
public List<EngineMessage> validate(VmInit vmInit) { if (vmInit != null && isOpenstackMetadataProtocol(vmInit)) { return new VmInitToOpenStackMetadataAdapter().validate(vmInit); } return Collections.emptyList(); }
Source:
public void checkHeader(String distribId) { if (distribId != null) { assertEquals(String.format("Browsing Distribution '%s'", distribId), header.getText()); } else { assertTrue(header.getText(), header.getText().startsWith("Browsing Distribution")); } }

Target:
public void checkHeader(String distribId) { String text = header.getText(); if (distribId != null) { assertEquals(String.format("Browsing Distribution '%s'", distribId), text); } else { assertTrue(text, text.startsWith("Browsing Distribution")); } }
Source:
public void process(final K key, final Change<V1> change) { if (key == null) { LOG.warn( "Skipping record due to null key. change=[{}] topic=[{}] partition=[{}] offset=[{}]", change, context().topic(), context().partition(), context().offset() ); metrics.skippedRecordsSensor().record(); return; } R newValue = null; final long resultTimestamp; R oldValue = null; final ValueAndTimestamp<V2> valueAndTimestamp2 = valueGetter.get(key); final V2 value2 = getValueOrNull(valueAndTimestamp2); final long timestamp2; if (value2 == null) { if (change.newValue == null && change.oldValue == null) { return; } timestamp2 = UNKNOWN; } else { timestamp2 = valueAndTimestamp2.timestamp(); } final long timestamp1; if (change.newValue == null) { timestamp1 = UNKNOWN; } else { timestamp1 = context().timestamp(); } resultTimestamp = Math.max(timestamp1, timestamp2); if (value2 != null || change.newValue != null) { newValue = joiner.apply(change.newValue, value2); } if (sendOldValues && (value2 != null || change.oldValue != null)) { oldValue = joiner.apply(change.oldValue, value2); } context().forward(key, new Change<>(newValue, oldValue), To.all().withTimestamp(resultTimestamp)); }

Target:
public void process(final K key, final Change<V1> change) { if (key == null) { LOG.warn( "Skipping record due to null key. change=[{}] topic=[{}] partition=[{}] offset=[{}]", change, context().topic(), context().partition(), context().offset() ); metrics.skippedRecordsSensor().record(); return; } R newValue = null; final long resultTimestamp; R oldValue = null; final ValueAndTimestamp<V2> valueAndTimestamp2 = valueGetter.get(key); final V2 value2 = getValueOrNull(valueAndTimestamp2); if (value2 == null) { if (change.newValue == null && change.oldValue == null) { return; } resultTimestamp = context().timestamp(); } else { resultTimestamp = Math.max(context().timestamp(), valueAndTimestamp2.timestamp()); } if (value2 != null || change.newValue != null) { newValue = joiner.apply(change.newValue, value2); } if (sendOldValues && (value2 != null || change.oldValue != null)) { oldValue = joiner.apply(change.oldValue, value2); } context().forward(key, new Change<>(newValue, oldValue), To.all().withTimestamp(resultTimestamp)); }