auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void addVmStatic() { VmStatic vmStatic = getParameters().getVmStaticData(); if (vmStatic.getOrigin() == null) { vmStatic.setOrigin(OriginType.valueOf(Config.<String> GetValue(ConfigValues.OriginType))); } vmStatic.setId(getVmId()); vmStatic.setQuotaId(getQuotaId()); vmStatic.setCreationDate(new Date()); vmStatic.setCreatedByUserId(getUserId()); if (vmStatic.getCustomProperties() != null) { VMCustomProperties properties = VmPropertiesUtils.getInstance().parseProperties(getVdsGroupDAO() .get(getParameters().getVm().getVdsGroupId()) .getcompatibility_version(), vmStatic.getCustomProperties()); String predefinedProperties = properties.getPredefinedProperties(); String userDefinedProperties = properties.getUseDefinedProperties(); vmStatic.setPredefinedProperties(predefinedProperties); vmStatic.setUserDefinedProperties(userDefinedProperties); } vmStatic.setOriginalTemplateGuid(vmStatic.getVmtGuid()); VmTemplate template = getVmTemplateDAO().get(vmStatic.getVmtGuid()); vmStatic.setOriginalTemplateName(template.getName()); getVmStaticDao().save(vmStatic); getCompensationContext().snapshotNewEntity(vmStatic); }

Target:
protected void addVmStatic() { VmStatic vmStatic = getParameters().getVmStaticData(); if (vmStatic.getOrigin() == null) { vmStatic.setOrigin(OriginType.valueOf(Config.<String> GetValue(ConfigValues.OriginType))); } vmStatic.setId(getVmId()); vmStatic.setQuotaId(getQuotaId()); vmStatic.setCreationDate(new Date()); vmStatic.setCreatedByUserId(getUserId()); if (vmStatic.getCustomProperties() != null) { VMCustomProperties properties = VmPropertiesUtils.getInstance().parseProperties(getVdsGroupDAO() .get(getParameters().getVm().getVdsGroupId()) .getcompatibility_version(), vmStatic.getCustomProperties()); String predefinedProperties = properties.getPredefinedProperties(); String userDefinedProperties = properties.getUseDefinedProperties(); vmStatic.setPredefinedProperties(predefinedProperties); vmStatic.setUserDefinedProperties(userDefinedProperties); } vmStatic.setOriginalTemplateGuid(vmStatic.getVmtGuid()); if (VmTemplateHandler.BlankVmTemplateId.equals(vmStatic.getVmtGuid())) { vmStatic.setOriginalTemplateName(VmTemplateHandler.BlankVmTemplateName); } else { VmTemplate template = getVmTemplateDAO().get(vmStatic.getVmtGuid()); vmStatic.setOriginalTemplateName(template.getName()); } getVmStaticDao().save(vmStatic); getCompensationContext().snapshotNewEntity(vmStatic); }
Source:
public static String sendHttpGet(final String url) throws Exception { HttpUriRequest request = RequestBuilder.get(url).setHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON) .build(); return httpClient.execute(request, getStringResponseHandler()); }

Target:
public static String sendHttpGet(final String url) throws Exception { HttpUriRequest request = RequestBuilder.get(url).setHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON).build(); return HTTP_CLIENT.execute(request, getStringResponseHandler()); }
Source:
public static void append(File file, Object text, String charset, boolean writeBom) throws IOException { Writer writer = null; try { boolean shouldWriteBom = writeBom && !file.exists(); FileOutputStream out = new FileOutputStream(file, true); if (shouldWriteBom) { IOGroovyMethods.writeUTF16BomIfRequired(charset, out); } writer = new OutputStreamWriter(out, charset); InvokerHelper.write(writer, text); writer.flush(); Writer temp = writer; writer = null; temp.close(); } finally { closeWithWarning(writer); } }

Target:
public static void append(File file, Object text, String charset, boolean writeBom) throws IOException { Writer writer = null; try { boolean shouldWriteBom = writeBom && !file.exists(); FileOutputStream out = new FileOutputStream(file, true); if (shouldWriteBom) { IOGroovyMethods.writeUTF16BomIfRequired(out, charset); } writer = new OutputStreamWriter(out, charset); InvokerHelper.write(writer, text); writer.flush(); Writer temp = writer; writer = null; temp.close(); } finally { closeWithWarning(writer); } }
Source:
public void setPropertyFileLocation(String propertyFileLocation) { if (propertyFileLocation != null && !propertyFileLocation.isEmpty() && !propertyFileLocation.equals(this.propertyFileLocation)) { Properties p = new Properties(); try { p.load(getClass().getResourceAsStream(propertyFileLocation)); } catch (FileNotFoundException e) { LOGGER.debug("File not found when attempting to load user properties file.", e); } catch (IOException e) { LOGGER.debug("Exception when trying to load the user properties file.", e); } propBackingEngine = new PropertiesBackingEngine(p); List<UserPrincipal> userList = propBackingEngine.listUsers(); userMapping = new HashMap(); for (UserPrincipal eachUser : userList) { List<RolePrincipal> userRoles = propBackingEngine.listRoles(eachUser); List<String> roleList = new ArrayList(); for (RolePrincipal userRole : userRoles) { roleList.add(userRole.getName()); } userMapping.put(eachUser.getName(), StringUtils.join(roleList, ",")); } } this.propertyFileLocation = propertyFileLocation; }

Target:
public void setPropertyFileLocation(String propertyFileLocation) { if (propertyFileLocation != null && !propertyFileLocation.isEmpty() && !propertyFileLocation.equals(this.propertyFileLocation.toString())) { setPropertyFileLocation(Paths.get(propertyFileLocation)); } }
Source:
protected boolean set(EntityLivingBase container, Float value) { container.fallDistance = value; return true; }

