auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void run() { HashMap<String, String> commandLineArgs = new HashMap<>(getParameters().getNamed()); String sourceJarPath = commandLineArgs.get("source"); String targetJarPath = commandLineArgs.get("target"); String executeJarOption = commandLineArgs.get("execute-jar"); if (sourceJarPath == null || targetJarPath == null) { log("Please specify source and target files."); quit(); } else { log("source: " + sourceJarPath); log("target: " + targetJarPath); } File sourceJarFile = new File(sourceJarPath); File targetJarFile = new File(targetJarPath); if (!sourceJarFile.exists()) { log("Such source file does not exist, aborting."); quit(); } if (!prepareTargetJarFile(targetJarFile)) { showCriticalErrorOnUpdating(); return; } log("Moving source to target"); if (!moveFile(sourceJarFile.toPath(), targetJarFile.toPath())) { log("Failed to move update."); restoreBackup(targetJarFile); quit(); } if (executeJarOption != null && executeJarOption.equalsIgnoreCase("y")) { if (executeJar(targetJarPath, "")) { removeBackup(targetJarFile); } else { restoreBackup(targetJarFile); executeJar(targetJarPath, ""); } } else { removeBackup(targetJarFile); } quit(); }

Target:
private void run() throws IllegalArgumentException, IOException { HashMap<String, String> commandLineArgs = new HashMap<>(getParameters().getNamed()); String sourceJarPath = commandLineArgs.get("source"); String targetJarPath = commandLineArgs.get("target"); String executeJarOption = commandLineArgs.get("execute-jar"); if (sourceJarPath == null || targetJarPath == null) { throw new IllegalArgumentException("Please specify source and target files."); } else { log("source: " + sourceJarPath); log("target: " + targetJarPath); } File sourceJarFile = new File(sourceJarPath); File targetJarFile = new File(targetJarPath); if (!sourceJarFile.exists()) { throw new IOException(String.format("Source file %s does not exist. Aborting...", sourceJarFile.toString())); } if (targetJarFile.exists() && targetJarFile.isFile()) { makeJarBackup(targetJarFile); } else { JarUpdaterFileHandler.createParentDirectoriesOfFile(targetJarFile); } log("Moving source to target"); try { JarUpdaterFileHandler.moveFileWithReplaceExisting(sourceJarFile.toPath(), targetJarFile.toPath()); } catch (IOException e) { restoreBackupOfFile(targetJarFile); throw e; } if (executeJarOption != null && executeJarOption.equalsIgnoreCase("y") && !executeJar(targetJarPath)) { restoreBackupOfFile(targetJarFile); executeJar(targetJarPath); } else { removeBackupOfFileIfExists(targetJarFile); } quit(); }
Source:
protected void runInternal() { log.info("XdContainer internal run starting, setting up XD container launcher"); log.info("Using xd.home=" + getEnvironment("xd.home")); ContainerOptions options = new ContainerOptions(); String[] args = new String[] { "--xdHomeDir", getEnvironment("xd.home") }; CmdLineParser parser = new CmdLineParser(options); try { parser.parseArgument(args); } catch (CmdLineException e) { log.error("Error parsing options", e); } log.info("Going to launch Spring XD specific XDContainer"); ContainerLauncher launcher = context.getBean(ContainerLauncher.class); XDContainer container = launcher.launch(options); log.info("XdContainer launched id=" + container.getId() + " jvm=" + container.getJvmName()); }

Target:
protected void runInternal() { log.info("XdContainer internal run starting, setting up XD container launcher"); log.info("Using XD_HOME=" + getEnvironment("XD_HOME")); log.info("XdContainer context=" + context); log.info("XdContainer parent context=" + context.getParent()); ContainerOptions options = new ContainerOptions(); String[] args = new String[] { "--xdHomeDir", getEnvironment("XD_HOME") }; CmdLineParser parser = new CmdLineParser(options); try { parser.parseArgument(args); } catch (CmdLineException e) { log.error("Error parsing options", e); } log.info("Going to launch Spring XD specific XDContainer"); ContainerLauncher launcher = context.getBean(ContainerLauncher.class); XDContainer container = launcher.launch(options); log.info("XdContainer launched id=" + container.getId() + " jvm=" + container.getJvmName()); }
Source:
public static void testOnblurAutoConvertValueNoncompoundAttribute(WebDriver driver, By context, String simpleName, String value, String expected) { WebElement attribuetContainer = findAttributeContainerWebElement(driver, context, simpleName, false); changeValueAttribute(attribuetContainer, simpleName, value); attribuetContainer.click(); assertFalse(FormsUtils.formHasErrors(driver, context)); String actual = FormsUtils.getValueNoncompoundAttribute(driver, context, simpleName); assertEquals(actual, expected); }

Target:
public static void testOnblurAutoConvertValueNoncompoundAttribute(WebDriver driver, By context, String simpleName, String value, String expected) { WebElement attributeContainer = findAttributeContainerWebElement(driver, context, simpleName, false); changeValueAttributeTextNumberEmailUrl(attributeContainer, simpleName, value); attributeContainer.click(); assertFalse(FormsUtils.formHasErrors(driver, context)); String actual = FormsUtils.getValueNoncompoundAttribute(driver, context, simpleName); assertEquals(actual, expected); }
Source:
public void Find_Available_Default_Actions_Invalid_License() throws Exception { final HttpServletRequest request = mock(HttpServletRequest.class); final ContentType defaultContentType = APILocator.getContentTypeAPI(userAdmin).find("webPageContent"); final Response response = nonLicenseWorkflowResource.findAvailableDefaultActionsByContentType(request, defaultContentType.id()); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); ResponseEntityView ev = ResponseEntityView.class.cast(response.getEntity()); List<WorkflowDefaultActionView> actions = List.class.cast(ev.getEntity()); for(WorkflowDefaultActionView av:actions){ assertTrue(av.getScheme().isSystem()); } }

Target:
public void Find_Available_Default_Actions_Invalid_License() throws Exception { final HttpServletRequest request = mock(HttpServletRequest.class); final ContentType webPageContentType = APILocator.getContentTypeAPI(userAdmin).find("webPageContent"); final Response response = nonLicenseWorkflowResource.findAvailableDefaultActionsByContentType(request, webPageContentType.id()); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); ResponseEntityView ev = ResponseEntityView.class.cast(response.getEntity()); List<WorkflowDefaultActionView> actions = List.class.cast(ev.getEntity()); for(WorkflowDefaultActionView av:actions){ assertTrue(av.getScheme().isSystem()); } }
Source:
public boolean isExistChecksum(Repository repository, String path) { return getDigestAlgorithmSet() .stream() .map(algorithm -> { String checksumPath = path.concat(".") .concat(algorithm.toLowerCase() .replaceAll("-", "")); RepositoryPath checksum = null; try { checksum = resolve(repository, checksumPath); } catch (IOException e) { e.printStackTrace(); } return checksum; }) .allMatch(checksum -> Files.exists(checksum)); }

