auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean validateHostPort(String string) { try { URI uri = new URI("my://" + string); if (uri.getHost() == null || uri.getPort() == -1) { throw new URISyntaxException(uri.toString(), "URI must have host and port parts"); } } catch (URISyntaxException ex) { return false; } return true; }

Target:
private boolean validateHostPort(String string) { try { URI uri = new URI("my://" + string); if (uri.getHost() == null || uri.getPort() == -1) { return false; } } catch (URISyntaxException ex) { return false; } return true; }
Source:
public SpatialIndexBuilderOperator( OperatorContext operatorContext, PagesSpatialIndexFactory pagesSpatialIndexFactory, List<Integer> outputChannels, int indexChannel, BiPredicate<OGCGeometry, OGCGeometry> spatialRelationshipTest, Optional<JoinFilterFunctionFactory> filterFunctionFactory, int expectedPositions, PagesIndex.Factory pagesIndexFactory) { this.operatorContext = operatorContext; this.localUserMemoryContext = operatorContext.localUserMemoryContext(); this.spatialRelationshipTest = spatialRelationshipTest; this.filterFunctionFactory = filterFunctionFactory; this.index = pagesIndexFactory.newPagesIndex(pagesSpatialIndexFactory.getTypes(), expectedPositions); this.pagesSpatialIndexFactory = pagesSpatialIndexFactory; this.outputChannels = outputChannels; this.indexChannel = indexChannel; }

Target:
private SpatialIndexBuilderOperator( OperatorContext operatorContext, PagesSpatialIndexFactory pagesSpatialIndexFactory, List<Integer> outputChannels, int indexChannel, BiPredicate<OGCGeometry, OGCGeometry> spatialRelationshipTest, Optional<JoinFilterFunctionFactory> filterFunctionFactory, int expectedPositions, PagesIndex.Factory pagesIndexFactory) { this.operatorContext = requireNonNull(operatorContext, "operatorContext is null"); this.localUserMemoryContext = operatorContext.localUserMemoryContext(); this.spatialRelationshipTest = requireNonNull(spatialRelationshipTest, "spatialRelationshipTest is null"); this.filterFunctionFactory = filterFunctionFactory; this.pagesSpatialIndexFactory = requireNonNull(pagesSpatialIndexFactory, "pagesSpatialIndexFactory is null"); this.index = pagesIndexFactory.newPagesIndex(pagesSpatialIndexFactory.getTypes(), expectedPositions); this.outputChannels = requireNonNull(outputChannels, "outputChannels is null"); this.indexChannel = indexChannel; }
Source:
private Set<SignatureAlgorithm> fetchSignatureAlgorithms() { if (StringUtils.isEmpty(jwkSetUri)) { return Collections.emptySet(); } try { return parseAlgorithms(JWKSet.load(toURL(jwkSetUri), 5000, 5000, 0)); } catch (Exception ex) { log.error("Failed to load Signature Algorithms from remote JWK source."); return Collections.emptySet(); } }

Target:
private Set<SignatureAlgorithm> fetchSignatureAlgorithms() { try { return parseAlgorithms(JWKSet.load(toURL(jwkSetUri), 5000, 5000, 0)); } catch (Exception ex) { throw new IllegalArgumentException("Failed to load Signature Algorithms from remote JWK source.", ex); } }
Source:
public void testExecuteAndPostProcess() { InstructorAttributes instructor1ofCourse1 = dataBundle.instructors.get("instructor1OfCourse1"); FeedbackSessionAttributes fs = dataBundle.feedbackSessions.get("session1InCourse1"); InstructorFeedbackRemindAction action; RedirectResult rr; ______TS("Unsuccessful case: Not owned Course/Modify Permission, authentication failure"); String[] paramsNotOwnedCourse = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), }; verifyUnaccessibleForInstructorsOfOtherCourses(paramsNotOwnedCourse); verifyUnaccessibleWithoutModifySessionPrivilege(paramsNotOwnedCourse); gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId); ______TS("Unsuccessful case: Not enough Parameter"); verifyAssumptionFailure(); String[] paramsNoCourseId = new String[] { Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), }; verifyAssumptionFailure(paramsNoCourseId); String[] paramsNoFeedback = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId() }; verifyAssumptionFailure(paramsNoFeedback); ______TS("Successful case: Typical case"); String[] paramsTypical = new String[]{ Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), }; action = getAction(paramsTypical); rr = (RedirectResult) action.executeAndPostProcess(); assertTrue(rr.getStatusMessage().contains(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSENT)); verifySpecifiedTasksAdded(action, TaskQueue.FEEDBACK_SESSION_REMIND_EMAIL_QUEUE_NAME, 1); }

Target:
public void testExecuteAndPostProcess() { InstructorAttributes instructor1ofCourse1 = dataBundle.instructors.get("instructor1OfCourse1"); FeedbackSessionAttributes fs = dataBundle.feedbackSessions.get("session1InCourse1"); gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId); ______TS("Unsuccessful case: Not enough parameters"); verifyAssumptionFailure(); String[] paramsNoCourseId = new String[] { Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), }; verifyAssumptionFailure(paramsNoCourseId); String[] paramsNoFeedback = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId() }; verifyAssumptionFailure(paramsNoFeedback); ______TS("Successful case: Typical case"); String[] paramsTypical = new String[]{ Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), }; InstructorFeedbackRemindAction action = getAction(paramsTypical); RedirectResult rr = (RedirectResult) action.executeAndPostProcess(); assertTrue(rr.getStatusMessage().contains(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSENT)); verifySpecifiedTasksAdded(action, TaskQueue.FEEDBACK_SESSION_REMIND_EMAIL_QUEUE_NAME, 1); }
Source:
public void activate() { logger.info("Activate " + Thread.currentThread()); controllerThread.start(); }

