auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public COREEnvelopeBatchSubmissionResponse batchSubmitTransaction(COREEnvelopeBatchSubmission msg, AssertionType assertion, NhinTargetSystemType targetSystem, NhincConstants.GATEWAY_API_LEVEL apiLevel) { COREEnvelopeBatchSubmissionResponse response; try { String url = proxyHelper.getUrlFromTargetSystemByGatewayAPILevel(targetSystem, getServiceName(), apiLevel); if (StringUtils.isNotEmpty(url)) { X12LargePayloadUtils.convertFileLocationToDataIfEnabled(msg); ServicePortDescriptor<GenericBatchTransactionPort> portDescriptor = new COREGenericBatchServicePortDescriptor(); CONNECTClient<GenericBatchTransactionPort> client = getCONNECTClientSecured(portDescriptor, assertion, url, targetSystem, getServiceName()); client.enableMtom(); response = (COREEnvelopeBatchSubmissionResponse) client.invokePort(GenericBatchTransactionPort.class, "batchSubmitTransaction", msg); if (response != null && response.getPayload() != null) { X12LargePayloadUtils.convertDataToFileLocationIfEnabled(response); } } else { <START> String targetHCID = null; <END> if (targetSystem != null && targetSystem.getHomeCommunity() != null && targetSystem.getHomeCommunity().getHomeCommunityId() != null) { targetHCID = targetSystem.getHomeCommunity().getHomeCommunityId(); } return X12EntityExceptionBuilder.getInstance().createErrorResponse(msg, targetHCID); } } catch (Exception ex) { LOG.error("Error calling batchSubmitTransaction: {}", ex.getLocalizedMessage(), ex); return X12EntityExceptionBuilder.getInstance().createWebServiceErrorResponse(msg, ex.getLocalizedMessage()); } return response; }</code><technical_language>I duplicate logic in here. Consider HomeCommunityMap.getCommunityIdFromTargetCommunities()</technical_language>

Target:
public COREEnvelopeBatchSubmissionResponse batchSubmitTransaction(COREEnvelopeBatchSubmission msg, AssertionType assertion, NhinTargetSystemType targetSystem, NhincConstants.GATEWAY_API_LEVEL apiLevel) { COREEnvelopeBatchSubmissionResponse response; try { String url = proxyHelper.getUrlFromTargetSystemByGatewayAPILevel(targetSystem, getServiceName(), apiLevel); if (StringUtils.isNotEmpty(url)) { X12LargePayloadUtils.convertFileLocationToDataIfEnabled(msg); ServicePortDescriptor<GenericBatchTransactionPort> portDescriptor = new COREGenericBatchServicePortDescriptor(); CONNECTClient<GenericBatchTransactionPort> client = getCONNECTClientSecured(portDescriptor, assertion, url, targetSystem, getServiceName()); client.enableMtom(); response = (COREEnvelopeBatchSubmissionResponse) client.invokePort(GenericBatchTransactionPort.class, "batchSubmitTransaction", msg); if (response != null && response.getPayload() != null) { X12LargePayloadUtils.convertDataToFileLocationIfEnabled(response); } } else { String targetHCID = HomeCommunityMap.getCommunityIdFromTargetSystem(targetSystem); return X12EntityExceptionBuilder.getInstance().createErrorResponse(msg, targetHCID); } } catch (Exception ex) { LOG.error("Error calling batchSubmitTransaction: {}", ex.getLocalizedMessage(), ex); return X12EntityExceptionBuilder.getInstance().createWebServiceErrorResponse(msg, ex.getLocalizedMessage()); } return response; }
Source:
<code>Injector getInjector(IClass iClass) { Guice guice = AnnotationHelper.findAnnotationSuperClasses(Guice.class, iClass.getRealClass()); if (guice == null) { return null; } if (iClass instanceof TestClass) { iClass = ((TestClass) iClass).getIClass(); } if (!(iClass instanceof ClassImpl)) { return null; } Injector parentInjector = ((ClassImpl) iClass).getParentInjector(); List<Module> moduleInstances = Lists.newArrayList(getModules(guice, parentInjector, iClass.getRealClass())); if (isStringNotEmpty(context.getSuite().getParentModule())) { Class<Module> parentModule = (Class<Module>) ClassHelper.forName(context.getSuite().getParentModule()); if (parentModule != null) { moduleInstances.add(newParentModule(parentModule)); } else { throw new TestNGException( "Cannot load parent Guice module class: " + context.getSuite().getParentModule()); } } Injector injector = context.getInjector(moduleInstances); if (injector == null) { <START> Stage stage; <END> String stageString = context.getSuite().getGuiceStage(); if (isStringNotEmpty(stageString)) { stage = Stage.valueOf(stageString); } else { stage = Stage.DEVELOPMENT; } injector = com.google.inject.Guice.createInjector(stage, moduleInstances); context.addInjector(moduleInstances, injector); } return injector; }</code><technical_language>do this (and avoid else part) java Stage stage = Stage.DEVELOPMENT; String stageString = context.getSuite().getGuiceStage(); if (isStringNotEmpty(stageString)){ stage = Stage.valueOf(stageString); }</technical_language>

Target:
Injector getInjector(IClass iClass) { Guice guice = AnnotationHelper.findAnnotationSuperClasses(Guice.class, iClass.getRealClass()); if (guice == null) { return null; } if (iClass instanceof TestClass) { iClass = ((TestClass) iClass).getIClass(); } if (!(iClass instanceof ClassImpl)) { return null; } Injector parentInjector = ((ClassImpl) iClass).getParentInjector(); List<Module> moduleInstances = Lists.newArrayList(getModules(guice, parentInjector, iClass.getRealClass())); List<Module> moduleLookup = Lists.newArrayList(moduleInstances); Module parentModule = getParentModule(context); if (parentModule != null) { moduleInstances.add(parentModule); } Injector injector = context.getInjector(moduleLookup); if (injector == null) { injector = createInjector(context, moduleInstances); context.addInjector(moduleInstances, injector); } return injector; }
Source:
<code>public List<MostRecentChecksum> findByResultTypeInDateRange(Context context, Date startDate, Date endDate, ChecksumResultCode resultCode) throws SQLException { CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context); CriteriaQuery<MostRecentChecksum> criteriaQuery = getCriteriaQuery(criteriaBuilder, MostRecentChecksum.class); Root<MostRecentChecksum> mostRecentChecksumRoot = criteriaQuery.from(MostRecentChecksum.class); criteriaQuery.select(mostRecentChecksumRoot); criteriaQuery.where(criteriaBuilder.and( criteriaBuilder.equal(mostRecentChecksumRoot.get("checksumResult.resultCode"), resultCode), criteriaBuilder.lessThanOrEqualTo(mostRecentChecksumRoot.get("processStartDate"), startDate), <START> criteriaBuilder.greaterThan(mostRecentChecksumRoot.get("processStartDate"), endDate) <END> ) ); List<Order> orderList = new LinkedList<>(); orderList.add(criteriaBuilder.asc(mostRecentChecksumRoot.get(MostRecentChecksum_.bitstream))); criteriaQuery.orderBy(orderList); return list(context, criteriaQuery, false, MostRecentChecksum.class, -1, -1); }</code><technical_language>Is a reason hardcoded strings here, instead of, for example MostRecentChecksum_.processStartDate, etc</technical_language>

