auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void takeEvidenceAndAnswerQuery() { Map<Timestep, Evidence> slicedEvidence = DBLOGUtil .splitEvidenceInTime(evidence); Map<Timestep, List<Query>> slicedQueries = DBLOGUtil .splitQueriesInTime((List<Query>) queries); if (slicedEvidence.containsKey(null)) { take(slicedEvidence.get(null)); } List<Timestep> nonNullTimesteps = new ArrayList<Timestep>(); nonNullTimesteps.addAll(slicedEvidence.keySet()); nonNullTimesteps.addAll(slicedQueries.keySet()); nonNullTimesteps.remove(null); Collections.sort(nonNullTimesteps); for (Timestep timestep : nonNullTimesteps) { if (slicedEvidence.containsKey(timestep)) { take(slicedEvidence.get(timestep)); } if (slicedQueries.containsKey(timestep)) { List<Query> currentQueries = slicedQueries.get(timestep); for (Particle particle : particles) { particle.answer(currentQueries); } if (timestep.intValue() % queryReportInterval == 0) { System.out.println("======== Query Results ========="); System.out.println("After timestep " + timestep.intValue()); for (Query q : currentQueries) { q.printResults(System.out); } } } removePriorTimeSlice(timestep); } if (slicedQueries.containsKey(null)) { List<Query> currentQueries = slicedQueries.get(null); for (Particle particle : particles) { particle.answer(currentQueries); } } }

Target:
private void takeEvidenceAndAnswerQuery() { Map<Timestep, Evidence> slicedEvidence = DBLOGUtil .splitEvidenceInTime(evidence); Map<Timestep, List<Query>> slicedQueries = DBLOGUtil .splitQueriesInTime((List<Query>) queries); if (slicedEvidence.containsKey(null)) { take(slicedEvidence.get(null)); } List<Timestep> nonNullTimesteps = new ArrayList<Timestep>(); nonNullTimesteps.addAll(slicedEvidence.keySet()); nonNullTimesteps.addAll(slicedQueries.keySet()); nonNullTimesteps.remove(null); TreeSet<Timestep> sortedTimesteps = new TreeSet<Timestep>(nonNullTimesteps); for (Timestep timestep : sortedTimesteps) { if (slicedEvidence.containsKey(timestep)) { take(slicedEvidence.get(timestep)); } if (slicedQueries.containsKey(timestep)) { List<Query> currentQueries = slicedQueries.get(timestep); for (Particle particle : particles) { particle.answer(currentQueries); } if (timestep.intValue() % queryReportInterval == 0) { TableWriter tableWriter = new TableWriter(queries); tableWriter.setHeader("After timestep " + timestep.intValue()); tableWriter.writeResults(System.out); } } removePriorTimeSlice(timestep); } if (slicedQueries.containsKey(null)) { List<Query> currentQueries = slicedQueries.get(null); for (Particle particle : particles) { particle.answer(currentQueries); } } }
Source:
public void migrate() { MigrationContext context = new MigrationContext(databaseType); try (Handle handle = dbi.open()) { boolean isInitial = !existsSchemaMigrationsTable(handle); if (isInitial) { createSchemaMigrationsTable(handle, context); } for (Migration m : migrations) { Set<String> appliedSet = getAppliedMigrationNames(handle); if (appliedSet.add(m.getVersion())) { logger.info("Applying database migration:" + m.getVersion()); if (m.noTransaction()) { applyMigration(m, handle, context); } else { handle.inTransaction((h, session) -> { if (context.isPostgres()) { h.update("LOCK TABLE schema_migrations IN EXCLUSIVE MODE"); } applyMigration(m, handle, context); return true; }); } } } } }

Target:
public int migrate() { int numApplied = 0; MigrationContext context = new MigrationContext(databaseType); try (Handle handle = dbi.open()) { boolean isInitial = !existsSchemaMigrationsTable(handle); if (isInitial) { createSchemaMigrationsTable(handle, context); } for (Migration m : migrations) { Set<String> appliedSet = getAppliedMigrationNames(handle); if (appliedSet.add(m.getVersion())) { logger.info("Applying database migration:" + m.getVersion()); numApplied++; if (m.noTransaction()) { applyMigration(m, handle, context); } else { handle.inTransaction((h, session) -> { if (context.isPostgres()) { h.update("LOCK TABLE schema_migrations IN EXCLUSIVE MODE"); } applyMigration(m, handle, context); return true; }); } } } } return numApplied; }
Source:
public void onDeploy(DeploymentEvent event) { InternalRuntimeManager runtimeManager = (InternalRuntimeManager) event.getDeployedUnit().getRuntimeManager(); if (runtimeManager instanceof PerCaseRuntimeManager) { List<CaseEventListener> caseEventListeners = getEventListenerFromDescriptor(runtimeManager); logger.debug("Adding following case event listeners for deployment {}", caseEventListeners, event.getDeploymentId()); TransactionalCommandService commandService = transactionalCommandService; if (commandService == null) { commandService = new TransactionalCommandService(((SimpleRuntimeEnvironment) runtimeManager.getEnvironment()).getEmf()); } CaseEventListener auditEventListener = getCaseAuditEventListner(runtimeManager, commandService); caseEventListeners.add(auditEventListener); caseEventListeners.add(new NotifyParentCaseEventListener(identityProvider)); CaseEventSupport caseEventSupport = new CaseEventSupport(identityProvider, caseEventListeners); ((PerCaseRuntimeManager) runtimeManager).setCaseEventSupport(caseEventSupport); logger.debug("CaseEventSupport configured for deployment {}", event.getDeploymentId()); } }

Target:
public void onDeploy(DeploymentEvent event) { InternalRuntimeManager runtimeManager = (InternalRuntimeManager) event.getDeployedUnit().getRuntimeManager(); if (runtimeManager instanceof PerCaseRuntimeManager) { List<CaseEventListener> caseEventListeners = getEventListenerFromDescriptor(runtimeManager); logger.debug("Adding following case event listeners for deployment {}", caseEventListeners, event.getDeploymentId()); TransactionalCommandService commandService = transactionalCommandService; if (commandService == null) { commandService = new TransactionalCommandService(((SimpleRuntimeEnvironment) runtimeManager.getEnvironment()).getEmf()); } CaseEventListener auditEventListener = getCaseAuditEventListener(runtimeManager, commandService); caseEventListeners.add(auditEventListener); caseEventListeners.add(new NotifyParentCaseEventListener(identityProvider)); CaseEventSupport caseEventSupport = new CaseEventSupport(identityProvider, caseEventListeners); ((PerCaseRuntimeManager) runtimeManager).setCaseEventSupport(caseEventSupport); logger.debug("CaseEventSupport configured for deployment {}", event.getDeploymentId()); } }
Source:
public void setSpmMap(String spId, Host host) { spmMap.put(spId, host); }

