auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public byte[] serialize(PendingSplitsCheckpoint<HiveSourceSplit> checkpoint) throws IOException { Preconditions.checkArgument(checkpoint.getClass() == ContinuousHivePendingSplitsCheckpoint.class, "Only supports %s", ContinuousHivePendingSplitsCheckpoint.class.getName()); ContinuousHivePendingSplitsCheckpoint hiveCheckpoint = (ContinuousHivePendingSplitsCheckpoint) checkpoint; PendingSplitsCheckpoint<HiveSourceSplit> superCP = PendingSplitsCheckpoint.fromCollectionSnapshot( hiveCheckpoint.getSplits(), hiveCheckpoint.getAlreadyProcessedPaths()); byte[] superBytes = superSerDe.serialize(superCP); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (ObjectOutputStream outputStream = new ObjectOutputStream(byteArrayOutputStream)) { outputStream.writeInt(superBytes.length); outputStream.write(superBytes); <START> outputStream.writeObject(hiveCheckpoint.getCurrentReadOffset()); <END> outputStream.writeInt(hiveCheckpoint.getSeenPartitions().size()); for (List<String> partition : hiveCheckpoint.getSeenPartitions()) { outputStream.writeObject(partition); } } return byteArrayOutputStream.toByteArray(); }</code><technical_language>is pass serializer</technical_language>

Target:
public byte[] serialize(PendingSplitsCheckpoint<HiveSourceSplit> checkpoint) throws IOException { Preconditions.checkArgument(checkpoint.getClass() == ContinuousHivePendingSplitsCheckpoint.class, "Only supports %s", ContinuousHivePendingSplitsCheckpoint.class.getName()); ContinuousHivePendingSplitsCheckpoint hiveCheckpoint = (ContinuousHivePendingSplitsCheckpoint) checkpoint; PendingSplitsCheckpoint<HiveSourceSplit> superCP = PendingSplitsCheckpoint.fromCollectionSnapshot( hiveCheckpoint.getSplits(), hiveCheckpoint.getAlreadyProcessedPaths()); byte[] superBytes = superSerDe.serialize(superCP); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (DataOutputViewStreamWrapper outputWrapper = new DataOutputViewStreamWrapper(byteArrayOutputStream)) { outputWrapper.writeInt(superBytes.length); outputWrapper.write(superBytes); readOffsetSerDe.serialize(hiveCheckpoint.getCurrentReadOffset(), outputWrapper); outputWrapper.writeInt(hiveCheckpoint.getSeenPartitionsSinceOffset().size()); for (List<String> partition : hiveCheckpoint.getSeenPartitionsSinceOffset()) { partitionSerDe.serialize(partition, outputWrapper); } } return byteArrayOutputStream.toByteArray(); }
Source:
<code>public long getMinEnd() { <START> return fMinEnd != null ? fMinEnd : getNodeStart() + 1; <END> }</code><technical_language>Ok... a test passes fixing anything... :p</technical_language>

Target:
public long getMinEnd() { return fMinEnd; }
Source:
<code>public NetworkTemplateListModel() { setTitle(ConstantsManager.getInstance().getConstants().templatesTitle()); setHashName("templates"); <START> setRemoveCommand(new UICommand("SetupNetworks", this)); END> updateActionAvailability(); }</code><technical_language>please fix setupnetworks -> remove</technical_language>

Target:
public NetworkTemplateListModel() { setTitle(ConstantsManager.getInstance().getConstants().templatesTitle()); setHashName("templates"); setRemoveCommand(new UICommand("Remove", this)); updateActionAvailability(); }
Source:
<code>public void start(StartContext context) throws StartException { String relativeTo = this.relativeTo.getOptionalValue(); <START> String keytabFile = relativeTo == null ? path : relativeTo + "/" + path; <END> try { clientConfiguration = createConfiguration(false, keytabFile); serverConfiguration = createConfiguration(true, keytabFile); } catch (MalformedURLException e) { throw SECURITY_LOGGER.invalidKeytab(e); } }</code><technical_language>PathManager for this sort of thing</technical_language>

Target:
public void start(StartContext context) throws StartException { String file = path; if (relativeTo != null) { PathManager pm = pathManager.getValue(); file = pm.resolveRelativePathEntry(file, relativeTo); pm.registerCallback(relativeTo, new org.jboss.as.controller.services.path.PathManager.Callback() { @Override public void pathModelEvent(PathEventContext eventContext, String name) { if (eventContext.isResourceServiceRestartAllowed() == false) { eventContext.reloadRequired(); } } @Override public void pathEvent(Event event, PathEntry pathEntry) { } }, Event.REMOVED, Event.UPDATED); } try { clientConfiguration = createConfiguration(false, file); serverConfiguration = createConfiguration(true, file); } catch (MalformedURLException e) { throw SECURITY_LOGGER.invalidKeytab(e); } }
Source:
<code>private static List<USReceiptItem> toReceiptItems(FormField<?> fieldValueItems) { List<FormField<?>> fieldValueArray = (List<FormField<?>>) fieldValueItems.getFieldValue(); List<USReceiptItem> receiptItemList = new ArrayList<>(); FormField<String> name = null; FormField<Float> quantity = null; FormField<Float> price = null; FormField<Float> totalPrice = null; USReceiptItem receiptItem = null; for (FormField<?> eachFieldValue : fieldValueArray) { Map<String, FormField<?>> objectValue = ((Map<String, FormField<?>>) (eachFieldValue.getFieldValue())); for (Map.Entry<String, FormField<?>> entry : objectValue.entrySet()) { String key = entry.getKey(); if (QUANTITY.toString().equals(key)) { quantity = (FormField<Float>) entry.getValue(); } else if (NAME.toString().equals(key)) { name = (FormField<String>) entry.getValue(); } else if (PRICE.toString().equals(key)) { price = (FormField<Float>) entry.getValue(); } else if (TOTAL_PRICE.toString().equals(key)) { totalPrice = (FormField<Float>) entry.getValue(); } <START> receiptItem = new USReceiptItem(name, quantity, price, totalPrice); <END> } receiptItemList.add(receiptItem); } return receiptItemList; }</code><technical_language>move instantiation of USReceiptItem of for loop, this construct entire entrySet processed churn a lot of short lived objects</technical_language>