Target:
public List<MostRecentChecksum> findByResultTypeInDateRange(Context context, Date startDate, Date endDate, ChecksumResultCode resultCode) throws SQLException { CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context); CriteriaQuery<MostRecentChecksum> criteriaQuery = getCriteriaQuery(criteriaBuilder, MostRecentChecksum.class); Root<MostRecentChecksum> mostRecentChecksumRoot = criteriaQuery.from(MostRecentChecksum.class); Join<MostRecentChecksum, ChecksumResult> mostRecentResult = mostRecentChecksumRoot.join(MostRecentChecksum_.checksumResult); criteriaQuery.select(mostRecentChecksumRoot); criteriaQuery.where(criteriaBuilder.and( criteriaBuilder.equal(mostRecentResult.get(ChecksumResult_.resultCode), resultCode), criteriaBuilder.lessThanOrEqualTo( mostRecentChecksumRoot.get(MostRecentChecksum_.processStartDate), startDate), criteriaBuilder.greaterThan(mostRecentChecksumRoot.get(MostRecentChecksum_.processStartDate), endDate) ) ); List<Order> orderList = new LinkedList<>(); orderList.add(criteriaBuilder.asc(mostRecentChecksumRoot.get(MostRecentChecksum_.bitstream))); criteriaQuery.orderBy(orderList); return list(context, criteriaQuery, false, MostRecentChecksum.class, -1, -1); }
Source:
<code>public void TestParserInvalidBidPriceInput() { String input = "1234,98233,adxyz,3.3,2015-03-08 03:37:12,11/12/2012,12,y,,CAMP_AD,Y,yes"; parser.in.process(input.getBytes()); <START> parser.teardown(); <END> Assert.assertEquals(0, objectPort.collectedTuples.size()); Assert.assertEquals(0, pojoPort.collectedTuples.size()); Assert.assertEquals(1, error.collectedTuples.size()); }</code><technical_language>parser.teardown() call part of finished() call of TestWatcher</technical_language>

Target:
public void TestParserInvalidBidPriceInput() { String input = "1234,98233,adxyz,3.3,2015-03-08 03:37:12,11/12/2012,12,y,,CAMP_AD,Y,yes"; parser.beginWindow(0); parser.in.process(input.getBytes()); parser.endWindow(); Assert.assertEquals(0, objectPort.collectedTuples.size()); Assert.assertEquals(0, pojoPort.collectedTuples.size()); Assert.assertEquals(1, error.collectedTuples.size()); }
Source:
<code>public boolean canGenerateReport() { if ("pom".equals(project.getPackaging())) { getLog().info("Skipping JaCoCo for project with packaging type 'pom'"); return false; <START> }else if ("ear".equals(project.getPackaging())){ <END> getLog().info("Skipping JaCoCo for project with packaging type 'ear'"); return false; } if (skip) { getLog().info("Skipping JaCoCo execution"); return false; } if (!getDataFile().exists()) { getLog().info("Skipping JaCoCo execution due to missing execution data file"); return false; } return true; }</code><technical_language>Instead of adding more if here, I prefer a constant private static final Set<String> SKIPPED_PACKAGINGS = new HashSet(Arrays.asList("pom", "ear")); if (SKIPPED_PACKAGINGS.contains(project.getPackaging()) { getLog().info(String.format("Skipping JaCoCo for project packaging type %s", project.getPackaging()); return false; }</technical_language>

Target:
public boolean canGenerateReport() { if (SKIPPED_PACKAGINGS.contains(project.getPackaging())) { getLog().info(String.format("Skipping JaCoCo for project with packaging type '%s'", project.getPackaging())); return false; } if (skip) { getLog().info("Skipping JaCoCo execution"); return false; } if (!getDataFile().exists()) { getLog().info("Skipping JaCoCo execution due to missing execution data file"); return false; } return true; }
Source:
<code><START> public void serialize(ByteBuffer bb) { <END> bb.put(data, 0, getLength()); }</code><technical_language>return int</technical_language>

Target:
public int serialize(ByteBuffer bb) { int length = getLength(); bb.put(data, 0, length); return length; }
Source:
<code>private void initUnregisteredVM() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskMap() != null) { vmFromConfiguration.setDiskMap(getParameters().getDiskMap()); vmFromConfiguration.setImages(getDiskImageListFromDiskMap(getParameters().getDiskMap())); } } catch (OvfReaderException e) { <START> log.error("Failed to parse a given ovf configuration:\n{}", ovfEntityData.getOvfData()); <END> log.error("Exception", e); } } }</code><technical_language>please add getMessage : {}\n{}</technical_language>