Target:
protected boolean set(EntityLivingBase container, Float value) { container.fallDistance = Preconditions.checkNotNull(value); return true; }
Source:
private void savePostAndOptionallyFinish(final boolean doFinish, final boolean forceSave) { new Thread(new Runnable() { @Override public void run() { boolean isFirstTimePublish = isFirstTimePublish(false); boolean postUpdateSuccessful = updatePostObject(); if (!postUpdateSuccessful) { return; } boolean isPublishable = PostUtils.isPublishable(mPost); boolean shouldSave = shouldSavePost() || forceSave; boolean shouldSync = isPublishable || !isNewPost(); if (doFinish) { saveResult(shouldSave && shouldSync, isDiscardable(), false); } definitelyDeleteBackspaceDeletedMediaItems(); if (shouldSave) { PostStatus status = PostStatus.fromPost(mPost); boolean isNotRestarting = mRestartEditorOption == RestartEditorOptions.NO_RESTART; if ((status == PostStatus.DRAFT || status == PostStatus.PENDING) && isPublishable && !hasFailedMedia() && NetworkUtils.isNetworkAvailable(getBaseContext()) && isNotRestarting && mSite.isUsingWpComRestApi()) { mPostEditorAnalyticsSession.setOutcome(Outcome.SAVE); savePostOnlineAndFinishAsync(isFirstTimePublish, doFinish); } else { mPostEditorAnalyticsSession.setOutcome(Outcome.SAVE); if (forceSave) { savePostOnlineAndFinishAsync(false, false); } else { savePostLocallyAndFinishAsync(doFinish); } } } else { if (isDiscardable()) { mDispatcher.dispatch(PostActionBuilder.newRemovePostAction(mPost)); } removePostOpenInEditorStickyEvent(); if (doFinish) { mPostEditorAnalyticsSession.setOutcome(Outcome.CANCEL); finish(); } } } }).start(); }

Target:
private void savePostAndOptionallyFinish(final boolean doFinish, final boolean forceSave) { new Thread(new Runnable() { @Override public void run() { boolean isFirstTimePublish = isFirstTimePublish(false); boolean postUpdateSuccessful = updatePostObject(); if (!postUpdateSuccessful) { return; } boolean isPublishable = PostUtils.isPublishable(mPost); boolean shouldSave = shouldSavePost() || forceSave; boolean shouldSync = isPublishable || !isNewPost(); if (doFinish) { saveResult(shouldSave && shouldSync, isDiscardable(), false); } definitelyDeleteBackspaceDeletedMediaItems(); if (shouldSave) { boolean isNotRestarting = mRestartEditorOption == RestartEditorOptions.NO_RESTART; boolean isWpComOrIsLocalDraft = mSite.isUsingWpComRestApi() || mPost.isLocalDraft(); if (isPublishable && !hasFailedMedia() && NetworkUtils.isNetworkAvailable(getBaseContext()) && isNotRestarting && isWpComOrIsLocalDraft) { mPostEditorAnalyticsSession.setOutcome(Outcome.SAVE); savePostOnlineAndFinishAsync(isFirstTimePublish, doFinish); } else { mPostEditorAnalyticsSession.setOutcome(Outcome.SAVE); if (forceSave) { savePostOnlineAndFinishAsync(false, false); } else { savePostLocallyAndFinishAsync(doFinish); } } } else { if (isDiscardable()) { mDispatcher.dispatch(PostActionBuilder.newRemovePostAction(mPost)); } removePostOpenInEditorStickyEvent(); if (doFinish) { mPostEditorAnalyticsSession.setOutcome(Outcome.CANCEL); finish(); } } } }).start(); }
Source:
public V apply(Map.Entry<Key, Value> keyValueEntry) { EventFields eventFields = new EventFields(); eventFields.read(kryo, new Input(keyValueEntry.getValue().get()), EventFields.class); V entry = buildTupleCollectionFromKey(keyValueEntry.getKey()); for (Map.Entry<String, EventFields.FieldValue> fieldValue : eventFields.entries()) { String[] aliasVal = splitPreserveAllTokens(new String(fieldValue.getValue().getValue()), ONE_BYTE); Object javaVal = typeRegistry.decode(aliasVal[0], aliasVal[1]); String vis = fieldValue.getValue().getVisibility().getExpression().length > 0 ? new String(fieldValue.getValue().getVisibility().getExpression()) : ""; try { Map<String,Object> meta = metadataSerDe.deserialize(fieldValue.getValue().getMetadata()); if(meta != null) { Map<String,Object> metadata = new HashMap<String,Object>(); metadata.putAll(meta); setVisibility(metadata, vis); Tuple tuple = new Tuple(fieldValue.getKey(), javaVal, metadata); entry.put(tuple); } else { Map<String,Object> metadata = new HashMap<String,Object>(); setVisibility(metadata, vis); Tuple tuple = new Tuple(fieldValue.getKey(), javaVal, metadata); entry.put(tuple); } } catch(Exception e) { log.error("There was an error deserializing the metadata for a tuple", e); } } return entry; }

Target:
public V apply(Map.Entry<Key, Value> keyValueEntry) { EventFields eventFields = new EventFields(); eventFields.read(kryo, new Input(keyValueEntry.getValue().get()), EventFields.class); V entry = buildTupleCollectionFromKey(keyValueEntry.getKey()); for (Map.Entry<String, EventFields.FieldValue> fieldValue : eventFields.entries()) { String[] aliasVal = splitPreserveAllTokens(new String(fieldValue.getValue().getValue()), ONE_BYTE); Object javaVal = typeRegistry.decode(aliasVal[0], aliasVal[1]); String vis = fieldValue.getValue().getVisibility().getExpression().length > 0 ? new String(fieldValue.getValue().getVisibility().getExpression()) : ""; try { Map<String,Object> meta = metadataSerDe.deserialize(fieldValue.getValue().getMetadata()); Map<String,Object> metadata = (meta == null ? new HashMap<String,Object>() : new HashMap<String,Object>(meta)); setVisibility(metadata, vis); Tuple tuple = new Tuple(fieldValue.getKey(), javaVal, metadata); entry.put(tuple); } catch(Exception e) { log.error("There was an error deserializing the metadata for a tuple", e); } } return entry; }
Source:
public void startAndShutdownWithDefaults() throws Exception { System.setProperty(NinjaProperties.NINJA_EXTERNAL_CONF, "conf/minimal.conf"); NinjaJetty nj = new NinjaJetty(); nj.setPort(randomPort); try { Assert.assertEquals(new Integer(randomPort), nj.port); Assert.assertNull(nj.host); Assert.assertNull(nj.ninjaContextPath); Assert.assertEquals(NinjaMode.prod, nj.ninjaMode); nj.start(); Assert.assertNotNull("http://localhost:" + randomPort, nj.ninjaProperties.get(NinjaConstant.serverName)); Assert.assertNotNull(nj.context); Assert.assertNotNull(nj.ninjaServletListener); Assert.assertTrue(nj.context.isAvailable()); Assert.assertTrue(nj.context.isStarted()); Assert.assertTrue(nj.server.isStarted()); nj.shutdown(); Assert.assertTrue(nj.context.isStopped()); Assert.assertTrue(nj.server.isStopped()); } finally { nj.shutdown(); } }