Target:
private static List<USReceiptItem> toReceiptItems(FormField<?> fieldValueItems) { List<FormField<?>> fieldValueArray = (List<FormField<?>>) fieldValueItems.getFieldValue(); List<USReceiptItem> receiptItemList = null; for (FormField<?> eachFieldValue : fieldValueArray) { receiptItemList = new ArrayList<>(); Map<String, FormField<?>> objectValue = ((Map<String, FormField<?>>) (eachFieldValue.getFieldValue())); FormField<String> name = null; FormField<Float> quantity = null; FormField<Float> price = null; FormField<Float> totalPrice = null; for (Map.Entry<String, FormField<?>> entry : objectValue.entrySet()) { String key = entry.getKey(); if (QUANTITY.toString().equals(key)) { quantity = (FormField<Float>) entry.getValue(); } else if (NAME.toString().equals(key)) { name = (FormField<String>) entry.getValue(); } else if (PRICE.toString().equals(key)) { price = (FormField<Float>) entry.getValue(); } else if (TOTAL_PRICE.toString().equals(key)) { totalPrice = (FormField<Float>) entry.getValue(); } } receiptItemList.add(new USReceiptItem(name, quantity, price, totalPrice)); } return receiptItemList; }
Source:
<code>public void neighborBlockRead() { int[] vector = new int[3]; World world = coordinate.world(); neighborOpaque = 0; neighborWrapable = 0; for (Direction direction : Direction.values()) { BlockPos.MutableBlockPos pos = coordinate.pos; vector[0] = pos.getX(); vector[1] = pos.getY(); vector[2] = pos.getZ(); direction.applyTo(vector, 1); Block b = world.getBlockState(pos).getBlock(); neighborOpaque |= 1 << direction.getInt(); <START> if (isBlockWrappable(b, world, coordonate.x, coordonate.y, coordonate.z)) <END> neighborWrapable |= 1 << direction.getInt(); } }</code><technical_language>old-style positions</technical_language>

Target:
public void neighborBlockRead() { int[] vector = new int[3]; World world = coordinate.world(); neighborOpaque = 0; neighborWrapable = 0; for (Direction direction : Direction.values()) { BlockPos.MutableBlockPos pos = coordinate.pos; vector[0] = pos.getX(); vector[1] = pos.getY(); vector[2] = pos.getZ(); direction.applyTo(vector, 1); Block b = world.getBlockState(pos).getBlock(); neighborOpaque |= 1 << direction.getInt(); if (isBlockWrappable(b, world, pos) neighborWrapable |= 1 << direction.getInt(); } }
Source:
<code>private List<Guid> findVmViolatingPositiveAg(AffinityGroup affinityGroup, Map<Guid, Guid> vmToHost) { Map<Guid, List<Guid>> hostCount = new HashMap<>(); for (Guid vm : affinityGroup.getEntityIds()) { Guid host = vmToHost.get(vm); if (host == null) { continue; } if (hostCount.containsKey(host)) { hostCount.get(host).add(vm); } else { hostCount.put(host, new ArrayList<>()); hostCount.get(host).add(vm); } } Guid host = chooseCandidateHostForMigration(hostCount); if (host == null) { <START> return Collections.EMPTY_LIST; <END> } return hostCount.get(host); }</code><technical_language>Collection.emptyList() instead is type safe. unit tests cover handle empty list properly</technical_language>

Target:
private List<Guid> findVmViolatingPositiveAg(AffinityGroup affinityGroup, Map<Guid, Guid> vmToHost) { Map<Guid, List<Guid>> hostCount = new HashMap<>(); for (Guid vm : affinityGroup.getEntityIds()) { Guid host = vmToHost.get(vm); if (host == null) { continue; } if (hostCount.containsKey(host)) { hostCount.get(host).add(vm); } else { hostCount.put(host, new ArrayList<>()); hostCount.get(host).add(vm); } } Guid host = chooseCandidateHostForMigration(hostCount); if (host == null) { return Collections.emptyList(); } return hostCount.get(host); }
Source:
<code>public void flushIfNeeded(FlushPredicate flushPredicate) { <START> flushIfNeeded(flushPredicate, null); <END> }</code><technical_language>Yeah... I null a message argument for shouldFlush: fileWritingMessageHandler.flushIfNeeded((fileAbsolutePath, lastWrite, filterMessage) -> ...); filterMessage sense in this context all. So, consider introduce more FlushPredicate contract pass in flashable entry. I arguments</technical_language>

Target:
public synchronized void flushIfNeeded(FlushPredicate flushPredicate) { Iterator<Entry<String, FileState>> iterator = FileWritingMessageHandler.this.fileStates.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, FileState> entry = iterator.next(); FileState state = entry.getValue(); if (flushPredicate.shouldFlush(entry.getKey(), state.lastWrite)) { iterator.remove(); state.close(); } } }
Source:
<code>public OneOriginContainer propagate () { long startTimeMillis = System.currentTimeMillis(); perIterationTravelTimes = new int[nIterations]; perIterationPaths = calculateComponents ? new Path[nIterations] : null; int startTarget = 0; int endTarget = nTargets; if (request instanceof RegionalTask && ((RegionalTask) request).oneToOne) { String originId = ((RegionalTask) request).id; if (originId != null) { startTarget = ((FreeFormPointSet) linkedTargets.get(0).pointSet).getIndexForFeature(originId); <START> endTarget = 1; <END> } else { LOG.error("One-to-one travel time analysis requested, but no matched origin-destination pair found."); } } for (int targetIdx = startTarget; targetIdx < endTarget; targetIdx++) { Arrays.fill(perIterationTravelTimes, nonTransitTravelTimesToTargets[targetIdx]); if (perIterationPaths != null) { Arrays.fill(perIterationPaths, null); } propagateTransit(targetIdx); PathScorer pathScorer = null; if (calculateComponents) { pathScorer = new PathScorer(perIterationPaths, perIterationTravelTimes); } int[] percentilesMinutes = travelTimeReducer.extractTravelTimesAndRecord(targetIdx, perIterationTravelTimes); if (calculateComponents) { Set<Path> selectedPaths = pathScorer.getTopPaths(pathWriter.nPathsPerTarget, percentilesMinutes[0] * SECONDS_PER_MINUTE); pathWriter.recordPathsForTarget(selectedPaths); } } LOG.info("Propagating iterations from stops to target points took {}s", nIterations, nStops, endTarget, (System.currentTimeMillis() - startTimeMillis) / 1000d ); if (pathWriter != null) { pathWriter.finishAndStorePaths(); } targets = null; return travelTimeReducer.finish(); }</code><technical_language>this startTarget + 1</technical_language>