Target:
public void activate() { logger.info("Activate " + Thread.currentThread()); }
Source:
public Future<PoolEntry<T, C>> lease( final T route, final Object state, final Timeout requestTimeout, final FutureCallback<PoolEntry<T, C>> callback) { Args.notNull(route, "Route"); Args.notNull(requestTimeout, "Request timeout"); Asserts.check(!this.isShutDown.get(), "Connection pool shut down"); final Deadline deadline = Deadline.calculate(requestTimeout); final BasicFuture<PoolEntry<T, C>> future = new BasicFuture<>(callback); boolean acquiredLock = false; try { acquiredLock = this.lock.tryLock(requestTimeout.getDuration(), requestTimeout.getTimeUnit()); } catch (final InterruptedException ignored) { } if (acquiredLock) { try { final LeaseRequest<T, C> request = new LeaseRequest<>(route, state, requestTimeout, future); final boolean completed = processPendingRequest(request); if (!request.isDone() && !completed) { this.leasingRequests.add(request); } if (request.isDone()) { this.completedRequests.add(request); } } finally { this.lock.unlock(); } fireCallbacks(); } else { future.failed(DeadlineTimeoutException.from(deadline)); } return future; }

Target:
public Future<PoolEntry<T, C>> lease( final T route, final Object state, final Timeout requestTimeout, final FutureCallback<PoolEntry<T, C>> callback) { Args.notNull(route, "Route"); Args.notNull(requestTimeout, "Request timeout"); Asserts.check(!this.isShutDown.get(), "Connection pool shut down"); final Deadline deadline = Deadline.calculate(requestTimeout); final BasicFuture<PoolEntry<T, C>> future = new BasicFuture<>(callback); final boolean acquiredLock; try { acquiredLock = this.lock.tryLock(requestTimeout.getDuration(), requestTimeout.getTimeUnit()); } catch (final InterruptedException interruptedException) { Thread.currentThread().interrupt(); future.cancel(); return future; } if (acquiredLock) { try { final LeaseRequest<T, C> request = new LeaseRequest<>(route, state, requestTimeout, future); final boolean completed = processPendingRequest(request); if (!request.isDone() && !completed) { this.leasingRequests.add(request); } if (request.isDone()) { this.completedRequests.add(request); } } finally { this.lock.unlock(); } fireCallbacks(); } else { future.failed(DeadlineTimeoutException.from(deadline)); } return future; }
Source:
public void dump() { m_replaySequencer.dump(m_mailbox.getHSId()); tmLog.info(String.format("%s: %s", CoreUtils.hsIdToString(m_mailbox.getHSId()), m_pendingTasks)); if (m_defaultConsistencyReadLevel == ReadLevel.SAFE) { hostLog.info("[dump] current truncation handle: " + TxnEgo.debugTxnId(m_repairLogTruncationHandle) + " " + (m_defaultConsistencyReadLevel == Consistency.ReadLevel.SAFE ? m_bufferedReadLog.toString() : "")); } }

Target:
public void dump() { m_replaySequencer.dump(m_mailbox.getHSId()); tmLog.info(String.format("%s: %s", CoreUtils.hsIdToString(m_mailbox.getHSId()), m_pendingTasks)); if (m_defaultConsistencyReadLevel == ReadLevel.SAFE) { tmLog.info("[dump] current truncation handle: " + TxnEgo.txnIdToString(m_repairLogTruncationHandle) + " " + (m_defaultConsistencyReadLevel == Consistency.ReadLevel.SAFE ? m_bufferedReadLog.toString() : "")); } }
Source:
public void flush() throws IOException { LOG.trace("Flushing"); try { sizeManager.flush(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException("flush() was interrupted before it could complete", e); } LOG.trace("Done flushing"); }

Target:
public void flush() throws IOException { LOG.trace("Flushing"); try { sizeManager.flush(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } LOG.trace("Done flushing"); }
Source:
public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) { String line = text.getText(); int end = line.indexOf(':',charPos); if (end<0) { if (CLASSNAME.matcher(line.substring(charPos)).matches()) end = line.length(); else return null; } text.addHyperlinkLowKey(charPos,end,annotateClassName(line.substring(charPos,end))); return new ConsoleAnnotator() { @Override public ConsoleAnnotator annotate(Object context, MarkupText text) { return null; } }; }

Target:
public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) { return null; }
Source:
public static boolean isOfType(DetailAST ast, int... types) { return ast != null && Arrays.stream(types).anyMatch(tokenType -> tokenType == ast.getType()); }

Target:
public static boolean isOfType(DetailAST ast, int... types) { return ast != null && isOfType(ast.getType(), types); }
Source:
protected void stubGet(UrlMatchingStrategy url, String responseFile) throws Exception { stubFor(get(url) .withHeader("Authorization", equalTo("Basic dXNlcjpwYXNz")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBody(IOUtils.toString(getClass().getResourceAsStream(responseFile))))); }

Target:
protected void stubGet(UrlMatchingStrategy url, String responseFile) throws Exception { stubFor(get(url) .withHeader("Authorization", equalTo("Basic dXNlcjpwYXNz")) .willReturn(aResponse() .withStatus(HttpStatus.SC_OK) .withHeader("Content-Type", "application/json") .withBody(IOUtils.toString(getClass().getResourceAsStream(responseFile))))); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MeasuredUnit measuredUnit = (MeasuredUnit) o; if (name != null ? !name.equals(measuredUnit.name) : measuredUnit.name != null) return false; if (displayName != null ? !displayName.equals(measuredUnit.displayName) : measuredUnit.displayName != null) return false; if (description != null ? !description.equals(measuredUnit.description) : measuredUnit.description != null) return false; return true; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MeasuredUnit measuredUnit = (MeasuredUnit) o; if (id != null ? !id.equals(measuredUnit.id) : measuredUnit.id != null) return false; if (name != null ? !name.equals(measuredUnit.name) : measuredUnit.name != null) return false; if (displayName != null ? !displayName.equals(measuredUnit.displayName) : measuredUnit.displayName != null) return false; if (description != null ? !description.equals(measuredUnit.description) : measuredUnit.description != null) return false; return true; }
Source:
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } MyObject other = (MyObject) obj; if (count != other.count) { return false; } if (message == null) { if (other.message != null) { return false; } } else if (!message.equals(other.message)) { return false; } return true; }

