auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void free(File fileToReturn, long sizeInBytes, String storeId, boolean isSwapSegment) throws IOException { long startTime = System.currentTimeMillis(); try { if (enablePooling && poolState != PoolState.INITIALIZED) { logger.info("Freeing segment of size from before pool is fully initialized", sizeInBytes, fileToReturn.getAbsolutePath()); metrics.diskSpaceAllocatorFreeBeforeInitCount.inc(); } else { logger.info("Freeing segment of size from {}", isSwapSegment ? "swap" : "store[" + storeId + "]", sizeInBytes, fileToReturn.getAbsolutePath()); } Files.delete(fileToReturn.toPath()); if (poolState == PoolState.INITIALIZED) { if (isSwapSegment) { fileToReturn = createReserveFile(sizeInBytes, swapReserveDir); swapReserveFiles.add(sizeInBytes, fileToReturn); } else { File storeReserveDir = new File(reserveDir, STORE_DIR_PREFIX + storeId); fileToReturn = createReserveFile(sizeInBytes, storeReserveDir); ReserveFileMap sizeToFilesMap = storeReserveFiles.getOrDefault(storeId, new ReserveFileMap()); sizeToFilesMap.add(sizeInBytes, fileToReturn); storeReserveFiles.put(storeId, sizeToFilesMap); } } } finally { long elapsedTime = System.currentTimeMillis() - startTime; <START> logger.debug("free took ms for {}", elapsedTime, "store[" + storeId + "]"); <END> metrics.diskSpaceAllocatorFreeTimeMs.update(elapsedTime); } }</code><technical_language>avoid cost of string concat debug logging is off: logger.debug("free ms for store[{}]", elapsedTime, storeId);</technical_language>

Target:
void free(File fileToReturn, long sizeInBytes, String storeId, boolean isSwapSegment) throws IOException { long startTime = System.currentTimeMillis(); try { if (enablePooling && poolState != PoolState.INITIALIZED) { logger.info("Freeing segment of size from before pool is fully initialized", sizeInBytes, fileToReturn.getAbsolutePath()); metrics.diskSpaceAllocatorFreeBeforeInitCount.inc(); } else { logger.info("Freeing segment of size from {}", isSwapSegment ? "swap" : "store[" + storeId + "]", sizeInBytes, fileToReturn.getAbsolutePath()); } Files.delete(fileToReturn.toPath()); if (poolState == PoolState.INITIALIZED) { if (isSwapSegment) { fileToReturn = createReserveFile(sizeInBytes, swapReserveDir); swapReserveFiles.add(sizeInBytes, fileToReturn); } else { File storeReserveDir = new File(reserveDir, STORE_DIR_PREFIX + storeId); fileToReturn = createReserveFile(sizeInBytes, storeReserveDir); ReserveFileMap sizeToFilesMap = storeReserveFiles.getOrDefault(storeId, new ReserveFileMap()); sizeToFilesMap.add(sizeInBytes, fileToReturn); storeReserveFiles.put(storeId, sizeToFilesMap); } } } finally { long elapsedTime = System.currentTimeMillis() - startTime; logger.debug("free took ms for store[{}]", elapsedTime, storeId); metrics.diskSpaceAllocatorFreeTimeMs.update(elapsedTime); } }
Source:
<code>public boolean areResponseDeletionsRequiredForChanges(FeedbackQuestionAttributes newAttributes) { if (!newAttributes.giverType.equals(this.giverType) || !newAttributes.recipientType.equals(this.recipientType)) { return true; } if (newAttributes.giverType.isCustom()) { for (FeedbackPathAttributes feedbackPath : feedbackPaths) { <START> if (!newAttributes.containsFeedbackPath(feedbackPath.getGiver(), feedbackPath.getRecipient())) { <END> return true; } } } if (!this.showResponsesTo.containsAll(newAttributes.showResponsesTo) || !this.showGiverNameTo.containsAll(newAttributes.showGiverNameTo) || !this.showRecipientNameTo.containsAll(newAttributes.showRecipientNameTo)) { return true; } return this.getQuestionDetails().isChangesRequiresResponseDeletion(newAttributes.getQuestionDetails()); }</code><technical_language>slightly slow in worst case (when feedback paths of newAttributes is a superset of in feedbackPaths ie. adding new feedback paths existing set of paths), a problem in general, theoretically visibly slower approx >10,000 feedback paths</technical_language>

Target:
public boolean areResponseDeletionsRequiredForChanges(FeedbackQuestionAttributes newAttributes) { if (!newAttributes.giverType.equals(this.giverType) || !newAttributes.recipientType.equals(this.recipientType)) { return true; } if (newAttributes.giverType.isCustom()) { Set<FeedbackPathAttributes> newCustomFeedbackPaths = new HashSet<FeedbackPathAttributes>(newAttributes.feedbackPaths); for (FeedbackPathAttributes feedbackPath : feedbackPaths) { if (!newCustomFeedbackPaths.contains(feedbackPath)) { return true; } } } if (!this.showResponsesTo.containsAll(newAttributes.showResponsesTo) || !this.showGiverNameTo.containsAll(newAttributes.showGiverNameTo) || !this.showRecipientNameTo.containsAll(newAttributes.showRecipientNameTo)) { return true; } return this.getQuestionDetails().isChangesRequiresResponseDeletion(newAttributes.getQuestionDetails()); }
Source:
<code>public static void main(String[] args) throws IOException { DataMigrationForSanitizedDataInAdminEmailAttributes migrator = new DataMigrationForSanitizedDataInAdminEmailAttributes(); <START> migrator.doOperationRemotely(); <END> }</code><technical_language>I if new DataMigrationForSanitizedDataInAdminEmailAttributes().doOperationRemotely() is enough</technical_language>

