auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void setState(String state, boolean timestamp) { if (instance == null) { return; } RichPresence.Builder builder = new RichPresence.Builder(); if (state != null) { builder.setState(state); if (getInstance() == null || (getInstance().lastState != null && !getInstance().lastState.equals(state))) { getInstance().lastState = state; } } if (getInstance().config != null) { String playerName = getInstance().config.getPlayer().getName(); <START> builder.setDetails("IGN | " + playerName); <END> } if (timestamp) { builder.setStartTimestamp(OffsetDateTime.now()); } builder.setLargeImage("ss_6"); getInstance().sendRichPresence(builder.build()); }</code><technical_language>IGN? In-Game Name? If if needs short I suppose alright :-)</technical_language>

Target:
public static void setState(String state, boolean timestamp) { if (instance == null) { return; } RichPresence.Builder builder = new RichPresence.Builder(); if (state != null) { builder.setState(state); if (getInstance().lastState == null || (getInstance().lastState != null && !getInstance().lastState.equals(state))) { getInstance().lastState = state; } } if (getInstance().config != null) { String playerName = getInstance().config.getPlayer().getName(); builder.setDetails("Name: " + playerName); } if (timestamp) { builder.setStartTimestamp(OffsetDateTime.now()); } builder.setLargeImage(DISCORD_APP_LARGE_IMAGE); getInstance().sendRichPresence(builder.build()); }
Source:
<code>synchronized void processTimeouts() { long cur = System.currentTimeMillis(); for (TrieNodeRequest request : new ArrayList<>(pendingNodes.values())) { <START> synchronized (request.requestSent) { <END> for (Map.Entry<Long, Long> requestEntry : request.requestSent.entrySet()) { if (cur - requestEntry.getValue() > REQUEST_TIMEOUT) { request.requestSent.remove(requestEntry.getKey()); purgePending(request.nodeHash); nodesQueue.addFirst(request); } } } } }</code><technical_language>ConcurrentHashMap work (it internally synchronizes instance)</technical_language>

Target:
synchronized void processTimeouts() { long cur = System.currentTimeMillis(); for (TrieNodeRequest request : new ArrayList<>(pendingNodes.values())) { Iterator<Map.Entry<Long, Long>> reqIterator = request.requestSent.entrySet().iterator(); while (reqIterator.hasNext()) { Map.Entry<Long, Long> requestEntry = reqIterator.next(); if (cur - requestEntry.getValue() > REQUEST_TIMEOUT) { reqIterator.remove(); purgePending(request.nodeHash); nodesQueue.addFirst(request); } } } }
Source:
<code>private Executor selectExecutor(ExecutableFlow exflow, Set<Executor> availableExecutors) { Executor choosenExecutor = getUserSpecifiedExecutor(exflow); if (choosenExecutor == null) { logger.info("Using dispatcher for execution id :" + exflow.getExecutionId()); <START> ExecutorSelector selector = new ExecutorSelector(filterList, comparatorWeightsMap); <END> choosenExecutor = selector.getBest(activeExecutors, exflow); } return choosenExecutor; }</code><technical_language>do need a new instance of selector time selectExecutor is called</technical_language>

Target:
private Executor selectExecutor(ExecutableFlow exflow, Set<Executor> availableExecutors) { Executor choosenExecutor = getUserSpecifiedExecutor(exflow.getExecutionOptions(), exflow.getExecutionId()); if (choosenExecutor == null) { logger.info("Using dispatcher for execution id :" + exflow.getExecutionId()); ExecutorSelector selector = new ExecutorSelector(filterList, comparatorWeightsMap); choosenExecutor = selector.getBest(activeExecutors, exflow); } return choosenExecutor; }
Source:
<code>public static void sendJobCompletionEvent(final JSONObject payload) { final List<TeamCollectionConfiguration> connectedCollections = TeamCollectionConfiguration.getConnectedCollections(); for (final TeamCollectionConfiguration c : connectedCollections) { try { final ConnectionParameters connectionParameters = c.getConnectionParameters(); if (connectionParameters == null || !connectionParameters.isSendJobCompletionEvents()) { continue; } final TeamRestClient client = new TeamRestClient(URI.create(c.getCollectionUrl())); payload.put("server", connectionParameters.getConnectionKey()); final String jsonPayload = payload.toString(); final JobCompletionEventArgs args = new JobCompletionEventArgs( <START> connectionParameters.getConnectionKey(), jsonPayload, <END> getPayloadSignature(connectionParameters, jsonPayload)); client.sendJobCompletionEvent(args); } catch (final Exception e) { log.info("ERROR: sendJobCompletionEvent: (collection=" + c.getCollectionUrl() + ") " + e.getMessage()); } } }</code><technical_language>Split this line</technical_language>

Target:
public static void sendJobCompletionEvent(final JSONObject payload) { final List<TeamCollectionConfiguration> connectedCollections = TeamCollectionConfiguration.getConnectedCollections(); for (final TeamCollectionConfiguration c : connectedCollections) { try { final ConnectionParameters connectionParameters = c.getConnectionParameters(); final TeamRestClient client = new TeamRestClient(URI.create(c.getCollectionUrl())); payload.put("server", connectionParameters.getConnectionKey()); final String jsonPayload = payload.toString(); final JobCompletionEventArgs args = new JobCompletionEventArgs( connectionParameters.getConnectionKey(), jsonPayload, getPayloadSignature(connectionParameters, jsonPayload)); client.sendJobCompletionEvent(args); } catch (final Exception e) { log.warning("ERROR: sendJobCompletionEvent: (collection=" + c.getCollectionUrl() + ") " + e.getMessage()); } } }
Source:
<code>public void serialize( final Instant instant, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider ) throws IOException { if (instant != null) { <START> SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); <END> jsonGenerator.writeString(df.format(Date.from(instant))); } else { jsonGenerator.writeNull(); } }</code><technical_language>some standard format constant instead of this adhoc format</technical_language>

