auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private DatePicker.OnDateChangedListener buildDateListener() { final Handler mainHandler = new Handler(getContext().getMainLooper()); final Runnable updateFormRelevancyRunnable = new Runnable() { @Override public void run() { widgetEntryChanged(); isRelevancyUpdateScheduled = false; } }; return new DatePicker.OnDateChangedListener() { @Override public void onDateChanged(DatePicker view, int year, int month, int day) { if (mPrompt.isReadOnly()) { setAnswer(); } else { Calendar c = Calendar.getInstance(); c.set(year, month, 1); int max = c.getActualMaximum(Calendar.DAY_OF_MONTH); if (day > max) { mDatePicker.updateDate(year, month, max); } else { if (!(mDatePicker.getDayOfMonth() == day && mDatePicker.getMonth() == month && mDatePicker.getYear() == year)) { mDatePicker.updateDate(year, month, day); } } } if (!isRelevancyUpdateScheduled) { mainHandler.postDelayed(updateFormRelevancyRunnable, 750); } } }; }

Target:
private DatePicker.OnDateChangedListener buildDateListener() { final Handler mainHandler = new Handler(getContext().getMainLooper()); final Runnable updateFormRelevancyRunnable = new Runnable() { @Override public void run() { widgetEntryChanged(); isRelevancyUpdateScheduled = false; } }; return new DatePicker.OnDateChangedListener() { @Override public void onDateChanged(DatePicker view, int year, int month, int day) { if (mPrompt.isReadOnly()) { setAnswer(); } else { Calendar c = Calendar.getInstance(); c.set(year, month, 1); int max = c.getActualMaximum(Calendar.DAY_OF_MONTH); if (day > max) { mDatePicker.updateDate(year, month, max); } else { if (!(mDatePicker.getDayOfMonth() == day && mDatePicker.getMonth() == month && mDatePicker.getYear() == year)) { mDatePicker.updateDate(year, month, day); } } } if (!isRelevancyUpdateScheduled) { isRelevancyUpdateScheduled = true; mainHandler.postDelayed(updateFormRelevancyRunnable, 750); } } }; }
Source:
public void close() throws IOException { backingStream.close(); if (onCloseAction != null) { onCloseAction.run(); } }

Target:
public void close() throws IOException { try { backingStream.close(); } finally { if (onCloseAction != null) { onCloseAction.run(); } } }
Source:
public ResponseEntity<Problem> noEventTypeException(final NoEventTypeException exception, final NativeWebRequest request) { return Responses.create(UNPROCESSABLE_ENTITY, exception.getMessage(), request); }

Target:
public ResponseEntity<Problem> noEventTypeException(final NoEventTypeException exception, final NativeWebRequest request) { return Responses.create(Response.Status.NOT_FOUND, exception.getMessage(), request); }
Source:
public void copy(Position other) { this.position = other.position; }

Target:
public void copy(Position other) { position = other.position.cpy(); }
Source:
public void testReboot() throws Exception { Set<? extends NodeMetadata> rebootNodes = client.rebootNodesMatching(inGroup(group)); for (ComputeMetadata node : rebootNodes) { assert node.getProviderId() != null : node; assert node.getLocation() != null : node; assertEquals(node.getType(), ComputeType.NODE); } testGet(); }

Target:
public void testReboot() throws Exception { Set<? extends NodeMetadata> rebootNodes = client.rebootNodesMatching(inGroup(group)); for (ComputeMetadata node : rebootNodes){ assertNotNull(node); assert node.getProviderId() != null : node; assert node.getLocation() != null : node; } testGet(); }
Source:
public static void fixNmMdAndUq(final SAMRecord record, final ReferenceSequenceFileWalker refSeqWalker, final boolean isBisulfiteSequence) { final byte[] referenceBases = refSeqWalker.get(refSeqWalker.getSequenceDictionary().getSequenceIndex(record.getReferenceName())).getBases(); SequenceUtil.calculateMdAndNmTags(record, referenceBases, true, !isBisulfiteSequence); if (isBisulfiteSequence) { record.setAttribute(SAMTag.NM.name(), SequenceUtil.calculateSamNmTag(record, referenceBases, 0, isBisulfiteSequence)); } if (record.getBaseQualities() != SAMRecord.NULL_QUALS) { calculateUq(record, refSeqWalker, isBisulfiteSequence); } }

Target:
public static void fixNmMdAndUq(final SAMRecord record, final ReferenceSequenceFileWalker refSeqWalker, final boolean isBisulfiteSequence) { final byte[] referenceBases = refSeqWalker.get(refSeqWalker.getSequenceDictionary().getSequenceIndex(record.getReferenceName())).getBases(); SequenceUtil.calculateMdAndNmTags(record, referenceBases, true, !isBisulfiteSequence); if (isBisulfiteSequence) { record.setAttribute(SAMTag.NM.name(), SequenceUtil.calculateSamNmTag(record, referenceBases, 0, isBisulfiteSequence)); } calculateUq(record, refSeqWalker, isBisulfiteSequence); }
Source:
public String getTableName() { return this.tableName; }

Target:
String getTableName() { return tableName; }
Source:
public void lex_generalInputs() { assertEquals(getTokens(""), Arrays.asList( new Token(TokenType.EOF, ""))); assertEquals(getTokens("a' b' c'"), Arrays.asList( new Token(TokenType.SYMBOL, "a'"), new Token(TokenType.SYMBOL, "b'"), new Token(TokenType.SYMBOL, "c'"), new Token(TokenType.EOF, ""))); }

Target:
public void lex_generalInputs() { assertEquals(tokenise(""), Arrays.asList( new Token(TokenType.EOF, ""))); assertEquals(tokenise("a' b' c'"), Arrays.asList( new Token(TokenType.SYMBOL, "a'"), new Token(TokenType.SYMBOL, "b'"), new Token(TokenType.SYMBOL, "c'"), new Token(TokenType.EOF, ""))); }
Source:
protected <T> void processBean(Bean<T> b) { Bean<T> bean = b; BeanManagerImpl beanManager = getOrCreateBeanDeployment(bean.getBeanClass()).getBeanManager(); ExternalBeanAttributesFactory.validateBeanAttributes(bean, beanManager); ContainerLifecycleEvents containerLifecycleEvents = beanManager.getServices().get(ContainerLifecycleEvents.class); if (bean instanceof Interceptor<?>) { beanManager.addInterceptor((Interceptor<?>) bean); } else if (bean instanceof Decorator<?>) { beanManager.addDecorator(CustomDecoratorWrapper.of((Decorator<?>) bean, beanManager)); } else { if (bean instanceof PassivationCapable) { PassivationCapable passivationCapable = (PassivationCapable) bean; if (passivationCapable.getId() == null) { throw new IllegalArgumentException("Passivation capable bean cannot have a null id: " + bean); } } beanManager.addBean(bean); } containerLifecycleEvents.fireProcessBean(beanManager, bean); }

