auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public BlockFluidBase(Fluid fluid, Material material) { super(material); this.setTickRandomly(true); this.disableStats(); <START> this.fluidName = fluid.getRegistryName(); <END> this.density = fluid.density; this.temperature = fluid.temperature; this.maxScaledLight = fluid.luminosity; this.tickRate = fluid.viscosity / 200; this.densityDir = fluid.density > 0 ? -1 : 1; fluid.setBlock(this); this.definedFluid = fluid; displacements.putAll(defaultDisplacements); this.setDefaultState(blockState.getBaseState().withProperty(LEVEL, 0)); }</code><technical_language>Add com.google.common.base.Preconditions#checkNotNull(fluid.getRegistryName()) top of this constructor easy forget set registry name calling this. easy a null name in fluid constructor. This people port registry new more easily</technical_language>

Target:
public BlockFluidBase(Fluid fluid, Material material) { super(material); Preconditions.checkNotNull(fluid.getRegistryName(), "Cannot create Block for Fluid with null registry name %s", fluid); this.setTickRandomly(true); this.disableStats(); this.fluidName = fluid.getRegistryName(); this.density = fluid.density; this.temperature = fluid.temperature; this.maxScaledLight = fluid.luminosity; this.tickRate = fluid.viscosity / 200; this.densityDir = fluid.density > 0 ? -1 : 1; fluid.setBlock(this); this.definedFluid = fluid; displacements.putAll(defaultDisplacements); this.setDefaultState(blockState.getBaseState().withProperty(LEVEL, 0)); }
Source:
<code>public Object[] getElements() { ArrayList<Event> events = new ArrayList<>(); if (protocols.size() > 0) { addAnyEvent(events, protocols.get(0)); } <START> ; <END> return events.toArray(); }</code><technical_language>Empty statement. JDT flag this a problem</technical_language>

Target:
public Object[] getElements() { ArrayList<Event> events = new ArrayList<>(); if (protocols.size() > 0) { events.add(protocols.get(0).getAnyReceiveEvent()); } return events.toArray(); }
Source:
<code>protected void setEcsNetworkConfiguration(final EcsClientConfig clientConfig, final RunTaskRequest request) { if (!clientConfig.getSubnets().isEmpty()) { request.withNetworkConfiguration(new NetworkConfiguration().withAwsvpcConfiguration( new AwsVpcConfiguration() .withSubnets(clientConfig.getSubnets()) <START> .withAssignPublicIp(AssignPublicIp.ENABLED) END> )); } }</code><technical_language>default, runTask assign public IP. <LINK_0> So, I remove this public IP setting. this control task definition</technical_language>

Target:
protected void setEcsNetworkConfiguration(final EcsClientConfig clientConfig, final RunTaskRequest request) { if (clientConfig.getSubnets().isPresent()) { request.withNetworkConfiguration(new NetworkConfiguration().withAwsvpcConfiguration( new AwsVpcConfiguration() .withSubnets(clientConfig.getSubnets().get()) .withAssignPublicIp(clientConfig.isAssignPublicIp() ? AssignPublicIp.ENABLED : AssignPublicIp.DISABLED) )); } }
Source:
<code>public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (receiver instanceof Shell) { Shell shell = (Shell) receiver; if (shell.isDisposed()) { return false; } Object shellData = shell.getData(); if (shellData instanceof FilteredPreferenceDialog) { FilteredPreferenceDialog propertyDialog = (FilteredPreferenceDialog) shellData; IPreferencePage currentPage = propertyDialog.getCurrentPage(); if (currentPage != null) { return currentPage.getClass().getName().equals(expectedValue); } } } return <START> true; <END> }</code><technical_language>concern here. true wrong</technical_language>

Target:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (receiver instanceof Shell) { Shell shell = (Shell) receiver; if (shell.isDisposed()) { return false; } Object shellData = shell.getData(); if (shellData instanceof FilteredPreferenceDialog) { FilteredPreferenceDialog propertyDialog = (FilteredPreferenceDialog) shellData; IPreferencePage currentPage = propertyDialog.getCurrentPage(); if (currentPage != null) { return currentPage.getClass().getName().equals(expectedValue); } } } return false; }
Source:
<code>public void execute(IProgressMonitor monitor) throws CoreException { Git repoTree; <START> if (resources.length > 0) { <END> if (paths != null) { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().setPaths(paths).call(); } } else { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().call(); } } } }</code><technical_language>I this, I thinking situation getRepository(res) == null, in situation Git class constructor thrown NPE</technical_language>

Target:
public void execute(IProgressMonitor monitor) throws CoreException { Git repoTree; if (resources == null) { throw new CoreException(new Status(IStatus.ERROR, Activator .getPluginId(), CoreText.OperationAlreadyExecuted)); } if (resources.length > 0) { if (paths != null) { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().setPaths(paths).call(); } } else { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().call(); } } } }
Source:
<code>public SchedulerService(WorkflowInstanceExecutor workflowInstanceExecutor, Environment env) { int dbPoolSize = env.getProperty("nflow.db.max_pool_size", Integer.class); int dispatcherCount = workflowInstanceExecutor.getThreadCount(); <START> int threadPoolSize = Math.max(dbPoolSize - dispatcherCount, 2); <END> logger.info("Initializing REST API thread pool size to {}", threadPoolSize); this.scheduler = Schedulers.fromExecutor(Executors.newFixedThreadPool(threadPoolSize)); }</code><technical_language>static imports</technical_language>

Target:
public SchedulerService(WorkflowInstanceExecutor workflowInstanceExecutor, Environment env) { int dbPoolSize = env.getProperty("nflow.db.max_pool_size", Integer.class); int dispatcherCount = workflowInstanceExecutor.getThreadCount(); int threadPoolSize = max(dbPoolSize - dispatcherCount, 2); logger.info("Initializing REST API thread pool size to {}", threadPoolSize); this.scheduler = fromExecutor(Executors.newFixedThreadPool(threadPoolSize)); }
Source:
<code>private boolean areNewerMediaFilesAvailable(DriveListItem item) { String mediaDirName = FileUtils.constructMediaPath(item.getName()); try { List<com.google.api.services.drive.model.File> mediaFileList; try { mediaFileList = getMediaFiles(item); } catch (MultipleFoldersFoundException exception) { return false; } if (mediaFileList != null) { for (com.google.api.services.drive.model.File mediaFile : mediaFileList) { File localMediaFile = new File(new StoragePathProvider().getDirPath(StorageSubdirectory.FORMS) + File.separator + mediaDirName + File.separator + mediaFile.getName()); if (!localMediaFile.exists()) { return true; } else { Long lastModifiedLocal = localMediaFile.lastModified(); Long lastModifiedServer = mediaFile.getModifiedTime().getValue(); if (lastModifiedServer > lastModifiedLocal) { return true; } } } } } catch (Exception e) { <START> Timber.e(e); <END> } return false; }</code><technical_language>I log a warning error Timber.w(e); important other hand necessarily fault</technical_language>