Target:
public void serialize( final Instant instant, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider ) throws IOException { if (instant != null) { DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.ROOT); jsonGenerator.writeString(formatter.format(Date.from(instant))); } else { jsonGenerator.writeNull(); } }
Source:
<code>public void recognizeContentResultWithBlankPdf(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); SyncPoller<OperationResult, List<FormPage>> syncPoller = <START> client.beginRecognizeContent(getReplayableBufferData(BLANK_FORM_LOCAL_URL), BLANK_FORM_FILE_LENGTH, <END> FormContentType.APPLICATION_PDF, null).getSyncPoller(); syncPoller.waitForCompletion(); validateContentResultData(syncPoller.getFinalResult(), false); }</code><technical_language>Update this public beginRecognizeContent API</technical_language>

Target:
public void recognizeContentResultWithBlankPdf(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); blankPdfDataRunner((data, dataLength) -> { SyncPoller<OperationResult, List<FormPage>> syncPoller = client.beginRecognizeContent( new RecognizeOptions(toFluxByteBuffer(data), dataLength) .setFormContentType(FormContentType.APPLICATION_PDF).setPollInterval(durationTestMode)) .getSyncPoller(); syncPoller.waitForCompletion(); validateContentResultData(syncPoller.getFinalResult(), false); }); }
Source:
<code>InternalMachineConfig(MachineConfig originalConfig, InstallerRegistry installerRegistry) throws InfrastructureException { this.installers = new ArrayList<>(); this.servers = new HashMap<>(originalConfig.getServers()); <START> this.env = new HashMap<>(originalConfig.getEnv()); <END> this.attributes = new HashMap<>(originalConfig.getAttributes()); initInstallers(originalConfig.getInstallers(), installerRegistry); }</code><technical_language>if getEnv returns null</technical_language>

Target:
InternalMachineConfig(MachineConfig originalConfig, InstallerRegistry installerRegistry) throws InfrastructureException { this.servers = new HashMap<>(); if (originalConfig.getServers() != null) { this.servers.putAll(originalConfig.getServers()); } this.env = new HashMap<>(); if (originalConfig.getEnv() != null) { this.env.putAll(originalConfig.getEnv()); } this.attributes = new HashMap<>(); if (originalConfig.getAttributes() != null) { this.attributes.putAll(originalConfig.getAttributes()); } this.installers = new ArrayList<>(); initInstallers(originalConfig.getInstallers(), installerRegistry); }
Source:
<code>public ResteasyUriInfo(final String absoluteUri, final String contextPath, final InitData initData) { <START> initialize(absoluteUri, contextPath, InitData.canBeCached(absoluteUri) ? initData : null); <END> }</code><technical_language>I do this instead: initialize(absoluteUri, contextPath, (initData != null && InitData.canBeCached(absoluteUri)) ? initData : null); IOW, point in spending time checking if cache if initData provided</technical_language>

Target:
public ResteasyUriInfo(final String absoluteUri, final String contextPath, final InitData initData) { initialize(absoluteUri, contextPath, initData != null && InitData.canBeCached(absoluteUri) ? initData : null); }
Source:
<code>protected List<Workflow> githubWebhookDelete(String repository, String gitReference) { Pair<String, String> referencePair = parseGitHubReference(gitReference); <START> List<Workflow> workflows = workflowDAO.findAllByPath("github.com/" + repository, false).stream().filter(workflow -> Objects.equals(workflow.getMode(), DOCKSTORE_YML)).collect( <END> Collectors.toList()); workflows.forEach(workflow -> workflow.getWorkflowVersions().removeIf(workflowVersion -> Objects.equals(workflowVersion.getName(), referencePair.getRight()))); return workflows; }</code><technical_language>pass in mode finding path</technical_language>

Target:
protected List<Workflow> githubWebhookDelete(String repository, String gitReference) { Optional<String> gitReferenceName = GitHelper.parseGitHubReference(gitReference); if (gitReferenceName.isEmpty()) { String msg = "Reference " + gitReference + " is not of the valid form"; LOG.error(msg); throw new CustomWebApplicationException(msg, LAMBDA_FAILURE); } List<Workflow> workflows = workflowDAO.findAllByPath("github.com/" + repository, false).stream().filter(workflow -> Objects.equals(workflow.getMode(), DOCKSTORE_YML)).collect( Collectors.toList()); workflows.forEach(workflow -> workflow.getWorkflowVersions().removeIf(workflowVersion -> Objects.equals(workflowVersion.getName(), gitReferenceName.get()) && !workflowVersion.isFrozen())); return workflows; }
Source:
<code>private boolean isDoNotDisturb() { try { if (sessionDoNotDisturb) { return true; } <START> String clientDnd = clientStorage.getLocalItem(DO_NOT_DISTURB); <END> if (clientDnd != null && !clientDnd.isEmpty()) { Double clientDndExpires = Double.parseDouble(clientDnd); JsDate now = JsDate.create(); if (clientDndExpires > now.getTime()) { return true; } } } catch (NumberFormatException e) { } return false; }</code><technical_language>I call this besides Dnd, mistaken for Drag N Drop acronym</technical_language>

Target:
private boolean isDoNotDisturb() { try { if (sessionDoNotDisturb) { return true; } String clientDoNotDisturb = clientStorage.getLocalItem(DO_NOT_DISTURB); if (clientDoNotDisturb != null && !clientDoNotDisturb.isEmpty()) { Double clientDoNotDisturbExpires = Double.parseDouble(clientDoNotDisturb); JsDate now = JsDate.create(); if (clientDoNotDisturbExpires > now.getTime()) { return true; } } } catch (NumberFormatException e) { } return false; }
Source:
<code>private void decodeDistribution(DBObject dbObject, Described entity) { entity.setDistributions(TranslatorUtils.toIterable(dbObject, <START> DISTRIBUTION_KEY, new Function<DBObject, Distribution>() { <END> @Override public Distribution apply(DBObject input) { return distributionTranslator.fromDBObject(input, new Distribution()); } }).or(ImmutableSet.<Distribution>of())); }</code><technical_language>lambda</technical_language>