Target:
public boolean isExistChecksum(Repository repository, String path) { return getDigestAlgorithmSet() .stream() .map(algorithm -> { String checksumPath = path.concat(".") .concat(algorithm.toLowerCase() .replaceAll( "-", "")); RepositoryPath checksum = null; try { checksum = resolve(repository, checksumPath); } catch (IOException e) { logger.error(e.getMessage()); } return checksum; }) .allMatch(checksum -> Files.exists(checksum)); }
Source:
private Set<String> extractTags(Set<String> input) throws BadRequestException { if (input == null) { return ImmutableSet.of(); } else { for (String hashtag: input) { if (hashtag.contains(",")) { throw new BadRequestException("Hashtags may not contain commas"); } } return input; } }

Target:
private Set<String> extractTags(Set<String> input) throws BadRequestException { if (input == null) { return ImmutableSet.of(); } else { HashSet<String> result = new HashSet<>(); for (String hashtag : input) { if (hashtag.contains(",")) { throw new BadRequestException("Hashtags may not contain commas"); } if (!hashtag.trim().isEmpty()) { result.add(hashtag.trim()); } } return result; } }
Source:
public final Long createLO(Connection connection) throws SQLException { if (shouldUseReflection) { Object largeObjectManager = getLargeObjectManager(connection); try { Method method = largeObjectManager.getClass().getMethod("createLO", Connection.class); return (Long) method.invoke(largeObjectManager, connection); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { throw new SQLException("Couldn't access org.postgresql.largeobject.LargeObjectManager", ex); } } else { return ((PGConnection) unwrap(connection)).getLargeObjectAPI().createLO(); } }

Target:
public final Long createLO(Connection connection) throws SQLException { if (shouldUseReflection) { Object largeObjectManager = getLargeObjectManager(connection); try { Method method = largeObjectManager.getClass().getMethod("createLO"); return (Long) method.invoke(largeObjectManager); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { throw new SQLException("Couldn't access org.postgresql.largeobject.LargeObjectManager", ex); } } else { return ((PGConnection) unwrap(connection)).getLargeObjectAPI().createLO(); } }
Source:
private static Fork fork(final String host, final Take take) { return new Fork() { @Override public Opt<Response> route(final Request req) throws Exception { final String hst = new RqHeaders.Smart( new RqHeaders.Base(req) ).single("host"); final Opt<Response> rsp; if (new UncheckedText( new Lowered(host) ).asString().equals( new UncheckedText( new Lowered(hst) ).asString() ) ) { rsp = new Opt.Single<>(take.act(req)); } else { rsp = new Opt.Empty<>(); } return rsp; } }; }

Target:
private static Fork fork(final String host, final Take take) { return new Fork() { @Override public Opt<Response> route(final Request req) throws Exception { final String hst = new RqHeaders.Smart( new RqHeaders.Base(req) ).single("host"); final Opt<Response> rsp; final Text lowhost = new UncheckedText(new Lowered(host)); final Text lowhst = new UncheckedText(new Lowered(hst)); if (lowhost.asString().equals(lowhst.asString())) { rsp = new Opt.Single<>(take.act(req)); } else { rsp = new Opt.Empty<>(); } return rsp; } }; }
Source:
private void setPagesRecycler(OnThisDayCard card) { if (card.pages() != null) { RecyclerAdapter recyclerAdapter = new RecyclerAdapter(card.pages(), card.wiki(), true, (Activity) this.getContext()); recyclerAdapter.setCallback(new ItemCallback()); pagesRecycler.setAdapter(recyclerAdapter); } else { pagesRecycler.setVisibility(GONE); } }

Target:
private void setPagesRecycler(OnThisDayCard card) { if (card.pages() != null) { RecyclerAdapter recyclerAdapter = new RecyclerAdapter(card.pages(), card.wiki(), true, (Activity) getContext()); recyclerAdapter.setCallback(new ItemCallback()); pagesRecycler.setAdapter(recyclerAdapter); } else { pagesRecycler.setVisibility(GONE); } }
Source:
public void passivateAll() throws PersistenceException { if (enabled && !skipOnStop) { long start = timeService.time(); log.passivatingAllEntries(); int count = 0; for (InternalCacheEntry e : container) { if (count != Integer.MAX_VALUE) { count++; } if (trace) log.tracef("Passivating %s", e.getKey()); persistenceManager.writeToAllNonTxStores(marshalledEntryFactory.newMarshalledEntry(e.getKey(), e.getValue(), internalMetadata(e)), BOTH); } log.passivatedEntries(count, Util.prettyPrintTime(timeService.timeDuration(start, TimeUnit.MILLISECONDS))); } }

Target:
public void passivateAll() throws PersistenceException { if (enabled && !skipOnStop) { long start = timeService.time(); log.passivatingAllEntries(); long count = 0; for (InternalCacheEntry e : container) { count++; if (trace) log.tracef("Passivating %s", e.getKey()); persistenceManager.writeToAllNonTxStores(marshalledEntryFactory.newMarshalledEntry(e.getKey(), e.getValue(), internalMetadata(e)), BOTH); } log.passivatedEntries(count, Util.prettyPrintTime(timeService.timeDuration(start, TimeUnit.MILLISECONDS))); } }
Source:
public void startElement(String uri, String localName, String qName, Attributes attributes) { currentQName = qName; if (qName.indexOf("Pixels") != -1) { inPixels = true; } if (qName.indexOf("BinData") != -1 && inPixels == true) { binData.add( new BinData(locator.getLineNumber(), locator.getColumnNumber())); String compress = attributes.getValue("Compression"); compression.add(compress == null ? "" : compress); xmlBuffer.append("<"); xmlBuffer.append(qName); for (int i=0; i<attributes.getLength(); i++) { String key = XMLTools.escapeXML(attributes.getQName(i)); String value = XMLTools.escapeXML(attributes.getValue(i)); if (key.equals("Length")) value = "0"; xmlBuffer.append(" "); xmlBuffer.append(key); xmlBuffer.append("=\""); xmlBuffer.append(value); xmlBuffer.append("\""); } xmlBuffer.append(">"); } else { xmlBuffer.append("<"); xmlBuffer.append(qName); for (int i=0; i<attributes.getLength(); i++) { String key = XMLTools.escapeXML(attributes.getQName(i)); String value = XMLTools.escapeXML(attributes.getValue(i)); if (key.equals("BigEndian")) { String endian = value.toLowerCase(); if (!endian.equals("true") && !endian.equals("false")) { if (endian.startsWith("t")) endian = "true"; else if (endian.startsWith("f")) endian = "false"; } value = endian; } xmlBuffer.append(" "); xmlBuffer.append(key); xmlBuffer.append("=\""); xmlBuffer.append(value); xmlBuffer.append("\""); } xmlBuffer.append(">"); } }

Target:
public void startElement(String uri, String localName, String qName, Attributes attributes) { currentQName = qName; if (qName.indexOf("Pixels") != -1) { inPixels = true; } if (inPixels && qName.indexOf("BinData") != -1) { binData.add( new BinData(locator.getLineNumber(), locator.getColumnNumber())); String compress = attributes.getValue("Compression"); compression.add(compress == null ? "" : compress); xmlBuffer.append("<"); xmlBuffer.append(qName); for (int i=0; i<attributes.getLength(); i++) { String key = XMLTools.escapeXML(attributes.getQName(i)); String value = XMLTools.escapeXML(attributes.getValue(i)); if (key.equals("Length")) value = "0"; xmlBuffer.append(" "); xmlBuffer.append(key); xmlBuffer.append("=\""); xmlBuffer.append(value); xmlBuffer.append("\""); } xmlBuffer.append(">"); } else { xmlBuffer.append("<"); xmlBuffer.append(qName); for (int i=0; i<attributes.getLength(); i++) { String key = XMLTools.escapeXML(attributes.getQName(i)); String value = XMLTools.escapeXML(attributes.getValue(i)); if (key.equals("BigEndian")) { String endian = value.toLowerCase(); if (!endian.equals("true") && !endian.equals("false")) { if (endian.startsWith("t")) endian = "true"; else if (endian.startsWith("f")) endian = "false"; } value = endian; } xmlBuffer.append(" "); xmlBuffer.append(key); xmlBuffer.append("=\""); xmlBuffer.append(value); xmlBuffer.append("\""); } xmlBuffer.append(">"); } }
Source:
public void setUp() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, IOException { inputFiles = new ArrayList<>(); inputFiles.add(new File(TEST_INPUT_DIR + "AngleBracketWhitespaceTest.swift")); inputFiles.add(new File(TEST_INPUT_DIR + "BraceWhitespaceTest.swift")); inputFiles.add(new File(TEST_INPUT_DIR + "SemicolonTest.swift")); inputFiles.add(new File(TEST_INPUT_DIR + "UpperCamelCaseTest.swift")); expectedMessages = new ArrayList<>(); outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent, false, Charset.defaultCharset().name())); }