Target:
private boolean areNewerMediaFilesAvailable(DriveListItem item) { String mediaDirName = FileUtils.constructMediaPath(item.getName()); try { List<com.google.api.services.drive.model.File> mediaFileList; try { mediaFileList = getMediaFiles(item); } catch (MultipleFoldersFoundException exception) { return false; } if (mediaFileList != null) { for (com.google.api.services.drive.model.File mediaFile : mediaFileList) { File localMediaFile = new File(storagePathProvider.getDirPath(StorageSubdirectory.FORMS) + File.separator + mediaDirName + File.separator + mediaFile.getName()); if (!localMediaFile.exists()) { return true; } else { Long lastModifiedLocal = localMediaFile.lastModified(); Long lastModifiedServer = mediaFile.getModifiedTime().getValue(); if (lastModifiedServer > lastModifiedLocal) { return true; } } } } } catch (Exception e) { Timber.w(e); } return false; }
Source:
<code>private void validateOrders(HashSet<Order> unboughtOrders, HashSet<Order> unsoldOrders, CumulativeOrder cumulativeBuyOrder, CumulativeOrder cumulativeSellOrder, double matchingPrice) { HashSet<Order> validBuyOrders = new HashSet<Order>(); HashSet<Order> validSellOrders = new HashSet<Order>(); <START> for (Order o : unboughtOrders) { if (o.isMarketOrder() || o.getPrice() >= matchingPrice) { validBuyOrders.add(o); } } <END> for (Order o : unsoldOrders) { if (o.isMarketOrder() || o.getPrice() <= matchingPrice) { validSellOrders.add(o); } } if (cumulativeBuyOrder != null && cumulativeBuyOrder.getCumulativePrice() >= matchingPrice) { validBuyOrders.addAll(cumulativeBuyOrder.getOrders()); } if (cumulativeSellOrder != null && cumulativeSellOrder.getCumulativePrice() <= matchingPrice) { validSellOrders.addAll(cumulativeSellOrder.getOrders()); } unboughtOrders.clear(); unboughtOrders.addAll(validBuyOrders); unsoldOrders.clear(); unsoldOrders.addAll(validSellOrders); }</code><technical_language>extract a function called addValidBuyOrders</technical_language>

Target:
private void validateOrders(HashSet<Order> unboughtOrders, HashSet<Order> unsoldOrders, CumulativeOrder cumulativeBuyOrder, CumulativeOrder cumulativeSellOrder, double matchingPrice) { HashSet<Order> validBuyOrders = new HashSet<Order>(); HashSet<Order> validSellOrders = new HashSet<Order>(); validBuyOrders = addValidBuyOrders(unboughtOrders, validBuyOrders); validSellOrders = addValidSellOrders(unsoldOrders, validSellOrders); if (cumulativeBuyOrder != null && cumulativeBuyOrder.getCumulativePrice() >= matchingPrice) { validBuyOrders.addAll(cumulativeBuyOrder.getOrders()); } if (cumulativeSellOrder != null && cumulativeSellOrder.getCumulativePrice() <= matchingPrice) { validSellOrders.addAll(cumulativeSellOrder.getOrders()); } unboughtOrders.clear(); unboughtOrders.addAll(validBuyOrders); unsoldOrders.clear(); unsoldOrders.addAll(validSellOrders); }
Source:
<code>private void whole(final int type, final long pos, final long sz) throws IOException { IObjectChecker checker=(objCheck==null)?null:objCheck.checkerFor(type); if (checker != null) { ByteArrayOutputStream destinationForInflatedObjectData=new ByteArrayOutputStream((int) sz); updateTempObjectIdWithDigestForPackedObject(type, sz, destinationForInflatedObjectData); byte[] data = destinationForInflatedObjectData.toByteArray(); try { checker.check(data); } catch (CorruptObjectException e) { throw new IOException(MessageFormat.format(JGitText.get().invalidObject , Constants.typeString(type) , tempObjectId.name() , e.getMessage())); } <START> verifySafeObject(tempObjectId, type, data); END> } else { updateTempObjectIdWithDigestForPackedObject(type, sz, NullOutputStream.INSTANCE); } final int crc32 = (int) crc.getValue(); addObjectAndTrack(new PackedObjectInfo(pos, crc32, tempObjectId)); }</code><technical_language>continue do existing object check, for blobs. This is a safety measure prevent a SHA-1 collision corrupting local repository. object is added a repository compute SHA-1 for it, check if object exists. If does, create new object, instead rely existing content. This prevents object SHA-1 content entering repository, continues return older content expected. However, keeping pack file as-is in repository. means wind another copy of existing object. In order ensure continue return content, need compare byte-for-byte. slow, yes. a safety feature trip (in theory), is keep</technical_language>

Target:
private void whole(final int type, final long pos, final long sz) throws IOException { objectDigest.update(Constants.encodedTypeString(type)); objectDigest.update((byte) ' '); objectDigest.update(Constants.encodeASCII(sz)); objectDigest.update((byte) 0); boolean checkContentLater = false; if (type == Constants.OBJ_BLOB && sz >= streamFileThreshold) { InputStream inf = inflate(Source.INPUT, sz); long cnt = 0; while (cnt < sz) { int r = inf.read(readBuffer); if (r <= 0) break; objectDigest.update(readBuffer, 0, r); cnt += r; } inf.close(); tempObjectId.fromRaw(objectDigest.digest(), 0); checkContentLater = readCurs.has(tempObjectId); } else { final byte[] data = inflateAndReturn(Source.INPUT, sz); objectDigest.update(data); tempObjectId.fromRaw(objectDigest.digest(), 0); verifySafeObject(tempObjectId, type, data); } final int crc32 = (int) crc.getValue(); PackedObjectInfo obj = new PackedObjectInfo(pos, crc32, tempObjectId); addObjectAndTrack(obj); if (checkContentLater) deferredCheckContent.add(obj); }
Source:
<code>void test_for_valid_value() { <START> IntStream.range(1, 20).forEach(i -> assertTrue(validator.isValid(UUID.randomUUID().toString(), null))); <END> }</code><technical_language>non-deterministic tests</technical_language>