Target:
private void decodeDistribution(DBObject dbObject, Described entity) { entity.setDistributions(TranslatorUtils.toIterable(dbObject, DISTRIBUTION_KEY, input -> distributionTranslator.fromDBObject(input) ).or(ImmutableSet.<Distribution>of())); }
Source:
<code>public <V> DataSet<V> readAvroFile(int[] baseColumnMap, int[] partitionColumnMap, String location, OperationContext context, Qualifier[][] qualifiers, DataValueDescriptor probeValue, ExecRow execRow, boolean useSample, double sampleFraction) throws StandardException { try { Dataset<Row> table = null; try { <START> SparkSession spark = SparkSession.builder().master("local").getOrCreate(); <END> table = spark.read().format("com.databricks.spark.avro").load(location); } catch (Exception e) { return handleExceptionInCaseOfEmptySet(e,location); } table = processExternalDataset(table,baseColumnMap,qualifiers,probeValue); if (useSample) { return new SparkDataSet(table .rdd().toJavaRDD() .sample(false, sampleFraction) .map(new RowToLocatedRowFunction(context, execRow))); } else { return new SparkDataSet(table .rdd().toJavaRDD() .map(new RowToLocatedRowFunction(context, execRow))); } } catch (Exception e) { throw StandardException.newException( SQLState.EXTERNAL_TABLES_READ_FAILURE,e.getMessage()); } }</code><technical_language>SpliceSpark.getSession()</technical_language>

Target:
public <V> DataSet<V> readAvroFile(int[] baseColumnMap, int[] partitionColumnMap, String location, OperationContext context, Qualifier[][] qualifiers, DataValueDescriptor probeValue, ExecRow execRow, boolean useSample, double sampleFraction) throws StandardException { try { Dataset<Row> table = null; try { SparkSession spark = SpliceSpark.getSession(); table = spark.read().format("com.databricks.spark.avro").load(location); } catch (Exception e) { return handleExceptionInCaseOfEmptySet(e,location); } table = processExternalDataset(table,baseColumnMap,qualifiers,probeValue); if (useSample) { return new SparkDataSet(table .rdd().toJavaRDD() .sample(false, sampleFraction) .map(new RowToLocatedRowFunction(context, execRow))); } else { return new SparkDataSet(table .rdd().toJavaRDD() .map(new RowToLocatedRowFunction(context, execRow))); } } catch (Exception e) { throw StandardException.newException( SQLState.EXTERNAL_TABLES_READ_FAILURE,e.getMessage()); } }
Source:
<code>public boolean rename(ByteArrayWrapper oldKey, ByteArrayWrapper newKey) { <START> Object value = localRegion.get(oldKey); <END> localRegion.put(newKey, value); del(oldKey); return true; }</code><technical_language>if get returns null? I in case rename immediately return false</technical_language>

Target:
public boolean rename(ByteArrayWrapper oldKey, ByteArrayWrapper newKey) { RedisData value = getRedisData(oldKey); if (value == null) { return false; } region.put(newKey, value); region.remove(oldKey); return true; }
Source:
<code>public int hashCode() { <START> return delegate.hashCode(); <END> }</code><technical_language>Again, this implementation AbstractSet ensure equals hashCode correct for Set</technical_language>

Target:
public int hashCode() { return TODO(); }
Source:
<code>public void fireResourcesRemoved(List<Resource<L>> resources) { if (!resources.isEmpty()) { try { <START> inventoryListenerRWLock.readLock().lock(); <END> LOG.debugf("Firing inventory event for [%d] removed resources", resources.size()); InventoryEvent<L> event = new InventoryEvent<L>(EndpointService.this, resources); for (InventoryListener inventoryListener : inventoryListeners) { inventoryListener.resourcesRemoved(event); } } finally { inventoryListenerRWLock.readLock().unlock(); } } }</code><technical_language>acquisition of locks (just before) entering try-catch. if wrong, finally block is try unlock a lock acquired. swap lines 104-105. Do for others</technical_language>

Target:
public void fireResourcesRemoved(List<Resource<L>> resources) { if (!resources.isEmpty()) { inventoryListenerRWLock.readLock().lock(); try { LOG.debugf("Firing inventory event for [%d] removed resources", resources.size()); InventoryEvent<L> event = new InventoryEvent<L>(EndpointService.this, resources); for (InventoryListener inventoryListener : inventoryListeners) { inventoryListener.resourcesRemoved(event); } } finally { inventoryListenerRWLock.readLock().unlock(); } } }
Source:
<code>public Image getImage(Object element) { <START> if (element instanceof TmfCommonProjectElement) { <END> TmfCommonProjectElement trace = (TmfCommonProjectElement) element; try { if (trace.getResource().getPersistentProperty(TmfCommonConstants.TRACETYPE) == null) { return fUnknownTraceIcon; } String name = trace.getResource().getPersistentProperty(TmfCommonConstants.TRACEBUNDLE); String icon = trace.getResource().getPersistentProperty(TmfCommonConstants.TRACEICON); if (name != null && icon != null) { Bundle bundle = Platform.getBundle(name); if (bundle != null) { Image image = loadIcon(bundle, icon); if (image != null) { return image; } } return fUnknownTraceIcon; } } catch (CoreException e) { } if (element instanceof TmfTraceElement) { return fDefaultTraceIcon; } return fExperimentIcon; } if (element instanceof TmfExperimentFolder) { return fExperimentFolderIcon; } if (element instanceof TmfTraceFolder) { return fTraceFolderIcon; } return null; }</code><technical_language>For experiments experiment type generic experiment type set automatically. This upgrade for users experiments seamless</technical_language>

Target:
public Image getImage(Object element) { if (element instanceof TmfCommonProjectElement) { TmfCommonProjectElement trace = (TmfCommonProjectElement) element; try { if (trace.getResource().getPersistentProperty(TmfCommonConstants.TRACETYPE) == null) { return fUnknownTraceIcon; } String name = trace.getResource().getPersistentProperty(TmfCommonConstants.TRACEBUNDLE); String icon = trace.getResource().getPersistentProperty(TmfCommonConstants.TRACEICON); if (name != null && icon != null) { Bundle bundle = Platform.getBundle(name); if (bundle != null) { Image image = loadIcon(bundle, icon); if (image != null) { return image; } } return fUnknownTraceIcon; } } catch (CoreException e) { } if (element instanceof TmfTraceElement) { return fDefaultTraceIcon; } return fExperimentIcon; } if (element instanceof TmfExperimentFolder) { return fExperimentFolderIcon; } if (element instanceof TmfTraceFolder) { return fTraceFolderIcon; } if (element instanceof TmfAnalysisOutputElement) { TmfAnalysisOutputElement output = (TmfAnalysisOutputElement) element; Image icon = output.getIcon(); if (icon == null) { return fDefaultViewIcon; } return icon; } if (element instanceof TmfAnalysisElement) { TmfAnalysisElement analysis = (TmfAnalysisElement) element; String iconFile = analysis.getIconFile(); if (iconFile != null) { Bundle bundle = analysis.getBundle(); if (bundle != null) { Image icon = loadIcon(bundle, iconFile); return icon; } } return fDefaultAnalysisIcon; } return null; }
Source:
<code>public boolean contentEquals(byte[] bytes, int offset, int len) { <START> if (length != len) { <END> return false; } return compareTo(bytes, offset, len) == 0; }</code><technical_language>return false len offset is negative</technical_language>