Target:
public void startAndShutdownWithDefaults() throws Exception { System.setProperty(NinjaProperties.NINJA_EXTERNAL_CONF, "conf/minimal.conf"); NinjaJetty nj = new NinjaJetty(); nj.setPort(randomPort); try { assertEquals(new Integer(randomPort), nj.port); assertNull(nj.host); assertNull(nj.ninjaContextPath); assertEquals(NinjaMode.prod, nj.ninjaMode); nj.start(); assertNotNull("http://localhost:" + randomPort, nj.ninjaProperties.get(NinjaConstant.serverName)); assertNotNull(nj.context); assertNotNull(nj.ninjaServletListener); assertTrue(nj.context.isAvailable()); assertTrue(nj.context.isStarted()); assertTrue(nj.server.isStarted()); nj.shutdown(); assertTrue(nj.context.isStopped()); assertTrue(nj.server.isStopped()); } finally { nj.shutdown(); } }
Source:
public List<Condition> searchConditionByName(String name) throws NotImplementedException { return null; }

Target:
public List<Condition> searchConditionByName(String name) { throw new NotImplementedException(); }
Source:
public ConfigurableApplicationContext run(String[] parentArgs) { ConfigurableApplicationContext parentContext = this.parentContext != null ? this.parentContext : AggregateApplication.createParentContext(parentArgs); SharedChannelRegistry sharedChannelRegistry = parentContext .getBean(SharedChannelRegistry.class); List<AppConfigurer<?>> apps = new ArrayList<AppConfigurer<?>>(); if (this.sourceConfigurer != null) { apps.add(sourceConfigurer); } if (!processorConfigurers.isEmpty()) { for (ProcessorConfigurer processorConfigurer : processorConfigurers) { apps.add(processorConfigurer); } } if (this.sinkConfigurer != null) { apps.add(sinkConfigurer); } List<Class<?>> appsToEmbed = new ArrayList<>(); String namespace = null; for (int i = 0; i < apps.size(); i++) { AppConfigurer<?> appConfigurer = apps.get(i); appsToEmbed.add(appConfigurer.getApp()); if (namespace == null) { namespace = appConfigurer.namespace; } } AggregateApplication.prepareSharedChannelRegistry(sharedChannelRegistry, appsToEmbed.toArray(new Class<?>[0]), namespace); for (int i = apps.size() - 1; i >= 0; i--) { AppConfigurer<?> appConfigurer = apps.get(i); appConfigurer.namespace(AggregateApplication .getNamespace(namespace, appConfigurer.getApp().getName(), i)); appConfigurer.embed(); } return parentContext; }

Target:
public ConfigurableApplicationContext run(String[] parentArgs) { ConfigurableApplicationContext parentContext = this.parentContext != null ? this.parentContext : AggregateApplication.createParentContext(parentArgs); SharedChannelRegistry sharedChannelRegistry = parentContext .getBean(SharedChannelRegistry.class); List<AppConfigurer<?>> apps = new ArrayList<AppConfigurer<?>>(); if (this.sourceConfigurer != null) { apps.add(sourceConfigurer); } if (!processorConfigurers.isEmpty()) { for (ProcessorConfigurer processorConfigurer : processorConfigurers) { apps.add(processorConfigurer); } } if (this.sinkConfigurer != null) { apps.add(sinkConfigurer); } LinkedHashMap<Class<?>, String> appsToEmbed = new LinkedHashMap<>(); for (int i = 0; i < apps.size(); i++) { AppConfigurer<?> appConfigurer = apps.get(i); Class<?> appToEmbed = appConfigurer.getApp(); appsToEmbed.put(appToEmbed, appConfigurer.namespace); } AggregateApplication.prepareSharedChannelRegistry(sharedChannelRegistry, appsToEmbed); for (int i = apps.size() - 1; i >= 0; i--) { AppConfigurer<?> appConfigurer = apps.get(i); appConfigurer.namespace(AggregateApplication .getNamespace(appConfigurer.namespace, appConfigurer.getApp().getName(), i)); appConfigurer.embed(); } return parentContext; }
Source:
public void save() { clusters.stream().forEach(ICluster::save); Preferences accountRoot = getAccountsPreferences(); ISecurePreferences accountSecureRoot = getSecureAccountsPreferences(); removed.stream().forEach(id -> { try { accountRoot.node(id).removeNode(); accountSecureRoot.node(id).removeNode(); } catch (BackingStoreException e) { OpenShiftIOCoreActivator.logError(e.getLocalizedMessage(), e); } }); removed.clear(); }

Target:
public void save() { clusters.forEach(ICluster::save); Preferences accountRoot = getAccountsPreferences(); ISecurePreferences accountSecureRoot = getSecureAccountsPreferences(); removed.forEach(id -> { removeAccount(id ,accountRoot, accountSecureRoot); }); removed.clear(); }
Source:
public void onMediaUploadCancelClicked(String mediaId, boolean delete) { if (!TextUtils.isEmpty(mediaId)) { int localMediaId = Integer.valueOf(mediaId); EventBus.getDefault().post(new PostEvents.PostMediaCanceled(localMediaId)); } else { EventBus.getDefault().post(new PostEvents.PostMediaCanceled(true)); } }