Target:
public void setSpmMap(String spId, Host host) { this.spmMap.put(spId, host); }
Source:
protected void relayout(ToolBar layoutBar, int oldCount, int newCount) { if (oldCount != newCount && newCount != 0) { Point beforePack = layoutBar.getSize(); layoutBar.pack(true); Point afterPack = layoutBar.getSize(); if (beforePack.equals(afterPack)) { return; } layoutBar.getParent().layout(); if (layoutBar.getParent() instanceof CoolBar) { CoolBar cb = (CoolBar) layoutBar.getParent(); CoolItem[] items = cb.getItems(); for (CoolItem item : items) { if (item.getControl() == layoutBar) { Point curSize = item.getSize(); item.setSize(curSize.x + (afterPack.x - beforePack.x), curSize.y + (afterPack.y - beforePack.y)); return; } } } layoutBar.getParent().requestLayout(); } }

Target:
protected void relayout(ToolBar layoutBar, int oldCount, int newCount) { if (oldCount != newCount && newCount != 0) { Point beforePack = layoutBar.getSize(); layoutBar.pack(true); Point afterPack = layoutBar.getSize(); if (beforePack.equals(afterPack)) { return; } layoutBar.requestLayout(); if (layoutBar.getParent() instanceof CoolBar) { CoolBar cb = (CoolBar) layoutBar.getParent(); CoolItem[] items = cb.getItems(); for (CoolItem item : items) { if (item.getControl() == layoutBar) { Point curSize = item.getSize(); item.setSize(curSize.x + (afterPack.x - beforePack.x), curSize.y + (afterPack.y - beforePack.y)); return; } } } } }
Source:
public void exportCsv() throws IOException { bootstrap("--input", "../test-files/Windup1x-javaee-example-tiny.war", "--output", tmp.getRoot().getAbsolutePath(), "--target", "eap7", "--exportCSV"); File csv = new File(tmp.getRoot(), "Windup1x_javaee_example_tiny_war.csv"); assertTrue(csv.exists()); String csvContent = new String(Files.readAllBytes(csv.toPath()), "UTF-8"); assertTrue(csvContent.contains("Windup1x-javaee-example-tiny.war")); File allIssuesCsv = new File(tmp.getRoot(), "AllIssues.csv"); assertTrue(allIssuesCsv.exists()); File appTagsCsv = new File(tmp.getRoot(), "ApplicationFileTechnologies.csv"); assertTrue(appTagsCsv.exists()); }

Target:
public void exportCsv() throws IOException { bootstrap("--input", "../test-files/Windup1x-javaee-example-tiny.war", "--output", tmp.getRoot().getAbsolutePath(), "--target", "eap7", "--exportCSV"); File csv = new File(tmp.getRoot(), "Windup1x_javaee_example_tiny_war.csv"); assertTrue(csv.exists()); String csvContent = new String(Files.readAllBytes(csv.toPath()), "UTF-8"); assertTrue(csvContent.contains("Windup1x-javaee-example-tiny.war")); File allIssuesCsv = new File(tmp.getRoot(), "AllIssues.csv"); assertTrue(allIssuesCsv.exists()); File appTagsCsv = new File(tmp.getRoot(), "ApplicationFileTechnologies.csv"); assertTrue(appTagsCsv.exists()); List<List<String>> records = readCSVFile(appTagsCsv); assertTrue(records.stream().allMatch(this::isRowSorted)); }
Source:
public QuotaStorageConsumptionParameter clone() { return new QuotaStorageConsumptionParameter( this.quotaGuid, this.quota, this.action, this.storageDomainId, this.requestedStorageGB); }

Target:
public QuotaStorageConsumptionParameter clone() { return new QuotaStorageConsumptionParameter( this.getQuotaGuid(), this.getQuota(), this.getAction(), this.storageDomainId, this.requestedStorageGB); }
Source:
public static <T extends Serializable> T roundtrip(final T msg) { return SerializationUtils.deserialize(SerializationUtils.serialize(msg)); }

Target:
public static <T extends Serializable> T roundtrip(final T msg) { return (T) SerializationUtils.deserialize(SerializationUtils.serialize(msg)); }
Source:
private List<AbstractInsnNode> createInstructionList() { final List<AbstractInsnNode> list = new LinkedList<>(); for (AbstractInsnNode abstractInsnNode : this.rawNode.instructions) { list.add(abstractInsnNode); } this.lazyInstructions = new ArrayList<>(list); return this.lazyInstructions; }

Target:
private List<AbstractInsnNode> createInstructionList() { final List<AbstractInsnNode> list = new ArrayList<>(); for (AbstractInsnNode abstractInsnNode : this.rawNode.instructions) { list.add(abstractInsnNode); } this.lazyInstructions = list; return this.lazyInstructions; }
Source:
public static boolean containsControlCharacters( String path ) { if ( StringUtils.isNotBlank( path ) ) { Pattern pattern = Pattern.compile( "[\\x00-\\x1F\\x7F]" ); Matcher matcher = pattern.matcher( path ); return matcher.find(); } return false; }

Target:
public static boolean containsControlCharacters( String path ) { RegExp pattern = RegExp.compile( "[\\x00-\\x1F\\x7F]" ); return pattern.test( path ); }
Source:
public void simple_for() { verifyBlockCfg("" + "before(succ = [cond], elem = 1);" + "for ($i=1, $j=1 ; $i < 1, $j < 1, cond(succ=[forBody, END], elem=5); update(succ=[cond], elem=2), $i++) {" + " forBody( succ = [update], elem = 1 );" + "}"); verifyBlockCfg("" + "for ($i=1 ; cond(succ=[forBody, END], elem=2); $i++, $i++, update(succ=[cond], elem=3)) :" + " forBody(succ=[update], elem=1 );" + "endfor;"); }