Target:
@Override public boolean equals(Object obj) { if (obj == this) return true; if (!(obj instanceof MyObject)) return false; MyObject other = (MyObject) obj; return count == other.count && (message == null ? other.message == null : message.equals(other.message)); }
Source:
protected void run() throws Exception { if (localName != null && gitdir != null) throw die(CLIText.get().conflictingUsageOf_git_dir_andArguments); final URIish uri = new URIish(sourceUri); if (localName == null) { try { localName = uri.getHumanishName(); } catch (IllegalArgumentException e) { throw die(MessageFormat.format(CLIText.get().cannotGuessLocalNameFrom, sourceUri)); } } if (branch == null) branch = Constants.HEAD; CloneCommand command = Git.cloneRepository(); command.setURI(sourceUri).setRemote(remoteName) .setNoCheckout(noCheckout).setBranch(branch); String dirPath = ""; if (localName != null && localName.length() > 0) dirPath = localName; if (gitdir != null && gitdir.length() > 0) dirPath = gitdir; command.setDirectory(new File(dirPath)); try { outw.println(MessageFormat.format(CLIText.get().cloningInto, dirPath)); Repository db = command.call().getRepository(); if (db.resolve(Constants.HEAD) == null) outw.println(CLIText.get().clonedEmptyRepository); } catch (InvalidRemoteException e) { throw die(MessageFormat.format(CLIText.get().doesNotExist, sourceUri)); } outw.println(); outw.flush(); }

Target:
protected void run() throws Exception { if (localName != null && gitdir != null) throw die(CLIText.get().conflictingUsageOf_git_dir_andArguments); final URIish uri = new URIish(sourceUri); if (localName == null) { try { localName = uri.getHumanishName(); } catch (IllegalArgumentException e) { throw die(MessageFormat.format(CLIText.get().cannotGuessLocalNameFrom, sourceUri)); } } if (branch == null) branch = Constants.HEAD; CloneCommand command = Git.cloneRepository(); command.setURI(sourceUri).setRemote(remoteName) .setNoCheckout(noCheckout).setBranch(branch); command.setGitDir(gitdir == null ? null : new File(gitdir)); command.setDirectory(localName == null ? null : new File(localName)); try { outw.println(MessageFormat.format(CLIText.get().cloningInto, command.getDirectory().getPath())); db = command.call().getRepository(); if (db.resolve(Constants.HEAD) == null) outw.println(CLIText.get().clonedEmptyRepository); } catch (InvalidRemoteException e) { throw die(MessageFormat.format(CLIText.get().doesNotExist, sourceUri)); } finally { if (db != null) db.close(); } outw.println(); outw.flush(); }
Source:
private boolean isUpsertEnabled() { return _upsertMode != null && _upsertMode == UpsertConfig.Mode.FULL || _upsertMode == UpsertConfig.Mode.PARTIAL; }

Target:
public boolean isUpsertEnabled() { return _upsertMode != UpsertConfig.Mode.NONE; }
Source:
private void handleFormats(List<StringField> sourceFormats, DataSetReference.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(sourceFormats)) { List<CharSequence> resultFormats = new ArrayList<CharSequence>(); for (StringField sourceFormat : sourceFormats) { if (fieldApprover.approve(sourceFormat.getDataInfo()) && StringUtils.isNotBlank(sourceFormat.getValue())) { resultFormats.add(sourceFormat.getValue()); } } metaBuilder.setFormats(resultFormats); } }

Target:
private void handleFormats(List<StringField> sourceFormats, DataSetReference.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(sourceFormats)) { metaBuilder.setFormats(sourceFormats.stream().filter(x -> fieldApprover.approve(x.getDataInfo())) .filter(x -> StringUtils.isNotBlank(x.getValue())).map(StringField::getValue) .collect(Collectors.toList())); } }
Source:
public static String preprocessQuery(Optional<String> catalog, Optional<String> schema, String query) throws QueryPreprocessorException { Duration timeout = DEFAULT_PREPROCESSOR_TIMEOUT; String timeoutEnvironment = System.getenv(ENV_PREPROCESSOR_TIMEOUT); if (emptyToNull(timeoutEnvironment) != null) { timeout = Duration.valueOf(timeoutEnvironment.trim()); } String preprocessorCommand = System.getenv(ENV_PREPROCESSOR); if (emptyToNull(preprocessorCommand) == null) { return query; } return preprocessQuery(catalog, schema, query, ImmutableList.of("/bin/sh", "-c", preprocessorCommand.trim()), timeout); }

Target:
public static String preprocessQuery(Optional<String> catalog, Optional<String> schema, String query) throws QueryPreprocessorException { Duration timeout = DEFAULT_PREPROCESSOR_TIMEOUT; String timeoutEnvironment = nullToEmpty(System.getenv(ENV_PREPROCESSOR_TIMEOUT)).trim(); if (!timeoutEnvironment.isEmpty()) { timeout = Duration.valueOf(timeoutEnvironment); } String preprocessorCommand = System.getenv(ENV_PREPROCESSOR); if (emptyToNull(preprocessorCommand) == null) { return query; } return preprocessQuery(catalog, schema, query, ImmutableList.of("/bin/sh", "-c", preprocessorCommand), timeout); }
Source:
public boolean isAnyNotificationUnread() { List<WebElement> notifications = notificationCards .stream() .filter(card -> card .getAttribute("class") .contains(UNREAD_CLASS)) .collect(Collectors.toList()); return !notifications.isEmpty(); }

Target:
public boolean isAnyNotificationUnread() { return notificationCards .stream() .anyMatch(card -> card .getAttribute("class") .contains(UNREAD_CLASS)); }
Source:
public static void setupFlavoredUI(PlaybackPreferencesFragment ui) { ui.findPreference(UserPreferences.PREF_CAST_ENABLED).setOnPreferenceChangeListener((preference, o) -> { if (o instanceof Boolean && ((Boolean) o)) { final int googlePlayServicesCheck = GoogleApiAvailability.getInstance() .isGooglePlayServicesAvailable(ui.getActivity()); if (googlePlayServicesCheck == ConnectionResult.SUCCESS) { displayRestartRequiredDialog(ui.requireContext()); return true; } else { GoogleApiAvailability.getInstance() .getErrorDialog(ui.getActivity(), googlePlayServicesCheck, 0) .show(); return false; } } displayRestartRequiredDialog(ui.requireContext()); return true; }); }