Target:
public static void main(String[] args) throws IOException { new DataMigrationForSanitizedDataInAdminEmailAttributes().doOperationRemotely(); }
Source:
<code>public DlmsConnection connect(final DlmsDevice device, final DlmsMessageListener dlmsMessageListener) throws TechnicalException, FunctionalException { this.checkDevice(device); this.checkIpAddress(device); TcpConnectionBuilder tcpConnectionBuilder; try { tcpConnectionBuilder = new TcpConnectionBuilder(InetAddress.getByName(device.getIpAddress())) .setResponseTimeout(this.responseTimeout).setLogicalDeviceId(this.logicalDeviceAddress) .setClientId(this.clientAccessPoint) .setReferencingMethod(device.isUseSn() ? ReferencingMethod.SHORT : ReferencingMethod.LOGICAL); if (device.isUseHdlc()) { tcpConnectionBuilder.useHdlc(); } } catch (final UnknownHostException e) { throw new ConnectionException(e); } this.setOptionalValues(device, tcpConnectionBuilder); if (device.isInDebugMode()) { tcpConnectionBuilder.setRawMessageListener(dlmsMessageListener); } try { return tcpConnectionBuilder.build(); } catch (final IOException e) { final String errorMessage = String.format("Communication timeout for device %s", device.getDeviceIdentification()); LOGGER.error(errorMessage); <START> throw new FunctionalException(FunctionalExceptionType.COMMUNICATION_TIMEOUT, ComponentType.PROTOCOL_DLMS, e); <END> } }</code><technical_language>IOException, for instance a timeout mentioned in error message (by way, for IOException caused else a timeout, in case message misleading), is handled a retry, I expect ConnectionException thrown in code. Is reason IOExceptions handled differently in Lls0Connector in Hls5Connector? differences connectors, I spotted Lls0Connector throws a retryable ConnectionException in case of UnknownHostException. sense, is TechnicalException thrown in Hls5Connector, more appropriate</technical_language>

Target:
public DlmsConnection connect(final DlmsDevice device, final DlmsMessageListener dlmsMessageListener) throws TechnicalException, FunctionalException { this.checkDevice(device); this.checkIpAddress(device); TcpConnectionBuilder tcpConnectionBuilder; try { tcpConnectionBuilder = new TcpConnectionBuilder(InetAddress.getByName(device.getIpAddress())) .setResponseTimeout(this.responseTimeout).setLogicalDeviceId(this.logicalDeviceAddress) .setClientId(this.clientAccessPoint) .setReferencingMethod(device.isUseSn() ? ReferencingMethod.SHORT : ReferencingMethod.LOGICAL); if (device.isUseHdlc()) { tcpConnectionBuilder.useHdlc(); } } catch (final UnknownHostException e) { LOGGER.error("The IP address is not found: {}", device.getIpAddress(), e); throw new TechnicalException(ComponentType.PROTOCOL_DLMS, "The IP address is not found: " + device.getIpAddress()); } this.setOptionalValues(device, tcpConnectionBuilder); if (device.isInDebugMode()) { tcpConnectionBuilder.setRawMessageListener(dlmsMessageListener); } try { return tcpConnectionBuilder.build(); } catch (final IOException e) { final String msg = String.format("Error creating connection for device %s with Ip address:%s Port:%d UseHdlc:%b UseSn:%b Message:%s", device.getDeviceIdentification(), device.getIpAddress(), device.getPort(), device.isUseHdlc(), device.isUseSn(), e.getMessage()); LOGGER.error(msg); throw new ConnectionException(msg, e); } }
Source:
<code>private void newEntity() { if (getWindow() != null) { return; } VmInterfaceModel model = NewVmInterfaceModel.createInstance( getEntity().getStaticData(), getEntity().getStatus(), getEntity().getStoragePoolId(), <START> getEntity().getCompatibilityVersion(), <END> (ArrayList<VmNetworkInterface>) getItems(), this); setWindow(model); }</code><technical_language>network related compatibility version stuff need cluster's version</technical_language>

Target:
private void newEntity() { if (getWindow() != null) { return; } VmInterfaceModel model = NewVmInterfaceModel.createInstance(getEntity().getStaticData(), getEntity().getStatus(), getEntity().getStoragePoolId(), getEntity().getClusterCompatibilityVersion(), (ArrayList<VmNetworkInterface>) getItems(), this); setWindow(model); }
Source:
<code>public void encode(ChannelHandlerContext ctx, Frame frame, List<Object> results) throws IOException { ByteBuf header = CBUtil.allocator.buffer(Header.LENGTH); Message.Type type = frame.header.type; header.writeByte(type.direction.addToVersion(frame.header.version.asInt())); header.writeByte(Header.Flag.serialize(frame.header.flags)); if (frame.header.version.isGreaterOrEqualTo(ProtocolVersion.V3)) header.writeShort(frame.header.streamId); else header.writeByte(frame.header.streamId); header.writeByte(type.opcode); header.writeInt(frame.body.readableBytes()); results.add(header); results.add(frame.body); <START> int messageSize = header.writerIndex() + frame.body.writerIndex(); <END> ClientRequestSizeMetrics.totalBytesWritten.inc(messageSize); ClientRequestSizeMetrics.bytesTransmittedPerFrame.update(messageSize); }</code><technical_language>io.netty.buffer.ByteBuf#readableBytes. a allocator a promise readerIndex is 0, get a ByteBuf pointing a fragment in memory readerIndex is 102471081; readableBytes is safer</technical_language>

Target:
public void encode(ChannelHandlerContext ctx, Frame frame, List<Object> results) throws IOException { ByteBuf header = CBUtil.allocator.buffer(Header.LENGTH); Message.Type type = frame.header.type; header.writeByte(type.direction.addToVersion(frame.header.version.asInt())); header.writeByte(Header.Flag.serialize(frame.header.flags)); if (frame.header.version.isGreaterOrEqualTo(ProtocolVersion.V3)) header.writeShort(frame.header.streamId); else header.writeByte(frame.header.streamId); header.writeByte(type.opcode); header.writeInt(frame.body.readableBytes()); int messageSize = header.readableBytes() + frame.body.readableBytes(); ClientRequestSizeMetrics.totalBytesWritten.inc(messageSize); ClientRequestSizeMetrics.bytesTransmittedPerFrame.update(messageSize); results.add(header); results.add(frame.body); }
Source:
<code>public void onNext(final ContextStop contextStop) { <START> LOG.log(Level.FINE, "Wait {0} milliseconds at maximum for the PS worker to be closed", CLOSE_TIMEOUT_MS); <END> try { parameterWorker.close(CLOSE_TIMEOUT_MS); LOG.fine("Succeed to close PS worker cleanly"); } catch (InterruptedException | TimeoutException | ExecutionException e) { LOG.log(Level.INFO, "Fail to close PS worker cleanly", e); } psNetworkSetup.unregisterConnectionFactory(); }</code><technical_language>{0} milliseconds maximum -> {0} milliseconds</technical_language>

