auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Map<Guid, ManageNetworkClustersParameters> mapParametersByClusterId() { final ManageNetworkClustersParameters parameters = getParameters(); final Map<Guid, List<NetworkCluster>> attachmentByClusterId = groupByClusterId(parameters.getAttachments()); final Map<Guid, List<NetworkCluster>> detachmentByClusterId = groupByClusterId(parameters.getDetachments()); <START> final Map<Guid, List<NetworkCluster>> updatesByClusterId = groupByClusterId(parameters.getUpdates()); <END> final Set<Guid> clusterIds = Stream.of(attachmentByClusterId, detachmentByClusterId, updatesByClusterId) .flatMap(e -> e.keySet().stream()) .collect(Collectors.toSet()); return clusterIds .stream() .collect(Collectors.toMap(Function.identity(), clusterId -> new ManageNetworkClustersParameters( nullToEmptyList(attachmentByClusterId.get(clusterId)), nullToEmptyList(detachmentByClusterId.get(clusterId)), nullToEmptyList(updatesByClusterId.get(clusterId))))); }</code><technical_language>This patch is refactoring. Right? In original code "parameters.getUpdates()" processed</technical_language>

Target:
private Map<Guid, ManageNetworkClustersParameters> mapParametersByClusterId() { ManageNetworkClustersParameters parameters = getParameters(); Map<Guid, List<NetworkCluster>> attachmentByClusterId = groupByClusterId(parameters.getAttachments()); Map<Guid, List<NetworkCluster>> detachmentByClusterId = groupByClusterId(parameters.getDetachments()); Set<Guid> clusterIds = Stream.of(attachmentByClusterId, detachmentByClusterId) .flatMap(e -> e.keySet().stream()) .collect(Collectors.toSet()); return clusterIds .stream() .collect(Collectors.toMap(Function.identity(), clusterId -> new ManageNetworkClustersParameters( nullToEmptyList(attachmentByClusterId.get(clusterId)), nullToEmptyList(detachmentByClusterId.get(clusterId))))); }
Source:
<code>public Iterator<SpectraUser> getObjIterator() { <START> SpectraUserList userlist = getuserList(); <END> if (userlist != null) { List<SpectraUser> users = userlist.getSpectraUsers(); if (users != null) { return users.iterator(); } } return Collections.emptyListIterator(); }</code><technical_language>missing final</technical_language>

Target:
public Iterator<SpectraUser> getObjIterator() { final SpectraUserList userlist = getuserList(); if (userlist != null) { final List<SpectraUser> users = userlist.getSpectraUsers(); if (Guard.isNotNullAndNotEmpty(users)) { return users.iterator(); } } return Collections.emptyListIterator(); }
Source:
<code>public void testDontDeserializeOtherThanMuleSession() throws MuleException { DefaultMuleMessage message = new DefaultMuleMessage("Test Message", muleContext); SessionHandler handler = new SerializeAndEncodeSessionHandler(); <START> String encodedSet = new String(Base64.encode(SerializationUtils.serialize(new HashSet<String>()))); <END> message.setInboundProperty(MULE_SESSION_PROPERTY, encodedSet); MuleSession session = handler.retrieveSessionInfoFromMessage(message); assertNull(session); }</code><technical_language>static import Base64.encode SerializationUtils.serialize</technical_language>

Target:
public void testDontDeserializeOtherThanMuleSession() throws MuleException { DefaultMuleMessage message = new DefaultMuleMessage("Test Message", muleContext); SessionHandler handler = new SerializeAndEncodeSessionHandler(); String encodedSet = new String(encode(serialize(new HashSet<String>()))); message.setInboundProperty(MULE_SESSION_PROPERTY, encodedSet); MuleSession session = handler.retrieveSessionInfoFromMessage(message); assertNull(session); }
Source:
<code>private void initialize(ScoreBoard sb) { updateMap.put("ScoreBoard." + ScoreBoard.EVENT_IN_PERIOD, sb.isInPeriod()); updateMap.put("ScoreBoard." + ScoreBoard.EVENT_IN_OVERTIME, sb.isInOvertime()); updateMap.put("ScoreBoard." + ScoreBoard.EVENT_OFFICIAL_SCORE, sb.isOfficialScore()); updateMap.put("ScoreBoard." + ScoreBoard.EVENT_RULESET, sb.getRuleset()); updateMap.put("ScoreBoard." + ScoreBoard.EVENT_TIMEOUT_OWNER, sb.getTimeoutOwner()); updateMap.put("ScoreBoard." + ScoreBoard.EVENT_OFFICIAL_REVIEW, sb.isOfficialReview()); processSettings("ScoreBoard", sb.getSettings()); <START> processPenalties(sb.getSettings()); <END> for (Team t : sb.getTeams()) { processTeam("ScoreBoard", t, false); } for (Clock c : sb.getClocks()) { processClock("ScoreBoard", c, false); } for (Policy p : sb.getPolicies()) { processPolicy("ScoreBoard", p, false); } updateState(); }</code><technical_language>This code get called startup I see, codes changed a run/game</technical_language>

Target:
private void initialize(ScoreBoard sb) { updates.add(new WSUpdate("ScoreBoard." + ScoreBoard.EVENT_IN_PERIOD, sb.isInPeriod())); updates.add(new WSUpdate("ScoreBoard." + ScoreBoard.EVENT_IN_OVERTIME, sb.isInOvertime())); updates.add(new WSUpdate("ScoreBoard." + ScoreBoard.EVENT_OFFICIAL_SCORE, sb.isOfficialScore())); updates.add(new WSUpdate("ScoreBoard." + ScoreBoard.EVENT_RULESET, sb.getRuleset())); updates.add(new WSUpdate("ScoreBoard." + ScoreBoard.EVENT_TIMEOUT_OWNER, sb.getTimeoutOwner())); updates.add(new WSUpdate("ScoreBoard." + ScoreBoard.EVENT_OFFICIAL_REVIEW, sb.isOfficialReview())); processSettings("ScoreBoard", sb.getSettings()); processPenaltyCodes(sb.getSettings()); for (Team t : sb.getTeams()) { processTeam("ScoreBoard", t, false); } for (Clock c : sb.getClocks()) { processClock("ScoreBoard", c, false); } for (Policy p : sb.getPolicies()) { processPolicy("ScoreBoard", p, false); } updateState(); }
Source:
<code>public void markAsRead() throws InterruptedException { getDriver().navigate().to("http://localhost:" + config.getHttpPort() + "/notifications/" + NET_ID); LoginView loginView = new LoginView(getDriver()); loginView.setPasswordField(PASSWORD); loginView.setUsernameField(NET_ID); String url = getDriver().getCurrentUrl(); loginView.clickLoginButton(); loginView.waitUntilCurrentUrlDiffersFrom(url); NotificationView notificationView = new NotificationView(getDriver()); notificationView.invariant(); <START> WebElement button = getDriver().findElement(MARK_READ_BUTTON); <END> assertNotNull(button); assertEquals(1,getDriver().findElements(NOTIFICATIONS_READ).size()); assertEquals(1,getDriver().findElements(NOTIFICATIONS_UNREAD).size()); assertNotNull(getDriver().findElement(NOTIFICATION_INDICATOR)); button.click(); notificationView = new NotificationView(getDriver()); notificationView.invariant(); assertEquals(2,getDriver().findElements(NOTIFICATIONS_READ).size()); assertEquals(0,getDriver().findElements(NOTIFICATIONS_UNREAD).size()); }</code><technical_language>consistent Page Objects structure, tests deal XPath expressions webdriver. Instead this logic abstracted in Page Objects itself. NotificationView expose API as: notificationView().getUnreadNotifications().get(0).markRead() notificationView().getUnreadNotifications().size()</technical_language>