Target:
public void onMediaUploadCancelClicked(String mediaId, boolean delete) { if (!TextUtils.isEmpty(mediaId)) { int localMediaId = Integer.valueOf(mediaId); EventBus.getDefault().post(new PostEvents.PostMediaCanceled(localMediaId)); } else { ToastUtils.showToast(this, getString(R.string.error_all_media_upload_canceled)); EventBus.getDefault().post(new PostEvents.PostMediaCanceled(true)); } }
Source:
private Revision getRevision(RevCommit commit, String sFilePath) throws GitAPIException, IOException { List<String> commitParentsList = getCommitParents(commit); List<Branch> commitBranchesList = getCommitBranches(commit, ListMode.ALL); List<DiffCommitFile> diffCommitFilesList = getCommitDiffFiles(commit,sFilePath); GitUser oAuthor = getCommitAuthor(commit); GitUser oCommitter = getCommitCommitter(commit); Revision revision = createDto(Revision.class).withId(commit.getId() .getName()) .withMessage(commit.getFullMessage()) .withCommitTime((long) commit.getCommitTime() * 1000) .withCommitter(oCommitter) .withAuthor(oAuthor) .withBranches(commitBranchesList) .withCommitParent(commitParentsList) .withDiffCommitFile(diffCommitFilesList); return revision; }

Target:
private Revision getRevision(RevCommit commit, String sFilePath) throws GitAPIException, IOException { List<String> commitParentsList = Stream.of(commit.getParents()) .map(RevCommit::getName) .collect(Collectors.toList()); List<Branch> commitBranchesList = getCommitBranches(commit, ListMode.ALL); List<DiffCommitFile> diffCommitFilesList = getCommitDiffFiles(commit,sFilePath); GitUser author = getCommitAuthor(commit); GitUser committer = getCommitCommitter(commit); Revision revision = createDto(Revision.class).withId(commit.getId() .getName()) .withMessage(commit.getFullMessage()) .withCommitTime((long) commit.getCommitTime() * 1000) .withCommitter(committer) .withAuthor(author) .withBranches(commitBranchesList) .withCommitParent(commitParentsList) .withDiffCommitFile(diffCommitFilesList); return revision; }
Source:
public void hasNoActiveMemberships_shouldReturnFalseIfOneExists() throws Exception{ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date endDateLater = dateFormat.parse("2100-02-01 00:00:00"); Cohort cohort = new Cohort(3); CohortMembership temp = new CohortMembership(7); temp.setVoided(false); temp.setEndDate(endDateLater); cohort.addMembership(temp); assertFalse(cohort.hasNoActiveMemberships()); }

Target:
public void hasNoActiveMemberships_shouldReturnFalseIfOneExists() throws Exception{ Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_YEAR, 1); Date endDateLater = calendar.getTime(); Cohort cohort = new Cohort(3); CohortMembership temp = new CohortMembership(7); temp.setVoided(false); temp.setEndDate(endDateLater); cohort.addMembership(temp); assertFalse(cohort.hasNoActiveMemberships()); }
Source:
public boolean sendSerialData(XBee64BitAddress address, byte[] data) throws InterfaceNotOpenException, InvalidOperatingModeException, TimeoutException, IOException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); XBeePacket xbeePacket; XBeePacket receivedPacket; if (address == null || data == null) throw new NullPointerException("Address and data cannot be null"); logger.info("Sending data to >> {}.", address, HexUtils.byteArrayToHexString(data)); switch (getXBeeProtocol()) { case RAW_802_15_4: xbeePacket = new TX64Packet(getNextFrameID(), address, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket == null) return true; if (receivedPacket instanceof TXStatusPacket) { switch (((TXStatusPacket)receivedPacket).getTransmitStatus()) { case SUCCESS: return true; default: return false; } } else return false; default: xbeePacket = new TransmitPacket(getNextFrameID(), address, XBee16BitAddress.UNKNOWN_ADDRESS, 0, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket == null) return true; if (receivedPacket instanceof TransmitStatusPacket) { switch (((TransmitStatusPacket)receivedPacket).getTransmitStatus()) { case SUCCESS: return true; default: return false; } } else return false; } }

Target:
public boolean sendSerialData(XBee64BitAddress address, byte[] data) throws InterfaceNotOpenException, InvalidOperatingModeException, TimeoutException, IOException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); if (address == null) throw new NullPointerException("Address cannot be null"); if (data == null) throw new NullPointerException("Data cannot be null"); XBeePacket xbeePacket; XBeePacket receivedPacket; logger.info(toString() + "Sending serial data to >> {}.", address, HexUtils.byteArrayToHexString(data)); switch (getXBeeProtocol()) { case RAW_802_15_4: xbeePacket = new TX64Packet(getNextFrameID(), address, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket == null) return true; if (receivedPacket instanceof TXStatusPacket) { switch (((TXStatusPacket)receivedPacket).getTransmitStatus()) { case SUCCESS: return true; default: return false; } } else return false; default: xbeePacket = new TransmitPacket(getNextFrameID(), address, XBee16BitAddress.UNKNOWN_ADDRESS, 0, XBeeTransmitOptions.NONE, data); receivedPacket = sendXBeePacket(xbeePacket); if (receivedPacket == null) return true; if (receivedPacket instanceof TransmitStatusPacket) { switch (((TransmitStatusPacket)receivedPacket).getTransmitStatus()) { case SUCCESS: return true; default: return false; } } else return false; } }
Source:
public void removeContrib(EventDispatcherDescriptor contrib) { Iterator<EventDispatcherDescriptor> it = contribs.iterator(); while (it.hasNext()) { EventDispatcherDescriptor desc = it.next(); if (desc.getName().equals(contrib.getName())) { it.remove(); break; } } }

Target:
public void removeContrib(EventDispatcherDescriptor contrib) { contribs.removeIf(descriptor -> descriptor.getName().equals(contrib.getName())); }
Source:
public void testChangeMessageOfLastCommit(GitConnectionFactory connectionFactory) throws GitException, IOException { GitConnection connection = connectToGitRepositoryWithContent(connectionFactory, repository); int commitsBefore = connection.log(newDto(LogRequest.class)).getCommits().size(); CommitRequest commitRequest = newDto(CommitRequest.class).withMessage("Changed message").withAmend(true); connection.commit(commitRequest); int commitsAfter = connection.log(newDto(LogRequest.class)).getCommits().size(); assertEquals(commitsBefore, commitsAfter); assertEquals(connection.log(newDto(LogRequest.class)).getCommits().get(commitsAfter - 1).getMessage(), commitRequest.getMessage()); }

