auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static SliceHeader internalRead(int major, InputStream inputStream) throws IOException { final int sequenceId = ITF8.readUnsignedITF8(inputStream); final int alignmentStart = ITF8.readUnsignedITF8(inputStream); final int alignmentSpan = ITF8.readUnsignedITF8(inputStream); final int recordCount = ITF8.readUnsignedITF8(inputStream); final long globalRecordCounter = LTF8.readUnsignedLTF8(inputStream); final int blockCount = ITF8.readUnsignedITF8(inputStream); final int[] contentIDs = CramIntArray.array(inputStream); final int embeddedRefBlockContentID = ITF8.readUnsignedITF8(inputStream); final byte[] referenceMD5s = new byte[MD5_LEN]; InputStreamUtils.readFully(inputStream, referenceMD5s, 0, MD5_LEN); final byte[] tagBytes = InputStreamUtils.readFully(inputStream); final SAMBinaryTagAndValue tags = (major >= CramVersions.CRAM_v3.major) ? BinaryTagCodec.readTags(tagBytes, 0, tagBytes.length, ValidationStringency.DEFAULT_STRINGENCY) : null; return new SliceHeader(sequenceId, alignmentStart, alignmentSpan, recordCount, globalRecordCounter, blockCount, contentIDs, embeddedRefBlockContentID, referenceMD5s, tags); }

Target:
private static SliceHeader internalRead(int major, InputStream inputStream) throws IOException { final int sequenceId = ITF8.readUnsignedITF8(inputStream); final int alignmentStart = ITF8.readUnsignedITF8(inputStream); final int alignmentSpan = ITF8.readUnsignedITF8(inputStream); final int recordCount = ITF8.readUnsignedITF8(inputStream); final long globalRecordCounter = LTF8.readUnsignedLTF8(inputStream); final int blockCount = ITF8.readUnsignedITF8(inputStream); final int[] contentIDs = CramIntArray.array(inputStream); final int embeddedRefBlockContentID = ITF8.readUnsignedITF8(inputStream); final byte[] referenceMD5 = new byte[MD5_LEN]; InputStreamUtils.readFully(inputStream, referenceMD5, 0, MD5_LEN); final byte[] tagBytes = InputStreamUtils.readFully(inputStream); final SAMBinaryTagAndValue sliceHeaderTags = (major >= CramVersions.CRAM_v3.major) ? BinaryTagCodec.readTags(tagBytes, 0, tagBytes.length, ValidationStringency.DEFAULT_STRINGENCY) : null; return new SliceHeader(sequenceId, alignmentStart, alignmentSpan, recordCount, globalRecordCounter, blockCount, contentIDs, embeddedRefBlockContentID, referenceMD5, sliceHeaderTags); }
Source:
public void init() throws Exception { initDataSource(); CertificateManagementDAOFactory.init(this.getDataSource()); }

Target:
public void init() throws Exception { initDataSource(); CertificateManagementDAOFactory.init(this.getDataSource()); Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); managementService = CertificateManagementServiceImpl.getInstance(); Assert.assertNotNull(managementService); log.info("getInstance Test Successful"); }
Source:
protected boolean canDoAction() { if (getVm() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); return false; } if (getVm().getstatus() != VMStatus.MigratingFrom) { addCanDoActionMessage(VdcBllMessages.VM_CANNOT_CANCEL_MIGRATION_WHEN_VM_IS_NOT_MIGRATING); return false; } return true; }

Target:
protected boolean canDoAction() { if (getVm() == null) { addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM.toString()); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__MIGRATE.toString()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); return false; } if (getVm().getstatus() != VMStatus.MigratingFrom) { addCanDoActionMessage(VdcBllMessages.VM_CANNOT_CANCEL_MIGRATION_WHEN_VM_IS_NOT_MIGRATING); return false; } return true; }
Source:
public TouchScreen getTouch() { return new RemoteTouchScreen(this.getExecuteMethod()); }

Target:
public TouchScreen getTouch() { return touchScreen; }
Source:
public Resource minify(Resource originalResource, String filename) { if (!getEnabled()) { LOG.trace(MINIFICATION_IS_DISABLED_RETURNING_ORIGINAL_RESOURCE); return originalResource; } String type = getFileType(originalResource, filename); if (type == null) { LOG.info("Unsupported minification resource: " + filename); return originalResource; } Integer filenameLength = originalResource.getFilename().length(); if (filenameLength >= JS_MIN.length()) { String lastSevenCharacters = originalResource.getFilename().substring(filenameLength-JS_MIN.length()); if (lastSevenCharacters.equals(JS_MIN)) { LOG.info("Minification already have done for this resource: " + filename); return originalResource; } } try (BufferedReader in = new BufferedReader(new InputStreamReader(originalResource.getInputStream(), "utf-8")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(baos, "utf-8"));) { minify(in, out, filename, type); out.flush(); return new GeneratedResource(baos.toByteArray(), filename); } catch (Exception e) { LOG.warn(COULD_NOT_MINIFY_RESOURCES_RETURNED_UNMINIFIED_BYTES, e); return originalResource; } }

Target:
public Resource minify(Resource originalResource, String filename) { if (!getEnabled()) { LOG.trace(MINIFICATION_IS_DISABLED_RETURNING_ORIGINAL_RESOURCE); return originalResource; } String type = getFileType(originalResource, filename); if (type == null) { LOG.info("Unsupported minification resource: " + filename); return originalResource; } if (isPreviouslyMinifiedFile(originalResource)) { LOG.info("Minification has already be done for this resource: " + filename); return originalResource; } try (BufferedReader in = new BufferedReader(new InputStreamReader(originalResource.getInputStream(), "utf-8")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(baos, "utf-8"));) { minify(in, out, filename, type); out.flush(); return new GeneratedResource(baos.toByteArray(), filename); } catch (Exception e) { LOG.warn(COULD_NOT_MINIFY_RESOURCES_RETURNED_UNMINIFIED_BYTES, e); return originalResource; } }
Source:
public void shouldNotDeleteThePipelineForUnauthorizedUsers() throws Exception { assertThat(goConfigService.getAllPipelineConfigs().size(), is(1)); assertTrue(goConfigService.hasPipelineNamed(pipelineConfig.name())); pipelineConfigService.deletePipelineConfig(new Username(new CaseInsensitiveString("unauthorized-user")), pipelineConfig.name().toString(), result); assertFalse(result.isSuccessful()); assertThat(result.toString(), result.toString().contains("UNAUTHORIZED_TO_DELETE_PIPELINE"), is(true)); assertThat(result.httpCode(), is(401)); assertThat(goConfigService.getAllPipelineConfigs().size(), is(1)); assertTrue(goConfigService.hasPipelineNamed(pipelineConfig.name())); }