Target:
public static void setupFlavoredUI(PlaybackPreferencesFragment ui) { ui.findPreference(UserPreferences.PREF_CAST_ENABLED).setOnPreferenceChangeListener((preference, o) -> { if (o instanceof Boolean && ((Boolean) o)) { final int googlePlayServicesCheck = GoogleApiAvailability.getInstance() .isGooglePlayServicesAvailable(ui.getActivity()); if (googlePlayServicesCheck == ConnectionResult.SUCCESS) { displayRestartRequiredDialog(ui.requireContext()); return true; } else { GoogleApiAvailability.getInstance() .getErrorDialog(ui.getActivity(), googlePlayServicesCheck, 0) .show(); return false; } } return true; }); }
Source:
public void mouseClicked(MouseEvent e) { JTable table = this.weakRef.get(); if (table != null) { int uiIndex = table.getColumnModel().getColumnIndexAtX(e.getX()); this.columnIndex = table.getColumnModel().getColumn(uiIndex).getModelIndex(); for (RowSorter.SortKey key : table.getRowSorter().getSortKeys()) { if (key.getColumn() == this.columnIndex) { this.sortOrder = key.getSortOrder(); break; } } } }

Target:
public void mouseClicked(MouseEvent e) { JTable table = this.weakRef.get(); if (table != null) { int uiIndex = table.getColumnModel().getColumnIndexAtX(e.getX()); if (uiIndex == -1) { return; } this.columnIndex = table.getColumnModel().getColumn(uiIndex).getModelIndex(); for (RowSorter.SortKey key : table.getRowSorter().getSortKeys()) { if (key.getColumn() == this.columnIndex) { this.sortOrder = key.getSortOrder(); break; } } } }
Source:
public void handleActualMeterReadsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final MeterReadsResponseDto actualMeterReadsDto) { LOGGER.info("handleActualMeterReadsResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } this.webServiceResponseMessageSender.send( ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception) .withDataObject(this.monitoringMapper.map(actualMeterReadsDto, MeterReads.class)) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }

Target:
public void handleActualMeterReadsResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final MeterReadsResponseDto actualMeterReadsDto) { LOGGER.info("handleActualMeterReadsResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception) .withDataObject(this.monitoringMapper.map(actualMeterReadsDto, MeterReads.class)) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
public void run(BatchActionContext batchContext) throws Exception { config.validate(batchContext.getFailureCollector()); if (!config.shouldRun(batchContext)) { return; } Class<? extends Driver> driverClass = batchContext.loadPluginClass(JDBC_PLUGIN_ID); DBRun executeQuery = new DBRun(config, driverClass); executeQuery.run(); }

Target:
public void run(BatchActionContext batchContext) throws Exception { FailureCollector collector = batchContext.getFailureCollector(); config.validate(collector); collector.getOrThrowException(); if (!config.shouldRun(batchContext)) { return; } Class<? extends Driver> driverClass = batchContext.loadPluginClass(JDBC_PLUGIN_ID); DBRun executeQuery = new DBRun(config, driverClass); executeQuery.run(); }
Source:
private void deleteKeyPair(KeyPair keyPair) { System.out.format(" Delete Key Pair%n"); KeyPairApi keyPairApi = nova.getApi().getKeyPairExtensionForZone(ZONE).get(); keyPairApi.delete(keyPair.getName()); if (keyPairFile.delete()) { System.out.format(" Deleted %s%n", keyPairFile.getAbsolutePath()); } else { System.out.format(" Could not delete %s%n", keyPairFile.getAbsolutePath()); } }

Target:
private void deleteKeyPair(KeyPair keyPair) { System.out.format(" Delete Key Pair%n"); KeyPairApi keyPairApi = novaContext.getApi().getKeyPairExtensionForZone(ZONE).get(); keyPairApi.delete(keyPair.getName()); if (keyPairFile.delete()) { System.out.format(" Deleted %s%n", keyPairFile.getAbsolutePath()); } else { System.err.format(" Could not delete %s%n", keyPairFile.getAbsolutePath()); } }
Source:
protected String copyRecurse(String sourceId, String parentId, LinkedList<String> ancestorIds, String name, boolean excludeSpecialChildren, boolean excludeRegularChildren) { String copyId = copy(sourceId, parentId, ancestorIds, name); ancestorIds.addLast(copyId); for (String childId : getChildrenIds(sourceId, excludeSpecialChildren, excludeRegularChildren)) { copyRecurse(childId, copyId, ancestorIds, null, true, false); } ancestorIds.removeLast(); return copyId; }

Target:
protected String copyRecurse(String sourceId, String parentId, LinkedList<String> ancestorIds, String name, boolean excludeSpecialChildren, boolean excludeRegularChildren) { String copyId = copy(sourceId, parentId, ancestorIds, name); ancestorIds.addLast(copyId); for (String childId : getChildrenIds(sourceId, excludeSpecialChildren, excludeRegularChildren)) { copyRecurse(childId, copyId, ancestorIds, null, excludeSpecialChildren, false); } ancestorIds.removeLast(); return copyId; }
Source:
public SubscribeConnection openSubscribe() throws NotSupportedException, TransportException { final String service = SVC_PUBLISH_SUBSCRIBE; try { final HttpURLConnection c = connect(service); final InputStream in = openInputStream(c); try { if (isSmartHttp(c, service)) { readSmartHeaders(in, service); return new SmartHttpSubscribeConnection(in); } else { String msg = JGitText .get().remoteDoesNotSupportSmartHTTPSubscribe; throw new NotSupportedException(MessageFormat.format( msg, baseUrl.toString())); } } finally { in.close(); } } catch (IOException err) { throw new TransportException(uri, JGitText .get().errorReadingInfoRefs, err); } }

Target:
public SubscribeConnection openSubscribe() throws NotSupportedException, TransportException { return new SmartHttpSubscribeConnection(); }
Source:
public void validate() { StorageType type = attributes.attribute(STORAGE_TYPE).get(); if (type != StorageType.OBJECT && getBuilder().compatibility().isEnabled()) { throw new CacheConfigurationException("Compatibility mode requires OBJECT storage type but was: " + type); } long size = attributes.attribute(SIZE).get(); if (size > 0) { EvictionType evictionType = attributes.attribute(EVICTION_TYPE).get(); if (evictionType == EvictionType.MEMORY) { switch (type) { case OBJECT: throw new CacheConfigurationException("MEMORY based eviction is not supported with OBJECT storage"); case OFF_HEAP: int addressCount = attributes.attribute(ADDRESS_COUNT).get(); long actualAddressCount = OffHeapDataContainer.findRequiredMemoryAddress(addressCount); actualAddressCount *= 8; if (size < actualAddressCount) { throw new CacheConfigurationException("MEMORY based OFF_HEAP eviction configured size " + size + " must be larger than " + actualAddressCount + " to store configured address count of " + addressCount); } } } } }

Target:
public void validate() { StorageType type = attributes.attribute(STORAGE_TYPE).get(); if (type != StorageType.OBJECT && getBuilder().compatibility().isEnabled()) { throw log.compatibilityModeOnlyCompatibleWithObjectStorage(type); } long size = attributes.attribute(SIZE).get(); if (size > 0) { EvictionType evictionType = attributes.attribute(EVICTION_TYPE).get(); if (evictionType == EvictionType.MEMORY) { switch (type) { case OBJECT: throw log.offHeapMemoryEvictionNotSupportedWithObject(); case OFF_HEAP: int addressCount = attributes.attribute(ADDRESS_COUNT).get(); long actualAddressCount = OffHeapDataContainer.getActualAddressCount(addressCount << 3); actualAddressCount = UnpooledOffHeapMemoryAllocator.estimateSizeOverhead(actualAddressCount); if (size < actualAddressCount) { throw log.offHeapMemoryEvictionSizeNotLargeEnoughForAddresses(size, actualAddressCount, addressCount); } } } } }
Source:
private void sleepUntilLoginDisplays(final AuthenticationActivity startedActivity) throws InterruptedException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { Log.v(TAG, "sleepUntilLoginDisplays start"); waitUntil(PAGE_LOAD_TIMEOUT * 5, new ResponseVerifier() { @Override public boolean hasCondition() throws IllegalArgumentException, NoSuchFieldException, IllegalAccessException { return hasLoginPage(getLoginPage(startedActivity)); } }); Log.v(TAG, "sleepUntilLoginDisplays end"); }

Target:
private void sleepUntilLoginDisplays(final AuthenticationActivity startedActivity) throws InterruptedException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException { Log.v(TAG, "sleepUntilLoginDisplays start"); waitUntil(LOGIN_DISPLAY_TIME_OUT, new ResponseVerifier() { @Override public boolean hasCondition() throws IllegalArgumentException, NoSuchFieldException, IllegalAccessException { return hasLoginPage(getLoginPage(startedActivity)); } }); Log.v(TAG, "sleepUntilLoginDisplays end"); }
Source:
void cleanUp() { Log.d(TAG, "Vungle banner adapter try to cleanUp:" + this); if (mVungleBannerAd != null) { Log.d(TAG, "Vungle banner adapter cleanUp: destroyAd # " + mVungleBannerAd.hashCode()); mVungleBannerAd.destroyAd(); if (mVungleBannerAd != null && mVungleBannerAd.getParent() != null) { ((RelativeLayout) mVungleBannerAd.getParent()).removeView(mVungleBannerAd); } mVungleBannerAd = null; } if (mVungleNativeAd != null) { Log.d(TAG, "Vungle banner adapter cleanUp: finishDisplayingAd # " + mVungleNativeAd.hashCode()); mVungleNativeAd.finishDisplayingAd(); if (mVungleNativeAd != null) { View adView = mVungleNativeAd.renderNativeView(); if (adView != null && adView.getParent() != null) { ((RelativeLayout) adView.getParent()).removeView(adView); } } mVungleNativeAd = null; } }

Target:
void cleanUp() { Log.d(TAG, "Vungle banner adapter try to cleanUp:" + this); if (mVungleBannerAd != null) { Log.d(TAG, "Vungle banner adapter cleanUp: destroyAd # " + mVungleBannerAd.hashCode()); mVungleBannerAd.destroyAd(); if (mVungleBannerAd != null && mVungleBannerAd.getParent() != null) { ((ViewGroup) mVungleBannerAd.getParent()).removeView(mVungleBannerAd); } mVungleBannerAd = null; } if (mVungleNativeAd != null) { Log.d(TAG, "Vungle banner adapter cleanUp: finishDisplayingAd # " + mVungleNativeAd.hashCode()); mVungleNativeAd.finishDisplayingAd(); if (mVungleNativeAd != null) { View adView = mVungleNativeAd.renderNativeView(); if (adView != null && adView.getParent() != null) { ((ViewGroup) adView.getParent()).removeView(adView); } } mVungleNativeAd = null; } }
Source:
public void getConsensusFromCurrentMembers1Node() throws Exception { addServer(SERVERS.PORT_0); addServer(SERVERS.PORT_1); Layout l = new TestLayoutBuilder() .setEpoch(1L) .addLayoutServer(SERVERS.PORT_1) .addSequencer(SERVERS.PORT_1) .buildSegment() .buildStripe() .addLogUnit(SERVERS.PORT_1) .addToSegment() .addToLayout() .build(); bootstrapAllServers(l); CorfuRuntime corfuRuntime = getRuntime(l).connect(); getManagementServer(SERVERS.PORT_0).shutdown(); getManagementServer(SERVERS.PORT_1).shutdown(); Layout newLayout = new TestLayoutBuilder() .setEpoch(2L) .addLayoutServer(SERVERS.PORT_0) .addLayoutServer(SERVERS.PORT_1) .addSequencer(SERVERS.PORT_1) .buildSegment() .buildStripe() .addLogUnit(SERVERS.PORT_1) .addToSegment() .addToLayout() .build(); l.setEpoch(l.getEpoch() + 1); corfuRuntime.getLayoutView().getRuntimeLayout(l).sealMinServerSet(); corfuRuntime.getLayoutView().updateLayout(newLayout, 1L); System.out.println("check12"); assertThat(getLayoutServer(SERVERS.PORT_0).getCurrentLayout()).isEqualTo(newLayout); assertThat(getLayoutServer(SERVERS.PORT_1).getCurrentLayout()).isEqualTo(newLayout); }

Target:
public void getConsensusFromCurrentMembers1Node() throws Exception { addServer(SERVERS.PORT_0); addServer(SERVERS.PORT_1); Layout l = new TestLayoutBuilder() .setEpoch(1L) .addLayoutServer(SERVERS.PORT_1) .addSequencer(SERVERS.PORT_1) .buildSegment() .buildStripe() .addLogUnit(SERVERS.PORT_1) .addToSegment() .addToLayout() .build(); bootstrapAllServers(l); CorfuRuntime corfuRuntime = getRuntime(l).connect(); getManagementServer(SERVERS.PORT_0).shutdown(); getManagementServer(SERVERS.PORT_1).shutdown(); Layout newLayout = new TestLayoutBuilder() .setEpoch(2L) .addLayoutServer(SERVERS.PORT_0) .addLayoutServer(SERVERS.PORT_1) .addSequencer(SERVERS.PORT_1) .buildSegment() .buildStripe() .addLogUnit(SERVERS.PORT_1) .addToSegment() .addToLayout() .build(); l.setEpoch(l.getEpoch() + 1); corfuRuntime.getLayoutView().getRuntimeLayout(l).sealMinServerSet(); corfuRuntime.getLayoutView().updateLayout(newLayout, 1L); assertThat(getLayoutServer(SERVERS.PORT_0).getCurrentLayout()).isEqualTo(newLayout); assertThat(getLayoutServer(SERVERS.PORT_1).getCurrentLayout()).isEqualTo(newLayout); }
Source:
private void pullMetadata(final Callback callback) { mPullMetadataController.pullMetadata(new PullMetadataController.Callback() { @Override public void onComplete() { if(mMetadataValidator.isValid()){ pullData(callback); } else { onError(new ConversionException()); } } @Override public void onStep(PullStep step) { callback.onStep(step); } @Override public void onError(Throwable throwable) { manageError(throwable, callback); } @Override public void onCancel() { callback.onCancel(); } }); }

Target:
private void pullMetadata(final Callback callback) { mPullMetadataController.pullMetadata(new PullMetadataController.Callback() { @Override public void onComplete() { if(pullCanceled){ callback.onCancel(); }else { if(mMetadataValidator.isValid()){ pullData(callback); } else { onError(new MetadataException()); } } } @Override public void onStep(PullStep step) { callback.onStep(step); } @Override public void onError(Throwable throwable) { manageError(throwable, callback); } }); }
Source:
public void latestFiles() throws Exception { File tempDir = Files.createTempDir(); long currentTime = System.currentTimeMillis(); for (int count = 0; count < 10; count++) { File gcLogFile = new File(tempDir, "gc5625.log" + count); Files.touch(gcLogFile); gcLogFile.setLastModified(currentTime - TimeUnit.DAYS.toMillis(5)); } for (int count = 0; count < 5; count++) { Files.touch(new File(tempDir, "gc3421.log" + count)); } GCLogs.VmArgumentFinder finder = mock(GCLogs.VmArgumentFinder.class); when(finder.findVmArgument(GCLogs.GCLOGS_JRE_SWITCH)).thenReturn(GCLogs.GCLOGS_JRE_SWITCH + new File(tempDir, "gc%p.log").getAbsolutePath()); when(finder.findVmArgument(GCLogs.GCLOGS_ROTATION_SWITCH)).thenReturn(GCLogs.GCLOGS_ROTATION_SWITCH); TestContainer container = new TestContainer(); new GCLogs(finder).addContents(container); assertEquals(5, container.getContents().size()); }

Target:
public void latestFiles() throws Exception { File tempDir = Files.createTempDir(); long currentTime = System.currentTimeMillis(); for (int count = 0; count < 10; count++) { File gcLogFile = new File(tempDir, "gc5625.log" + count); Files.touch(gcLogFile); gcLogFile.setLastModified(currentTime - TimeUnit.DAYS.toMillis(5)); } for (int count = 0; count < 5; count++) { Files.touch(new File(tempDir, "gc3421.log" + count)); } GCLogs.VmArgumentFinder finder = mock(GCLogs.VmArgumentFinder.class); when(finder.findVmArgument(GCLogs.GCLOGS_JRE_SWITCH)).thenReturn(GCLogs.GCLOGS_JRE_SWITCH + new File(tempDir, "gc%p.log").getAbsolutePath()); when(finder.findVmArgument(GCLogs.GCLOGS_ROTATION_SWITCH)).thenReturn(GCLogs.GCLOGS_ROTATION_SWITCH); TestContainer container = new TestContainer(); new GCLogs(finder).addContents(container); assertEquals(5, container.getContents().size()); Assertions.assertThat(container.getContents()) .extracting("file", File.class) .extractingResultOf("getName") .contains("gc3421.log0", "gc3421.log1", "gc3421.log2", "gc3421.log3", "gc3421.log4"); }
Source:
protected boolean buildAnalysisSegments(@NonNull ISegmentStore<@NonNull ISegment> segments, @NonNull IProgressMonitor monitor) throws TmfAnalysisException { final @Nullable ITmfTrace trace = getTrace(); if (trace == null) { analysisReady(false); return false; } waitForSegmentStoreCompletion(); segments.addAll(getSegments()); return true; }

Target:
protected boolean buildAnalysisSegments(@NonNull ISegmentStore<@NonNull ISegment> segments, @NonNull IProgressMonitor monitor) throws TmfAnalysisException { final @Nullable ITmfTrace trace = getTrace(); if (trace == null) { segmentStoreReady(false); return false; } waitForSegmentStoreCompletion(); segments.addAll(getSegments()); return true; }
Source:
private PinotExpression handleCast(CallExpression cast, Map<VariableReferenceExpression, Selection> context) { if (cast.getArguments().size() == 1) { RowExpression input = cast.getArguments().get(0); Type expectedType = cast.getType(); if (isImplicitCast(input.getType(), expectedType)) { return input.accept(this, context); } else { throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), "Non implicit casts not supported: " + cast); } } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("This type of CAST operator not supported. Received: %s", cast)); }

