auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private HeaderCacheElement getHeader() <END> throws ExecutionException, InterruptedException, TimeoutException { final Future<HeaderCacheElement> deferredResult; synchronized (lock) { CacheState state = headerCache.getCacheState(); if (isAppEngine && state == CacheState.Stale) { state = CacheState.Good; } if (state == CacheState.Good || state == CacheState.Exception) { return headerCache; } else if (state == CacheState.Stale) { asyncRefresh(); return headerCache; } else if (state == CacheState.Expired) { deferredResult = asyncRefresh(); } else { return new HeaderCacheElement( Status.UNAUTHENTICATED .withCause(new IllegalStateException("Could not process state: " + state)) ); } } return deferredResult.get(250, TimeUnit.MILLISECONDS); }</code><technical_language>do need incur lock penalty CacheState == CacheState.Good? optimize for situation</technical_language>

Target:
private HeaderCacheElement getHeader() throws ExecutionException, InterruptedException { final Future<HeaderCacheElement> deferredResult; synchronized (lock) { CacheState state = headerCache.getCacheState(); if (state == CacheState.Good || state == CacheState.Exception) { return headerCache; } else if (!isAppEngine && state == CacheState.Stale) { asyncRefresh(); return headerCache; } else if (state == CacheState.Expired) { deferredResult = asyncRefresh(); } else { return new HeaderCacheElement( Status.UNAUTHENTICATED .withCause(new IllegalStateException("Could not process state: " + state)) ); } } return deferredResult.get(); }
Source:
<code>public void schedule(Work work, Scheduling scheduling, boolean afterCommit) { String queueId = getStreamForCategory(work.getCategory()); if (log.isDebugEnabled()) { log.debug(String.format( "Scheduling: workId: %s, category: %s, queue: %s, scheduling: %s, afterCommit: %s, work: %s", work.getId(), work.getCategory(), queueId, scheduling, afterCommit, work)); } if (!isQueuingEnabled(queueId)) { log.info("Queue disabled, scheduling canceled: " + queueId); return; } if (CANCEL_SCHEDULED.equals(scheduling)) { if (storeState) { if (WorkStateHelper.getState(work.getId()) != null) { WorkStateHelper.setCanceled(work.getId()); } } else { log.warn(String.format("Canceling a work is only supported if '%s' is true. Skipping work: %s", STORESTATE_KEY, work)); } return; } if (afterCommit && scheduleAfterCommit(work, scheduling)) { return; } WorkSchedulePath.newInstance(work); LogAppender<Record> appender = logManager.getAppender(getStreamForCategory(work.getCategory())); if (appender == null) { log.error(String.format("Not scheduled work, unknown category: %s, mapped to %s", work.getCategory(), getStreamForCategory(work.getCategory()))); return; } String key = work.getPartitionKey(); LogOffset offset = appender.append(key, Record.of(key, WorkComputation.serialize(work))); <START> if (work.isCoalescing() || storeState) { <END> WorkStateHelper.setLastOffset(work.getId(), offset.offset(), stateTTL); } if (storeState) { WorkStateHelper.setState(work.getId(), Work.State.SCHEDULED, stateTTL); } }</code><technical_language>|| && ? is storestate a requirement coalescing work</technical_language>

Target:
public void schedule(Work work, Scheduling scheduling, boolean afterCommit) { String queueId = getStreamForCategory(work.getCategory()); if (log.isDebugEnabled()) { log.debug(String.format( "Scheduling: workId: %s, category: %s, queue: %s, scheduling: %s, afterCommit: %s, work: %s", work.getId(), work.getCategory(), queueId, scheduling, afterCommit, work)); } if (!isQueuingEnabled(queueId)) { log.info("Queue disabled, scheduling canceled: " + queueId); return; } if (CANCEL_SCHEDULED.equals(scheduling)) { if (storeState) { if (WorkStateHelper.getState(work.getId()) != null) { WorkStateHelper.setCanceled(work.getId()); } } else { log.warn(String.format("Canceling a work is only supported if '%s' is true. Skipping work: %s", STORESTATE_KEY, work)); } return; } if (afterCommit && scheduleAfterCommit(work, scheduling)) { return; } WorkSchedulePath.newInstance(work); LogAppender<Record> appender = logManager.getAppender(getStreamForCategory(work.getCategory())); if (appender == null) { log.error(String.format("Not scheduled work, unknown category: %s, mapped to %s", work.getCategory(), getStreamForCategory(work.getCategory()))); return; } String key = work.getPartitionKey(); LogOffset offset = appender.append(key, Record.of(key, WorkComputation.serialize(work))); if (work.isCoalescing()) { WorkStateHelper.setLastOffset(work.getId(), offset.offset(), stateTTL); } if (storeState) { WorkStateHelper.setState(work.getId(), Work.State.SCHEDULED, stateTTL); } }
Source:
<code>public void getThreadData() throws Throwable { SyncUtil.runToLine(SOURCE_NAME, MIRunControlTest.LINE_MAIN_ALL_THREADS_STARTED); IThreadDMData mainThreadData = SyncUtil.getThreadData(1); Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); Matcher matcher = pattern.matcher(mainThreadData.getId()); assertTrue("Thread ID is a series of number", matcher.matches()); final String names[] = { EXEC_NAME, "monday", "tuesday", "wednesday", "thursday", "friday" }; <START> for (int i = 2; i <= 6; i++) { <END> IThreadDMData threadData = SyncUtil.getThreadData(i); String name = threadData.getName(); String expectedName = threadNamesSupported() ? names[i - 1] : ""; assertEquals("Thread name of thread " + i, expectedName, name); } }</code><technical_language>"i" initialized 1 in order validate name for main thread well</technical_language>