Target:
public void setUp() throws UnsupportedEncodingException { inputFiles = new ArrayList<>(); inputFiles.add(new File(TEST_INPUT_DIR + "AngleBracketWhitespaceTest.swift")); inputFiles.add(new File(TEST_INPUT_DIR + "BraceWhitespaceTest.swift")); inputFiles.add(new File(TEST_INPUT_DIR + "SemicolonTest.swift")); inputFiles.add(new File(TEST_INPUT_DIR + "UpperCamelCaseTest.swift")); expectedMessages = new ArrayList<>(); outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent, false, Charset.defaultCharset().name())); }
Source:
public void testGetReplicaException() throws Exception { CompletableFuture<Void> taskFuture = new CompletableFuture<>(); taskFuture.completeExceptionally(new CacheException("Problem encountered retrieving state")); initTransferTaskMock(taskFuture); CompletableFuture<List<Map<Address, InternalCacheEntry<Object, Object>>>> cf = stateReceiver.getAllReplicasForSegment(0, localizedCacheTopology); try { cf.get(); fail("Expected an ExecutionExceptions caused by a CacheException"); } catch (ExecutionException e) { assertTrue("Expected an ExecutionExceptions caused by a CacheException.", e.getCause() instanceof CacheException); } }

Target:
public void testGetReplicaException() throws Exception { CompletableFuture<Void> taskFuture = new CompletableFuture<>(); taskFuture.completeExceptionally(new CacheException("Problem encountered retrieving state")); initTransferTaskMock(taskFuture); CompletableFuture<List<Map<Address, CacheEntry<Object, Object>>>> cf = stateReceiver.getAllReplicasForSegment(0, localizedCacheTopology); Exceptions.expectExecutionException(CacheException.class, cf); }
Source:
public CandlepinQuery<Consumer> getHypervisorsBulk(Iterable<String> hypervisorIds, String ownerKey) { if (hypervisorIds == null || !hypervisorIds.iterator().hasNext()) { return this.cpQueryFactory.<Consumer>buildQuery(); } DetachedCriteria criteria = DetachedCriteria.forClass(Consumer.class) .createAlias("owner", "o") .createAlias("hypervisorId", "hvsr") .add(Restrictions.eq("o.key", ownerKey)) .add(this.getHypervisorIdRestriction(hypervisorIds)) .addOrder(Order.asc("hvsr.hypervisorId")); CandlepinQuery<Consumer> query = this.cpQueryFactory.<Consumer>buildQuery(this.currentSession(), criteria); query.setLockMode(LockModeType.PESSIMISTIC_WRITE); return query; }

Target:
public CandlepinQuery<Consumer> getHypervisorsBulk(Iterable<String> hypervisorIds, String ownerKey) { if (hypervisorIds == null || !hypervisorIds.iterator().hasNext()) { return this.cpQueryFactory.<Consumer>buildQuery(); } DetachedCriteria criteria = DetachedCriteria.forClass(Consumer.class) .createAlias("owner", "o") .createAlias("hypervisorId", "hvsr") .add(Restrictions.eq("o.key", ownerKey)) .add(this.getHypervisorIdRestriction(hypervisorIds)) .addOrder(Order.asc("hvsr.hypervisorId")); return this.cpQueryFactory.<Consumer>buildQuery(this.currentSession(), criteria) .setLockMode(LockModeType.PESSIMISTIC_WRITE); }
Source:
public synchronized static void setUp() { try { System.setProperty(DIIRT_HOME_ENV_VAR, FileLocator.resolve(PVManagerSettings.class.getResource(DIIRT_DIR)).getPath()); } catch (IOException | RuntimeException err) { IsisLog.getLogger(PVManagerSettings.class).error(err.getMessage(), err); } }