Target:
public boolean contentEquals(byte[] bytes, int offset, int len) { Preconditions.checkArgument(len >= 0 && offset >= 0 && offset + len <= bytes.length); return contentEqualsUnchecked(bytes, offset, len); }
Source:
<code>public void testIterationWithSingleLastBatchIsBroken() { try (CacheManager cacheManager = createTestCacheManager()) { Cache<Long, byte[]> cache = cacheManager.getCache(testName.getMethodName(), Long.class, byte[].class); byte[] data = new byte[101 * 1024]; cache.put(1L, data); cache.put(2L, data); <START> for (Cache.Entry<Long, byte[]> entry : cache) { <END> assertThat(entry, notNullValue()); } } }</code><technical_language>assertion iterator returns something</technical_language>

Target:
public void testIterationWithSingleLastBatchIsBroken() { try (CacheManager cacheManager = createTestCacheManager()) { Cache<Long, byte[]> cache = cacheManager.getCache(testName.getMethodName(), Long.class, byte[].class); byte[] data = new byte[101 * 1024]; cache.put(1L, data); cache.put(2L, data); assertThat(cache, containsInAnyOrder( isEntry(is(1L), any(byte[].class)), isEntry(is(2L), any(byte[].class)) )); } }
Source:
<code>public void consume(final Span span) { if (numInflights.incrementAndGet() <= maxInflights) { ListenableFuture<Span> future = executorService.submit(new Callable<Span>() { @Override public Span call() throws Exception { observer.consume(span); return span; } }); Futures.addCallback(future, new FutureCallback<Span>() { @Override public void onSuccess(Span result) { numInflights.decrementAndGet(); } @Override public void onFailure(Throwable error) { log.trace("Failed to notify observer", error); numInflights.decrementAndGet(); } }); } else { log.trace("Failed to notify span observer since the maximum number of allowed concurrent observations was " <START> + "exceeded: " + maxInflights); <END> numInflights.decrementAndGet(); } }</code><technical_language>slf4j string interp</technical_language>

Target:
public void consume(final Span span) { if (numInflights.incrementAndGet() <= maxInflights) { ListenableFuture<Span> future = executorService.submit(new Callable<Span>() { @Override public Span call() throws Exception { observer.consume(span); return span; } }); Futures.addCallback(future, new FutureCallback<Span>() { @Override public void onSuccess(Span result) { numInflights.decrementAndGet(); } @Override public void onFailure(Throwable error) { log.trace("Failed to notify observer", error); numInflights.decrementAndGet(); } }); } else { log.trace("Failed to notify span observer since the maximum number of allowed concurrent observations was " + "exceeded: {}", maxInflights); numInflights.decrementAndGet(); } }
Source:
<code>private int getDimension(RandomAccessInputStream stream) throws IOException { String dim = stream.readString(6).trim(); try { <START> return Integer.parseInt(dim); <END> } catch (NumberFormatException e) { } return 0; }</code><technical_language>DataTools.parseInteger handle NumberFormatException</technical_language>

Target:
private int getDimension(RandomAccessInputStream stream) throws IOException { String dim = stream.readString(6).trim(); Integer dimension = DataTools.parseInteger(dim); return dimension == null ? 0 : dimension; }
Source:
<code>public abstract void add(T entry) throws IOException; public abstract T peek() throws IOException; <START> public final List<T> peek(int max) throws IOException { <END> int end = Math.min(max, size()); List<T> subList = new ArrayList<T>(end); Iterator<T> iterator = iterator(); for (int i = 0; i < end; i++) { subList.add(iterator.next()); } return Collections.unmodifiableList(subList); }</code><technical_language>I of stay non-final provide more efficient implementations in subclasses</technical_language>

Target:
public abstract void add(T entry) throws IOException; public abstract T peek() throws IOException; public List<T> peek(int max) throws IOException { int end = Math.min(max, size()); List<T> subList = new ArrayList<T>(end); Iterator<T> iterator = iterator(); for (int i = 0; i < end; i++) { subList.add(iterator.next()); } return Collections.unmodifiableList(subList); }
Source:
<code>HttpRequestBuilder(boolean preserveHeadersCase) { <START> headers = new LazyValue<>(() -> new CaseInsensitiveMultiMap(!preserveHeadersCase)); <END> }</code><technical_language>lazy? this eventually called build is called</technical_language>

Target:
HttpRequestBuilder(boolean preserveHeadersCase) { headers = new CaseInsensitiveMultiMap(!preserveHeadersCase); }
Source:
<code>public void addCloudConfig(String clusterName, CloudConfig cloudConfig) { <START> <END> }</code><technical_language>Curious throw IllegalStateException in other methods these</technical_language>

Target:
public void addCloudConfig(String clusterName, CloudConfig cloudConfig) { throw new IllegalStateException("Not implemented"); }
Source:
<code>public static Schema extractValues(Schema inputSchema, List<String> keyPaths) { if (inputSchema == null) { return AvroUtils.createEmptySchema(); } Schema schema = extractValues(inputSchema, keyPaths, ""); if (schema == null) { return Schema.createRecord("value_" + inputSchema.getName(), inputSchema.getDoc(), inputSchema.getNamespace(), inputSchema.isError(), new ArrayList<Schema.Field>()); } if (schema.getName() == null) { <START> schema = Schema.createRecord(RECORD_VALUE_PREFIX, schema.getDoc(), schema.getNamespace(), schema.isError(), <END> schema.getFields()); } return schema; }</code><technical_language>I get chosen name this case (when schema == null). matter</technical_language>

