auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public SubTabHostGeneralHostErrataPresenter(EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, DetailTabModelProvider<HostListModel<Void>, HostErrataCountModel> errataCountModelProvider) { super(eventBus, view, proxy, placeManager, errataCountModelProvider, HostGeneralSubTabPanelPresenter.TYPE_SetTabContent); currentErrataModel = getModelProvider().getModel(); logger.info("SubTabHostGeneralHostErrataPresenter created: " + this.toString()); }

Target:
public SubTabHostGeneralHostErrataPresenter(EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, DetailTabModelProvider<HostListModel<Void>, HostErrataCountModel> errataCountModelProvider) { super(eventBus, view, proxy, placeManager, errataCountModelProvider, HostGeneralSubTabPanelPresenter.TYPE_SetTabContent); currentErrataModel = getModelProvider().getModel(); }
Source:
protected void download(final long objectSize, final WebResponse response) throws IOException { try (final InputStream responseStream = response.getResponseStream()) { final long startTime = PerformanceUtils.getCurrentTime(); final long totalBytes = IOUtils.copy(responseStream, destinationChannel, bufferSize, objName, false); final long endTime = PerformanceUtils.getCurrentTime(); if (objectSize != -1 && totalBytes != objectSize) { throw new ContentLengthNotMatchException(objName, objectSize, totalBytes); } PerformanceUtils.logMbps(startTime, endTime, totalBytes, objName, false); } }

Target:
protected void download(final long objectSize, final WebResponse response) throws IOException { try (final InputStream responseStream = response.getResponseStream()) { final long startTime = PerformanceUtils.getCurrentTime(); final long totalBytes = IOUtils.copy(responseStream, destinationChannel, bufferSize, objName, false); destinationChannel.close(); final long endTime = PerformanceUtils.getCurrentTime(); if (objectSize != -1 && totalBytes != objectSize) { throw new ContentLengthNotMatchException(objName, objectSize, totalBytes); } PerformanceUtils.logMbps(startTime, endTime, totalBytes, objName, false); } }
Source:
private void updateLogviewerState(TaskStatus status) { String nodeId = status.getTaskId().getValue().split("\\" + DEFAULT_MESOS_COMPONENT_NAME_DELIMITER)[0]; switch (status.getState()) { case TASK_STAGING: return; case TASK_STARTING: return; case TASK_RUNNING: return; default: } String logviewerZKPath = String.format("%s/%s", logviewerZkDir, nodeId); if (zkClient.nodeExists(logviewerZKPath)) { LOG.info("updateLogviewerState: Remove logviewer state in zk: {}", logviewerZKPath); zkClient.deleteNode(logviewerZKPath); LOG.info("updateLogviewerState: Reviving offers for logviewer relaunch"); mesosNimbus._driver.reviveOffers(); StormSchedulerImpl stormScheduler = (StormSchedulerImpl) mesosNimbus.getForcedScheduler(); stormScheduler.unsetOffersSuppressed(); } else { LOG.error("Task exists for logviewer that isn't tracked in ZooKeeper"); } }

Target:
private void updateLogviewerState(TaskStatus status) { String taskId = status.getTaskId().getValue(); if (!taskId.contains(MesosCommon.MESOS_COMPONENT_ID_DELIMITER)) { LOG.error("updateLogviewerState: taskId for logviewer, {}, isn't formatted correctly so ignoring task update", taskId); return; } String nodeId = taskId.split("\\" + MesosCommon.MESOS_COMPONENT_ID_DELIMITER)[1]; String logviewerZKPath = String.format("%s/%s", logviewerZkDir, nodeId); switch (status.getState()) { case TASK_STAGING: checkRunningLogviewerState(logviewerZKPath); return; case TASK_STARTING: checkRunningLogviewerState(logviewerZKPath); return; case TASK_RUNNING: checkRunningLogviewerState(logviewerZKPath); return; case TASK_LOST: break; default: mesosNimbus._driver.killTask(status.getTaskId()); } if (zkClient.nodeExists(logviewerZKPath)) { LOG.info("updateLogviewerState: Remove logviewer state in zk at for logviewer task {}", logviewerZKPath, taskId); zkClient.deleteNode(logviewerZKPath); LOG.info("updateLogviewerState: Add offer request for logviewer"); StormSchedulerImpl stormScheduler = (StormSchedulerImpl) mesosNimbus.getForcedScheduler(); stormScheduler.addOfferRequest(MesosCommon.LOGVIEWER_OFFERS_REQUEST_KEY); } }
Source:
public ProcessVariablesMap<String, Object> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ProcessVariablesMap<String, Object> map = new ProcessVariablesMap<>(); JsonNode node = jp.getCodec().readTree(jp); node.fields().forEachRemaining(entry -> { String name = entry.getKey(); JsonNode entryValue = entry.getValue(); if(!entryValue.isNull()) { if (entryValue.get("type") != null && entryValue.get("value") != null) { String type = entryValue.get("type").textValue(); String value = entryValue.get("value").asText(); Class<?> clazz = ProcessVariablesMapTypeRegistry.forType(type); Object result = conversionService.convert(value, clazz); if(ObjectValue.class.isInstance(result)) { result = ObjectValue.class.cast(result) .getObject(); } map.put(name, result); } else { Object value = null; try { value = new ObjectMapper().treeToValue(entryValue, Object.class); } catch (JsonProcessingException e) { e.printStackTrace(); } map.put(name, value); } } else { map.put(name, null); } }); return map; }

Target:
public ProcessVariablesMap<String, Object> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ProcessVariablesMap<String, Object> map = new ProcessVariablesMap<>(); JsonNode node = jp.getCodec().readTree(jp); node.fields().forEachRemaining(entry -> { String name = entry.getKey(); JsonNode entryValue = entry.getValue(); if(!entryValue.isNull()) { if (entryValue.get(TYPE) != null && entryValue.get(VALUE) != null) { String type = entryValue.get(TYPE).textValue(); String value = entryValue.get(VALUE).asText(); Class<?> clazz = ProcessVariablesMapTypeRegistry.forType(type); Object result = conversionService.convert(value, clazz); if(ObjectValue.class.isInstance(result)) { result = ObjectValue.class.cast(result) .getObject(); } map.put(name, result); } else { Object value = null; try { value = objectMapper.treeToValue(entryValue, Object.class); } catch (JsonProcessingException e) { logger.error("Unexpected Json Processing Exception: ", e); } map.put(name, value); } } else { map.put(name, null); } }); return map; }
Source:
private ChannelWriteController channelWriteController() { return new ChannelWriteController( configFetcher, channelStore, new DefaultGsonModelReader(), new ChannelModelTransformer( v4ChannelCodec(), new ImageModelTranslator() ) ); }