Target:
public void markAsRead() { CoursesView coursesView = openLoginScreen().login(NET_ID,PASSWORD); NotificationView notificationView = coursesView.toNotificationView(); assertThatNumberOfReadAndUnreadNotificationsMatch(notificationView); notificationView.getUnreadNotifications().iterator().next() .clickAndMarkAsRead() .toNotificationView(); assertThatNumberOfReadAndUnreadNotificationsMatch(notificationView); }
Source:
<code>private void edit(String key, Object value) throws IOException { <START> root.retrieve().method("POST").with(key, value).method("PATCH").withUrlPath(getApiRoute()).to(); <END> }</code><technical_language>remove method("POST") setting method("PATCH") right</technical_language>

Target:
private void edit(String key, Object value) throws IOException { root.createRequest().with(key, value).method("PATCH").withUrlPath(getApiRoute()).send(); }
Source:
<code>void should_rethrow_any_extractor_function_exception() { RuntimeException explosion = new RuntimeException("boom!"); <START> Function<Employee, Object> extractor = employee -> { <END> throw explosion; }; Throwable error = catchThrowable(() -> assertThat(luke).extracting(firstName, extractor)); then(error).isSameAs(explosion); }</code><technical_language>rename extractor bomb :bomb: :smile:</technical_language>

Target:
void should_rethrow_any_extractor_function_exception() { RuntimeException explosion = new RuntimeException("boom!"); Function<Employee, Object> bomb = employee -> { throw explosion; }; Throwable error = catchThrowable(() -> assertThat(luke).extracting(firstName, bomb)); then(error).isSameAs(explosion); }
Source:
<code>public FedoraResource getResourceFromPath(final String externalPath) { final FedoraId fedoraId = identifierConverter().pathToInternalId(externalPath); try { final FedoraResource fedoraResource = resourceFactory.getResource(transaction(), fedoraId); final FedoraResource originalResource; if (fedoraId.isMemento()) { <START> originalResource = fedoraResource.getOriginalResource(); <END> } else { originalResource = fedoraResource; } if (originalResource instanceof Tombstone) { final String tombstoneUri = identifierConverter().toExternalId( fedoraResource.getFedoraId().resolve(FCR_TOMBSTONE).getFullId() ); throw new TombstoneException(fedoraResource, tombstoneUri); } return fedoraResource; } catch (final PathNotFoundException exc) { throw new PathNotFoundRuntimeException(exc); } }</code><technical_language>Minor (borderline ignorable)... originalResource = fedoraResource.getOriginalResource(); is indented space far</technical_language>

Target:
public FedoraResource getResourceFromPath(final String externalPath) { final FedoraId fedoraId = identifierConverter().pathToInternalId(externalPath); try { final FedoraResource fedoraResource = resourceFactory.getResource(transaction(), fedoraId); final FedoraResource originalResource; if (fedoraId.isMemento()) { originalResource = fedoraResource.getOriginalResource(); } else { originalResource = fedoraResource; } if (originalResource instanceof Tombstone) { final String tombstoneUri = identifierConverter().toExternalId( originalResource.getFedoraId().resolve(FCR_TOMBSTONE).getFullId() ); throw new TombstoneException(fedoraResource, tombstoneUri); } return fedoraResource; } catch (final PathNotFoundException exc) { throw new PathNotFoundRuntimeException(exc); } }
Source:
<code>public UserResourceProfile getUserResourceProfile(String userId, String gatewayId) throws AppCatalogException { <START> Map<String, Object> queryParameters = new HashMap<>(); <END> queryParameters.put(DBConstants.UserResourceProfile.USER_ID, userId); queryParameters.put(DBConstants.UserResourceProfile.GATEWAY_ID, gatewayId); List<UserResourceProfile> userResourceProfileList = select(QueryConstants.GET_USER_RESOURCE_PROFILE, -1, 0, queryParameters); if(!userResourceProfileList.isEmpty() && userResourceProfileList != null) { logger.debug("Return the record (there is only one record)"); return userResourceProfileList.get(0); } return null; }</code><technical_language>this create a UserResourceProfilePK issue a get() id? This is primary key</technical_language>

Target:
public UserResourceProfile getUserResourceProfile(String userId, String gatewayId) throws AppCatalogException { UserResourceProfilePK userResourceProfilePK = new UserResourceProfilePK(); userResourceProfilePK.setUserId(userId); userResourceProfilePK.setGatewayId(gatewayId); UserResourceProfile userResourceProfile = get(userResourceProfilePK); return userResourceProfile; }
Source:
<code>public void setCurrentContentViewName(String contentViewName) { <START> currentContentViewName = contentViewName; <END> }</code><technical_language>Is needed remove 'this'</technical_language>

Target:
public void setCurrentContentViewName(String contentViewName) { this.currentContentViewName = contentViewName; }
Source:
<code>protected void onResume() { super.onResume(); <START> castUICounter++; <END> if (isCastEnabled) { mCastManager.incrementUiCounter(); castUICounter++; } }</code><technical_language>increment check if block</technical_language>