Target:
public void shouldNotDeleteThePipelineForUnauthorizedUsers() throws Exception { assertThat(goConfigService.getAllPipelineConfigs().size(), is(1)); assertTrue(goConfigService.hasPipelineNamed(pipelineConfig.name())); pipelineConfigService.deletePipelineConfig(new Username(new CaseInsensitiveString("unauthorized-user")), pipelineConfig, result); assertFalse(result.isSuccessful()); assertThat(result.toString(), result.toString().contains("UNAUTHORIZED_TO_DELETE_PIPELINE"), is(true)); assertThat(result.httpCode(), is(401)); assertThat(goConfigService.getAllPipelineConfigs().size(), is(1)); assertTrue(goConfigService.hasPipelineNamed(pipelineConfig.name())); }
Source:
private static String findPath(IAdaptable adaptable) { String result = null; final IResourceVariant variant = (IResourceVariant)adaptable.getAdapter(IResourceVariant.class); if (variant != null) { try { final IStorage storage = variant.getStorage(new NullProgressMonitor()); final Object adapter = Platform.getAdapterManager().loadAdapter(storage, IStoragePathProvider.class.getName()); if (adapter instanceof IStoragePathProvider) { final IPath fixedPath = ((IStoragePathProvider)adapter).computeFixedPath(storage); result = fixedPath.toString(); } else if (variant instanceof CachedResourceVariant) { result = ((CachedResourceVariant)variant).getDisplayPath().toString(); } else if (storage instanceof IFile) { result = storage.getFullPath().toString(); } } catch (TeamException e) { } } return result; }

Target:
private static String findPath(IAdaptable adaptable) { String result = null; final IResourceVariant variant = (IResourceVariant)adaptable.getAdapter(IResourceVariant.class); if (variant != null) { try { final IStorage storage = variant.getStorage(new NullProgressMonitor()); if (storage != null) { final Object adapter = Platform.getAdapterManager().loadAdapter(storage, IStoragePathProvider.class.getName()); if (adapter instanceof IStoragePathProvider) { final IPath fixedPath = ((IStoragePathProvider)adapter).computeFixedPath(storage); result = fixedPath.toString(); } else if (storage instanceof IFile) { result = storage.getFullPath().toString(); } } else if (variant instanceof CachedResourceVariant) { result = ((CachedResourceVariant)variant).getDisplayPath().toString(); } } catch (TeamException e) { } } return result; }
Source:
public void testSortDue() { DateRange today = TaskActivityUtil.getCurrentWeek().getToday(); DateRange tomorrow = TaskActivityUtil.getCurrentWeek().getToday().next(); DateRange yesterday = TaskActivityUtil.getCurrentWeek().getToday().previous(); task1.setDueDate(new Date(today.getStartDate().toInstant().toEpochMilli())); assertEquals(-1, sorter.compare(new EmptyViewer(), task1, task2)); assertEquals(1, sorter.compare(new EmptyViewer(), task2, task1)); task2.setDueDate(new Date(tomorrow.getStartDate().toInstant().toEpochMilli())); assertEquals(-1, sorter.compare(new EmptyViewer(), task1, task2)); assertEquals(1, sorter.compare(new EmptyViewer(), task2, task1)); task2.setDueDate(new Date(yesterday.getStartDate().toInstant().toEpochMilli())); assertEquals(0, sorter.compare(new EmptyViewer(), task1, task2)); assertEquals(0, sorter.compare(new EmptyViewer(), task2, task1)); }

Target:
public void testSortDue() { DateRange today = TaskActivityUtil.getCurrentWeek().getToday(); DateRange tomorrow = TaskActivityUtil.getCurrentWeek().getToday().next(); DateRange yesterday = TaskActivityUtil.getCurrentWeek().getToday().previous(); task1.setDueDate(new Date(today.getStartDate().getTimeInMillis())); assertEquals(-1, sorter.compare(new EmptyViewer(), task1, task2)); assertEquals(1, sorter.compare(new EmptyViewer(), task2, task1)); task2.setDueDate(new Date(tomorrow.getStartDate().getTimeInMillis())); assertEquals(-1, sorter.compare(new EmptyViewer(), task1, task2)); assertEquals(1, sorter.compare(new EmptyViewer(), task2, task1)); task2.setDueDate(new Date(yesterday.getStartDate().getTimeInMillis())); assertEquals(0, sorter.compare(new EmptyViewer(), task1, task2)); assertEquals(0, sorter.compare(new EmptyViewer(), task2, task1)); }
Source:
public void removeAllPrivateWorkerKeys(String topologyId) { for (WorkerTokenServiceType type : WorkerTokenServiceType.values()) { String path = ClusterUtils.secretKeysPath(type, topologyId); try { LOG.debug("Removing worker keys under {}", path); stateStorage.delete_node(path); } catch (RuntimeException e) { if (!Utils.exceptionCauseIsInstanceOf(KeeperException.NoNodeException.class, e)) { throw e; } } } }

Target:
public void removeAllPrivateWorkerKeys(String topologyId) { for (WorkerTokenServiceType type : WorkerTokenServiceType.values()) { String path = ClusterUtils.secretKeysPath(type, topologyId); try { LOG.info("Removing worker keys under {}", path); stateStorage.delete_node(path); } catch (RuntimeException e) { if (!Utils.exceptionCauseIsInstanceOf(KeeperException.NoNodeException.class, e)) { throw e; } } } }
Source:
public void setDisabledAdministrativeMonitors(Set<String> disabledAdministrativeMonitors){ this.disabledAdministrativeMonitors = disabledAdministrativeMonitors; }

Target:
public void setDisabledAdministrativeMonitors(Set<String> disabledAdministrativeMonitors) { synchronized (this.disabledAdministrativeMonitors) { this.disabledAdministrativeMonitors.clear(); this.disabledAdministrativeMonitors.addAll(disabledAdministrativeMonitors); } }
Source:
public void rename() throws InterruptedException { try { if (!hasOnlyOneSelection()) { return; } List<Integer> folderIds = getMainController().getPortalSession().getSelectedFolderIds(); if (folderIds.size() == 0) { renameLogOrProcess(); } else { renameFolder(); } } catch (DialogException e) { Messagebox.show(e.getMessage(), "Attention", Messagebox.OK, Messagebox.ERROR); } }