Target:
public static Schema extractValues(Schema inputSchema, List<String> keyPaths) { if (inputSchema == null) { return AvroUtils.createEmptySchema(); } Schema schema = extractValues(inputSchema, keyPaths, ""); if (schema == null) { return AvroUtils.createEmptySchema(); } if (schema.getName() == null) { schema = Schema.createRecord(RECORD_VALUE_PREFIX, schema.getDoc(), schema.getNamespace(), schema.isError(), schema.getFields()); } return schema; }
Source:
<code>protected abstract void setupDrivers() throws Exception; protected abstract void deployDataSource( DataSourceDef dataSourceDef ) throws Exception; @Test <START> public void testUnDeployDataSource() { <END> try { setupDrivers(); deployDataSource( dataSourceDef ); DataSourceDeploymentInfo deploymentInfo = dataSourceProvider.getDeploymentInfo( dataSourceDef.getUuid() ); assertNotNull( deploymentInfo ); unDeployDataSource( deploymentInfo ); deploymentInfo = dataSourceProvider.getDeploymentInfo( dataSourceDef.getUuid() ); assertNull( deploymentInfo ); } catch ( Exception e ) { fail ( e.getMessage() ); } }</code><technical_language>Is worth testing if try deploy a Data Source exist</technical_language>

Target:
protected abstract void setupDrivers( ) throws Exception; protected abstract void deployDataSource( DataSourceDef dataSourceDef ) throws Exception; @Test public void testUnDeployDataSource( ) throws Exception { setupDrivers( ); deployDataSource( dataSourceDef ); DataSourceDeploymentInfo initialDeploymentInfo = dataSourceProvider.getDeploymentInfo( dataSourceDef.getUuid( ) ); assertNotNull( initialDeploymentInfo ); unDeployDataSource( initialDeploymentInfo ); DataSourceDeploymentInfo currentDeploymentInfo = dataSourceProvider.getDeploymentInfo( dataSourceDef.getUuid( ) ); assertNull( currentDeploymentInfo ); expectedException.expectMessage( "DataSource: " + initialDeploymentInfo.getUuid( ) + " is not deployed" ); dataSourceProvider.undeploy( initialDeploymentInfo ); }
Source:
<code>private void markHeadsAsUninteresting(final RevWalk walk, Set<ObjectId> existing) { for (Ref ref : repo.getAllRefs().values()) { if (ref.getObjectId() == null) { continue; } else if (ref.getName().startsWith("refs/changes/")) { <START> if (existing != null) <END> existing.add(ref.getObjectId()); } else if (ref.getName().startsWith(R_HEADS) || (destBranchCtl!=null && ref.getName().equals(destBranchCtl.getRefName()))) { try { walk.markUninteresting(walk.parseCommit(ref.getObjectId())); } catch (IOException e) { log.warn(String.format("Invalid ref %s in %s", ref.getName(), project.getName()), e); continue; } } } }</code><technical_language>this is null</technical_language>

Target:
private void markHeadsAsUninteresting(final RevWalk walk, Set<ObjectId> existing) { for (Ref ref : repo.getAllRefs().values()) { if (ref.getObjectId() == null) { continue; } else if (ref.getName().startsWith("refs/changes/")) { existing.add(ref.getObjectId()); } else if (ref.getName().startsWith(R_HEADS) || (destBranchCtl != null && ref.getName().equals(destBranchCtl.getRefName()))) { try { walk.markUninteresting(walk.parseCommit(ref.getObjectId())); } catch (IOException e) { log.warn(String.format("Invalid ref %s in %s", ref.getName(), project.getName()), e); continue; } } } }
Source:
<code>public FenixLessonSummary(Shift shift, DateTime lessonDate, Space space, LessonInstance lessonInstance) { this.shift = shift.getExternalId(); this.shiftName = shift.getPresentationName(); <START> this.shiftType = shift.getSortedTypes().first().getFullNameTipoAula(); <END> this.lessonDate = lessonDate.toString("yyyy-MM-dd HH:mm:ss"); this.room = space != null ? new FenixSpace.Room(space) : null; if(lessonInstance != null && lessonInstance.getSummary() != null) { summary = new FenixSummary(lessonInstance.getSummary()); } }</code><technical_language>if is</technical_language>

Target:
public FenixLessonSummary(Shift shift, DateTime lessonDate, Space space, LessonInstance lessonInstance) { this.shift = shift.getExternalId(); this.shiftName = shift.getPresentationName(); this.shiftType = !shift.getSortedTypes().isEmpty() ? shift.getSortedTypes().first().getFullNameTipoAula() : null; this.lessonDate = lessonDate.toString("yyyy-MM-dd HH:mm:ss"); this.room = space != null ? new FenixSpace.Room(space) : null; if(lessonInstance != null && lessonInstance.getSummary() != null) { summary = new FenixSummary(lessonInstance.getSummary()); } }
Source:
<code>public void suspendAccepts() { handle.suspend(0); <START> suspendedDueToWatermark = false; <END> }</code><technical_language>If suspended due watermark I suspend a no-op (other setting a user-suspended flag) - actual suspend status of channel (suspended user | suspended due watermark). IOW override suspention due connection count</technical_language>

Target:
public void suspendAccepts() { synchronized (this) { handle.suspend(SelectionKey.OP_ACCEPT); suspended = true; } }
Source:
<code>public Object aggregate(List values) { if (values == null || values.isEmpty()) { return null; } <START> List sorted = (List) values.stream().sorted().collect(Collectors.toList()); <END> Object result = sorted.get(sorted.size()-1); return result instanceof Number ? round((Number) result, precission) : result; }</code><technical_language>mentioned above: Please filter out nulls provide some unit tests cover cases</technical_language>