Target:
protected void onResume() { super.onResume(); castButtonVisibilityManager.setResumed(true); }
Source:
<code>public void testTimestamp() throws InvalidParametersException, EntityAlreadyExistsException, EntityDoesNotExistException { ______TS("success : created"); FeedbackResponseAttributes fra = getNewFeedbackResponseAttributes(); frDb.deleteEntity(fra); frDb.createEntity(fra); verifyPresentInDatastore(fra); String feedbackQuestionId = fra.feedbackQuestionId; String giverEmail = fra.giver; String recipientEmail = fra.recipient; FeedbackResponseAttributes feedbackResponse = frDb.getFeedbackResponse(feedbackQuestionId, giverEmail, recipientEmail); AssertHelper.assertInstantIsNow(feedbackResponse.getCreatedAt()); AssertHelper.assertInstantIsNow(feedbackResponse.getUpdatedAt()); ______TS("success : update lastUpdated"); String newRecipientEmail = "new-email@tmt.com"; feedbackResponse.recipient = newRecipientEmail; frDb.updateFeedbackResponse(feedbackResponse); FeedbackResponseAttributes updatedFr = frDb.getFeedbackResponse(feedbackQuestionId, giverEmail, newRecipientEmail); assertFalse(feedbackResponse.getUpdatedAt().equals(updatedFr.getUpdatedAt())); AssertHelper.assertInstantIsNow(updatedFr.getUpdatedAt()); ______TS("success : keep lastUpdated"); String newRecipientEmailTwo = "new-email-two@tmt.com"; feedbackResponse.recipient = newRecipientEmailTwo; <START> frDb.updateFeedbackResponse(feedbackResponse); <END> FeedbackResponseAttributes updatedFrTwo = frDb.getFeedbackResponse(feedbackQuestionId, giverEmail, newRecipientEmailTwo); assertNotEquals(updatedFr.getUpdatedAt(), updatedFrTwo.getUpdatedAt()); }</code><technical_language>Actually, is this a irrelevant change is for FeedbackResponsesDb.java FeedbackQuestionDb</technical_language>

Target:
public void testTimestamp() throws InvalidParametersException, EntityAlreadyExistsException, EntityDoesNotExistException { ______TS("success : created"); FeedbackResponseAttributes fra = getNewFeedbackResponseAttributes(); frDb.deleteEntity(fra); frDb.createEntity(fra); verifyPresentInDatastore(fra); String feedbackQuestionId = fra.feedbackQuestionId; String giverEmail = fra.giver; String recipientEmail = fra.recipient; FeedbackResponseAttributes feedbackResponse = frDb.getFeedbackResponse(feedbackQuestionId, giverEmail, recipientEmail); AssertHelper.assertInstantIsNow(feedbackResponse.getCreatedAt()); AssertHelper.assertInstantIsNow(feedbackResponse.getUpdatedAt()); ______TS("success : update lastUpdated"); String newRecipientEmail = "new-email@tmt.com"; feedbackResponse.recipient = newRecipientEmail; frDb.updateFeedbackResponse(feedbackResponse); FeedbackResponseAttributes updatedFr = frDb.getFeedbackResponse(feedbackQuestionId, giverEmail, newRecipientEmail); assertFalse(feedbackResponse.getUpdatedAt().equals(updatedFr.getUpdatedAt())); AssertHelper.assertInstantIsNow(updatedFr.getUpdatedAt()); }
Source:
<code>private void registerOvfStoreDisks() { for (final Guid storageDomainId : getParameters().getStorages()) { resetOvfStoreDisks(); <START> if (DbFacade.getInstance().getStorageDomainDao().get(storageDomainId) <END> .getStorageDomainType().isDataDomain()) { TransactionSupport.executeInNewTransaction(() -> { List<DiskImage> ovfStoreDiskImages = getAllOVFDisks(storageDomainId, getStoragePool().getId()); registerAllOvfDisks(ovfStoreDiskImages, storageDomainId); for (OvfEntityData ovf : getEntitiesFromStorageOvfDisk(storageDomainId, getStoragePool().getId())) { getUnregisteredOVFDataDao().removeEntity(ovf.getEntityId(), storageDomainId); getUnregisteredOVFDataDao().saveOVFData(ovf); log.info("Adding OVF data of entity id '{}' and entity name '{}'", ovf.getEntityId(), ovf.getEntityName()); } return null; }); } } }</code><technical_language>1) please getStorageDomainDao().get(storageDomainId); need for DbFacade 2) if condition resetOvfStoreDisks</technical_language>

Target:
private void registerOvfStoreDisks() { for (final Guid storageDomainId : getParameters().getStorages()) { if (getStorageDomainDao().get(storageDomainId).getStorageDomainType().isDataDomain()) { resetOvfStoreDisks(); TransactionSupport.executeInNewTransaction(() -> { List<DiskImage> ovfStoreDiskImages = getAllOVFDisks(storageDomainId, getStoragePool().getId()); registerAllOvfDisks(ovfStoreDiskImages, storageDomainId); for (OvfEntityData ovf : getEntitiesFromStorageOvfDisk(storageDomainId, getStoragePool().getId())) { getUnregisteredOVFDataDao().removeEntity(ovf.getEntityId(), storageDomainId); getUnregisteredOVFDataDao().saveOVFData(ovf); log.info("Adding OVF data of entity id '{}' and entity name '{}'", ovf.getEntityId(), ovf.getEntityName()); } return null; }); } } }
Source:
<code>public static void deleteContainerIfExists(String storage, String key, String containerName) { final AzureBlobClient azureBlob = ContextBuilder.newBuilder("azureblob") .credentials(storage, key) .buildApi(AzureBlobClient.class); azureBlob.deleteContainer(containerName); try { azureBlob.close(); } catch (IOException e) { e.printStackTrace(); <START> } <END> }</code><technical_language>Closeables2.closeQuietly(azureBlob);</technical_language>

Target:
public static void deleteContainerIfExists(String storage, String key, String containerName) { final AzureBlobClient azureBlob = ContextBuilder.newBuilder("azureblob") .credentials(storage, key) .buildApi(AzureBlobClient.class); try { azureBlob.deleteContainer(containerName); } finally { Closeables2.closeQuietly(azureBlob); } }
Source:
<code>public static boolean isGlusterfsCliInstalled(VDS vds) { if (FeatureSupported.glusterVolumeInfoSupported(getStoragePool(vds.getId()).getCompatibilityVersion())) { RpmVersion glusterfsCliVer = vds.getGlusterfsCliVersion(); <START> if (glusterfsCliVer == null || <END> glusterfsCliVer.getRpmRelease() == null || glusterfsCliVer.getRpmRelease().isEmpty()) { return false; } return true; } return true; }</code><technical_language>consider rephrasing 'return !(condition)' 'return (cond1 && cond2 && ...)</technical_language>