Target:
public void onNext(final ContextStop contextStop) { LOG.log(Level.FINE, "Wait at most {0} milliseconds for the PS worker to be closed", CLOSE_TIMEOUT_MS); try { parameterWorker.close(CLOSE_TIMEOUT_MS); LOG.fine("Succeed to close PS worker cleanly"); } catch (InterruptedException | TimeoutException | ExecutionException e) { LOG.log(Level.INFO, "Fail to close PS worker cleanly", e); } psNetworkSetup.unregisterConnectionFactory(); }
Source:
<code>private Runnable insertNewDraft(final CodeMirror cm) { if (!Gerrit.isSignedIn()) { return new Runnable() { @Override public void run() { Gerrit.doSignIn(getToken()); } }; } return new Runnable() { public void run() { LineHandle handle = cm.getActiveLine(); int line = cm.getLineNumber(handle); CommentBox box = lineActiveBoxMap.get(handle); if (box == null) { lineActiveBoxMap.put(handle, addDraftBox(CommentInfo.createRange( path, getSideFromCm(cm), line + 1, null, null, <START> cm.somethingSelected() ? CommentRange.fromFromTo(cm.getSelectedRange()) : null))); <END> } else if (box instanceof DraftBox) { ((DraftBox) box).setEdit(true); } else { ((PublishedBox) box).doReply(); } } }; }</code><technical_language>This line is long. Line break ? : indent more level</technical_language>

Target:
private Runnable insertNewDraft(final CodeMirror cm) { if (!Gerrit.isSignedIn()) { return new Runnable() { @Override public void run() { Gerrit.doSignIn(getToken()); } }; } return new Runnable() { public void run() { LineHandle handle = cm.getActiveLine(); int line = cm.getLineNumber(handle); CommentBox box = lineActiveBoxMap.get(handle); if (box == null) { lineActiveBoxMap.put(handle, addDraftBox(CommentInfo.createRange( path, getSideFromCm(cm), line + 1, null, null, cm.somethingSelected() ? CommentRange.create(cm.getSelectedRange()) : null))); } else if (box instanceof DraftBox) { ((DraftBox) box).setEdit(true); } else { ((PublishedBox) box).doReply(); } } }; }
Source:
<code>private void updateIfChanged(String instance, String property, State newState) { DenonBindingProvider firstProvider = getFirstMatchingProvider(instance, property); if (firstProvider != null) { DenonBindingConfig config = firstProvider.getConfig(instance, property); ItemRegistry registry = firstProvider.getItemRegistry(); try { State oldState = registry.getItem(config.getItemName()).getState(); <START> if (!oldState.equals(newState)) <END> eventPublisher.postUpdate(config.getItemName(), newState); } catch (ItemNotFoundException e) { e.printStackTrace(); } } }</code><technical_language>add curly braces for readability this is a Oneliner</technical_language>

Target:
private void updateIfChanged(String instance, String property, State newState) { DenonBindingProvider firstProvider = getFirstMatchingProvider(instance, property); if (firstProvider != null) { DenonBindingConfig config = firstProvider.getConfig(instance, property); try { State oldState = itemRegistry.getItem(config.getItemName()).getState(); if (!oldState.equals(newState)) { eventPublisher.postUpdate(config.getItemName(), newState); } } catch (ItemNotFoundException e) { logger.debug("Cannot find item " + config.getItemName() + " in the registry", e); } } }
Source:
<code>public HelixAccountServiceTest(boolean useNewZNodePath) throws Exception { this.useNewZNodePath = useNewZNodePath; helixConfigProps.setProperty( HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "zk.client.connection.timeout.ms", String.valueOf(ZK_CLIENT_CONNECTION_TIMEOUT_MS)); helixConfigProps.setProperty(HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "zk.client.session.timeout.ms", String.valueOf(ZK_CLIENT_SESSION_TIMEOUT_MS)); helixConfigProps.setProperty(HelixAccountServiceConfig.ZK_CLIENT_CONNECT_STRING_KEY, ZK_CONNECT_STRING); helixConfigProps.setProperty(HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "root.path", STORE_ROOT_PATH); accountBackupDir = Paths.get(TestUtils.getTempDir("account-backup")).toAbsolutePath(); helixConfigProps.setProperty(HelixAccountServiceConfig.BACKUP_DIRECTORY_KEY, accountBackupDir.toString()); helixConfigProps.setProperty(HelixAccountServiceConfig.USE_NEW_ZNODE_PATH, String.valueOf(useNewZNodePath)); vHelixConfigProps = new VerifiableProperties(helixConfigProps); storeConfig = new HelixPropertyStoreConfig(vHelixConfigProps); notifier = new MockNotifier<>(); mockHelixAccountServiceFactory = <START> new MockHelixAccountServiceFactory(vHelixConfigProps, new MetricRegistry(), notifier, null); <END> mockRouter = new MockRouter(); deleteStoreIfExists(); generateReferenceAccountsAndContainers(); }</code><technical_language>pass useNewZNodePath mockRouter factory constructor. tests need if/setupRouter code, factory do that</technical_language>