Target:
protected <T> void processBean(Bean<T> b) { Bean<T> bean = b; BeanManagerImpl beanManager = getOrCreateBeanDeployment(bean.getBeanClass()).getBeanManager(); ExternalBeanAttributesFactory.validateBeanAttributes(bean, beanManager); ContainerLifecycleEvents containerLifecycleEvents = beanManager.getServices().get(ContainerLifecycleEvents.class); if (bean instanceof PassivationCapable) { PassivationCapable passivationCapable = (PassivationCapable) bean; if (passivationCapable.getId() == null) { throw new IllegalArgumentException(PASSIVATION_CAPABLE_BEAN_HAS_NULL_ID, bean); } } if (bean instanceof Interceptor<?>) { beanManager.addInterceptor((Interceptor<?>) bean); } else if (bean instanceof Decorator<?>) { beanManager.addDecorator(CustomDecoratorWrapper.of((Decorator<?>) bean, beanManager)); } else { beanManager.addBean(bean); } containerLifecycleEvents.fireProcessBean(beanManager, bean); }
Source:
public List<CodeSystem> getCodeSystems() { final CDOResource cdoResource = transaction.getOrCreateResource(getMetaRootResourceName()); return Lists.transform(cdoResource.getContents(), new UncheckedCastFunction<>(CodeSystem.class)); }

Target:
public List<CodeSystem> getCodeSystems() { final CDOResource cdoResource = transaction.getOrCreateResource(getMetaRootResourceName()); return FluentIterable.from(cdoResource.getContents()).filter(CodeSystem.class).toList(); }
Source:
public ActiveMQBuffer getDataBuffer() { ActiveMQBuffer buffer; try { if (isLargeMessage()) { LargeBodyEncoder encoder = getBodyEncoder(); encoder.open(); int bodySize = (int) encoder.getLargeBodySize(); buffer = new ChannelBufferWrapper(UnpooledByteBufAllocator.DEFAULT.heapBuffer(bodySize)); encoder.encode(buffer, bodySize); encoder.close(); } else { buffer = getReadOnlyBodyBuffer(); } if (Boolean.TRUE.equals(getBooleanProperty(Message.HDR_LARGE_COMPRESSED))) { buffer = inflate(buffer); } } catch (Exception e) { ActiveMQIOErrorException e2 = new ActiveMQIOErrorException(); e2.initCause(e); logger.warn(e.getMessage(), e); return getReadOnlyBodyBuffer(); } return buffer; }

Target:
public ActiveMQBuffer getDataBuffer() { ActiveMQBuffer buffer; try { if (isLargeMessage()) { buffer = getLargeMessageBuffer(); } else { buffer = getReadOnlyBodyBuffer(); } if (Boolean.TRUE.equals(getBooleanProperty(Message.HDR_LARGE_COMPRESSED))) { buffer = inflate(buffer); } } catch (Exception e) { logger.warn(e.getMessage(), e); return getReadOnlyBodyBuffer(); } return buffer; }
Source:
public boolean isSupported() { return SystemUtils.IS_OS_LINUX && gnomeLoginKeyring != null; }

Target:
public boolean isSupported() { return SystemUtils.IS_OS_LINUX && gnomeLoginKeyring.isPresent(); }
Source:
private void generateStructSupportClasses(StructType type) { generateStructSupportReader(type); generateStructSupportWriter(type); }

Target:
private void generateStructSupportClasses(StructType type) { generateStructReader(type); generateStructWriter(type); }
Source:
private void registerListeners() { final IWorkbench workbench = PlatformUI.getWorkbench(); workbench.getDisplay().asyncExec(new Runnable() { @Override public void run() { IWorkbenchWindow active = workbench.getActiveWorkbenchWindow(); if (active == null) return; CodanPartListener.installOnWindow(active); workbench.addWindowListener(new CodanWindowListener()); } }); }

Target:
private void registerListeners() { final IWorkbench workbench = PlatformUI.getWorkbench(); workbench.getDisplay().asyncExec(new Runnable() { @Override public void run() { for (IWorkbenchWindow window : workbench.getWorkbenchWindows()) { CodanPartListener.installOnWindow(window); } workbench.addWindowListener(new CodanWindowListener()); } }); }
Source:
public void statusesChanged(Collection<ResourceStatusChange> changes) { if (session != null) { if (SessionStatus.SYNC.equals(session.getStatus())) { marker = null; } } }

Target:
public void statusesChanged(Collection<ResourceStatusChange> changes) { if (session != null) { if (SessionStatus.SYNC == session.getStatus()) { marker = null; } } }
Source:
public PresenceStatus getPresenceStatusObject(Registration reg) { return clientStatusList.get(reg.getEndpoint()); }

Target:
private PresenceStatus getPresenceStatusObject(Registration reg) { return clientStatusList.get(reg.getEndpoint()); }
Source:
public void removeInstance(Object instance) { deployedCacheStores.put(instance.getClass().getName(), new CompletableFuture<>()); }

Target:
public void removeInstance(Object instance) { deployedCacheStores.remove(instance.getClass().getName()); }
Source:
protected List<String> getLdapServers(CLIParser parser, String domainName) throws ManageDomainsResult { String argValue = parser.getArg(Arguments.ldapServers.toString().toLowerCase()); if (StringUtils.isEmpty(argValue)) { LdapSRVLocator locator = new LdapSRVLocator(); DnsSRVResult ldapDnsResult = null; boolean foundServers = true; try { InetAddress ia = InetAddress.getByName(domainName); ia.getCanonicalHostName(); } catch (UnknownHostException e) { foundServers = false; } try { ldapDnsResult = locator.getLdapServers(domainName); if (!foundSrvRecords(ldapDnsResult)) { foundServers = false; } } catch (Exception ex) { foundServers = false; } if (!foundServers) { throw new ManageDomainsResult("Could not locate LDAP servers to be used to validate the input of the utility", ManageDomainsResultEnum.NO_LDAP_SERVERS_FOR_DOMAIN, domainName); } ArrayList<String> result = new ArrayList<String>(); for (int counter = 0; counter < ldapDnsResult.getNumOfValidAddresses(); counter++) { result.add(ldapDnsResult.getAddresses()[counter]); } return result; } return new ArrayList<String>(Arrays.asList(argValue.split(","))); }