Target:
public OneOriginResult propagate () { long startTimeMillis = System.currentTimeMillis(); perIterationTravelTimes = new int[nIterations]; perIterationPaths = calculateComponents ? new Path[nIterations] : null; int startTarget = 0; int endTarget = nTargets; if (oneToOne) { startTarget = ((RegionalTask) request).taskId; endTarget = startTarget + 1; } for (int targetIdx = startTarget; targetIdx < endTarget; targetIdx++) { Arrays.fill(perIterationTravelTimes, nonTransitTravelTimesToTargets[targetIdx]); if (perIterationPaths != null) { Arrays.fill(perIterationPaths, null); } propagateTransit(targetIdx); PathScorer pathScorer = null; if (calculateComponents) { pathScorer = new PathScorer(perIterationPaths, perIterationTravelTimes); } int targetToWrite = oneToOne ? 0 : targetIdx; int[] percentilesMinutes = travelTimeReducer.extractTravelTimesAndRecord(targetToWrite, perIterationTravelTimes); if (calculateComponents) { Set<Path> selectedPaths = pathScorer.getTopPaths(pathWriter.nPathsPerTarget, percentilesMinutes[0] * SECONDS_PER_MINUTE); pathWriter.recordPathsForTarget(selectedPaths); } } LOG.info("Propagating iterations from stops to target points took {}s", nIterations, nStops, endTarget - startTarget, (System.currentTimeMillis() - startTimeMillis) / 1000d ); if (pathWriter != null) { pathWriter.finishAndStorePaths(); } targets = null; return travelTimeReducer.finish(); }
Source:
<code>protected void updatePlayer1Button(GameContainer container, StateBasedGame game) throws SlickException { if (controller.isAreaClicked(mouseOverOnePlayer, input)) { Game singleplayerGame = controller.createSingleplayerGame(container, game); final GameState gameState = new GameState(singleplayerGame); <START> game.addState(gameState); <END> game.getState(States.GameState).init(container, game); resources.stopTitleScreen(); game.enterState(States.GameState); Game.LOGGER .log(LogSeverity.DEBUG, "StartMenu", "User starts a single player game"); } }</code><technical_language>line 109 112 in updatePlayer1Button updatePlayer2Button put in a method</technical_language>

Target:
protected void updatePlayer1Button(GameContainer container, StateBasedGame game) throws SlickException { if (controller.isAreaClicked(mouseOverOnePlayer, input)) { Game singleplayerGame = controller.createSingleplayerGame(container, game); enterGameState(container, game, singleplayerGame); Game.LOGGER .log(LogSeverity.DEBUG, "StartMenu", "User starts a single player game"); } }
Source:
<code>public String getText(Object element) { if (element instanceof IBreakpointManager) { <START> return "Breakpoint Manager"; END> } return super.getText(element); }</code><technical_language>"Breakpoints"</technical_language>

Target:
public String getText(Object element) { if (element instanceof IBreakpointManager) { return "Breakpoints"; } return super.getText(element); }
Source:
<code>public FieldManager(EntityConfiguration entityConfiguration, EntityManager entityManager) { this.entityConfiguration = entityConfiguration; this.entityManager = entityManager; if (entityManager != null) { <START> Set<EntityType<?>> managedEntities = entityManager.getMetamodel().getEntities(); <END> for (EntityType managedEntity : managedEntities) { classes.add(managedEntity.getJavaType()); } } }</code><technical_language>solid improvement for sure, need re-figure this out time</technical_language>

Target:
public FieldManager(EntityConfiguration entityConfiguration, EntityManager entityManager) { this.entityConfiguration = entityConfiguration; this.entityManager = entityManager; if (entityManager != null) { Set<EntityType<?>> managedEntities = entityManager.getMetamodel().getEntities(); for (EntityType managedEntity : managedEntities) { managedEntityClasses.add(managedEntity.getJavaType()); } } }
Source:
<code>public void alterPartitionAndStats(List<String> partVals, SharedCache sharedCache, long writeId, Map<String,String> parameters, List<ColumnStatisticsObj> colStatsObjs) { try { tableLock.writeLock().lock(); PartitionWrapper partitionWrapper = partitionCache.get(CacheUtils.buildPartitionCacheKey(partVals)); <START> if (partitionWrapper != null) { <END> Partition newPart = partitionWrapper.getPartition(); newPart.setParameters(parameters); newPart.setWriteId(writeId); removePartition(partVals, sharedCache); cachePartition(newPart, sharedCache); updatePartitionColStats(partVals, colStatsObjs); } } finally { tableLock.writeLock().unlock(); } }</code><technical_language>if partitionWrapper is null? If anything, remove if, NPE is skip silently (I couple of places this)</technical_language>

Target:
public void alterPartitionAndStats(List<String> partVals, SharedCache sharedCache, long writeId, Map<String,String> parameters, List<ColumnStatisticsObj> colStatsObjs) { try { tableLock.writeLock().lock(); PartitionWrapper partitionWrapper = partitionCache.get(CacheUtils.buildPartitionCacheKey(partVals)); if (partitionWrapper == null) { LOG.info("Partition " + partVals + " is missing from cache. Cannot update the partition stats in cache."); return; } Partition newPart = partitionWrapper.getPartition(); newPart.setParameters(parameters); newPart.setWriteId(writeId); removePartition(partVals, sharedCache); cachePartition(newPart, sharedCache); updatePartitionColStats(partVals, colStatsObjs); } finally { tableLock.writeLock().unlock(); } }
Source:
<code>void shouldLoadAllowOnlySuccessOnManualApprovalType() throws Exception { String content = config( "<pipelines group=\"first\">" + "<pipeline name=\"pipeline\">" + " <materials>" + " <hg url=\"/hgrepo\"/>" + " </materials>" + " <stage name=\"mingle\">" + " <approval type=\"manual\" allowOnlyOnSuccess=\"true\" /> " + " <jobs>" + " <job name=\"functional\">" + " </job>" + " </jobs>" + " </stage>" + "</pipeline>" + "</pipelines>", 126); <START> CruiseConfig config = xmlLoader.loadConfigHolder(content).config; <END> Approval approval = config .getPipelineConfigByName(new CaseInsensitiveString("pipeline")) .getStage("mingle") .getApproval(); assertThat(approval.getType()).isEqualTo("manual"); assertThat(approval.isAllowOnlyOnSuccess()).isEqualTo(true); }</code><technical_language>This break in future if config unparsable. GoConfigMigrationIntegrationTest, basically do this: java String migratedContent = migrateXmlString(configXml, 126); CruiseConfig cruiseConfig = loader.deserializeConfig(migratedContent); Approval a = cruiseConfig.....getApproval(); // perform assertions a Alternatively (a lot chance of breakage, if breaks, easier change): java Approval approval = xmlLoader.fromXmlPartial("<approval .../>", Approval.class); assertThat(approval.isAllowOnlyOnSuccess()).isEqualTo(true);</technical_language>