Target:
ChannelWriteController channelWriteController() { return ChannelWriteController.create( configFetcher, channelStore, DefaultGsonModelReader.create(), ChannelModelTransformer.create( v4ChannelCodec(), ImageModelTranslator.create() ) ); }
Source:
public byte[] toBytes(Tuple tuple, Expression[] expressions, ValueBitSet valueSet, ImmutableBytesWritable ptr) { int offset = 0; int index = 0; valueSet.clear(); int minNullableIndex = getMinNullable(); byte[] b = new byte[getEstimatedValueLength() + valueSet.getEstimatedLength()]; List<Field> fields = getFields(); for (int i = 0; i < fields.size(); i++) { Field field = fields.get(i); PDataType type = field.getDataType(); for (int j = 0; j < field.getCount(); j++) { if (expressions[index].evaluate(tuple, ptr) && ptr.getLength() > 0) { if (index >= minNullableIndex) { valueSet.set(index - minNullableIndex); } if (!type.isFixedWidth()) { b = ensureSize(b, offset, offset + getVarLengthBytes(ptr.getLength())); offset = writeVarLengthField(ptr, b, offset); } else { int nBytes = ptr.getLength(); b = ensureSize(b, offset, offset + nBytes); System.arraycopy(ptr.get(), ptr.getOffset(), b, offset, nBytes); if (field.getMaxLength() != null && field.getMaxLength() > 0 ) { if (field.getMaxLength() > nBytes){ Arrays.fill(b, offset + nBytes, offset + field.getMaxLength(), StringUtil.SPACE_UTF8); } offset += field.getMaxLength(); } else { offset += nBytes; } } } index++; } } b = ensureSize(b, offset, offset + valueSet.getEstimatedLength()); offset = valueSet.toBytes(b, offset); if (offset == b.length) { return b; } else { byte[] bExact = new byte[offset]; System.arraycopy(b, 0, bExact, 0, offset); return bExact; } }

Target:
public byte[] toBytes(Tuple tuple, Expression[] expressions, ValueBitSet valueSet, ImmutableBytesWritable ptr) { int offset = 0; int index = 0; valueSet.clear(); int minNullableIndex = getMinNullable(); byte[] b = new byte[getEstimatedValueLength() + valueSet.getEstimatedLength()]; List<Field> fields = getFields(); for (int i = 0; i < fields.size(); i++) { Field field = fields.get(i); PDataType type = field.getDataType(); for (int j = 0; j < field.getCount(); j++) { if (expressions[index].evaluate(tuple, ptr) && ptr.getLength() > 0) { if (index >= minNullableIndex) { valueSet.set(index - minNullableIndex); } if (!type.isFixedWidth()) { b = ensureSize(b, offset, offset + getVarLengthBytes(ptr.getLength())); offset = writeVarLengthField(ptr, b, offset); } else { int nBytes = ptr.getLength(); b = ensureSize(b, offset, offset + nBytes); System.arraycopy(ptr.get(), ptr.getOffset(), b, offset, nBytes); if (field.getDataType() == PChar.INSTANCE && field.getMaxLength() != null && field.getMaxLength() > 0) { if (field.getMaxLength() > nBytes){ Arrays.fill(b, offset + nBytes, offset + field.getMaxLength(), StringUtil.SPACE_UTF8); } offset += field.getMaxLength(); } else { offset += nBytes; } } } index++; } } b = ensureSize(b, offset, offset + valueSet.getEstimatedLength()); offset = valueSet.toBytes(b, offset); if (offset == b.length) { return b; } else { byte[] bExact = new byte[offset]; System.arraycopy(b, 0, bExact, 0, offset); return bExact; } }
Source:
public int compareTo(LocalizedMessage other) { int result = Integer.compare(lineNo, other.lineNo); if (lineNo == other.lineNo) { if (columnNo == other.columnNo) { result = Comparator.nullsFirst(Comparator.<String>naturalOrder()) .compare(moduleId, other.getModuleId()); if (result == 0) { result = getMessage().compareTo(other.getMessage()); } } else { result = Integer.compare(columnNo, other.columnNo); } } return result; }

Target:
public int compareTo(LocalizedMessage other) { final int result; if (lineNo == other.lineNo) { if (columnNo == other.columnNo) { if (Objects.equals(moduleId, other.moduleId)) { result = getMessage().compareTo(other.getMessage()); } else if (moduleId == null) { result = -1; } else if (other.moduleId == null) { result = 1; } else { result = moduleId.compareTo(other.moduleId); } } else { result = Integer.compare(columnNo, other.columnNo); } } else { result = Integer.compare(lineNo, other.lineNo); } return result; }
Source:
private <T, K extends Exception> T applyAndRelease(Semaphore semaphore, FunctionCheckedException<F, T, K> function) throws K { try { return function.apply(delegate()); } finally { semaphore.release(); } }

Target:
private <T, K extends Exception> T applyAndRelease(Semaphore semaphore, FunctionCheckedException<F, T, K> function) throws K { try { return function.apply(delegate); } finally { semaphore.release(); } }
Source:
private static DataSource createDataSource() { DataSource result = null; Properties properties = new Properties(); Config.setConfigUtils(new DBConfigUtils(false)); try { String job = System.getProperty("JOB_NAME"); if (job == null) job = ""; String number = System.getProperty("BUILD_NUMBER"); if (number == null) number = ""; String schemaNamePostfix = job + number; InputStream is = BaseDAOTestCase.class.getResourceAsStream( "/test-database.properties"); properties.load(is); is.close(); ClassLoader.getSystemClassLoader().loadClass( properties.getProperty("database.driver")); String dbUrl = properties.getProperty("database.url") + schemaNamePostfix; result = new SingleConnectionDataSource( dbUrl, properties.getProperty("database.username"), properties.getProperty("database.password"), true); initSql = properties.getProperty("database.initsql"); loadDataFactory(properties.getProperty("database.testing.datafactory")); if (initSql != null && !initSql.isEmpty()) { needInitializationSql = true; } } catch (Exception error) { error.printStackTrace(); throw new RuntimeException("Cannot create data source", error); } return result; }