Target:
public HelixAccountServiceTest(boolean useNewZNodePath) throws Exception { this.useNewZNodePath = useNewZNodePath; helixConfigProps.setProperty( HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "zk.client.connection.timeout.ms", String.valueOf(ZK_CLIENT_CONNECTION_TIMEOUT_MS)); helixConfigProps.setProperty(HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "zk.client.session.timeout.ms", String.valueOf(ZK_CLIENT_SESSION_TIMEOUT_MS)); helixConfigProps.setProperty(HelixAccountServiceConfig.ZK_CLIENT_CONNECT_STRING_KEY, ZK_CONNECT_STRING); helixConfigProps.setProperty(HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "root.path", STORE_ROOT_PATH); accountBackupDir = Paths.get(TestUtils.getTempDir("account-backup")).toAbsolutePath(); helixConfigProps.setProperty(HelixAccountServiceConfig.BACKUP_DIRECTORY_KEY, accountBackupDir.toString()); helixConfigProps.setProperty(HelixAccountServiceConfig.USE_NEW_ZNODE_PATH, String.valueOf(useNewZNodePath)); vHelixConfigProps = new VerifiableProperties(helixConfigProps); storeConfig = new HelixPropertyStoreConfig(vHelixConfigProps); notifier = new MockNotifier<>(); mockRouter = new MockRouter(); mockHelixAccountServiceFactory = new MockHelixAccountServiceFactory(vHelixConfigProps, new MetricRegistry(), notifier, null, mockRouter); deleteStoreIfExists(); generateReferenceAccountsAndContainers(); }
Source:
<code>public void tearDown(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { if (build.getResult() == null) { SonarUtils.addBuildInfoTo(build, installation.getName(), true); } else { SonarUtils.addBuildInfoTo(build, installation.getName(), false); <START> } <END> }</code><technical_language>putting condition in 3rd param avoid duplication</technical_language>

Target:
public void tearDown(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { SonarUtils.addBuildInfoTo(build, installation.getName(), build.getResult() == null); }
Source:
<code><START> private void checkDomElementMatches(Source source) { Document doc = Jsoup.parse(String.valueOf(source)); <END> for (Map<String, Map<String, Map<String, AppPattern>>> map : currentApp.getDom()) { for (Map.Entry<String, Map<String, Map<String, AppPattern>>> ap : map.entrySet()) { for (Map.Entry<String, Map<String, AppPattern>> p : ap.getValue().entrySet()) { for (Map.Entry<String, AppPattern> pa : p.getValue().entrySet()) { Elements links = doc.select(ap.getKey()); for (org.jsoup.nodes.Element link : links) { if (Objects.equals(pa.getKey(), "text")) { AppPattern Ap = pa.getValue(); addIfMatches(Ap, link.text()); } if (Objects.equals(p.getKey(), "attributes")) { AppPattern Ap = pa.getValue(); if (link.hasAttr(String.valueOf(pa.getKey()))) { addIfMatches(Ap, link.attr(pa.getKey())); } } if (Objects.equals(p.getKey(), "properties")) { AppPattern Ap = pa.getValue(); if (link.hasAttr(String.valueOf(pa.getKey()))) { addIfMatches(Ap, link.attr(pa.getKey())); } } } } } } } }</code><technical_language>pass in HttpMessage msg, msg.getResponseBody().toString()</technical_language>

Target:
private void checkDomElementMatches(Source source) { Document doc = Jsoup.parse(String.valueOf(source)); for (Map<String, Map<String, Map<String, AppPattern>>> domSelectorMap : currentApp.getDom()) { for (Map.Entry<String, Map<String, Map<String, AppPattern>>> selectorMap : domSelectorMap.entrySet()) { for (Map.Entry<String, Map<String, AppPattern>> nodeSelectorMap : selectorMap.getValue().entrySet()) { for (Map.Entry<String, AppPattern> value : nodeSelectorMap.getValue().entrySet()) { Elements selectedElements = doc.select(selectorMap.getKey()); for (org.jsoup.nodes.Element selectedElement : selectedElements) { if (Objects.equals(value.getKey(), "text")) { AppPattern ap = value.getValue(); addIfMatches(ap, selectedElement.text()); } if (Objects.equals(nodeSelectorMap.getKey(), "attributes") || Objects.equals(nodeSelectorMap.getKey(), "properties")) { AppPattern ap = value.getValue(); if (selectedElement.hasAttr(value.getKey())) { addIfMatches(ap, selectedElement.attr(value.getKey())); } } } } } } } }
Source:
<code>protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId())); <START> setSucceeded(true); <END> if (images != null && !images.isEmpty()) { List<DiskImage> imageToRemove = new ArrayList<>(); for (DiskImage image : images) { if (image.getStorageIds().get(0).equals(getParameters().getStorageDomainId())) { image.setStorageIds(Collections.singletonList(getParameters().getStorageDomainId())); image.setStoragePoolId(getParameters().getStoragePoolId()); imageToRemove.add(image); } } RemoveAllVmImagesParameters removeAllVmImagesParameters = new RemoveAllVmImagesParameters(getVmId(), imageToRemove); removeAllVmImagesParameters.setParentCommand(getActionType()); removeAllVmImagesParameters.setEntityInfo(getParameters().getEntityInfo()); removeAllVmImagesParameters.setForceDelete(true); removeAllVmImagesParameters.setParentParameters(getParameters()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.RemoveAllVmImages, removeAllVmImagesParameters); if (vdcRetValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList()); } else { getReturnValue().setFault(vdcRetValue.getFault()); setSucceeded(false); } } vmAndTemplatesGenerationsDao.deleteOvfGenerations(Collections.singletonList(ovfEntityData.getEntityId())); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); }</code><technical_language>this later</technical_language>

Target:
protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VmTemplate, getVmTemplateId())); setSucceeded(true); if (images != null && !images.isEmpty()) { List<DiskImage> imageToRemove = new ArrayList<>(); for (DiskImage image : images) { if (image.getStorageIds().get(0).equals(getParameters().getStorageDomainId())) { image.setStorageIds(Collections.singletonList(getParameters().getStorageDomainId())); image.setStoragePoolId(getParameters().getStoragePoolId()); imageToRemove.add(image); } } RemoveAllVmImagesParameters removeAllVmImagesParameters = new RemoveAllVmImagesParameters(getVmTemplateId(), imageToRemove); removeAllVmImagesParameters.setParentCommand(getActionType()); removeAllVmImagesParameters.setEntityInfo(getParameters().getEntityInfo()); removeAllVmImagesParameters.setForceDelete(true); removeAllVmImagesParameters.setParentParameters(getParameters()); ActionReturnValue vdcRetValue = runInternalActionWithTasksContext(ActionType.RemoveAllVmImages, removeAllVmImagesParameters); if (vdcRetValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList()); } else { getReturnValue().setFault(vdcRetValue.getFault()); setSucceeded(false); } } vmAndTemplatesGenerationsDao.deleteOvfGenerations(Collections.singletonList(ovfEntityData.getEntityId())); unregisteredOVFDataDao.removeEntity(ovfEntityData.getEntityId(), null); unregisteredDisksDao.removeUnregisteredDiskRelatedToVM(ovfEntityData.getEntityId(), null); }
Source:
<code>private void deleteButtonAction(ActionEvent a) { try { FileUtils.deleteRecursively(new File(getDBPath())); items.remove(getDBPath()); } catch (Exception e) { <START> e.printStackTrace(); <END> } }</code><technical_language>user notified database deleted means of ExceptionDialog</technical_language>