Target:
public void testChangeMessageOfLastCommit(GitConnectionFactory connectionFactory) throws GitException, IOException { GitConnection connection = connectToGitRepositoryWithContent(connectionFactory, repository); addFile(connection, "NewFile.txt", CONTENT); connection.add(newDto(AddRequest.class).withFilepattern(ImmutableList.of("NewFile.txt"))); connection.commit(newDto(CommitRequest.class).withMessage("First commit")); int beforeCommitsCount = connection.log(newDto(LogRequest.class)).getCommits().size(); CommitRequest commitRequest = newDto(CommitRequest.class).withMessage("Changed message").withAmend(true); connection.commit(commitRequest); int afterCommitsCount = connection.log(newDto(LogRequest.class)).getCommits().size(); assertEquals(beforeCommitsCount, afterCommitsCount); assertEquals(connection.log(newDto(LogRequest.class)).getCommits().get(0).getMessage(), commitRequest.getMessage()); }
Source:
public void reinstatePatchForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1").build(); context.setCurrentUser(admin); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .withdrawn() .build(); String token = getAuthToken(eperson.getEmail(), password); String tokenAdmin = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/withdrawn", "false"); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.withdrawn", Matchers.is(true))) .andExpect(jsonPath("$.inArchive", Matchers.is(false))); }

Target:
public void reinstatePatchForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1) .withName("Collection 1").build(); context.setCurrentUser(admin); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .withdrawn() .build(); String token = getAuthToken(eperson.getEmail(), password); String tokenAdmin = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/withdrawn", false); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.withdrawn", Matchers.is(true))) .andExpect(jsonPath("$.inArchive", Matchers.is(false))); }
Source:
private PostModel handleRemoteAutoSave(boolean isError, PostModel post) { if (!isError && isUploadingPostForPreview()) { mViewModel.hideSavingDialog(); updateOnSuccessfulUpload(); ActivityLauncher.previewPostOrPageForResult( EditPostActivity.this, mSite, post, mPostLoadingState == PostLoadingState.UPLOADING_FOR_PREVIEW ? RemotePreviewLogicHelper.RemotePreviewType.REMOTE_PREVIEW : RemotePreviewLogicHelper.RemotePreviewType.REMOTE_PREVIEW_WITH_REMOTE_AUTO_SAVE ); updatePostLoadingAndDialogState(PostLoadingState.PREVIEWING, post); } else if (isError || isRemoteAutoSaveError()) { updatePostLoadingAndDialogState(PostLoadingState.NONE); mUploadUtilsWrapper.showSnackbarError(findViewById(R.id.editor_activity), getString(R.string.remote_preview_operation_error)); } return post; }

Target:
private PostModel handleRemoteAutoSave(boolean isError, PostModel post) { mViewModel.hideSavingDialog(); if (!isError && isUploadingPostForPreview()) { updateOnSuccessfulUpload(); ActivityLauncher.previewPostOrPageForResult( EditPostActivity.this, mSite, post, mPostLoadingState == PostLoadingState.UPLOADING_FOR_PREVIEW ? RemotePreviewLogicHelper.RemotePreviewType.REMOTE_PREVIEW : RemotePreviewLogicHelper.RemotePreviewType.REMOTE_PREVIEW_WITH_REMOTE_AUTO_SAVE ); updatePostLoadingAndDialogState(PostLoadingState.PREVIEWING, post); } else if (isError || isRemoteAutoSaveError()) { updatePostLoadingAndDialogState(PostLoadingState.NONE); mUploadUtilsWrapper.showSnackbarError(findViewById(R.id.editor_activity), getString(R.string.remote_preview_operation_error)); } return post; }
Source:
public synchronized void addEncoding( long primarySSRC, long rtxSSRC, long fecSSRC, int order) { RTPEncoding encoding = new RTPEncoding(this, primarySSRC, rtxSSRC, fecSSRC); if (encoding.getPrimarySSRC() != -1) { encodingsBySSRC.put(encoding.getPrimarySSRC(), encoding); } if (encoding.getRTXSSRC() != -1) { encodingsBySSRC.put(encoding.getRTXSSRC(), encoding); } if (encoding.getFECSSRC() != -1) { encodingsBySSRC.put(encoding.getFECSSRC(), encoding); } encodingsByOrder.put(order, encoding); }

Target:
public synchronized void addEncoding( long primarySSRC, long rtxSSRC, long fecSSRC, int order) { RTPEncoding encoding = new RTPEncoding(this, primarySSRC, rtxSSRC, fecSSRC); encodingsBySSRC.put(encoding.getPrimarySSRC(), encoding); encodingsBySSRC.put(encoding.getRTXSSRC(), encoding); encodingsBySSRC.put(encoding.getFECSSRC(), encoding); encodingsByOrder.put(order, encoding); }
Source:
private void displayMessage(String message, boolean bad, boolean suppressToast) { if(!suppressToast) { Toast.makeText(this, message, Toast.LENGTH_LONG).show(); } if(isUsingNewUI()) { adapter.setNotificationTextForButton(R.layout.home_sync_button, false, message); } else { TextView syncMessage = (TextView)findViewById(R.id.home_sync_message); syncMessage.setText(message); int[] padding = {syncMessage.getPaddingLeft(), syncMessage.getPaddingTop(), syncMessage.getPaddingRight(),syncMessage.getPaddingBottom() }; if(bad){ syncMessage.setTextColor(getResources().getColor(R.color.red)); syncMessage.setTypeface(null, Typeface.BOLD); syncMessage.setBackgroundDrawable(getResources().getDrawable(R.drawable.bubble_danger)); } else{ syncMessage.setTextColor(getResources().getColor(R.color.black)); syncMessage.setTypeface(null, Typeface.NORMAL); syncMessage.setBackgroundDrawable(getResources().getDrawable(R.drawable.bubble)); } syncMessage.setPadding(padding[0],padding[1], padding[2], padding[3]); } }