Target:
private static DataSource createDataSource() { DataSource result = null; Properties properties = new Properties(); Config.setConfigUtils(new DBConfigUtils(false)); InputStream is = null; try { String job = System.getProperty("JOB_NAME"); if (job == null) job = ""; String number = System.getProperty("BUILD_NUMBER"); if (number == null) number = ""; String schemaNamePostfix = job + number; is = BaseDAOTestCase.class.getResourceAsStream( "/test-database.properties"); properties.load(is); ClassLoader.getSystemClassLoader().loadClass( properties.getProperty("database.driver")); String dbUrl = properties.getProperty("database.url") + schemaNamePostfix; result = new SingleConnectionDataSource( dbUrl, properties.getProperty("database.username"), properties.getProperty("database.password"), true); initSql = properties.getProperty("database.initsql"); loadDataFactory(properties.getProperty("database.testing.datafactory")); if (initSql != null && !initSql.isEmpty()) { needInitializationSql = true; } } catch (Exception error) { error.printStackTrace(); throw new RuntimeException("Cannot create data source", error); } finally { if (is != null) { try { is.close(); } catch (IOException e) { } } } return result; }
Source:
public void setSlaveAgentPort(int port) throws IOException { if (!SLAVE_AGENT_PORT_ENFORCE) { forceSetSlaveAgentPort(port); } }

Target:
public void setSlaveAgentPort(int port) throws IOException { if (SLAVE_AGENT_PORT_ENFORCE) { LOGGER.log(Level.WARNING, "setSlaveAgentPort({0}) call ignored because system property {1} is true", new String[] { Integer.toString(port), Jenkins.class.getName()+".slaveAgentPortEnforce" }); } else { forceSetSlaveAgentPort(port); } }
Source:
public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException, OperationCanceledException { RefactoringStatus status = new RefactoringStatus(); try { RenameParams params = new RenameParams(); params.setPosition(LSPEclipseUtils.toPosition(offset, info.getDocument())); TextDocumentIdentifier identifier = new TextDocumentIdentifier(); identifier.setUri(info.getFileUri().toString()); params.setTextDocument(identifier); params.setNewName(newName); if (params.getNewName() != null) { rename = info.getInitializedLanguageClient().get(1000, TimeUnit.MILLISECONDS).getTextDocumentService() .rename(params).get(1000, TimeUnit.MILLISECONDS); } } catch (Exception e) { status.addError(e.getMessage()); } return status; }

Target:
public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException, OperationCanceledException { RefactoringStatus status = new RefactoringStatus(); try { RenameParams params = new RenameParams(); params.setPosition(LSPEclipseUtils.toPosition(offset, info.getDocument())); TextDocumentIdentifier identifier = new TextDocumentIdentifier(); identifier.setUri(info.getFileUri().toString()); params.setTextDocument(identifier); params.setNewName(newName); if (params.getNewName() != null) { rename = info.getInitializedLanguageClient() .thenCompose(langaugeServer -> langaugeServer.getTextDocumentService().rename(params)) .get(1000, TimeUnit.MILLISECONDS); } } catch (Exception e) { status.addError(e.getMessage()); } return status; }
Source:
public void destroy() throws Exception { restAPIStore.deleteApplication(applicationID); super.cleanUp(); }

Target:
public void destroy() throws Exception { restAPIStore.deleteApplication(applicationID); super.cleanUpUsingRest(); }
Source:
public void rules_targeting_tests_should_have_tests_tag() throws Exception { List<Class> checks = CheckList.getChecks(); Set<Class> testChecks = new HashSet<>(CheckList.getJavaTestChecks()); for (Class cls : checks) { String key = getKey(cls, AnnotationUtils.getAnnotation(cls, Rule.class)); URL metadataURL = getClass().getResource("/org/sonar/l10n/java/rules/" + CheckList.REPOSITORY_KEY + "/" + key + "_java.json"); File metadataFile = new File(metadataURL.toURI()); assertThat(metadataFile).exists(); FileReader jsonReader = new FileReader(metadataFile); DummyMetatada metatada = gson.fromJson(jsonReader, DummyMetatada.class); if (testChecks.contains(cls)) { assertThat(metatada.tags).as("Rule " + key + " is targeting tests sources and should contain the 'tests' tag.").contains("tests"); } else { assertThat(metatada.tags).as("Rule " + key + " is targeting main sources and should not contain the 'tests' tag.").doesNotContain("tests"); } jsonReader.close(); } }

Target:
public void rules_targeting_tests_should_have_tests_tag() throws Exception { Set<Class> testChecks = new HashSet<>(CheckList.getJavaTestChecks()); for (Class cls : CheckList.getChecks()) { String key = getKey(cls, AnnotationUtils.getAnnotation(cls, Rule.class)); URL metadataURL = getClass().getResource("/org/sonar/l10n/java/rules/" + CheckList.REPOSITORY_KEY + "/" + key + "_java.json"); File metadataFile = new File(metadataURL.toURI()); assertThat(metadataFile).exists(); try (FileReader jsonReader = new FileReader(metadataFile)) { DummyMetatada metatada = gson.fromJson(jsonReader, DummyMetatada.class); if (testChecks.contains(cls)) { assertThat(metatada.tags).as("Rule " + key + " is targeting tests sources and should contain the 'tests' tag.").contains("tests"); } else { assertThat(metatada.tags).as("Rule " + key + " is targeting main sources and should not contain the 'tests' tag.").doesNotContain("tests"); } } } }
Source:
private Element addedElement(AbstractEditPart added, String label, ElementType type) { List<EditPart> selected = processEditor.getViewer().getSelectedEditParts(); if(selected.size() != 1) { StringBuilder builder = new StringBuilder(); for(int i = 0; i < selected.size(); i++) { builder.append(selected.get(i).toString()); builder.append(", "); } throw new IllegalStateException("Adding element caused selecting more elements: " + builder.toString()); } Element addedElement = new Element(selected.get(0), type); try{ if("Tasks".compareTo(type.getSectionName()) == 0) { added.setLabel(label); } else { addedElement.setName(label); } } catch (CoreLayerException e) { addedElement.setName(label); } return addedElement; }