Target:
public static synchronized void setUp() { try { System.setProperty(DIIRT_HOME_ENV_VAR, FileLocator.resolve(PVManagerSettings.class.getResource(DIIRT_DIR)).getPath()); } catch (IOException | RuntimeException err) { IsisLog.getLogger(PVManagerSettings.class).error(err.getMessage(), err); } }
Source:
public void refreshSchema(String keyspace, String table) throws InterruptedException { logger.debug("[Control connection] Refreshing schema for {}{}", keyspace == null ? "" : keyspace, table == null ? "" : '.' + table); try { Connection c = connectionRef.get(); if (c == null) return; refreshSchema(c, keyspace, table, cluster); if (table == null) { cluster.submitNodeListRefresh(); cluster.nodeListRefreshRequestDebouncer.deliverEvents().get(); } } catch (ConnectionException e) { logger.debug("[Control connection] Connection error while refreshing schema ({})", e.getMessage()); signalError(); } catch (ExecutionException e) { if (!isShutdown) logger.error("[Control connection] Unexpected error while refreshing schema", e); signalError(); } catch (BusyConnectionException e) { logger.debug("[Control connection] Connection is busy, reconnecting"); signalError(); } }

Target:
public void refreshSchema(String keyspace, String table) throws InterruptedException { if(keyspace == null && table == null) { logger.debug("[Control connection] Refreshing schema"); } else { logger.debug("[Control connection] Refreshing schema for {}{}", keyspace == null ? "" : keyspace, table == null ? "" : '.' + table); } try { Connection c = connectionRef.get(); if (c == null) return; refreshSchema(c, keyspace, table, cluster); if (table == null) { cluster.submitNodeListRefresh(); } } catch (ConnectionException e) { logger.debug("[Control connection] Connection error while refreshing schema ({})", e.getMessage()); signalError(); } catch (ExecutionException e) { if (!isShutdown) logger.error("[Control connection] Unexpected error while refreshing schema", e); signalError(); } catch (BusyConnectionException e) { logger.debug("[Control connection] Connection is busy, reconnecting"); signalError(); } }
Source:
public void testCcTestCoverageOutputGenerator() throws Exception { scratch.file( "sh/test/BUILD", "sh_test(name = 'foo_test',", " srcs = ['foo_test.sh'])"); reporter.removeHandler(failFastHandler); ConfiguredTarget ct = getConfiguredTarget(" assertThat(getRuleContext(ct).getPrerequisite(":lcov_merger", Mode.HOST)).isNull(); }

Target:
public void testCcTestCoverageOutputGenerator() throws Exception { scratch.file( "sh/test/BUILD", "sh_test(name = 'foo_test', srcs = ['foo_test.sh'])"); reporter.removeHandler(failFastHandler); ConfiguredTarget ct = getConfiguredTarget(" assertThat(getRuleContext(ct).getPrerequisite(":lcov_merger", Mode.HOST)).isNull(); }
Source:
public static EntityManagerCacheGlobal entityManagerCache(PersistenceUnitMetadata pu) { if (pu.getProperties().containsKey(Configuration.JPA_ENTITYMANAGER_CACHE) && Boolean.parseBoolean(pu.getProperties().getProperty(Configuration.JPA_ENTITYMANAGER_CACHE))) { int cache_max_size = 0; if (pu.getProperties().containsKey(Configuration.JPA_ENTITYMANAGER_CACHE_SIZE)) { cache_max_size = Integer.parseInt(pu.getProperties().getProperty(Configuration.JPA_ENTITYMANAGER_CACHE_SIZE)); } return new EntityManagerCacheGlobal(cache_max_size); } return null; }

Target:
public static EntityManagerCache entityManagerCache(PersistenceUnitMetadata pu) { if (pu.getProperties().containsKey(JPA_ENTITYMANAGER_CACHE) && Boolean.parseBoolean(pu.getProperties().getProperty(JPA_ENTITYMANAGER_CACHE))) { int cache_max_size = 0; if (pu.getProperties().containsKey(JPA_ENTITYMANAGER_CACHE_SIZE)) { cache_max_size = Integer.parseInt(pu.getProperties().getProperty(JPA_ENTITYMANAGER_CACHE_SIZE)); } if (cache_max_size > 0) { return new BoundedEntityManagerCacheImpl(cache_max_size); } return new UnBoundedEntityManagerCacheImpl(); } return null; }
Source:
protected WorkflowItemRest createAndReturn(Context context) { XmlWorkflowItem source; try { source = submissionService.createWorkflowItem(context, getRequestService().getCurrentRequest()); } catch (SQLException | AuthorizeException | WorkflowException e) { throw new RuntimeException(e.getMessage(), e); } if (source.getItem().isArchived()) { return null; } return converter.convert(source); }

Target:
protected WorkflowItemRest createAndReturn(Context context) { XmlWorkflowItem source; try { source = submissionService.createWorkflowItem(context, getRequestService().getCurrentRequest()); } catch (AuthorizeException e) { throw new RESTAuthorizationException(e); } catch (WorkflowException e) { throw new UnprocessableEntityException( "Invalid workflow action: " + e.getMessage(), e); } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } if (source.getItem().isArchived()) { return null; } return converter.convert(source); }
Source:
public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) .append("myId", myId) .append(myValueSet != null ? ("myValueSet - id=" + myValueSet.getId()) : ("myValueSet=(null)")) .append("myValueSetUrl", this.getValueSetUrl()) .append("myValueSetName", this.getValueSetName()) .append("mySystem", mySystem) .append("myCode", myCode) .append("myDisplay", myDisplay) .toString(); }

Target:
public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) .append("myId", myId) .append(myValueSet != null ? ("myValueSet - id=" + myValueSet.getId()) : ("myValueSet=(null)")) .append("myValueSetUrl", this.getValueSetUrl()) .append("myValueSetName", this.getValueSetName()) .append("mySystem", mySystem) .append("myCode", myCode) .append("myDisplay", myDisplay) .toString(); }
Source:
public Collection<T> values() { LinkedList<T> collection = new LinkedList<T>(); validate(); Set<String> keySet = litems.keySet(); for (String key: keySet) { LinkedList<T> list = litems.get(key); for (T item: list) { collection.add(item); } } return collection; }