Target:
public void getThreadData() throws Throwable { SyncUtil.runToLine(SOURCE_NAME, MIRunControlTest.LINE_MAIN_ALL_THREADS_STARTED); IThreadDMData mainThreadData = SyncUtil.getThreadData(1); Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); Matcher matcher = pattern.matcher(mainThreadData.getId()); assertTrue("Thread ID is a series of number", matcher.matches()); final String names[] = { EXEC_NAME, "monday", "tuesday", "wednesday", "thursday", "friday" }; for (int i = 1; i <= 6; i++) { IThreadDMData threadData = SyncUtil.getThreadData(i); String name = threadData.getName(); String expectedName = threadNamesSupported() ? names[i - 1] : ""; assertEquals("Thread name of thread " + i, expectedName, name); } }
Source:
<code>public void canCreateBusinessService() throws Exception { final String businessServiceJson = "{" + "\"name\":\"some-name\"," + "\"attributes\":{\"attribute\":[{\"key\":\"some-key\",\"value\":\"some-value\"}]}," + "\"reductionKeys\": [\n" + " \"key1\", \"key2\", \"key3\"\n" + " ]" + "}"; final String businessServiceXml = "<business-service>" + " <name>some-name2</name>" + " <reductionKeys>" + " <reductionKey>key1</reductionKey>" + " <reductionKey>key2</reductionKey>" + " <reductionKey>key3</reductionKey>" + " </reductionKeys>" + "</business-service>"; sendData(POST, MediaType.APPLICATION_JSON, "/business-services", businessServiceJson, 201); sendData(POST, MediaType.APPLICATION_XML, "/business-services", businessServiceXml, 201); Assert.assertEquals(2, m_businessServiceDao.findAll().size()); assertTrue("createBusinessServiceWithReductionKeys", m_businessServiceDao.findAll().get(0).getReductionKeys().contains("key1")); assertTrue("createBusinessServiceWithReductionKeys", m_businessServiceDao.findAll().get(0).getReductionKeys().contains("key2")); assertTrue("createBusinessServiceWithReductionKeys", m_businessServiceDao.findAll().get(0).getReductionKeys().contains("key3")); assertEquals("createBusinessServiceWithReductionKeys", 3, m_businessServiceDao.findAll().get(1).getReductionKeys().size()); <START> } <END></code><technical_language>above: Please meaningful description instead of a single name leave completely</technical_language>

Target:
public void canCreateBusinessService() throws Exception { String key1 = "reductionKey-1"; String key2 = "reductionKey-2"; String key3 = "reductionKey-3"; final String businessServiceJson = "{" + "\"name\":\"some-name\"," + "\"attributes\":{\"attribute\":[{\"key\":\"some-key\",\"value\":\"some-value\"}]}," + "\"reductionKeys\": [\n" + " \"" + key1 + "\", \""+ key2 +"\", \""+ key3 +"\"\n" + " ]" + "}"; final String businessServiceXml = "<business-service>" + " <name>some-name2</name>" + " <reductionKeys>" + " <reductionKey>" + key1 + "</reductionKey>" + " <reductionKey>" + key2 + "</reductionKey>" + " <reductionKey>" + key3 + "</reductionKey>" + " </reductionKeys>" + "</business-service>"; sendData(POST, MediaType.APPLICATION_JSON, "/business-services", businessServiceJson, 201); sendData(POST, MediaType.APPLICATION_XML, "/business-services", businessServiceXml, 201); Assert.assertEquals(2, m_businessServiceDao.findAll().size()); for (BusinessService bs : m_businessServiceDao.findAll()) { assertTrue("Expect reductionkey '" + key1 + "' to be present in retrieved BusinessService.", bs.getReductionKeys().contains(key1)); assertTrue("Expect reductionkey '" + key2 + "' to be present in retrieved BusinessService.", bs.getReductionKeys().contains(key2)); assertTrue("Expect reductionkey '" + key3 + "' to be present in retrieved BusinessService.", bs.getReductionKeys().contains(key3)); assertEquals("Check amount of reductionkeys in BusinessService.", 3, bs.getReductionKeys().size()); } }
Source:
<code>public RestService createRestService(String schemaRegistryUrl, Map<String, String> configs) { RestService restService = new RestService(schemaRegistryUrl); <START> Map<String, Object> asslConfigs = configs.entrySet().stream() <END> .filter(e -> !e.equals(SCHEMA_REGISTRY_REST_URL)) .filter(e -> e.getKey().startsWith("schema.registry.")) .collect(Collectors.toMap( e -> e.getKey().substring("schema.registry.".length()), Map.Entry::getValue)); Map<String, Object> sslConfigs = new HashMap<>(); for (String key : configs.keySet()) { if (!key.equals(SCHEMA_REGISTRY_REST_URL) && key.startsWith("schema.registry.")) { String value = configs.get(key); key = key.substring("schema.registry.".length()); if (key.contains("password")) { sslConfigs.put(key, new Password(value)); } else { sslConfigs.put(key, value); } } } System.out.println(configs.toString()); System.out.println(sslConfigs.toString()); System.out.println("CONFIGS CONFIGS"); if (!sslConfigs.isEmpty()) { SslFactory sslFactory = new SslFactory(Mode.CLIENT); sslFactory.configure(sslConfigs); restService.setSslSocketFactory(sslFactory.sslContext().getSocketFactory()); } return restService; }</code><technical_language>rename sslConfigs</technical_language>

Target:
public RestService createRestService(String schemaRegistryUrl, Map<String, String> configs) { RestService restService = new RestService(schemaRegistryUrl); ConfigDef configDef = new ConfigDef(); SslConfigs.addClientSslSupport(configDef); Map<String, ConfigDef.ConfigKey> configKeyMap = configDef.configKeys(); Map<String, Object> sslConfigs = new HashMap<>(); for (String key : configs.keySet()) { if (!key.equals(SCHEMA_REGISTRY_REST_URL) && key.startsWith(SCHEMA_REGISTRY_OPTS_PREFIX)) { String value = configs.get(key); key = key.substring(SCHEMA_REGISTRY_OPTS_PREFIX.length()); if (configKeyMap.containsKey(key)) { if (configKeyMap.get(key).type == ConfigDef.Type.PASSWORD) { sslConfigs.put(key, new Password(value)); } else { sslConfigs.put(key, value); } } } } if (!sslConfigs.isEmpty()) { SslFactory sslFactory = new SslFactory(Mode.CLIENT); sslFactory.configure(sslConfigs); restService.setSslSocketFactory(sslFactory.sslContext().getSocketFactory()); } return restService; }
Source:
<code>private boolean isModifyAccessEnabled() { <START> boolean returnValue; <END> try { if (SystemGroup.OseeAccessAdmin.isCurrentUserMember()) { returnValue = true; } else if (policyTableViewer.getAccessControlList().size() > 0) { returnValue = AccessControlManager.hasPermission(accessControlledObject, PermissionEnum.OWNER); } else { returnValue = true; } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); returnValue = false; } return returnValue; }</code><technical_language>Adding Megumi's nit: Consider initializing true, possibly collapsing methods argument</technical_language>