Target:
public static boolean isGlusterfsCliInstalled(VDS vds) { if (FeatureSupported.glusterVolumeInfoSupported(getStoragePool(vds.getId()).getCompatibilityVersion())) { RpmVersion glusterfsCliVer = vds.getGlusterfsCliVersion(); return glusterfsCliVer == null || glusterfsCliVer.getRpmRelease() == null || glusterfsCliVer.getRpmRelease().isEmpty(); } return true; }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.notification_preferences); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { addPreferencesFromResource(R.xml.notification_preferences_lollipop); } CheckBoxPreference enableNotifications = (CheckBoxPreference) findPreference("enable_notifications"); notificationTone = findPreference("notification_tone"); notificationVibrate = findPreference("notification_vibrate"); notificationVisibility = null; notificationHeadsup = null; if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { notificationVisibility = findPreference("notification_visibility"); notificationHeadsup = findPreference("notification_headsup"); } boolean currentlyEnabled = enableNotifications.isChecked(); notificationTone.setEnabled(currentlyEnabled); notificationVibrate.setEnabled(currentlyEnabled); enableNotifications.setOnPreferenceChangeListener((preference, newValue) -> { boolean value = (Boolean) newValue; notificationTone.setEnabled(value); notificationVibrate.setEnabled(value); <START> if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { <END> if (notificationVisibility != null) { notificationVisibility.setEnabled(value); } if (notificationHeadsup != null) { notificationHeadsup.setEnabled(value); } } return true; }); }</code><technical_language>out this if; null checks care of case preferences exist Lollipop devices</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.notification_preferences); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { addPreferencesFromResource(R.xml.notification_preferences_lollipop); } CheckBoxPreference enableNotifications = (CheckBoxPreference) findPreference("enable_notifications"); notificationTone = findPreference("notification_tone"); notificationVibrate = findPreference("notification_vibrate"); notificationVisibility = null; notificationHeadsup = null; if (Utilities.hasLApis()) { notificationVisibility = findPreference("notification_visibility"); notificationHeadsup = findPreference("notification_headsup"); } boolean currentlyEnabled = enableNotifications.isChecked(); notificationTone.setEnabled(currentlyEnabled); notificationVibrate.setEnabled(currentlyEnabled); enableNotifications.setOnPreferenceChangeListener((preference, newValue) -> { boolean value = (Boolean) newValue; notificationTone.setEnabled(value); notificationVibrate.setEnabled(value); if (notificationVisibility != null) { notificationVisibility.setEnabled(value); } if (notificationHeadsup != null) { notificationHeadsup.setEnabled(value); } return true; }); }
Source:
<code>private StreamBlock pollPersistentDeque(boolean actuallyPoll) { BBContainer cont = null; BBContainer schemaCont = null; try { if (m_reader.isStartOfSegment()) { schemaCont = m_reader.getExtraHeader(-1); } cont = m_reader.poll(PersistentBinaryDeque.UNSAFE_CONTAINER_FACTORY); } catch (IOException e) { exportLog.error("Failed to poll from persistent binary deque:" + e); <START> if (schemaCont != null) { <END> schemaCont.discard(); } return null; } if (cont == null) { if (schemaCont != null) { schemaCont.discard(); } return null; } else { long segmentIndex = m_reader.getSegmentIndex(); cont.b().order(ByteOrder.LITTLE_ENDIAN); final BBContainer fcont = cont; long seqNo = cont.b().getLong(StreamBlock.SEQUENCE_NUMBER_OFFSET); long committedSeqNo = cont.b().getLong(StreamBlock.COMMIT_SEQUENCE_NUMBER_OFFSET); int tupleCount = cont.b().getInt(StreamBlock.ROW_NUMBER_OFFSET); long uniqueId = cont.b().getLong(StreamBlock.UNIQUE_ID_OFFSET); StreamBlock block = new StreamBlock( fcont, schemaCont, seqNo, committedSeqNo, tupleCount, uniqueId, segmentIndex, true); if (!actuallyPoll) { m_memoryDeque.offer(block); } return block; } }</code><technical_language>This technically needed cont null in this case enter cont == null block</technical_language>

Target:
private StreamBlock pollPersistentDeque(boolean actuallyPoll) { BBContainer cont = null; BBContainer schemaCont = null; try { if (m_reader.isStartOfSegment()) { schemaCont = m_reader.getExtraHeader(-1); } cont = m_reader.poll(PersistentBinaryDeque.UNSAFE_CONTAINER_FACTORY); } catch (IOException e) { exportLog.error("Failed to poll from persistent binary deque:" + e); } if (cont == null) { if (schemaCont != null) { schemaCont.discard(); } return null; } else { long segmentIndex = m_reader.getSegmentIndex(); cont.b().order(ByteOrder.LITTLE_ENDIAN); final BBContainer fcont = cont; long seqNo = cont.b().getLong(StreamBlock.SEQUENCE_NUMBER_OFFSET); long committedSeqNo = cont.b().getLong(StreamBlock.COMMIT_SEQUENCE_NUMBER_OFFSET); int tupleCount = cont.b().getInt(StreamBlock.ROW_NUMBER_OFFSET); long uniqueId = cont.b().getLong(StreamBlock.UNIQUE_ID_OFFSET); StreamBlock block = new StreamBlock( fcont, schemaCont, seqNo, committedSeqNo, tupleCount, uniqueId, segmentIndex, true); if (!actuallyPoll) { m_memoryDeque.offer(block); } return block; } }
Source:
<code>public void constructFromMap() { final NavigableMap<Long, List<Integer>> r = new TreeMap<>(); final List<Integer> expectedList = Arrays.asList( 0, 1, 2, 3, 10, 11, 12, 13, 30, 31, 32, 33); r.put(1L, Arrays.asList(10, 11, 12, 13)); r.put(0L, Arrays.asList(0, 1, 2, 3)); r.put(3L, Arrays.asList(30, 31, 32, 33)); final StreamingCommitterState<Integer> streamingCommitterState = new StreamingCommitterState<>( r); <START> Assert.assertArrayEquals( <END> expectedList.toArray(), streamingCommitterState.getCommittables().toArray()); }</code><technical_language>simplified Assert.assertEquals(expectedList, streamingCommitterState.getCommittables());</technical_language>