Target:
public Collection<T> values() { LinkedList<T> collection = new LinkedList<T>(); validate(); Set<String> keySet = linkedListItems.keySet(); for (String key: keySet) { LinkedList<T> list = linkedListItems.get(key); for (T item: list) { collection.add(item); } } return collection; }
Source:
Bitmap decodeAsset(String filePath) throws IOException { BitmapFactory.Options options = null; if (data.hasSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; InputStream is = null; try { is = assetManager.open(filePath); BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } calculateInSampleSize(data.targetWidth, data.targetHeight, options, config); } InputStream is = assetManager.open(filePath); try { return BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } }

Target:
Bitmap decodeAsset(String filePath) throws IOException { BitmapFactory.Options options = null; if (data.hasSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; InputStream is = null; try { is = assetManager.open(filePath); BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } calculateInSampleSize(data.targetWidth, data.targetHeight, options, data.config); } InputStream is = assetManager.open(filePath); try { return BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } }
Source:
public void testClone() { executableMap.add(DEPENDENCY_NAME1, DEPENDENCY_VALUE11, JOB_TYPE_SPARK); Assert.assertEquals(1, executableMap.size()); ExecutableRampDependencyMap clonedExecutableMap = executableMap.clone(); Assert.assertEquals(clonedExecutableMap, executableMap); Assert.assertEquals(DEPENDENCY_VALUE11, executableMap.getDefaultValue(DEPENDENCY_NAME1)); Assert.assertEquals(DEPENDENCY_VALUE11, clonedExecutableMap.getDefaultValue(DEPENDENCY_NAME1)); ExecutableRampDependencyMap novaExecutableMap = ExecutableRampDependencyMap.createInstance(); novaExecutableMap.add(DEPENDENCY_NAME1, DEPENDENCY_VALUE12, JOB_TYPE_SPARK_PIG); executableMap.refresh(novaExecutableMap); Assert.assertEquals(1, executableMap.size()); Assert.assertEquals(DEPENDENCY_VALUE12, executableMap.getDefaultValue(DEPENDENCY_NAME1)); Assert.assertEquals(1, clonedExecutableMap.size()); Assert.assertEquals(DEPENDENCY_VALUE12, clonedExecutableMap.getDefaultValue(DEPENDENCY_NAME1)); }

Target:
public void testClone() { executableMap.add(DEPENDENCY_NAME1, DEPENDENCY_VALUE11, JOB_TYPE_SPARK); Assert.assertEquals(1, executableMap.size()); ExecutableRampDependencyMap clonedExecutableMap = executableMap.clone(); Assert.assertEquals(executableMap, clonedExecutableMap); Assert.assertEquals(DEPENDENCY_VALUE11, executableMap.getDefaultValue(DEPENDENCY_NAME1)); Assert.assertEquals(DEPENDENCY_VALUE11, clonedExecutableMap.getDefaultValue(DEPENDENCY_NAME1)); ExecutableRampDependencyMap novaExecutableMap = ExecutableRampDependencyMap.createInstance(); novaExecutableMap.add(DEPENDENCY_NAME1, DEPENDENCY_VALUE12, JOB_TYPE_SPARK_PIG); executableMap.refresh(novaExecutableMap); Assert.assertEquals(1, executableMap.size()); Assert.assertEquals(DEPENDENCY_VALUE12, executableMap.getDefaultValue(DEPENDENCY_NAME1)); Assert.assertEquals(1, clonedExecutableMap.size()); Assert.assertEquals(DEPENDENCY_VALUE12, clonedExecutableMap.getDefaultValue(DEPENDENCY_NAME1)); }
Source:
public String getBuilds(@QueryParam("repository") String repo, @QueryParam("userId") long userId) { List<Token> tokens = tokenDAO.findByUserId(userId); StringBuilder builder = new StringBuilder(); for (Token token : tokens) { if (token.getTokenSource().equals(TokenType.QUAY_IO.toString())) { Optional<String> asString = ResourceUtilities.asString(TARGET_URL + "repository/" + repo + "/build/", token.getContent(), client); if (asString.isPresent()) { String json = asString.get(); Gson gson = new Gson(); Map<String, ArrayList> map = new HashMap<>(); map = (Map<String, ArrayList>) gson.fromJson(json, map.getClass()); Map<String, Map<String, String>> map2 = new HashMap<>(); map2 = (Map<String, Map<String, String>>) map.get("builds").get(0); String gitURL = map2.get("trigger_metadata").get("git_url"); System.out.println(gitURL); builder.append(asString.get()); } builder.append("\n"); } } return builder.toString(); }

Target:
public String getBuilds(@QueryParam("repository") String repo, @QueryParam("userId") long userId) { List<Token> tokens = tokenDAO.findByUserId(userId); StringBuilder builder = new StringBuilder(); for (Token token : tokens) { if (token.getTokenSource().equals(TokenType.QUAY_IO.toString())) { Optional<String> asString = ResourceUtilities.asString(TARGET_URL + "repository/" + repo + "/build/", token.getContent(), client); if (asString.isPresent()) { String json = asString.get(); Gson gson = new Gson(); Map<String, ArrayList> map = new HashMap<>(); map = (Map<String, ArrayList>) gson.fromJson(json, map.getClass()); Map<String, Map<String, String>> map2 = new HashMap<>(); if (!map.get("builds").isEmpty()) { map2 = (Map<String, Map<String, String>>) map.get("builds").get(0); String gitURL = map2.get("trigger_metadata").get("git_url"); LOG.info(gitURL); ArrayList<String> tags = (ArrayList<String>) map2.get("tags"); for (String tag : tags) { LOG.info(tag); } } builder.append(asString.get()); } builder.append("\n"); } } return builder.toString(); }
Source:
private boolean isEmpty(String value) { return (value == null || value.trim().equals("")); }