Target:
private PinotExpression handleCast( CallExpression cast, Map<VariableReferenceExpression, Selection> context) { if (cast.getArguments().size() == 1) { RowExpression input = cast.getArguments().get(0); Type expectedType = cast.getType(); if (isImplicitCast(input.getType(), expectedType)) { return input.accept(this, context); } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), "Non implicit casts not supported: " + cast); } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("This type of CAST operator not supported. Received: %s", cast)); }
Source:
void removeDrgElementsWithoutShape( final List<org.kie.dmn.model.api.DRGElement> drgElements, final List<DMNShape> dmnShapes) { if (dmnShapes.size() == 0) { return; } for (int i = drgElements.size() - 1; i >= 0; i--) { final org.kie.dmn.model.api.DRGElement element = drgElements.get(i); final Optional<DMNShape> shape = dmnShapes.stream() .filter(s -> s.getDmnElementRef().getLocalPart().equals(element.getId())) .findFirst(); if (!shape.isPresent()) { drgElements.remove(element); } } }

Target:
void removeDrgElementsWithoutShape( final List<org.kie.dmn.model.api.DRGElement> drgElements, final List<DMNShape> dmnShapes) { if (dmnShapes.size() == 0) { return; } drgElements.removeIf(element -> !dmnShapes.stream() .filter(s -> Objects.equals(s.getDmnElementRef().getLocalPart(), element.getId())) .findFirst() .isPresent() ); }
Source:
private void setUpMediaWikiBaseUri(final EditTextPreference pref) { pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { private static final String API_PHP_FILENAME = "api.php"; @Override public boolean onPreferenceChange(Preference preference, final Object newValue) { String apiUrl = (String) newValue; if (apiUrl.endsWith(API_PHP_FILENAME)) { apiUrl = apiUrl.replace(API_PHP_FILENAME, ""); } final ProgressDialog dialog = ProgressDialog.show( getActivity(), "", getActivity().getString(R.string.dialog_loading_siteinfo_wait), true ); Retrofit retrofitClient = RetrofitFactory.newInstance(apiUrl, new WikiSite(apiUrl)); Service request = retrofitClient.create(Service.class); Call<MwQueryResponse<SiteInfo>> call = request.requestSiteinfo(); call.enqueue(new retrofit2.Callback<MwQueryResponse<SiteInfo>>() { @Override public void onResponse(Call<MwQueryResponse<SiteInfo>> call, Response<MwQueryResponse<SiteInfo>> response) { if (response.isSuccessful()) { if (response.body().query().server() != null) { pref.setText(response.body().query().server()); } } else { showAlert(getActivity().getString( R.string.dialog_loading_siteinfo_failed, Integer.toString(response.code()) )); } dialog.hide(); } @Override public void onFailure(Call<MwQueryResponse<SiteInfo>> call, Throwable t) { showAlert(getActivity().getString( R.string.dialog_loading_siteinfo_failed, t.getMessage() )); dialog.hide(); } }); return true; } }); }