Target:
public Object aggregate(List values) { if (values == null || values.isEmpty()) { return null; } Comparable result = null; for (Object obj : values) { Comparable val = (Comparable) obj; if (val == null) { continue; } if (result == null || val.compareTo(result) > 0) { result = val; } } return result instanceof Number ? round((Number) result, precission) : result; }
Source:
<code>public void run() { try { <START> if ((!_shouldRefreshCache.isPresent() && ( <END> _clusterEventType.equals(ClusterEventType.PeriodicalRebalance) || _clusterEventType .equals(ClusterEventType.OnDemandRebalance))) || (_shouldRefreshCache.isPresent() && _shouldRefreshCache.get())) { requestDataProvidersFullRefresh(); HelixDataAccessor accessor = _manager.getHelixDataAccessor(); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); Map<String, LiveInstance> liveInstanceMap = accessor.getChildValuesMap(keyBuilder.liveInstances()); if (liveInstanceMap != null && !liveInstanceMap.isEmpty()) { NotificationContext changeContext = new NotificationContext(_manager); changeContext.setType(NotificationContext.Type.CALLBACK); synchronized (_manager) { checkLiveInstancesObservation(new ArrayList<>(liveInstanceMap.values()), changeContext); } } } forceRebalance(_manager, _clusterEventType); } catch (Throwable ex) { logger.error("Time task failed. Rebalance task type: " + _clusterEventType + ", cluster: " + _clusterName, ex); } }</code><technical_language>hard read long if statement. _shouldRefreshCache.orElse(false)</technical_language>

Target:
public void run() { try { if (_shouldRefreshCacheOption.orElse( _clusterEventType.equals(ClusterEventType.PeriodicalRebalance) || _clusterEventType .equals(ClusterEventType.OnDemandRebalance))) { requestDataProvidersFullRefresh(); HelixDataAccessor accessor = _manager.getHelixDataAccessor(); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); Map<String, LiveInstance> liveInstanceMap = accessor.getChildValuesMap(keyBuilder.liveInstances()); if (liveInstanceMap != null && !liveInstanceMap.isEmpty()) { NotificationContext changeContext = new NotificationContext(_manager); changeContext.setType(NotificationContext.Type.CALLBACK); synchronized (_manager) { checkLiveInstancesObservation(new ArrayList<>(liveInstanceMap.values()), changeContext); } } } forceRebalance(_manager, _clusterEventType); } catch (Throwable ex) { logger.error("Time task failed. Rebalance task type: " + _clusterEventType + ", cluster: " + _clusterName, ex); } }
Source:
<code><START> public Map generateSprite(String[] urls, Map options) throws IOException { <END> options.put("urls", urls); return generateSprite(options); }</code><technical_language>if I send urls tag</technical_language>

Target:
public Map generateSprite(String[] urls, Map options) throws IOException { if (options == null) options = Collections.singletonMap("urls", urls); else options.put("urls", urls); return callApi("sprite", buildGenerateSpriteParams(options), options, null); }
Source:
<code>private static boolean checkDecimal(Number number, BigDecimal min, BigDecimal max) { BigDecimal bigDecimal = null; if (number instanceof Integer || number instanceof Long) { bigDecimal = new BigDecimal(number.doubleValue()); } else if (number instanceof Float || number instanceof Double) { double doubleValue = number.doubleValue(); if (!Double.isNaN(doubleValue) && doubleValue != Double.NEGATIVE_INFINITY && doubleValue != Double.POSITIVE_INFINITY) { bigDecimal = new BigDecimal(doubleValue); } else { return false; } } else if (number instanceof BigInteger) { bigDecimal = new BigDecimal((BigInteger) number); } else if (number instanceof BigDecimal) { bigDecimal = (BigDecimal) number; } else { double doubleValue = number.doubleValue(); if (!Double.isNaN(doubleValue) && <START> doubleValue != Double.NEGATIVE_INFINITY && doubleValue != Double.POSITIVE_INFINITY) { <END> bigDecimal = new BigDecimal(doubleValue); } else { return false; } } { return max.compareTo(bigDecimal) >= 0 && min.compareTo(bigDecimal) <= 0; } }</code><technical_language>written !Double.isInfinite(doubleValue)</technical_language>

Target:
private static boolean checkDecimal(Number number, BigDecimal min, BigDecimal max) { BigDecimal bigDecimal = null; if (number instanceof Integer || number instanceof Long) { bigDecimal = new BigDecimal(number.doubleValue()); } else if (number instanceof Float || number instanceof Double) { double doubleValue = number.doubleValue(); if (!Double.isNaN(doubleValue) && !Double.isInfinite(doubleValue)) { bigDecimal = new BigDecimal(doubleValue); } else { return false; } } else if (number instanceof BigInteger) { bigDecimal = new BigDecimal((BigInteger) number); } else if (number instanceof BigDecimal) { bigDecimal = (BigDecimal) number; } else { double doubleValue = number.doubleValue(); if (!Double.isNaN(doubleValue) && !Double.isInfinite(doubleValue)) { bigDecimal = new BigDecimal(doubleValue); } else { return false; } } { return max.compareTo(bigDecimal) >= 0 && min.compareTo(bigDecimal) <= 0; } }
Source:
<code><START> private boolean isTenantRowCell(Cell cell) { <END> ImmutableBytesWritable key = new ImmutableBytesWritable(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()); return key.get()[key.getOffset()] != QueryConstants.SEPARATOR_BYTE; }</code><technical_language>related this changes, wondering if need construct ImmutableBytesWritable object. this method impl reduced to: return cell.getRowArray()[cell.getRowOffset()] != QueryConstants.SEPARATOR_BYTE;</technical_language>

Target:
private boolean isTenantRowCell(Cell cell) { return cell.getRowArray()[cell.getRowOffset()] != QueryConstants.SEPARATOR_BYTE; }
Source:
<code>public void closeAndRecycleState() { prepareClose(true); <START> close(true, true); <END> log.info("Closed clean and recycled state"); }</code><technical_language>nit: suggest a separate recycle() function piggy-backing close additional flag, clean is true, i.e. 1) write checkpoints, 2) call stateMgr.recycle(), 3) transit CLOSED if is in CREATED / RUNNING do nothing. some duplicated lines is a bit straight-forward</technical_language>