Target:
void test_for_valid_value() { assertTrue(validator.isValid(UUID.randomUUID().toString(), null)); }
Source:
<code>public void process(final Exchange exchange) throws Exception { <START> final Endpoint endpoint = getEndpoint(); <END> final CamelContext camelContext = endpoint.getCamelContext(); final Message in = exchange.getIn(); final Map<String, Object> headers = in.getHeaders(); final String expandedUri = baseTemplate.expand(headers); final URI uri = URI.create(expandedUri); final String host = new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), null, null, null).toString(); final String basePath = uri.getPath(); final String path = pathTemplate.expand(headers); producer = restProducerFactory.createProducer(camelContext, host, method, basePath, path, null, null, null, null); ServiceHelper.startService(producer); producer.process(exchange); }</code><technical_language>Do need empty lines, a bit confusing read</technical_language>

Target:
public void process(final Exchange exchange) throws Exception { final Endpoint endpoint = getEndpoint(); final CamelContext camelContext = endpoint.getCamelContext(); final Message in = exchange.getIn(); final Map<String, Object> headers = in.getHeaders(); final String expandedUri = baseTemplate.expand(headers); final URI uri = URI.create(expandedUri); final String host = new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), null, null, null).toString(); final String basePath = uri.getPath(); final String path = pathTemplate.expand(headers); Producer answer = producerRef.get(); if (answer == null) { answer = restProducerFactory.createProducer(camelContext, host, method, basePath, path, null, null, null, null); if (producerRef.compareAndSet(null, answer)) { ServiceHelper.startService(answer); } } answer.process(exchange); }
Source:
<code>public void init(final Command callback) { libraryService.call((OrganizationalUnitRepositoryInfo info) -> { if (info != null) { LibraryToolbarPresenter.this.info = info; view.init(LibraryToolbarPresenter.this); setupRepositories(info); selectedRepository = info.getSelectedRepository(); selectedBranch = info.getSelectedRepository().getDefaultBranch(); <START> setBranchSelectorVisibility(); <END> setRepositorySelectorVisibility(); final ProjectContextChangeEvent event = new ProjectContextChangeEvent(info.getSelectedOrganizationalUnit()); projectContextChangeEvent.fire(event); callback.execute(); } }).getDefaultOrganizationalUnitRepositoryInfo(); }</code><technical_language>.and if equal null do want put view a state prevents erroneous manipulation (and errors)</technical_language>

Target:
public void init(final Command callback) { libraryService.call((OrganizationalUnitRepositoryInfo info) -> { LibraryToolbarPresenter.this.info = info; if (info != null) { view.init(LibraryToolbarPresenter.this); setupRepositories(info); selectedRepository = info.getSelectedRepository(); selectedBranch = info.getSelectedRepository().getDefaultBranch(); final ProjectContextChangeEvent event = new ProjectContextChangeEvent(info.getSelectedOrganizationalUnit()); projectContextChangeEvent.fire(event); callback.execute(); } else { notificationEvent.fire(new NotificationEvent(view.getNotEnoughPermissionsToAccessLibraryMessage(), NotificationEvent.NotificationType.ERROR)); } setBranchSelectorVisibility(); setRepositorySelectorVisibility(); }).getDefaultOrganizationalUnitRepositoryInfo(); }
Source:
<code>public static Collection<Collection<ShardIndexInfo>> getShardsByDaysBuckets(Table tableInfo, Collection<ShardIndexInfo> shards, TemporalFunction temporalFunction) { <START> if (shards.size() == 0) { <END> return ImmutableList.of(); } if (!tableInfo.getBucketCount().isPresent() && !tableInfo.getTemporalColumnId().isPresent()) { return ImmutableList.of(shards); } if (tableInfo.getBucketCount().isPresent() && !tableInfo.getTemporalColumnId().isPresent()) { return Multimaps.index(shards, shard -> shard.getBucketNumber().getAsInt()).asMap().values(); } ImmutableMultimap.Builder<Long, ShardIndexInfo> shardsByDaysBuilder = ImmutableMultimap.builder(); shards.stream() .filter(shard -> shard.getTemporalRange().isPresent()) .forEach(shard -> { long day = temporalFunction.getDayFromRange(shard.getTemporalRange().get()); shardsByDaysBuilder.put(day, shard); }); Collection<Collection<ShardIndexInfo>> byDays = shardsByDaysBuilder.build().asMap().values(); if (!tableInfo.getBucketCount().isPresent()) { return byDays; } ImmutableList.Builder<Collection<ShardIndexInfo>> sets = ImmutableList.builder(); for (Collection<ShardIndexInfo> s : byDays) { sets.addAll(Multimaps.index(s, ShardIndexInfo::getBucketNumber).asMap().values()); } return sets.build(); }</code><technical_language>isEmpty()</technical_language>

Target:
public static Collection<Collection<ShardIndexInfo>> getShardsByDaysBuckets(Table tableInfo, Collection<ShardIndexInfo> shards, TemporalFunction temporalFunction) { if (shards.isEmpty()) { return ImmutableList.of(); } if (!tableInfo.getBucketCount().isPresent() && !tableInfo.getTemporalColumnId().isPresent()) { return ImmutableList.of(shards); } if (tableInfo.getBucketCount().isPresent() && !tableInfo.getTemporalColumnId().isPresent()) { return Multimaps.index(shards, shard -> shard.getBucketNumber().getAsInt()).asMap().values(); } ImmutableMultimap.Builder<Long, ShardIndexInfo> shardsByDaysBuilder = ImmutableMultimap.builder(); shards.stream() .filter(shard -> shard.getTemporalRange().isPresent()) .forEach(shard -> { long day = temporalFunction.getDayFromRange(shard.getTemporalRange().get()); shardsByDaysBuilder.put(day, shard); }); Collection<Collection<ShardIndexInfo>> byDays = shardsByDaysBuilder.build().asMap().values(); if (!tableInfo.getBucketCount().isPresent()) { return byDays; } ImmutableList.Builder<Collection<ShardIndexInfo>> sets = ImmutableList.builder(); for (Collection<ShardIndexInfo> s : byDays) { sets.addAll(Multimaps.index(s, ShardIndexInfo::getBucketNumber).asMap().values()); } return sets.build(); }
Source:
<code>private MachineConfigImpl queuePeekOrFail(String workspaceId) throws ConflictException, ServerException { acquireReadLock(workspaceId); try { ensurePreDestroyIsNotExecuted(); final Queue<MachineConfigImpl> queue = startQueues.get(workspaceId); if (queue == null) { <START> throw new ConflictException(format("Workspace '%s' start interrupted. " + <END> "Workspace was stopped before all its machines were started", workspaceId)); } return queue.peek(); } finally { releaseReadLock(workspaceId); } }</code><technical_language>concatenation</technical_language>