Target:
protected List<String> getLdapServers(CLIParser parser, String domainName) throws ManageDomainsResult { String argValue = parser.getArg(Arguments.ldapServers.toString().toLowerCase()); if (StringUtils.isEmpty(argValue)) { LdapSRVLocator locator = new LdapSRVLocator(); DnsSRVResult ldapDnsResult = null; boolean foundServers = true; try { ldapDnsResult = locator.getLdapServers(domainName); if (!foundSrvRecords(ldapDnsResult)) { foundServers = false; } } catch (Exception ex) { foundServers = false; } if (!foundServers) { throw new ManageDomainsResult("Could not locate LDAP servers to be used to validate the input of the utility", ManageDomainsResultEnum.NO_LDAP_SERVERS_FOR_DOMAIN, domainName); } ArrayList<String> result = new ArrayList<String>(); for (int counter = 0; counter < ldapDnsResult.getNumOfValidAddresses(); counter++) { result.add(ldapDnsResult.getAddresses()[counter]); } return result; } else { for (String host: argValue.split(DOMAIN_SEPERATOR)) { try { InetAddress ia = InetAddress.getByName(host); ia.getCanonicalHostName(); } catch (UnknownHostException e) { log.error("Cannot resolve FQDN: " + e.getMessage()); } } } return new ArrayList<String>(Arrays.asList(argValue.split(DOMAIN_SEPERATOR))); }
Source:
private void makeManagerAddonVersionOlder(String homeAddonsDirPath) { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder; try { dBuilder = dbFactory.newDocumentBuilder(); File installedXml = new File(homeAddonsDirPath + "/installed.xml"); Document doc = dBuilder.parse(installedXml); Element documentElement = doc.getDocumentElement(); NodeList childNodes = documentElement.getElementsByTagName("addon"); for (int i = 0; i <= childNodes.getLength() - 1; i++) { Element item = (Element) childNodes.item(i); if (item.getNodeName().equals("addon")) { String addonName = item.getAttribute("name"); if (addonName.equals("org.jboss.forge.addon:addon-manager")) { item.setAttribute("version", FORGE_OLD_VERSION); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(installedXml); transformer.transform(source, result); return; } } } } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (Exception e) { System.out.println("Why?"); } return; }

Target:
private void makeManagerAddonVersionOlder(String homeAddonsDirPath) throws TransformerException, SAXException, IOException { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder; try { dBuilder = dbFactory.newDocumentBuilder(); File installedXml = new File(homeAddonsDirPath + "/installed.xml"); Document doc = dBuilder.parse(installedXml); Element documentElement = doc.getDocumentElement(); NodeList childNodes = documentElement.getElementsByTagName("addon"); for (int i = 0; i <= childNodes.getLength() - 1; i++) { Element item = (Element) childNodes.item(i); if (item.getNodeName().equals("addon")) { String addonName = item.getAttribute("name"); if (addonName.equals("org.jboss.forge.addon:addon-manager")) { item.setAttribute("version", FORGE_OLD_VERSION); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(installedXml); transformer.transform(source, result); return; } } } } catch (ParserConfigurationException e) { e.printStackTrace(); } return; }
Source:
private OrderSet orderSetBuilder(boolean orderSetRetired, boolean orderSetMemberRetired) { OrderSet orderSet = new OrderSet(); orderSet.setName("Test Order Set"); orderSet.setDescription("Test Order Set Description"); orderSet.setOperator(OrderSet.Operator.ALL); OrderSetMember orderSetMember = new OrderSetMember(); orderSetMember.setOrderType(orderService.getOrderType(100)); orderSetMember.setConcept(conceptService.getConcept(1000)); orderSetMember.setCreator(new User(1)); orderSetMember.setDateCreated(new Date()); orderSetMember.setRetired(orderSetMemberRetired); orderSetMember.setOrderSet(orderSet); List<OrderSetMember> orderSetMembers = new ArrayList<>(Arrays.asList(orderSetMember)); orderSet.setOrderSetMembers(orderSetMembers); orderSet.setCreator(new User(1)); orderSet.setDateCreated(new Date()); orderSet.setRetired(orderSetRetired); return orderSet; }

Target:
private OrderSet orderSetBuilder(boolean orderSetRetired, boolean orderSetMemberRetired) { OrderSet orderSet = new OrderSet(); orderSet.setName("Test Order Set"); orderSet.setDescription("Test Order Set Description"); orderSet.setOperator(OrderSet.Operator.ALL); OrderSetMember orderSetMember = new OrderSetMember(); orderSetMember.setOrderType(orderService.getOrderType(100)); orderSetMember.setConcept(conceptService.getConcept(1000)); orderSetMember.setCreator(new User(1)); orderSetMember.setDateCreated(new Date()); orderSetMember.setRetired(orderSetMemberRetired); orderSetMember.setOrderSet(orderSet); List<OrderSetMember> orderSetMembers = new ArrayList<>(Collections.singletonList(orderSetMember)); orderSet.setOrderSetMembers(orderSetMembers); orderSet.setCreator(new User(1)); orderSet.setDateCreated(new Date()); orderSet.setRetired(orderSetRetired); return orderSet; }
Source:
public void testBounds() { int low = fCondition.min(); assertEquals(LOW, low); int high = fCondition.max(); assertEquals(HIGH, high); }

Target:
public void testBounds() { assertEquals(LOW, (int) fCondition.min()); assertEquals(HIGH, (int) fCondition.max()); }
Source:
public void testCreateTableWithDefaultCFProperties() throws Exception { String tableName = generateUniqueName(); String schemaName = generateUniqueName(); String properties = "KEEP_DELETED_CELLS=TRUE, TTL=1209600, IMMUTABLE_STORAGE_SCHEME=ONE_CELL_PER_COLUMN, REPLICATION_SCOPE=1, DEFAULT_COLUMN_FAMILY=cv"; String pTableFullName = SchemaUtil.getQualifiedTableName(schemaName, tableName); String query = "create table " + pTableFullName + "(a_char CHAR(15) NOT NULL, " + "b_char CHAR(10) NOT NULL, " + "\"av\".\"_\" CHAR(1), " + "\"bv\".\"_\" CHAR(1), " + "\"cv\".\"_\" CHAR(1), " + "\"dv\".\"_\" CHAR(1) CONSTRAINT PK PRIMARY KEY (a_char, b_char)) " + properties; List<String> queries = new ArrayList<String>(){}; queries.add(query); String result = runSchemaExtractionTool(schemaName, tableName, null, queries); Assert.assertTrue(compareProperties(properties, getProperties(result))); }