Target:
private boolean isModifyAccessEnabled() { boolean returnValue; try { if (!SystemGroup.OseeAccessAdmin.isCurrentUserMember() && policyTableViewer.getAccessControlList().size() > 0) { returnValue = AccessControlManager.hasPermission(accessControlledObject, PermissionEnum.OWNER); } else { returnValue = true; } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); returnValue = false; } return returnValue; }
Source:
<code>private static DialectName convertToDialect(final String dialectName) { <START> if(dialectName.equals("h2")) { <END> return DialectName.H2; } if(dialectName.equals("postgres")) { return DialectName.POSTGRES; } if(dialectName.equals("mysql")) { return DialectName.MYSQL; } throw new DolphinRuntimeException("Dialect not supported"); }</code><technical_language>Add a not-null check for dialectName change if statements "h2".equals(dialectName). I prefer some constants too</technical_language>

Target:
private static DialectName convertToDialect(final String dialectName) { if(dialectName.equals(DB_H2)) { return DialectName.H2; } if(dialectName.equals(DB_POSTGRES)) { return DialectName.POSTGRES; } if(dialectName.equals(DB_MYSQL)) { return DialectName.MYSQL; } throw new DolphinRuntimeException("Dialect not supported"); }
Source:
<code>public void setCommandExecuted() { Transaction transaction = TransactionSupport.suspend(); try { CommandEntity cmdEntity = CommandCoordinatorUtil.getCommandEntity(getCommandId()); if (cmdEntity != null) { CommandEntity executedCmdEntity = buildCommandEntity(cmdEntity.getRootCommandId(), cmdEntity.isCallbackEnabled()); executedCmdEntity <START> .setWaitingForEVent(getCallback() == null ? false : getCallback().isTriggeredByEvent()); <END> CommandCoordinatorUtil.persistCommand(executedCmdEntity, getContext()); CommandCoordinatorUtil.updateCommandExecuted(getCommandId()); } } finally { if (transaction != null) { TransactionSupport.resume(transaction); } } }</code><technical_language>export "getCallback() == null ? false : getCallback().isTriggeredByEvent()" a method, repeated numerous times</technical_language>

Target:
public void setCommandExecuted() { Transaction transaction = TransactionSupport.suspend(); try { CommandEntity cmdEntity = CommandCoordinatorUtil.getCommandEntity(getCommandId()); if (cmdEntity != null) { CommandEntity executedCmdEntity = buildCommandEntity(cmdEntity.getRootCommandId(), cmdEntity.isCallbackEnabled()); executedCmdEntity.setWaitingForEvent(callbackTriggeredByEvent()); CommandCoordinatorUtil.persistCommand(executedCmdEntity, getContext()); CommandCoordinatorUtil.updateCommandExecuted(getCommandId()); } } finally { if (transaction != null) { TransactionSupport.resume(transaction); } } }
Source:
<code>public EventDrivenTransformationRule(String name, IQuerySpecification<Matcher> precondition, IMatchProcessor<Match> action, IncQueryActivationStateEnum transition, ActivationLifeCycle lifeCycle) { Job<Match> stJob = Jobs.newStatelessJob(transition, action); <START> Job<Match> job = Jobs.newRecordingJob(stJob); <END> ruleSpecification = Rules.newMatcherRuleSpecification(precondition, lifeCycle, CollectionLiterals.newHashSet(job)); }</code><technical_language>default usage of recording job problematic, please remove. model editing API handle editing domains</technical_language>

Target:
public EventDrivenTransformationRule(String name, IQuerySpecification<Matcher> precondition, IMatchProcessor<Match> action, IncQueryActivationStateEnum transition, ActivationLifeCycle lifeCycle) { Job<Match> job = Jobs.newStatelessJob(transition, action); ruleSpecification = Rules.newMatcherRuleSpecification(precondition, lifeCycle, CollectionLiterals.newHashSet(job)); }
Source:
<code>protected void executeQueryCommand() { <START> VDSReturnValue nfsReturnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeProfileInfo, <END> new GlusterVolumeProfileInfoVDSParameters(getParameters().getClusterId(), getUpServerId(getParameters().getClusterId()), getGlusterVolumeName(getParameters().getVolumeId()), ((GlusterVolumeProfileParameters)getParameters()).isNfs())); getQueryReturnValue().setReturnValue((((GlusterVolumeProfileParameters)getParameters()).isNfs()) ? (GlusterVolumeProfileInfo) nfsReturnValue.getReturnValue() : setBrickNames((GlusterVolumeProfileInfo) nfsReturnValue.getReturnValue())); }</code><technical_language>is this called nfsReturnValue ? getParameters()).isNfs() false, profile info bricks, correct</technical_language>

Target:
protected void executeQueryCommand() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeProfileInfo, new GlusterVolumeProfileInfoVDSParameters(getParameters().getClusterId(), getUpServerId(getParameters().getClusterId()), getGlusterVolumeName(getParameters().getVolumeId()), ((GlusterVolumeProfileParameters)getParameters()).isNfs())); getQueryReturnValue().setReturnValue((((GlusterVolumeProfileParameters)getParameters()).isNfs()) ? (GlusterVolumeProfileInfo) returnValue.getReturnValue() : setBrickNames((GlusterVolumeProfileInfo) returnValue.getReturnValue())); }
Source:
<code>private void logIn(String username, String password) { try { String uniqueId = uidService.generate(String.valueOf(sessionId.get()), preferencesService.getFafDataDirectory().resolve("uid.log")); writeToServer(new LoginClientMessage(username, Hashing.sha256().hashString(password, UTF_8).toString(), sessionId.get(), uniqueId, localIp)); } catch (IOException e) { <START> onUIDNotFound(e); <END> } }</code><technical_language>IOException "not found". access denied, non-readable, failure reading etc. method renamed. Thus, method renamed</technical_language>