Target:
public void closeAndRecycleState() { prepareClose(true); if (state() == State.CREATED || state() == State.RUNNING) { stateMgr.checkpoint(Collections.emptyMap()); offsetSnapshotSinceLastCommit = new HashMap<>(stateMgr.changelogOffsets()); stateMgr.recycle(); } else { throw new IllegalStateException("Illegal state " + state() + " while closing standby task " + id); } closeTaskSensor.record(); transitionTo(State.CLOSED); log.info("Closed clean and recycled state"); }
Source:
<code>protected String getProtocol(HttpRequestAttributes attributes) { String protocol = attributes.getScheme(); if (protocol == null) { <START> String uri = attributes.getRequestUri(); <END> Matcher m = Pattern.compile("^(http|https|.+)://.*$").matcher(uri); if (m.matches()) { protocol = m.group(1); } else { protocol = "http"; } } return protocol; }</code><technical_language>Is this block needed? a workaround</technical_language>

Target:
protected String getProtocol(HttpRequestAttributes attributes) { String protocol = attributes.getScheme(); return protocol; }
Source:
<code>public Void execute(Context context) { RegistryContext registryContext = (RegistryContext) context; DMNContext dmnContext = registryContext .computeIfAbsent(DMNContext.class, <START> clazz -> DMNFactory.newContext()); <END> dmnContext.set(name, value); return null; }</code><technical_language>want create a DMNContext DMNRuntime instead</technical_language>

Target:
public Void execute(Context context) { RegistryContext registryContext = (RegistryContext) context; DMNContext dmnContext = registryContext .computeIfAbsent(DMNContext.class, clazz -> { DMNRuntime dmnRuntime = registryContext.lookup(DMNRuntime.class); return dmnRuntime != null ? dmnRuntime.newContext() : DMNFactory.newContext(); }); dmnContext.set(name, value); return null; }
Source:
<code>public void testDataModelAttributeSerializable() { try { <START> String filename = "DynamicDataModelAttribute.tmp"; <END> IDataModelAttribute dataModelAttribute = new DynamicDataModelAttribute(DataModelConstants.TYPE_NONE); writeObjectToFile(dataModelAttribute, filename); Object readObject = readObjectFromFile(filename); IOUtility.deleteFile(filename); assertTrue(readObject instanceof IDataModelAttribute); assertEquals(((IDataModelAttribute) readObject).getType(), DataModelConstants.TYPE_NONE); } catch (Throwable t) { fail(t.toString()); } }</code><technical_language>work temp files, please java.io.File API. function: File.createTempFile(prefix, suffix) work File tmpFile instead of String filename</technical_language>

Target:
public void testDataModelAttributeSerializable() { try { File tmpFile = IOUtility.createTempFile("DynamicDataModelAttribute", "tmp", null); IDataModelAttribute dataModelAttribute = new DynamicDataModelAttribute(DataModelConstants.TYPE_NONE); writeObjectToFile(dataModelAttribute, tmpFile); Object readObject = readObjectFromFile(tmpFile); tmpFile.delete(); assertTrue(readObject instanceof IDataModelAttribute); assertEquals(((IDataModelAttribute) readObject).getType(), DataModelConstants.TYPE_NONE); } catch (Throwable t) { fail(t.toString()); } }
Source:
<code><START> public TreasureChestItemIterator iterator(ItemType itemType) { <END> return new TreasureChestItemIterator(this, itemType); }</code><technical_language>Return type changed Iterator</technical_language>

Target:
public Iterator<Item> iterator(ItemType itemType) { return new TreasureChestItemIterator(this, itemType); }
Source:
<code>public Interval liftOver(final Interval interval, final double liftOverMinMatch) { if (interval.length() == 0) { throw new IllegalArgumentException("Zero-length interval cannot be lifted over. Interval: " + interval.getName()); } Chain chainHit = null; TargetIntersection targetIntersection = null; double minMatchSize = liftOverMinMatch * interval.length(); for (final Chain chain : chains.getOverlaps(interval)) { final TargetIntersection candidateIntersection = targetIntersection(chain, interval); if (candidateIntersection != null && candidateIntersection.intersectionLength >= minMatchSize) { if (chainHit != null) { return null; } chainHit = chain; targetIntersection = candidateIntersection; } else if (candidateIntersection != null) { <START> if (logFailedIntervals){ <END> LOG.info("Interval " + interval.getName() + " failed to match chain " + chain.id + " because intersection length " + candidateIntersection.intersectionLength + " < minMatchSize " + minMatchSize + " (" + (candidateIntersection.intersectionLength/(float)interval.length()) + " < " + liftOverMinMatch + ")"); } } } if (chainHit == null) { return null; } return createToInterval(interval.getName(), interval.isNegativeStrand(), targetIntersection); }</code><technical_language>I a single (warn) message emitted. like: "there intervals failing liftOver, logFailedIntervals is false. intervals failed, re-run logFailedIntervals=true."</technical_language>

Target:
public Interval liftOver(final Interval interval, final double liftOverMinMatch) { if (interval.length() == 0) { throw new IllegalArgumentException("Zero-length interval cannot be lifted over. Interval: " + interval.getName()); } Chain chainHit = null; TargetIntersection targetIntersection = null; double minMatchSize = liftOverMinMatch * interval.length(); boolean hasOverlapBelowThreshold = false; for (final Chain chain : chains.getOverlaps(interval)) { final TargetIntersection candidateIntersection = targetIntersection(chain, interval); if (candidateIntersection != null && candidateIntersection.intersectionLength >= minMatchSize) { if (chainHit != null) { return null; } chainHit = chain; targetIntersection = candidateIntersection; } else if (candidateIntersection != null) { hasOverlapBelowThreshold = true; if (logFailedIntervals) { LOG.info("Interval " + interval.getName() + " failed to match chain " + chain.id + " because intersection length " + candidateIntersection.intersectionLength + " < minMatchSize " + minMatchSize + " (" + (candidateIntersection.intersectionLength/(float)interval.length()) + " < " + liftOverMinMatch + ")"); } } } if (chainHit == null) { if (hasOverlapBelowThreshold) { totalFailedIntervalsBelowThreshold++; } return null; } return createToInterval(interval.getName(), interval.isNegativeStrand(), targetIntersection); }
Source:
<code>public void importKerasConvnetTheanoConfigTest() throws Exception { ClassLoader classLoader = getClass().getClassLoader(); String configFilename = classLoader.getResource("keras/config/cnn_th_config.json").getPath(); importKerasConfigTest(configFilename); <START> } <END></code><technical_language><LINK_0> here. more robust</technical_language>