Target:
public void simple_for() { verifyBlockCfg("" + "before(succ = [cond], elem = 3);" + "for ($i=1, $j=1 ; cond(succ = [forBody, END], elem=3), $i < 1, $j < 1; update(succ = [cond], elem=2), $i++) {" + " forBody( succ = [update], elem = 1 );" + "}"); verifyBlockCfg("" + "for (before(succ = [cond], elem = 2), $i=1; cond(succ = [forBody, END], elem=2), $i < 10; update(succ = [cond], elem = 2), $i++ ) :" + " forBody(succ = [update], elem=1 );" + "endfor;"); }
Source:
public <T> FieldProjectionBuilder<T> createFieldValueProjectionBuilder(String absoluteFieldPath, Class<T> expectedType, ProjectionConverter projectionConverter) { checkProjectable( absoluteFieldPath, projectable ); if ( projectionConverter.isEnabled() && !converter.isConvertedTypeAssignableTo( expectedType ) ) { throw log.invalidProjectionInvalidType( absoluteFieldPath, expectedType, EventContexts.fromIndexFieldAbsolutePath( absoluteFieldPath ) ); } return (FieldProjectionBuilder<T>) new LuceneFieldProjectionBuilder<>( absoluteFieldPath, getConverter( projectionConverter ), codec ); }

Target:
public <T> FieldProjectionBuilder<T> createFieldValueProjectionBuilder(String absoluteFieldPath, Class<T> expectedType, ProjectionConverter projectionConverter) { checkProjectable( absoluteFieldPath, projectable ); FromDocumentFieldValueConverter<? super F, ?> requestConverter = getConverter( projectionConverter ); if ( !requestConverter.isConvertedTypeAssignableTo( expectedType ) ) { throw log.invalidProjectionInvalidType( absoluteFieldPath, expectedType, EventContexts.fromIndexFieldAbsolutePath( absoluteFieldPath ) ); } return (FieldProjectionBuilder<T>) new LuceneFieldProjectionBuilder<>( absoluteFieldPath, requestConverter, codec ); }
Source:
private final void populateGrouplessLabels(List<String> finalLabels, List<String> matchedLabels, Optional<String> suggestion) { FlowPane groupless = createGroupPane(GROUPLESS_PAD); allLabels.stream() .filter(label -> !label.isInGroup()) .map(label -> new PickerLabel(label, false)) .forEach(label -> groupless.getChildren().add(processMatchedLabel( label.getFullName(), matchedLabels, finalLabels, suggestion))); if (!groupless.getChildren().isEmpty()) feedbackLabels.getChildren().add(groupless); }

Target:
private final void populateGrouplessLabels(List<String> finalLabels, List<String> matchedLabels, Optional<String> suggestion) { FlowPane groupless = createGroupPane(GROUPLESS_PAD); allLabels.stream() .filter(label -> !label.isInGroup()) .map(label -> new PickerLabel(label, false)) .forEach(label -> groupless.getChildren().add(processMatchedLabel( label.getFullName(), matchedLabels, finalLabels, suggestion))); feedbackLabels.getChildren().add(groupless); }
Source:
public List<IAtsConfigObject> getProgramInsertions(@PathParam("uuid") long uuid) throws Exception { ArtifactReadable programArt = atsServer.getQuery().andUuid(uuid).getResults().getExactlyOne(); if (!programArt.getArtifactType().equals(AtsArtifactTypes.Program)) { throw new OseeCoreException("Given uuid not program type"); } ResultSet<ArtifactReadable> results = programArt.getRelated(AtsRelationTypes.ProgramToInsertion_Insertion); List<IAtsConfigObject> insertions = new LinkedList<IAtsConfigObject>(); for (ArtifactReadable insertion : results) { insertions.add(atsServer.getConfigItemFactory().getInsertion(insertion)); } return insertions; }

Target:
public Response getProgramInsertions(@PathParam("uuid") long uuid) throws Exception { ArtifactReadable programArt = atsServer.getArtifactByUuid(uuid); if (programArt == null) { throw new OseeCoreException("Given uuid not found"); } if (!programArt.getArtifactType().equals(AtsArtifactTypes.Program)) { throw new OseeCoreException("Given uuid not program type"); } ResultSet<ArtifactReadable> results = programArt.getRelated(AtsRelationTypes.ProgramToInsertion_Insertion); List<IAtsConfigObject> insertions = new LinkedList<IAtsConfigObject>(); for (ArtifactReadable insertion : results) { insertions.add(atsServer.getConfigItemFactory().getInsertion(insertion)); } GenericEntity<List<IAtsConfigObject>> entity = new GenericEntity<List<IAtsConfigObject>>(insertions) { }; return Response.ok(entity).build(); }
Source:
private String formatColumnDefinition(ColumnDefinition column) { StringBuilder sb = new StringBuilder(formatExpression(column.getName(), parameters)) .append(" ").append(column.getType()); if (column.getComment().isPresent()) { sb.append(" COMMENT ").append(formatStringLiteral(column.getComment().get())); } sb.append(formatPropertiesSingleLine(column.getProperties())); if (!column.isNullable()) { sb.append(" NOT NULL "); } if (column.getDefaultValue().isPresent()) { sb.append(" DEFAULT ").append(column.getDefaultValue().get()); } return sb.toString(); }

Target:
private String formatColumnDefinition(ColumnDefinition column) { StringBuilder sb = new StringBuilder(formatExpression(column.getName(), parameters)) .append(" ").append(column.getType()); if (column.getDefaultValue().isPresent()) { sb.append(" DEFAULT ").append(column.getDefaultValue().get()); } if (!column.isNullable()) { sb.append(" NOT NULL"); } if (column.getComment().isPresent()) { sb.append(" COMMENT ").append(formatStringLiteral(column.getComment().get())); } sb.append(formatPropertiesSingleLine(column.getProperties())); return sb.toString(); }
Source:
private CompletableFuture<RestResponse> getCacheKeys(RestRequest request) throws RestResponseException { String cacheName = request.variables().get("cacheName"); String accept = request.getAcceptHeader(); if (accept == null) accept = MediaType.MATCH_ALL_TYPE; MediaType contentType = negotiateMediaType(accept, cacheName); AdvancedCache<Object, Object> cache = restCacheManager.getCache(cacheName, TEXT_PLAIN, TEXT_PLAIN); Charset mediaCharset = Charset.fromMediaType(accept); Charset charset = mediaCharset == null ? Charset.UTF8 : mediaCharset; return CompletableFuture.supplyAsync(cache::keySet, executor).thenApply(keys -> { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); responseBuilder.contentType(contentType); responseBuilder.header(HttpHeaderNames.CACHE_CONTROL.toString(), CacheControl.noCache()); OutputPrinter outputPrinter = EntrySetFormatter.forMediaType(contentType); responseBuilder.entity(outputPrinter.print(cacheName, keys, charset)); return responseBuilder.build(); }); }