Target:
private Element addedElement(AbstractEditPart added, String label, ElementType type) { List<EditPart> selected = processEditor.getViewer().getSelectedEditParts(); if(selected.size() != 1) { StringBuilder builder = new StringBuilder(); for(int i = 0; i < selected.size(); i++) { builder.append(selected.get(i).toString()); builder.append(", "); } throw new IllegalStateException("Adding element caused selecting more elements: " + builder.toString()); } Element addedElement = new Element(selected.get(0), type); try{ if("Tasks".compareTo(type.getSectionName()) == 0) { added.setLabel(label); } else { addedElement.setName(label); } } catch (SWTLayerException | CoreLayerException e) { addedElement.setName(label); } return addedElement; }
Source:
public void activate(Context.OperatorContext context) { ApexKuduConnection.ApexKuduConnectionBuilder apexKuduConnectionBuilder = getKuduConnectionConfig(); apexKuduConnection = apexKuduConnectionBuilder.build(); checkNotNull(apexKuduConnection,"Kudu connection cannot be null"); kuduTable = apexKuduConnection.getKuduTable(); kuduSession = apexKuduConnection.getKuduSession(); kuduClientHandle = apexKuduConnection.getKuduClient(); checkNotNull(kuduTable,"Kudu Table cannot be null"); checkNotNull(kuduSession, "Kudu session cannot be null"); allColumnDefs = new HashMap(); primaryKeyColumnNames = new HashSet<>(); kuduColumnBasedGetters = new HashMap(); buildGettersForPojoPayload(); isInSafeMode = false; isInReconcilingMode = false; reconcilingWindowId = Stateless.WINDOW_ID; if ( (context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID) != Stateless.WINDOW_ID) && context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID) < windowDataManager.getLargestCompletedWindow()) { isInSafeMode = true; reconcilingWindowId = windowDataManager.getLargestCompletedWindow() + 1; isInReconcilingMode = false; } }

Target:
public void activate(Context.OperatorContext context) { ApexKuduConnection.ApexKuduConnectionBuilder apexKuduConnectionBuilder = getKuduConnectionConfig(); apexKuduConnection = apexKuduConnectionBuilder.build(); checkNotNull(apexKuduConnection,"Kudu connection cannot be null"); kuduTable = apexKuduConnection.getKuduTable(); kuduSession = apexKuduConnection.getKuduSession(); kuduClientHandle = apexKuduConnection.getKuduClient(); checkNotNull(kuduTable,"Kudu Table cannot be null"); checkNotNull(kuduSession, "Kudu session cannot be null"); allColumnDefs = new HashMap(); primaryKeyColumnNames = new HashSet<>(); kuduColumnBasedGetters = new HashMap(); buildGettersForPojoPayload(); reconcilingWindowId = Stateless.WINDOW_ID; if ( (context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID) != Stateless.WINDOW_ID) && context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID) < windowDataManager.getLargestCompletedWindow()) { reconcilingWindowId = windowDataManager.getLargestCompletedWindow() + 1; } if ( (context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID) != Stateless.WINDOW_ID) && context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID) == windowDataManager.getLargestCompletedWindow()) { reconcilingWindowId = windowDataManager.getLargestCompletedWindow(); } }
Source:
private void testSaveAndReadMessage(String messageId) { final ProjectId expected = TestAggregateIdFactory.createProjectId(messageId); storage.write(expected.getId(), expected); final ProjectId actual = storage.read(expected.getId()); assertEquals(expected, actual); }

Target:
private void testSaveAndReadMessage(String messageId) { final ProjectId expected = createProjectId(messageId); storage.write(expected.getId(), expected); final ProjectId actual = storage.read(expected.getId()); assertEquals(expected, actual); }
Source:
public RemoteFile readFileWithMode(String uri, String ref, String path) throws GitAPIException, IOException { File dir = FileUtils.createTempDir("jgit_", ".git", null); try (Git git = Git.cloneRepository().setBare(true).setDirectory(dir) .setURI(uri).call()) { Repository repo = git.getRepository(); ObjectId refCommitId = sha1(uri, ref); RevCommit commit = repo.parseCommit(refCommitId); TreeWalk tw = TreeWalk.forPath(repo, path, commit.getTree()); tw.setRecursive(true); return new RemoteFile( readFileFromRepo(git.getRepository(), ref, path), tw.getFileMode(0)); } finally { FileUtils.delete(dir, FileUtils.RECURSIVE); } }

Target:
public RemoteFile readFileWithMode(String uri, String ref, String path) throws GitAPIException, IOException { File dir = FileUtils.createTempDir("jgit_", ".git", null); try (Git git = Git.cloneRepository().setBare(true).setDirectory(dir) .setURI(uri).call()) { Repository repo = git.getRepository(); ObjectId refCommitId = sha1(uri, ref); RevCommit commit = repo.parseCommit(refCommitId); TreeWalk tw = TreeWalk.forPath(repo, path, commit.getTree()); return new RemoteFile( tw.getObjectReader().open(tw.getObjectId(0)).getBytes( Integer.MAX_VALUE), tw.getFileMode(0)); } finally { FileUtils.delete(dir, FileUtils.RECURSIVE); } }
Source:
public void score(List<String> sentences, String output) throws Exception { EnglishAnalyzer ea = new EnglishAnalyzer(EnglishAnalyzer.getDefaultStopSet()); QueryParser qp = new QueryParser(LuceneDocumentGenerator.FIELD_BODY, ea); ClassicSimilarity similarity = new ClassicSimilarity(); Query question = qp.parse(sentences.remove(0)); List<String> questionTerms = Arrays.asList(question.toString().trim().split("\\s+")); for (String sent: sentences) { double idf = 0.0; String[] terms = sent.split("\\s+"); for (String term: terms) { try { TermQuery q = (TermQuery) qp.parse(term); Term t = q.getTerm(); if (questionTerms.contains(t.toString().trim())) { idf += similarity.idf(reader.docFreq(t), reader.numDocs()); } else { idf += 0.0; } } catch (Exception e) { continue; } } double normalizedScore = idf / sent.length(); ScoredPassage scoredPassage = new ScoredPassage(sent, normalizedScore); if (scoredPassageHeap.size() < topPassages || normalizedScore > scoredPassageHeap.peekFirst().getScore()) { if (scoredPassageHeap.size() == topPassages) { scoredPassageHeap.pollLast(); } scoredPassageHeap.add(scoredPassage); } } }