Target:
private void setUpMediaWikiBaseUri(final EditTextPreference pref) { pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, final Object newValue) { SiteInfoClient siteInfoClient = new SiteInfoClient((String) newValue, getActivity()); siteInfoClient.request(new SiteInfoClient.Callback() { public void onSuccess(SiteInfo info) { pref.setText(info.general().server()); } }); return true; } }); }
Source:
protected void createActivatorIfNotExist(Path context) { KieModule kieModule = kieModuleService.resolveModule(context); Package junitActivatorPackage = getOrCreateJunitActivatorPackage(kieModule); final org.uberfire.java.nio.file.Path activatorPath = getActivatorPath(junitActivatorPackage); boolean removeExistingActivator = ensureDependencies(kieModule); if (removeExistingActivator || !ioService.exists(activatorPath)) { removeOldActivatorIfExists(activatorPath, kieModule); ioService.write(activatorPath, ScenarioJunitActivator.ACTIVATOR_CLASS_CODE.apply(junitActivatorPackageName), commentedOptionFactory.makeCommentedOption("")); } }

Target:
protected void createActivatorIfNotExist(Path context) { KieModule kieModule = kieModuleService.resolveModule(context); Package junitActivatorPackage = getOrCreateJunitActivatorPackage(kieModule); final org.uberfire.java.nio.file.Path activatorPath = getActivatorPath(junitActivatorPackage); boolean needMigrateActivatorIfExists = ensureDependencies(kieModule); if (needMigrateActivatorIfExists || !ioService.exists(activatorPath)) { removeOldActivatorIfExists(activatorPath, kieModule); ioService.write(activatorPath, ScenarioJunitActivator.ACTIVATOR_CLASS_CODE.apply(junitActivatorPackageName), commentedOptionFactory.makeCommentedOption("")); } }
Source:
private PinotExpression handleLogicalBinary( String operator, CallExpression call, Function<VariableReferenceExpression, Selection> context) { if (!LOGICAL_BINARY_OPS_FILTER.contains(operator)) { throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("'%s' is not supported in filter", operator)); } List<RowExpression> arguments = call.getArguments(); if (arguments.size() == 2) { String def0 = arguments.get(0).accept(this, context).getDefinition(); String def1 = arguments.get(1).accept(this, context).getDefinition(); def1 = handleTimeStampAndDateCast(arguments.get(0), def1); def0 = handleTimeStampAndDateCast(arguments.get(1), def0); return derived(format("(%s %s %s)", def0, operator, def1)); } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("Unknown logical binary: '%s'", call)); }