Target:
private void initUnregisteredVM() { OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); if (getParameters().getDiskMap() != null) { vmFromConfiguration.setDiskMap(getParameters().getDiskMap()); vmFromConfiguration.setImages(getDiskImageListFromDiskMap(getParameters().getDiskMap())); } } catch (OvfReaderException e) { log.error("Failed to parse a given ovf configuration: '{}':\n{}", ovfEntityData.getOvfData(), e.getMessage()); log.debug("Exception", e); } } }
Source:
<code>private static DbConnectionProperties createFrom(Map<String, String> map) { DbConnectionProperties props = new DbConnectionProperties(); for (Map.Entry<String, String> entry: map.entrySet()) { String key = entry.getKey(); String val = entry.getValue(); switch (key) { case "username": props.Username = val; break; case "password": props.Password = val; break; case "service": props.Service = val; break; case "database": props.DbName = val; break; case "connection-string": props.FullConnectionString = val; break; <START> case "admin-username": <END> case "admin-password": case "admin-database": break; default: throw new UnsupportedOperationException( "Unsupported key in properties file:" + key); } } if (props.FullConnectionString != null) { return props; } if (props.Service != null && props.Username != null && props.Password != null) { return props; } throw new Error( "You have to define either the full connection string; or service, username and password in the properties file"); }</code><technical_language>Hmm, changing production code wondering - of for else integration test bootstrap here? Another question is: if want a set of username/password - in properties file</technical_language>

Target:
private static DbConnectionProperties createFrom(Map<String, String> map) { DbConnectionProperties props = new DbConnectionProperties(); for (Map.Entry<String, String> entry: map.entrySet()) { String key = entry.getKey(); String val = entry.getValue(); if ("username".equals(key)) { props.Username = val; } else if ("password".equals(key)) { props.Password = val; } else if ("service".equals(key)) { props.Service = val; } else if ("database".equals(key)) { props.DbName = val; } else if ("connection-string".equals(key)) { props.FullConnectionString = val; } else { throw new UnsupportedOperationException( "Unsupported key in properties file:" + key); } } if (props.FullConnectionString != null) { return props; } if (props.Service != null && props.Username != null && props.Password != null) { return props; } throw new Error( "You have to define either the full connection string; or service, username and password in the properties file"); }
Source:
<code>public List<MedalDepency> getMedalDepencies() { <START> return medalDepencies; <END> }</code><technical_language>Minor typo MedalDepency class - MedalDependency. :-)</technical_language>

Target:
public List<MedalDependency> getMedalDepencies() { return medalDepencies; }
Source:
<code>private String getWebappFilePath() throws IOException { String webappFilePath = null; <START> if (getContext() instanceof Context) { <END> Context ctx = getContext(); String docBase = ctx.getDocBase(); Host host = (Host) ctx.getParent(); String appBase = host.getAppBase(); File canonicalAppBase = new File(appBase); if (canonicalAppBase.isAbsolute()) { canonicalAppBase = canonicalAppBase.getCanonicalFile(); } else { canonicalAppBase = new File(System.getProperty("carbon.home"), appBase) .getCanonicalFile(); } File webappFile = new File(docBase); if (webappFile.isAbsolute()) { webappFilePath = webappFile.getCanonicalPath(); } else { webappFilePath = (new File(canonicalAppBase, docBase)).getPath(); } } return webappFilePath; }</code><technical_language>getContext() returns Context</technical_language>

Target:
private String getWebappFilePath() throws IOException { String webappFilePath = null; Context ctx = getContext(); String docBase = ctx.getDocBase(); Host host = (Host) ctx.getParent(); String appBase = host.getAppBase(); File canonicalAppBase = new File(appBase); if (canonicalAppBase.isAbsolute()) { canonicalAppBase = canonicalAppBase.getCanonicalFile(); } else { canonicalAppBase = new File(System.getProperty("carbon.home"), appBase) .getCanonicalFile(); } File webappFile = new File(docBase); if (webappFile.isAbsolute()) { webappFilePath = webappFile.getCanonicalPath(); } else { webappFilePath = (new File(canonicalAppBase, docBase)).getPath(); } return webappFilePath; }
Source:
<code>public void setUp() { vm = new VM(); vm.setCpuPerSocket(2); vm.setNumOfSockets(2); <START> vdsWithoutCores = new VDS(); vdsWithoutCores.setId(Guid.newGuid()); vdsWithoutCores.setCpuCores(0); vdsWithoutCores.setCpuThreads(0); <END> vdsWithCores = new VDS(); vdsWithCores.setId(Guid.newGuid()); vdsWithCores.setCpuCores(2); vdsWithCores.setCpuThreads(4); cluster = new VDSGroup(); cluster.setId(Guid.newGuid()); when(vdsGroupDao.get(any(Guid.class))).thenReturn(cluster); }</code><technical_language>a valid host. is covered for edge case? a bit unclear. call invalidVds add vdsWithInsufficientCpus</technical_language>

Target:
public void setUp() { vm = new VM(); vm.setCpuPerSocket(2); vm.setNumOfSockets(2); vdsWithInvalidCpuInfo = new VDS(); vdsWithInvalidCpuInfo.setId(Guid.newGuid()); vdsWithInvalidCpuInfo.setCpuCores(0); vdsWithInvalidCpuInfo.setCpuThreads(0); vdsWithCores = new VDS(); vdsWithCores.setId(Guid.newGuid()); vdsWithCores.setCpuCores(2); vdsWithCores.setCpuThreads(4); cluster = new VDSGroup(); cluster.setId(Guid.newGuid()); when(vdsGroupDao.get(any(Guid.class))).thenReturn(cluster); }
Source:
<code><START> public void setProgressMessage(String progressMessage) { <END> this.progressMessage = progressMessage; }</code><technical_language>Please final</technical_language>

Target:
public final void setProgressMessage(String progressMessage) { this.progressMessage = progressMessage; }
Source:
<code>public static <C extends SCMCategory<?>> String toShortUrl(List<C> categories) { <START> if (categories.size() == 1) { <END> return categories.get(0).getName().toLowerCase(Locale.ENGLISH); } Set<String> urlNames = new TreeSet<String>(); for (SCMCategory category : categories) { urlNames.add(category.getName()); } return StringUtils.join(urlNames, "_").toLowerCase(Locale.ENGLISH); }</code><technical_language>Is empty list permitted</technical_language>