Target:
public void constructFromMap() { final NavigableMap<Long, List<Integer>> r = new TreeMap<>(); final List<Integer> expectedList = Arrays.asList(0, 1, 2, 3, 10, 11, 12, 13, 30, 31, 32, 33); r.put(1L, Arrays.asList(10, 11, 12, 13)); r.put(0L, Arrays.asList(0, 1, 2, 3)); r.put(3L, Arrays.asList(30, 31, 32, 33)); final StreamingCommitterState<Integer> streamingCommitterState = new StreamingCommitterState<>( r); assertThat( streamingCommitterState.getCommittables(), equalTo( expectedList)); }
Source:
<code>public Device getLocalDevice() { List<Device> devices = getDevices(true); if (devices.isEmpty()) { Log.e(TAG, "getLocalDevice: devices is empty"); <START> throw new RuntimeException(); <END> } Log.v(TAG, "getLocalDevice: Looking for local device ID " + mLocalDeviceId); for (Device d : devices) { if (d.deviceID.equals(mLocalDeviceId)) { return deepCopy(d, Device.class); } } throw new RuntimeException(); }</code><technical_language>a useful exception..</technical_language>

Target:
public Device getLocalDevice() { List<Device> devices = getDevices(true); if (devices.isEmpty()) { throw new RuntimeException("RestApi.getLocalDevice: devices is empty."); } Log.v(TAG, "getLocalDevice: Looking for local device ID " + mLocalDeviceId); for (Device d : devices) { if (d.deviceID.equals(mLocalDeviceId)) { return deepCopy(d, Device.class); } } throw new RuntimeException("RestApi.getLocalDevice: Failed to get the local device crucial to continuing execution."); }
Source:
<code>public void testSubmitToUdpInput() throws Exception { Service service = connect(); String indexName = temporaryName(); Integer udpPort = 10000; while (service.getInputs().containsKey(udpPort.toString())) { udpPort += 1; } Index index = null; UdpInput input = null; try { index = service.getIndexes().create(indexName); Args args = new Args(); args.add("index", indexName); input = service.getInputs().create(udpPort.toString(), InputKind.Udp, args); int nEvents = index.getTotalEventCount(); input.submit(getTimestamp() + " Boris the mad baboon!\r\n"); <START> int nTries = 50; <END> while (nTries > 0) { index.refresh(); if (index.getTotalEventCount() == nEvents + 1) { break; } else { nTries -= 1; Thread.sleep(1000); } } if (nTries == 0) { SplunkTestCase.fail("Timed out before new events were found in index."); } } finally { if (index != null && service.versionCompare("5.0") >= 0) { index.remove(); } if (input != null) { input.remove(); } } }</code><technical_language>This block of functionality is duplicated 3 times. Extract method</technical_language>

Target:
public void testSubmitToUdpInput() throws Exception { Service service = connect(); String indexName = temporaryName(); int udpPort = 10000; while (service.getInputs().containsKey(String.valueOf(udpPort))) { udpPort += 1; } Index index = null; UdpInput input = null; try { index = service.getIndexes().create(indexName); Args args = new Args(); args.add("index", indexName); input = service.getInputs().create(String.valueOf(udpPort), InputKind.Udp, args); int nEvents = index.getTotalEventCount(); input.submit(createTimestamp() + " Boris the mad baboon!\r\n"); int nTries = 50; while (nTries > 0) { index.refresh(); if (index.getTotalEventCount() == nEvents + 1) { break; } else { nTries -= 1; Thread.sleep(1000); } } if (nTries == 0) { SplunkTestCase.fail("Timed out before new events were found in index."); } } finally { if (index != null && service.versionCompare("5.0") >= 0) { index.remove(); } if (input != null) { input.remove(); } } }
Source:
<code>public void configureWebApplication() throws Exception { File extractedWebAppDir= new File(getTmpDirectory(), "webapp"); if (isExtractedWebAppDirStale(extractedWebAppDir, webAppFile)) { FileUtils.deleteDirectory(extractedWebAppDir); } super.configureWebApplication(); getWebAppConfig().setWar(webAppFile.getCanonicalPath()); HashLoginService hashLoginService = (new HashLoginService("Jenkins Realm")); <START> hashLoginService.setConfig(System.getProperty("jetty.home", ".") + "/etc/realm.properties"); <END> getWebAppConfig().getSecurityHandler().setLoginService(hashLoginService); }</code><technical_language>this defaulted work/ is . CWD</technical_language>

Target:
public void configureWebApplication() throws Exception { File extractedWebAppDir= new File(getTmpDirectory(), "webapp"); if (isExtractedWebAppDirStale(extractedWebAppDir, webAppFile)) { FileUtils.deleteDirectory(extractedWebAppDir); } super.configureWebApplication(); getWebAppConfig().setWar(webAppFile.getCanonicalPath()); HashLoginService hashLoginService = (new HashLoginService("Jenkins Realm")); hashLoginService.setConfig(System.getProperty("jetty.home", "work") + "/etc/realm.properties"); getWebAppConfig().getSecurityHandler().setLoginService(hashLoginService); }
Source:
<code>protected Object visitLogicalBinaryExpression(LogicalBinaryExpression node, Object context) { LogicalBinaryExpression.Type type = node.getType(); Object left = process(node.getLeft(), context); if (isPredicate && type == LogicalBinaryExpression.Type.AND && Boolean.FALSE.equals(left)) { <START> return left; <END> } if (isPredicate && type == LogicalBinaryExpression.Type.OR && Boolean.TRUE.equals(left)) { return left; } Object right = process(node.getRight(), context); switch (type) { case AND: { if (Boolean.FALSE.equals(left) || Boolean.TRUE.equals(right)) { return left; } if (Boolean.FALSE.equals(right) || Boolean.TRUE.equals(left)) { return right; } break; } case OR: { if (Boolean.TRUE.equals(left) || Boolean.FALSE.equals(right)) { return left; } if (Boolean.TRUE.equals(right) || Boolean.FALSE.equals(left)) { return right; } break; } } if (left == null && right == null) { return null; } return new LogicalBinaryExpression(node.getType(), toExpression(left, type(node.getLeft())), toExpression(right, type(node.getRight()))); }</code><technical_language>return false</technical_language>