Target:
private void displayMessage(String message, boolean bad, boolean suppressToast) { if (!suppressToast) { Toast.makeText(this, message, Toast.LENGTH_LONG).show(); } adapter.setNotificationTextForButton(R.layout.home_sync_button, false, message); }
Source:
protected void migrateComments(CoreSession session, RelationManager relationManager, CommentServiceConfig config, Statement statement) { Map<String, Object> ctxMap = Collections.singletonMap(ResourceAdapter.CORE_SESSION_CONTEXT_KEY, session); QNameResourceImpl object = (QNameResourceImpl) statement.getObject(); DocumentModel parent = (DocumentModel) relationManager.getResourceRepresentation(config.documentNamespace, object, ctxMap); QNameResourceImpl subject = (QNameResourceImpl) statement.getSubject(); DocumentModel comment = (DocumentModel) relationManager.getResourceRepresentation(config.commentNamespace, subject, ctxMap); if (parent != null && comment != null) { comment.setPropertyValue(COMMENT_PARENT_ID, parent.getId()); session.saveDocument(comment); } Graph graph = relationManager.getGraph(config.graphName, session); graph.remove(statement); }

Target:
protected void migrateComments(CoreSession session, RelationManager relationManager, CommentServiceConfig config, Statement statement) { Map<String, Object> ctxMap = Collections.singletonMap(ResourceAdapter.CORE_SESSION_CONTEXT_KEY, session); QNameResourceImpl object = (QNameResourceImpl) statement.getObject(); DocumentModel parent = (DocumentModel) relationManager.getResourceRepresentation(config.documentNamespace, object, ctxMap); QNameResourceImpl subject = (QNameResourceImpl) statement.getSubject(); DocumentModel comment = (DocumentModel) relationManager.getResourceRepresentation(config.commentNamespace, subject, ctxMap); if (parent != null && comment != null) { comment.setPropertyValue(COMMENT_PARENT_ID, parent.getId()); session.saveDocument(comment); } else if (parent == null && comment == null) { log.debug("Documents and do not exist, they can not be migrated", object.getLocalName(), subject.getLocalName()); } else { log.debug("Document does not exist, it can not be migrated", parent == null ? object.getLocalName() : subject.getLocalName()); } Graph graph = relationManager.getGraph(config.graphName, session); graph.remove(statement); }
Source:
public void testRangeQueried() { List<Token> tokens = updateTokens(Arrays.asList(100, 200, 300, 400)); Keyspace keyspace = Keyspace.open(KEYSPACE1); ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF_STANDARD1); cfs.clearUnsafe(); int rows = 100; for (int i = 0; i < rows; ++i) { RowUpdateBuilder builder = new RowUpdateBuilder(cfs.metadata(), 10, String.valueOf(i)); builder.clustering("c"); builder.add("val", String.valueOf(i)); builder.build().applyUnsafe(); } cfs.forceBlockingFlush(); PartitionRangeReadCommand command = (PartitionRangeReadCommand) Util.cmd(cfs).build(); StorageProxy.RangeIterator rangeIterator = new StorageProxy.RangeIterator(command, keyspace, ConsistencyLevel.ONE); StorageProxy.RangeCommandIterator data = new StorageProxy.RangeCommandIterator(rangeIterator, command, 1, 1000, keyspace, ConsistencyLevel.ONE, System.nanoTime()); int num = Util.size(data); assertEquals(rows, num); assertEquals(tokens.size() + 1, data.rangesQueried()); }

Target:
public void testRangeQueried() { List<Token> tokens = setTokens(Arrays.asList(100, 200, 300, 400)); int vnodeCount = tokens.size() + 1; Keyspace keyspace = Keyspace.open(KEYSPACE1); ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(CF_STANDARD1); cfs.clearUnsafe(); int rows = 100; for (int i = 0; i < rows; ++i) { RowUpdateBuilder builder = new RowUpdateBuilder(cfs.metadata(), 10, String.valueOf(i)); builder.clustering("c"); builder.add("val", String.valueOf(i)); builder.build().applyUnsafe(); } cfs.forceBlockingFlush(); PartitionRangeReadCommand command = (PartitionRangeReadCommand) Util.cmd(cfs).build(); Iterator<ReplicaPlan.ForRangeRead> ranges = rangeIterator(command, keyspace, false); StorageProxy.RangeCommandIterator data = new StorageProxy.RangeCommandIterator(ranges, command, 1, 1000, vnodeCount, System.nanoTime()); verifyRangeCommandIterator(data, rows, 2, vnodeCount); ranges = rangeIterator(command, keyspace, false); data = new StorageProxy.RangeCommandIterator(ranges, command, vnodeCount, 1000, vnodeCount, System.nanoTime()); verifyRangeCommandIterator(data, rows, 1, vnodeCount); ranges = rangeIterator(command, keyspace, false); data = new StorageProxy.RangeCommandIterator(ranges, command, 1, 1, vnodeCount, System.nanoTime()); verifyRangeCommandIterator(data, rows, vnodeCount, vnodeCount); ranges = rangeIterator(command, keyspace, true); data = new StorageProxy.RangeCommandIterator(ranges, command, 1, 1000, vnodeCount, System.nanoTime()); verifyRangeCommandIterator(data, rows, 1, vnodeCount); ranges = rangeIterator(command, keyspace, true); data = new StorageProxy.RangeCommandIterator(ranges, command, 1, 1, vnodeCount, System.nanoTime()); verifyRangeCommandIterator(data, rows, 1, vnodeCount); }
Source:
private List<InstituteStats> convertToList( HashMap<String, HashMap<Integer, HashSet<String>>> institutes) { List<InstituteStats> list = new ArrayList<>(); institutes.forEach((insStatName, inStatStudents) -> { InstituteStats insStat = new InstituteStats(); insStat.name = insStatName; insStat.studentTotal = inStatStudents.get(STUDENT_INDEX).size(); insStat.instructorTotal = inStatStudents.get(INSTRUCTOR_INDEX).size(); list.add(insStat); }); return list; }

Target:
private List<InstituteStats> convertToList( HashMap<String, HashMap<Integer, HashSet<String>>> institutes) { List<InstituteStats> list = new ArrayList<>(); institutes.forEach((insName, insStudents) -> { InstituteStats insStat = new InstituteStats(); insStat.name = insName; insStat.studentTotal = insStudents.get(STUDENT_INDEX).size(); insStat.instructorTotal = insStudents.get(INSTRUCTOR_INDEX).size(); list.add(insStat); }); return list; }
Source:
@Override public V putIfAbsent(int key, V val) { lock.writeLock().lock(); try { int idx = find(key); if (idx < 0) { put(key, val); return null; } else return entries[idx].val; } finally { lock.writeLock().unlock(); } }