Target:
void shouldLoadAllowOnlySuccessOnManualApprovalType() throws Exception { Approval approval = xmlLoader.fromXmlPartial("<approval type=\"manual\" allowOnlyOnSuccess=\"true\" />", Approval.class); assertThat(approval.getType()).isEqualTo("manual"); assertThat(approval.isAllowOnlyOnSuccess()).isEqualTo(true); }
Source:
<code>public void testList_CLI() throws Exception { String result = CLIGitCommand.execute("git branch -v", db); <START> assertEquals("* master 9c58deb Initial commit\r\n", result); <END> }</code><technical_language>\r is for Windows only. do that</technical_language>

Target:
public void testList_CLI() throws Exception { assertEquals("* master 9c58deb Initial commit", execute("git branch -v")[0]); }
Source:
<code>private void createResourceControls(Composite parent, DataBindingContext dbc) { resourceKindLabel = new Label(parent, SWT.None); applyAlignData(SWT.FILL, SWT.CENTER, resourceKindLabel); resourceText = new Text(parent, SWT.BORDER | SWT.READ_ONLY); <START> applyGridData(2, 1, SWT.FILL, SWT.CENTER, true, false, resourceText); <END> }</code><technical_language>ugly. for parameters method reading does</technical_language>

Target:
private void createResourceControls(Composite parent, DataBindingContext dbc) { resourceKindLabel = new Label(parent, SWT.None); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(resourceKindLabel); resourceText = new Text(parent, SWT.BORDER | SWT.READ_ONLY); GridDataFactory.fillDefaults().span(2,1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(resourceText); }
Source:
<code>public void delete(Field field, User user) throws DotDataException, DotSecurityException { ContentTypeAPI tapi = APILocator.getContentTypeAPI(user); ContentType type = tapi.find(field.contentTypeId()); perAPI.checkPermission(type, PermissionLevel.PUBLISH, user); Structure structure = new StructureTransformer(type).asStructure(); com.dotmarketing.portlets.structure.model.Field legacyField = new LegacyFieldTransformer(field).asOldField(); <START> HibernateUtil.startTransaction(); <END> if (!(field instanceof CategoryField) && !(field instanceof ConstantField) && !(field instanceof HiddenField) && !(field instanceof LineDividerField) && !(field instanceof TabDividerField) && !(field instanceof RelationshipsTabField) && !(field instanceof PermissionTabField) && !(field instanceof HostFolderField) && structure != null ) { this.conAPI.cleanField(structure, legacyField, this.userAPI.getSystemUser(), false); } fac.delete(field); HibernateUtil.commitTransaction(); CacheLocator.getContentTypeCache().remove(structure); StructureServices.removeStructureFile(structure); if (field instanceof HostFolderField) { try { this.conAPI.cleanHostField(structure, this.userAPI.getSystemUser(), false); } catch(DotMappingException e) { } this.perAPI.resetChildrenPermissionReferences(structure); } conAPI.reindex(structure); ContentletServices.removeContentletFile(structure); ContentletMapServices.removeContentletMapFile(structure); }</code><technical_language>wrap this method in a local transaction? I asking becuase if this method is called in another API started a transaction</technical_language>

Target:
public void delete(Field field, User user) throws DotDataException, DotSecurityException { LocalTransaction.wrapReturn(() -> { ContentTypeAPI tapi = APILocator.getContentTypeAPI(user); ContentType type = tapi.find(field.contentTypeId()); perAPI.checkPermission(type, PermissionLevel.PUBLISH, user); Structure structure = new StructureTransformer(type).asStructure(); com.dotmarketing.portlets.structure.model.Field legacyField = new LegacyFieldTransformer(field).asOldField(); if (!(field instanceof CategoryField) && !(field instanceof ConstantField) && !(field instanceof HiddenField) && !(field instanceof LineDividerField) && !(field instanceof TabDividerField) && !(field instanceof RelationshipsTabField) && !(field instanceof PermissionTabField) && !(field instanceof HostFolderField) && structure != null ) { this.conAPI.cleanField(structure, legacyField, this.userAPI.getSystemUser(), false); } fac.delete(field); CacheLocator.getContentTypeCache().remove(structure); StructureServices.removeStructureFile(structure); if (field instanceof HostFolderField) { try { this.conAPI.cleanHostField(structure, this.userAPI.getSystemUser(), false); } catch(DotMappingException e) this.perAPI.resetChildrenPermissionReferences(structure); } conAPI.reindex(structure); ContentletServices.removeContentletFile(structure); ContentletMapServices.removeContentletMapFile(structure); return null; }); }
Source:
<code>public boolean update(final Identifier queryId, final Identifier operatorId, final OperatorState state) { <START> final Map<Identifier, OperatorState> queryState = queryStateMap.get(queryId); <END> if (queryState != null) { queryState.put(operatorId, state); queryStateMap.put(queryId, queryState); return true; } else { return false; } }</code><technical_language>@bokyoungbin A single query is partitioned OperatorChains, OperatorChain executed in threads. stateful operators in OperatorChains access SSM multiple threads update single shared queryStateMap. @bgchun said, implementation thread-safe. @bgchun Thanks for good point</technical_language>

Target:
public boolean update(final Identifier queryId, final Identifier operatorId, final OperatorState state) { final Map<Identifier, OperatorState> queryState = queryStateMap.get(queryId); if (queryState == null) { return false; } return queryState.replace(operatorId, state) != null ? true : false; }
Source:
<code><START> public void should_log_and_drop_events_on_overflow() throws InterruptedException { <END> MemoryAppender logs = new MemoryAppender(); Logger logger = Logger.getLogger(EventDebouncer.class); Level originalLoggerLevel = logger.getLevel(); logger.setLevel(Level.WARN); logger.addAppender(logs); try { EventDebouncer<MockEvent> debouncer = new EventDebouncer<MockEvent>("test", executor, callback, 100, 10005); debouncer.start(); List<MockEvent> events = new ArrayList<MockEvent>(); for (int i = 0; i < 10004; i++) { MockEvent event = new MockEvent(i); events.add(event); debouncer.eventReceived(event); } callback.awaitEvents(10000); assertThat(callback.getEvents()).isEqualTo(events.subList(0, 10000)); assertThat(logs.get()).containsOnlyOnce("test debouncer enqueued more than 10000 events, rejecting new events."); } finally { logger.removeAppender(logs); logger.setLevel(originalLoggerLevel); } }</code><technical_language>executed takes < 300ms (a lot of overhead in framework though). sense max verify behavior in tests :+1:</technical_language>

Target:
public void should_log_and_drop_events_on_overflow() throws InterruptedException { MemoryAppender logs = new MemoryAppender(); Logger logger = Logger.getLogger(EventDebouncer.class); Level originalLoggerLevel = logger.getLevel(); logger.setLevel(Level.WARN); logger.addAppender(logs); try { EventDebouncer<MockEvent> debouncer = new EventDebouncer<MockEvent>("test", executor, callback, 100, 15, 10); debouncer.start(); List<MockEvent> events = new ArrayList<MockEvent>(); for (int i = 0; i < 14; i++) { MockEvent event = new MockEvent(i); events.add(event); debouncer.eventReceived(event); } callback.awaitEvents(10); assertThat(callback.getEvents()).isEqualTo(events.subList(0, 10)); assertThat(logs.get()).containsOnlyOnce("test debouncer enqueued more than 10 events, rejecting new events."); } finally { logger.removeAppender(logs); logger.setLevel(originalLoggerLevel); } }
Source:
<code>public List<HashShuffleIntermediate> close(ExecutionBlockId ebId) throws IOException { Map<Integer, PartitionAppenderMeta> partitionAppenderMap = null; synchronized (appenderMap) { partitionAppenderMap = appenderMap.remove(ebId); } if (partitionAppenderMap == null) { LOG.info("Close HashShuffleAppender:" + ebId + ", not a hash shuffle"); return null; } <START> List<HashShuffleIntermediate> interimEntries = new ArrayList<HashShuffleIntermediate>(); <END> for (PartitionAppenderMeta eachMeta : partitionAppenderMap.values()) { try { eachMeta.appender.close(); HashShuffleIntermediate intermediate = new HashShuffleIntermediate(eachMeta.partId, eachMeta.appender.getOffset(), eachMeta.appender.getPages(), eachMeta.appender.getMergedTupleIndexes()); interimEntries.add(intermediate); } catch (IOException e) { LOG.error(e.getMessage(), e); throw e; } } LOG.info("Close HashShuffleAppender:" + ebId + ", intermediates=" + interimEntries.size()); return interimEntries; }</code><technical_language>a typo</technical_language>

Target:
public List<HashShuffleIntermediate> close(ExecutionBlockId ebId) throws IOException { Map<Integer, PartitionAppenderMeta> partitionAppenderMap = null; synchronized (appenderMap) { partitionAppenderMap = appenderMap.remove(ebId); } if (partitionAppenderMap == null) { LOG.info("Close HashShuffleAppender:" + ebId + ", not a hash shuffle"); return null; } List<HashShuffleIntermediate> intermediateEntries = new ArrayList<HashShuffleIntermediate>(); for (PartitionAppenderMeta eachMeta : partitionAppenderMap.values()) { try { eachMeta.appender.close(); HashShuffleIntermediate intermediate = new HashShuffleIntermediate(eachMeta.partId, eachMeta.appender.getOffset(), eachMeta.appender.getPages(), eachMeta.appender.getMergedTupleIndexes()); intermediateEntries.add(intermediate); } catch (IOException e) { LOG.error(e.getMessage(), e); throw e; } } LOG.info("Close HashShuffleAppender:" + ebId + ", intermediates=" + intermediateEntries.size()); return intermediateEntries; }
Source:
<code>public static void setFilterNumberByFilterOutRatio(ModelConfig modelConfig,List<ColumnConfig> columnConfigList){ if(modelConfig.getVarSelectFilterNum()>0){ return; } int[] inputOutputIndex = DTrainUtils.getInputOutputCandidateCounts(columnConfigList); log.info("inputOutputIndex:"+inputOutputIndex[0]+" "+inputOutputIndex[1]+" "+inputOutputIndex[2]); int inputNodeCount = inputOutputIndex[0] == 0 ? inputOutputIndex[2] : inputOutputIndex[0]; log.info("inputNodeCount:"+inputNodeCount); Float filterOutRatio = modelConfig.getVarSelect().getFilterOutRatio(); int targetCnt = (int) (inputNodeCount * (1.0f - filterOutRatio)); <START> log.info("target_num:"+targetCnt); <END> modelConfig.getVarSelect().setFilterNum(targetCnt); }</code><technical_language>debug level</technical_language>

Target:
public static void setFilterNumberByFilterOutRatio(ModelConfig modelConfig,List<ColumnConfig> columnConfigList){ if(modelConfig.getVarSelectFilterNum()>0){ return; } int[] inputOutputIndex = DTrainUtils.getInputOutputCandidateCounts(columnConfigList); int inputNodeCount = inputOutputIndex[0] == 0 ? inputOutputIndex[2] : inputOutputIndex[0]; Float filterOutRatio = modelConfig.getVarSelect().getFilterOutRatio(); int targetCnt = (int) (inputNodeCount * (1.0f - filterOutRatio)); modelConfig.getVarSelect().setFilterNum(targetCnt); }
Source:
<code>public static RunDto asDto(Run from) { RunDto dto = new RunDto(); dto.setId(from.getId()); dto.setName(from.getName()); dto.setAlias(from.getAlias()); if (from.getHealth() != null) { dto.setStatus(from.getHealth().getKey()); } else { dto.setStatus(""); } if (from.getLastUpdated() != null) { dto.setLastModified(getDateAsString(from.getLastUpdated())); } if (from.getSequencerReference() != null) { dto.setPlatformType(from.getSequencerReference().getPlatform().getPlatformType().getKey()); } else { dto.setPlatformType(""); } if (from.getStartDate() != null) { dto.setStartDate(getDateAsString(from.getStartDate())); } else { dto.setStartDate(""); } if (from.getCompletionDate() != null) { <START> dto.setEndDate(getDateAsString(from.getStartDate())); <END> } if (from.getSequencingParameters() != null) { dto.setParameters(asDto(from.getSequencingParameters())); } else { SequencingParametersDto parametersDto = new SequencingParametersDto(); parametersDto.setId(-1L); parametersDto.setName("(None)"); dto.setParameters(parametersDto); } return dto; }</code><technical_language>Copying from.startDate instead of from.completionDate</technical_language>

Target:
public static RunDto asDto(Run from) { RunDto dto = new RunDto(); dto.setId(from.getId()); dto.setName(from.getName()); dto.setAlias(from.getAlias()); if (from.getHealth() != null) { dto.setStatus(from.getHealth().getKey()); } else { dto.setStatus(""); } if (from.getLastUpdated() != null) { dto.setLastModified(getDateAsString(from.getLastUpdated())); } if (from.getSequencerReference() != null) { dto.setPlatformType(from.getSequencerReference().getPlatform().getPlatformType().getKey()); } else { dto.setPlatformType(""); } if (from.getStartDate() != null) { dto.setStartDate(getDateAsString(from.getStartDate())); } else { dto.setStartDate(""); } if (from.getCompletionDate() != null) { dto.setEndDate(getDateAsString(from.getCompletionDate())); } if (from.getSequencingParameters() != null) { dto.setParameters(asDto(from.getSequencingParameters())); } else { SequencingParametersDto parametersDto = new SequencingParametersDto(); parametersDto.setId(-1L); parametersDto.setName("(None)"); dto.setParameters(parametersDto); } return dto; }
Source:
<code>public boolean endsWith(Bytes suffix) { int startOffset = this.length - suffix.length; <START> for (int i = startOffset; i < this.length; i++) { <END> if (this.byteAt(i) != suffix.byteAt(i - startOffset)) return false; } return true; }</code><technical_language>if startOffset is negative here, this return false. In other words, is impossible for a string a suffix of a shorter string</technical_language>

Target:
public boolean endsWith(Bytes suffix) { Objects.requireNonNull(suffix, "endsWith(Bytes suffix) cannot have null parameter"); int startOffset = this.length - suffix.length; if (startOffset < 0) { return false; } else { int end = startOffset + this.offset + suffix.length; for (int i = startOffset + this.offset, j = suffix.offset; i < end; i++, j++) { if (this.data[i] != suffix.data[j]) { return false; } } } return true; }
Source:
<code>public SiteModel getSelectedSite() { if (getActivity() instanceof WPMainActivity) { WPMainActivity mainActivity = (WPMainActivity) getActivity(); <START> mainActivity.getSelectedSite(); <END> } return null; }</code><technical_language>I meant return mainActivity.getSelectedSite() here</technical_language>

Target:
public SiteModel getSelectedSite() { if (getActivity() instanceof WPMainActivity) { WPMainActivity mainActivity = (WPMainActivity) getActivity(); return mainActivity.getSelectedSite(); } return null; }
Source:
<code><START> public void handleError(ClientHttpResponse response) throws IOException { <END> GdcError error = null; try { error = gdcErrorExtractor.extractData(response); } catch (RestClientException | IOException ignored) { } final String requestId = response.getHeaders().getFirst(GDC_REQUEST_ID_HEADER); throw new GoodDataRestException(response.getRawStatusCode(), requestId, response.getStatusText(), error); }</code><technical_language>Do want throw IOE</technical_language>

Target:
public void handleError(ClientHttpResponse response) { GdcError error = null; try { error = gdcErrorExtractor.extractData(response); } catch (RestClientException | IOException ignored) { } final String requestId = response.getHeaders().getFirst(GDC_REQUEST_ID_HEADER); int statusCode; try { statusCode = response.getRawStatusCode(); } catch (IOException e) { statusCode = 0; } String statusText; try { statusText = response.getStatusText(); } catch (IOException e) { statusText = null; } throw new GoodDataRestException(statusCode, requestId, statusText, error); }
Source:
<code>public void connect() throws Exception { if (channel.getClusterName() != null && !clusterName.equals(channel.getClusterName())) { throw new ConnectionFailedException("Already joined cluster: " + channel.getClusterName()); } channel.setReceiver(this); channel.connect(clusterName); broadCastMembership(); Address localAddress = channel.getAddress(); String localName = channel.getName(localAddress); <START> SimpleMember<Address> localMember = new SimpleMember<>(localName, localAddress, true, null); <END> members.put(localAddress, localMember); consistentHash.updateAndGet(ch -> ch.with(localMember, loadFactor, commandFilter)); }</code><technical_language>a minor thing, nice if instead of true, a constants LOCAL_MEMBER in this constructor</technical_language>

Target:
public void connect() throws Exception { if (channel.getClusterName() != null && !clusterName.equals(channel.getClusterName())) { throw new ConnectionFailedException("Already joined cluster: " + channel.getClusterName()); } channel.setReceiver(this); channel.connect(clusterName); broadCastMembership(); Address localAddress = channel.getAddress(); String localName = channel.getName(localAddress); SimpleMember<Address> localMember = new SimpleMember<>(localName, localAddress, LOCAL_MEMBER, null); members.put(localAddress, localMember); consistentHash.updateAndGet(ch -> ch.with(localMember, loadFactor, commandFilter)); }
Source:
<code>public PointSetTimes eval (TravelTimeFunction travelTimeForVertex, int offstreetTravelSpeedMillimetersPerSecond) { int[] travelTimes = new int[edges.length]; EdgeStore.Edge edge = streetLayer.edgeStore.getCursor(); for (int i = 0; i < edges.length; i++) { if (edges[i] < 0) { travelTimes[i] = Integer.MAX_VALUE; continue; } edge.seek(edges[i]); int time0 = travelTimeForVertex.getTravelTime(edge.getFromVertex()); int time1 = travelTimeForVertex.getTravelTime(edge.getToVertex()); int scaledLinkDist = distancesToEdge_mm[i] > CELL_SIZE*1000 ? <START> distancesToEdge_mm[i] + OFFROAD_PENALTY * (distancesToEdge_mm[i] - CELL_SIZE * 1000) : distancesToEdge_mm[i]; <END> if (scaledLinkDist > MAX_OFFSTREET_WALK_METERS * 1000 || scaledLinkDist < 0 || scaledLinkDist + distances0_mm[i] < 0){ time0 = Integer.MAX_VALUE; } if (scaledLinkDist > MAX_OFFSTREET_WALK_METERS*1000 || scaledLinkDist < 0 || scaledLinkDist + distances1_mm[i] < 0){ time1 = Integer.MAX_VALUE; } if (time0 != Integer.MAX_VALUE) { time0 += (distances0_mm[i] + scaledLinkDist) / offstreetTravelSpeedMillimetersPerSecond; } if (time1 != Integer.MAX_VALUE) { time1 += (distances1_mm[i] + scaledLinkDist) / offstreetTravelSpeedMillimetersPerSecond; } travelTimes[i] = time0 < time1 ? time0 : time1; } return new PointSetTimes (pointSet, travelTimes); }</code><technical_language>hesitant empirically tuned unitless multipliers isochrone edges extending out water. work in place another, prone overflow. Also, pre-multiplied distance lose information useful for dynamically applying speed distance parameters routing. hard justify speed change some predetermined distance - if consider a cell reachable distance all, do hypothetical walking path cell ends? Instead I limit linking distance, apply walking/biking speed full length</technical_language>

Target:
public PointSetTimes eval (TravelTimeFunction travelTimeForVertex, int offstreetTravelSpeedMillimetersPerSecond) { int[] travelTimes = new int[edges.length]; EdgeStore.Edge edge = streetLayer.edgeStore.getCursor(); for (int i = 0; i < edges.length; i++) { if (edges[i] < 0) { travelTimes[i] = Integer.MAX_VALUE; continue; } edge.seek(edges[i]); int time0 = travelTimeForVertex.getTravelTime(edge.getFromVertex()); int time1 = travelTimeForVertex.getTravelTime(edge.getToVertex()); if (time0 != Integer.MAX_VALUE) { time0 += (distances0_mm[i]) / offstreetTravelSpeedMillimetersPerSecond; } if (time1 != Integer.MAX_VALUE) { time1 += (distances1_mm[i]) / offstreetTravelSpeedMillimetersPerSecond; } travelTimes[i] = time0 < time1 ? time0 : time1; } return new PointSetTimes (pointSet, travelTimes); }
Source:
<code>public void setup() throws Exception { File rootDirectory = StoreTestUtils.createTempDirectory("ambry"); File indexFile = new File(rootDirectory.getAbsolutePath()); for (File c : indexFile.listFiles()) { c.delete(); } ScheduledExecutorService scheduler = Utils.newScheduler(1, false); Log log = new Log(rootDirectory.getAbsolutePath(), 10000, 10000, new StoreMetrics(rootDirectory.getAbsolutePath(), new MetricRegistry())); Properties props = new Properties(); props.setProperty("store.data.flush.interval.seconds", "3600"); props.setProperty("store.deleted.message.retention.days", "1"); props.setProperty("store.index.max.number.of.inmem.elements", "2"); props.setProperty("store.hard.delete.bytes.per.sec", "40"); StoreConfig config = new StoreConfig(new VerifiableProperties(props)); StoreKeyFactory factory = Utils.getObj("com.github.ambry.store.MockIdFactory"); time = new MockTime(SystemTime.getInstance().milliseconds()); helper = new HardDeleteTestHelper(0, 200); index = new MockIndex(rootDirectory.getAbsolutePath(), scheduler, log, config, factory, helper, time); helper.setIndex(index, log); index.setHardDeleteRunningStatus(true); <START> } <END></code><technical_language>@After stops scheduler, closes log etc</technical_language>

Target:
public void setup() throws Exception { File rootDirectory = StoreTestUtils.createTempDirectory("ambry"); File indexFile = new File(rootDirectory.getAbsolutePath()); for (File c : indexFile.listFiles()) { c.delete(); } scheduler = Utils.newScheduler(1, false); log = new Log(rootDirectory.getAbsolutePath(), 10000, 10000, new StoreMetrics(rootDirectory.getAbsolutePath(), new MetricRegistry())); Properties props = new Properties(); props.setProperty("store.data.flush.interval.seconds", "3600"); props.setProperty("store.deleted.message.retention.days", "1"); props.setProperty("store.index.max.number.of.inmem.elements", "2"); props.setProperty("store.hard.delete.bytes.per.sec", "40"); StoreConfig config = new StoreConfig(new VerifiableProperties(props)); StoreKeyFactory factory = Utils.getObj("com.github.ambry.store.MockIdFactory"); time = new MockTime(SystemTime.getInstance().milliseconds()); helper = new HardDeleteTestHelper(0, 200); index = new MockIndex(rootDirectory.getAbsolutePath(), scheduler, log, config, factory, helper, time, UUID.randomUUID()); helper.setIndex(index, log); index.setHardDeleteRunningStatus(true); }
Source:
<code>protected boolean check(Supplier<DesiredCapabilities> serverCapabilitiesSupplier, Supplier<Capabilities> clientCapabilitiesSupplier, BiPredicate<By, Class<? extends WebElement>> filter, By by, Class<? extends WebElement> clazz) { AppiumServiceBuilder builder = new AppiumServiceBuilder() <START> .withAppiumJS(new File("/usr/local/lib/node_modules/appium/build/lib/main.js")) <END> .withCapabilities(serverCapabilitiesSupplier.get()); driver = new AppiumDriver<>(builder, clientCapabilitiesSupplier.get()); return filter.test(by, clazz); }</code><technical_language>this cross-platform</technical_language>

Target:
protected boolean check(Supplier<DesiredCapabilities> serverCapabilitiesSupplier, Supplier<Capabilities> clientCapabilitiesSupplier, BiPredicate<By, Class<? extends WebElement>> filter, By by, Class<? extends WebElement> clazz) { AppiumServiceBuilder builder = new AppiumServiceBuilder() .withCapabilities(serverCapabilitiesSupplier.get()); driver = new AppiumDriver<>(builder, clientCapabilitiesSupplier.get()); return filter.test(by, clazz); }
Source:
<code>public int read() throws IOException { if (this.bytesRead == this.length) { return -1; } try { if (this.streamBytesRead == 0 || this.chunkPos == this.chunkBody.length) { if (this.streamBytesRead != this.streamSize) { int chunkSize = CHUNK_SIZE; if (this.streamBytesRead + chunkSize > this.streamSize) { chunkSize = this.streamSize - this.streamBytesRead; } if (readChunk(chunkSize) < 0) { return -1; } this.streamBytesRead += chunkSize; } else { byte[] chunk = new byte[0]; createChunkBody(chunk); } } this.bytesRead++; <START> return this.chunkBody[this.chunkPos++] & 0xFF; <END> } catch (NoSuchAlgorithmException | InvalidKeyException | InsufficientDataException | InternalException e) { throw new IOException(e.getCause()); } }</code><technical_language>this.chunkBody[this.chunkPos++] evaluate? return index this.chunkPos increment? Is non-idiomatic do increment indexing in separate statements</technical_language>

Target:
public int read() throws IOException { if (this.bytesRead == this.length) { return -1; } try { if (this.streamBytesRead == 0 || this.chunkPos == this.chunkBody.length) { if (this.streamBytesRead != this.streamSize) { int chunkSize = CHUNK_SIZE; if (this.streamBytesRead + chunkSize > this.streamSize) { chunkSize = this.streamSize - this.streamBytesRead; } if (readChunk(chunkSize) < 0) { return -1; } this.streamBytesRead += chunkSize; } else { byte[] chunk = new byte[0]; createChunkBody(chunk); } } this.bytesRead++; int value = this.chunkBody[this.chunkPos] & 0xFF; this.chunkPos++; return value; } catch (NoSuchAlgorithmException | InvalidKeyException | InsufficientDataException | InternalException e) { throw new IOException(e.getCause()); } }
Source:
<code>List<String> foo() { Object obj; Object o1 = (List<String>) foo(); Object o2 = (List<? extends String>) foo(); Object o3 = (List<? super String>) foo(); String s1 = (String) obj; String s2 = (String) s1; A a = (A) new B(); A[][] as = (A[][]) new B[1][1]; B b; fun(b); fun((A) b); List<B> bees = new java.util.ArrayList<B>(); java.util.List<A> aaas = (java.util.List) bees; <START> C c = new C((A)null); END> foo((List<List<A>>) (List<?>) foo2()); obj = (Unknown<String>) unknown; String[] stringList = (String[]) list.toArray(new String[0]); }</code><technical_language>I add a new constructor call check new raising issues in newClassTree well</technical_language>

Target:
List<String> foo() { Object obj; Object o1 = (List<String>) foo(); Object o2 = (List<? extends String>) foo(); Object o3 = (List<? super String>) foo(); String s1 = (String) obj; String s2 = (String) s1; A a = (A) new B(); A[][] as = (A[][]) new B[1][1]; B b; fun(b); fun((B) b); fun((A) b); funBParameter((A) b); List<B> bees = new java.util.ArrayList<B>(); java.util.List<A> aaas = (java.util.List) bees; C c = new C((A) null); C c2 = new C((B) b); foo((List<List<A>>) (List<?>) foo2()); obj = (Unknown<String>) unknown; String[] stringList = (String[]) list.toArray(new String[0]); }
Source:
<code>public void collectionProcessComplete() throws AnalysisEngineProcessException { if (out != null) { IOUtils.closeQuietly(out); } <START> try { <END> Train.main(new String[] { tempData.toString(), targetLocation.toString() }); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } }</code><technical_language>If problems locale-specific numbers, explicitly add a locale printf here? System.out.printf( Locale.ITALIAN, "The date is %tc\n", date );</technical_language>

Target:
public void collectionProcessComplete() throws AnalysisEngineProcessException { try { Train.main(new String[] { tempData.toString(), targetLocation.toString() }); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } }
Source:
<code>public void testHeaderSkip() throws Exception { String []myOptions = { "-f" + path_csv, "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--skip=2", "--escape=\\", "--limitrows=100", "--header", "BlAh" }; String currentTime = new TimestampType().toString(); String []myData = { "1 ,1,1,11111111,first,1.10,1.11,"+currentTime+",POINT(1 1),\"POLYGON((0 0, 1 0, 0 1, 0 0))\"", "2,2,2,222222,second,3.30,NULL,"+currentTime+",POINT(2 2),\"POLYGON((0 0, 2 0, 0 2, 0 0))\"", "clm_integer,clm_tinyint,clm_smallint,clm_bigint,clm_string,clm_decimal,clm_float,clm_timestamp,clm_point,clm_geography", <START> "3,3,3,333333, third ,NULL, 3.33,"+currentTime+",POINT(3 3),\"POLYGON((0 0, 3 0, 0 3, 0 0))\"", <END> "4,4,4,444444, NULL ,4.40 ,4.44,"+currentTime+",POINT(4 4),\"POLYGON((0 0, 4 0, 0 4, 0 0))\"", "5,5,5,5555555, \"abcde\"g, 5.50, 5.55,"+currentTime+",POINT(5 5),\"POLYGON((0 0, 5 0, 0 5, 0 0))\"", "6,6,NULL,666666, sixth, 6.60, 6.66,"+currentTime+",POINT(6 6),\"POLYGON((0 0, 6 0, 0 6, 0 0))\"", "7,NULL,7,7777777, seventh, 7.70, 7.77,"+currentTime+",POINT(7 7),\"POLYGON((0 0, 7 0, 0 7, 0 0))\"", "11, 1,1,\"1,000\",first,1.10,1.11,"+currentTime+",POINT(1 1),\"POLYGON((0 0, 8 0, 0 8, 0 0))\"", }; int invalidLineCnt = 0; int validLineCnt = 6; test_Interface(myOptions, myData, invalidLineCnt, validLineCnt ); }</code><technical_language>column headers is line line skip. column header line</technical_language>

Target:
public void testHeaderSkip() throws Exception { String []myOptions = { "-f" + path_csv, "--reportdir=" + reportDir, "--maxerrors=50", "--user=", "--password=", "--port=", "--separator=,", "--quotechar=\"", "--skip=2", "--escape=\\", "--limitrows=100", "--header", "BlAh" }; String currentTime = new TimestampType().toString(); String []myData = { "clm_integer,clm_tinyint,clm_smallint,clm_bigint,clm_string,clm_decimal,clm_float,clm_timestamp,clm_point,clm_geography", "1 ,1,1,11111111,first,1.10,1.11,"+currentTime+",POINT(1 1),\"POLYGON((0 0, 1 0, 0 1, 0 0))\"", "2,2,2,222222,second,3.30,NULL,"+currentTime+",POINT(2 2),\"POLYGON((0 0, 2 0, 0 2, 0 0))\"", "3,3,3,333333, third ,NULL, 3.33,"+currentTime+",POINT(3 3),\"POLYGON((0 0, 3 0, 0 3, 0 0))\"", "4,4,4,444444, NULL ,4.40 ,4.44,"+currentTime+",POINT(4 4),\"POLYGON((0 0, 4 0, 0 4, 0 0))\"", "5,5,5,5555555, \"abcde\"g, 5.50, 5.55,"+currentTime+",POINT(5 5),\"POLYGON((0 0, 5 0, 0 5, 0 0))\"", "6,6,NULL,666666, sixth, 6.60, 6.66,"+currentTime+",POINT(6 6),\"POLYGON((0 0, 6 0, 0 6, 0 0))\"", "7,NULL,7,7777777, seventh, 7.70, 7.77,"+currentTime+",POINT(7 7),\"POLYGON((0 0, 7 0, 0 7, 0 0))\"", "11, 1,1,\"1,000\",first,1.10,1.11,"+currentTime+",POINT(1 1),\"POLYGON((0 0, 8 0, 0 8, 0 0))\"", }; int invalidLineCnt = 0; int validLineCnt = 6; test_Interface(myOptions, myData, invalidLineCnt, validLineCnt ); }