Target:
private CompletionStage<RestResponse> getCacheKeys(RestRequest request) throws RestResponseException { String cacheName = request.variables().get("cacheName"); String accept = request.getAcceptHeader(); if (accept == null) accept = MediaType.MATCH_ALL_TYPE; MediaType contentType = negotiateMediaType(accept, cacheName); AdvancedCache<Object, Object> cache = restCacheManager.getCache(cacheName, TEXT_PLAIN, TEXT_PLAIN); Charset mediaCharset = Charset.fromMediaType(accept); Charset charset = mediaCharset == null ? Charset.UTF8 : mediaCharset; return CompletableFuture.supplyAsync(() -> { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); responseBuilder.contentType(contentType); responseBuilder.header(HttpHeaderNames.CACHE_CONTROL.toString(), CacheControl.noCache()); OutputPrinter outputPrinter = EntrySetFormatter.forMediaType(contentType); responseBuilder.entity(outputPrinter.print(cacheName, cache.keySet(), charset)); return responseBuilder.build(); }, executor); }
Source:
static <E,T> Validation<E,T> valid(Supplier<? extends T> supplier) { return new Valid<>(supplier.get()); }

Target:
static <E,T> Validation<E,T> valid(Supplier<? extends T> supplier) { Objects.requireNonNull(supplier, "supplier is null"); return new Valid<>(supplier.get()); }
Source:
private void saveUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, String resourceType, Map<String, String> details) { UsageEventVO usageEvent = new UsageEventVO(usageType, accountId, zoneId, resourceId, resourceName, offeringId, templateId, resourceType); _usageEventDao.persist(usageEvent); _usageEventDao.saveDetails(usageEvent.getId(), details); }

Target:
private void saveUsageEvent(String usageType, long accountId, long zoneId, long resourceId, String resourceName, Long offeringId, Long templateId, String resourceType, Map<String, String> details) { UsageEventVO usageEvent = new UsageEventVO(usageType, accountId, zoneId, resourceId, resourceName, offeringId, templateId, resourceType); usageEventDao.persist(usageEvent); usageEventDao.saveDetails(usageEvent.getId(), details); }
Source:
private static void start() { if (!isProperlyConfigured) { return; } try { logger.debug("Creating Cisco Spark client..."); CiscoSpark.spark = createSpark(); logger.debug("Retrieving user..."); Person person = CiscoSpark.spark.people().path("/me").get(); logger.info("Cisco Spark logged in as " + person.getDisplayName()); } catch (SparkException se) { logger.error("Failed to initialized Cisco Spark", se); } catch (Exception e) { logger.error("Failed to initialized Cisco Spark!", e); } logger.info("Cisco Spark has been successfully started"); }

Target:
private void start() { if (!isProperlyConfigured) { return; } try { logger.debug("Creating Cisco Spark client..."); CiscoSpark.spark = createSpark(); logger.debug("Retrieving user..."); Person person = CiscoSpark.spark.people().path("/me").get(); logger.info("Cisco Spark logged in as {}", person.getDisplayName()); } catch (SparkException se) { logger.warn("Failed to initialized Cisco Spark", se); } catch (Exception e) { logger.warn("Failed to initialized Cisco Spark!", e); } logger.info("Cisco Spark has been successfully started"); }
Source:
public SegmentKeyTracker(SegmentConsistentHash segmentConsistentHash, Set<Integer> segments) { int numSegments = segmentConsistentHash.getNumSegments(); keysPerSegment = new AtomicReferenceArray<>(numSegments); if (log.isDebugEnabled()) log.debugf("Created SegmentKeyTracker with %d segments", numSegments); this.segmentConsistentHash = segmentConsistentHash; Stream<Integer> segmentStream = segments == null ? IntStream.range(0, segmentConsistentHash.getNumSegments()).boxed() : segments.stream(); segmentStream.forEach(i -> keysPerSegment.set(i, CollectionFactory.makeSet(ByteArrayEquivalence.INSTANCE))); }

Target:
public SegmentKeyTracker(SegmentConsistentHash segmentConsistentHash, Set<Integer> segments) { int numSegments = segmentConsistentHash.getNumSegments(); keysPerSegment = new AtomicReferenceArray<>(numSegments); if (log.isDebugEnabled()) log.debugf("Created SegmentKeyTracker with %d segments", numSegments); this.segmentConsistentHash = segmentConsistentHash; IntStream segmentStream = segments == null ? IntStream.range(0, segmentConsistentHash.getNumSegments()) : segments.stream().mapToInt(i -> i); segmentStream.forEach(i -> keysPerSegment.set(i, CollectionFactory.makeSet(ByteArrayEquivalence.INSTANCE))); }
Source:
public Context startSavedSearchRequest(String searchName, String entity, String version) { return new DropwizardContext(name(API, "savedsearch", searchName, entity, version)); }

Target:
public Context startSavedSearchRequest(String searchName, String entity, String version) { return new DropwizardContext(name(API, "savedsearch", searchName, entity, formatVersion(version))); }
Source:
private boolean isInProvidedNamespace(Node node) { for (String providedNamespace : providedNamespaces) { @Nullable String rhsQualifiedName = node.getQualifiedName(); if ((null != rhsQualifiedName) && providedNamespace.startsWith(node.getQualifiedName())) { return true; } } return false; }

Target:
private boolean isInProvidedNamespace(Node node) { for (String providedNamespace : providedNamespaces) { @Nullable String rhsQualifiedName = node.getQualifiedName(); if ((rhsQualifiedName != null) && providedNamespace.startsWith(node.getQualifiedName())) { return true; } } return false; }
Source:
private File createTempIoFile(VirtualFile parent, String prefix, String suffix) throws IOException { File vfsDir = new File(ioRoot, toIoPath(parent.getPath().newPath(VFS_SERVICE_DIR))); vfsDir.mkdirs(); return File.createTempFile("modify", ".tmp", vfsDir); }