Target:
public static <C extends SCMCategory<?>> String toShortUrl(List<C> categories) { if (categories.isEmpty()) { throw new IllegalArgumentException("Must supply at least one category"); } if (categories.size() == 1) { return categories.get(0).getName().toLowerCase(Locale.ENGLISH); } Set<String> urlNames = new TreeSet<String>(); for (SCMCategory category : categories) { urlNames.add(category.getName().toLowerCase(Locale.ENGLISH)); } return StringUtils.join(urlNames, "_"); }
Source:
<code>public AuthenticationException(ADALError code, String details, HttpWebResponse response) { super(details); mCode = code; if (null == response) { return; } mServiceStatusCode = response.getStatusCode(); if (null != response.getResponseHeaders()) { <START> mHttpResponseHeaders = response.getResponseHeaders(); <END> } if (null != response.getBody()) { final String responseBodyStr = response.getBody(); try { mResponseBody = new HashMap<>(); final JSONObject jsonObject = new JSONObject(responseBodyStr); final Iterator<?> i = jsonObject.keys(); while (i.hasNext()) { final String key = (String) i.next(); mResponseBody.put(key, jsonObject.getString(key)); } } catch (final JSONException exc) { return; } } }</code><technical_language>HashMapExtensions.getJsonResponse</technical_language>

Target:
public AuthenticationException(ADALError code, String details, HttpWebResponse response) { super(details); mCode = code; setHttpResponse(response); }
Source:
<code>protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__HOT_PLUG); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_DISK); if (getDisk() != null) { addCanDoActionMessage(String.format("$%1$s %2$s", "diskAliases", getDiskAlias())); <START> } <END> }</code><technical_language>imo this added needed message, need add disk alias if get a message vm for example..as do for messages</technical_language>

Target:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__HOT_PLUG); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_DISK); }
Source:
<code>private void parseBlueToothDevices(AbstractFile regFile, BufferedReader reader) throws FileNotFoundException, IOException { List<BlackboardArtifact> bbartifacts = new ArrayList<>(); String line = reader.readLine(); <START> while (!line.contains(SECTION_DIVIDER)) { <END> line = reader.readLine(); line = line.trim(); if (line.toLowerCase().contains("device unique id")) { while (!line.contains(SECTION_DIVIDER) && !line.isEmpty() && !line.toLowerCase().contains("radio support not found")) { Collection<BlackboardAttribute> attributes = new ArrayList<>(); addBlueToothAttribute(line, attributes, TSK_DEVICE_ID); line = reader.readLine(); if (line.toLowerCase().contains("name")) { addBlueToothAttribute(line, attributes, TSK_NAME); line = reader.readLine(); } addBlueToothAttribute(line, attributes, TSK_DATETIME); line = reader.readLine(); addBlueToothAttribute(line, attributes, TSK_DATETIME_ACCESSED); BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING, regFile, attributes); if(bba != null) { bbartifacts.add(bba); } line = reader.readLine(); line = reader.readLine(); } line = line.trim(); } } if (!bbartifacts.isEmpty()) { postArtifacts(bbartifacts); } }</code><technical_language>check line != null contains? unsafe</technical_language>

Target:
private void parseBlueToothDevices(AbstractFile regFile, BufferedReader reader) throws FileNotFoundException, IOException { List<BlackboardArtifact> bbartifacts = new ArrayList<>(); String line = reader.readLine(); while ((line != null) && (!line.contains(SECTION_DIVIDER))) { line = reader.readLine(); if (line != null) { line = line.trim(); } if ((line != null) && (line.toLowerCase().contains("device unique id"))) { while (line != null && !line.contains(SECTION_DIVIDER) && !line.isEmpty() && !line.toLowerCase().contains("radio support not found")) { Collection<BlackboardAttribute> attributes = new ArrayList<>(); addBlueToothAttribute(line, attributes, TSK_DEVICE_ID); line = reader.readLine(); if ((line != null) && (line.toLowerCase().contains("name"))) { addBlueToothAttribute(line, attributes, TSK_NAME); line = reader.readLine(); } addBlueToothAttribute(line, attributes, TSK_DATETIME); line = reader.readLine(); addBlueToothAttribute(line, attributes, TSK_DATETIME_ACCESSED); BlackboardArtifact bba = createArtifactWithAttributes(ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING, regFile, attributes); if(bba != null) { bbartifacts.add(bba); } reader.readLine(); line = reader.readLine(); } if (line != null) { line = line.trim(); } } } if (!bbartifacts.isEmpty()) { postArtifacts(bbartifacts); } }
Source:
<code>public void manage(Entity e) { if (isManaged(e)) { log.warn(""+this+" redundant call to start management of entity (and descendants of) "+e+"; skipping", new Exception("source of duplicate management of "+e)); return; } <START> validateDescendantConfig(e); <END> manageRecursive(e, ManagementTransitionMode.guessing(BrooklynObjectManagementMode.NONEXISTENT, BrooklynObjectManagementMode.MANAGED_PRIMARY)); }</code><technical_language>reason do in InternalEntityFactory (analogously policy path)</technical_language>

Target:
public void manage(Entity e) { if (isManaged(e)) { log.warn(""+this+" redundant call to start management of entity (and descendants of) "+e+"; skipping", new Exception("source of duplicate management of "+e)); return; } manageRecursive(e, ManagementTransitionMode.guessing(BrooklynObjectManagementMode.NONEXISTENT, BrooklynObjectManagementMode.MANAGED_PRIMARY)); }
Source:
<code><START> public Map<String, String> headers() { <END> if (this.isDestroyed()) { throw new IllegalStateException("object is already destroyed"); } Map<String, String> headers = new HashMap<>(); try { final byte[] key = secretKey.getEncoded(); md5.update(key); headers.put("X-Amz-Server-Side-Encryption-Customer-Algorithm", "AES256"); headers.put("X-Amz-Server-Side-Encryption-Customer-Key", BaseEncoding.base64().encode(key)); headers.put("X-Amz-Server-Side-Encryption-Customer-Key-Md5", BaseEncoding.base64().encode(md5.digest())); } finally { md5.reset(); } }</code><technical_language>do return a new HashMap instead of adding headers existing one? typical case is add SSE-C headers HTTP header map. do gain here</technical_language>