Target:
private boolean isEmpty(String value) { return (value == null || value.trim().isEmpty()); }
Source:
public void createDirectory(Path path, FileAttribute<?>... fileAttributes) throws IOException { if (!(path instanceof AzurePath)) { throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of " + "Path other than AzurePath")); } fileAttributes = fileAttributes == null ? new FileAttribute<?>[0] : fileAttributes; BlobClient client = ((AzurePath) path).toBlobClient(); Path root = path.getRoot(); if (root != null && root.equals(path)) { throw Utility.logError(logger, new IOException("Creating a root directory is not supported.")); } if (checkParentDirectoryExists(path)) { try { List<FileAttribute<?>> attributeList = new ArrayList<>(Arrays.asList(fileAttributes)); BlobHttpHeaders headers = Utility.extractHttpHeaders(attributeList, logger); Map<String, String> metadata = Utility.convertAttributesToMetadata(attributeList); putDirectoryBlob(client, headers, metadata, new BlobRequestConditions().setIfNoneMatch("*")); } catch (BlobStorageException e) { if (e.getStatusCode() == HttpURLConnection.HTTP_CONFLICT) { throw Utility.logError(logger, new FileAlreadyExistsException(path.toString())); } else { throw Utility.logError(logger, new IOException("An error occured when creating the directory", e)); } } } else { throw Utility.logError(logger, new IOException("Parent directory does not exist for path: " + path.toString())); } }

Target:
public void createDirectory(Path path, FileAttribute<?>... fileAttributes) throws IOException { if (!(path instanceof AzurePath)) { throw Utility.logError(logger, new IllegalArgumentException("This provider cannot operate on subtypes of " + "Path other than AzurePath")); } fileAttributes = fileAttributes == null ? new FileAttribute<?>[0] : fileAttributes; BlobClient client = ((AzurePath) path).toBlobClient(); Path root = path.getRoot(); if (root != null && root.equals(path)) { throw Utility.logError(logger, new IOException("Creating a root directory is not supported.")); } if (checkParentDirectoryExists(path)) { try { List<FileAttribute<?>> attributeList = new ArrayList<>(Arrays.asList(fileAttributes)); BlobHttpHeaders headers = Utility.extractHttpHeaders(attributeList, logger); Map<String, String> metadata = Utility.convertAttributesToMetadata(attributeList); putDirectoryBlob(client, headers, metadata, new BlobRequestConditions().setIfNoneMatch("*")); } catch (BlobStorageException e) { if (e.getStatusCode() == HttpURLConnection.HTTP_CONFLICT && e.getErrorCode().equals(BlobErrorCode.BLOB_ALREADY_EXISTS)) { throw Utility.logError(logger, new FileAlreadyExistsException(path.toString())); } else { throw Utility.logError(logger, new IOException("An error occured when creating the directory", e)); } } } else { throw Utility.logError(logger, new IOException("Parent directory does not exist for path: " + path.toString())); } }
Source:
public Connection(final SessionTicket sessionTicket, SessionId sessionId) { if (sessionTicket == null) { throw new NullPointerException("session ticket must not be null"); } if (sessionId == null) { throw new NullPointerException("session identity must not be null"); } this.ticket = sessionTicket; this.sessionId =sessionId; this.peerAddress = null; this.autoResumptionTimeout = null; this.sessionListener = null; this.maxDeferredProcessedApplicationDataMessages = 0; this.deferredApplicationData = EMPTY; }

Target:
public Connection(final SessionTicket sessionTicket, SessionId sessionId) { if (sessionTicket == null) { throw new NullPointerException("session ticket must not be null"); } if (sessionId == null) { throw new NullPointerException("session identity must not be null"); } this.ticket = sessionTicket; this.sessionId =sessionId; this.peerAddress = null; this.autoResumptionTimeout = null; this.sessionListener = null; }
Source:
public ReadRowsRequest get() { if (cachedRequest == null) { Scan scan = new Scan(); if (start.get() != null && !start.get().isEmpty()) { scan.setStartRow(start.get().getBytes()); } if (stop.get() != null && !stop.get().isEmpty()) { scan.setStopRow(stop.get().getBytes()); } if (maxVersion.get() != null) { scan.setMaxVersions(maxVersion.get()); } if (filter.get() != null && !filter.get().isEmpty()) { try { scan.setFilter(new ParseFilter().parseFilterString(filter.get())); } catch (CharacterCodingException e) { throw new RuntimeException(e); } } ReadHooks readHooks = new DefaultReadHooks(); Query query = Query.create(options.getBigtableTableId().get()); Adapters.SCAN_ADAPTER.adapt(scan, readHooks, query); cachedRequest = ((Query)readHooks.applyPreSendHook(query)).toProto(requestContext); } return cachedRequest; }

Target:
public ReadRowsRequest get() { if (cachedRequest == null) { Scan scan = new Scan(); if (start.get() != null && !start.get().isEmpty()) { scan.setStartRow(start.get().getBytes()); } if (stop.get() != null && !stop.get().isEmpty()) { scan.setStopRow(stop.get().getBytes()); } if (maxVersion.get() != null) { scan.setMaxVersions(maxVersion.get()); } if (filter.get() != null && !filter.get().isEmpty()) { try { scan.setFilter(new ParseFilter().parseFilterString(filter.get())); } catch (CharacterCodingException e) { throw new RuntimeException(e); } } ReadHooks readHooks = new DefaultReadHooks(); Query query = Query.create(PLACEHOLDER_TABLE_ID); Adapters.SCAN_ADAPTER.adapt(scan, readHooks, query); readHooks.applyPreSendHook(query); RequestContext requestContext = RequestContext.create(PLACEHOLDER_PROJECT_ID, PLACEHOLDER_INSTANCE_ID, PLACEHOLDER_APP_PROFILE_ID); cachedRequest = query.toProto(requestContext).toBuilder().setTableName("").setAppProfileId("").build(); } return cachedRequest; }
Source:
public void testHealthCheck(String host, String opHost) { String resp = Tester.newClient(host).healthCheck(); assertNotNull(resp); assertEquals(new String("{\"status\":\"running\"}").trim(), resp); }

Target:
public void testHealthCheck(String host, String opHost) { String resp = Tester.newClient(host).healthCheck(); assertNotNull(resp); assertEquals("{\"status\":\"running\"}", resp); }
Source:
public void loadKeyDSA() throws IOException, GeneralSecurityException { File file = new File(this.getClass().getResource("dsa").getFile()); assertkeyPair(file, null); }

Target:
public void loadKeyDSA() throws IOException, GeneralSecurityException { File file = new File(this.getClass().getResource("dsa").getFile()); assertKeyPairNotNull(file, null); }
Source:
private void move(Player player, int dx, int dy){ Point point = grid.find(player); point.translate(dx, dy); if (grid.isValidPoint(point) && grid.isPassable(point)){ grid.set(player, point); } }

Target:
private void move(Player player, int dx, int dy){ Point origin = grid.find(player); Point dest = new Point(origin); dest.translate(dx, dy); if (grid.getPossibleMoves(origin).contains(dest)){ grid.set(player, dest); } }
Source:
public void initMetrics(SystemStreamPartition systemStreamPartition) { this.noMoreMessageGaugeMap.putIfAbsent(systemStreamPartition, metricsRegistry.<Integer>newGauge(group, "no-more-messages-" + systemStreamPartition, 0)); this.blockingPollCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-count-" + systemStreamPartition)); this.blockingPollTimeoutCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-timeout-count-" + systemStreamPartition)); metricsRegistry.<Integer>newGauge(group, new BufferGauge(systemStreamPartition, "buffered-message-count-" + systemStreamPartition)); metricsRegistry.<Long>newGauge(group, new BufferSizeGauge(systemStreamPartition, "buffered-message-size-" + systemStreamPartition)); }