Target:
private void logIn(String username, String password) { try { String uniqueId = uidService.generate(String.valueOf(sessionId.get()), preferencesService.getFafDataDirectory().resolve("uid.log")); writeToServer(new LoginClientMessage(username, Hashing.sha256().hashString(password, UTF_8).toString(), sessionId.get(), uniqueId, localIp)); } catch (IOException e) { onUIDNotExecuted(e); } }
Source:
<code>private BaseEntity transformNbtData(BaseEntity state) { CompoundTag tag = state.getNbtData(); if (tag != null) { boolean hasTilePosition = tag.containsKey("TileX") && tag.containsKey("TileY") && tag.containsKey("TileZ"); boolean hasFacing = tag.containsKey("Facing"); if (hasTilePosition) { Vector3 tilePosition = Vector3.at(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ")); BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint(); CompoundTagBuilder builder = tag.createBuilder() .putInt("TileX", newTilePosition.getBlockX()) .putInt("TileY", newTilePosition.getBlockY()) .putInt("TileZ", newTilePosition.getBlockZ()); if (hasFacing) { boolean isPainting = state.getType() == EntityTypes.PAINTING; <START> Direction direction = isPainting ? MCDirections.fromPre13Hanging(tag.asInt("Facing")) : MCDirections.fromHanging(tag.asInt("Facing")); <END> if (direction != null) { Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize(); Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL); if (newDirection != null) { builder.putByte("Facing", (byte) (isPainting ? MCDirections.toPre13Hanging(newDirection) : MCDirections.toHanging(newDirection))); } } } return new BaseEntity(state.getType(), builder.build()); } } return state; }</code><technical_language>need fix this for item frames well. horizontal-hanging value</technical_language>

Target:
private BaseEntity transformNbtData(BaseEntity state) { CompoundTag tag = state.getNbtData(); if (tag != null) { boolean hasTilePosition = tag.containsKey("TileX") && tag.containsKey("TileY") && tag.containsKey("TileZ"); boolean hasFacing = tag.containsKey("Facing"); if (hasTilePosition) { Vector3 tilePosition = Vector3.at(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ")); BlockVector3 newTilePosition = transform.apply(tilePosition.subtract(from)).add(to).toBlockPoint(); CompoundTagBuilder builder = tag.createBuilder() .putInt("TileX", newTilePosition.getBlockX()) .putInt("TileY", newTilePosition.getBlockY()) .putInt("TileZ", newTilePosition.getBlockZ()); if (hasFacing) { boolean isPainting = state.getType() == EntityTypes.PAINTING; Direction direction = isPainting ? MCDirections.fromHorizontalHanging(tag.asInt("Facing")) : MCDirections.fromHanging(tag.asInt("Facing")); if (direction != null) { Vector3 vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector3.ZERO)).normalize(); Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL); if (newDirection != null) { builder.putByte("Facing", (byte) (isPainting ? MCDirections.toHorizontalHanging(newDirection) : MCDirections.toHanging(newDirection))); } } } return new BaseEntity(state.getType(), builder.build()); } } return state; }
Source:
<code>public InlineHyperlink getPreviousPatchLink(int index, PatchScreen.Type patchType) { for(index--; index > -1; index--) { InlineHyperlink link = createLink(index, patchType, null, SafeHtml.asis(Util.C <START> .nextPatchLinkIcon())); <END> if(link != null) { return link; } } return null; }</code><technical_language>I guess icon changed mistake? be: Util.C.prevPatchLinkIcon()</technical_language>

Target:
public InlineHyperlink getPreviousPatchLink(int index, PatchScreen.Type patchType) { for(index--; index > -1; index--) { InlineHyperlink link = createLink(index, patchType, SafeHtml.asis(Util.C .prevPatchLinkIcon()), null); if(link != null) { return link; } } return null; }
Source:
<code>public void checkSpecificAccessControl() { if (userInfo.isStudent) { checkStudentAccess(); } else if (userInfo.isInstructor) { <START> checkInstructorAccess(); <END> } else { throw new UnauthorizedAccessException("Your account cannot access this student's profile."); } }</code><technical_language>if account is a student of A instructor of B, in this case treat student. Is a differentiate? adding some indicator param in request? account able view teammates's profile profile of students in B(suppose privilege)</technical_language>

Target:
public void checkSpecificAccessControl() { String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); if (studentEmail == null || courseId == null) { if (!userInfo.isStudent) { throw new UnauthorizedAccessException(MESSAGE_NOT_STUDENT_ACCOUNT); } } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { throw new UnauthorizedAccessException(MESSAGE_STUDENT_NOT_FOUND); } gateKeeper.verifyAccessibleForCurrentUserAsInstructorOrTeamMemberOrAdmin(userInfo.id, courseId, student.section, studentEmail); } }
Source:
<code>public Step loadVariantsStep(StepBuilderFactory stepBuilderFactory, JobOptions jobOptions, SimpleCompletionPolicy chunkSizeCompletionPolicy) { logger.debug("Building '" + LOAD_VARIANTS_STEP + "'"); return stepBuilderFactory.get(LOAD_VARIANTS_STEP) .<Variant, Variant>chunk(chunkSizeCompletionPolicy) .reader(reader) .processor(variantProcessor) .writer(variantWriter) <START> .faultTolerant().skipLimit(50).skip(FlatFileParseException.class) <END> .allowStartIfComplete(jobOptions.isAllowStartIfComplete()) .listener(new SkippedItemListener()) .listener(new StepProgressListener()) .listener(new VariantLoaderStepStatisticsListener()) .build(); }</code><technical_language>remove this then? I main reason for fault tolerance NO_VARIANTS, right</technical_language>

Target:
public Step loadVariantsStep(StepBuilderFactory stepBuilderFactory, JobOptions jobOptions, SimpleCompletionPolicy chunkSizeCompletionPolicy) { logger.debug("Building '" + LOAD_VARIANTS_STEP + "'"); return stepBuilderFactory.get(LOAD_VARIANTS_STEP) .<Variant, Variant>chunk(chunkSizeCompletionPolicy) .reader(reader) .processor(new VariantNoAlternateFilterProcessor()) .writer(variantWriter) .allowStartIfComplete(jobOptions.isAllowStartIfComplete()) .listener(new SkippedItemListener()) .listener(new StepProgressListener()) .listener(new VariantLoaderStepStatisticsListener()) .build(); }
Source:
<code>private void addGroupsFrom(IConfigurationElement element, Collection<MarkerGroup> groupss) { for (IConfigurationElement <START> configElement : <END> element.getChildren(MarkerSupportRegistry.MARKER_GROUPING)) { groupss.add(MarkerGroup.createMarkerGroup(configElement)); } }</code><technical_language>'grouping' correct</technical_language>

Target:
private void addGroupsFrom(IConfigurationElement element, Collection<MarkerGroup> groupss) { for (IConfigurationElement grouping : element.getChildren(MarkerSupportRegistry.MARKER_GROUPING)) { groupss.add(MarkerGroup.createMarkerGroup(grouping)); } }
Source:
<code>public List<GeoEntry> query(final String queryString, final int maxResults) throws GeoEntryQueryException { try (final Directory directory = openDirectoryAndCheckForIndex()) { return doQuery(queryString, maxResults, directory); } catch (IOException e) { <START> LOGGER.warn("Error querying from directory", e); <END> } return Collections.emptyList(); }</code><technical_language>want trace exception stack trace debug warn level</technical_language>

Target:
public List<GeoEntry> query(final String queryString, final int maxResults) throws GeoEntryQueryException { try (final Directory directory = openDirectoryAndCheckForIndex()) { return doQuery(queryString, maxResults, directory); } catch (IOException e) { LOGGER.debug("Error querying from directory", e); } return Collections.emptyList(); }
Source:
<code>void setCurrentTitleAndDescriptions(Title title, List<Description> descriptions) { setCurrentUploadTitle(title); setCurrentUploadDescriptions(descriptions); <START> store.putString("Title", title.toString()); <END> }</code><technical_language>Is this change related</technical_language>

Target:
void setCurrentTitleAndDescriptions(Title title, List<Description> descriptions) { setCurrentUploadTitle(title); setCurrentUploadDescriptions(descriptions); }
Source:
<code>public InputStream raw() throws IOException { return new ByteArrayInputStream( DatatypeConverter.parseBase64Binary( this.storage.xml().xpath( String.format( <START> "/github/repos/repo[@coords='%s']/asset/text()", <END> this.coords ) ).get(0) ) ); }</code><technical_language>This path release asset in storage is good, get asset of release. release id asset id</technical_language>

Target:
public InputStream raw() throws IOException { return new ByteArrayInputStream( DatatypeConverter.parseBase64Binary( this.storage.xml().xpath( String.format("%s/content/text()", this.xpath()) ).get(0) ) ); }
Source:
<code>public String toString() { return new StringBuilder() .append("result: ").append(result).append("; ") <START> .append("reason: ").append(failureReason).append("; ") <END> .append("seqid=").append(flushSequenceId).toString(); }</code><technical_language>removing failure? is failure reason</technical_language>

Target:
public String toString() { return new StringBuilder() .append("flush result:").append(result).append(", ") .append("failureReason:").append(failureReason).append(",") .append("flush seq id").append(flushSequenceId).toString(); }
Source:
<code>public void testDelete() throws IOException { String path = "/path"; String deletePath = path + "/delete"; try { _testBaseDataAccessor.create(deletePath, null, AccessOption.PERSISTENT); new JerseyUriRequestBuilder("zookeeper{}?command=delete").format(deletePath) .expectedReturnStatusCode(Response.Status.FORBIDDEN.getStatusCode()); Assert.assertTrue(_testBaseDataAccessor.exists(deletePath, AccessOption.PERSISTENT)); _testBaseDataAccessor.remove(deletePath, AccessOption.PERSISTENT); _testBaseDataAccessor.create(deletePath, null, AccessOption.EPHEMERAL); String data = new JerseyUriRequestBuilder("zookeeper{}?command=delete").format(deletePath) .isBodyReturnExpected(true).get(this); Map<String, String> result = OBJECT_MAPPER.readValue(data, HashMap.class); <START> Assert.assertEquals(result.get("path"), deletePath); <END> Assert.assertEquals(result.get("delete"), new Boolean(true).toString()); Assert.assertFalse(_testBaseDataAccessor.exists(deletePath, AccessOption.PERSISTENT)); } finally { _testBaseDataAccessor.remove(path, AccessOption.PERSISTENT); } }</code><technical_language>Question (may related change). Is param in exists(String path, int options) useful? I find considered in implementation of BaseDataAccessor</technical_language>

Target:
public void testDelete() { String path = "/path"; String deletePath = path + "/delete"; try { _testBaseDataAccessor.create(deletePath, null, AccessOption.PERSISTENT); new JerseyUriRequestBuilder("zookeeper{}").format(deletePath) .expectedReturnStatusCode(Response.Status.FORBIDDEN.getStatusCode()).delete(this); Assert.assertTrue(_testBaseDataAccessor.exists(deletePath, AccessOption.PERSISTENT)); new JerseyUriRequestBuilder("zookeeper{}").format(deletePath + "/foobar") .expectedReturnStatusCode(Response.Status.NOT_FOUND.getStatusCode()).delete(this); _testBaseDataAccessor.remove(deletePath, AccessOption.PERSISTENT); _testBaseDataAccessor.create(deletePath, null, AccessOption.EPHEMERAL); new JerseyUriRequestBuilder("zookeeper{}").format(deletePath) .expectedReturnStatusCode(Response.Status.OK.getStatusCode()).delete(this); Assert.assertFalse(_testBaseDataAccessor.exists(deletePath, AccessOption.PERSISTENT)); } finally { _testBaseDataAccessor.remove(path, AccessOption.PERSISTENT); } }
Source:
<code>public void MercuryCuratedNavigationTests_003_navigateThroughNamespaces() { CuratedContentPageObject category = new CuratedContentPageObject(driver); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_ARTICLES) .isArticleIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinishReloadingPage(); UrlChecker.isPathContainedInCurrentUrl(driver, ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isBlogIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinishReloadingPage(); UrlChecker.isPathContainedInCurrentUrl(driver, ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isImageIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinishReloadingPage(); UrlChecker.isPathContainedInCurrentUrl(driver, ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isVideoIconVisible() .clickOnCuratedContentElementByIndex(0) <START> .waitForLoadingSpinnerToFinishReloadingPage(); <END> UrlChecker.isPathContainedInCurrentUrl(driver, ROOT_ARTICLE_PATH); }</code><technical_language>this page called "waitForPageToLoad()" - base this name get impression spinner is reloading</technical_language>

Target:
public void MercuryCuratedNavigationTests_003_navigateThroughNamespaces() { CuratedContentPageObject category = new CuratedContentPageObject(driver); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_ARTICLES) .isArticleIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinish(); category.isArticle(); UrlChecker.isPathContainedInCurrentUrl(driver, MercuryPaths.ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isBlogIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinish(); UrlChecker.isPathContainedInCurrentUrl(driver, MercuryPaths.ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isImageIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinish(); UrlChecker.isPathContainedInCurrentUrl(driver, MercuryPaths.ROOT_ARTICLE_PATH); category .openCuratedContentPage(wikiURL, MercurySubpages.CC_CATEGORY_BLOGS) .isVideoIconVisible() .clickOnCuratedContentElementByIndex(0) .waitForLoadingSpinnerToFinish(); UrlChecker.isPathContainedInCurrentUrl(driver, MercuryPaths.ROOT_ARTICLE_PATH); }
Source:
<code>private void activate() { for (ExtensionEntry entry : loadedEntries.values()) { if (entry.enabled) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); activatedEntries.put(entry.getName(), entry); MultiValueMapUtils.addToMap(entry.getProvides(), entry, providesEntries); <START> } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | ConfigurationException ex ) { <END> log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } } }</code><technical_language>catch "Exception"</technical_language>

Target:
private void activate() { for (ExtensionEntry entry : loadedEntries.values()) { if (entry.enabled) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); activatedEntries.put(entry.getName(), entry); MultiValueMapUtils.addToMap(entry.getProvides(), entry, providesEntries); } catch (Exception ex) { log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } } }
Source:
<code>public void aggregate(ByteBuffer buf, int position) { ByteBuffer mutationBuffer = buf.duplicate(); mutationBuffer.position(position); Object value = valueSelector.getObject(); long time = Long.MIN_VALUE; String lastString = null; if (value instanceof SerializablePairLongString) { SerializablePairLongString serializablePair = (SerializablePairLongString) value; time = serializablePair.lhs; lastString = serializablePair.rhs; } else if (value instanceof String) { time = timeSelector.getLong(); lastString = (String) value; } else if (value != null) { throw new IllegalStateException( "Try to aggregate unsuported class type [" + value.getClass().getName() + "]. Supported class types: String or SerializablePairLongString" ); } long lastTime = mutationBuffer.getLong(position); <START> if (lastString != null && time >= lastTime) { <END> if (lastString.length() > maxStringBytes) { lastString = lastString.substring(0, maxStringBytes); } byte[] valueBytes = StringUtils.toUtf8(lastString); mutationBuffer.putLong(position, time); mutationBuffer.putInt(position + Long.BYTES, valueBytes.length); mutationBuffer.position(position + Long.BYTES + Integer.BYTES); mutationBuffer.put(valueBytes); } }</code><technical_language>here. buffer updated lastString is null</technical_language>

Target:
public void aggregate(ByteBuffer buf, int position) { ByteBuffer mutationBuffer = buf.duplicate(); mutationBuffer.position(position); Object value = valueSelector.getObject(); long time = timeSelector.getLong(); String lastString = null; if (value != null) { if (value instanceof SerializablePairLongString) { SerializablePairLongString serializablePair = (SerializablePairLongString) value; time = serializablePair.lhs; lastString = serializablePair.rhs; } else if (value instanceof String) { lastString = (String) value; } else { throw new ISE( "Try to aggregate unsuported class type [%s].Supported class types: String or SerializablePairLongString", value.getClass().getCanonicalName() ); } } long lastTime = mutationBuffer.getLong(position); if (time >= lastTime) { if (lastString != null) { if (lastString.length() > maxStringBytes) { lastString = lastString.substring(0, maxStringBytes); } byte[] valueBytes = StringUtils.toUtf8(lastString); mutationBuffer.putLong(position, time); mutationBuffer.putInt(position + Long.BYTES, valueBytes.length); mutationBuffer.position(position + Long.BYTES + Integer.BYTES); mutationBuffer.put(valueBytes); } else { mutationBuffer.putLong(position, time); mutationBuffer.putInt(position + Long.BYTES, 0); } } }
Source:
<code>public byte[] toBytes() { ByteBuffer idBuf = ByteBuffer.allocate(sizeInBytes()); idBuf.putShort(version); switch (version) { case BLOB_ID_V1: break; case BLOB_ID_V2: case BLOB_ID_V3: byte flag = (byte) (type.ordinal() & 0x3); <START> flag = isEncrypted ? (byte) (flag | 0x4) : flag; <END> idBuf.put(flag); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } idBuf.put(partitionId.getBytes()); idBuf.putInt(uuid.getBytes().length); idBuf.put(uuid.getBytes()); return idBuf.array(); }</code><technical_language>minor: masks (0x3 0x4) constants</technical_language>

Target:
public byte[] toBytes() { ByteBuffer idBuf = ByteBuffer.allocate(sizeInBytes()); idBuf.putShort(version); switch (version) { case BLOB_ID_V1: break; case BLOB_ID_V2: case BLOB_ID_V3: byte flag = (byte) (type.ordinal() & BLOB_ID_TYPE_MASK); flag |= isEncrypted ? IS_ENCRYPTED_MASK : 0; idBuf.put(flag); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } idBuf.put(partitionId.getBytes()); idBuf.putInt(uuid.getBytes().length); idBuf.put(uuid.getBytes()); return idBuf.array(); }
Source:
<code>public void snapshot() { map.snapshot(new GoogleMap.SnapshotReadyCallback() { @Override public void onSnapshotReady(Bitmap snapshot) { TiBlob sblob = TiBlob.blobFromImage(snapshot); KrollDict data = new KrollDict(); data.put("snapshot", sblob); data.put("source", proxy); <START> proxy.fireEvent("onsnapshotready", data); <END> } }); }</code><technical_language>a constant instead of "onsnapshotready"</technical_language>

Target:
public void snapshot() { map.snapshot(new GoogleMap.SnapshotReadyCallback() { @Override public void onSnapshotReady(Bitmap snapshot) { TiBlob sblob = TiBlob.blobFromImage(snapshot); KrollDict data = new KrollDict(); data.put("snapshot", sblob); data.put("source", proxy); proxy.fireEvent(MapModule.EVENT_ON_SNAPSHOT_READY, data); } }); }
Source:
<code>private void onSafeRename() { if (context.getEditorModelContent().getOriginalClassName() != null) { final String className = context.getEditorModelContent().getOriginalClassName(); <START> showAssetUsagesDisplayer.showAssetUsages(Constants.INSTANCE.modelEditor_confirm_renaming_of_used_class(className), <END> versionRecordManager.getCurrentPath(), className, ResourceType.JAVA, () -> rename(), () -> { }); } else { rename(); } }</code><technical_language>@pefernan A test checks showAssetUsagesDisplayer is invocked appreciated please</technical_language>

Target:
public void onSafeRename() { if (context.getEditorModelContent().getOriginalClassName() != null) { final String className = context.getEditorModelContent().getOriginalClassName(); showAssetUsagesDisplayer.showAssetUsages(Constants.INSTANCE.modelEditor_confirm_renaming_of_used_class(className), versionRecordManager.getCurrentPath(), className, ResourceType.JAVA, () -> rename(), () -> { }); } else { rename(); } }
Source:
<code>public boolean execute(String jobName, Date jobRunDate) throws InterruptedException { boolean jobCompletedSuccessfully = true; concurRequestExtractCreatePdpFeedService.createPdpFeedsFromRequestExtracts(); <START> return jobCompletedSuccessfully; <END> }</code><technical_language>createPdpFeeds method return a boolean is a case change of jobCompletedSuccessfully false? I if this return true</technical_language>

Target:
public boolean execute(String jobName, Date jobRunDate) throws InterruptedException { getConcurRequestExtractCreatePdpFeedService().createPdpFeedsFromRequestExtracts(); return true; }
Source:
<code>private PDataType getViewIndexDataType() throws SQLException { <START> boolean supportsLongViewIndexId = "true".equalsIgnoreCase(connection.getClientInfo(LONG_VIEW_INDEX_ENABLED_ATTRIB)); <END> return supportsLongViewIndexId ? MetaDataUtil.getViewIndexIdDataType() : MetaDataUtil.getLegacyViewIndexIdDataType(); }</code><technical_language>please add a default for LONG_VIEW_INDEX_ENABLED_ATTRIB QueryServicesOptions set false similar : boolean asyncIndexBuildEnabled = connection.getQueryServices().getProps().getBoolean( QueryServices.INDEX_ASYNC_BUILD_ENABLED, QueryServicesOptions.DEFAULT_INDEX_ASYNC_BUILD_ENABLED);</technical_language>

Target:
private PDataType getViewIndexDataType() throws SQLException { boolean supportsLongViewIndexId = connection.getQueryServices().getProps().getBoolean( QueryServices.LONG_VIEW_INDEX_ENABLED_ATTRIB, QueryServicesOptions.DEFAULT_LONG_VIEW_INDEX_ENABLED); return supportsLongViewIndexId ? MetaDataUtil.getViewIndexIdDataType() : MetaDataUtil.getLegacyViewIndexIdDataType(); }
Source:
<code>private Boolean calcNoAutoImportAll() { <START> return containsCompileDirectiveWithOption("no_auto_import"); <END> }</code><technical_language>Please check works 'quoted' names</technical_language>

Target:
private boolean calcNoAutoImportAll() { return containsCompileDirectiveWithOption("no_auto_import"); }
Source:
<code>public void testDeregister() { tested.init(canvasHandler); tested.register(element); tested.deregister(element); verify(shapeEventHandler, <START> times(3)).removeHandler(any(ViewHandler.class)); <END> assertFalse(tested.isRegistered(element)); }</code><technical_language>IMO atLeastOnce()</technical_language>

Target:
public void testDeregister() { tested.init(canvasHandler); tested.register(element); tested.deregister(element); verify(shapeEventHandler, atLeastOnce()).removeHandler(any(ViewHandler.class)); assertFalse(tested.isRegistered(element)); }
Source:
<code>public static void buildAndDeployArtifacts() { KieServerDeployer.buildAndDeployCommonMavenParent(); <START> KieServerDeployer.buildAndDeployMavenProjectFromResource("/kjars-sources/scorecard_mm"); <END> KieMavenRepository kmp = KieMavenRepository.getKieMavenRepository(); File artifact = kmp.resolveArtifact(releaseId).getFile(); if (artifact != null) { URL urls[] = new URL[1]; try { urls[0] = artifact.toURI().toURL(); classLoader = new KieURLClassLoader(urls, PMML4Result.class.getClassLoader()); } catch (MalformedURLException e) { logger.error("FAILED TO GET CLASSLOADER !!!"); } } else { logger.error("Could not find artifact file and no class loader created"); } KieServicesClient client = createDefaultStaticClient(EXTENDED_TIMEOUT); ServiceResponse<KieContainerResource> reply = client.createContainer(CONTAINER_ID, new KieContainerResource(CONTAINER_ID, releaseId)); KieServerAssert.assertSuccess(reply); }</code><technical_language>I is nitpicking I originally coded this way, want path for resource a private static final String</technical_language>

Target:
public static void buildAndDeployArtifacts() { KieServerDeployer.buildAndDeployCommonMavenParent(); KieServerDeployer.buildAndDeployMavenProjectFromResource(KJAR_RESOURCE_PATH); KieMavenRepository kmp = KieMavenRepository.getKieMavenRepository(); File artifact = kmp.resolveArtifact(releaseId).getFile(); if (artifact != null) { URL urls[] = new URL[1]; try { urls[0] = artifact.toURI().toURL(); classLoader = new KieURLClassLoader(urls, PMML4Result.class.getClassLoader()); } catch (MalformedURLException e) { logger.error("FAILED TO GET CLASSLOADER !!!"); } } else { logger.error("Could not find artifact file and no class loader created"); } KieServicesClient client = createDefaultStaticClient(EXTENDED_TIMEOUT); ServiceResponse<KieContainerResource> reply = client.createContainer(CONTAINER_ID, new KieContainerResource(CONTAINER_ID, releaseId)); KieServerAssert.assertSuccess(reply); }
Source:
<code>public void testMultipleAsyncClients() { Injector injector = Guice.createInjector( new Module() { @Override public void configure(Binder binder) { httpClientBinder(binder).bindAsyncHttpClient("foo", FooClient.class); httpClientBinder(binder).bindAsyncHttpClient("bar", BarClient.class); } }, new ConfigurationModule(new ConfigurationFactory(Collections.<String, String>emptyMap()))); AsyncHttpClient fooClient = injector.getInstance(Key.get(AsyncHttpClient.class, FooClient.class)); AsyncHttpClient barClient = injector.getInstance(Key.get(AsyncHttpClient.class, BarClient.class)); Assert.assertNotSame(fooClient, barClient); <START> injector.getInstance(NettyIoPool.class).close(); <END> }</code><technical_language>verify a pool is bound FooClientand BarClient annotations</technical_language>

Target:
public void testMultipleAsyncClients() { Injector injector = Guice.createInjector( new Module() { @Override public void configure(Binder binder) { httpClientBinder(binder).bindAsyncHttpClient("foo", FooClient.class); httpClientBinder(binder).bindAsyncHttpClient("bar", BarClient.class); } }, new ConfigurationModule(new ConfigurationFactory(Collections.<String, String>emptyMap()))); AsyncHttpClient fooClient = injector.getInstance(Key.get(AsyncHttpClient.class, FooClient.class)); AsyncHttpClient barClient = injector.getInstance(Key.get(AsyncHttpClient.class, BarClient.class)); Assert.assertNotSame(fooClient, barClient); assertNull(injector.getExistingBinding(Key.get(NettyIoPool.class, FooClient.class))); assertNull(injector.getExistingBinding(Key.get(NettyIoPool.class, BarClient.class))); injector.getInstance(NettyIoPool.class).close(); }
Source:
<code>private static Statistics stringColumnStats(String minimum, String maximum) { <START> Statistics.Builder builder = Statistics.getBuilderForReading(new PrimitiveType(Type.Repetition.OPTIONAL, PrimitiveType.PrimitiveTypeName.BINARY, "testFile", OriginalType.UTF8)); <END> builder.withMin(minimum.getBytes()) .withMax(maximum.getBytes()) .withNumNulls(0); return builder.build(); }</code><technical_language>import OPTIONAL, BINARY, UTF8</technical_language>

Target:
private static Statistics stringColumnStats(String minimum, String maximum) { Statistics.Builder builder = Statistics.getBuilderForReading(new PrimitiveType(OPTIONAL, BINARY, "testFile", UTF8)); builder.withMin(minimum.getBytes()) .withMax(maximum.getBytes()) .withNumNulls(0); return builder.build(); }
Source:
<code>public void testGetNonOverWritingFileNameReturnsUniqueNameOver1Conflict() throws IOException { Path dummyFilePath1 = tempDir.resolve("differentFile.txt"); Files.createFile(dummyFilePath1); String outputFileName = FileNameUniqueness.getNonOverWritingFileName(tempDir, "differentFile.txt"); assertEquals("differentFile (1).txt", outputFileName); <START> Files.delete(dummyFilePath1); <END> }</code><technical_language>Deleting file necessary TempDir care of this</technical_language>

Target:
public void testGetNonOverWritingFileNameReturnsUniqueNameOver1Conflict() throws IOException { Path dummyFilePath1 = tempDir.resolve("differentFile.txt"); Files.createFile(dummyFilePath1); String outputFileName = FileNameUniqueness.getNonOverWritingFileName(tempDir, "differentFile.txt"); assertEquals("differentFile (1).txt", outputFileName); }
Source:
<code>public void testPush() throws Exception { AzureDataSegmentPusher pusher = new AzureDataSegmentPusher(azureStorage, azureAccountConfig, jsonMapper); <START> File tmpDir = Files.createTempDir(); <END> tmpDir.deleteOnExit(); File tmp = new File(tmpDir, "version.bin"); tmp.deleteOnExit(); final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1}; Files.write(data, tmp); final long size = data.length; DataSegment segmentToPush = new DataSegment( "foo", new Interval("2015/2016"), "0", Maps.<String, Object>newHashMap(), Lists.<String>newArrayList(), Lists.<String>newArrayList(), new NoneShardSpec(), 0, size ); DataSegment segment = pusher.push(tmpDir, segmentToPush); Assert.assertEquals(segmentToPush.getSize(), segment.getSize()); }</code><technical_language>this move a TemporaryFolder @Rule</technical_language>

Target:
public void testPush() throws Exception { AzureDataSegmentPusher pusher = new AzureDataSegmentPusher(azureStorage, azureAccountConfig, jsonMapper); File tmp = tempFolder.newFile("version.bin"); final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1}; Files.write(data, tmp); final long size = data.length; DataSegment segmentToPush = new DataSegment( "foo", new Interval("2015/2016"), "0", Maps.<String, Object>newHashMap(), Lists.<String>newArrayList(), Lists.<String>newArrayList(), new NoneShardSpec(), 0, size ); DataSegment segment = pusher.push(tempFolder.getRoot(), segmentToPush); Assert.assertEquals(segmentToPush.getSize(), segment.getSize()); }