Target:
public void rename() throws InterruptedException { try { if (!isSingleFileSelected()) { Notification.error("Please select single file or folder to rename"); return; } List<Integer> folderIds = getMainController().getPortalSession().getSelectedFolderIds(); if (folderIds.size() == 0) { renameLogOrProcess(); } else { renameFolder(); } } catch (DialogException e) { Messagebox.show(e.getMessage(), "Attention", Messagebox.OK, Messagebox.ERROR); } }
Source:
public Set<Role> getRoles(final Project project) { notNull(project, "project"); final Roles roles = restTemplate.getForObject(Roles.URI, Roles.class, project.getId()); final HashSet<Role> result = new HashSet<>(); for (String roleUri : roles.getRoles()) { final Role role = restTemplate.getForObject(roleUri, Role.class); role.setUri(roleUri); result.add(role); } return result; }

Target:
public Set<Role> getRoles(final Project project) { notNull(project, "project"); final Roles roles = restTemplate.getForObject(Roles.URI, Roles.class, project.getId()); final Set<Role> result = new HashSet<>(); for (String roleUri : roles.getRoles()) { final Role role = restTemplate.getForObject(roleUri, Role.class); role.setUri(roleUri); result.add(role); } return result; }
Source:
public void testTransformXDRResponseToCheckPolicy() throws Exception { XDRResponseEventType eventA = new XDRResponseEventType(); HomeCommunityType hct = new HomeCommunityType(); hct.setHomeCommunityId(TEST_HC_VAL); hct.setName("bcd"); hct.setDescription("jkl"); AssertionType assertionTypeTest = new AssertionType(); assertionTypeTest.setMessageId(MESSAGE_ID); SlotType1 slotType1 = new SlotType1(); slotType1.setName("$XDSDocumentEntryPatientId"); ValueListType valueListType = new ValueListType(); valueListType.getValue().add("1111.4444^^^&amp;26.489.22&amp;ISO"); slotType1.setValueList(valueListType); PersonNameType pnt = new PersonNameType(); pnt.setFullName("abc"); assertionTypeTest.setPersonName(pnt); SlotListType rsl = new SlotListType(); rsl.getSlot().add(slotType1); SubmitObjectsRequest sor = new SubmitObjectsRequest(); sor.setId("100"); sor.setRequestSlotList(rsl); RegistryResponseType prdsrt = new RegistryResponseType(); prdsrt.setResponseSlotList(rsl); prdsrt.setRequestId("1235"); RegistryObjectListType rolt = new RegistryObjectListType(); sor.setRegistryObjectList(rolt); XDRResponseMessageType xmt = new XDRResponseMessageType(); eventA.setMessage(xmt); xmt.setAssertion(assertionTypeTest); xmt.setRegistryResponse(prdsrt); assertionTypeTest.setHomeCommunity(hct); assertionTypeTest.setSSN("170112756"); eventA.setSendingHomeCommunity(hct); String direction = "inbound"; eventA.setDirection(direction); eventA.getMessage().setAssertion(assertionTypeTest); RequestType request = new RequestType(); SubjectHelper subjHelp = new SubjectHelper(); SubjectType subject = subjHelp.subjectFactory(hct, assertionTypeTest); request.getSubject().add(subject); CheckPolicyRequestType result = xdrTransformHelper.transformXDRResponseToCheckPolicy(eventA); verifycheckPolicy_Request(result, direction); }

Target:
public void testTransformXDRResponseToCheckPolicy() throws Exception { XDRResponseEventType eventA = new XDRResponseEventType(); assertionType.setMessageId(MESSAGE_ID); pnt.setFullName("Minh"); assertionType.setPersonName(pnt); rsl.getSlot().add(slotType1); sor.setId("100"); sor.setRequestSlotList(rsl); RegistryResponseType prdsrt = new RegistryResponseType(); prdsrt.setResponseSlotList(rsl); prdsrt.setRequestId("1235"); sor.setRegistryObjectList(rolt); XDRResponseMessageType xmt = new XDRResponseMessageType(); eventA.setMessage(xmt); xmt.setAssertion(assertionType); xmt.setRegistryResponse(prdsrt); assertionType.setHomeCommunity(hct); assertionType.setSSN("170112756"); eventA.setSendingHomeCommunity(hct); String direction = "inbound"; eventA.setDirection(direction); eventA.getMessage().setAssertion(assertionType); RequestType request = new RequestType(); SubjectHelper subjHelp = new SubjectHelper(); SubjectType subject = subjHelp.subjectFactory(hct, assertionType); request.getSubject().add(subject); CheckPolicyRequestType result = xdrTransformHelper.transformXDRResponseToCheckPolicy(eventA); verifycheckPolicy_Request(result); }
Source:
public void testResourceListPropertyDirectory() throws Exception { PherfConstants constants = PherfConstants.create(); assertNotNull(constants.getProperty("pherf.default.dataloader.threadpool")); assertNotNull(constants.getProperty("pherf.default.results.dir")); assertNotNull(constants.getProperty("pherf.default.log_per_nrows")); }

Target:
public void testResourceListPropertyDirectory() throws Exception { PherfConstants constants = PherfConstants.create(); assertNotNull(constants.getProperty("pherf.default.dataloader.threadpool")); assertNotNull(constants.getProperty("pherf.default.results.dir")); assertNotNull(constants.getProperty(PherfConstants.LOG_PER_NROWS_NAME)); }
Source:
protected Object doExecute() throws Exception { checkNotNull(template, "You must choose a template for the image you are trying to create."); Provisionr service = getService(); final Pool pool = createPoolOfOne(service); final String processInstanceId = service.startPoolManagementProcess("j-" + UUID.randomUUID().toString(), pool); return String.format("Pool management process started (id: %s)", processInstanceId); }

Target:
protected Object doExecute() throws Exception { Provisionr service = getService(); final Pool pool = createPoolOfOne(service); return null; }
Source:
public void testExpandValueSetInMemoryRespectsMaxSize() { createCodeSystem(); CustomTerminologySet additions = new CustomTerminologySet(); for (int i = 0; i < 100; i++) { additions.addRootConcept("CODE" + i, "Display " + i); } myTermCodeSystemStorageSvc.applyDeltaCodeSystemsAdd(CS_URL, additions); myDaoConfig.setMaximumExpansionSize(50); ValueSet vs = new ValueSet(); ValueSet.ConceptSetComponent include = vs.getCompose().addInclude(); include.setSystem(CS_URL); try { ValueSet expansion = myTermSvc.expandValueSet(null, vs); fail("Expanded to " + expansion.getExpansion().getContains().size() + " but mas was " + myDaoConfig.getMaximumExpansionSize()); } catch (InternalErrorException e) { assertEquals("Expansion of ValueSet produced too many codes (maximum 50) - Operation aborted!", e.getMessage()); } myDaoConfig.setMaximumExpansionSize(150); vs = new ValueSet(); include = vs.getCompose().addInclude(); include.setSystem(CS_URL); ValueSet outcome = myTermSvc.expandValueSet(null, vs); assertEquals(109, outcome.getExpansion().getContains().size()); }