Target:
private MachineConfigImpl queuePeekOrFail(String workspaceId) throws ConflictException, ServerException { acquireReadLock(workspaceId); try { ensurePreDestroyIsNotExecuted(); final Queue<MachineConfigImpl> queue = startQueues.get(workspaceId); if (queue == null) { throw new ConflictException( format("Workspace '%s' start interrupted. Workspace was stopped before all its machines were started", workspaceId)); } return queue.peek(); } finally { releaseReadLock(workspaceId); } }
Source:
<code>private static List<Entry<Cell, byte[]>> postFilterEmptyValues( Iterator<Entry<Cell, byte[]>> mergeIterators) { List<Entry<Cell, byte[]>> mergedWritesWithoutEmptyValues = new ArrayList<>(); Predicate<Entry<Cell, byte[]>> nonEmptyValuePredicate = Predicates.compose(Predicates.not(Value.IS_EMPTY), MapEntries.getValueFunction()); while (mergeIterators.hasNext()) { Entry<Cell, byte[]> next = mergeIterators.next(); if (nonEmptyValuePredicate.apply(next)) { mergedWritesWithoutEmptyValues.add(next); } else { <START> getMeter(AtlasDbMetricNames.CellFilterMetrics.EMPTY_VALUE).mark(); <END> } } return mergedWritesWithoutEmptyValues; }</code><technical_language>nit: more efficient a local variable count, update meter end. i a great sense for expensive getMeter call is, i assume access a couple maps</technical_language>

Target:
private static List<Entry<Cell, byte[]>> postFilterEmptyValues( Iterator<Entry<Cell, byte[]>> mergeIterators) { List<Entry<Cell, byte[]>> mergedWritesWithoutEmptyValues = new ArrayList<>(); Predicate<Entry<Cell, byte[]>> nonEmptyValuePredicate = Predicates.compose(Predicates.not(Value.IS_EMPTY), MapEntries.getValueFunction()); long numEmptyValues = 0; while (mergeIterators.hasNext()) { Entry<Cell, byte[]> next = mergeIterators.next(); if (nonEmptyValuePredicate.apply(next)) { mergedWritesWithoutEmptyValues.add(next); } else { numEmptyValues++; } } getMeter(AtlasDbMetricNames.CellFilterMetrics.EMPTY_VALUE).mark(numEmptyValues); return mergedWritesWithoutEmptyValues; }
Source:
<code>public boolean canEditPipelineGroup(String groupName, Username username, HttpLocalizedOperationResult result) { CruiseConfig cruiseConfig = getCurrentConfig(); if((isValidGroup(groupName, cruiseConfig, result) && isAdminOfGroup(groupName, username, result)) == true) { return true; } return false; <START> } <END></code><technical_language>do return (isValidGroup(groupName, cruiseConfig, result) && isAdminOfGroup(groupName, username, result))</technical_language>

Target:
public boolean canEditPipelineGroup(String groupName, Username username, HttpLocalizedOperationResult result) { CruiseConfig cruiseConfig = getCurrentConfig(); return (isValidGroup(groupName, cruiseConfig, result) && isAdminOfGroup(groupName, username, result)); }
Source:
<code>public void annotationShouldWorkWithRange() { DateRangeRandomizerTest.TestData data = null; for(int x=0; x < 10; x++) { data = new EnhancedRandomBuilder().build().nextObject(DateRangeRandomizerTest.TestData.class); <START> System.out.println(data.getDate().toString()); <END> then(data.getDate().getTime()).isBetween( 1452384000000L, 1454112000000L ); } }</code><technical_language>This deleted safely</technical_language>

Target:
public void annotationShouldWorkWithRange() throws Exception { DateRangeRandomizerTest.TestData data = null; for(int x=0; x < 10; x++) { data = EnhancedRandom.random(DateRangeRandomizerTest.TestData.class); then(data.getDate().getTime()).isBetween( LocalDate.parse("2016-01-10").atStartOfDay().toEpochSecond(ZoneOffset.UTC)*1000, LocalDate.parse("2016-01-30").atStartOfDay().toEpochSecond(ZoneOffset.UTC)*1000 ); } }
Source:
<code>public void dispose() { for (DisposeListener l : dispseListeners) { Event e = new Event(); e.widget = getControl(); <START> l.widgetDisposed(new DisposeEvent(e)); <END> } dispseListeners.clear(); part = null; super.dispose(); }</code><technical_language>Papyrus is sufficiently prone exceptions in dealing stale data is worth catching logging RuntimeException occur in listener call-back miss call super.dispose()</technical_language>

Target:
public void dispose() { for (DisposeListener l : disposeListeners) { Event e = new Event(); e.widget = getControl(); SafeRunnable runnable = new SafeRunnable() { @Override public void run() throws Exception { l.widgetDisposed(new DisposeEvent(e)); } }; SafeRunnable.run(runnable); } disposeListeners.clear(); part = null; super.dispose(); }
Source:
<code>private static JsonObject pull(final String title) throws Exception { return Json.createObjectBuilder() .add("number", new Random().nextInt()) <START> .add("state", "open") <END> .add("title", title) .build(); }</code><technical_language>introduce Pull.STATE_OPEN Pull.STATE_CLOSED</technical_language>