Target:
public void initMetrics(SystemStreamPartition systemStreamPartition) { this.noMoreMessageGaugeMap.putIfAbsent(systemStreamPartition, metricsRegistry.newGauge(group, "no-more-messages-" + systemStreamPartition, 0)); this.blockingPollCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-count-" + systemStreamPartition)); this.blockingPollTimeoutCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-timeout-count-" + systemStreamPartition)); metricsRegistry.<Integer>newGauge(group, new BufferGauge(systemStreamPartition, "buffered-message-count-" + systemStreamPartition)); metricsRegistry.<Long>newGauge(group, new BufferSizeGauge(systemStreamPartition, "buffered-message-size-" + systemStreamPartition)); }
Source:
public int compareTo(final Repo repo) { int returnValue; if (repo instanceof RtRepo) { final RtRepo rtRepo = (RtRepo) repo; returnValue = this.entry.uri().get().compareTo( rtRepo.entry.uri().get() ); if (returnValue == 0) { returnValue = this.coords.compareTo(rtRepo.coords); } } else { returnValue = -1; } return returnValue; }

Target:
public int compareTo(final Repo repo) { return this.coords.compareTo(repo.coordinates()); }
Source:
public void refreshIndexDelta() { if(repository.isBare()) { refresh(); return; } try { DirCache currentIndex = repository.readDirCache(); DirCache oldIndex = lastIndex; lastIndex = currentIndex; if(oldIndex == null) { refresh(); return; } Set<String> paths = new TreeSet<String>(); TreeWalk walk = new TreeWalk(repository); walk.addTree(new DirCacheIterator(oldIndex)); walk.addTree(new DirCacheIterator(currentIndex)); walk.setFilter(TreeFilter.ANY_DIFF); while(walk.next()) { if(walk.isSubtree()) walk.enterSubtree(); else paths.add(walk.getPathString()); } if(!paths.isEmpty()) { refreshFiles(paths); } } catch (Exception ex) { Activator.error(String.format(CoreText.IndexDiffCacheEntry_failed_index_load, repository), ex); scheduleReloadJob("failed to calculate index delta!"); } }

Target:
private void refreshIndexDelta() { if (repository.isBare()) return; try { DirCache currentIndex = repository.readDirCache(); DirCache oldIndex = lastIndex; lastIndex = currentIndex; if (oldIndex == null) { refresh(); return; } Set<String> paths = new TreeSet<String>(); TreeWalk walk = new TreeWalk(repository); try { walk.addTree(new DirCacheIterator(oldIndex)); walk.addTree(new DirCacheIterator(currentIndex)); walk.setFilter(TreeFilter.ANY_DIFF); while (walk.next()) { if(walk.isSubtree()) walk.enterSubtree(); else paths.add(walk.getPathString()); } } finally { walk.release(); } if (!paths.isEmpty()) refreshFiles(paths); } catch (IOException ex) { Activator.error(String.format(CoreText.IndexDiffCacheEntry_errorCalculatingIndexDelta, repository), ex); scheduleReloadJob("Exception while calculating index delta, doing full reload instead"); } }
Source:
MultiUserCase(Path caseDirectoryPath) throws CaseMetadata.CaseMetadataException { CaseMetadata caseMetadata = null; try { caseMetadata = getCaseMetadataFromCaseDirectoryPath(caseDirectoryPath); } catch (CaseMetadata.CaseMetadataException ex) { logger.log(Level.SEVERE, String.format("Error reading the case metadata for %s.", caseDirectoryPath), ex); throw ex; } this.caseDirectoryPath = caseDirectoryPath; caseName = caseMetadata.getCaseDisplayName(); metadataFilePath = caseDirectoryPath.resolve(caseMetadata.getCaseName() + CaseMetadata.getFileExtension()); BasicFileAttributes fileAttrs = null; try { fileAttrs = Files.readAttributes(metadataFilePath, BasicFileAttributes.class); } catch (IOException ex) { logger.log(Level.SEVERE, String.format("Error reading file attributes of case metadata file in %s, will use current time for case createDate/lastModfiedDate", caseDirectoryPath), ex); } if (null != fileAttrs) { createDate = new Date(fileAttrs.creationTime().toMillis()); lastAccessedDate = new Date(fileAttrs.lastAccessTime().toMillis()); } else { createDate = new Date(); lastAccessedDate = new Date(); } }

Target:
MultiUserCase(Path caseDirectoryPath) throws CaseMetadata.CaseMetadataException, MultiUserCaseException { CaseMetadata caseMetadata = null; try { caseMetadata = getCaseMetadataFromCaseDirectoryPath(caseDirectoryPath); } catch (CaseMetadata.CaseMetadataException ex) { logger.log(Level.SEVERE, String.format("Error reading the case metadata for %s.", caseDirectoryPath), ex); throw ex; } this.caseDirectoryPath = caseDirectoryPath; caseName = caseMetadata.getCaseDisplayName(); metadataFilePath = caseMetadata.getFilePath(); BasicFileAttributes fileAttrs = null; try { fileAttrs = Files.readAttributes(metadataFilePath, BasicFileAttributes.class); } catch (IOException ex) { logger.log(Level.SEVERE, String.format("Error reading file attributes of case metadata file in %s, will use current time for case createDate/lastModfiedDate", caseDirectoryPath), ex); } if (null != fileAttrs) { createDate = new Date(fileAttrs.creationTime().toMillis()); lastAccessedDate = new Date(fileAttrs.lastAccessTime().toMillis()); } else { createDate = new Date(); lastAccessedDate = new Date(); } }
Source:
public static String toBase64(String string) { if (string == null) { return null; } String base64 = new String(Base64.getEncoder().encode(string.getBytes(UTF_8)), UTF_8); String temp = base64; StringBuilder str = new StringBuilder(); while ((temp.length() / 76) > 0) { str.append(temp.substring(0, 76)); str.append("\n"); temp = temp.substring(76, temp.length()); } base64 = str.append(temp).toString(); return base64; }