Target:
public void testExpandValueSetInMemoryRespectsMaxSize() { createCodeSystem(); CustomTerminologySet additions = new CustomTerminologySet(); for (int i = 0; i < 100; i++) { additions.addRootConcept("CODE" + i, "Display " + i); } myTermCodeSystemStorageSvc.applyDeltaCodeSystemsAdd(CS_URL, additions); myDaoConfig.setMaximumExpansionSize(50); ValueSet vs = new ValueSet(); ValueSet.ConceptSetComponent include = vs.getCompose().addInclude(); include.setSystem(CS_URL); try { ValueSet expansion = myTermSvc.expandValueSet(null, vs); fail("Expanded to " + expansion.getExpansion().getContains().size() + " but max was " + myDaoConfig.getMaximumExpansionSize()); } catch (InternalErrorException e) { assertEquals("Expansion of ValueSet produced too many codes (maximum 50) - Operation aborted!", e.getMessage()); } myDaoConfig.setMaximumExpansionSize(150); vs = new ValueSet(); include = vs.getCompose().addInclude(); include.setSystem(CS_URL); ValueSet outcome = myTermSvc.expandValueSet(null, vs); assertEquals(109, outcome.getExpansion().getContains().size()); }
Source:
public String createGroupName(Object[] childrenGroup) { final String baseName = NAME_NEW_VARIABLE_GROUP; String name = baseName; int index = 1; while (!checkNameSubgroup(name, childrenGroup)) name = baseName + "_" + Integer.toString(index++); return name + NAME_ROOT_GROUP; }

Target:
public String createGroupName(Object[] childrenGroup) { final String baseName = NAME_NEW_VARIABLE_GROUP; String name = baseName; int index = 1; while (!checkNameSubgroup(name, childrenGroup)) name = baseName + " " + Integer.toString(index++); return name + Path.ROOT.toString(); }
Source:
public VmLeaseParameters(Guid storagePoolId, Guid storageDomainId, Guid vmId) { this.storagePoolId = storagePoolId; this.storageDomainId = storageDomainId; this.vmId = vmId; this.vmName = null; }

Target:
public VmLeaseParameters(Guid storagePoolId, Guid storageDomainId, Guid vmId) { this.storagePoolId = storagePoolId; this.storageDomainId = storageDomainId; this.vmId = vmId; }
Source:
public boolean supports(CredentialItem... items) { for (CredentialItem i : items) { if (i instanceof CredentialItem.Username) continue; else if (i instanceof CredentialItem.Password) continue; else if (i instanceof CredentialItem.YesNoType) continue; else return false; } return true; }

Target:
public boolean supports(CredentialItem... items) { for (CredentialItem i : items) { if (i instanceof CredentialItem.Password) continue; if (i instanceof CredentialItem.StringType) continue; if (i instanceof CredentialItem.Username) continue; if (i instanceof CredentialItem.YesNoType) continue; return false; } return true; }
Source:
public SSHCredential build() { if (this.sshDirectory == null) this.sshDirectory = new File(System.getProperty("user.home"), ".ssh"); if (this.privateKeyIdentities == null || this.privateKeyIdentities.length == 0) { this.privateKeyIdentities = new String[]{"id_rsa", "id_dsa", "id_ecdsa"}; } if (this.knownHostsFile == null) this.knownHostsFile = "known_hosts"; return new SSHCredential(this.sshDirectory, this.privateKeyIdentities, this.passphrase, this.knownHostsFile); }

Target:
public SSHCredential build() { if (this.sshDirectory == null) this.sshDirectory = DEFAULT_SSH_DIRECTORY; if (this.privateKeyIdentities == null || this.privateKeyIdentities.length == 0) { this.privateKeyIdentities = DEFAULT_PRIVATE_KEYS; } if (this.knownHostsFile == null) this.knownHostsFile = DEFAULT_KNOWN_HOSTS; return new SSHCredential(this.sshDirectory, this.privateKeyIdentities, this.passphrase, this.knownHostsFile); }
Source:
protected void allocateInstance(final AllocationRequest request) { final Instance origInstance = objectManager.loadResource(Instance.class, request.getResourceId()); final List<Instance> instances = getInstancesToAllocate(origInstance); final List<Long> volumeIds = new ArrayList<>(); for (Instance instance : instances) { volumeIds.addAll(InstanceHelpers.extractVolumeIdsFromMounts(instance)); } LockDefinition lock = getInstanceLockDef(origInstance, instances, volumeIds); if (lock != null) { Context c = allocateLockTimer.time(); try { lockManager.lock(lock, new LockCallbackNoReturn() { @Override public void doWithLockNoResult() { allocateInstanceInternal(request, origInstance, instances); } }); } finally { c.stop(); } } else { allocateInstanceInternal(request, origInstance, instances); } }

Target:
protected void allocateInstance(final AllocationRequest request) { final Instance origInstance = objectManager.loadResource(Instance.class, request.getResourceId()); final List<Instance> instances = getInstancesToAllocate(origInstance); final Set<Long> volumeIds = new HashSet<>(); for (Instance instance : instances) { volumeIds.addAll(InstanceHelpers.extractVolumeIdsFromMounts(instance)); } LockDefinition lock = getInstanceLockDef(origInstance, instances, volumeIds); if (lock != null) { Context c = allocateLockTimer.time(); try { lockManager.lock(lock, new LockCallbackNoReturn() { @Override public void doWithLockNoResult() { allocateInstanceInternal(request, origInstance, instances); } }); } finally { c.stop(); } } else { allocateInstanceInternal(request, origInstance, instances); } }
Source:
private void addPrerequisites(BundleDescription bundle, Set<BundleDescription> reachable) { if (reachable.contains(bundle)) return; reachable.add(bundle); List<BundleDescription> depList = ((BundleDescriptionImpl) bundle).getBundleDependencies(); BundleDescription[] dependencies = depList.toArray(new BundleDescription[depList.size()]); for (BundleDescription dependencie : dependencies) { addPrerequisites(dependencie, reachable); } }