Target:
private void deleteButtonAction(ActionEvent a) { try { FileUtils.deleteRecursively(new File(getDBPath())); items.remove(getDBPath()); } catch (Exception e) { new ExceptionDialog(list.getParent(), e, "Failed to delete database."); } }
Source:
<code>private QuorumServer(long id, InetSocketAddress addr, InetSocketAddress electionAddr) { this.id = id; this.addr = addr; this.electionAddr = electionAddr; String checkIPReachableValue = System.getProperty("zookeeper.checkIPTimeout"); <START> if(checkIPReachableValue != null){ <END> this.checkIPReachableTO = Integer.parseInt(checkIPReachableValue); } }</code><technical_language>nit: space if (</technical_language>

Target:
private QuorumServer(long id, InetSocketAddress addr, InetSocketAddress electionAddr) { this.id = id; this.addr = addr; this.electionAddr = electionAddr; }
Source:
<code>public DataSchema( @JsonProperty("dataSource") String dataSource, @JsonProperty("parser") Map<String, Object> parser, @JsonProperty("metricsSpec") AggregatorFactory[] aggregators, @JsonProperty("granularitySpec") GranularitySpec granularitySpec, @JsonProperty("transformSpec") TransformSpec transformSpec, @JacksonInject ObjectMapper jsonMapper ) { this.jsonMapper = Preconditions.checkNotNull(jsonMapper, "null ObjectMapper."); this.parser = parser; this.transformSpec = transformSpec == null ? TransformSpec.NONE : transformSpec; <START> Preconditions.checkArgument(dataSource != null && !dataSource.isEmpty(), "dataSource cannot be null or empty. Please provide a dataSource."); <END> this.dataSource = dataSource; if (granularitySpec == null) { log.warn("No granularitySpec has been specified. Using UniformGranularitySpec as default."); this.granularitySpec = new UniformGranularitySpec(null, null, null); } else { this.granularitySpec = granularitySpec; } if (aggregators != null && aggregators.length != 0) { Set<String> names = new HashSet<>(); for (AggregatorFactory factory : aggregators) { if (!names.add(factory.getName())) { throw new IAE("duplicate aggregators found with name [%s].", factory.getName()); } } } else if (this.granularitySpec.isRollup()) { log.warn("No metricsSpec has been specified. Are you sure this is what you want?"); } this.aggregators = aggregators == null ? new AggregatorFactory[]{} : aggregators; }</code><technical_language>Strings.isNullOrEmpty(str)</technical_language>

Target:
public DataSchema( @JsonProperty("dataSource") String dataSource, @JsonProperty("parser") Map<String, Object> parser, @JsonProperty("metricsSpec") AggregatorFactory[] aggregators, @JsonProperty("granularitySpec") GranularitySpec granularitySpec, @JsonProperty("transformSpec") TransformSpec transformSpec, @JacksonInject ObjectMapper jsonMapper ) { this.jsonMapper = Preconditions.checkNotNull(jsonMapper, "null ObjectMapper."); this.parser = parser; this.transformSpec = transformSpec == null ? TransformSpec.NONE : transformSpec; Preconditions.checkArgument(!Strings.isNullOrEmpty(dataSource), "dataSource cannot be null or empty. Please provide a dataSource."); this.dataSource = dataSource; if (granularitySpec == null) { log.warn("No granularitySpec has been specified. Using UniformGranularitySpec as default."); this.granularitySpec = new UniformGranularitySpec(null, null, null); } else { this.granularitySpec = granularitySpec; } if (aggregators != null && aggregators.length != 0) { Set<String> names = new HashSet<>(); for (AggregatorFactory factory : aggregators) { if (!names.add(factory.getName())) { throw new IAE("duplicate aggregators found with name [%s].", factory.getName()); } } } else if (this.granularitySpec.isRollup()) { log.warn("No metricsSpec has been specified. Are you sure this is what you want?"); } this.aggregators = aggregators == null ? new AggregatorFactory[]{} : aggregators; }
Source:
<code>public void groupMessage(final GroupDescription groupDescription) { try { <START> groupDescription.getMessage().toString(); <END> final Message m = Message.obtain(); m.what = ENQUEUE_GROUP; m.obj = groupDescription; mWorker.runMessage(m); } catch (AssertionError e) { MPLog.e(LOGTAG, "Could not record group update (see <LINK_0>", e); } }</code><technical_language>same, check in MixpanelMessageDescription constructor handle it</technical_language>

Target:
public void groupMessage(final GroupDescription groupDescription) { final Message m = Message.obtain(); m.what = ENQUEUE_GROUP; m.obj = groupDescription; mWorker.runMessage(m); }
Source:
<code>protected void postLoad(DAnalysis dAnalysis, Version loadedVersion) { if (loadedVersion.compareTo(MIGRATION_VERSION) < 0) { StringBuilder sb = new StringBuilder(Messages.DeleteMultipleConnectorMigrationParticipant_title); EList<DView> ownedViews = dAnalysis.getOwnedViews(); for (DView view : ownedViews) { List<DRepresentationDescriptor> loadedRepresentationsDescriptors = new DViewQuery(view).getLoadedRepresentationsDescriptors(); for (DRepresentationDescriptor descriptor : loadedRepresentationsDescriptors) { DRepresentation rep = descriptor.getRepresentation(); if (rep instanceof DSemanticDiagram) { DSemanticDiagram dDiagram = (DSemanticDiagram) rep; boolean isEdgeModified = false; List<Edge> edgeList = getEdgeList(dDiagram); for (Edge edge : edgeList) { isEdgeModified = checkAndDeleteMultipleConnectorStyle(edge) || isEdgeModified; } if (isEdgeModified) { migrationOccured = true; sb.append(MessageFormat.format(Messages.DeleteMultipleConnectorMigrationParticipant_edgesModified, descriptor.getName())); } <START> if (migrationOccured) { DiagramPlugin.getDefault().logInfo(sb.toString()); migrationOccured = false; } <END> } } } } }</code><technical_language>log end of loop for step</technical_language>

Target:
protected void postLoad(DAnalysis dAnalysis, Version loadedVersion) { if (loadedVersion.compareTo(MIGRATION_VERSION) < 0) { StringBuilder sb = new StringBuilder(Messages.DeleteMultipleConnectorMigrationParticipant_title); EList<DView> ownedViews = dAnalysis.getOwnedViews(); for (DView view : ownedViews) { List<DRepresentationDescriptor> loadedRepresentationsDescriptors = new DViewQuery(view).getLoadedRepresentationsDescriptors(); for (DRepresentationDescriptor descriptor : loadedRepresentationsDescriptors) { DRepresentation rep = descriptor.getRepresentation(); if (rep instanceof DSemanticDiagram) { DSemanticDiagram dDiagram = (DSemanticDiagram) rep; boolean isEdgeModified = false; List<Edge> edgeList = getEdgeList(dDiagram); for (Edge edge : edgeList) { isEdgeModified = checkAndDeleteMultipleConnectorStyle(edge) || isEdgeModified; } if (isEdgeModified) { migrationOccured = true; sb.append(MessageFormat.format(Messages.DeleteMultipleConnectorMigrationParticipant_edgesModified, descriptor.getName())); } } } if (migrationOccured) { DiagramPlugin.getDefault().logInfo(sb.toString()); migrationOccured = false; } } } }
Source:
<code>private void linkToSessionFormRecord(Uri instanceUri) { AndroidSessionWrapper currentState = CommCareApplication._().getCurrentSessionWrapper(); if (instanceUri == null) { raiseFormEntryError("Form Entry did not return a form", currentState); return; } Cursor c = getContext().getContentResolver().query(instanceUri, null, null, null, null); boolean complete = false; try { complete = currentState.beginRecordTransaction(instanceUri, c); } catch (IllegalArgumentException iae) { iae.printStackTrace(); raiseFormEntryError("Unrecoverable error when trying to read form|" + iae.getMessage(), currentState); return; } finally { c.close(); } FormRecord current; try { current = currentState.commitRecordTransaction(); } catch (Exception e) { FormRecordCleanupTask.wipeRecord(getContext(), currentState); ExceptionReportTask ert = new ExceptionReportTask(); ert.execute(e); <START> raiseFormEntryError("An error occurred: " + e.getMessage() + " and your data could not be saved.", currentState); <END> return; } Logger.log(AndroidLogger.TYPE_FORM_ENTRY, "Form Entry Completed"); if (complete) { if (FormRecord.STATUS_COMPLETE.equals(current.getStatus())) { try { new FormRecordProcessor(getContext()).process(current); } catch (Exception e) { Logger.log(AndroidLogger.TYPE_ERROR_WORKFLOW, "Error processing form. Should be recaptured during async processing: " + e.getMessage()); } } } }</code><technical_language>is user facing outcome if, for instance, form is saved incomplete error occurs. app finish filling out form, errors return session is gone</technical_language>

Target:
private void linkToSessionFormRecord(Uri instanceUri) { if (getType(instanceUri) != InstanceColumns.CONTENT_ITEM_TYPE) { Log.w(t, "Tried to link a FormRecord to a URI that doesn't point " + "to a concrete instance."); return; } AndroidSessionWrapper currentState = CommCareApplication._().getCurrentSessionWrapper(); if (instanceUri == null) { raiseFormEntryError("Form Entry did not return a form", currentState); return; } Cursor c = getContext().getContentResolver().query(instanceUri, null, null, null, null); boolean complete = false; try { complete = currentState.beginRecordTransaction(instanceUri, c); } catch (IllegalArgumentException iae) { iae.printStackTrace(); raiseFormEntryError("Unrecoverable error when trying to read form|" + iae.getMessage(), currentState); return; } finally { c.close(); } FormRecord current; try { current = currentState.commitRecordTransaction(); } catch (Exception e) { FormRecordCleanupTask.wipeRecord(getContext(), currentState); ExceptionReportTask ert = new ExceptionReportTask(); ert.execute(e); raiseFormEntryError("An error occurred: " + e.getMessage() + " and your data could not be saved.", currentState); return; } Logger.log(AndroidLogger.TYPE_FORM_ENTRY, "Form Entry Completed"); if (complete) { if (FormRecord.STATUS_COMPLETE.equals(current.getStatus())) { try { new FormRecordProcessor(getContext()).process(current); } catch (Exception e) { Logger.log(AndroidLogger.TYPE_ERROR_WORKFLOW, "Error processing form. Should be recaptured during async processing: " + e.getMessage()); } } } }
Source:
<code>public <T> Provider<T> scope(final Key<T> key, final Provider<T> unscoped) { final Provider<T> base = Scopes.SINGLETON.scope(key,unscoped); return new Provider<T>() { public T get() { try { return base.get(); } catch (Exception | LinkageError e) { error(key, e); return null; } } void error(Key<T> key, Throwable x) { if (verbose) { LOGGER.log(Level.WARNING, "Failed to instantiate " + key + "; skipping this component", x); } else { <START> LOGGER.log(Level.FINEST, "Failed to instantiate optional component {0}; skipping", key.getTypeLiteral()); <END> LOGGER.log(Level.FINEST, key.toString(), x); } } }; }</code><technical_language>Important information for admins</technical_language>

Target:
public <T> Provider<T> scope(final Key<T> key, final Provider<T> unscoped) { final Provider<T> base = Scopes.SINGLETON.scope(key,unscoped); return new Provider<T>() { public T get() { try { return base.get(); } catch (Exception | LinkageError e) { error(key, e); return null; } } void error(Key<T> key, Throwable x) { if (verbose) { LOGGER.log(Level.WARNING, "Failed to instantiate " + key + "; skipping this component", x); } else { LOGGER.log(Level.INFO, "Failed to instantiate optional component {0}; skipping", key.getTypeLiteral()); LOGGER.log(Level.FINEST, key.toString(), x); } } }; }
Source:
<code>private NonNoteEntry mergeNonNotes(NonNoteEntry baseList, NonNoteEntry oursList, NonNoteEntry theirsList) throws IOException { if (baseList == null && oursList == null && theirsList == null) return null; try { ObjectId baseId = write(baseList, inserter); ObjectId oursId = write(oursList, inserter); ObjectId theirsId = write(theirsList, inserter); inserter.flush(); <START> ThreeWayMerger m = MergeStrategy.RESOLVE.newMerger(db, true); <END> m.setBase(baseId); if (!m.merge(oursId, theirsId)) throw new NotesMergeConflictException(baseList, oursList, theirsList); AbbreviatedObjectId none = AbbreviatedObjectId.fromString(""); return NoteParser.parse(none, m.getResultTreeId(), reader).nonNotes; } finally { inserter.release(); } }</code><technical_language>MergeStrategy configurable, defaulting MergeStrategy.RESOLVE</technical_language>

Target:
private NonNoteEntry mergeNonNotes(NonNoteEntry baseList, NonNoteEntry oursList, NonNoteEntry theirsList) throws IOException { if (baseList == null && oursList == null && theirsList == null) return null; ObjectId baseId = write(baseList, inserter); ObjectId oursId = write(oursList, inserter); ObjectId theirsId = write(theirsList, inserter); inserter.flush(); ObjectId resultTreeId; if (nonNotesMergeStrategy instanceof ThreeWayMergeStrategy) { ThreeWayMerger m = ((ThreeWayMergeStrategy) nonNotesMergeStrategy) .newMerger(db, true); m.setBase(baseId); if (!m.merge(oursId, theirsId)) throw new NotesMergeConflictException(baseList, oursList, theirsList); resultTreeId = m.getResultTreeId(); } else { Merger m = nonNotesMergeStrategy.newMerger(db, true); if (!m.merge(new AnyObjectId[] { oursId, theirsId })) throw new NotesMergeConflictException(baseList, oursList, theirsList); resultTreeId = m.getResultTreeId(); } AbbreviatedObjectId none = AbbreviatedObjectId.fromString(""); return NoteParser.parse(none, resultTreeId, reader).nonNotes; }
Source:
<code>public void testMultiWALFromOneDFSClient() throws Exception { fs.delete(new Path(FileUtils.directoryName(url, topicsDir, TOPIC_PARTITION)), true); @SuppressWarnings("unchecked") Class<? extends Storage> storageClass = (Class<? extends Storage>) Class.forName(connectorConfig.getString(HdfsSinkConnectorConfig.STORAGE_CLASS_CONFIG)); Storage storage = StorageFactory.createStorage(storageClass, conf, url); final WAL wal1 = storage.wal(topicsDir, TOPIC_PARTITION); <START> final FSWAL wal2 = (FSWAL)storage.wal(topicsDir, TOPIC_PARTITION); <END> String directory = TOPIC + "/" + String.valueOf(PARTITION); final String tempfile = FileUtils.tempFileName(url, topicsDir, directory, extension); final String commitedFile = FileUtils.committedFileName(url, topicsDir, directory, TOPIC_PARTITION, 0, 10, extension, ZERO_PAD_FMT); fs.createNewFile(new Path(tempfile)); wal1.acquireLease(); wal1.append(WAL.beginMarker, ""); wal1.append(tempfile, commitedFile); wal1.append(WAL.endMarker, ""); Thread thread = new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(wal2.getSleepIntervalMs()-100); closed = true; wal1.close(); } catch (ConnectException | InterruptedException e) { } } }); thread.start(); wal2.acquireLease(); assertTrue(closed); wal2.apply(); wal2.close(); assertTrue(fs.exists(new Path(commitedFile))); assertFalse(fs.exists(new Path(tempfile))); storage.close(); }</code><technical_language>Single white space needed casting storage</technical_language>