Target:
public void importKerasConvnetTheanoConfigTest() throws Exception { ClassPathResource resource = new ClassPathResource("keras/config/cnn_th_config.json", ModelConfigurationTest.class.getClassLoader()); String configFilename = resource.getFile().getAbsolutePath(); importKerasConfigTest(configFilename); }
Source:
<code>public static VdsStatic map(Host model, VdsStatic template) { VdsStatic entity = template != null ? template : new VdsStatic(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setVdsName(model.getName()); } if (model.isSetCluster() && model.getCluster().isSetId()) { entity.setVdsGroupId(GuidUtils.asGuid(model.getCluster().getId())); } if (model.isSetAddress()) { entity.setHostName(model.getAddress()); } if (model.isSetPort() && model.getPort() > 0) { entity.setPort(model.getPort()); } else { entity.setPort(DEFAULT_VDSM_PORT); } if (model.isSetSsh() && model.getSsh().isSetUser() && model.getSsh().getUser().isSetUserName()) { entity.setSshUsername(model.getSsh().getUser().getUserName()); } else { entity.setSshUsername(DEFAULT_ROOT_USERNAME); <START> } <END> if (model.isSetSsh() && model.getSsh().isSetPort() && model.getSsh().getPort() > 0) { entity.setSshPort(model.getSsh().getPort()); } else { entity.setSshPort(DEFAULT_SSH_PORT); } if (model.isSetSsh() && model.getSsh().isSetFingerprint()) { entity.setSshKeyFingerprint(model.getSsh().getFingerprint()); } if (model.isSetPowerManagement()) { entity = map(model.getPowerManagement(), entity); } if (model.isSetStorageManager()) { if (model.getStorageManager().getPriority() != null) { entity.setVdsSpmPriority(model.getStorageManager().getPriority()); } } if (model.isSetDisplay() && model.getDisplay().isSetAddress()) { entity.setConsoleAddress("".equals(model.getDisplay().getAddress()) ? null : model.getDisplay().getAddress()); } return entity; }</code><technical_language>supported</technical_language>

Target:
public static VdsStatic map(Host model, VdsStatic template) { VdsStatic entity = template != null ? template : new VdsStatic(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setVdsName(model.getName()); } if (model.isSetCluster() && model.getCluster().isSetId()) { entity.setVdsGroupId(GuidUtils.asGuid(model.getCluster().getId())); } if (model.isSetAddress()) { entity.setHostName(model.getAddress()); } if (model.isSetPort() && model.getPort() > 0) { entity.setPort(model.getPort()); } else { entity.setPort(DEFAULT_VDSM_PORT); } if (model.isSetSsh() && model.getSsh().isSetPort() && model.getSsh().getPort() > 0) { entity.setSshPort(model.getSsh().getPort()); } else { entity.setSshPort(DEFAULT_SSH_PORT); } if (model.isSetSsh() && model.getSsh().isSetFingerprint()) { entity.setSshKeyFingerprint(model.getSsh().getFingerprint()); } if (model.isSetPowerManagement()) { entity = map(model.getPowerManagement(), entity); } if (model.isSetStorageManager()) { if (model.getStorageManager().getPriority() != null) { entity.setVdsSpmPriority(model.getStorageManager().getPriority()); } } if (model.isSetDisplay() && model.getDisplay().isSetAddress()) { entity.setConsoleAddress("".equals(model.getDisplay().getAddress()) ? null : model.getDisplay().getAddress()); } return entity; }
Source:
<code>private void updateMemberDomainsFormat(StorageFormatType targetFormat) { Guid spId = getStoragePool().getId(); <START> StorageDomainStaticDAO sdStatDao = DbFacade.getInstance().getStorageDomainStaticDAO(); <END> List<storage_domain_static> domains = sdStatDao.getAllForStoragePool(spId); for (storage_domain_static domain : domains) { StorageDomainType sdType = domain.getstorage_domain_type(); log.info("Updating storage domain \"" + domain.getId() + "\" (type \"" + sdType + "\") to format \"" + targetFormat + "\""); if (sdType != StorageDomainType.Data && sdType != StorageDomainType.Master) { continue; } domain.setStorageFormat(targetFormat); sdStatDao.update(domain); } }</code><technical_language>able replace DbFacade.getInstance() getDbFacadeInstance()</technical_language>

Target:
private void updateMemberDomainsFormat(StorageFormatType targetFormat) { Guid spId = getStoragePool().getId(); StorageDomainStaticDAO sdStatDao = DbFacade.getInstance().getStorageDomainStaticDAO(); List<storage_domain_static> domains = sdStatDao.getAllForStoragePool(spId); for (storage_domain_static domain : domains) { StorageDomainType sdType = domain.getstorage_domain_type(); log.infoFormat("Updating storage domain {0} (type {1}) to format {2}", domain.getId(), sdType, targetFormat); if (sdType != StorageDomainType.Data && sdType != StorageDomainType.Master) { continue; } domain.setStorageFormat(targetFormat); sdStatDao.update(domain); } }
Source:
<code><START> void removeReplica(ReplicaId id) { <END> partitionToReplicaMap.remove(id.getPartitionId()); logger.info(id.getPartitionId() + " is removed from StatsManager"); }</code><technical_language>removeReplica return a success boolean addReplica</technical_language>

Target:
boolean removeReplica(ReplicaId id) { boolean success = partitionToReplicaMap.remove(id.getPartitionId()) != null; if (success) { logger.info(id.getPartitionId() + " is removed from StatsManager"); } else { logger.error("Failed to remove " + id.getPartitionId() + " because it doesn't exist in StatsManager"); } return success; }
Source:
<code><START> public final void close() throws Exception { <END> if (this.contextManager != null) { this.contextManager.close(); } operatorImplGraph.close(); }</code><technical_language>again, I wondering, is thinking making close() final, process() non-final</technical_language>

Target:
public void close() throws Exception { if (this.contextManager != null) { this.contextManager.close(); } operatorImplGraph.close(); }