Target:
private static JsonObject pull(final String title) throws Exception { return Json.createObjectBuilder() .add("number", new Random().nextInt()) .add("state", Issue.OPEN_STATE) .add("title", title) .build(); }
Source:
<code>public int compare(Annotation o1, Annotation o2) { Class<? extends Annotation> c1 = o1.annotationType(); Class<? extends Annotation> c2 = o2.annotationType(); Method priority1 = getPriorityMethod(c1); Method priority2 = getPriorityMethod(c2); int p1 = getPriorityValue(priority1, o1, c1); int p2 = getPriorityValue(priority2, o2, c2); <START> if (p2 > p1) { <END> return -1; } else if (p2 < p1) { return 1; } else { return 0; } }</code><technical_language>condition replaced return Integer.signum(p1 - p2);</technical_language>

Target:
public int compare(Annotation o1, Annotation o2) { Class<? extends Annotation> c1 = o1.annotationType(); Class<? extends Annotation> c2 = o2.annotationType(); Method priority1 = getPriorityMethod(c1); Method priority2 = getPriorityMethod(c2); int p1 = getPriorityValue(priority1, o1, c1); int p2 = getPriorityValue(priority2, o2, c2); return signum(p1 - p2); }
Source:
<code>public TmfConstantTransform(long offset) { <START> fOffset = Long.valueOf(offset); <END> }</code><technical_language>fOffset = offset</technical_language>

Target:
public TmfConstantTransform(long offset) { fOffset = offset; }
Source:
<code>protected void executeCommand() { entity = getGlusterHook(); addCustomValue(GlusterConstants.HOOK_NAME, entity.getName()); List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS server : getServersInCluster()) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue; returnValue = runVdsCommand( VDSCommandType.RemoveGlusterHook, new GlusterHookVDSParameters(server.getId(), entity.getGlusterCommand(), entity.getStage(), entity.getName() )); return new Pair<VDS, VDSReturnValue>(server, returnValue); } }); } <START> setSucceeded(true); <END> if (!taskList.isEmpty()) { List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); for (Pair<VDS, VDSReturnValue> pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); if (!retValue.getSucceeded() ) { errors.add(retValue.getVdsError().getMessage()); } } } else { setSucceeded(false); } if (errors.size() > 0) { setSucceeded(false); errorType = AuditLogType.GLUSTER_HOOK_REMOVE_FAILED; handleVdsErrors(getAuditLogTypeValue(), errors); addCustomValue(GlusterConstants.FAILURE_MESSAGE , StringUtils.join(errors, SystemUtils.LINE_SEPARATOR)); } if (getSucceeded()) { entity.removeMissingConflict(); getGlusterHooksDao().remove(entity.getId()); } }</code><technical_language>i setting succeeded done results</technical_language>

Target:
protected void executeCommand() { entity = getGlusterHook(); addCustomValue(GlusterConstants.HOOK_NAME, entity.getName()); List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS server : getServersInCluster()) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue; returnValue = runVdsCommand( VDSCommandType.RemoveGlusterHook, new GlusterHookVDSParameters(server.getId(), entity.getGlusterCommand(), entity.getStage(), entity.getName() )); return new Pair<VDS, VDSReturnValue>(server, returnValue); } }); } if (!taskList.isEmpty()) { List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); for (Pair<VDS, VDSReturnValue> pairResult : pairResults) { VDSReturnValue retValue = pairResult.getSecond(); if (!retValue.getSucceeded() ) { errors.add(retValue.getVdsError().getMessage()); } } } if (errors.size() > 0) { setSucceeded(false); errorType = AuditLogType.GLUSTER_HOOK_REMOVE_FAILED; handleVdsErrors(getAuditLogTypeValue(), errors); addCustomValue(GlusterConstants.FAILURE_MESSAGE , StringUtils.join(errors, SystemUtils.LINE_SEPARATOR)); } if (getSucceeded()) { entity.removeMissingConflict(); getGlusterHooksDao().remove(entity.getId()); } else { setSucceeded(false); } }
Source:
<code><START> public void setExecutionAudit(BiConsumer<RequestData, Authentication> executionAudit) { <END> this.executionAudit = executionAudit; }</code><technical_language>a testing facility methods package private. Another approach manually register a RequestPostProcessor work GeoServerExtensionsHelper.singleton</technical_language>

Target:
void setExecutionAudit(BiConsumer<RequestData, Authentication> executionAudit) { this.executionAudit = executionAudit; }
Source:
<code>private void updateDescription(GameInfo item) { String mainWorldGenerator = item.getManifest() .getWorldInfo(TerasologyConstants.MAIN_WORLD) .getWorldGenerator() .getObjectName() .toString(); <START> String modules = item.getManifest() <END> .getModules() .stream() .map(NameVersion::getName) .map(Name::toString) .sorted(String::compareToIgnoreCase) .collect(Collectors.joining(", ")); worldGenerator.setText(mainWorldGenerator); moduleNames.setText(modules); loadPreviewImage(item); }</code><technical_language>rename this commaSeparatedModules immediately clear stream calls :)</technical_language>

Target:
private void updateDescription(GameInfo item) { if (item == null) { worldGenerator.setText(""); moduleNames.setText(""); loadPreviewImage(null); return; } String mainWorldGenerator = item.getManifest() .getWorldInfo(TerasologyConstants.MAIN_WORLD) .getWorldGenerator() .getObjectName() .toString(); String commaSeparatedModules = item.getManifest() .getModules() .stream() .map(NameVersion::getName) .map(Name::toString) .sorted(String::compareToIgnoreCase) .collect(Collectors.joining(", ")); worldGenerator.setText(mainWorldGenerator); moduleNames.setText(commaSeparatedModules); loadPreviewImage(item); }
Source:
<code>public void testRemoveAllOfTypeForVolume() { List<AuditLog> entries = dao.getByVolumeIdAndType(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); assertEquals(1, entries.size()); dao.removeAllOfTypeForVolume(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); List<AuditLog> entries1 = dao.getByVolumeIdAndType(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); assertEquals(1, entries1.size()); <START> assertEquals(entries1.get(0).getLogType(), AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED); <END> }</code><technical_language>expected argument</technical_language>