Target:
private File createTempIoFile(VirtualFile parent, String prefix, String suffix) throws IOException { File vfsDir = new File(ioRoot, toIoPath(parent.getPath().newPath(VFS_SERVICE_DIR))); vfsDir.mkdirs(); return File.createTempFile(prefix, suffix, vfsDir); }
Source:
private void shutdown(boolean fail) { this.ttlLatch.countDown(); if (fail) { transportConnection.forceClose(); } else { transportConnection.close(); } }

Target:
private void shutdown(boolean fail) { if (fail) { transportConnection.forceClose(); } else { transportConnection.close(); } }
Source:
private String getDefaultBrowserLanguage() { String defaultBrowserLanguage = null; switch (paymentLanguage) { case ENGLISH: defaultBrowserLanguage = Locale.forLanguageTag("en-GB").toLanguageTag(); break; case WELSH: defaultBrowserLanguage = Locale.forLanguageTag("cy-GB").toLanguageTag(); break; } return defaultBrowserLanguage; }

Target:
private String getDefaultBrowserLanguage() { if (paymentLanguage == SupportedLanguage.ENGLISH) { return "en-GB"; } return paymentLanguage.toString(); }
Source:
public void testOnStartCommandStartReplicationWaitsForSetReplicators() { PeriodicReplicationService service = new TestReplicationService(mMockContext); Intent intent = new Intent(mMockContext, TestReplicationService.class); intent.putExtra(PeriodicReplicationService.EXTRA_COMMAND, PeriodicReplicationService.COMMAND_START_REPLICATION); service.setReplicationPolicyManager(mMockReplicationPolicyManager); service.onCreate(); final CountDownLatch latch = new CountDownLatch(1); service.setOperationStartedListener(new PeriodicReplicationService .OperationStartedListener() { @Override public void operationStarted(int operationId) { if (operationId == PeriodicReplicationService.COMMAND_START_REPLICATION) { latch.countDown(); } } }); service.onStartCommand(intent, 0, 0); try { latch.await(1000, TimeUnit.MILLISECONDS); assertEquals("CountDownLatch should not be decremented", latch.getCount(), 1); service.setReplicators(mMockReplicators); latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public void testOnStartCommandStartReplicationWaitsForSetReplicators() { PeriodicReplicationService service = new TestReplicationService(mMockContext); Intent intent = new Intent(mMockContext, TestReplicationService.class); intent.putExtra(PeriodicReplicationService.EXTRA_COMMAND, PeriodicReplicationService.COMMAND_START_REPLICATION); service.setReplicationPolicyManager(mMockReplicationPolicyManager); service.onCreate(); final CountDownLatch latch = new CountDownLatch(1); service.setOperationStartedListener(new PeriodicReplicationService .OperationStartedListener() { @Override public void operationStarted(int operationId) { assertEquals("Unexpected command received", PeriodicReplicationService.COMMAND_START_REPLICATION, operationId); latch.countDown(); } }); service.onStartCommand(intent, 0, 0); try { latch.await(1000, TimeUnit.MILLISECONDS); assertEquals("CountDownLatch should not be decremented", latch.getCount(), 1); service.setReplicators(mMockReplicators); assertTrue("The countdown should reach zero", latch.await(DEFAULT_WAIT_SECONDS, TimeUnit.SECONDS)); } catch (InterruptedException e) { e.printStackTrace(); } }
Source:
private URIBuilder getFingerIdURI(String path) throws URISyntaxException { if (path == null) path = ""; URIBuilder builder = new URIBuilder(FINGERID_SOURCE); builder.setPath("/csi-fingerid-" + FingerIdWebMethod.fingerIdVersion() + path); return builder; }

Target:
private URIBuilder getFingerIdURI(String path) throws URISyntaxException { if (path == null) path = ""; URIBuilder builder = new URIBuilder(FINGERID_SOURCE); builder.setPath("/csi-fingerid-" + FINGERID_VERSION + path); return builder; }
Source:
public ParsedSql parse(String sql, StatementContext ctx) { return PARSED_SQL_CACHE.get(sql, ctx); }

Target:
public ParsedSql parse(String sql, StatementContext ctx) { try { return PARSED_SQL_CACHE.get(sql, ctx); } catch (IllegalArgumentException e) { throw new UnableToCreateStatementException("Exception parsing for named parameter replacement", e, ctx); } }
Source:
public List<HaxeModel> getExposedMembers() { HaxeClassBody body = UsefulPsiTreeUtil.getChild(haxeClass, HaxeClassBody.class); ArrayList<HaxeModel> out = new ArrayList<>(); if (body != null) { for (HaxeNamedComponent declaration : PsiTreeUtil.getChildrenOfAnyType(body, HaxeVarDeclaration.class, HaxeMethod.class)) { if (!(declaration instanceof PsiMember)) continue; if (declaration instanceof HaxeVarDeclaration) { HaxeVarDeclaration varDeclaration = (HaxeVarDeclaration)declaration; if (varDeclaration.getContainingClass() == haxeClass && varDeclaration.isPublic() && varDeclaration.isStatic()) { out.add(new HaxeFieldModel((HaxeVarDeclaration)declaration)); } } else { HaxeMethod method = (HaxeMethod)declaration; if (method.getContainingClass() == haxeClass && method.isStatic() && method.isPublic()) { out.add(new HaxeMethodModel(method)); } } } } return out; }

Target:
public List<HaxeModel> getExposedMembers() { HaxeClassBody body = UsefulPsiTreeUtil.getChild(haxeClass, HaxeClassBody.class); ArrayList<HaxeModel> out = new ArrayList<>(); if (body != null) { for (HaxeNamedComponent declaration : PsiTreeUtil.getChildrenOfAnyType(body, HaxeVarDeclaration.class, HaxeMethod.class)) { if (!(declaration instanceof PsiMember)) continue; if (declaration instanceof HaxeVarDeclaration) { HaxeVarDeclaration varDeclaration = (HaxeVarDeclaration)declaration; if (varDeclaration.isPublic() && varDeclaration.isStatic()) { out.add(new HaxeFieldModel((HaxeVarDeclaration)declaration)); } } else { HaxeMethod method = (HaxeMethod)declaration; if (method.isStatic() && method.isPublic()) { out.add(new HaxeMethodModel(method)); } } } } return out; }
Source:
public void validateSpaceNotEnough() throws Exception { AddVmCommand<VmManagementParametersBase> command = setupCanAddVmTests(0, 0); doReturn(ValidationResult.VALID).when(storageDomainValidator).isDomainWithinThresholds(); doReturn(new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN)). when(storageDomainValidator).hasSpaceForNewDisks(any(List.class)); doReturn(storageDomainValidator).when(command).createStorageDomainValidator(any(StorageDomain.class)); assertFalse(command.validateSpaceRequirements()); verify(storageDomainValidator).hasSpaceForNewDisks(any(List.class)); verify(storageDomainValidator, never()).hasSpaceForClonedDisks(any(List.class)); }

Target:
public void validateSpaceNotEnough() throws Exception { AddVmCommand<VmManagementParametersBase> command = setupCanAddVmTests(0, 0); doReturn(ValidationResult.VALID).when(storageDomainValidator).isDomainWithinThresholds(); doReturn(new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_TARGET_STORAGE_DOMAIN)). when(storageDomainValidator).hasSpaceForNewDisks(anyList()); doReturn(storageDomainValidator).when(command).createStorageDomainValidator(any(StorageDomain.class)); assertFalse(command.validateSpaceRequirements()); verify(storageDomainValidator).hasSpaceForNewDisks(anyList()); verify(storageDomainValidator, never()).hasSpaceForClonedDisks(anyList()); }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) return false; if (getGeoRepSession().getStatus() == GeoRepSessionStatus.PASSIVE) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GEOREP_SESSION_ALREADY_PAUSED); return false; } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getGeoRepSession().getStatus() == GeoRepSessionStatus.PASSIVE) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GEOREP_SESSION_ALREADY_PAUSED); } return true; }
Source:
public void run() { Multimap<String, Serializable> map = ArrayListMultimap.create(possibleKeys, possibleValues); while (!Thread.interrupted()){ int size = 0; boolean need_to_flash = false; Log current = null; while(size <= flushSize){ try { current = buffer.take(); if (isFlushLog(current)){ need_to_flash = true; break; }else{ map.put(current.getPath(), current.getValue()); size++; } } catch (InterruptedException e) { e.printStackTrace(); } } writeToFileStorage(map, need_to_flash); map.clear(); } }