Target:
public void score(List<String> sentences, String output) throws Exception { EnglishAnalyzer ea = new EnglishAnalyzer(EnglishAnalyzer.getDefaultStopSet()); QueryParser qp = new QueryParser(LuceneDocumentGenerator.FIELD_BODY, ea); ClassicSimilarity similarity = new ClassicSimilarity(); Query question = qp.parse(sentences.remove(0)); HashSet<String> questionTerms = new HashSet<>(Arrays.asList(question.toString().trim().split("\\s+"))); for (String sent: sentences) { double idf = 0.0; String[] terms = sent.split("\\s+"); for (String term: terms) { try { TermQuery q = (TermQuery) qp.parse(term); Term t = q.getTerm(); if (questionTerms.contains(t.toString())) { idf += similarity.idf(reader.docFreq(t), reader.numDocs()); } else { idf += 0.0; } } catch (Exception e) { continue; } } double normalizedScore = idf / sent.length(); ScoredPassage scoredPassage = new ScoredPassage(sent, normalizedScore); if (scoredPassageHeap.size() < topPassages || normalizedScore > scoredPassageHeap.peekFirst().getScore()) { if (scoredPassageHeap.size() == topPassages) { scoredPassageHeap.pollLast(); } scoredPassageHeap.add(scoredPassage); } } }
Source:
public void run() { try { int logCount = 0; int randRoll = r.nextInt(snapCount/2); while (true) { ServerMetrics.SYNC_PROCESSOR_QUEUE_SIZE.add(queuedRequests.size()); Request si; if (toFlush.isEmpty()) { si = queuedRequests.take(); } else { si = queuedRequests.poll(); if (si == null) { flush(toFlush); continue; } } if (si == requestOfDeath) { break; } long startProcessTime = Time.currentElapsedTime(); ServerMetrics.SYNC_PROCESSOR_REAL_QUEUE_TIME.add( startProcessTime - si.syncQueueStartTime); if (zks.getZKDatabase().append(si)) { logCount++; if (logCount > (snapCount / 2 + randRoll)) { randRoll = r.nextInt(snapCount/2); zks.getZKDatabase().rollLog(); if (snapInProcess != null && snapInProcess.isAlive()) { LOG.warn("Too busy to snap, skipping"); } else { snapInProcess = new ZooKeeperThread("Snapshot Thread") { public void run() { try { zks.takeSnapshot(); } catch(Exception e) { LOG.warn("Unexpected exception", e); } } }; snapInProcess.start(); } logCount = 0; } } toFlush.add(si); if (toFlush.size() > 1000) { flush(toFlush); } ServerMetrics.SYNC_PROCESS_TIME.add( Time.currentElapsedTime() - startProcessTime); } } catch (Throwable t) { handleException(this.getName(), t); } finally{ running = false; } LOG.info("SyncRequestProcessor exited!"); }

Target:
public void run() { try { resetSnapshotStats(); lastFlushTime = Time.currentElapsedTime(); while (true) { ServerMetrics.getMetrics().SYNC_PROCESSOR_QUEUE_SIZE.add(queuedRequests.size()); long pollTime = Math.min(zks.getMaxWriteQueuePollTime(), getRemainingDelay()); Request si = queuedRequests.poll(pollTime, TimeUnit.MILLISECONDS); if (si == null) { flush(); si = queuedRequests.take(); } if (si == REQUEST_OF_DEATH) { break; } long startProcessTime = Time.currentElapsedTime(); ServerMetrics.getMetrics().SYNC_PROCESSOR_QUEUE_TIME.add( startProcessTime - si.syncQueueStartTime); if (zks.getZKDatabase().append(si)) { if (shouldSnapshot()) { resetSnapshotStats(); zks.getZKDatabase().rollLog(); if (!snapThreadMutex.tryAcquire()) { LOG.warn("Too busy to snap, skipping"); } else { new ZooKeeperThread("Snapshot Thread") { public void run() { try { zks.takeSnapshot(); } catch (Exception e) { LOG.warn("Unexpected exception", e); } finally { snapThreadMutex.release(); } } }.start(); } } } else if (toFlush.isEmpty()) { if (nextProcessor != null) { nextProcessor.processRequest(si); if (nextProcessor instanceof Flushable) { ((Flushable)nextProcessor).flush(); } } continue; } toFlush.add(si); if (shouldFlush()) { flush(); } ServerMetrics.getMetrics().SYNC_PROCESS_TIME.add(Time.currentElapsedTime() - startProcessTime); } } catch (Throwable t) { handleException(this.getName(), t); } LOG.info("SyncRequestProcessor exited!"); }
Source:
public void updatePermissions() throws Exception { Config config = new Config(); setup(config); Set<PermissionConfig> permissionConfigs = new HashSet<PermissionConfig>(); permissionConfigs.add(new PermissionConfig(PermissionConfig.PermissionType.MAP, "test", "*")); UpdatePermissionConfigRequest request = new UpdatePermissionConfigRequest(permissionConfigs); String result = communicator.updatePermissions(config.getGroupConfig().getName(), config.getGroupConfig().getPassword(), request.toJson().toString()); assertEquals("{\"status\":\"forbidden\"}", result); }

Target:
public void updatePermissions() throws Exception { Config config = setup(); Set<PermissionConfig> permissionConfigs = new HashSet<PermissionConfig>(); permissionConfigs.add(new PermissionConfig(PermissionConfig.PermissionType.MAP, "test", "*")); UpdatePermissionConfigRequest request = new UpdatePermissionConfigRequest(permissionConfigs); String result = communicator.updatePermissions(config.getGroupConfig().getName(), config.getGroupConfig().getPassword(), request.toJson().toString()); assertEquals("{\"status\":\"forbidden\"}", result); }
Source:
public void emitReplayedTuples(PreparedStatement ps) { LOG.debug("Emitting replayed statement is -" + ps.toString()); ResultSet rs = null; try (PreparedStatement pStat = ps;) { pStat.setFetchSize(10000); LOG.debug("sql query = {}", pStat); rs = pStat.executeQuery(); if (rs == null || rs.isClosed()) { LOG.debug("Nothing to replay"); return; } while (rs.next()) { previousUpperBound = rs.getObject(getKey()).toString(); outputPort.emit((T)rs.getObject(getKey())); } } catch (SQLException ex) { throw new RuntimeException(ex); } }