Target:
private void addPrerequisites(BundleDescription bundle, Set<BundleDescription> reachable) { if (reachable.contains(bundle)) return; reachable.add(bundle); List<BundleDescription> depList = ((BundleDescriptionImpl) bundle).getBundleDependencies(); BundleDescription[] dependencies = depList.toArray(new BundleDescription[depList.size()]); for (BundleDescription dependency : dependencies) { addPrerequisites(dependency, reachable); } }
Source:
public static void tieSystemOutAndErrToLog() { org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger(); Appender appender = rootLogger.getAppender(DT_LOG_APPENDER); if (appender instanceof RollingFileAppender) { RollingFileAppender rfa = (RollingFileAppender)appender; if (rfa.getFile() == null || rfa.getFile().isEmpty()) { rfa.setFile(System.getProperty(DT_LOGDIR)); rfa.activateOptions(); } } else if (appender != null) { logger.warn("found appender instead of RollingFileAppender", appender); } System.setOut(createLoggingProxy(System.out)); System.setErr(createLoggingProxy(System.err)); LoggerUtil.addAppender("apex"); }

Target:
public static void tieSystemOutAndErrToLog() { org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger(); Appender appender = rootLogger.getAppender(DT_LOG_APPENDER); if (appender instanceof RollingFileAppender) { RollingFileAppender rfa = (RollingFileAppender)appender; if (rfa.getFile() == null || rfa.getFile().isEmpty()) { rfa.setFile(System.getProperty(DT_LOGDIR)); rfa.activateOptions(); } } else if (appender != null) { logger.warn("found appender instead of RollingFileAppender", appender); } LoggerUtil.addAppenders(); System.setOut(createLoggingProxy(System.out)); System.setErr(createLoggingProxy(System.err)); }
Source:
public void handle(Request request, Response response) { long conditionId = request.mandatoryParamAsLong(PARAM_ID); try (DbSession dbSession = dbClient.openSession(false)) { QualityGateConditionDto condition = wsSupport.getCondition(dbSession, conditionId); QualityGateDto qualityGateDto = dbClient.qualityGateDao().selectById(dbSession, condition.getQualityGateId()); String message = format("Condition '%s' is linked to an unknown quality gate '%s'", conditionId, condition.getQualityGateId()); checkState(qualityGateDto != null, message); wsSupport.checkCanEdit(qualityGateDto); dbClient.gateConditionDao().delete(condition, dbSession); dbSession.commit(); response.noContent(); } }

Target:
public void handle(Request request, Response response) { long conditionId = request.mandatoryParamAsLong(PARAM_ID); try (DbSession dbSession = dbClient.openSession(false)) { QualityGateConditionDto condition = wsSupport.getCondition(dbSession, conditionId); QualityGateDto qualityGateDto = dbClient.qualityGateDao().selectById(dbSession, condition.getQualityGateId()); checkState(qualityGateDto != null, "Condition '%s' is linked to an unknown quality gate '%s'", conditionId, condition.getQualityGateId()); wsSupport.checkCanEdit(qualityGateDto); dbClient.gateConditionDao().delete(condition, dbSession); dbSession.commit(); response.noContent(); } }
Source:
public void launchTargetsChanged() { targetSelector.refresh(); }

Target:
public void launchTargetsChanged() { if (targetSelector!=null){ targetSelector.refresh(); } }
Source:
public Object[][] dictionaries() { return new Object[][]{ new Object[]{"test1_comp.interval_list", "test1.dict"}, new Object[]{"test1.vcf", "test1.dict"}, new Object[]{"test1.dict", "test1.dict"}, new Object[]{"empty.interval_list", "test1.dict"}, new Object[]{"Homo_sapiens_assembly18.trimmed.fasta", "Homo_sapiens_assembly18.trimmed.dict"}, new Object[]{"test2_comp.interval_list", "Homo_sapiens_assembly18.trimmed.dict"}, new Object[]{"ScreenSamReads.100.input.sam", "test3_comp.interval_list"}, }; }

Target:
public Object[][] dictionaries() { return new Object[][]{ new Object[]{"test1_comp.interval_list", "test1.dict"}, new Object[]{"test1.vcf", "test1.dict"}, new Object[]{"test1.dict", "test1.dict"}, new Object[]{"empty.interval_list", "test1.dict"}, new Object[]{"Homo_sapiens_assembly18.trimmed.fasta", "Homo_sapiens_assembly18.trimmed.dict"}, new Object[]{"test2_comp.interval_list", "Homo_sapiens_assembly18.trimmed.dict"}, new Object[]{"ScreenSamReads.100.input.sam", "test3_comp.interval_list"}, new Object[]{"ScreenSamReads.100.input.sam", "test4_comp.interval_list"}, }; }
Source:
private void detectContainersEvents() { executorService.execute(new Runnable() { @Override public void run() { while (true) { try { dockerConnector.getEvents(lastProcessedEventDate, 0, new Filters().withFilter("event", "die", "oom"), new EventsProcessor()); } catch (IOException ignore) { } } } }); }

Target:
private void detectContainersEvents() { executorService.execute(() -> { while (true) { try { dockerConnector.getEvents(lastProcessedEventDate, 0, new Filters().withFilter("event", "die", "oom"), new EventsProcessor()); } catch (IOException e) { LOG.debug(e.getLocalizedMessage(), e); } } }); }
Source:
public static RyaStreamsClient make( final String ryaInstance, final String kafkaHostname, final int kafkaPort) { requireNonNull(kafkaHostname); final Producer<?, QueryChange> queryProducer = makeProducer(kafkaHostname, kafkaPort, StringSerializer.class, QueryChangeSerializer.class); final Consumer<?, QueryChange>queryConsumer = fromStartConsumer(kafkaHostname, kafkaPort, StringDeserializer.class, QueryChangeDeserializer.class); final String changeLogTopic = KafkaTopics.queryChangeLogTopic(ryaInstance); final QueryChangeLog changeLog = new KafkaQueryChangeLog(queryProducer, queryConsumer, changeLogTopic); final QueryRepository queryRepo = new InMemoryQueryRepository(changeLog); return new RyaStreamsClient( new DefaultAddQuery(queryRepo), new DefaultGetQuery(queryRepo), new DefaultDeleteQuery(queryRepo), new KafkaGetQueryResultStream<>(kafkaHostname, "" + kafkaPort, VisibilityStatementDeserializer.class), new KafkaGetQueryResultStream<>(kafkaHostname, "" + kafkaPort, VisibilityBindingSetDeserializer.class), new DefaultListQueries(queryRepo), new DefaultStartQuery(queryRepo), new DefaultStopQuery(queryRepo)) { @Override public void close() { try { queryRepo.close(); } catch (final Exception e) { log.warn("Couldn't close a QueryRepository.", e); } } }; }