Target:
public void testMultiWALFromOneDFSClient() throws Exception { setUp(); fs.delete(new Path(FileUtils.directoryName(url, topicsDir, TOPIC_PARTITION)), true); @SuppressWarnings("unchecked") Class<? extends HdfsStorage> storageClass = (Class<? extends HdfsStorage>) connectorConfig .getClass(StorageCommonConfig.STORAGE_CLASS_CONFIG); storage = io.confluent.connect.storage.StorageFactory.createStorage( storageClass, HdfsSinkConnectorConfig.class, connectorConfig, url ); final WAL wal1 = storage.wal(topicsDir, TOPIC_PARTITION); final FSWAL wal2 = (FSWAL) storage.wal(topicsDir, TOPIC_PARTITION); String directory = TOPIC + "/" + String.valueOf(PARTITION); final String tempfile = FileUtils.tempFileName(url, topicsDir, directory, extension); final String committedFile = FileUtils.committedFileName( url, topicsDir, directory, TOPIC_PARTITION, 0, 10, extension, ZERO_PAD_FMT ); fs.createNewFile(new Path(tempfile)); wal1.acquireLease(); wal1.append(WAL.beginMarker, ""); wal1.append(tempfile, committedFile); wal1.append(WAL.endMarker, ""); Thread thread = new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(WALConstants.INITIAL_SLEEP_INTERVAL_MS - 100); closed = true; wal1.close(); } catch (ConnectException | InterruptedException e) { } } }); thread.start(); wal2.acquireLease(); assertTrue(closed); wal2.apply(); wal2.close(); assertTrue(fs.exists(new Path(committedFile))); assertFalse(fs.exists(new Path(tempfile))); storage.close(); }
Source:
<code>public void validateCantLiveMigrateToBackupDomain() { StorageDomain dstStorageDomain = <START> initStorageDomain(srcStorageId); <END> dstStorageDomain.setStatus(StorageDomainStatus.Active); dstStorageDomain.setBackup(true); initDiskImage(diskImageGroupId, diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageGroupId); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_VM_DISKS_ON_BACKUP_STORAGE); }</code><technical_language>dst</technical_language>