Target:
public void emitReplayedTuples(PreparedStatement ps) { LOG.debug("Emitting replayed statement is -" + ps.toString()); ResultSet rs = null; try (PreparedStatement pStat = ps;) { pStat.setFetchSize(getFetchSize()); LOG.debug("sql query = {}", pStat); rs = pStat.executeQuery(); if (rs == null || rs.isClosed()) { LOG.debug("Nothing to replay"); return; } while (rs.next()) { previousUpperBound = rs.getObject(getKey()).toString(); outputPort.emit((T)rs.getObject(getKey())); } } catch (SQLException ex) { throw new RuntimeException(ex); } }
Source:
public void notAllowSimpleGetsOnThoroughTables() throws IllegalAccessException { Method[] declaredMethods = ReadTransaction.class.getDeclaredMethods(); for (Method m : declaredMethods) { if (simpleGets.containsKey(m.getName()) && simpleGets.get(m.getName()).length == m.getParameterCount()) { checkThrowsAndNoInteraction(() -> { try { m.invoke(readTransaction, simpleGets.get(m.getName())); } catch (InvocationTargetException e) { Throwables.throwIfInstance(e.getCause(), IllegalStateException.class); } catch (IllegalAccessException e) { Throwables.throwUncheckedException(e); } }, IllegalStateException.class, "Cannot read"); } } }

Target:
public void notAllowSimpleGetsOnThoroughTables() throws IllegalAccessException { Method[] declaredMethods = ReadTransaction.class.getDeclaredMethods(); for (Method method : declaredMethods) { if (simpleGets.containsKey(method.getName()) && hasExpectedParameterCount(method)) { checkThrowsAndNoInteraction(() -> { try { method.invoke(readTransaction, simpleGets.get(method.getName())); } catch (InvocationTargetException e) { Throwables.throwIfInstance(e.getCause(), IllegalStateException.class); } catch (IllegalAccessException e) { Throwables.throwUncheckedException(e); } }, IllegalStateException.class, "Cannot read"); } } }
Source:
public Optional<PillHeartBeat> retrievePillHeartBeat(final DeviceAccountPair pillAccountPair) { final Optional<PillHeartBeat> pillHeartBeatOptional = this.pillHeartBeatDAODynamoDB.get(pillAccountPair.externalDeviceId); if (pillHeartBeatOptional.isPresent()) { return pillHeartBeatOptional; } LOGGER.warn("No pill heartbeat for pill in dynamoDB", pillAccountPair.externalDeviceId); final Optional<DeviceStatus> pillStatusOptional = this.trackerMotionDAO.pillStatus(pillAccountPair.internalDeviceId, pillAccountPair.accountId); if(pillStatusOptional.isPresent()) { return Optional.of(PillHeartBeat.fromDeviceStatus(pillAccountPair.externalDeviceId, pillStatusOptional.get())); } LOGGER.warn("No pill heartbeat for pill in postgres", pillAccountPair.externalDeviceId); return Optional.absent(); }

Target:
public Optional<PillHeartBeat> retrievePillHeartBeat(final DeviceAccountPair pillAccountPair) { final Optional<PillHeartBeat> pillHeartBeatOptional = this.pillHeartBeatDAODynamoDB.get(pillAccountPair.externalDeviceId); if (pillHeartBeatOptional.isPresent()) { return pillHeartBeatOptional; } LOGGER.warn("No pill heartbeat for pill in dynamoDB", pillAccountPair.externalDeviceId); final Optional<DeviceStatus> pillStatusOptional = this.trackerMotionDAO.pillStatus(pillAccountPair.internalDeviceId, pillAccountPair.accountId); if(pillStatusOptional.isPresent()) { return Optional.of(PillHeartBeat.fromDeviceStatus(pillAccountPair.externalDeviceId, pillStatusOptional.get())); } LOGGER.warn("No pill heartbeat for pill in trackerMotionDAO", pillAccountPair.externalDeviceId); return Optional.absent(); }
Source:
private GenericObjectPool<UplinkConnector<?>> createPool(UplinkConnectorConfig<?> uplinkConnectorConfig) { UplinkConnectorFactory uplinkConnectorFactory = new UplinkConnectorFactory(uplinkConnectorConfig); GenericObjectPool<UplinkConnector<?>> pool = new GenericObjectPool<>(uplinkConnectorFactory); uplinkConnectorFactory.linkToPool(pool); pool.setMaxIdle(uplinkConnectorConfig.maxIdle); pool.setMaxTotal(uplinkConnectorConfig.maxActive); pool.setTimeBetweenEvictionRunsMillis(30_000); pool.setNumTestsPerEvictionRun(4); pool.setTestOnBorrow(true); pool.setTestWhileIdle(true); return pool; }

Target:
private GenericObjectPool<UplinkConnector<?>> createPool(UplinkConnectorConfig<?> uplinkConnectorConfig) { UplinkConnectorFactory uplinkConnectorFactory = new UplinkConnectorFactory(uplinkConnectorConfig); GenericObjectPool<UplinkConnector<?>> pool = new GenericObjectPool<>(uplinkConnectorFactory); uplinkConnectorFactory.linkToPool(pool); pool.setMaxIdle(uplinkConnectorConfig.maxIdle); pool.setMaxTotal(uplinkConnectorConfig.maxActive); pool.setTimeBetweenEvictionRunsMillis(TIME_BETWEEN_EVICTION_RUNS_MILLIS); pool.setNumTestsPerEvictionRun(NUM_TESTS_PER_EVICTION_RUN); pool.setTestOnBorrow(true); pool.setTestWhileIdle(true); return pool; }
Source:
public CompletableFuture<Event> process(CoreEvent event, EventProcessor router,String ramlPath) throws MuleException { logger.info("Handling odata enabled request."); HttpRequestAttributes attributes = ((HttpRequestAttributes) event.getMessage().getAttributes().getValue()); OdataContext oDataContext = null; if (isExecutable(event)) { try { oDataContext = initializeModel(ramlPath,attributes.getMethod()); } catch (OdataMetadataFieldsException | OdataMetadataResourceNotFound | OdataMetadataFormatException | OdataMetadataEntityNotFoundException e) { e.printStackTrace(); } } String path = attributes.getRelativePath(); if (path.contains(ODATA_SVC_URI_PREFIX)) { return ODataRouterService.processODataRequest(attributes, router, oDataContext,event); } else { return router.processEvent(event); } }