Target:
public static String toBase64(String string) { return toBase64_(string.getBytes(UTF_8)); }
Source:
public void createEnvironment(final BasicEnvironmentConfig config, final Username user, final LocalizedOperationResult result) { Localizable noPermission = LocalizedMessage.string("NO_PERMISSION_TO_ADD_ENVIRONMENT", user.getDisplayName()); Localizable.CurryableLocalizable actionFailed = LocalizedMessage.string("ENV_ADD_FAILED"); editEnvironments(new EditEnvironments() { public void performEdit() { if (goConfigService.hasEnvironmentNamed(config.name())) { result.conflict(LocalizedMessage.string("CANNOT_ADD_ENV_ALREADY_EXISTS", config.name())); return; } goConfigService.addEnvironment(config, user); } }, user, result, noPermission, actionFailed); }

Target:
public void createEnvironment(final BasicEnvironmentConfig config, final Username user, final LocalizedOperationResult result) { Localizable noPermission = LocalizedMessage.string("NO_PERMISSION_TO_ADD_ENVIRONMENT", user.getDisplayName()); Localizable.CurryableLocalizable actionFailed = LocalizedMessage.string("ENV_ADD_FAILED"); editEnvironments(new EditEnvironments() { public void performEdit() { if (goConfigService.hasEnvironmentNamed(config.name())) { result.conflict(LocalizedMessage.string("CANNOT_ADD_ENV_ALREADY_EXISTS", config.name())); return; } goConfigService.updateConfig(new AddEnvironmentCommand(config, user)); } }, user, result, noPermission, actionFailed); }
Source:
public Set<PartitionLoad> getPartitionLoads(){ Map<byte[], RegionLoad> regionsLoad=load.getRegionsLoad(); Set<PartitionLoad> loads = new HashSet<>(regionsLoad.size(),0.9f); for(Map.Entry<byte[],RegionLoad> regionLoad:regionsLoad.entrySet()){ String name = Bytes.toString(regionLoad.getKey()); RegionLoad rl = regionLoad.getValue(); PartitionLoad pl = new HPartitionLoad(name,rl.getStorefileSizeMB()*1024,rl.getMemStoreSizeMB()*1024); loads.add(pl); } return loads; }

Target:
public Set<PartitionLoad> getPartitionLoads(){ Map<byte[], RegionMetrics> regionsLoad=load.getRegionMetrics(); Set<PartitionLoad> loads = new HashSet<>(regionsLoad.size(),0.9f); for(Map.Entry<byte[], RegionMetrics> regionLoad:regionsLoad.entrySet()){ String name = Bytes.toString(regionLoad.getKey()); RegionMetrics rm = regionLoad.getValue(); PartitionLoad pl = new HPartitionLoad(name, (long) rm.getStoreFileSize().get(Size.Unit.BYTE), (long) rm.getMemStoreSize().get(Size.Unit.BYTE)); loads.add(pl); } return loads; }
Source:
public Pair<Long, Long> find(byte bucket, byte[] begin, boolean reverse) throws IOException { if(begin == null) { SortedMap<Long, Long> m = txnTimeline.get(bucket); if(reverse) { if(m.size() == 0) { return null; } return new Pair<>(m.lastKey(), m.get(m.lastKey())); } else { if(m.size() == 0) { return null; } return new Pair<>(m.firstKey(), m.get(m.firstKey())); } } else { long txnId = Bytes.toLong(Bytes.slice(begin, 1, begin.length-1)); SortedMap<Long, Long> m = txnTimeline.get(bucket); if(reverse) { if(m.size() == 0) { return null; } else { long prev = -1; for(long k : m.keySet()) { if(k <= txnId) { prev = k; } else { return new Pair<>(prev, m.get(prev)); } } } } else { if(m.size() == 0) { return null; } else { for(long k : m.keySet()) { if (k > txnId) { return new Pair<>(k, m.get(k)); } } } } } return null; }

Target:
public Pair<Long, Long> find(byte bucket, byte[] begin, boolean reverse) throws IOException { SortedMap<Long, Long> m = txnTimeline.get(bucket); if(m.size() == 0) { return null; } if(begin == null) { if(reverse) { return new Pair<>(m.lastKey(), m.get(m.lastKey())); } else { return new Pair<>(m.firstKey(), m.get(m.firstKey())); } } else { long txnId = Bytes.toLong(Bytes.slice(begin, 1, begin.length-1)); if(reverse) { long prev = -1; for(long k : m.keySet()) { if(k <= txnId) { prev = k; } else { return new Pair<>(prev, m.get(prev)); } } } else { for(long k : m.keySet()) { if (k > txnId) { return new Pair<>(k, m.get(k)); } } } } return null; }
Source:
public void controller(PageModel model, @RequestParam(value = "returnUrl", required = false) String returnUrl) { model.addAttribute("returnUrl", returnUrl); String criterion = Context.getAdministrationService().getGlobalProperty(CoreAppsConstants.CONDITIONS_TO_BE_DISPLAYED); String criterion_array[] = criterion.split(","); String conditionListClasses= ""; for(String i : criterion_array) { if(i.equalsIgnoreCase("Diagnosis")) conditionListClasses += "8d4918b0-c2cc-11de-8d13-0010c6dffd0f,"; else if(i.equalsIgnoreCase("Symptom")) conditionListClasses += "8d492954-c2cc-11de-8d13-0010c6dffd0f,"; else if(i.equalsIgnoreCase("Symptom/Finding")) conditionListClasses += "8d492b2a-c2cc-11de-8d13-0010c6dffd0f,"; else conditionListClasses += "8d491a9a-c2cc-11de-8d13-0010c6dffd0f,"; } conditionListClasses = conditionListClasses.substring(0,conditionListClasses.length()-1); model.addAttribute("conditionListClasses",conditionListClasses); }

Target:
public void controller(PageModel model, @RequestParam(value = "returnUrl", required = false) String returnUrl) { model.addAttribute("returnUrl", returnUrl); String conditionListClasses = Context.getAdministrationService().getGlobalProperty(CoreAppsConstants.GLOBAL_PROPERTY_CONDITIONS_CRITERIA); model.addAttribute("conditionListClasses",conditionListClasses); }