Target:
public void validateCantLiveMigrateToBackupDomain() { StorageDomain srcStorageDomain = initStorageDomain(srcStorageId); srcStorageDomain.setStatus(StorageDomainStatus.Active); srcStorageDomain.setBackup(true); initDiskImage(diskImageGroupId, diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageGroupId); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_VM_DISKS_ON_BACKUP_STORAGE); }
Source:
<code>public void validate(Class<?> originalType, MirrorList<Method> methods) { boolean hasAfterMethod = notNull(AfterCall.class, originalType, methods); boolean hasAroundMethod = notNull(AroundCall.class, originalType, methods); boolean hasBeforeMethod = notNull(BeforeCall.class, originalType, methods); if (!hasAfterMethod && !hasAroundMethod && !hasBeforeMethod) { throw new InterceptionException(format("Interceptor %s must " + "declare at least one method whith @%s, @%s or @%s annotation", originalType.getCanonicalName(), AfterCall.class.getSimpleName(), <START> AroundCall.class.getSimpleName(), BeforeCall.class.getSimpleName())); <END> } }</code><technical_language>refactor friendly annotations? I names change official (beta) release. put @BeforeCall in string</technical_language>

Target:
public void validate(Class<?> originalType, MirrorList<Method> methods) { boolean hasAfterMethod = hasAnnotatedMethod(AfterCall.class, originalType, methods); boolean hasAroundMethod = hasAnnotatedMethod(AroundCall.class, originalType, methods); boolean hasBeforeMethod = hasAnnotatedMethod(BeforeCall.class, originalType, methods); if (!hasAfterMethod && !hasAroundMethod && !hasBeforeMethod) { throw new InterceptionException(format("Interceptor %s must " + "declare at least one method whith @AfterCall, @AroundCall " + "or @BeforeCall annotation", originalType.getCanonicalName())); } }
Source:
<code>public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException { CommonHelper.assertNotNull("config", config); <START> SAML2Client client = (SAML2Client) config.getClients().findClient("SAML2Client").get(); <END> if (client != null) { client.init(); servletResponse.getWriter().write(client.getServiceProviderMetadataResolver().getMetadata()); servletResponse.getWriter().flush(); } else { throw new TechnicalException("No SAML2Client"); } }</code><technical_language>client name a property, config. name is generally "SAML2Client"</technical_language>