Target:
public static RyaStreamsClient make( final String ryaInstance, final String kafkaHostname, final int kafkaPort) { requireNonNull(ryaInstance); requireNonNull(kafkaHostname); final Producer<?, QueryChange> queryProducer = makeProducer(kafkaHostname, kafkaPort, StringSerializer.class, QueryChangeSerializer.class); final Consumer<?, QueryChange>queryConsumer = fromStartConsumer(kafkaHostname, kafkaPort, StringDeserializer.class, QueryChangeDeserializer.class); final String changeLogTopic = KafkaTopics.queryChangeLogTopic(ryaInstance); final QueryChangeLog changeLog = new KafkaQueryChangeLog(queryProducer, queryConsumer, changeLogTopic); final QueryRepository queryRepo = new InMemoryQueryRepository(changeLog); return new RyaStreamsClient( new DefaultAddQuery(queryRepo), new DefaultGetQuery(queryRepo), new DefaultDeleteQuery(queryRepo), new KafkaGetQueryResultStream<>(kafkaHostname, "" + kafkaPort, VisibilityStatementDeserializer.class), new KafkaGetQueryResultStream<>(kafkaHostname, "" + kafkaPort, VisibilityBindingSetDeserializer.class), new DefaultListQueries(queryRepo), new DefaultStartQuery(queryRepo), new DefaultStopQuery(queryRepo)) { @Override public void close() { try { queryRepo.close(); } catch (final Exception e) { log.warn("Couldn't close a QueryRepository.", e); } } }; }
Source:
public static User createUserEntity(String firstName, String lastName, String mobileNumber, String nickname, String vpnPassword) { MessageSource anonymousMessageSource = MessageSource.createInstance(); UserAnonymized johnAnonymized = UserAnonymized.createInstance(anonymousMessageSource.getDestination(), Collections.emptySet()); UserAnonymized.getRepository().save(johnAnonymized); byte[] initializationVector = CryptoSession.getCurrent().generateInitializationVector(); MessageSource namedMessageSource = MessageSource.createInstance(); UserPrivate userPrivate = UserPrivate.createInstance(nickname, vpnPassword, johnAnonymized.getId(), anonymousMessageSource.getId(), namedMessageSource); return new User(UUID.randomUUID(), initializationVector, firstName, lastName, mobileNumber, userPrivate, namedMessageSource.getDestination()); }

Target:
public static User createUserEntity(String firstName, String lastName, String mobileNumber, String nickname, String vpnPassword) { MessageSource anonymousMessageSource = MessageSource.createInstance(); UserAnonymized johnAnonymized = UserAnonymized.createInstance(anonymousMessageSource.getDestination(), Collections.emptySet()); UserAnonymized.getRepository().save(johnAnonymized); byte[] initializationVector = CryptoSession.getCurrent().generateInitializationVector(); MessageSource namedMessageSource = MessageSource.createInstance(); UserPrivate userPrivate = UserPrivate.createInstance(nickname, vpnPassword, johnAnonymized.getId(), anonymousMessageSource.getId(), namedMessageSource); User user = new User(UUID.randomUUID(), initializationVector, firstName, lastName, mobileNumber, userPrivate, namedMessageSource.getDestination()); return User.getRepository().save(user); }
Source:
public PartitionedFile finish() throws IOException { checkState(!isFinished, "File writer is already finished."); checkState(dataFileChannel != null && indexFileChannel != null, "Must open the partitioned file first."); isFinished = true; writeRegionIndex(); flushIndexBuffer(); indexBuffer.rewind(); dataFileChannel.close(); indexFileChannel.close(); ByteBuffer indexDataCache = canCacheAllIndexData ? indexBuffer : null; return new PartitionedFile(numRegions, numSubpartitions, dataFilePath, indexFilePath, indexDataCache); }

Target:
public PartitionedFile finish() throws IOException { checkState(!isFinished, "File writer is already finished."); checkState(!isClosed, "File writer is already closed."); isFinished = true; writeDataCache.flip(); if (writeDataCache.hasRemaining()) { BufferReaderWriterUtil.writeBuffer(dataFileChannel, writeDataCache); } writeDataCache = null; writeRegionIndex(); flushIndexBuffer(); indexBuffer.rewind(); close(); ByteBuffer indexEntryCache = null; if (allIndexEntriesCached) { indexEntryCache = indexBuffer; } indexBuffer = null; return new PartitionedFile( numRegions, numSubpartitions, dataFilePath, indexFilePath, indexEntryCache); }
Source:
boolean execute(boolean batched) throws SQLException { throwIfUnboundParameters(); if (!batched && statement.getOperation().isMutation() && !batch.isEmpty()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.EXECUTE_UPDATE_WITH_NON_EMPTY_BATCH) .build().buildException(); } if (statement.getOperation().isMutation()) { executeMutation(statement, createQueryLogger(statement,query)); return false; } executeQuery(statement, createQueryLogger(statement,query)); return true; }

Target:
boolean execute(boolean batched) throws SQLException { throwIfUnboundParameters(); if (!batched && statement.getOperation().isMutation() && !batch.isEmpty()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.EXECUTE_UPDATE_WITH_NON_EMPTY_BATCH) .build().buildException(); } if (statement.getOperation().isMutation()) { executeMutation(statement); return false; } executeQuery(statement, createQueryLogger(statement,query)); return true; }
Source:
private Scheduler getScheduler(Config schedulerConfig, ZoneId workflowTimeZone, boolean throwUnusedKeys) { Set<String> shouldBeUsedKeys = new HashSet<>(schedulerConfig.getKeys()); CheckedConfig.UsedKeysSet usedKeys = new CheckedConfig.UsedKeysSet(); Config c = new CheckedConfig(schedulerConfig, usedKeys); String type; if (c.has("_type")) { type = c.get("_type", String.class); } else { java.util.Optional<String> operatorKey = c.getKeys() .stream() .filter(key -> key.endsWith(">")) .findFirst(); if (!operatorKey.isPresent()) { throw new ConfigException("Schedule config requires 'type>: at' parameter: " + c); } type = operatorKey.get().substring(0, operatorKey.get().length() - 1); Object command = c.get(operatorKey.get(), Object.class); c.set("_type", type); c.set("_command", command); } for(String param : BUILT_IN_SCHEDULE_PARAMS){ usedKeys.add(param); } SchedulerFactory factory = types.get(type); if (factory == null) { throw new ConfigException("Unknown scheduler type: " + type); } if (!usedKeys.isAllUsed()) { shouldBeUsedKeys.removeAll(usedKeys); if (!shouldBeUsedKeys.isEmpty()) { for (String key: shouldBeUsedKeys) { if (throwUnusedKeys) throw new UnusedConfigException(getWarnUnusedKey(key, usedKeys)); else logger.error(getWarnUnusedKey(key, usedKeys)); } } } return factory.newScheduler(c, workflowTimeZone); }