Target:
@Override public V putIfAbsent(int key, V val) { int idx = find(key); if (idx < 0) { put(key, val); return null; } else return entries[idx].val; }
Source:
static void modifyPersonaAccount(long id, Persona.Confidence confidence, String justification) throws CentralRepoException { CentralRepository cr = CentralRepository.getInstance(); if (cr == null) { throw new CentralRepoException("Failed to modify persona account, Central Repo is not enabled"); } String updateClause = "UPDATE persona_accounts SET confidence_id = " + confidence.getLevelId() + ", justification = '" + justification + "' WHERE id = " + id; cr.executeUpdateSQL(updateClause); }

Target:
static void modifyPersonaAccount(long id, Persona.Confidence confidence, String justification) throws CentralRepoException { String updateClause = "UPDATE persona_accounts SET confidence_id = " + confidence.getLevelId() + ", justification = '" + justification + "' WHERE id = " + id; getCRInstance().executeUpdateSQL(updateClause); }
Source:
public void flushAndReleaseResources() { Address lockHolder = getLockHolder(getIndexName()); if (lockHolder != null) { InfinispanDirectoryProvider directoryProvider = (InfinispanDirectoryProvider) getDirectoryProvider(); int activeDeleteTasks = directoryProvider.getActiveDeleteTasks(); while (activeDeleteTasks > 0) { try { Thread.sleep(POLL_WAIT); logDebug("Waiting for pending delete tasks, remaining: %s", activeDeleteTasks); activeDeleteTasks = directoryProvider.getActiveDeleteTasks(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } logDebug("Flushing directory provider"); super.flushAndReleaseResources(); } }

Target:
public void flushAndReleaseResources() { Address lockHolder = getLockHolder(getIndexName()); if (lockHolder != null) { InfinispanDirectoryProvider directoryProvider = (InfinispanDirectoryProvider) getDirectoryProvider(); int activeDeleteTasks = directoryProvider.getActiveDeleteTasks(); boolean wasInterrupted = false; while (activeDeleteTasks > 0) { try { Thread.sleep(POLL_WAIT); logDebug("Waiting for pending delete tasks, remaining: %s", activeDeleteTasks); activeDeleteTasks = directoryProvider.getActiveDeleteTasks(); } catch (InterruptedException e) { wasInterrupted = true; } } if (wasInterrupted) { Thread.currentThread().interrupt(); } logDebug("Flushing directory provider"); super.flushAndReleaseResources(); } }
Source:
public void clickRemoveAvatar() { showAvatarControls(); avatarRemoveButton.click(); Alert alert = driver.switchTo().alert(); alert.accept(); hideAvatarControls(); waitForElementByElement(avatarWrapper); }

Target:
public void clickRemoveAvatar() { showAvatarControls(); avatarRemoveButton.click(); Alert alert = driver.switchTo().alert(); alert.accept(); hideAvatarControls(); waitForElementByElement(avatarWrapper); PageObjectLogging.log("clickRemoveAvatar", "avatar remove button clicked", true); }
Source:
private Thread getStuckThread (Thread mainThread) { if (fThreadGroup == null) return null; final int count = fThreadGroup.activeCount(); int enumSize = Math.max (count * 2, 100); int enumCount; Thread[] threads; ThreadMXBean mxBean = ManagementFactory.getThreadMXBean(); int loopCount = 0; while (true) { threads = new Thread[enumSize]; enumCount = fThreadGroup.enumerate (threads); if (enumCount < enumSize) break; enumSize += 100; if (++loopCount >= 5) return null; } Thread firstRunnable = null; Thread mostCpu = null; long maxCpuTime = 0; int runnableCount = 0; for (int i = 0; i < enumCount; i++) { if (threads[i].getState() == Thread.State.RUNNABLE) { runnableCount++; if (firstRunnable == null) firstRunnable = threads[i]; if (mxBean.isThreadCpuTimeSupported()) { try { long cpuTime = mxBean.getThreadCpuTime(threads[i].getId()); if (mostCpu == null || cpuTime > maxCpuTime) { mostCpu = threads[i]; maxCpuTime = cpuTime; } } catch (UnsupportedOperationException e) { } } } } Thread stuckThread = (runnableCount == 1) ? firstRunnable : ((mostCpu != null) ? mostCpu : firstRunnable); return (stuckThread == mainThread) ? null : stuckThread; }

Target:
private Thread getStuckThread (Thread mainThread) { if (fThreadGroup == null) return null; Thread[] threadsInGroup = getThreadArray(fThreadGroup); if (threadsInGroup == null) return null; Thread stuckThread = null; long maxCpuTime = 0; for (Thread thread : threadsInGroup) { if (thread.getState() == Thread.State.RUNNABLE) { long threadCpuTime = cpuTime(thread); if (stuckThread == null || threadCpuTime > maxCpuTime) { stuckThread = thread; maxCpuTime = threadCpuTime; } } } return (stuckThread == mainThread) ? null : stuckThread; }
Source:
public PackageMaterialPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) { RepositoryConfiguration repositoryConfiguration = extension.getRepositoryConfiguration(descriptor.id()); com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageConfiguration = extension.getPackageConfiguration(descriptor.id()); if (repositoryConfiguration == null) { throw new RuntimeException(format("Plugin[%s] returned null repository configuration", descriptor.id())); } if (packageConfiguration == null) { throw new RuntimeException(format("Plugin[%s] returned null package configuration", descriptor.id())); } PluggableInstanceSettings pluginSettingsAndView = getPluginSettingsAndView(descriptor, extension); return new PackageMaterialPluginInfo(descriptor, new PluggableInstanceSettings(configurations(repositoryConfiguration)), new PluggableInstanceSettings(configurations(packageConfiguration)), pluginSettingsAndView); }

Target:
public PackageMaterialPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) { RepositoryConfiguration repositoryConfiguration = extension.getRepositoryConfiguration(descriptor.id()); com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageConfiguration = extension.getPackageConfiguration(descriptor.id()); if (repositoryConfiguration == null) { throw new RuntimeException(format("Plugin[%s] returned null repository configuration", descriptor.id())); } if (packageConfiguration == null) { throw new RuntimeException(format("Plugin[%s] returned null package configuration", descriptor.id())); } PluggableInstanceSettings pluginSettingsAndView = getPluginSettingsAndView(descriptor, extension); return new PackageMaterialPluginInfo(descriptor, new PluggableInstanceSettings(packageRepoConfigurations(repositoryConfiguration)), new PluggableInstanceSettings(packageRepoConfigurations(packageConfiguration)), pluginSettingsAndView); }
Source:
public void save(OutputStream out) { try { PropertiesConfiguration pconf = newPropertiesConfiguration(); pconf.append(internalConfig); new FileHandler(pconf).save(out); } catch (ConfigurationException e) { throw new FluoException(e); } }