Target:
public void testRemoveAllOfTypeForVolume() { List<AuditLog> entries = dao.getByVolumeIdAndType(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); assertEquals(1, entries.size()); dao.removeAllOfTypeForVolume(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); List<AuditLog> entries1 = dao.getByVolumeIdAndType(GLUSTER_VOLUME_ID, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED.getValue()); assertEquals(1, entries1.size()); assertEquals(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_SOFT_LIMIT_REACHED, entries1.get(0).getLogType()); }
Source:
<code>public void testMultiTrackNative() throws IOException { Assume.assumeTrue("Ignore tests for format: " + formatStringPair.get(mOutFormat), shouldRunTest(mOutFormat)); System.loadLibrary("ctsmediav2codec_jni"); Assume.assumeTrue("Webm fails this test. <START> Bug: 146423022, delete <END> this once fixed", mOutFormat != MediaMuxer.OutputFormat.MUXER_OUTPUT_WEBM); String inpPrefix = WorkDir.getMediaDirString(); String srcPathA = inpPrefix + mSrcFileA; String srcPathB = inpPrefix + mSrcFileB; String refPath = File.createTempFile("MuxerTestMTrackRefNat", ".out").getAbsolutePath(); String outPath = File.createTempFile("MuxerTestMTrackNat", ".out").getAbsolutePath(); boolean status = nativeTestMultiTrack(mOutFormat, srcPathA, srcPathB, refPath, outPath); new File(outPath).delete(); new File(refPath).delete(); assertTrue("testMultiTrackNative failed for Format: " + mOutFormat, status); }</code><technical_language>I general convention TODO(b/146423022) instead of Bug: 146423022. change occurrences TODO(b/<bugid>) format</technical_language>

Target:
public void testMultiTrackNative() { Assume.assumeTrue(shouldRunTest(mOutFormat)); Assume.assumeTrue("TODO(b/146423022)", mOutFormat != MediaMuxer.OutputFormat.MUXER_OUTPUT_WEBM); System.loadLibrary("ctsmediav2codec_jni"); assertTrue(nativeTestMultiTrack(mOutFormat, mInpPathA, mInpPathB, mRefPath, mOutPath)); }
Source:
<code>public AzkabanCommonModuleConfig(final Props props) { this.props = props; this.storageImplementation = props.getString(AZKABAN_STORAGE_TYPE, this.storageImplementation); this.localStorageBaseDirPath = props .getString(AZKABAN_STORAGE_LOCAL_BASEDIR, this.localStorageBaseDirPath); this.hdfsProjectRootUri = props.get(AZKABAN_STORAGE_HDFS_PROJECT_ROOT_URI) != null ? props .getUri(AZKABAN_STORAGE_HDFS_PROJECT_ROOT_URI, true) : null; this.cacheDependencyRootUri = props.get(AZKABAN_STORAGE_CACHE_DEPENDENCY_ROOT_URI) != null ? props .getUri(AZKABAN_STORAGE_CACHE_DEPENDENCY_ROOT_URI, true) : null; <START> this.originDependencyRootUri = props.get(AZKABAN_STORAGE_ORIGIN_DEPENDENCY_ROOT_URI) != null ? props <END> .getUri(AZKABAN_STORAGE_ORIGIN_DEPENDENCY_ROOT_URI, true) : null; }</code><technical_language>azkaban.utils.Props#getUri(java.lang.String, java.net.URI) directly? e.g. getUri(AZKABAN_STORAGE_ORIGIN_DEPENDENCY_ROOT_URI, null)</technical_language>

Target:
public AzkabanCommonModuleConfig(final Props props) { this.props = props; this.storageImplementation = props.getString(AZKABAN_STORAGE_TYPE, this.storageImplementation); this.localStorageBaseDirPath = props.getString(AZKABAN_STORAGE_LOCAL_BASEDIR, this.localStorageBaseDirPath); this.hdfsProjectRootUri = props.getUri(AZKABAN_STORAGE_HDFS_PROJECT_ROOT_URI, null, true); this.cacheDependencyRootUri = props.getUri(AZKABAN_STORAGE_CACHE_DEPENDENCY_ROOT_URI, null, true); this.originDependencyRootUri = props.getUri(AZKABAN_STORAGE_ORIGIN_DEPENDENCY_ROOT_URI, null, true); this.dependencyCachingEnabled = props.getBoolean(AZKABAN_STORAGE_CACHE_DEPENDENCY_ENABLED, true); }
Source:
<code>public void testHgvsDeletionToGenomicVariant() { <START> GenomicVariant variant = GenomicVariant.fromHgvs("1:g.19_21del"); <END> GenomicVariantUtil util = variant.getUtil(); assertEquals(util.getChromosome(), "1"); assertEquals(util.getStart(), (Integer) 19); assertEquals(util.getEnd(), (Integer) 21); assertEquals(util.getRef(), "del"); assertEquals(util.getAlt(), ""); }</code><technical_language>this example is tricky, reference allele is deleted. examples like: 1:g.19_21delACG reference allele becomes: ACG alt - empty string if prefer</technical_language>

Target:
public void testHgvsDeletionToGenomicVariant() { GenomicVariant variant = GenomicVariantUtil.fromHgvs("1:g.4849848_4849857del"); assertEquals("1", variant.getChromosome()); assertEquals(RefType.GENOMIC, variant.getRefType()); assertEquals((Integer) 4849848, variant.getStart()); assertEquals((Integer) 4849857, variant.getEnd()); assertEquals("", variant.getRef()); assertEquals(Type.DELETION, variant.getType()); assertEquals("", variant.getAlt()); }
Source:
<code>private static JAXBContext initJaxbContext() { JAXBContext jaxbContext = null; String contextPath = StringUtils.join( new String[] { CswConstants.OGC_CSW_PACKAGE, CswConstants.OGC_FILTER_PACKAGE, CswConstants.OGC_GML_PACKAGE, CswConstants.OGC_OWS_PACKAGE }, ":"); try { LOGGER.debug("Creating JAXB context with context path: {}.", contextPath); jaxbContext = JAXBContext.newInstance(contextPath, CswJAXBElementProvider.class.getClassLoader()); if (LOGGER.isDebugEnabled()) { <START> LOGGER.debug(jaxbContext.toString()); <END> } } catch (JAXBException e) { LOGGER.info("Unable to create JAXB context using contextPath: {}.", contextPath, e); } return jaxbContext; }</code><technical_language>Instead of if, debug("{}", jaxbContext)</technical_language>