Target:
public void run() { ArrayList<Log> temp = new ArrayList<Log>(flushSize+flushSize/2); boolean shutdown = false; while (!shutdown){ Multimap<String, Serializable> map = LinkedHashMultimap.create(); int size = 0; boolean need_to_flash = false; try { while (size < flushSize){ temp.add(buffer.take()); size++; size += buffer.drainTo(temp); need_to_flash = drainToMap(temp, map); if (need_to_flash){ break; } } } catch (InterruptedException e) { shutdown = true; }finally { writeToFileStorage(map, need_to_flash); } } }
Source:
public void onAuthCreated(BoxAuthentication.BoxAuthenticationInfo info) { mFolderApi = new BoxApiFolder(mSession); mFileApi = new BoxApiFile(mSession); mMetadataApi = new BoxApiMetadata(mSession); loadRootFolder(); }

Target:
public void onAuthCreated(BoxAuthentication.BoxAuthenticationInfo info) { mFolderApi = new BoxApiFolder(mSession); mFileApi = new BoxApiFile(mSession); loadRootFolder(); }
Source:
public static Iterable<Object[]> getTracePaths() throws Exception { final List<Object[]> dirs = new LinkedList<>(); addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "pass", "literal-integers")), IStatus.OK, 10, false); String tracePath; try { tracePath = FileLocator.toFileURL(CtfTestTrace.KERNEL.getTraceURL()).getPath(); } catch (IOException e) { throw new IllegalStateException(); } addDirsFrom(dirs, Paths.get(tracePath), IStatus.OK, 10, false); addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "fail", "enum-empty")), IStatus.WARNING, 1, true); addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "fail", "lttng-modules-2.0-pre1")), IStatus.WARNING, 1, true); addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("synctraces.tar.gz")), IStatus.ERROR, 1, false); return dirs; }

Target:
public static Iterable<Object[]> getTracePaths() throws Exception { final List<Object[]> dirs = new LinkedList<>(); addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "pass", "literal-integers")), IStatus.OK, 10, false); String tracePath = FileLocator.toFileURL(CtfTestTrace.KERNEL.getTraceURL()).getPath(); addDirsFrom(dirs, Paths.get(tracePath), IStatus.OK, 10, false); addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "fail", "enum-empty")), IStatus.WARNING, 1, true); addDirsFrom(dirs, CTF_SUITE_BASE_PATH.resolve(Paths.get("regression", "metadata", "fail", "lttng-modules-2.0-pre1")), IStatus.WARNING, 1, true); addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("synctraces.tar.gz")), IStatus.ERROR, 1, false); return dirs; }
Source:
private String sessionUserNameOr(String nameIfNoUser) { final Subject subject; if ((subject = EnvironmentContext.getCurrent().getSubject()) != Subject.ANONYMOUS) { return subject.getUserName(); } return nameIfNoUser; }

Target:
private String sessionUserNameOr(String nameIfNoUser) { final Subject subject = EnvironmentContext.getCurrent().getSubject(); if (!subject.isAnonymous()) { return subject.getUserName(); } return nameIfNoUser; }
Source:
public void nestedTxTest() throws Exception { FedoraTransaction parentTx = repository.startTransaction(); repository.createFolderObject(pid, model); FedoraTransaction subTx = repository.startTransaction(); PID workPid = repository.mintContentPid(); repository.createWorkObject(workPid); subTx.close(); assertNull(subTx.getTxUri()); assertNotNull((parentTx.getTxUri())); assertTrue(FedoraTransaction.isStillAlive()); parentTx.close(); assertNull(parentTx.getTxUri()); assertFalse(FedoraTransaction.isStillAlive()); }