Target:
public final Map<String, String> headers() { if (this.isDestroyed()) { throw new IllegalStateException("object is already destroyed"); } Map<String, String> headers = new HashMap<>(); try { final byte[] key = secretKey.getEncoded(); md5.update(key); headers.put("X-Amz-Server-Side-Encryption-Customer-Algorithm", "AES256"); headers.put("X-Amz-Server-Side-Encryption-Customer-Key", BaseEncoding.base64().encode(key)); headers.put("X-Amz-Server-Side-Encryption-Customer-Key-Md5", BaseEncoding.base64().encode(md5.digest())); } finally { md5.reset(); } return headers; }
Source:
<code>public void waitTheiaIde() { try { seleniumWebDriverHelper.waitVisibility(theiaIde, PREPARING_WS_TIMEOUT_SEC); <START> } catch (WebDriverException ex) { <END> switchToIdeFrame(); } }</code><technical_language>more specific here, cover unrecoverable exceptions, timeout exception</technical_language>

Target:
public void waitTheiaIde() { try { seleniumWebDriverHelper.waitVisibility(theiaIde, PREPARING_WS_TIMEOUT_SEC); } catch (TimeoutException ex) { switchToIdeFrame(); seleniumWebDriverHelper.waitVisibility(theiaIde, PREPARING_WS_TIMEOUT_SEC); } }
Source:
<code>public String decode(byte[] wbxmlBody) { try { int i = 4; if ((wbxmlBody[i] & WBXML_TOKEN_MASK) != WBXML_TAG_EMN) { return null; } if ((wbxmlBody[i] & WBXML_TOKEN_WITH_ATTRS) != WBXML_TOKEN_WITH_ATTRS) { return null; } i++; if ((wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_TIMESTAMP) { i++; if (wbxmlBody[i] == WBXML_ATTR_OPAQUE_DATA) { i++; <START> i+= wbxmlBody[i] + 1; <END> } } if ((wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_MAILBOX && (wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_MAILBOX_AT) { return null; } if (wbxmlBody[i + 1] != WBXML_INLINE_STRING) { return null; } i += 2; int j = i; while (wbxmlBody[j] != WBXML_ATTR_NULL) { j++; } if (i == j) return null; String emailAddress = new String(wbxmlBody, i, j-i); i = j + 1; String extension = ExtensionEncoded(wbxmlBody[i]); if (extension != null) { emailAddress += extension; } return emailAddress; } catch (ArrayIndexOutOfBoundsException e) { if (Email.DEBUG) { Log.d(Email.LOG_TAG, "ArrayIndexOutOfBoundsException while handling " + "CONTENT_MIME_TYPE_B_EMN"); } } catch (Exception e) { if (Email.DEBUG) { Log.d(Email.LOG_TAG, "Exception while handling CONTENT_MIME_TYPE_B_EMN " + e); } } return null; }</code><technical_language>space i +=</technical_language>

Target:
public String decode(byte[] wbxmlBody) { try { int i = 4; if ((wbxmlBody[i] & WBXML_TOKEN_MASK) != WBXML_TAG_EMN) { return null; } if ((wbxmlBody[i] & WBXML_TOKEN_WITH_ATTRS) != WBXML_TOKEN_WITH_ATTRS) { return null; } i++; if ((wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_TIMESTAMP) { i++; if (wbxmlBody[i] == WBXML_ATTR_OPAQUE_DATA) { i++; i += wbxmlBody[i] + 1; } } if ((wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_MAILBOX && (wbxmlBody[i] & WBXML_TOKEN_MASK) == WBXML_ATTR_MAILBOX_AT) { return null; } if (wbxmlBody[i + 1] != WBXML_INLINE_STRING) { return null; } i += 2; int j = i; while (wbxmlBody[j] != WBXML_ATTR_NULL) { j++; } if (i == j) return null; String emailAddress = new String(wbxmlBody, i, j-i); i = j + 1; String extension = decodeExtension(wbxmlBody[i]); if (extension != null) { emailAddress += extension; } return emailAddress; } catch (ArrayIndexOutOfBoundsException e) { if (Email.DEBUG) { Log.d(Email.LOG_TAG, "ArrayIndexOutOfBoundsException while handling " + "CONTENT_MIME_TYPE_B_EMN"); } } catch (Exception e) { if (Email.DEBUG) { Log.d(Email.LOG_TAG, "Exception while handling CONTENT_MIME_TYPE_B_EMN " + e); } } return null; }
Source:
<code>public VmCommand(T parameters) { super(parameters); setVmId(parameters.getVmId()); <START> setReason(parameters.getReason()); <END> }</code><technical_language>this is in vmCommand? in stopBase command</technical_language>

Target:
public VmCommand(T parameters) { super(parameters); setVmId(parameters.getVmId()); }
Source:
<code>public void testCRAMContainerStreamWithCraiIndex() throws IOException { final List<SAMRecord> samRecords = createRecords(100); final SAMFileHeader header = createSAMHeader(SAMFileHeader.SortOrder.coordinate); final ByteArrayOutputStream outStream = new ByteArrayOutputStream(); final ByteArrayOutputStream indexStream = new ByteArrayOutputStream(); doTest(samRecords, outStream, header, new CRAMCRAIIndexer(indexStream, header)); <START> outStream.close(); <END> indexStream.close(); final File cramTempFile = File.createTempFile("cramContainerStreamTest", ".cram"); cramTempFile.deleteOnExit(); final OutputStream cramFileStream = new FileOutputStream(cramTempFile); cramFileStream.write(outStream.toByteArray()); cramFileStream.close(); final File indexTempFile = File.createTempFile("cramContainerStreamTest", ".crai"); indexTempFile.deleteOnExit(); OutputStream indexFileStream = new FileOutputStream(indexTempFile); indexFileStream.write(indexStream.toByteArray()); indexFileStream.close(); final ReferenceSource refSource = createReferenceSource(); final CRAMFileReader reader = new CRAMFileReader( cramTempFile, indexTempFile, refSource, ValidationStringency.SILENT); final CloseableIterator<SAMRecord> iterator = reader.query(new QueryInterval[]{new QueryInterval(1, 10, 10)}, false); int count = 0; while (iterator.hasNext()) { SAMRecord actualRecord = iterator.next(); count++; } Assert.assertEquals(count, 2); }</code><technical_language>try-with-resources avoid explicit close(),</technical_language>

Target:
public void testCRAMContainerStreamWithCraiIndex() throws IOException { final List<SAMRecord> samRecords = createRecords(100); final SAMFileHeader header = createSAMHeader(SAMFileHeader.SortOrder.coordinate); try (ByteArrayOutputStream outStream = new ByteArrayOutputStream(); ByteArrayOutputStream indexStream = new ByteArrayOutputStream()) { doTestWithIndexer(samRecords, outStream, header, new CRAMCRAIIndexer(indexStream, header)); outStream.flush(); indexStream.flush(); checkCRAMContainerStream(outStream, indexStream, ".crai"); } }
Source:
<code>public Payload next() { Payload payload; payload = nextPayload; <START> nextPayload = getNextPayload(); <END> return payload; }</code><technical_language>Do need some kind of synchronization here, next() concurrently called separate threads</technical_language>

Target:
public Payload next() { Payload payload; if (!hasNext()) throw new NoSuchElementException(); payload = nextPayload; nextPayload = getNextPayload(); return payload; }
Source:
<code><START> public DefaultDuoMultifactorAuthenticationProvider duoMultifactorAuthenticationProviders(final DuoSecurityMultifactorProperties duo) { <END> final BasicDuoSecurityAuthenticationService s = new BasicDuoSecurityAuthenticationService(duo, httpClient); final DefaultDuoMultifactorAuthenticationProvider duoP = new DefaultDuoMultifactorAuthenticationProvider(duo.getRegistrationUrl(), s); duoP.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode()); duoP.setBypassEvaluator(MultifactorAuthenticationUtils.newMultifactorAuthenticationProviderBypass(duo.getBypass())); duoP.setOrder(duo.getRank()); duoP.setId(duo.getId()); applicationContext.getBeanFactory().registerSingleton(duoP.getId()+"-provider", duoP); return duoP; }</code><technical_language>Switch type DuoMultifactorAuthenticationProvider? method private</technical_language>

Target:
private DuoMultifactorAuthenticationProvider duoMultifactorAuthenticationProviders(final DuoSecurityMultifactorProperties duo) { final BasicDuoSecurityAuthenticationService s = new BasicDuoSecurityAuthenticationService(duo, httpClient); final DefaultDuoMultifactorAuthenticationProvider duoP = new DefaultDuoMultifactorAuthenticationProvider(duo.getRegistrationUrl(), s); duoP.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode()); duoP.setBypassEvaluator(MultifactorAuthenticationUtils.newMultifactorAuthenticationProviderBypass(duo.getBypass())); duoP.setOrder(duo.getRank()); duoP.setId(duo.getId()); applicationContext.getBeanFactory().registerSingleton(duoP.getId()+"-provider", duoP); return duoP; }
Source:
<code>public static Configuration createConfiguration(UnderFileSystemConfiguration conf, Boolean isSecure) { Configuration wasbConf = HdfsUnderFileSystem.createConfiguration(conf); for (Map.Entry<String, String> entry : conf.toMap().entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (PropertyKey.Template.UNDERFS_AZURE_ACCOUNT_KEY.matches(key)) { wasbConf.set(key, value); } } if (isSecure) { <START> wasbConf.set("fs.AbstractFileSystem.wasb.impl", "org.apache.hadoop.fs.azure.Wasbs"); <END> wasbConf.set("fs.wasbs.impl", "org.apache.hadoop.fs.azure.NativeAzureFileSystem"); } else { wasbConf.set("fs.AbstractFileSystem.wasb.impl", "org.apache.hadoop.fs.azure.Wasb"); wasbConf.set("fs.wasb.impl", "org.apache.hadoop.fs.azure.NativeAzureFileSystem"); } return wasbConf; }</code><technical_language>this "fs.AbstractFileSystem.wasbs.impl"</technical_language>

Target:
public static Configuration createConfiguration(UnderFileSystemConfiguration conf, Boolean isSecure) { Configuration wasbConf = HdfsUnderFileSystem.createConfiguration(conf); for (Map.Entry<String, String> entry : conf.toMap().entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (PropertyKey.Template.UNDERFS_AZURE_ACCOUNT_KEY.matches(key)) { wasbConf.set(key, value); } } if (isSecure) { wasbConf.set("fs.AbstractFileSystem.wasbs.impl", "org.apache.hadoop.fs.azure.Wasbs"); wasbConf.set("fs.wasbs.impl", "org.apache.hadoop.fs.azure.NativeAzureFileSystem"); } else { wasbConf.set("fs.AbstractFileSystem.wasb.impl", "org.apache.hadoop.fs.azure.Wasb"); wasbConf.set("fs.wasb.impl", "org.apache.hadoop.fs.azure.NativeAzureFileSystem"); } return wasbConf; }
Source:
<code>public void assertHasParameter(AssertionInfo info, URI actual, String name, String value) { assertNotNull(info, actual); Map<String, List<String>> parameters = getParameters(actual.getQuery()); if (!parameters.containsKey(name)) { throw failures.failure(info, shouldHaveParameter(actual, name, value)); } List<String> values = parameters.get(name); if (!values.contains(value)) { <START> throw failures.failure(info, shouldHaveParameter(actual, name, value, values.get(0))); <END> } }</code><technical_language>values empty ? If display parameter's values, display [], if is one, stick actual message</technical_language>

Target:
public void assertHasParameter(AssertionInfo info, URI actual, String name, String value) { assertNotNull(info, actual); Map<String, List<String>> parameters = getParameters(actual.getQuery()); if (!parameters.containsKey(name)) { throw failures.failure(info, shouldHaveParameter(actual, name, value)); } List<String> values = parameters.get(name); if (!values.contains(value)) { if (values.size() == 1) { throw failures.failure(info, shouldHaveParameter(actual, name, value, values.get(0))); } throw failures.failure(info, shouldHaveParameter(actual, name, value, values.toString())); } }
Source:
<code>public void suggestArticleTypeIntoWhyCoolField(String text) { suggestArticleWhyCooliInput.sendKeys(text); <START> PageObjectLogging.log("SuggestArticleTypeIntoWhyCoolField", "Type '"+text+"' into 'Why cool' field on 'Suggest Video Modal'", true, driver); <END> }</code><technical_language>1. line shorter, 2. methods name changed, change parameter Suggest suggest</technical_language>

Target:
public void suggestArticleTypeIntoWhyCoolField(String text) { suggestArticleWhyCooliInput.sendKeys(text); PageObjectLogging.log( "suggestArticleTypeIntoWhyCoolField", "Type '"+text+"' into 'Why cool' field on 'Suggest Video Modal'", true ); }
Source:
<code><START> PRED_change_project_1(Term a1, Operation n) { <END> arg1 = a1; cont = n; }</code><technical_language>public</technical_language>

Target:
public PRED_change_project_1(Term a1, Operation n) { arg1 = a1; cont = n; }
Source:
<code>public Response start(Action action) { <START> validateParameters(action); <END> return performServiceAction(action, GlusterServiceActionType.start); }</code><technical_language>rsdl_metadata.yaml validating fields: action.name: 'xs:string', action.service_type: 'xs:string'</technical_language>

Target:
public Response start(Action action) { validateParameters(action); return performServiceAction(action, GlusterServiceActionType.START); }
Source:
<code>public void copySelected() { if (!table.selectedRows().isEmpty()) { for (Block block : table.selectedRows()) { EditableBlock added = new EditableBlock(block); added.setName(viewModel.getUniqueName(added.getName())); try { config.addNewBlock(added); } catch (DuplicateBlockNameException e1) { <START> e1.printStackTrace(); <END> } setBlocks(config); setSelectedBlocks(new ArrayList<EditableBlock>(Arrays.asList(added))); table.setSelected(added); } } }</code><technical_language>Remove TODO add more error handling. a minimum send IsisLog, want bring error dialog user notices</technical_language>

Target:
private void copySelected() { if (!table.selectedRows().isEmpty()) { for (Block block : table.selectedRows()) { EditableBlock added = new EditableBlock(block); added.setName(viewModel.getUniqueName(added.getName())); try { config.addNewBlock(added); } catch (DuplicateBlockNameException e1) { MessageDialog error = new MessageDialog(this.getShell(), "Error", null, "Failed to add block " + added.getName() + ":\nBlock with this name already exists.", MessageDialog.ERROR, new String[] {"OK"}, 0); error.open(); } setBlocks(config); setSelectedBlocks(new ArrayList<EditableBlock>(Arrays.asList(added))); table.setSelected(added); } } }
Source:
<code>public static void closeReaders(List<ParquetFileReader> readers) { readers.forEach(r -> { try { r.close(); <START> } catch (IOException e) { <END> } }); }</code><technical_language>nice swallow exception. throw a runtime exception, log happened while closing file</technical_language>

Target:
public static void closeReaders(List<ParquetFileReader> readers) { readers.forEach(r -> { try { r.close(); } catch (IOException e) { LOG.error("Error closing reader {}", r.getFile(), e); } }); }
Source:
<code>private List<String> getDataSourceArray() { try { Case currentCase = Case.getOpenCase(); SleuthkitCase tskDb = currentCase.getSleuthkitCase(); getLoadLogicalSources(tskDb); <START> getLoadImageSources(tskDb); <END> } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Unable to get current open case.", ex); } catch (TskCoreException | SQLException ex) { logger.log(Level.SEVERE, "Failed to get data source info from database.", ex); } List<String> dataSourcesList = new ArrayList<>(dataSourceMap.values()); Collections.sort(dataSourcesList, (String dsName1, String dsName2) -> dsName1.compareTo(dsName2)); List<String> dataSourceDisplayNames = new ArrayList<>(); for (String dataSource : dataSourcesList) { File dataSourceFullName = new File(dataSource); dataSourceDisplayNames.add(dataSourceFullName.getName()); toolTipList.add(dataSourceFullName.getParent()); } return dataSourceDisplayNames; }</code><technical_language>Is a reason tskDb.getDataSources() here</technical_language>

Target:
private List<String> getDataSourceArray() { List<String> dsList = new ArrayList<>(); try { Case currentCase = Case.getCurrentCaseThrows(); SleuthkitCase tskDb = currentCase.getSleuthkitCase(); List<DataSource> dataSources = tskDb.getDataSources(); Collections.sort(dataSources, (DataSource ds1, DataSource ds2) -> ds1.getName().compareTo(ds2.getName())); for (DataSource ds : dataSources) { String dsName = ds.getName(); File dataSourceFullName = new File(dsName); String displayName = dataSourceFullName.getName(); dataSourceMap.put(ds.getId(), displayName); toolTipList.add(dsName); dsList.add(displayName); } } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Unable to get current open case.", ex); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Failed to get data source info from database.", ex); } return dsList; }
Source:
<code>private static InputStream getDsTriples(final DatastreamVersion dv, final ObjectReference ref, final Map<String, String> createDates) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final Model triples = ModelFactory.createDefaultModel(); final String uri = "info:fedora/" + dv.getDatastreamInfo().getObjectInfo().getPid() + "/" + dv.getDatastreamInfo().getDatastreamId(); final String dsid = dv.getDatastreamInfo().getDatastreamId(); <START> System.out.println("DS URI: " + uri); <END> if (dv.isFirstVersionIn(ref)) { createDates.put(dv.getDatastreamInfo().getDatastreamId(), dv.getCreated()); } addDateLiteral(triples, uri, "<LINK_1>", createDates.get(dsid)); addDateLiteral(triples, uri, "<LINK_2>", dv.getCreated()); addStringLiteral(triples, uri, "<LINK_6>", dv.getDatastreamInfo().getDatastreamId()); addStringLiteral(triples, uri, "<LINK_3>", dv.getLabel()); addStringLiteral(triples, uri, "<LINK_0>", dv.getDatastreamInfo().getState()); addStringLiteral(triples, uri, "<LINK_5>", dv.getFormatUri()); addStringLiteral(triples, uri, "<LINK_4>", dv.getMimeType()); triples.write(out, "TTL"); return new ByteArrayInputStream(out.toByteArray()); }</code><technical_language>Please change logging</technical_language>

Target:
private static InputStream getDsTriples(final DatastreamVersion dv, final ObjectReference ref, final Map<String, String> createDates) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final Model triples = ModelFactory.createDefaultModel(); final String uri = "info:fedora/" + dv.getDatastreamInfo().getObjectInfo().getPid() + "/" + dv.getDatastreamInfo().getDatastreamId(); final String dsid = dv.getDatastreamInfo().getDatastreamId(); if (dv.isFirstVersionIn(ref)) { createDates.put(dv.getDatastreamInfo().getDatastreamId(), dv.getCreated()); } addDateLiteral(triples, uri, "<LINK_1>", createDates.get(dsid)); addDateLiteral(triples, uri, "<LINK_2>", dv.getCreated()); addStringLiteral(triples, uri, "<LINK_6>", dv.getDatastreamInfo().getDatastreamId()); addStringLiteral(triples, uri, "<LINK_3>", dv.getLabel()); addStringLiteral(triples, uri, "<LINK_0>", dv.getDatastreamInfo().getState()); addStringLiteral(triples, uri, "<LINK_5>", dv.getFormatUri()); addStringLiteral(triples, uri, "<LINK_4>", dv.getMimeType()); triples.write(out, "TTL"); return new ByteArrayInputStream(out.toByteArray()); }
Source:
<code>public void writeObject(ObjectOutput output, Object object) throws IOException { int number = objects.get(object.getClass(), -1); output.writeByte(number); <START> switch (ExternalizerId.values()[number]) { <END> case EQUALITY_PREDICATE: output.writeObject(((EqualityPredicate) object).object); break; } }</code><technical_language>If put enums in map instead of ordinals, I skip values() access. add a null check well</technical_language>