Target:
public void testCreateTableWithDefaultCFProperties() throws Exception { String tableName = generateUniqueName(); String schemaName = generateUniqueName(); String properties = "KEEP_DELETED_CELLS=TRUE, TTL=1209600, IMMUTABLE_STORAGE_SCHEME=ONE_CELL_PER_COLUMN, REPLICATION_SCOPE=1, DEFAULT_COLUMN_FAMILY=cv, SALT_BUCKETS=16, MULTI_TENANT=true"; String pTableFullName = SchemaUtil.getQualifiedTableName(schemaName, tableName); String query = "create table " + pTableFullName + "(a_char CHAR(15) NOT NULL, " + "b_char CHAR(10) NOT NULL, " + "\"av\".\"_\" CHAR(1), " + "\"bv\".\"_\" CHAR(1), " + "\"cv\".\"_\" CHAR(1), " + "\"dv\".\"_\" CHAR(1) CONSTRAINT PK PRIMARY KEY (a_char, b_char)) " + properties; List<String> queries = new ArrayList<String>(){}; queries.add(query); String result = runSchemaExtractionTool(schemaName, tableName, null, queries); Assert.assertTrue(compareProperties(properties, getProperties(result))); }
Source:
public Thing createThing(ThingTypeUID thingTypeUID, Configuration configuration, ThingUID thingUID, ThingUID bridgeUID) { if (BridgeHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { ThingUID dSSUID = getBridgeThingUID(thingTypeUID, thingUID, configuration); if (dSSUID != null) { logger.info("{}", dSSUID.toString()); return super.createThing(thingTypeUID, configuration, dSSUID, null); } else { logger.error("Can't generate thing UID for thing type {}" + ", because digitalSTROM-Server is not reachable. Please check these points:\n" + "Are the server address and portnumber correct?\n" + "Is the server turned on?\n" + "Is the network configured correctly?", thingTypeUID); return null; } } if (DeviceHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { ThingUID dsDeviceUID = getDeviceUID(thingTypeUID, thingUID, configuration, bridgeUID); return super.createThing(thingTypeUID, configuration, dsDeviceUID, bridgeUID); } if (SceneHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { ThingUID dsSceneUID = getSceneUID(thingTypeUID, thingUID, configuration, bridgeUID); return super.createThing(thingTypeUID, configuration, dsSceneUID, bridgeUID); } throw new IllegalArgumentException( "The thing type " + thingTypeUID + " is not supported by the digitalSTROM binding."); }

Target:
public Thing createThing(ThingTypeUID thingTypeUID, Configuration configuration, ThingUID thingUID, ThingUID bridgeUID) { if (BridgeHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { ThingUID dSSUID = getBridgeThingUID(thingTypeUID, thingUID, configuration); if (dSSUID != null) { logger.info("{}", dSSUID); return super.createThing(thingTypeUID, configuration, dSSUID, null); } else { logger.error("Can't generate thing UID for thing type {}" + ", because digitalSTROM-Server is not reachable. Please check these points:\n" + "Are the server address and portnumber correct?\n" + "Is the server turned on?\n" + "Is the network configured correctly?", thingTypeUID); return null; } } if (DeviceHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { ThingUID dsDeviceUID = getDeviceUID(thingTypeUID, thingUID, configuration, bridgeUID); return super.createThing(thingTypeUID, configuration, dsDeviceUID, bridgeUID); } if (SceneHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { ThingUID dsSceneUID = getSceneUID(thingTypeUID, thingUID, configuration, bridgeUID); return super.createThing(thingTypeUID, configuration, dsSceneUID, bridgeUID); } throw new IllegalArgumentException( "The thing type " + thingTypeUID + " is not supported by the digitalSTROM binding."); }
Source:
private void updateNotification() { final boolean tetheringInactive = mDownstreamTypesMask <= DOWNSTREAM_NONE; synchronized (mUpdateLock) { if (mTetheringRestricted) { setupRestrictedNotification(); } else if (tetheringInactive) { clearNotification(); } else { if (setupNotification()) { return; } clearNotification(); } } }

Target:
private void updateNotification() { synchronized (mUpdateLock) { final boolean tetheringInactive = mDownstreamTypesMask <= DOWNSTREAM_NONE; if (tetheringInactive) { clearNotification(); } else { if (setupNotification()) { return; } clearNotification(); } } }
Source:
public ApplyPmmlModelCommand(PMMLRequestData requestData, Boolean hasMining) { this.requestData = requestData; this.hasMining = hasMining; }

Target:
public ApplyPmmlModelCommand(PMMLRequestData requestData, Boolean hasMining) { initialize(requestData, hasMining); }
Source:
public synchronized boolean seek(final CtfLocationInfo ctfLocationData) { boolean ret = false; if (curLocation.getLocationInfo().compareTo(ctfLocationData) == 0) { return super.hasMoreEvents(); } long currTimestamp = ctfLocationData.getTimestamp(); final long offsetTimestamp = this.getCtfTmfTrace().getCTFTrace().timestampNanoToCycles(currTimestamp); if (offsetTimestamp < 0) { ret = super.seek(0L); } else { ret = super.seek(offsetTimestamp); } long index = 0; final CtfTmfEvent currentEvent = this.getCurrentEvent(); if (currentEvent != null) { currTimestamp = currentEvent.getTimestamp().getValue(); for (long i = 0; i < ctfLocationData.getIndex(); i++) { if (currTimestamp == currentEvent.getTimestamp().getValue()) { index++; } else { index = 0; } this.advance(); } } else { ret = false; } if (ret) { curLocation = new CtfLocation(new CtfLocationInfo(getCurrentEvent().getTimestamp().getValue(), index)); } else { curLocation = NULL_LOCATION; } return ret; }

Target:
public synchronized boolean seek(final CtfLocationInfo ctfLocationData) { boolean ret = false; if (curLocation.getLocationInfo().equals(ctfLocationData)) { return super.hasMoreEvents(); } long currTimestamp = ctfLocationData.getTimestamp(); final long offsetTimestamp = this.getCtfTmfTrace().getCTFTrace().timestampNanoToCycles(currTimestamp); if (offsetTimestamp < 0) { ret = super.seek(0L); } else { ret = super.seek(offsetTimestamp); } long index = 0; final CtfTmfEvent currentEvent = this.getCurrentEvent(); if (currentEvent != null) { currTimestamp = currentEvent.getTimestamp().getValue(); for (long i = 0; i < ctfLocationData.getIndex(); i++) { if (currTimestamp == currentEvent.getTimestamp().getValue()) { index++; } else { index = 0; } this.advance(); } } else { ret = false; } if (ret) { curLocation = new CtfLocation(new CtfLocationInfo(getCurrentEvent().getTimestamp().getValue(), index)); } else { curLocation = NULL_LOCATION; } return ret; }
Source:
public DebuggingContext disableDebugMode(IDeploymentConfig deploymentConfig, DebuggingContext debugContext, IProgressMonitor monitor) throws CoreException { assert deploymentConfig != null; assert debugContext != null; IDebugListener listener = debugContext.getDebugListener(); if (listener != null) { IPod pod = getFirstPod(deploymentConfig); debugContext.setPod(pod); listener.onDebugChange(debugContext, monitor); } if (debugContext.isDebugEnabled()) { debugContext.setDebugEnabled(false); updateDebugConfig(deploymentConfig, debugContext, monitor); } return debugContext; }

Target:
public DebuggingContext disableDebugMode(IDeploymentConfig deploymentConfig, DebuggingContext debugContext, IProgressMonitor monitor) throws CoreException { Assert.isNotNull(deploymentConfig); Assert.isNotNull(debugContext); IDebugListener listener = debugContext.getDebugListener(); if (listener != null) { IPod pod = getFirstPod(deploymentConfig); debugContext.setPod(pod); listener.onDebugChange(debugContext, monitor); } if (debugContext.isDebugEnabled()) { debugContext.setDebugEnabled(false); updateDebugConfig(deploymentConfig, debugContext, monitor); } return debugContext; }
Source:
public synchronized void init() { if (!initialized) { initializeRouteMatcher(); if (!isRunningFromServlet()) { new Thread(() -> { EmbeddedServers.initialize(); if (embeddedServerIdentifier == null) { embeddedServerIdentifier = EmbeddedServers.defaultIdentifier(); } server = EmbeddedServers.create(embeddedServerIdentifier, routes, staticFilesConfiguration, hasMultipleHandlers()); server.configureWebSockets(webSocketHandlers, webSocketIdleTimeoutMillis); port = server.ignite( ipAddress, port, sslStores, maxThreads, minThreads, threadIdleTimeoutMillis); try { latch.countDown(); server.join(); } catch (InterruptedException e) { LOG.error("server interrupted", e); } }).start(); } initialized = true; } }

Target:
public synchronized void init() { if (!initialized) { initializeRouteMatcher(); if (!isRunningFromServlet()) { new Thread(() -> { EmbeddedServers.initialize(); if (embeddedServerIdentifier == null) { embeddedServerIdentifier = EmbeddedServers.defaultIdentifier(); } server = EmbeddedServers.create(embeddedServerIdentifier, routes, staticFilesConfiguration, hasMultipleHandlers()); server.configureWebSockets(webSocketHandlers, webSocketIdleTimeoutMillis); port = server.ignite( ipAddress, port, sslStores, maxThreads, minThreads, threadIdleTimeoutMillis); try { latch.countDown(); server.join(); } catch (InterruptedException e) { LOG.error("server interrupted", e); Thread.currentThread().interrupt(); } }).start(); } initialized = true; } }
Source:
public void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { if (!getLeft().getSchema().compatible(getRight().getSchema())) { throw new DbException("Incompatible input schemas"); } tupleIndices = new IntObjectOpenHashMap<IntArrayList>(); tuplesToRemove = new MutableTupleBuffer(getSchema()); }

Target:
public void init(final ImmutableMap<String, Object> execEnvVars) throws DbException { if (!getLeft().getSchema().compatible(getRight().getSchema())) { throw new DbException("Incompatible input schemas"); } tupleIndices = new IntObjectHashMap<>(); tuplesToRemove = new MutableTupleBuffer(getSchema()); }
Source:
private void discoverHostName_SelectedItemChanged() { if (Boolean.TRUE.equals(getIsDiscoveredHosts().getEntity())) { ExternalDiscoveredHost dhost = (ExternalDiscoveredHost) getExternalDiscoveredHosts().getSelectedItem(); ExternalHostGroup dhg = (ExternalHostGroup) getExternalHostGroups().getSelectedItem(); VDS vds = new VDS(); if (dhost != null && dhg != null) { vds.setVdsName(dhost.getName()); vds.setHostName(dhost.getName() + "." + (dhg.getDomainName() != null ? dhg.getDomainName() : constants.empty())); } updateModelFromVds(vds, null, false, null); } }

Target:
private void discoverHostName_SelectedItemChanged() { if (Boolean.TRUE.equals(getIsDiscoveredHosts().getEntity())) { ExternalDiscoveredHost dhost = (ExternalDiscoveredHost) getExternalDiscoveredHosts().getSelectedItem(); ExternalHostGroup dhg = (ExternalHostGroup) getExternalHostGroups().getSelectedItem(); VDS vds = new VDS(); if (dhost != null && dhg != null) { vds.setVdsName(dhost.getName()); vds.setHostName(dhost.getName() + "." + (dhg.getDomainName() != null ? dhg.getDomainName() : "")); } updateModelFromVds(vds, null, false, null); } }
Source:
private void indexFile(IndexWriter indexWriter, String inputFile) throws IOException { System.out.println("Indexing " + inputFile); int lineCount = 0; for (String line : Files.readAllLines(Paths.get(inputFile))) { Document doc = new Document(); doc.add(new TextField(Lucene.FIELD_NAME, line, Field.Store.YES)); doc.add(new TextField(Lucene.FIELD_NAME_LOWERCASE, line.toLowerCase(), Field.Store.YES)); indexWriter.addDocument(doc); if (++lineCount % 10_000 == 0) { System.out.println(lineCount + "..."); } } }

Target:
private void indexFile(IndexWriter indexWriter, String inputFile) throws IOException { System.out.println("Indexing " + inputFile); int lineCount = 0; try (BufferedReader br = Files.newBufferedReader(Paths.get(inputFile))) { String line; while ((line = br.readLine()) != null) { Document doc = new Document(); doc.add(new TextField(Lucene.FIELD_NAME, line, Field.Store.YES)); doc.add(new TextField(Lucene.FIELD_NAME_LOWERCASE, line.toLowerCase(), Field.Store.YES)); indexWriter.addDocument(doc); if (++lineCount % 10_000 == 0) { System.out.println(lineCount + "..."); } } } }
Source:
public void test() throws Exception { String projectKey = TSPROJECT; SonarScanner build = SonarScanner.create() .setProjectKey(projectKey) .setSourceEncoding("UTF-8") .setSourceDirs(".") .setProjectDir(PROJECT_DIR); Tests.setProfile(projectKey, "eslint-based-rules-profile", "ts"); TestUtils.npmInstall(PROJECT_DIR); orchestrator.executeBuild(build); SearchRequest request = new SearchRequest(); request .setComponentKeys(Collections.singletonList(TSPROJECT)) .setRules(ImmutableList.of("typescript:S3923")); List<Issues.Issue> issuesList = newWsClient().issues().search(request).getIssuesList(); assertThat(issuesList).hasSize(1); assertThat(issuesList.get(0).getLine()).isEqualTo(2); assertThat(Tests.getMeasureAsInt(TSPROJECT, "ncloc")).isEqualTo(7); assertThat(Tests.getMeasureAsInt(TSPROJECT, "classes")).isEqualTo(0); assertThat(Tests.getMeasureAsInt(TSPROJECT, "functions")).isEqualTo(1); assertThat(Tests.getMeasureAsInt(TSPROJECT, "statements")).isEqualTo(4); assertThat(Tests.getMeasureAsInt(TSPROJECT, "comment_lines")).isEqualTo(1); assertThat(Tests.getMeasureAsDouble(TSPROJECT, "duplicated_lines")).isEqualTo(0.0); assertThat(Tests.getMeasureAsDouble(TSPROJECT, "duplicated_blocks")).isEqualTo(0.0); assertThat(Tests.getMeasureAsDouble(TSPROJECT, "duplicated_files")).isEqualTo(0.0); }

Target:
public void test() throws Exception { String projectKey = "tsproject"; SonarScanner build = SonarScanner.create() .setProjectKey(projectKey) .setSourceEncoding("UTF-8") .setSourceDirs(".") .setProjectDir(PROJECT_DIR); Tests.setProfile(projectKey, "eslint-based-rules-profile", "ts"); BuildResult result = orchestrator.executeBuild(build); List<Issues.Issue> issuesList = getIssues(projectKey + ":sample.lint.ts"); assertThat(issuesList).hasSize(1); assertThat(issuesList.get(0).getLine()).isEqualTo(2); String sampleFileKey = projectKey + ":sample.lint.ts"; assertThat(Tests.getMeasureAsInt(sampleFileKey, "ncloc")).isEqualTo(7); assertThat(Tests.getMeasureAsInt(sampleFileKey, "classes")).isEqualTo(0); assertThat(Tests.getMeasureAsInt(sampleFileKey, "functions")).isEqualTo(1); assertThat(Tests.getMeasureAsInt(sampleFileKey, "statements")).isEqualTo(4); assertThat(Tests.getMeasureAsInt(sampleFileKey, "comment_lines")).isEqualTo(1); assertThat(Tests.getMeasureAsDouble(projectKey, "duplicated_lines")).isEqualTo(111.0); assertThat(Tests.getMeasureAsDouble(projectKey, "duplicated_blocks")).isEqualTo(2.0); assertThat(Tests.getMeasureAsDouble(projectKey, "duplicated_files")).isEqualTo(1.0); issuesList = getIssues(projectKey + ":nosonar.lint.ts"); assertThat(issuesList).hasSize(1); assertThat(result.getLogsLines(log -> log.contains("Found 1 tsconfig.json file(s)"))).hasSize(1); }
Source:
default ModelNode execute(Operation operation, OperationMessageHandler messageHandler) throws IOException { OperationResponse or = executeOperation(operation, messageHandler); ModelNode result = or.getResponseNode(); or.close(); return result; }

Target:
default ModelNode execute(Operation operation, OperationMessageHandler messageHandler) throws IOException { try (OperationResponse or = executeOperation(operation, messageHandler)) { return or.getResponseNode(); } }
Source:
public void afterRun() throws Exception { long elapsed = Math.max(0, Timer.nanosElapsed(startTimeNanos)); MultiMapService service = getService(); service.getLocalMultiMapStatsImpl(name).incrementRemoveLatencyNanos(elapsed); if (removed != null) { for (MultiMapRecord record : removed) { publishEvent(EntryEventType.REMOVED, dataKey, null, record.getObject()); } } }

Target:
public void afterRun() throws Exception { long elapsedNanos = Math.max(0, Timer.nanosElapsed(startTimeNanos)); MultiMapService service = getService(); service.getLocalMultiMapStatsImpl(name).incrementRemoveLatencyNanos(elapsedNanos); if (removed != null) { for (MultiMapRecord record : removed) { publishEvent(EntryEventType.REMOVED, dataKey, null, record.getObject()); } } }
Source:
public <A> void assertIsEqualToComparingFieldByFieldRecursively(AssertionInfo info, A actual, A other) { assertNotNull(info, actual); assertHasSameClassAs(info, actual, other); if (!DeepEquals.deepEquals(actual, other)) throw failures.failure(info, shouldBeEqual(actual, other, StandardRepresentation.STANDARD_REPRESENTATION)); }

Target:
public <A> void assertIsEqualToComparingFieldByFieldRecursively(AssertionInfo info, A actual, A other) { assertNotNull(info, actual); List<Difference> differences = DeepDifference.determineDifferences(actual, other); if (!differences.isEmpty()) { throw failures.failure(info, ShouldBeEqualByComparingFieldByFieldRecursive.shouldBeEqualComparingOnlyGivenFields(actual, other, differences)); } }
Source:
private void doUpdateTimeZone(final String selectedTimeZone) { TimeZoneModel.withLoadedTimeZones(getTimeZoneType(), new Runnable() { @Override public void run() { final Iterable<TimeZoneModel> timeZones = TimeZoneModel.getTimeZones(getTimeZoneType()); getModel().getTimeZone().setItems(timeZones); getModel().getTimeZone().setSelectedItem(Linq.firstOrDefault(timeZones, new Linq.TimeZonePredicate(selectedTimeZone))); getModel().getTimeZone().setIsChangable(!getModel().getIsLinuxOS()); getModel().getTimeZone().setTitle(getModel().getIsLinuxOS() ? constants.timeZoneNotChangeableForLinuxVms() : ""); } }); }

Target:
private void doUpdateTimeZone(final String selectedTimeZone) { TimeZoneModel.withLoadedTimeZones(getTimeZoneType(), new Runnable() { @Override public void run() { final Iterable<TimeZoneModel> timeZones = TimeZoneModel.getTimeZones(getTimeZoneType()); getModel().getTimeZone().setItems(timeZones); getModel().getTimeZone().setSelectedItem(Linq.firstOrDefault(timeZones, new Linq.TimeZonePredicate(selectedTimeZone))); getModel().getTimeZone().setChangeProhibitionReason(constants.timeZoneNotChangeableForLinuxVms()); getModel().getTimeZone().setIsChangable(!getModel().getIsLinuxOS()); } }); }
Source:
Classpath toClasspath(final Path f, final boolean isSourceOnly, final String encoding) throws IllegalAccessException, InvocationTargetException; } static { ClasspathAccessor accessor = (f, isSourceOnly, encoding) -> { throw new SdkException("getClasspath method on FileSystem.class could not be found"); }; try { Method getClasspath = FileSystem.class.getMethod("getClasspath", String.class, String.class, boolean.class, AccessRuleSet.class, String.class, Map.class, String.class); accessor = (f, isSourceOnly, encoding) -> (Classpath) getClasspath.invoke(null, f.toString(), encoding, isSourceOnly, null, null, null, null); } catch (NoSuchMethodException nsme) { SdkLog.debug("Fallback to legacy ECJ", nsme); try { Method getClasspath = FileSystem.class.getMethod("getClasspath", String.class, String.class, boolean.class, AccessRuleSet.class, String.class, Map.class); accessor = (f, isSourceOnly, encoding) -> (Classpath) getClasspath.invoke(null, f.toString(), encoding, isSourceOnly, null, null, null); } catch (NoSuchMethodException e) { throw new SdkException(e); } } CLASSPATH_ACCESSOR = accessor; }

Target:
private static Classpath toClasspath(final Path f, final boolean isSourceOnly, final String encoding) { if (f == null || !Files.isReadable(f)) { return null; } try { return CLASSPATH_ACCESSOR.toClasspath(f, isSourceOnly, encoding); } catch (final IllegalArgumentException | ReflectiveOperationException e) { throw new SdkException(e); } }
Source:
private void setupAskHandler() { final StageActivity currentStage = this; messageHandler = new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message message) { ArrayList<Object> params = (ArrayList<Object>) message.obj; switch (message.what) { case ASK_MESSAGE: showDialog((String) params.get(1), (AskAction) params.get(0)); break; case REGISTER_INTENT: currentStage.queueIntent((IntentListener) params.get(0)); break; case PERFORM_INTENT: currentStage.startQueuedIntent((Integer) params.get(0)); break; default: Log.e(TAG,"Unhandled message in messagehandler, case "+message.what); } } }; }

Target:
private void setupAskHandler() { final StageActivity currentStage = this; messageHandler = new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message message) { List<Object> params = (ArrayList<Object>) message.obj; switch (message.what) { case ASK_MESSAGE: showDialog((String) params.get(1), (AskAction) params.get(0)); break; case REGISTER_INTENT: currentStage.queueIntent((IntentListener) params.get(0)); break; case PERFORM_INTENT: currentStage.startQueuedIntent((Integer) params.get(0)); break; default: Log.e(TAG, "Unhandled message in messagehandler, case " + message.what); break; } } }; }
Source:
public static Blob blobFromKey(String key) { try { int colon = key.indexOf(':'); if (colon < 0) { throw new NuxeoException("invalid blob key format"); } String providerId = key.substring(0, colon); BlobProvider blobProvider = Framework.getService(BlobManager.class).getBlobProvider(providerId); BlobInfo blobInfo = new BlobInfo(); blobInfo.key = key; if (blobProvider.performsAccessControl(blobInfo)) { return blobProvider.readBlob(blobInfo); } else { throw new NuxeoException("blob provider " + providerId + " does not perform access control"); } } catch (IOException e) { return null; } }

Target:
public static Blob blobFromKey(String key) { try { int colon = key.indexOf(':'); if (colon < 0) { throw new NuxeoException("Invalid blob key format: " + key); } String providerId = key.substring(0, colon); BlobProvider blobProvider = Framework.getService(BlobManager.class).getBlobProvider(providerId); BlobInfo blobInfo = new BlobInfo(); blobInfo.key = key; if (blobProvider.performsExternalAccessControl(blobInfo)) { return blobProvider.readBlob(blobInfo); } else { throw new NuxeoException("BlobProvider " + providerId + " cannot perform access control for key: " + key); } } catch (IOException e) { throw new NuxeoException(e); } }
Source:
public void testSecureGetHandshakeTimeout() throws Exception { createEndpoint(); CoapClient client = new CoapClient("coaps", InetAddress.getLoopbackAddress().getHostAddress(), TestTools.findFreePort()); CountingHandler handler = new CountingHandler(); client.get(handler); handler.waitForLoadCalls(1, 1000, TimeUnit.MILLISECONDS); Assert.assertEquals("An error is expected", 1, handler.errorCalls.get()); assertAllExchangesAreCompleted(coapTestEndpoint); }

Target:
public void testSecureGetHandshakeTimeout() throws Exception { try (DatagramSocket datagramSocket = new DatagramSocket(0)) { int freePort = datagramSocket.getLocalPort(); createEndpoint(); CoapClient client = new CoapClient("coaps", InetAddress.getLoopbackAddress().getHostAddress(), freePort); CountingHandler handler = new CountingHandler(); client.get(handler); handler.waitForErrorCalls(1, 1000, TimeUnit.MILLISECONDS); Assert.assertEquals("An error is expected", 1, handler.errorCalls.get()); assertAllExchangesAreCompleted(coapTestEndpoint); } }
Source:
public void onStart() { monitorSessionThread = new MonitorSessionThread(this, host, port, passwd); m_last_bus_scan = new Date( (new Date()).getTime() - (1000 * m_bus_scan_interval_secs) + (1000 * m_first_scan_delay_secs)); monitorSessionThread.start(); logger.info("Connected to [" + host + ":" + port + "], Rescan bus every [" + m_bus_scan_interval_secs + "] seconds, first scan over [" + (((new Date()).getTime() - m_last_bus_scan.getTime()) / 1000) + "] seconds, max. heating zones: [" + m_heating_zones + "]"); start(); }

Target:
public void onStart() { monitorSessionThread = new MonitorSessionThread(this, host, port, passwd); m_last_bus_scan = new Date( (new Date()).getTime() - (1000 * m_bus_scan_interval_secs) + (1000 * m_first_scan_delay_secs)); monitorSessionThread.start(); logger.info( "Connected to [{}:{}], Rescan bus every seconds, first scan over seconds, max. heating zones: [{}], Shutter run time msecs", host, port, m_bus_scan_interval_secs, (((new Date()).getTime() - m_last_bus_scan.getTime()) / 1000), m_heating_zones, m_shutter_run_msecs); start(); }
Source:
private ClockProvider createClockProvider(Configuration<?> config) { BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration(); String clockProviderFqcn = bootstrapConfiguration.getClockProviderClassName(); if ( clockProviderFqcn == null ) { return config.getDefaultClockProvider(); } @SuppressWarnings("unchecked") Class<ClockProvider> clockProviderClass = (Class<ClockProvider>) run( LoadClass.action( clockProviderFqcn, null ) ); return createInstance( clockProviderClass ); }

Target:
private ClockProvider createClockProvider(Configuration<?> config) { BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration(); String clockProviderFqcn = bootstrapConfiguration.getClockProviderClassName(); if ( clockProviderFqcn == null ) { return config.getDefaultClockProvider(); } @SuppressWarnings("unchecked") Class<? extends ClockProvider> clockProviderClass = (Class<? extends ClockProvider>) run( LoadClass.action( clockProviderFqcn, null ) ); return createInstance( clockProviderClass ); }
Source:
public String getUnifiedDiff() { StringBuilder detail = new StringBuilder(); if (patchSet != null) { ByteArrayOutputStream out = new ByteArrayOutputStream(); DiffFormatter df = new DiffFormatter(out); db = openRepository(); reader = db.newObjectReader(); PatchList patchList = getPatchList(); for (PatchListEntry p : patchList.getPatches()) { if (Patch.COMMIT_MSG.equals(p.getNewName())) { continue; } detail.append("\n"); List<String> headers = p.getHeaderLines(); for (String hdr : headers) { detail.append(hdr); } try { String filename = p.getNewName(); RawText aText = resolve(patchList.getOldId(), filename); RawText bText = resolve(patchList.getNewId(), filename); df.format(toEditList(p.getEdits()), aText, bText); detail.append(out.toString()); } catch (IOException err) { } } detail.append("\n"); } return detail.toString(); }

Target:
public String getUnifiedDiff() { ByteArrayOutputStream out = new ByteArrayOutputStream(); Repository repo = openRepository(); if (repo != null) { DiffFormatter df = new DiffFormatter(out); df.setRepository(repo); df.setDetectRenames(true); try { PatchList patchList = getPatchList(); df.format(patchList.getOldId(), patchList.getNewId()); } catch (IOException e) { log.error("Cannot format patch", e); } finally { df.release(); } } return RawParseUtils.decode(out.toByteArray()); }
Source:
private static JsonParserIterator<TaskStatusPlus> getTasks( DruidLeaderClient indexingServiceClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler ) { Request request; try { request = indexingServiceClient.makeRequest( HttpMethod.GET, StringUtils.format("/druid/indexer/v1/tasks") ); } catch (IOException e) { throw new RuntimeException(e); } ListenableFuture<InputStream> future = indexingServiceClient.goStream( request, responseHandler ); try { future.get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } if (responseHandler.getStatus() != HttpServletResponse.SC_OK) { throw new ISE( "Error while fetching tasks status[%s] description[%s]", responseHandler.status, responseHandler.description ); } final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<TaskStatusPlus>() { }); JsonParserIterator<TaskStatusPlus> iterator = new JsonParserIterator<>( typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper ); return iterator; }