Target:
private static JAXBContext initJaxbContext() { JAXBContext jaxbContext = null; String contextPath = StringUtils.join( new String[] { CswConstants.OGC_CSW_PACKAGE, CswConstants.OGC_FILTER_PACKAGE, CswConstants.OGC_GML_PACKAGE, CswConstants.OGC_OWS_PACKAGE }, ":"); try { LOGGER.debug("Creating JAXB context with context path: {}.", contextPath); jaxbContext = JAXBContext.newInstance(contextPath, CswJAXBElementProvider.class.getClassLoader()); LOGGER.debug("{}", jaxbContext); } catch (JAXBException e) { LOGGER.info("Unable to create JAXB context using contextPath: {}.", contextPath, e); } return jaxbContext; }
Source:
<code>public AlertWithIcon() { <START> initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); <END> }</code><technical_language>I add: setAlertType(AlertType.INFO); a default of INFO for messages specify</technical_language>

Target:
public AlertWithIcon() { initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this)); setAlertType(AlertType.INFO); }
Source:
<code>void operation() throws CentralRepoException; } public static PostgresConnectionSettings loadMultiUserSettings() { PostgresConnectionSettings settings = new PostgresConnectionSettings(); CaseDbConnectionInfo muConn; try { muConn = UserPreferences.getDatabaseConnectionInfo(); } catch (UserPreferencesException ex) { LOGGER.log(Level.SEVERE, "Failed to import settings from multi-user settings.", ex); return settings; } <START> handleTry(() -> settings.setHost(valOrDefault(muConn.getHost(), DEFAULT_HOST))); <END> handleTry(() -> settings.setDbName(DEFAULT_DBNAME)); handleTry(() -> settings.setUserName(valOrDefault(muConn.getUserName(), DEFAULT_USERNAME))); handleTry(() -> settings.setPort(valOrDefault(muConn.getPort(), DEFAULT_PORT, 1, 65535))); handleTry(() -> settings.setBulkThreshold(RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD)); handleTry(() -> settings.setPassword(valOrDefault(muConn.getPassword(), DEFAULT_PASSWORD))); return settings; }</code><technical_language>I preserved logic, I reading wrong. in new code if exception thrown field get saved default</technical_language>

Target:
void operation() throws CentralRepoException, NumberFormatException; } public PostgresConnectionSettings loadMultiUserSettings() { PostgresConnectionSettings settings = new PostgresConnectionSettings(); CaseDbConnectionInfo muConn; try { muConn = UserPreferences.getDatabaseConnectionInfo(); } catch (UserPreferencesException ex) { LOGGER.log(Level.SEVERE, "Failed to import settings from multi-user settings.", ex); return settings; } logException(() -> settings.setHost(muConn.getHost())); logException(() -> settings.setDbName(PostgresConnectionSettings.DEFAULT_DBNAME)); logException(() -> settings.setUserName(muConn.getUserName())); logException(() -> settings.setPort(Integer.parseInt(muConn.getPort()))); logException(() -> settings.setBulkThreshold(RdbmsCentralRepo.DEFAULT_BULK_THRESHHOLD)); logException(() -> settings.setPassword(muConn.getPassword())); return settings; }
Source:
<code>public static void serializeMailAddresses( ObjectDataOutput out, MailAddress... addresses ) throws IOException { out.writeInt( addresses.length ); for ( MailAddress address : addresses ) { <START> out.writeUTF( address.getEmail() ); <END> } }</code><technical_language>this problematic missing support for "Foo Bar <foo@bar.com>" style emails. I changing this email.toString() work properly</technical_language>

Target:
public static void serializeMailAddresses( ObjectDataOutput out, MailAddress... addresses ) throws IOException { out.writeInt( addresses.length ); for ( MailAddress address : addresses ) { out.writeUTF( address.getEmail() ); String personalName = address.getPersonalName(); boolean hasPersonalName = StringUtils.isNotBlank( personalName ); out.writeBoolean( hasPersonalName ); if ( hasPersonalName ) { out.writeUTF( address.getPersonalName() ); } } }
Source:
<code><START> public void addPackages(List<String> pkgs) { <END> for (String pkg: pkgs) { packages.add(pkg); } }</code><technical_language>java packages.addAll(pkgs);</technical_language>

Target:
public void addPackages(List<String> pkgs) { packages.addAll(pkgs); }
Source:
<code>private static <T> Predicate<T> hasMember(Path fieldPath, List<Object> values, RequestScope requestScope) { return (T entity) -> { if (values.size() != 1) { throw new InvalidPredicateException("HasMember can only take one argument"); } Object val = getFieldValue(entity, fieldPath, requestScope); <START> String filterStr = CoerceUtil.coerce(values.get(0), String.class); <END> if (val == null) { return false; } if (val instanceof Collection<?>) { return ((Collection<?>) val).contains(filterStr); } if (val instanceof Map<?, ?>) { return ((Map<?, ?>) val).keySet().contains(filterStr); } return false; }; }</code><technical_language>need fix coercion</technical_language>

Target:
private static <T> Predicate<T> hasMember(Path fieldPath, List<Object> values, RequestScope requestScope) { return (T entity) -> { if (values.size() != 1) { throw new BadRequestException("HasMember can only take one argument"); } Object val = getFieldValue(entity, fieldPath, requestScope); Object filterStr = fieldPath.lastElement() .map(last -> CoerceUtil.coerce(values.get(0), last.getFieldType())) .orElse(CoerceUtil.coerce(values.get(0), String.class)); if (val == null) { return false; } if (val instanceof Collection<?>) { return ((Collection<?>) val).contains(filterStr); } if (val instanceof Map<?, ?>) { return ((Map<?, ?>) val).keySet().contains(filterStr); } return false; }; }
Source:
<code>protected int doWork() { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); if (PROBABILITY == 1) { log.warn("Running DownsampleSam with PROBABILITY=1! This will likely just recreate the input file."); } final Random r = RANDOM_SEED == null ? new Random() : new Random(RANDOM_SEED); final SamReader in = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).open(SamInputResource.of(INPUT)); final SAMFileWriter out = new SAMFileWriterFactory().makeSAMOrBAMWriter(in.getFileHeader(), true, OUTPUT); final ProgressLogger progress = new ProgressLogger(log, (int) 1e7, "Wrote"); final DownsamplingIterator iterator = DownsamplingIteratorFactory.make(in, STRATEGY, PROBABILITY, ACCURACY, RANDOM_SEED); final PublicCollectQualityYieldMetrics metricsCollector = new PublicCollectQualityYieldMetrics(); while (iterator.hasNext()) { final SAMRecord rec = iterator.next(); out.addAlignment(rec); <START> metricsCollector.acceptRead(rec, null); <END> progress.record(rec); } out.close(); CloserUtil.close(in); final NumberFormat fmt = new DecimalFormat("0.00%"); log.info("Finished downsampling."); log.info("Kept ", iterator.getAcceptedCount(), " out of ", iterator.getSeenCount(), " reads (", fmt.format(iterator.getAcceptedFraction()), ")."); if (METRICS_FILE != null) metricsCollector.finish(); return 0; }</code><technical_language>this done if METRIC_FILE !=null needs a more parsing of bam-file downsampling..</technical_language>