Target:
public void writeObject(ObjectOutput output, Object object) throws IOException { ExternalizerId id = objects.get(object.getClass()); if (id == null) { throw new IllegalArgumentException("Unsupported class " + object.getClass() + " was provided!"); } output.writeByte(id.ordinal()); switch (id) { case EQUALITY_PREDICATE: output.writeObject(((EqualityPredicate) object).object); break; } }
Source:
<code>public Iterator<Object[]> queryableData() throws IOException { List<Object[]> tests = new ArrayList<>(); tests.add(new Object[]{new File(TEST_DATA_DIR, "NA12891.fp.vcf"), false}); tests.add(new Object[]{new File(TEST_DATA_DIR, "NA12891.vcf"), false}); tests.add(new Object[]{VcfTestUtils.createTemporaryIndexedVcfFromInput(new File(TEST_DATA_DIR, "NA12891.vcf"), "fingerprintcheckertest.tmp."), true}); <START> tests.add(new Object[]{new File(TEST_DATA_DIR, "NA12891.vcf.gz"), true}); <END> return tests.iterator(); }</code><technical_language>purpose of test clearer if create a temporary index for this file well, instead of committing it. a specific reason test createTemporaryIndexedVcfFromInput function</technical_language>

Target:
public Iterator<Object[]> queryableData() throws IOException { List<Object[]> tests = new ArrayList<>(); tests.add(new Object[]{new File(TEST_DATA_DIR, "NA12891.fp.vcf"), false}); tests.add(new Object[]{new File(TEST_DATA_DIR, "NA12891.vcf"), false}); tests.add(new Object[]{VcfTestUtils.createTemporaryIndexedVcfFromInput(new File(TEST_DATA_DIR, "NA12891.vcf"), "fingerprintcheckertest.tmp."), true}); tests.add(new Object[]{VcfTestUtils.createTemporaryIndexedVcfFromInput(new File(TEST_DATA_DIR, "NA12891.vcf.gz"), "fingerprintcheckertest.tmp."), true}); tests.add(new Object[]{new File("/dev/null"), false}); tests.add(new Object[]{new File("/dev/stdin"), false}); tests.add(new Object[]{new File("/dev/stdout"), false}); tests.add(new Object[]{new File("."), false}); tests.add(new Object[]{new File(".."), false}); tests.add(new Object[]{new File("/"), false}); tests.add(new Object[]{TEST_DATA_DIR, false}); return tests.iterator(); }
Source:
<code>protected Observable<ClientInterestChannel> reestablish() { final EurekaClientRegistry<InstanceInfo> prevRegistry = currentDelegateChannel().associatedRegistry(); final EurekaClientRegistry<InstanceInfo> newRegistry = new EurekaClientRegistryImpl(metricFactory.getRegistryMetrics()); final ClientInterestChannel newChannel = channelFactory.newInterestChannel(newRegistry); return Observable.create(new Observable.OnSubscribe<ClientInterestChannel>() { @Override public void call(final Subscriber<? super ClientInterestChannel> subscriber) { try { Interest<InstanceInfo> activeInterests = new MultipleInterests<InstanceInfo>(interestTracker.interests.keySet()); newChannel.appendInterest(activeInterests).subscribe(); newRegistry.forInterest(activeInterests) .lift(new RegistrySwapOperator(prevRegistry, newRegistry, swapStrategyFactory)) .doOnCompleted(new Action0() { @Override public void call() { <START> prevRegistry.shutdown(); <END> subscriber.onNext(newChannel); subscriber.onCompleted(); } }) .subscribe(); } catch (Exception e) { subscriber.onError(e); } } }); }</code><technical_language>This trigger immediately interest subscription OnError, while ready new registry. shutdown channel/registry new channel is swapped in</technical_language>