Target:
private PinotExpression handleLogicalBinary( String operator, CallExpression call, Function<VariableReferenceExpression, Selection> context) { if (!LOGICAL_BINARY_OPS_FILTER.contains(operator)) { throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("'%s' is not supported in filter", operator)); } List<RowExpression> arguments = call.getArguments(); if (arguments.size() == 2) { return handleDateOrTimestampBinaryExpression(operator, arguments, context).orElseGet( () -> derived(format( "(%s %s %s)", arguments.get(0).accept(this, context).getDefinition(), operator, arguments.get(1).accept(this, context).getDefinition()))); } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("Unknown logical binary: '%s'", call)); }
Source:
public int execute() throws HiveException { DataOutputStream outStream = getOutputStream(ddlDesc.getResFile()); try { Database database = db.getDatabase(ddlDesc.getDatabaseName()); if (database == null) { throw new HiveException(ErrorMsg.DATABASE_NOT_EXISTS, ddlDesc.getDatabaseName()); } Map<String, String> params = null; if (ddlDesc.isExt()) { params = database.getParameters(); } if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_IN_TEST) && params != null) { params = new TreeMap<String, String>(params); } String location = database.getLocationUri(); if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_IN_TEST)) { location = "location/in/test"; } PrincipalType ownerType = database.getOwnerType(); formatter.showDatabaseDescription(outStream, database.getName(), database.getDescription(), location, database.getOwnerName(), (null == ownerType) ? null : ownerType.name(), params); } catch (Exception e) { throw new HiveException(e, ErrorMsg.GENERIC_ERROR); } finally { IOUtils.closeStream(outStream); } return 0; }