Target:
protected Object visitLogicalBinaryExpression(LogicalBinaryExpression node, Object context) { Object left = process(node.getLeft(), context); Object right; switch (node.getType()) { case AND: { if (Boolean.FALSE.equals(left)) { return false; } right = process(node.getRight(), context); if (Boolean.FALSE.equals(left) || Boolean.TRUE.equals(right)) { return left; } if (Boolean.FALSE.equals(right) || Boolean.TRUE.equals(left)) { return right; } break; } case OR: { if (Boolean.TRUE.equals(left)) { return true; } right = process(node.getRight(), context); if (Boolean.TRUE.equals(left) || Boolean.FALSE.equals(right)) { return left; } if (Boolean.TRUE.equals(right) || Boolean.FALSE.equals(left)) { return right; } break; } default: throw new IllegalStateException("Unknown LogicalBinaryExpression#Type"); } if (left == null && right == null) { return null; } return new LogicalBinaryExpression(node.getType(), toExpression(left, type(node.getLeft())), toExpression(right, type(node.getRight()))); }
Source:
<code>public Optional<Kill> getKill() { <START> if (kill == null) { <END> return Optional.empty(); } return Optional.of(kill); }</code><technical_language>return Optional.ofNullable(kill);</technical_language>

Target:
public Optional<Kill> getKill() { return Optional.empty().ofNullable(kill); }
Source:
<code>public void setup() { sessionFactory = mock(SessionFactory.class); hibernateTemplate = mock(HibernateTemplate.class); goCache = mock(GoCache.class); systemEnvironment = mock(SystemEnvironment.class); databaseStrategy = mock(DatabaseStrategy.class); queryExtensions = mock(QueryExtensions.class); when(databaseStrategy.getQueryExtensions()).thenReturn(queryExtensions); <START> pipelineRepository = new PipelineRepository(sessionFactory, goCache,systemEnvironment, databaseStrategy); <END> pipelineRepository.setHibernateTemplate(hibernateTemplate); }</code><technical_language>of unit tests queryExtensions for simplicity change this ... private DatabaseStrategy databaseStrategy; @Before public void setup() { ... databaseStrategy = mock(DatabaseStrategy.class); pipelineRepository = new PipelineRepository(sessionFactory, goCache, systemEnvironment, databaseStrategy); pipelineRepository.setHibernateTemplate(hibernateTemplate); }</technical_language>

Target:
public void setup() { sessionFactory = mock(SessionFactory.class); hibernateTemplate = mock(HibernateTemplate.class); goCache = mock(GoCache.class); systemEnvironment = mock(SystemEnvironment.class); databaseStrategy = mock(DatabaseStrategy.class); pipelineRepository = new PipelineRepository(sessionFactory, goCache,systemEnvironment, databaseStrategy); pipelineRepository.setHibernateTemplate(hibernateTemplate); }
Source:
<code>public void onBecomingLeader() { LOG.info("ZkJobCoordinator::onBecomeLeader - I became the leader!"); metrics.isLeader.set(true); <START> zkUtils.subscribeToProcessorChange(new ProcessorChangeHandler(zkUtils)); <END> debounceTimer.scheduleAfterDebounceTime(ON_PROCESSOR_CHANGE, debounceTimeMs, () -> { doOnProcessorChange(new ArrayList<>()); }); }</code><technical_language>handler require a zkUtils reference itself? for other one</technical_language>

Target:
public void onBecomingLeader() { LOG.info("ZkJobCoordinator::onBecomeLeader - I became the leader"); metrics.isLeader.set(true); zkUtils.subscribeToProcessorChange(new ProcessorChangeHandler(zkUtils)); debounceTimer.scheduleAfterDebounceTime(ON_PROCESSOR_CHANGE, debounceTimeMs, () -> { doOnProcessorChange(new ArrayList<>()); }); }
Source:
<code>public Optional<String> getUsername(PublicSigningKey signer) { String name = reverseLookup.get(signer); <START> if (name == null) <END> return Optional.empty(); return Optional.of(name); }</code><technical_language>return Optional.ofNullable(name);</technical_language>

Target:
public Optional<String> getUsername(PublicSigningKey signer) { String name = reverseLookup.get(signer); return Optional.ofNullable(name); }
Source:
<code>public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { return method.invoke(bean, args); } catch (Throwable e) { logger.error("Convert RpcException to real exception"); Throwable t; <START> while ((t = e.getCause()) != null) { <END> e = t; } throw e; } }</code><technical_language>if</technical_language>

Target:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { try { return method.invoke(bean, args); } catch (UndeclaredThrowableException e) { logger.error("Convert RpcException to real exception"); if (e.getCause() instanceof InvocationTargetException) { throw e.getCause().getCause(); } else { throw e; } } }
Source:
<code>public void start(StartContext context) throws StartException { final ExecutorService executorService = getExecutorServiceInjector().getValue(); this.hostControllerConfigurationPersister = new HostControllerConfigurationPersister(environment, hostControllerInfo, executorService, hostExtensionRegistry, extensionRegistry); setConfigurationPersister(hostControllerConfigurationPersister); prepareStepHandler.setExecutorService(executorService); ThreadFactory pingerThreadFactory = doPrivileged(new PrivilegedAction<JBossThreadFactory>() { public JBossThreadFactory run() { return new JBossThreadFactory(new ThreadGroup("proxy-pinger-threads"), Boolean.TRUE, null, "%G - %t", null, null); } }); pingScheduler = Executors.newScheduledThreadPool(PINGER_POOL_SIZE, pingerThreadFactory); ContentCleanerService.addServiceOnHostController(context.getChildTarget(), DomainModelControllerService.SERVICE_NAME, <START> CLIENT_FACTORY_CAPABILITY.getCapabilityServiceName(), <END> HC_EXECUTOR_SERVICE_NAME, HC_SCHEDULED_EXECUTOR_SERVICE_NAME); super.start(context); pingScheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { slaveHostRegistrations.pruneExpired(); } catch (Exception e) { HostControllerLogger.DOMAIN_LOGGER.debugf(e, "failed to execute eviction task"); } } }, 1, 1, TimeUnit.MINUTES); }</code><technical_language>constant CLIENT_FACTORY_SERVICE_NAME defined</technical_language>