Target:
public CompletableFuture<Event> process(CoreEvent event, EventProcessor router,String ramlPath) throws MuleException { logger.info("Handling odata enabled request."); HttpRequestAttributes attributes = CoreEventUtils.getHttpRequestAttributes(event); OdataContext oDataContext = getOdataContext(ramlPath); oDataContext.setMethod(attributes.getMethod()); String path = attributes.getRelativePath(); if (path.contains(ODATA_SVC_URI_PREFIX)) { return ODataRouterService.processODataRequest(attributes, router, oDataContext,event); } else { return router.processEvent(event); } }
Source:
public static long stNumPoints(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { GeometryCursor cursor = deserialize(input).getEsriGeometryCursor(); int points = 0; while (true) { com.esri.core.geometry.Geometry geometry = cursor.next(); if (geometry == null) { return points; } if (geometry.isEmpty()) { continue; } if (geometry instanceof Point) { points++; } else { points += ((MultiVertexGeometry) geometry).getPointCount(); } } }

Target:
public static long stNumPoints(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { return getPointCount(deserialize(input)); }
Source:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain nextFilter) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; if (!request.isSecure() || authenticators.isEmpty()) { nextFilter.doFilter(request, response); return; } List<String> messages = new ArrayList<>(); List<String> headerValues = new ArrayList<>(); for (Authenticator authenticator : authenticators) { Principal principal; try { principal = authenticator.authenticate(request); } catch (AuthenticationException e) { if (e.getMessage() != null) { messages.add(e.getMessage()); } e.getHeaderValue().ifPresent(headerValues::add); continue; } nextFilter.doFilter(withPrincipal(request, principal), response); return; } skipRequestBody(request); for (String value : headerValues) { response.setHeader(WWW_AUTHENTICATE, value); } if (messages.isEmpty()) { messages.add("Unauthorized"); } response.sendError(SC_UNAUTHORIZED, Joiner.on(" | ").join(messages)); }

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain nextFilter) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; if (!request.isSecure() || authenticators.isEmpty()) { nextFilter.doFilter(request, response); return; } Set<String> messages = new LinkedHashSet<>(); Set<String> authenticateHeaders = new LinkedHashSet<>(); for (Authenticator authenticator : authenticators) { Principal principal; try { principal = authenticator.authenticate(request); } catch (AuthenticationException e) { if (e.getMessage() != null) { messages.add(e.getMessage()); } e.getAuthenticateHeader().ifPresent(authenticateHeaders::add); continue; } nextFilter.doFilter(withPrincipal(request, principal), response); return; } skipRequestBody(request); for (String value : authenticateHeaders) { response.setHeader(WWW_AUTHENTICATE, value); } if (messages.isEmpty()) { messages.add("Unauthorized"); } response.sendError(SC_UNAUTHORIZED, Joiner.on(" | ").join(messages)); }
Source:
public static void readFileMetaData(InputStream from, final FileMetaDataConsumer consumer, boolean skipRowGroups) throws IOException { readFileMetaData(from, consumer, skipRowGroups, (BlockCipher.Decryptor) null, (byte[]) null); }

Target:
public static void readFileMetaData(InputStream from, final FileMetaDataConsumer consumer, boolean skipRowGroups) throws IOException { readFileMetaData(from, consumer, skipRowGroups, null, null); }
Source:
private static Pair<CommandType, String> determineCommandTypeAndAttribute(RuleContext ruleContext) { AttributeMap attributeMap = ruleContext.attributes(); if (OS.getCurrent() == OS.WINDOWS) { if (attributeMap.isAttributeValueExplicitlySpecified("cmd_ps")) { return Pair.of(CommandType.POWERSHELL, "cmd_ps"); } if (attributeMap.isAttributeValueExplicitlySpecified("cmd_bat")) { return Pair.of(CommandType.BATCH, "cmd_bat"); } } if (attributeMap.isAttributeValueExplicitlySpecified("cmd_bash")) { return Pair.of(CommandType.BASH, "cmd_bash"); } if (attributeMap.isAttributeValueExplicitlySpecified("cmd")) { return Pair.of(CommandType.BASH, "cmd"); } ruleContext.attributeError( "cmd", "missing value for `cmd` attribute in genrule, you can also set `cmd_ps` or `cmd_bat` on Windows and `cmd_bash` on other platforms."); return null; }

Target:
private static Pair<CommandType, String> determineCommandTypeAndAttribute(RuleContext ruleContext) { AttributeMap attributeMap = ruleContext.attributes(); if (OS.getCurrent() == OS.WINDOWS) { if (attributeMap.isAttributeValueExplicitlySpecified("cmd_ps")) { return Pair.of(CommandType.WINDOWS_POWERSHELL, "cmd_ps"); } if (attributeMap.isAttributeValueExplicitlySpecified("cmd_bat")) { return Pair.of(CommandType.WINDOWS_BATCH, "cmd_bat"); } } if (attributeMap.isAttributeValueExplicitlySpecified("cmd_bash")) { return Pair.of(CommandType.BASH, "cmd_bash"); } if (attributeMap.isAttributeValueExplicitlySpecified("cmd")) { return Pair.of(CommandType.BASH, "cmd"); } ruleContext.attributeError( "cmd", "missing value for `cmd` attribute in genrule, you can also set `cmd_ps` or `cmd_bat` on Windows and `cmd_bash` on other platforms."); return null; }
Source:
public final <T> Observable<List<T>> mapToList(@NonNull final Func1<Cursor, T> mapper) { return lift(new Operator<List<T>, Query>() { @Override public Subscriber<? super Query> call(final Subscriber<? super List<T>> subscriber) { return new Subscriber<Query>(subscriber) { @Override public void onNext(Query query) { Cursor cursor = query.run(); List<T> items = new ArrayList<>(cursor.getCount()); try { while (cursor.moveToNext() && !subscriber.isUnsubscribed()) { items.add(mapper.call(cursor)); } } finally { cursor.close(); } subscriber.onNext(items); } @Override public void onCompleted() { subscriber.onCompleted(); } @Override public void onError(Throwable e) { subscriber.onError(e); } }; } }); }