Target:
protected int doWork() { IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); if (PROBABILITY == 1) { log.warn("Running DownsampleSam with PROBABILITY=1! This will likely just recreate the input file."); } final Random r = RANDOM_SEED == null ? new Random() : new Random(RANDOM_SEED); final SamReader in = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).open(SamInputResource.of(INPUT)); final SAMFileWriter out = new SAMFileWriterFactory().makeSAMOrBAMWriter(in.getFileHeader(), true, OUTPUT); final ProgressLogger progress = new ProgressLogger(log, (int) 1e7, "Wrote"); final DownsamplingIterator iterator = DownsamplingIteratorFactory.make(in, STRATEGY, PROBABILITY, ACCURACY, RANDOM_SEED); final QualityYieldMetricsCollector metricsCollector = new QualityYieldMetricsCollector(true, false, false); while (iterator.hasNext()) { final SAMRecord rec = iterator.next(); out.addAlignment(rec); if (METRICS_FILE != null) metricsCollector.acceptRecord(rec, null); progress.record(rec); } out.close(); CloserUtil.close(in); final NumberFormat fmt = new DecimalFormat("0.00%"); log.info("Finished downsampling."); log.info("Kept ", iterator.getAcceptedCount(), " out of ", iterator.getSeenCount(), " reads (", fmt.format(iterator.getAcceptedFraction()), ")."); if (METRICS_FILE != null) { final MetricsFile<QualityYieldMetrics, Integer> metricsFile = getMetricsFile(); metricsCollector.finish(); metricsCollector.addMetricsToFile(metricsFile); metricsFile.write(METRICS_FILE); } return 0; }
Source:
<code>static <T> Single<? extends T>[] iterableToArray(final Iterable<? extends Single<? extends T>> singlesIterable) { final Single<? extends T>[] singlesArray; int count; if (singlesIterable instanceof List) { List<? extends Single<? extends T>> list = (List<? extends Single<? extends T>>) singlesIterable; count = list.size(); singlesArray = list.toArray(new Single[count]); } else { Single<? extends T>[] tempArray = new Single[8]; count = 0; for (Single<? extends T> s : singlesIterable) { if (count == tempArray.length) { Single<? extends T>[] sb = new Single[count + (count >> 2)]; System.arraycopy(tempArray, 0, sb, 0, count); tempArray = sb; } tempArray[count] = s; count++; } if (tempArray.length == count) { singlesArray = tempArray; } else { singlesArray = new Single[count]; <START> System.arraycopy(tempArray, 0, singlesArray, 0, count); <END> } } return singlesArray; }</code><technical_language>This copy avoided inlined version</technical_language>

Target:
static <T> Single<? extends T>[] iterableToArray(final Iterable<? extends Single<? extends T>> singlesIterable) { final Single<? extends T>[] singlesArray; int count; if (singlesIterable instanceof Collection) { Collection<? extends Single<? extends T>> list = (Collection<? extends Single<? extends T>>) singlesIterable; count = list.size(); singlesArray = list.toArray(new Single[count]); } else { Single<? extends T>[] tempArray = new Single[8]; count = 0; for (Single<? extends T> s : singlesIterable) { if (count == tempArray.length) { Single<? extends T>[] sb = new Single[count + (count >> 2)]; System.arraycopy(tempArray, 0, sb, 0, count); tempArray = sb; } tempArray[count] = s; count++; } if (tempArray.length == count) { singlesArray = tempArray; } else { singlesArray = new Single[count]; System.arraycopy(tempArray, 0, singlesArray, 0, count); } } return singlesArray; }
Source:
<code>public InputStream openStream(String bucketName, String key) { <START> ReadChannel readChannel; <END> try { Blob blob = googleCloudStorageClient.getObject(bucketName, key); if (blob == null) { throw new IllegalArgumentException("Did not find Google Cloud object at key " + key + " from bucket " + bucketName); } readChannel = blob.reader(); } catch (StorageException e) { throw new IllegalArgumentException("Could not read object at key " + key + " from bucket " + bucketName, e); } return Channels.newInputStream(readChannel); }</code><technical_language>return a stream close type of failure</technical_language>

Target:
public InputStream openStream(String bucketName, String key) { ReadChannel readChannel = null; try { Blob blob = googleCloudStorageClient.getObject(bucketName, key); if (blob == null) { throw new IllegalArgumentException("Did not find Google Cloud object at key " + key + " from bucket " + bucketName); } readChannel = blob.reader(); return Channels.newInputStream(readChannel); } catch (Throwable e) { dispose(readChannel); if (e instanceof IllegalArgumentException) { throw e; } throw new IllegalArgumentException("Could not read object at key " + key + " from bucket " + bucketName, e); } }
Source:
<code>private void checkEditorStateAfterSave(String location, boolean canSave) { ((CDK3ServerEditor) editor).getMinishiftBinaryLabel().setText(location); AbstractWait.sleep(TimePeriod.getCustom(1)); if (canSave) { verifyEditorCanSave(); <START> } else { <END> verifyEditorCannotSave(); } }</code><technical_language>this abstract wait</technical_language>

Target:
private void checkEditorStateAfterSave(String location, boolean canSave) { LabeledText label = ((CDK3ServerEditor) editor).getMinishiftBinaryLabel(); label.setText(location); new WaitUntil(new SystemJobIsRunning(jobMatcher), TimePeriod.SHORT, false); new WaitWhile(new SystemJobIsRunning(jobMatcher), TimePeriod.SHORT, false); if (canSave) { verifyEditorCanSave(); } else { verifyEditorCannotSave(); } }