Target:
public void start(StartContext context) throws StartException { final ExecutorService executorService = getExecutorServiceInjector().getValue(); this.hostControllerConfigurationPersister = new HostControllerConfigurationPersister(environment, hostControllerInfo, executorService, hostExtensionRegistry, extensionRegistry); setConfigurationPersister(hostControllerConfigurationPersister); prepareStepHandler.setExecutorService(executorService); ThreadFactory pingerThreadFactory = doPrivileged(new PrivilegedAction<JBossThreadFactory>() { public JBossThreadFactory run() { return new JBossThreadFactory(new ThreadGroup("proxy-pinger-threads"), Boolean.TRUE, null, "%G - %t", null, null); } }); pingScheduler = Executors.newScheduledThreadPool(PINGER_POOL_SIZE, pingerThreadFactory); ContentCleanerService.addServiceOnHostController(context.getChildTarget(), DomainModelControllerService.SERVICE_NAME, CLIENT_FACTORY_SERVICE_NAME, HC_EXECUTOR_SERVICE_NAME, HC_SCHEDULED_EXECUTOR_SERVICE_NAME); super.start(context); pingScheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { slaveHostRegistrations.pruneExpired(); } catch (Exception e) { HostControllerLogger.DOMAIN_LOGGER.debugf(e, "failed to execute eviction task"); } } }, 1, 1, TimeUnit.MINUTES); }
Source:
<code>public void visitForEachStatement(ForEachStatement tree) { scan(tree.variable()); scan(tree.expression()); <START> TypeTree typeTree = tree.variable().type(); <END> JavaType iterableType = (JavaType) tree.expression().symbolType(); if (typeTree.is(Tree.Kind.VAR_TYPE)) { JavaType iteredObjectType = getIteredObjectType(iterableType); setInferedType(upwardProjection(iteredObjectType), (DeferredType) typeTree.symbolType()); } scan(tree.statement()); }</code><technical_language>variable if</technical_language>

Target:
public void visitForEachStatement(ForEachStatement tree) { scan(tree.variable()); scan(tree.expression()); TypeTree typeTree = tree.variable().type(); if (typeTree.is(Tree.Kind.VAR_TYPE)) { JavaType iteratedObjectType = getIteratedObjectType((JavaType) tree.expression().symbolType()); setInferedType(upwardProjection(iteratedObjectType), (DeferredType) typeTree.symbolType()); } scan(tree.statement()); }
Source:
<code>private Function<DataObject, Promise<Void>> onDelete() { return new Function<DataObject, Promise<Void>>() { @Override public Promise<Void> apply(DataObject deletedObject) throws FunctionException { <START> Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { <END> @Override public void execute() { eventBus.fireEvent(new ResourceNodeDeletedEvent(ResourceBasedNode.this)); } }); return Promises.resolve(null); } }; }</code><technical_language>explain Scheduller in this case</technical_language>

Target:
private Function<DataObject, Promise<Void>> onDelete() { return new Function<DataObject, Promise<Void>>() { @Override public Promise<Void> apply(DataObject deletedObject) throws FunctionException { eventBus.fireEvent(new ResourceNodeDeletedEvent(ResourceBasedNode.this)); return Promises.resolve(null); } }; }
Source:
<code><START> public void close() throws Exception { <END> }</code><technical_language>This declare throws Exception</technical_language>

Target:
public void close() { }
Source:
<code><START> public synchronized void removeQuotaFromCache(Guid storagePoolId, List<Guid> quotaList) { <END> lock.writeLock().lock(); try { if (!storagePoolQuotaMap.containsKey(storagePoolId)) { return; } synchronized (storagePoolQuotaMap.get(storagePoolId)) { Map<Guid, Quota> map = storagePoolQuotaMap.get(storagePoolId); for (Guid quotaId : quotaList) { map.remove(quotaId); } } } finally { lock.writeLock().unlock(); } }</code><technical_language>Please check if needed</technical_language>

Target:
public void removeQuotaFromCache(Guid storagePoolId, List<Guid> quotaList) { lock.writeLock().lock(); try { if (!storagePoolQuotaMap.containsKey(storagePoolId)) { return; } synchronized (storagePoolQuotaMap.get(storagePoolId)) { Map<Guid, Quota> map = storagePoolQuotaMap.get(storagePoolId); for (Guid quotaId : quotaList) { map.remove(quotaId); } } } finally { lock.writeLock().unlock(); } }
Source:
<code>public Void call() throws Exception { System.out.println(BANNER); System.out.println("Version: " + BrooklynVersion.get()); System.out.println("Website: <LINK_0>"); System.out.println("Source: <LINK_1>"); System.out.println(); System.out.println("Copyright 2011-2014 The Apache Software Foundation."); System.out.println("Licensed under the Apache 2.0 License"); <START> System.out.println(); <END> Console console = System.console(); if (console == null) { System.err.println("No console; cannot get password securely from standard input; aborting"); } System.out.print("Enter password: "); System.out.flush(); char[] chars = console.readPassword(); if (Strings.isBlank(new String(chars))) { System.err.println("Password must not be blank; aborting"); return null; } System.out.print("Re-enter password: "); System.out.flush(); char[] chars2 = console.readPassword(); if (!Arrays.equals(chars, chars2)) { System.err.println("Passwords did not match; aborting"); return null; } String salt = Identifiers.makeRandomId(4); String sha256password = PasswordHasher.sha256(salt, new String(chars)); System.out.println(); System.out.println("Please enter the following into your brooklyn.properies:"); System.out.println(); System.out.println("brooklyn.webconsole.security.users="+user); System.out.println("brooklyn.webconsole.security.user."+user+".salt="+salt); System.out.println("brooklyn.webconsole.security.user."+user+".sha256="+sha256password); return null; }</code><technical_language>Do need print this info</technical_language>