Target:
private Scheduler getScheduler(Config schedulerConfig, ZoneId workflowTimeZone, boolean throwUnusedKeys) { Set<String> shouldBeUsedKeys = new HashSet<>(schedulerConfig.getKeys()); CheckedConfig.UsedKeysSet usedKeys = new CheckedConfig.UsedKeysSet(); Config c = new CheckedConfig(schedulerConfig, usedKeys); String type; if (c.has("_type")) { type = c.get("_type", String.class); } else { java.util.Optional<String> operatorKey = c.getKeys() .stream() .filter(key -> key.endsWith(">")) .findFirst(); if (!operatorKey.isPresent()) { throw new ConfigException("Schedule config requires 'type>: at' parameter: " + c); } type = operatorKey.get().substring(0, operatorKey.get().length() - 1); Object command = c.get(operatorKey.get(), Object.class); c.set("_type", type); c.set("_command", command); } for(String param : BUILT_IN_SCHEDULE_PARAMS){ usedKeys.add(param); } SchedulerFactory factory = types.get(type); if (factory == null) { throw new ConfigException("Unknown scheduler type: " + type); } if (!usedKeys.isAllUsed()) { shouldBeUsedKeys.removeAll(usedKeys); if (!shouldBeUsedKeys.isEmpty()) { StringBuilder buf = new StringBuilder(); for (String key: shouldBeUsedKeys) { buf.append(getWarnUnusedKey(key, usedKeys)); buf.append("\n"); } if (throwUnusedKeys) throw new UnusedConfigException(buf.toString()); else logger.error(buf.toString()); } } return factory.newScheduler(c, workflowTimeZone); }
Source:
public int get(int index) { return this.data[index] & 0xFFFF; }

Target:
public int get(int index) { return this.data[index]; }
Source:
Future<HeaderCacheElement> asyncRefresh() { LOG.trace("asyncRefresh"); synchronized (lock) { if (isRefreshing) { LOG.trace("asyncRefresh is already in progress"); return futureToken; } isRefreshing = true; LOG.trace("asyncRefresh taking ownership"); try { this.futureToken = executor.submit(new Callable<HeaderCacheElement>() { @Override public HeaderCacheElement call() throws Exception { try { HeaderCacheElement newToken = refreshCredentials(); return updateToken(newToken); } finally { futureToken = null; isRefreshing = false; } } }); } catch (RuntimeException e) { isRefreshing = false; throw e; } return this.futureToken; } }

Target:
Future<HeaderCacheElement> asyncRefresh() { LOG.trace("asyncRefresh"); synchronized (lock) { if (isRefreshing) { LOG.trace("asyncRefresh is already in progress"); return futureToken; } isRefreshing = true; LOG.trace("asyncRefresh taking ownership"); try { this.futureToken = executor.submit(new Callable<HeaderCacheElement>() { @Override public HeaderCacheElement call() throws Exception { HeaderCacheElement newToken = refreshCredentials(); return updateToken(newToken); } }); } catch (RuntimeException e) { isRefreshing = false; throw e; } return this.futureToken; } }
Source:
private void checkJWT() { RSAPrivateKey rsaPrivateKey = null; try { String pemFileContent = FileUtils .readFileToString(new File(gitHubPrimaryKeyFile), "UTF-8"); pemFileContent = pemFileContent .replaceAll("\\n", "") .replace("-----BEGIN PRIVATE KEY-----", "") .replace("-----END PRIVATE KEY-----", ""); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.getDecoder().decode(pemFileContent)); rsaPrivateKey = (RSAPrivateKey)keyFactory.generatePrivate(pkcs8EncodedKeySpec); } catch (IOException | NoSuchAlgorithmException | InvalidKeySpecException ex) { LOG.error(ex.getMessage()); } if (rsaPrivateKey != null) { final int tenMinutes = 600000; try { Algorithm algorithm = Algorithm.RSA256(null, rsaPrivateKey); String jsonWebToken = JWT.create() .withIssuer(gitHubAppId) .withIssuedAt(new Date()) .withExpiresAt(new Date(Calendar.getInstance().getTimeInMillis() + tenMinutes)) .sign(algorithm); CacheConfigManager.setJsonWebToken(jsonWebToken); } catch (JWTCreationException ex) { LOG.error(ex.getMessage()); } } }

Target:
private void checkJWT() { RSAPrivateKey rsaPrivateKey = null; try { String pemFileContent = FileUtils .readFileToString(new File(gitHubPrivateKeyFile), Charset.forName("UTF-8")); pemFileContent = pemFileContent .replaceAll("\\n", "") .replace("-----BEGIN PRIVATE KEY-----", "") .replace("-----END PRIVATE KEY-----", ""); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.getDecoder().decode(pemFileContent)); rsaPrivateKey = (RSAPrivateKey)keyFactory.generatePrivate(pkcs8EncodedKeySpec); } catch (IOException | NoSuchAlgorithmException | InvalidKeySpecException ex) { LOG.error(ex.getMessage(), ex); } if (rsaPrivateKey != null) { final int tenMinutes = 600000; try { Algorithm algorithm = Algorithm.RSA256(null, rsaPrivateKey); String jsonWebToken = JWT.create() .withIssuer(gitHubAppId) .withIssuedAt(new Date()) .withExpiresAt(new Date(Calendar.getInstance().getTimeInMillis() + tenMinutes)) .sign(algorithm); CacheConfigManager.setJsonWebToken(jsonWebToken); } catch (JWTCreationException ex) { LOG.error(ex.getMessage(), ex); } } }
Source:
void unzoom(final MUIElement element) { MWindow win = getWindowFor(element); Shell hostShell = (Shell) win.getWidget(); FaderAnimationFeedback fader = new FaderAnimationFeedback(hostShell); AnimationEngine engine = new AnimationEngine(win.getContext(), fader, 300); engine.schedule(); List<MUIElement> elementsToRestore = getElementsToRestore(element); for (MUIElement toRestore : elementsToRestore) { toRestore.getTags().remove(IPresentationEngine.MINIMIZED_BY_ZOOM); toRestore.getTags().remove(IPresentationEngine.MINIMIZED); } adjustCTFButtons(element); if (MPartStack.class.isInstance(element)) { MArea area = getAreaFor(MPartStack.class.cast(element)); if (area != null && area.getTags().contains(MAXIMIZEABLE_CHILDREN_TAG)) { MPlaceholder placeholder = area.getCurSharedRef(); ignoreTagChanges = true; placeholder.getTags().remove(MAXIMIZED); ignoreTagChanges = false; adjustCTFButtons(placeholder); } } partService.requestActivation(); }