Target:
public final <T> Observable<List<T>> mapToList(@NonNull final Func1<Cursor, T> mapper) { return lift(new Operator<List<T>, Query>() { @Override public Subscriber<? super Query> call(final Subscriber<? super List<T>> subscriber) { return new Subscriber<Query>(subscriber) { @Override public void onNext(Query query) { Cursor cursor = query.run(); List<T> items = new ArrayList<>(cursor.getCount()); try { while (cursor.moveToNext() && !subscriber.isUnsubscribed()) { items.add(mapper.call(cursor)); } } finally { cursor.close(); } if (!subscriber.isUnsubscribed()) { subscriber.onNext(items); } } @Override public void onCompleted() { subscriber.onCompleted(); } @Override public void onError(Throwable e) { subscriber.onError(e); } }; } }); }
Source:
public NettyServerConnection createConnection(final ChannelHandlerContext ctx, String protocol, boolean httpEnabled) throws Exception { if (connectionsAllowed == -1 || connections.size() < connectionsAllowed) { super.channelActive(ctx); Listener connectionListener = new Listener(); NettyServerConnection nc = new NettyServerConnection(configuration, ctx.channel(), connectionListener, !httpEnabled && batchDelay > 0, directDeliver); connectionListener.connectionCreated(NettyAcceptor.this, nc, protocolHandler.getProtocol(protocol)); SslHandler sslHandler = ctx.pipeline().get(SslHandler.class); if (sslHandler != null) { sslHandler.handshakeFuture().addListener(new GenericFutureListener<io.netty.util.concurrent.Future<Channel>>() { @Override public void operationComplete(final io.netty.util.concurrent.Future<Channel> future) throws Exception { if (future.isSuccess()) { active = true; ctx.channel().pipeline().remove("readTimeoutHandler"); } else { future.getNow().close(); } } }); } else { active = true; } return nc; } else { ActiveMQServerLogger.LOGGER.connectionLimitReached(connectionsAllowed, ctx.channel().remoteAddress().toString()); ctx.channel().close(); return null; } }

Target:
public NettyServerConnection createConnection(final ChannelHandlerContext ctx, String protocol, boolean httpEnabled) throws Exception { if (connectionsAllowed == -1 || connections.size() < connectionsAllowed) { super.channelActive(ctx); Listener connectionListener = new Listener(); NettyServerConnection nc = new NettyServerConnection(configuration, ctx.channel(), connectionListener, !httpEnabled && batchDelay > 0, directDeliver); connectionListener.connectionCreated(NettyAcceptor.this, nc, protocolHandler.getProtocol(protocol)); SslHandler sslHandler = ctx.pipeline().get(SslHandler.class); if (sslHandler != null) { sslHandler.handshakeFuture().addListener(new GenericFutureListener<io.netty.util.concurrent.Future<Channel>>() { @Override public void operationComplete(final io.netty.util.concurrent.Future<Channel> future) throws Exception { if (future.isSuccess()) { active = true; } else { future.getNow().close(); } } }); } else { active = true; } return nc; } else { ActiveMQServerLogger.LOGGER.connectionLimitReached(connectionsAllowed, ctx.channel().remoteAddress().toString()); ctx.channel().close(); return null; } }
Source:
public void equalTo_UUID() { populateTestRealm(realm, 10); RealmResults<AllTypes> resultList = realm.where(AllTypes.class).sort(AllTypes.FIELD_UUID, Sort.ASCENDING).findAll(); for (int i = 0; i < 10; i++) { assertEquals(UUID.fromString(uuid), resultList.get(i).getColumnUUID()); } }

Target:
public void equalTo_UUID() { populateTestRealm(realm, 10); for (int i = 0; i < 10; i++) { RealmResults<AllTypes> resultList = realm .where(AllTypes.class) .equalTo(AllTypes.FIELD_UUID, UUID.fromString(TestHelper.generateUUIDString(i))) .sort(AllTypes.FIELD_UUID, Sort.ASCENDING) .findAll(); assertEquals(1, resultList.size()); assertEquals(UUID.fromString(TestHelper.generateUUIDString(i)), resultList.get(0).getColumnUUID()); } }
Source:
public void bind(String portalName, String statementName, List<Object> params, @Nullable FormatCodes.FormatCode[] resultFormatCodes) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("method=bind portalName={} statementName={} params={}", portalName, statementName, params); } PreparedStmt preparedStmt; try { preparedStmt = getSafeStmt(statementName); } catch (Throwable t) { jobsLogs.logPreExecutionFailure(UUID.randomUUID(), null, SQLExceptions.messageOf(t), sessionContext.user()); throw t; } AnalyzedStatement analyzedStatement; if (preparedStmt.analyzedStatement() == null) { try { analyzedStatement = analyzer.analyze( preparedStmt.parsedStatement(), sessionContext, preparedStmt.paramTypes()); } catch (Throwable t) { jobsLogs.logPreExecutionFailure( UUID.randomUUID(), preparedStmt.rawStatement(), SQLExceptions.messageOf(t), sessionContext.user()); throw t; } } else { analyzedStatement = preparedStmt.analyzedStatement(); } Portal portal = new Portal( portalName, preparedStmt, params, analyzedStatement, resultFormatCodes); Portal oldPortal = portals.put(portalName, portal); if (oldPortal != null) { oldPortal.closeActiveConsumer(); } }

Target:
public void bind(String portalName, String statementName, List<Object> params, @Nullable FormatCodes.FormatCode[] resultFormatCodes) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("method=bind portalName={} statementName={} params={}", portalName, statementName, params); } PreparedStmt preparedStmt; try { preparedStmt = getSafeStmt(statementName); } catch (Throwable t) { jobsLogs.logPreExecutionFailure(UUID.randomUUID(), null, SQLExceptions.messageOf(t), sessionContext.user()); throw t; } Portal portal = new Portal( portalName, preparedStmt, params, preparedStmt.analyzedStatement(), resultFormatCodes); Portal oldPortal = portals.put(portalName, portal); if (oldPortal != null) { oldPortal.closeActiveConsumer(); } }
Source:
public void onAttach(Activity activity) { super.onAttach(activity); com.baidu.mapapi.SDKInitializer.initialize(getActivity().getApplicationContext()); mDpApp = (DroidPlannerApp) activity.getApplication(); }

Target:
public void onAttach(Activity activity) { super.onAttach(activity); com.baidu.mapapi.SDKInitializer.initialize(activity.getApplicationContext()); mDpApp = (DroidPlannerApp) activity.getApplication(); }