Target:
public void save(OutputStream out) { try { PropertiesConfiguration pconf = new PropertiesConfiguration(); pconf.append(internalConfig); pconf.getLayout().save(pconf, new OutputStreamWriter(out, UTF_8)); } catch (ConfigurationException e) { throw new FluoException(e); } }
Source:
public Map<String, List<BuddyController.BuddyResource>> getEmbeddedResources() { if(getContent().getPrivateData() != null) { Optional<Set<BuddyDTO>> buddies = getContent().getPrivateData().getBuddies(); if(buddies.isPresent()) { return Collections.singletonMap(UserDTO.BUDDIES_REL_NAME, new BuddyController.BuddyResourceAssembler(getContent().getID()).toResources(buddies.get())); } } return Collections.emptyMap(); }

Target:
public Map<String, List<BuddyController.BuddyResource>> getEmbeddedResources() { if(getContent().getPrivateData() == null) { return Collections.emptyMap(); } Set<BuddyDTO> buddies = getContent().getPrivateData().getBuddies(); return Collections.singletonMap(UserDTO.BUDDIES_REL_NAME, new BuddyController.BuddyResourceAssembler(getContent().getID()).toResources(buddies)); }
Source:
void checkRowNumber() { Preconditions.checkArgument(dedicatedRowNumber() >= 0 && dedicatedRowNumber() < MAX_DEDICATED_ROWS, "Dedicated row number must be between 0 and %s inclusive, but it is %s.", MAX_DEDICATED_ROWS, dedicatedRowNumber()); }

Target:
void checkRowNumber() { Preconditions.checkArgument(dedicatedRowNumber() >= 0 && dedicatedRowNumber() < MAX_DEDICATED_ROWS, "Dedicated row number must be at least 0 and less than %s, but it is %s.", MAX_DEDICATED_ROWS, dedicatedRowNumber()); }
Source:
public BufferedMultipleNodeCallField toBuffered() { Stream<BufferableHandle> bufferableHandleStream = paramValues.map(handle ->{ if(!(handle instanceof BufferableHandle)) throw new IllegalArgumentException("Default parameter must implement BufferableHandle."); return new BytesHandle((BufferableHandle) handle); }); return new BufferedMultipleNodeCallField(super.getParamName(), bufferableHandleStream); }

Target:
public BufferedMultipleNodeCallField toBuffered() { Stream<BufferableHandle> bufferableHandleStream = paramValues.map(handle ->{ if(!(handle instanceof BufferableHandle)) throw new IllegalArgumentException("Default parameter must implement BufferableHandle."); return ((BufferableHandle) handle); }); return new BufferedMultipleNodeCallField(super.getParamName(), bufferableHandleStream); }
Source:
public String toString() { StringBuffer sbuf = new StringBuffer(); for (long position = 0; position < this.size;) { if ((position + WORD_SIZE) < this.size) { int arrayPos = (int) (position >> LG_WORD_SIZE); sbuf.append(toString(this.array[arrayPos])); position += WORD_SIZE; } else { sbuf.append(getBit(position) ? "1" : "0"); position++; } } return sbuf.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); for (long position = 0; position < this.size;) { if ((position + WORD_SIZE) < this.size) { int arrayPos = (int) (position >> LG_WORD_SIZE); sb.append(wordToString(this.arrayOfBits[arrayPos])); position += WORD_SIZE; } else { sb.append(getBit(position) ? "1" : "0"); position++; } } return sb.toString(); }
Source:
private void setUpAdapterFactoryRegistry(final IExtensionRegistry registry) { adapterFactoryRegistry = Multimaps.synchronizedListMultimap(ArrayListMultimap .<Collection<?>, RankedAdapterFactoryDescriptor> create()); adapterFactoryRegistryListener = new AdapterFactoryDescriptorRegistryListener( EMFCompareEditPlugin.PLUGIN_ID, FACTORY_PPID, getLog(), adapterFactoryRegistry); registry.addListener(adapterFactoryRegistryListener, PLUGIN_ID + "." + FACTORY_PPID); adapterFactoryRegistryListener.readRegistry(registry); }

Target:
private void setUpAdapterFactoryRegistry(final IExtensionRegistry registry) { adapterFactoryRegistryBackingMultimap = Multimaps.synchronizedListMultimap(ArrayListMultimap .<Collection<?>, RankedAdapterFactoryDescriptor> create()); adapterFactoryRegistryListener = new AdapterFactoryDescriptorRegistryListener( EMFCompareEditPlugin.PLUGIN_ID, FACTORY_PPID, getLog(), adapterFactoryRegistryBackingMultimap); registry.addListener(adapterFactoryRegistryListener, PLUGIN_ID + "." + FACTORY_PPID); adapterFactoryRegistryListener.readRegistry(registry); rankedAdapterFactoryRegistry = new RankedAdapterFactoryDescriptorRegistryImpl( ComposedAdapterFactory.Descriptor.Registry.INSTANCE, Multimaps .unmodifiableMultimap(adapterFactoryRegistryBackingMultimap)); }
Source:
public String toString() { return "Problem: " + message; }

Target:
public String toString() { return "Problem: '" + message + "' at " + sourceLineNumber + ":" + sourceStart + "-" + sourceEnd; }