Target:
private static JsonParserIterator<TaskStatusPlus> getTasks( DruidLeaderClient indexingServiceClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler ) { Request request; try { request = indexingServiceClient.makeRequest( HttpMethod.GET, StringUtils.format("/druid/indexer/v1/tasks") ); } catch (IOException e) { throw new RuntimeException(e); } ListenableFuture<InputStream> future = indexingServiceClient.goAsync( request, responseHandler ); final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<TaskStatusPlus>() { }); return new JsonParserIterator<>( typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper ); }
Source:
public void testDisposeCallsUnregisterForIccRefresh() { verify(mMockCI).registerForIccRefresh(any(IccRecords.class), eq(IccRecords.EVENT_REFRESH), isNull()); mIccRecords.dispose(); verify(mMockCI).unregisterForIccRefresh(any(IccRecords.class)); }

Target:
public void testDisposeCallsUnregisterForIccRefresh() { verify(mSimulatedCommandsVerifier).registerForIccRefresh(eq(mIccRecords), eq(IccRecords.EVENT_REFRESH), isNull()); mIccRecords.dispose(); verify(mSimulatedCommandsVerifier).unregisterForIccRefresh(eq(mIccRecords)); }
Source:
public synchronized String createNonce(Repository repo, long timestamp) throws IllegalStateException { String path; if (repo instanceof DfsRepository) path = ((DfsRepository) repo).getDescription().getRepositoryName(); else if (repo.getDirectory() != null) path = repo.getDirectory().getPath(); else throw new IllegalStateException(); String input = path + ":" + String.valueOf(timestamp); byte[] rawHmac; try { rawHmac = mac.doFinal(input.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } StringBuilder sentNonceBuilder = new StringBuilder(); sentNonceBuilder.append(String.format("%d-", new Long(timestamp))); for (byte b : rawHmac) { sentNonceBuilder.append(String.format("%02x", Byte.valueOf(b))); } return sentNonceBuilder.toString(); }

Target:
public synchronized String createNonce(Repository repo, long timestamp) throws IllegalStateException { String path; if (repo instanceof DfsRepository) path = ((DfsRepository) repo).getDescription().getRepositoryName(); else if (repo.getDirectory() != null) path = repo.getDirectory().getPath(); else throw new IllegalStateException(); String input = path + ":" + String.valueOf(timestamp); byte[] rawHmac; try { rawHmac = mac.doFinal(input.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } return String.format("%d-%s", Long.valueOf(timestamp), toHex(rawHmac)); }
Source:
public void start() throws Throwable { CleanupJob job; while ( (job = jobs.poll()) != null ) { jobScheduler.schedule( recoveryCleanup, job ); } }

Target:
public void start() throws Throwable { jobScheduler.schedule( recoveryCleanup, allJobs() ); }