Target:
public void nestedTxTest() throws Exception { FedoraTransaction parentTx = repository.startTransaction(); repository.createFolderObject(pid, model); FedoraTransaction subTx = repository.startTransaction(); PID workPid = repository.mintContentPid(); repository.createWorkObject(workPid); subTx.close(); assertNull(subTx.getTxUri()); verifyNonTxStatusCode(workPid, 404); assertNotNull((parentTx.getTxUri())); assertTrue(FedoraTransaction.isStillAlive()); parentTx.close(); assertNull(parentTx.getTxUri()); assertFalse(FedoraTransaction.isStillAlive()); verifyNonTxStatusCode(workPid, 200); }
Source:
public T newEntity2(Map flags, Entity owner) { Constructor<T> constructor; try { constructor = clazz.getConstructor(Map.class, Entity.class); } catch (NoSuchMethodException e) { throw Throwables.propagate(e); } try { return constructor.newInstance(flags, owner); } catch (InstantiationException e) { throw Throwables.propagate(e); } catch (IllegalAccessException e) { throw Throwables.propagate(e); } catch (InvocationTargetException e) { throw Throwables.propagate(e); } }

Target:
public T newEntity2(Map flags, Entity owner) { try { Constructor<T> constructor = clazz.getConstructor(Map.class, Entity.class); return constructor.newInstance(flags, owner); } catch (InstantiationException e) { throw Throwables.propagate(e); } catch (IllegalAccessException e) { throw Throwables.propagate(e); } catch (InvocationTargetException e) { throw Throwables.propagate(e); } catch (NoSuchMethodException e) { throw Throwables.propagate(e); } }
Source:
private void insertEmptyLines(CodeMirror cm, int line, int cnt) { Element div = DOM.createDiv(); div.setClassName(diffTable.style.padding()); div.setAttribute("style", "height : " + cnt + "em"); Configuration config = Configuration.create() .set("coverGutter", true) .set("above", line == 0); cm.addLineWidget(line == 0 ? 0 : (line - 1), div, config); }

Target:
private void insertEmptyLines(CodeMirror cm, int line, int cnt) { Element div = DOM.createDiv(); div.setClassName(diffTable.style.padding()); div.getStyle().setHeight(cnt, Unit.EM); Configuration config = Configuration.create() .set("coverGutter", true) .set("above", line == 0); cm.addLineWidget(line == 0 ? 0 : (line - 1), div, config); }
Source:
private JudgmentSearchResult sortJudges(JudgmentSearchResult judgmentSearchResult) { List<JudgeResult> judges = judgmentSearchResult.getJudges().stream().collect(Collectors.toList()); Collections.sort(judges, new JudgeResultComparator()); judgmentSearchResult.setJudges(judges); return judgmentSearchResult; }

Target:
private JudgmentSearchResult sortJudges(JudgmentSearchResult judgmentSearchResult) { List<JudgeResult> judges = judgmentSearchResult.getJudges(); Collections.sort(judges, new JudgeResultComparator()); judgmentSearchResult.setJudges(judges); return judgmentSearchResult; }
Source:
public InputStream getInputStream(RepoObject repoObject) { byte[] content = data.get(repoObject.getBucketName()).get(repoObject.getChecksum()); if (content != null) { return new ByteArrayInputStream(data.get(repoObject.getBucketName()).get(repoObject.getChecksum())); } log.debug("The content for the object was not found. Object --> key , bucket name: , content checksum: , version number: ", repoObject.getKey(), repoObject.getBucketName(), repoObject.getChecksum(), repoObject.getVersionNumber()); return null; }

Target:
public InputStream getInputStream(RepoObject repoObject) { Map<String, byte[]> bucket = data.get(repoObject.getBucketName()); if (bucket != null){ byte[] content = bucket.get(repoObject.getChecksum()); if (content != null) { return new ByteArrayInputStream(content); } } log.debug("The content for the object was not found. Object --> key , bucket name: , content checksum: , version number: ", repoObject.getKey(), repoObject.getBucketName(), repoObject.getChecksum(), repoObject.getVersionNumber()); return null; }
Source:
public void filter(ContainerRequestContext containerRequestContext) throws IOException { containerRequestContext.setSecurityContext(new SecurityContext() { @Override public Principal getUserPrincipal() { return new Principal() { @Override public String getName() { return "1"; } }; } @Override public boolean isUserInRole(String s) { return false; } @Override public boolean isSecure() { return false; } @Override public String getAuthenticationScheme() { return null; } }); }

Target:
public void filter(ContainerRequestContext containerRequestContext) throws IOException { containerRequestContext.setSecurityContext(new SecurityContext() { @Override public Principal getUserPrincipal() { return () -> "1"; } @Override public boolean isUserInRole(String s) { return false; } @Override public boolean isSecure() { return false; } @Override public String getAuthenticationScheme() { return null; } }); }
Source:
public void postBuildIndex() throws IOException, ServiceException { if(optimizeEnabled) { optimizeIndex(solrConfiguration.getReindexCollectionName(), solrConfiguration.getReindexServer()); if (!solrConfiguration.isSingleCoreMode()) { shs.swapActiveCores(solrConfiguration); } } }

Target:
public void postBuildIndex() throws IOException, ServiceException { if(optimizeEnabled) { optimizeIndex(solrConfiguration.getReindexCollectionName(), solrConfiguration.getReindexServer()); } if (!solrConfiguration.isSingleCoreMode()) { shs.swapActiveCores(solrConfiguration); } }
Source:
public <T> ResourceOperations<T> getResourceOperations(Class<T> type) { return (ResourceOperations<T>) (File.class.equals(type) ? DefaultFileOperations.INSTANCE : null); }

Target:
public <T> ResourceOperations<T> getResourceOperations(Class<T> type) { return (ResourceOperations<T>) DefaultFileOperations.INSTANCE; }
Source:
public void test_baseName_unknown() throws IOException, SAXException { try { JSONObject response = jenkinsRule.getJSON("i18n/resourceBundle?baseName=com.acme.XyzWhatever").getJSONObject(); } catch (Exception e) { Assert.assertNotNull(e); } }