Target:
public Void call() throws Exception { checkCanReadPassword(); System.out.print("Enter password: "); System.out.flush(); String password = readPassword(); if (Strings.isBlank(password)) { throw new UserFacingException("Password must not be blank; aborting"); } System.out.print("Re-enter password: "); System.out.flush(); String password2 = readPassword(); if (!password.equals(password2)) { throw new UserFacingException("Passwords did not match; aborting"); } String salt = Identifiers.makeRandomId(4); String sha256password = PasswordHasher.sha256(salt, new String(password)); System.out.println(); System.out.println("Please add the following to your brooklyn.properties:"); System.out.println(); System.out.println("brooklyn.webconsole.security.users="+user); System.out.println("brooklyn.webconsole.security.user."+user+".salt="+salt); System.out.println("brooklyn.webconsole.security.user."+user+".sha256="+sha256password); return null; }
Source:
<code>public void testDSLWithFrom() { <START> final RuleModel m = new RuleModel(); <END> m.name = "testDSLWithFrom"; m.lhs = new IPattern[2]; m.rhs = new IAction[0]; final FromCollectCompositeFactPattern from = new FromCollectCompositeFactPattern(); final FromCompositeFactPattern rightPattern = new FromCompositeFactPattern(); final FactPattern person = new FactPattern("Person"); person.setBoundName("$person"); m.lhs[0] = person; rightPattern.setFactPattern(new FactPattern("Person")); rightPattern.setExpression(new ExpressionFormLine(new ExpressionVariable(person.getBoundName(), person.getFactType()))); from.setRightPattern(rightPattern); from.setFactPattern(new FactPattern("java.util.List")); m.lhs[1] = from; final RuleModel modelSpy = spy(m); doReturn(true).when(modelSpy).hasDSLSentences(); final String drl = ruleModelPersistence.marshal(modelSpy); final RuleModel tempModel = spy(ruleModelPersistence.unmarshalUsingDSL(drl, null, dmo, "")); doReturn(true).when(tempModel).hasDSLSentences(); final String newDrl = ruleModelPersistence.marshal(tempModel); final RuleModel newModel = ruleModelPersistence.unmarshalUsingDSL(newDrl, null, dmo, ""); assertTrue(newModel.lhs[0] instanceof FactPattern); assertTrue(newModel.lhs[1] instanceof FromCollectCompositeFactPattern); }</code><technical_language>me.. issue ">" in DRL this test purports DSLs DRL DSLs in test mocking of a DSL.. confident this test touches affected code?! Happy refer final judgement QE supremo @jomarko</technical_language>

Target:
public void testDSLWithFrom() { final RuleModel m = new RuleModel(); m.name = "testDSLWithFrom"; m.lhs = new IPattern[2]; m.rhs = new IAction[0]; final FromCollectCompositeFactPattern from = new FromCollectCompositeFactPattern(); final FromCompositeFactPattern rightPattern = new FromCompositeFactPattern(); final FactPattern person = new FactPattern("Person"); person.setBoundName("$person"); m.lhs[0] = person; rightPattern.setFactPattern(new FactPattern("Person")); rightPattern.setExpression(new ExpressionFormLine(new ExpressionVariable(person.getBoundName(), person.getFactType()))); from.setRightPattern(rightPattern); from.setFactPattern(new FactPattern("java.util.List")); m.lhs[1] = from; final RuleModel modelSpy = spy(m); doReturn(true).when(modelSpy).hasDSLSentences(); final String drl = ruleModelPersistence.marshal(modelSpy); final RuleModel tempModel = spy(ruleModelPersistence.unmarshalUsingDSL(drl, null, dmo, "")); doReturn(true).when(tempModel).hasDSLSentences(); final String newDrl = ruleModelPersistence.marshal(tempModel); final RuleModel newModel = ruleModelPersistence.unmarshalUsingDSL(newDrl, null, dmo, ""); assertTrue(newModel.lhs[0] instanceof FactPattern); assertTrue(newModel.lhs[1] instanceof FromCollectCompositeFactPattern); final String[] rows = newDrl.split("\n"); boolean foundWhen = false; for (final String row : rows) { if (row.trim().startsWith("then")) { break; } if (foundWhen && !row.trim().isEmpty() && !row.trim().startsWith(">")) { fail("Each row inside the LHS needs to start with >. The row with the issue: " + row); } if (row.trim().startsWith("when")) { foundWhen = true; } } }
Source:
<code>public void onMediaRetryAllClicked(Set<String> failedMediaIds) { UploadService.cancelFinalNotification(this, mPost); UploadService.cancelFinalNotificationForMedia(this, mSite); <START> ArrayList<MediaModel> failedMedia = new ArrayList<>(); <END> for (String mediaId : failedMediaIds) { failedMedia.add(mMediaStore.getMediaWithLocalId(Integer.valueOf(mediaId))); } if (!failedMedia.isEmpty()) { for (MediaModel mediaModel : failedMedia) { mediaModel.setUploadState(MediaUploadState.QUEUED); mDispatcher.dispatch(MediaActionBuilder.newUpdateMediaAction(mediaModel)); } startUploadService(failedMedia); } AnalyticsTracker.track(Stat.EDITOR_UPLOAD_MEDIA_RETRIED); }</code><technical_language>consider failedMedias failedMediaList</technical_language>

Target:
public void onMediaRetryAllClicked(Set<String> failedMediaIds) { UploadService.cancelFinalNotification(this, mPost); UploadService.cancelFinalNotificationForMedia(this, mSite); ArrayList<MediaModel> failedMediaList = new ArrayList<>(); for (String mediaId : failedMediaIds) { failedMediaList.add(mMediaStore.getMediaWithLocalId(Integer.valueOf(mediaId))); } if (!failedMediaList.isEmpty()) { for (MediaModel mediaModel : failedMediaList) { mediaModel.setUploadState(MediaUploadState.QUEUED); mDispatcher.dispatch(MediaActionBuilder.newUpdateMediaAction(mediaModel)); } startUploadService(failedMediaList); } AnalyticsTracker.track(Stat.EDITOR_UPLOAD_MEDIA_RETRIED); }
Source:
<code>private boolean isSchemaAccessible(CatalogSchemaName schema) { <START> Set<String> schemas = ImmutableSet.of(schema.getSchemaName()); <END> schemas = accessControl.filterSchemas(session.getRequiredTransactionId(), session.getIdentity(), schema.getCatalogName(), schemas); return schemas.contains(schema.getSchemaName()) && metadata.schemaExists(session, schema); }</code><technical_language>inline</technical_language>

Target:
private boolean isSchemaAccessible(CatalogSchemaName schema) { return metadata.schemaExists(session, schema) && filterSchemas(schema.getCatalogName(), ImmutableSet.of(schema.getSchemaName())).contains(schema.getSchemaName()); }
Source:
<code><START> public boolean isSchemaEnum(Type type) { <END> for (Name name : SCHEMA_ENUMS) { if (name.toString().equals(type.getName().toString())) { return true; } } return false; }</code><technical_language>"Name" class implements correctly "equals" method, do this: return SCHEMA_ENUMS.contains(type.getName());</technical_language>

Target:
public boolean isSchemaEnum(Type type) { return SCHEMA_ENUMS.contains(type.getName()); }