Target:
void unzoom(final MUIElement element) { MWindow win = getWindowFor(element); Shell hostShell = (Shell) win.getWidget(); FaderAnimationFeedback fader = new FaderAnimationFeedback(hostShell); AnimationEngine engine = new AnimationEngine(win.getContext(), fader, 300); engine.schedule(); List<MUIElement> elementsToRestore = getElementsToRestore(element); for (MUIElement toRestore : elementsToRestore) { toRestore.getTags().remove(IPresentationEngine.MINIMIZED_BY_ZOOM); toRestore.getTags().remove(IPresentationEngine.MINIMIZED); } adjustCTFButtons(element); if (element instanceof MPartStack) { MArea area = getAreaFor((MPartStack) element); if (area != null && area.getTags().contains(MAXIMIZEABLE_CHILDREN_TAG)) { MPlaceholder placeholder = area.getCurSharedRef(); ignoreTagChanges = true; try { placeholder.getTags().remove(MAXIMIZED); } finally { ignoreTagChanges = false; } adjustCTFButtons(placeholder); } } partService.requestActivation(); }
Source:
HystrixInvocationHandler(Target<?> target, Map<Method, MethodHandler> dispatch, Object fallback) { this.target = checkNotNull(target, "target"); this.dispatch = checkNotNull(dispatch, "dispatch"); this.fallback = fallback; this.toFallback = toFallbackMethod(dispatch); }

Target:
HystrixInvocationHandler(Target<?> target, Map<Method, MethodHandler> dispatch, Object fallback) { this.target = checkNotNull(target, "target"); this.dispatch = checkNotNull(dispatch, "dispatch"); this.fallback = fallback; this.fallbackMethodMap = toFallbackMethod(dispatch); }
Source:
public String getComponentName() { if (this.beanName != null) { return "Final '" + this.beanName + "' channel"; } else { return "Unnamed final channel"; } }

Target:
public String getComponentName() { if (this.beanName != null) { return this.beanName; } else { return "Unnamed fixed subscriber channel"; } }
Source:
public Consumer createConsumer(Processor processor) { return new WekaConsumer(this, processor); }

Target:
public Consumer createConsumer(Processor processor) { throw new UnsupportedOperationException(); }
Source:
protected Collection<Address> getPossibleAddressesForInitialJoin() { long deadLine = System.nanoTime() + SECONDS.toNanos(maximumWaitingTimeBeforeJoinSeconds); for (int i = 0; System.nanoTime() - deadLine < 0; i++) { Collection<Address> possibleAddresses = getPossibleAddresses(); if (!possibleAddresses.isEmpty()) { return possibleAddresses; } idleStrategy.idle(i); } return Collections.emptyList(); }

Target:
protected Collection<Address> getPossibleAddressesForInitialJoin() { long deadLine = System.nanoTime() + SECONDS.toNanos(maximumWaitingTimeBeforeJoinSeconds); for (int i = 0; System.nanoTime() < deadLine; i++) { Collection<Address> possibleAddresses = getPossibleAddresses(); if (!possibleAddresses.isEmpty()) { return possibleAddresses; } idleStrategy.idle(i); } return Collections.emptyList(); }
Source:
public synchronized void join(long timeout) throws InterruptedException { long now = System.currentTimeMillis(); long end = now + timeout; while (now < end && (inClosed == null || outClosed == null)) { wait(now - end); now = System.currentTimeMillis(); } }

Target:
public synchronized void join(long timeout) throws InterruptedException { long now = System.nanoTime(); long end = now + TimeUnit.MILLISECONDS.toNanos(timeout); while ((end - now > 0L) && (inClosed == null || outClosed == null)) { wait(TimeUnit.NANOSECONDS.toMillis(end - now)); now = System.nanoTime(); } }
Source:
private void assertThatTimeAndLockMetricsAreRecorded(String timestampMetric, String lockMetric) { MetricRegistry metrics = MetricRegistries.createWithHdrHistogramReservoirs(); AtlasDbMetrics.setMetricRegistry(metrics); assertThat(metrics.timer(timestampMetric).getCount(), is(equalTo(0L))); assertThat(metrics.timer(lockMetric).getCount(), is(equalTo(0L))); TransactionManagers.LockAndTimestampServices lockAndTimestampServices = getLockAndTimestampServices(); lockAndTimestampServices.timelock().getFreshTimestamp(); lockAndTimestampServices.timelock().currentTimeMillis(); assertThat(metrics.timer(timestampMetric).getCount(), is(equalTo(1L))); assertThat(metrics.timer(lockMetric).getCount(), is(equalTo(1L))); }

Target:
private void assertThatTimeAndLockMetricsAreRecorded(String timestampMetric, String lockMetric) { assertThat(metricsRule.metrics().timer(timestampMetric).getCount(), is(equalTo(0L))); assertThat(metricsRule.metrics().timer(lockMetric).getCount(), is(equalTo(0L))); TransactionManagers.LockAndTimestampServices lockAndTimestampServices = getLockAndTimestampServices(); lockAndTimestampServices.timelock().getFreshTimestamp(); lockAndTimestampServices.timelock().currentTimeMillis(); assertThat(metricsRule.metrics().timer(timestampMetric).getCount(), is(equalTo(1L))); assertThat(metricsRule.metrics().timer(lockMetric).getCount(), is(equalTo(1L))); }
Source:
public String toString() { return "KafkaEmitterConfig{" + "bootstrap.servers='" + bootstrapServers + ", metric.topic=" + metricTopic + ", alert.topic=" + alertTopic + ", clusterName=" + clusterName + ", producer.config={" + kafkaProducerConfig.toString() + "}}"; }

Target:
public String toString() { return "KafkaEmitterConfig{" + "bootstrap.servers='" + bootstrapServers + '\'' + ", metric.topic='" + metricTopic + '\'' + ", alert.topic='" + alertTopic + '\'' + ", clusterName='" + clusterName + '\'' + ", Producer.config=" + kafkaProducerConfig + '}'; }