Target:
protected Observable<ClientInterestChannel> reestablish() { final ClientInterestChannel newChannel = channelFactory.newInterestChannel(); final EurekaClientRegistry<InstanceInfo> prevRegistry = currentDelegateChannel().associatedRegistry(); final EurekaClientRegistry<InstanceInfo> newRegistry = newChannel.associatedRegistry(); return Observable.create(new Observable.OnSubscribe<ClientInterestChannel>() { @Override public void call(final Subscriber<? super ClientInterestChannel> subscriber) { try { Interest<InstanceInfo> activeInterests = new MultipleInterests<InstanceInfo>(interestTracker.interests.keySet()); newChannel.appendInterest(activeInterests).subscribe(); newRegistry.forInterest(activeInterests) .lift(new RegistrySwapOperator(prevRegistry, newRegistry, swapStrategyFactory)) .doOnCompleted(new Action0() { @Override public void call() { subscriber.onNext(newChannel); subscriber.onCompleted(); } }) .subscribe(); } catch (Exception e) { subscriber.onError(e); } } }); }
Source:
<code><START> public static Duration seconds(Number n) { <END> return new Duration( n.longValue(), TimeUnit.SECONDS ); }</code><technical_language>seconds(1.1d) return a duration of 1.1 seconds? happy for return 1 second</technical_language>

Target:
public static Duration seconds(Number n) { return new Duration( (long)(n.doubleValue() * TimeUnit.SECONDS.toNanos(1)), TimeUnit.NANOSECONDS ); }