Target:
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain) throws IOException, ServletException { CommonHelper.assertNotNull("config", config); CommonHelper.assertNotNull("client", client); SAML2Client client = (SAML2Client) config.getClients().findClient(this.client).get(); if (client != null) { client.init(); servletResponse.getWriter().write(client.getServiceProviderMetadataResolver().getMetadata()); servletResponse.getWriter().flush(); } else { throw new TechnicalException("No SAML2Client: " + this.client); } }
Source:
<code>private ClientResponse makeRemoteCall(Action action) throws Throwable { if (lastRedirect.get() != null && isQueryAction(action)) { <START> String serviceUrl = lastRedirect.get(); <END> try { ClientResponse clientResponse = makeRemoteCall(action, serviceUrl); int status = clientResponse.getStatus(); if (status >= 200 && status < 300) { return clientResponse; } SERVER_RETRY_COUNTER.increment(); lastRedirect.compareAndSet(serviceUrl, null); } catch (Throwable ignored) { logger.warn("Remote call to last redirect address failed; retrying from configured service URL list"); SERVER_RETRY_COUNTER.increment(); lastRedirect.compareAndSet(serviceUrl, null); } } return makeRemoteCall(action, 0); }</code><technical_language>Minor race here, lastRedirect.get() change in calls. cache locally String serviceUrl = lastRedirect.get() if statement</technical_language>

Target:
private ClientResponse makeRemoteCall(Action action) throws Throwable { ClientResponse response; if(isQueryAction(action)) { response = makeRemoteCallToRedirectedServer(lastQueryRedirect, action); } else { response = makeRemoteCallToRedirectedServer(lastRegisterRedirect, action); } if (response == null) { response = makeRemoteCall(action, 0); } return response; }
Source:
<code>protected DeploymentGroupStatus awaitDeploymentGroupStatus( final HeliosClient client, final String name, final DeploymentGroupStatus.State expected) throws Exception { return Polling.await(LONG_WAIT_SECONDS, SECONDS, new Callable<DeploymentGroupStatus>() { @Override public DeploymentGroupStatus call() throws Exception { final DeploymentGroupStatusResponse response = getOrNull( client.deploymentGroupStatus(name)); if (response != null) { final DeploymentGroupStatus status = response.getDeploymentGroupStatus(); final DeploymentGroupStatus.State actual = status.getState(); <START> if (expected.equals(actual)) { <END> return status; } if (FAILED.equals(actual) && !expected.equals(actual)) { throw new AssertionError("Deployment group " + name + " failed unexpectedly: " + status.getError()); } } return null; } }); }</code><technical_language>State is enum, == here</technical_language>

Target:
protected DeploymentGroupStatus awaitDeploymentGroupStatus( final HeliosClient client, final String name, final DeploymentGroupStatus.State expected) throws Exception { return Polling.await(LONG_WAIT_SECONDS, SECONDS, new Callable<DeploymentGroupStatus>() { @Override public DeploymentGroupStatus call() throws Exception { final DeploymentGroupStatusResponse response = getOrNull( client.deploymentGroupStatus(name)); if (response != null) { final DeploymentGroupStatus status = response.getDeploymentGroupStatus(); final DeploymentGroupStatus.State actual = status.getState(); if (actual == FAILED && actual != expected) { throw new AssertionError("Deployment group " + name + " failed unexpectedly: " + status.getError()); } if (actual == expected) { return status; } } return null; } }); }
Source:
<code><START> ConditionParamPresenter mockParamPresenter() { <END> ConditionParamPresenter paramPresenter = mock(ConditionParamPresenter.class); ConditionParamPresenter.View paramPresenterView = mock(ConditionParamPresenter.View.class); HTMLElement element = mock(HTMLElement.class); when(paramPresenter.getView()).thenReturn(paramPresenterView); when(paramPresenterView.getElement()).thenReturn(element); return paramPresenter; }</code><technical_language>This method private</technical_language>

Target:
private ConditionParamPresenter mockParamPresenter() { ConditionParamPresenter paramPresenter = mock(ConditionParamPresenter.class); ConditionParamPresenter.View paramPresenterView = mock(ConditionParamPresenter.View.class); HTMLElement element = mock(HTMLElement.class); when(paramPresenter.getView()).thenReturn(paramPresenterView); when(paramPresenterView.getElement()).thenReturn(element); return paramPresenter; }