Target:
public void test_baseName_unknown() throws IOException, SAXException { try { JSONObject response = jenkinsRule.getJSON("i18n/resourceBundle?baseName=com.acme.XyzWhatever").getJSONObject(); } catch (FailingHttpStatusCodeException e) { Assert.assertNotNull(e); Assert.assertTrue(e.getMessage().contains("com.acme.XyzWhatever")); } }
Source:
public void calcTime(Date date, HistoryScanHolder holder) { Date now = new Date(); long seconds = TimeUnit.MILLISECONDS.toSeconds(now.getTime() - date.getTime()); long minutes = TimeUnit.MILLISECONDS.toMinutes(now.getTime() - date.getTime()); long hours = TimeUnit.MILLISECONDS.toHours(now.getTime() - date.getTime()); long days = TimeUnit.MILLISECONDS.toDays(now.getTime() - date.getTime()); String secText = String.valueOf(seconds) + " seconds ago"; String minText = String.valueOf(minutes) + " minutes ago"; String OneMinText = String.valueOf(minutes) + " minute ago"; String hourText = String.valueOf(hours) + " hours ago"; String OneHourText = String.valueOf(hours) + " hour ago"; String dayText = String.valueOf(days) + " days ago"; String OneDayText = String.valueOf(days) + " day ago"; if (seconds < 60) { holder.txtDate.setText(secText); } else if(minutes==1){ holder.txtDate.setText(OneMinText); } else if (minutes < 60) { holder.txtDate.setText(minText); } else if(hours==1){ holder.txtDate.setText(OneHourText); } else if (hours < 24) { holder.txtDate.setText(hourText); } else if(days==1){ holder.txtDate.setText(OneDayText); } else { holder.txtDate.setText(dayText); } }

Target:
public void calcTime(Date date, HistoryScanHolder holder) { Date now = new Date(); long seconds = TimeUnit.MILLISECONDS.toSeconds(now.getTime() - date.getTime()); long minutes = TimeUnit.MILLISECONDS.toMinutes(now.getTime() - date.getTime()); long hours = TimeUnit.MILLISECONDS.toHours(now.getTime() - date.getTime()); long days = TimeUnit.MILLISECONDS.toDays(now.getTime() - date.getTime()); String secText = String.valueOf(seconds) + " seconds ago"; String hourText = res.getString(R.string.last_seen_string,hours,res.getQuantityString(R.plurals.hours,(int)hours)); String minText = res.getString(R.string.last_seen_string,minutes,res.getQuantityString(R.plurals.minutes,(int)minutes)); String dayText = res.getString(R.string.last_seen_string,days,res.getQuantityString(R.plurals.days,(int)days)); if (seconds < 60) { holder.txtDate.setText(secText); } else if (minutes < 60) { holder.txtDate.setText(minText); } else if (hours < 24) { holder.txtDate.setText(hourText); } else { holder.txtDate.setText(dayText); } }
Source:
public List<Translation> getI18nTanslation() throws CommandNotFoundException, CommandExecutionException, CommandParameterizationException { List<Translation> items = new ArrayList<>(); String local = getSearchFilters()!=null? getSearchFilters().get("locale"):null; if (local == null) { getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST, "Request should contains 'locale' parameter."); return null; } Map<String, String> translations = i18n.getLocale(AbstractI18n.stringToLocale(local)); for (final Map.Entry<String, String> entry : translations.entrySet()) { items.add(new Translation(entry.getKey(), entry.getValue())); } return items; }

Target:
public List<Translation> getI18nTanslation() throws CommandNotFoundException, CommandExecutionException, CommandParameterizationException { List<Translation> items = new ArrayList<>(); String locale = getLocale(); if (locale == null) { getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST, "Request should contains 'locale' parameter."); return null; } Map<String, String> translations = i18n.getLocale(AbstractI18n.stringToLocale(locale)); for (final Map.Entry<String, String> entry : translations.entrySet()) { items.add(new Translation(entry.getKey(), entry.getValue())); } return items; }
Source:
public List getWritablePartitions() { List writablePartitions = new ArrayList(); List healthyWritablePartitions = new ArrayList(); for (Partition partition : partitionMap.values()) { if (partition.getPartitionState() == PartitionState.READ_WRITE) { writablePartitions.add(partition); boolean up = true; for (Replica replica : partition.getReplicas()) { if (replica.isDown()) { up = false; break; } } if (up) { healthyWritablePartitions.add(partition); } } } return healthyWritablePartitions.isEmpty() ? writablePartitions : healthyWritablePartitions; }

Target:
public List<PartitionId> getWritablePartitions() { List<PartitionId> writablePartitions = new ArrayList(); List<PartitionId> healthyWritablePartitions = new ArrayList(); for (Partition partition : partitionMap.values()) { if (partition.getPartitionState() == PartitionState.READ_WRITE) { writablePartitions.add(partition); boolean up = true; for (Replica replica : partition.getReplicas()) { if (replica.isDown()) { up = false; break; } } if (up) { healthyWritablePartitions.add(partition); } } } return healthyWritablePartitions.isEmpty() ? writablePartitions : healthyWritablePartitions; }
Source:
public Object toObject(String value) { throw new IllegalDataException("This operation is not suppported"); }

Target:
public Object toObject(String value) { throw new IllegalArgumentException("This operation is not suppported"); }
Source:
public GeneralQueryResult getBySingleKeyBetweenRangeKeys(final String key, final String rangeKey1, final String rangeKey2, final int limit) { final Map<String, Condition> queryConditions = Maps.newHashMap(); if (rangeKeyColumnName.isPresent()) { final List<AttributeValue> values = Lists.newArrayList(); values.add(new AttributeValue().withS(rangeKey1)); values.add(new AttributeValue().withS(rangeKey2)); final Condition selectRangeKeyCondition = new Condition() .withComparisonOperator(ComparisonOperator.BETWEEN.toString()) .withAttributeValueList(values); queryConditions.put(rangeKeyColumnName.get(), selectRangeKeyCondition); } return getBySingleKey(key, queryConditions, limit); }

Target:
public GeneralQueryResult getBySingleKeyBetweenRangeKeys(final String key, final String rangeKey1, final String rangeKey2, final int limit) { final Map<String, Condition> queryConditions = Maps.newHashMap(); if (rangeKeyColumnName.isPresent()) { final List<AttributeValue> values = Lists.newArrayList( new AttributeValue().withS(rangeKey1), new AttributeValue().withS(rangeKey2)); final Condition selectRangeKeyCondition = new Condition() .withComparisonOperator(ComparisonOperator.BETWEEN.toString()) .withAttributeValueList(values); queryConditions.put(rangeKeyColumnName.get(), selectRangeKeyCondition); } return getBySingleKey(key, queryConditions, limit); }