Target:
public int execute() throws HiveException { try (DataOutputStream outStream = getOutputStream(new Path(desc.getResFile()))) { Database database = context.getDb().getDatabase(desc.getDatabaseName()); if (database == null) { throw new HiveException(ErrorMsg.DATABASE_NOT_EXISTS, desc.getDatabaseName()); } Map<String, String> params = null; if (desc.isExt()) { params = database.getParameters(); } if (HiveConf.getBoolVar(context.getConf(), HiveConf.ConfVars.HIVE_IN_TEST) && params != null) { params = new TreeMap<String, String>(params); } String location = database.getLocationUri(); if (HiveConf.getBoolVar(context.getConf(), HiveConf.ConfVars.HIVE_IN_TEST)) { location = "location/in/test"; } PrincipalType ownerType = database.getOwnerType(); context.getFormatter().showDatabaseDescription(outStream, database.getName(), database.getDescription(), location, database.getOwnerName(), (null == ownerType) ? null : ownerType.name(), params); } catch (Exception e) { throw new HiveException(e, ErrorMsg.GENERIC_ERROR); } return 0; }
Source:
public MockVaadinServletService( DeploymentConfiguration deploymentConfiguration) { super(new MockVaadinServlet(deploymentConfiguration), deploymentConfiguration); }

Target:
public MockVaadinServletService( DeploymentConfiguration deploymentConfiguration) { super(new MockVaadinServlet(deploymentConfiguration), deploymentConfiguration); init(); }
Source:
public BiomeGenerationSettings getBiomeSettings(BiomeType type) { checkNotNull(type); BiomeGenerationSettings settings = this.biomeSettings.get(type); if (settings == null) { if (type instanceof VirtualBiomeType) { settings = ((VirtualBiomeType) type).getDefaultGenerationSettings().copy(); this.biomeSettings.put(type, settings); } else { settings = ((IMixinBiome) type).initPopulators(this.world); this.biomeSettings.put(type, settings); } } return settings; }

Target:
public BiomeGenerationSettings getBiomeSettings(BiomeType type) { checkNotNull(type, "type"); BiomeGenerationSettings settings = this.biomeSettings.get(type); if (settings == null) { settings = type.createDefaultGenerationSettings((org.spongepowered.api.world.World) this.world); this.biomeSettings.put(type, settings); } return settings; }
Source:
public void testGetTrackingKey() throws Exception { String trackedEventPrefixKey = "AMPLIFY_"; String iEventKey = "MOCK_EVENT"; String iEventCheckKey = "MOCK_EVENT_CHECK"; IEvent iEvent = Mockito.mock(IEvent.class); Mockito.when(iEvent.getTrackingKey()).thenReturn(iEventKey); IEventCheck iEventCheck = Mockito.mock(IEventCheck.class); Mockito.when(iEventCheck.getTrackingKey()).thenReturn(iEventCheckKey); TrackedEvent trackedEvent = new TrackedEvent(iEvent, iEventCheck); Assert.assertEquals(trackedEventPrefixKey + iEventKey + "_" + iEventCheckKey, trackedEvent.getTrackingKey()); }

Target:
public void testGetTrackingKey() throws Exception { String trackedEventPrefixKey = "AMPLIFY_"; String iEventKey = "MOCK_EVENT"; String iEventCheckKey = "MOCK_EVENT_CHECK"; IEvent iEvent = mock(IEvent.class); when(iEvent.getTrackingKey()).thenReturn(iEventKey); IEventCheck iEventCheck = mock(IEventCheck.class); when(iEventCheck.getTrackingKey()).thenReturn(iEventCheckKey); TrackedEvent trackedEvent = new TrackedEvent(iEvent, iEventCheck); assertEquals("The tracking key for a TrackedEvent is incorrect", trackedEventPrefixKey + iEventKey + "_" + iEventCheckKey, trackedEvent.getTrackingKey()); }
Source:
public void forEach(Consumer<? super Entry<K, V>> action) { if (associatedMap.elementCount > 0) { int prevModCount = associatedMap.modCount; for (int i = 0; i < associatedMap.elementData.length; i++) { HashEntry<K, V> entry = associatedMap.elementData[i]; while (entry != null) { action.accept(entry); entry = entry.next; } } if (prevModCount != associatedMap.modCount) { throw new TConcurrentModificationException(); } } }

Target:
public void forEach(Consumer<? super Entry<K, V>> action) { if (associatedMap.elementCount > 0) { int prevModCount = associatedMap.modCount; for (int i = 0; i < associatedMap.elementData.length; i++) { HashEntry<K, V> entry = associatedMap.elementData[i]; while (entry != null) { action.accept(entry); entry = entry.next; if (prevModCount != associatedMap.modCount) { throw new TConcurrentModificationException(); } } } } }