auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testCheckNullCiphersAndMacs() throws Exception { final GitSSHService sshService = new GitSSHService(); final File certDir = createTempDirectory(); String idleTimeout = "10000"; sshService.setup(certDir, null, idleTimeout, "RSA", mock(ReceivePackFactory.class), mock(JGitFileSystemProvider.RepositoryResolverImpl.class), executorService, null, null); sshService.start(); assertTrue(sshService.isRunning()); List<String> ciphersReaded = sshService.getSshServer().getCipherFactoriesNames(); List<String> macsReaded = sshService.getSshServer().getMacFactoriesNames(); assertThat(ciphersReaded).hasSize(7); <START> assertThat(ciphersReaded.containsAll(Arrays.asList("aes128-ctr", <END> "aes192-cbc", "aes192-ctr", "aes256-cbc", "aes256-ctr", "arcfour128", "arcfour256"))); assertThat(macsReaded).hasSize(6); assertThat(macsReaded.containsAll(Arrays.asList("HmacMD5", "HmacMD5", "HmacSHA1", "HmacSHA1", "HmacSHA256", "HmacSHA512"))); assertThat(sshService.getSshServer().getProperties().get(SshServer.IDLE_TIMEOUT)).isEqualTo(idleTimeout); sshService.stop(); assertFalse(sshService.isRunning()); }</code><technical_language>this test is fragile, iterate ciphers macs in a upgrade of library break test</technical_language>

Target:
public void testCheckNullCiphersAndMacs() throws Exception { final GitSSHService sshService = new GitSSHService(); final File certDir = createTempDirectory(); String idleTimeout = "10000"; sshService.setup(certDir, null, idleTimeout, "RSA", mock(ReceivePackFactory.class), mock(JGitFileSystemProvider.RepositoryResolverImpl.class), executorService, null, null); sshService.start(); assertTrue(sshService.isRunning()); List<String> ciphersReaded = sshService.getSshServer().getCipherFactoriesNames(); List<String> macsReaded = sshService.getSshServer().getMacFactoriesNames(); assertThat(ciphersReaded).hasSize(7); checkCiphersName(ciphersReaded); assertThat(macsReaded).hasSize(6); checkMacsName(macsReaded); assertThat(sshService.getSshServer().getProperties().get(SshServer.IDLE_TIMEOUT)).isEqualTo(idleTimeout); sshService.stop(); assertFalse(sshService.isRunning()); }
Source:
<code>public void testFallRiseFallObservingFallingEdge() { Latch latch = new Latch(true, Latch.EdgeType.FallingEdge); LatchTestObserver latchTestObserver = new LatchTestObserver(); latch.addObserver(latchTestObserver); latch.setValue(false); <START> assertEquals(latchTestObserver.getLastUpdateEdgeType(), Latch.EdgeType.FallingEdge); <END> latch.setValue(true); assertEquals(latchTestObserver.getLastUpdateEdgeType(), Latch.EdgeType.FallingEdge); latch.setValue(false); assertEquals(latchTestObserver.getNumTimesUpdated(), 2); }</code><technical_language>assert number of updates step (all tests)? Part of contract of latch is fires update edge happens; slightly worried complementary bugs cancel other out a logic inversion introduced tests pass</technical_language>

Target:
public void testFallRiseFallObservingFallingEdge() { Latch latch = new Latch(true, Latch.EdgeType.FallingEdge); latch.addObserver(latchTestObserver); verifyEdgeType(null); verifyTimesUpdateWasCalled(0); latch.setValue(false); verifyEdgeType(Latch.EdgeType.FallingEdge); verifyTimesUpdateWasCalled(1); latch.setValue(true); verifyEdgeType(Latch.EdgeType.FallingEdge); verifyTimesUpdateWasCalled(1); latch.setValue(false); verifyTimesUpdateWasCalled(2); }
Source:
<code>protected Document resolveParentReference(DocumentRef docRef) { if (docRef == null) { <START> throw new IllegalArgumentException("null docRref"); <END> } Object ref = docRef.reference(); if (ref == null) { throw new IllegalArgumentException("null reference"); } int type = docRef.type(); switch (type) { case DocumentRef.ID: return getSession().getDocumentByUUID((String) ref).getParent(); case DocumentRef.INSTANCE: return getSession().getDocumentByUUID(((DocumentModel) ref).getId()).getParent(); case DocumentRef.PATH: Document parentDoc = null; String docPath = (String) ref; if (!"/".equals(docPath)) { String parentPath = docPath.substring(0, docPath.lastIndexOf('/')); if ("".equals(parentPath)) { parentPath = "/"; } parentDoc = resolveReference(new PathRef(parentPath)); } return parentDoc; default: throw new IllegalArgumentException("Invalid type: " + type); } }</code><technical_language>suggestion throw new IllegalArgumentException("null docRef");</technical_language>

Target:
protected Document resolveParentReference(DocumentRef docRef) { if (docRef != null && docRef.type() == DocumentRef.PATH && docRef.reference() != null) { String docPath = (String) docRef.reference(); if ("/".equals(docPath)) { return null; } String parentPath = docPath.substring(0, docPath.lastIndexOf('/')); if (parentPath.isEmpty()) { parentPath = "/"; } return resolveReference(new PathRef(parentPath)); } return resolveReference(docRef).getParent(); }
Source:
<code>private void runPatchMetadataTests(EPerson asUser, int expectedStatus) throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Community").build(); <START> Collection col = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection").build(); <END> String token = getAuthToken(asUser.getEmail(), password); new MetadataPatchSuite().runWith(getClient(token), "/api/core/collections/" + col.getID(), expectedStatus); }</code><technical_language>Again, needs a context.restoreAuthSystemState();</technical_language>

Target:
private void runPatchMetadataTests(EPerson asUser, int expectedStatus) throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Community").build(); Collection col = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection").build(); context.restoreAuthSystemState(); String token = getAuthToken(asUser.getEmail(), password); new MetadataPatchSuite().runWith(getClient(token), "/api/core/collections/" + col.getID(), expectedStatus); }
Source:
<code>public List<PatchLineComment> byPatchSet(ReviewDb db, ChangeNotes notes, PatchSet.Id psId) throws OrmException { if (!migration.readComments()) { return db.patchComments().byPatchSet(psId).toList(); } List<PatchLineComment> comments = Lists.newArrayList(); comments.addAll(publishedByPatchSet(db, notes, psId)); Set<String> refNames = getRefNamesAllUsers(RefNames.REFS_USER); for (String refName : refNames) { <START> String suffix = Integer.toString(notes.getChangeId().get()); <END> if (!refName.endsWith(suffix)) { continue; } String[] parts = refName.split(RefNames.DRAFTS); if (parts.length != 2) { continue; } Account.Id account = Account.Id.fromRefPart(parts[0]); comments.addAll(draftByPatchSetAuthor(db, psId, account, notes)); } return comments; }</code><technical_language>This is practically identical above, factor out. a Predicate<String> Iterables.filter refNames</technical_language>

Target:
public List<PatchLineComment> byPatchSet(ReviewDb db, ChangeNotes notes, PatchSet.Id psId) throws OrmException { if (!migration.readComments()) { return db.patchComments().byPatchSet(psId).toList(); } List<PatchLineComment> comments = Lists.newArrayList(); comments.addAll(publishedByPatchSet(db, notes, psId)); Set<String> refNames = getRefNamesAllUsers(RefNames.REFS_USER); Iterable<String> filtered = Iterables.filter(refNames, new IsDraftRefForChange(notes.getChangeId())); for (String refName : filtered) { Account.Id account = Account.Id.fromRefPart(refName); comments.addAll(draftByPatchSetAuthor(db, psId, account, notes)); } return comments; }
Source:
<code><START> public void setModelFile(String modelFile) { <END> this.modelFile = modelFile; }}</code><technical_language>is problem: opening setModelFile world, issue: * call time. If is called registration, good. If called registration, this effect. implement this, implementation needs a more careful approach</technical_language>

Target:
public void setModelFile(String modelFile) { this.modelFile = modelFile; }
Source:
<code>public void initialConfigs() throws Exception { setApiConfigs(apiConfig); <START> initialise0OAuthApplication(); <END> }</code><technical_language>is method name "initialise0OAuthApplication", "0" is intended?? I is needed, simply "initializeOAuthApplication"</technical_language>

Target:
public void initialConfigs() throws Exception { setApiConfigs(apiConfig); initializeOAuthApplication(); }
Source:
<code>private void attemptAddRoutes() { Set<String> inputTransformerIds = InputTransformerIds.getTransformerIds(); synchronized (initState) { try { cdmServiceWaiter.waitFor(inputTransformerIds); } catch (InterruptedException e) { LOGGER.debug( <START> "Interrupted while waiting for input transformers. CDM route will not be started.", e); <END> Thread.currentThread().interrupt(); return; } if (!initState.isInputTransformersReady()) { LOGGER.warn("Not all input transformers were found, starting up CDM route anyways"); } if (!initState.isConfigDeleted()) { LOGGER.trace( "Attempting to add routes for content directory monitor watching {}", monitoredDirectory); try { RouteBuilder routeBuilder = createRouteBuilder(); verifyCamelComponentIsAvailable("content"); verifyCamelComponentIsAvailable("catalog"); camelContext.addRoutes(routeBuilder); initState.setRoutesStarted(true); setRouteCollection(routeBuilder); } catch (Exception e) { LOGGER.info("Unable to configure Camel route.", e); INGEST_LOGGER.warn("Unable to configure Camel route.", e); } finally { if (LOGGER.isDebugEnabled()) { dumpCamelContext("after attemptAddRoutes()"); } } } else { LOGGER.warn( "Config was deleted while waiting for input transformers, camel routes won't be started"); } } }</code><technical_language>this logged higher debug? Is else is logged of interrupt? CDM configuration save successfully this failed</technical_language>

Target:
private void attemptAddRoutes() { try { waitForInputTransformers(); } catch (InterruptedException e) { LOGGER.warn( "Interrupted while waiting for InputTransformers, CDM route will not be started, but the configuration may still exist. The configuration should be deleted and remade or the system should be restarted."); Thread.currentThread().interrupt(); return; } LOGGER.trace( "Attempting to add routes for content directory monitor watching {}", monitoredDirectory); try { routeBuilder = createRouteBuilder(); verifyCamelComponentIsAvailable("content"); verifyCamelComponentIsAvailable("catalog"); camelContext.addRoutes(routeBuilder); } catch (Exception e) { LOGGER.warn( "Unable to configure Camel route. Resources will not be ingested. CDM configuration may still exist and should be deleted and remade or the system should be restarted.", e); } finally { if (LOGGER.isDebugEnabled()) { dumpCamelContext("after attemptAddRoutes()"); } } }
Source:
<code>protected void migrateCommentsFromPropertyToSecured(CoreSession session, CommentManager commentManager, IdRef commentIdRef) { DocumentModel commentDocModel = session.getDocument(commentIdRef); String parentId = (String) commentDocModel.getPropertyValue(COMMENT_PARENT_ID); if (StringUtils.isEmpty(parentId)) { log.warn( "The comment document model with IdRef: cannot be migrated, because his 'comment:parentId' is not defined", commentIdRef); return; } DocumentRef parentDocRef = new IdRef(parentId); if (!session.exists(parentDocRef)) { log.warn( <START> "The comment document model with IdRef: cannot be migrated, because his parent: cannot be found", <END> commentIdRef, parentId); return; } DocumentModel parentDocModel = session.getDocument(parentDocRef); DocumentRef destination = new PathRef(commentManager.getLocationOfCommentCreation(session, parentDocModel)); session.move(commentIdRef, destination, null); commentDocModel.putContextData(DISABLE_NOTIFICATION_SERVICE, TRUE); ACP acp = session.getACP(commentIdRef); acp.removeACL(LOCAL_ACL); session.setACP(commentIdRef, acp, true); session.saveDocument(commentDocModel); session.save(); }</code><technical_language>**its** parent. is for humans</technical_language>

Target:
protected void migrateCommentsFromPropertyToSecured(CoreSession session, CommentManager commentManager, IdRef commentIdRef) { DocumentModel commentDocModel = session.getDocument(commentIdRef); String parentId = (String) commentDocModel.getPropertyValue(COMMENT_PARENT_ID); if (StringUtils.isEmpty(parentId)) { log.warn( "The comment document model with IdRef: cannot be migrated, because its 'comment:parentId' is not defined", commentIdRef); return; } DocumentRef parentDocRef = new IdRef(parentId); if (!session.exists(parentDocRef)) { log.warn( "The comment document model with IdRef: cannot be migrated, because its parent: cannot be found", commentIdRef, parentId); return; } DocumentModel parentDocModel = session.getDocument(parentDocRef); DocumentRef destination = new PathRef(commentManager.getLocationOfCommentCreation(session, parentDocModel)); session.move(commentIdRef, destination, null); commentDocModel.putContextData(DISABLE_NOTIFICATION_SERVICE, TRUE); ACP acp = session.getACP(commentIdRef); acp.removeACL(LOCAL_ACL); session.setACP(commentIdRef, acp, true); session.saveDocument(commentDocModel); session.save(); }
Source:
<code>protected Values compute() { final Values values = this.execContext.getValues(); final Processor<In, Out> process = this.node.processor; final MetricRegistry registry = this.node.metricRegistry; final String name = String.format("%s.compute(): %s", ProcessorGraphNode.class.getName(), process.getClass()); Timer.Context timerContext = registry.timer(name).time(); try { In inputParameter = ProcessorUtils.populateInputParameter(process, values); Out output; try { <START> LOGGER.debug("Executing process: " + process); <END> output = process.execute(inputParameter, this.execContext.getContext()); LOGGER.debug("Succeeded in executing process: " + process); } catch (Exception e) { if (this.execContext.getContext().isCanceled()) { throw new CancellationException(); } else { LOGGER.error("Error while executing process: " + process, e); throw ExceptionUtils.getRuntimeException(e); } } if (output != null) { ProcessorUtils.writeProcessorOutputToValues(output, process, values); } } finally { this.execContext.finished(this.node); final long processorTime = TimeUnit.MILLISECONDS.convert( timerContext.stop(), TimeUnit.NANOSECONDS); LOGGER.info("Time taken to run processor: '{}' was ms", process.getClass(), processorTime); } if (this.execContext.getContext().isCanceled()) { throw new CancellationException(); } executeDependencyProcessors(); return values; }</code><technical_language>Please placeholders instead of concatenation</technical_language>

Target:
protected Values compute() { final Values values = this.execContext.getValues(); final Processor<In, Out> process = this.node.processor; final MetricRegistry registry = this.node.metricRegistry; final String name = String.format("%s.compute(): %s", ProcessorGraphNode.class.getName(), process.getClass()); Timer.Context timerContext = registry.timer(name).time(); try { In inputParameter = ProcessorUtils.populateInputParameter(process, values); Out output; try { LOGGER.debug("Executing process: {}", process); output = process.execute(inputParameter, this.execContext.getContext()); LOGGER.debug("Succeeded in executing process: {}", process); } catch (Exception e) { if (this.execContext.getContext().isCanceled()) { throw new CancellationException(); } else { LOGGER.error("Error while executing process: " + process, e); throw ExceptionUtils.getRuntimeException(e); } } if (output != null) { ProcessorUtils.writeProcessorOutputToValues(output, process, values); } } finally { this.execContext.finished(this.node); final long processorTime = TimeUnit.MILLISECONDS.convert( timerContext.stop(), TimeUnit.NANOSECONDS); LOGGER.info("Time taken to run processor: '{}' was ms", process.getClass(), processorTime); } if (this.execContext.getContext().isCanceled()) { throw new CancellationException(); } executeDependencyProcessors(); return values; }
Source:
<code>public void testClientInvalidHeader() throws Exception { start(new EmptyHttpServlet()); Session session = newClient(new Session.Listener.Adapter()); <START> HttpFields.Mutable requestFields = HttpFields.build() <END> .put(":custom", "special"); MetaData.Request metaData = newRequest("GET", requestFields); HeadersFrame request = new HeadersFrame(metaData, null, true); FuturePromise<Stream> promise = new FuturePromise<>(); session.newStream(request, promise, new Stream.Listener.Adapter()); ExecutionException x = assertThrows(ExecutionException.class, () -> promise.get(5, TimeUnit.SECONDS)); assertThat(x.getCause(), instanceOf(HpackException.StreamException.class)); }</code><technical_language>Remove .Mutable</technical_language>

Target:
public void testClientInvalidHeader() throws Exception { start(new EmptyHttpServlet()); Session session = newClient(new Session.Listener.Adapter()); HttpFields requestFields = HttpFields.build() .put(":custom", "special"); MetaData.Request metaData = newRequest("GET", requestFields); HeadersFrame request = new HeadersFrame(metaData, null, true); FuturePromise<Stream> promise = new FuturePromise<>(); session.newStream(request, promise, new Stream.Listener.Adapter()); ExecutionException x = assertThrows(ExecutionException.class, () -> promise.get(5, TimeUnit.SECONDS)); assertThat(x.getCause(), instanceOf(HpackException.StreamException.class)); }
Source:
<code>public void setHtmlFilenameFormat(String htmlFilenameFormat) { <START> this.htmlFilenameFormat = htmlFilenameFormat; <END> }</code><technical_language>check provided (if null) contains "$1"</technical_language>

Target:
public void setHtmlFilenameFormat(String htmlFilenameFormat) { if (htmlFilenameFormat != null && htmlFilenameFormat.indexOf("$1") == -1) { throw new IllegalArgumentException("Illegal file name format pattern. Use \"$1\" to indicate name."); } this.htmlFilenameFormat = htmlFilenameFormat; }
Source:
<code>public final Connection createConnection() throws AmqpException { <START> synchronized (this.connectionMonitor) { <END> if (this.cacheMode == CacheMode.CHANNEL) { if (this.connection == null) { this.connection = new ChannelCachingConnectionProxy(super.createBareConnection()); getConnectionListener().onCreate(connection); } return this.connection; } else if (this.cacheMode == CacheMode.CONNECTION) { ChannelCachingConnectionProxy connection = null; while (connection == null) { connection = this.idleConnections.poll(); if (connection != null) { if (!connection.isOpen()) { if (logger.isDebugEnabled()) { logger.debug("Removing closed connection '" + connection + "'"); } connection.notifyCloseIfNecessary(); this.openConnections.remove(connection); connection = null; } } if (connection == null) { connection = new ChannelCachingConnectionProxy(super.createBareConnection()); getConnectionListener().onCreate(connection); if (logger.isDebugEnabled()) { logger.debug("Adding new connection '" + connection + "'"); } this.openConnections.add(connection); } else { if (logger.isDebugEnabled()) { logger.debug("Obtained connection '" + connection + "' from cache"); } } return connection; } } } return null; }</code><technical_language>do synchronize entire method body, independently of cacheMode, in createBareChannel CacheMode.CHANNEL block</technical_language>

Target:
public final Connection createConnection() throws AmqpException { synchronized (this.connectionMonitor) { if (this.cacheMode == CacheMode.CHANNEL) { if (this.connection == null) { this.connection = new ChannelCachingConnectionProxy(super.createBareConnection()); getConnectionListener().onCreate(connection); } return this.connection; } else if (this.cacheMode == CacheMode.CONNECTION) { ChannelCachingConnectionProxy connection = null; while (connection == null && !this.idleConnections.isEmpty()) { connection = this.idleConnections.poll(); if (connection != null) { if (!connection.isOpen()) { if (logger.isDebugEnabled()) { logger.debug("Removing closed connection '" + connection + "'"); } connection.notifyCloseIfNecessary(); this.openConnections.remove(connection); connection = null; } } } if (connection == null) { connection = new ChannelCachingConnectionProxy(super.createBareConnection()); getConnectionListener().onCreate(connection); if (logger.isDebugEnabled()) { logger.debug("Adding new connection '" + connection + "'"); } this.openConnections.add(connection); } else { if (logger.isDebugEnabled()) { logger.debug("Obtained connection '" + connection + "' from cache"); } } return connection; } } return null; }
Source:
<code>protected void updateClusters(Guid storagePoolId) { INewAsyncCallback callback = new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { ImportExportRepoImageBaseModel model = (ImportExportRepoImageBaseModel) target; List<VDSGroup> clusters = (List<VDSGroup>) returnValue; <START> model.getCluster().setItems(clusters); <END> model.getCluster().setIsEmpty(clusters.isEmpty()); model.updateControlsAvailability(); stopProgress(); } }; startProgress(null); if (storagePoolId != null) { AsyncDataProvider.getClusterList(new AsyncQuery(this, callback), storagePoolId); } else { AsyncDataProvider.getClusterList(new AsyncQuery(this, callback)); } }</code><technical_language>I filter out clusters undefined architecture, in order prevent user making mistakes receive a failure in canDoAction() of command later</technical_language>

Target:
protected void updateClusters(Guid storagePoolId) { INewAsyncCallback callback = new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { ImportExportRepoImageBaseModel model = (ImportExportRepoImageBaseModel) target; List<VDSGroup> clusters = AsyncDataProvider.filterClustersWithoutArchitecture((List<VDSGroup>) returnValue); model.getCluster().setItems(clusters); model.getCluster().setIsEmpty(clusters.isEmpty()); model.updateControlsAvailability(); stopProgress(); } }; startProgress(null); if (storagePoolId != null) { AsyncDataProvider.getClusterList(new AsyncQuery(this, callback), storagePoolId); } else { AsyncDataProvider.getClusterList(new AsyncQuery(this, callback)); } }
Source:
<code>public void before() { MessageSourceService as = mock(MessageSourceService.class); <START> PowerMockito.stub(PowerMockito.method(Context.class, "getMessageSourceService")).toReturn(as); <END> }</code><technical_language>able plain Mockito here: Mockito.when(Context.getMessageSourceService()).thenReturn(as);</technical_language>

Target:
public void before() { MessageSourceService as = mock(MessageSourceService.class); mockStatic(Context.class); when(Context.getMessageSourceService()).thenReturn(as); }
Source:
<code>public ContainerManager(ZKDatabase zkDb, RequestProcessor requestProcessor, int checkIntervalMs, int maxPerMinute) { this(zkDb, requestProcessor, checkIntervalMs, maxPerMinute, Integer.MAX_VALUE); <START> } <END></code><technical_language>Long.MAX_VALUE</technical_language>

Target:
public ContainerManager(ZKDatabase zkDb, RequestProcessor requestProcessor, int checkIntervalMs, int maxPerMinute) { this(zkDb, requestProcessor, checkIntervalMs, maxPerMinute, Long.MAX_VALUE); }
Source:
<code>private ArrayAdapter<String> createArrayAdapter(Context context) { ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item); arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); arrayAdapter.add(context.getString(R.string.tnf_mime_media)); arrayAdapter.add(context.getString(R.string.tnf_well_known_http)); arrayAdapter.add(context.getString(R.string.tnf_well_known_https)); arrayAdapter.add(context.getString(R.string.tnf_well_known_sms)); arrayAdapter.add(context.getString(R.string.tnf_well_known_tel)); arrayAdapter.add(context.getString(R.string.tnf_well_known_mailto)); arrayAdapter.add(context.getString(R.string.tnf_external_type)); <START> arrayAdapter.add(context.getString(R.string.tnf_empty)); <END> return arrayAdapter; }</code><technical_language>Currently is consistent fill array adapter selected item in codebase. I thought I created a Jira ticket for find it. I :smile_cat: Please a at: <LINK_1> <LINK_0> If of suited, please [ArrayAdapter.addAll(T...)](<LINK_2></technical_language>

Target:
private ArrayAdapter<String> createArrayAdapter(Context context) { ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item); arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); arrayAdapter.addAll( context.getString(R.string.tnf_mime_media), context.getString(R.string.tnf_well_known_http), context.getString(R.string.tnf_well_known_https), context.getString(R.string.tnf_well_known_sms), context.getString(R.string.tnf_well_known_tel), context.getString(R.string.tnf_well_known_mailto), context.getString(R.string.tnf_external_type), context.getString(R.string.tnf_empty)); return arrayAdapter; }
Source:
<code>private Vector<String> suggestLibraries() { String projectDir = myBuilder.getContext().getProjectFileDirectory(); <START> Vector<String> libraries = new Vector<>(); <END> List<String> hxmls = HaxeHxmlDetectionStep.findHxmlFiles(projectDir); for(String hxml:hxmls) { try { List<HXMLData> dataList = HXMLData.load(projectDir, hxml); for(HXMLData data:dataList) { for(String lib:data.getLibraries()) { if(!libraries.contains(lib)) { libraries.add(lib); } } } } catch (HXMLData.HXMLDataException e) { } } return libraries; }</code><technical_language>difference Vector ArrayList is Vector is synchronized. In this method async code, easily switch ArrayList. other hand change result type HashSet<String>, skip check of added library. Set contains unique values</technical_language>

Target:
private Set<String> suggestLibraries() { String projectDir = myBuilder.getContext().getProjectFileDirectory(); Set<String> result = new HashSet<>(); List<String> hxmls = HaxeHxmlDetectionStep.findHxmlFiles(projectDir); for(String hxml:hxmls) { try { List<HXMLData> dataList = HXMLData.load(projectDir, hxml); for(HXMLData data:dataList) { result.addAll(data.getLibraries()); } } catch (HXMLData.HXMLDataException e) { } } return result; }
Source:
<code><START> private String getOtherInfo(String resourceIdentifier, String param) { <END> return Constant.messages.getString( MESSAGE_PREFIX + resourceIdentifier + ".otherinfo", param); }</code><technical_language>static</technical_language>

Target:
private static String getOtherInfo(String resourceIdentifier, String param) { return Constant.messages.getString( MESSAGE_PREFIX + resourceIdentifier + ".otherinfo", param); }
Source:
<code>protected void finished(Description description) { try { <START> TestUtils.deleteTargetTestClassFolder(description); <END> } catch (Exception e) { } }</code><technical_language>a deleteQuietly function if this is frequently needed</technical_language>

Target:
protected void finished(Description description) { TestUtils.deleteTargetTestClassFolderQuietly(description); }
Source:
<code>public static Metric create(final List<MetricData> data, final String id, final MetricName name, final String type, final String unit) { <START> return new AutoValue_Metric(data, id, name, type, unit); <END> }</code><technical_language>Enforce immutable non-nullable lists. If this is a read-only object, users build send ARM in a request, avoid nullable collections (the typical tags field of object is a counter-example need send null, enforce immutability presence): java new AutoValue_Metric(data == null ? ImmutableList.of() : ImmutableList.copyOf(data), id, name, type, unit); Apply this pattern lists in new model classes</technical_language>

Target:
public static Metric create(final List<MetricData> data, final String id, final MetricName name, final String type, final String unit) { return new AutoValue_Metric(data == null ? ImmutableList.<MetricData> of() : ImmutableList.copyOf(data), id, name, type, unit); }
Source:
<code><START> public String getImageFilePath() { <END> return pathTextField.getText(); }</code><technical_language>this method need public</technical_language>

Target:
String getImageFilePath() { return pathTextField.getText(); }
Source:
<code>public void testHighlightReconciler() { IDocumentProvider dp = editor.getDocumentProvider(); IAnnotationModel annotationModel = dp.getAnnotationModel(editor.getEditorInput()); new DisplayHelper() { @Override protected boolean condition() { Iterator<Annotation> annotationIterator=annotationModel.getAnnotationIterator(); while (annotationIterator.hasNext()) { Annotation ann = annotationIterator.next(); if (ann.getType().indexOf(ANNOTATION_TYPE) > -1) { return true; } } return false; } }.waitForCondition(Display.getDefault().getActiveShell().getDisplay(), 2000); <START> List<Annotation> annotationList = new ArrayList<>(); <END> Iterator<Annotation> annotationIterator=annotationModel.getAnnotationIterator(); while (annotationIterator.hasNext()) { Annotation ann = annotationIterator.next(); if (ann.getType().indexOf(ANNOTATION_TYPE) > -1) { annotationList.add(ann); } } Assert.assertTrue("file does not have highlighting", annotationList.size() == 1); }</code><technical_language>Please extract this block in a method a Function<IAnnotationModel, Integer> reuse in DisplayHelper condition well</technical_language>

Target:
public void testHighlightReconciler() { IDocumentProvider dp = editor.getDocumentProvider(); IAnnotationModel am = dp.getAnnotationModel(editor.getEditorInput()); new DisplayHelper() { @Override protected boolean condition() { return getAnnotationsFromAnnotationModel(am).size() == 1; } }.waitForCondition(Display.getDefault().getActiveShell().getDisplay(), 2000); Assert.assertTrue("file does not have highlighting", getAnnotationsFromAnnotationModel(am).size() == 1); }
Source:
<code><START> public void testSendInstances() throws InterruptedException { <END> AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); processor.processMessage( new MsgCmdSendInstances()); Assert.assertEquals( 0, this.client.messagesForTheDm.size()); TestApplicationTemplate app = new TestApplicationTemplate(); processor.scopedInstance = app.getTomcatVm(); processor.processMessage( new MsgCmdSendInstances()); Assert.assertEquals( InstanceHelpers.buildHierarchicalList( app.getTomcatVm()).size(), this.client.messagesForTheDm.size()); for( int i=1; i<3; i++ ) Assert.assertEquals( "Index " + i, MsgNotifInstanceChanged.class, this.client.messagesForTheDm.get( i ).getClass()); }</code><technical_language>No, this method throw interrupted exceptions</technical_language>

Target:
public void testSendInstances() { AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); processor.processMessage( new MsgCmdSendInstances()); Assert.assertEquals( 0, this.client.messagesForTheDm.size()); TestApplicationTemplate app = new TestApplicationTemplate(); processor.scopedInstance = app.getTomcatVm(); processor.processMessage( new MsgCmdSendInstances()); Assert.assertEquals( InstanceHelpers.buildHierarchicalList( app.getTomcatVm()).size(), this.client.messagesForTheDm.size()); for( int i=1; i<3; i++ ) Assert.assertEquals( "Index " + i, MsgNotifInstanceChanged.class, this.client.messagesForTheDm.get( i ).getClass()); }
Source:
<code>private List<CertificateDTO> listKeyStore(String portName) throws CertificateManagerException { ListKeyStoresRequestMessageType message = new ListKeyStoresRequestMessageType(); <START> ConfigAssertionType assertion = buildConfigAssertion(getKeyStorePassKey()); <END> message.setConfigAssertion(assertion); ListKeyStoresResponseMessageType response; try { response = (ListKeyStoresResponseMessageType) getClient().invokePort(EntityConfigAdminPortType.class, portName, message); } catch (Exception e) { throw new CertificateManagerException("Error while fetching certificates.", e); } return soapResponseToDTO(response.getCertList()); }</code><technical_language>need for password/hash for listKeystore/listTrustStore</technical_language>

Target:
private List<CertificateDTO> listKeyStore(String portName) throws CertificateManagerException { ListKeyStoresRequestMessageType message = new ListKeyStoresRequestMessageType(); ConfigAssertionType assertion = buildConfigAssertion(); message.setConfigAssertion(assertion); ListKeyStoresResponseMessageType response; try { response = (ListKeyStoresResponseMessageType) getClient().invokePort(EntityConfigAdminPortType.class, portName, message); } catch (Exception e) { throw new CertificateManagerException("Error while fetching certificates.", e); } return soapResponseToDTO(response.getCertList()); }
Source:
<code>private byte[] getKeepAlivePayload() { DatabaseVersion version; try { version = JMXUtils.getLocalMBeanProxy(JMXUtils.SPLICEMACHINE_VERSION, DatabaseVersion.class); <START> } catch (Exception e) { throw new RuntimeException(e); } <END> OlapMessage.KeepAlive message = OlapMessage.KeepAlive.newBuilder().setTime(System.currentTimeMillis()) .setMajor(version.getMajorVersionNumber()) .setMinor(version.getMinorVersionNumber()) .setPatch(version.getPatchVersionNumber()) .setSprint(version.getSprintVersionNumber()) .setImplementation(version.getImplementationVersion()).build(); return message.toByteArray(); }</code><technical_language>Is needed wrap exception in a RuntimeException, remove catch</technical_language>

Target:
private byte[] getKeepAlivePayload() { OlapMessage.KeepAlive message = OlapMessage.KeepAlive.newBuilder(keepAlivePrototype) .setTime(System.currentTimeMillis()) .build(); return message.toByteArray(); }
Source:
<code>protected boolean isExpenditureSubFund(String subFundGroupCode) { <START> if(StringUtils.isNotBlank(subFundGroupCode)){ <END> Collection<String> acceptedValuesForExpenditureSubFundCodes = parameterService.getParameterValuesAsString(KFSConstants.OptionalModuleNamespaces.CONTRACTS_AND_GRANTS, CUKFSParameterKeyConstants.ALL_COMPONENTS, CUKFSParameterKeyConstants.ContractsGrantsParameterConstants.CG_INVOICING_EXCLUDE_EXPENSES_SUB_FUNDS); if(CollectionUtils.isNotEmpty(acceptedValuesForExpenditureSubFundCodes)){ return acceptedValuesForExpenditureSubFundCodes.stream().filter(acceptedValue -> acceptedValue.equalsIgnoreCase(subFundGroupCode)).count() > 0; } } return false; }</code><technical_language>Missing whitespace of outermost parentheses</technical_language>

Target:
protected boolean isExpenditureSubFund(String subFundGroupCode) { if (StringUtils.isNotBlank(subFundGroupCode)) { Collection<String> acceptedValuesForExpenditureSubFundCodes = parameterService.getParameterValuesAsString(KFSConstants.OptionalModuleNamespaces.ACCOUNTS_RECEIVABLE, CUKFSParameterKeyConstants.ALL_COMPONENTS, CuArParameterKeyConstants.CG_INVOICING_EXCLUDE_EXPENSES_SUB_FUNDS); if (CollectionUtils.isNotEmpty(acceptedValuesForExpenditureSubFundCodes)) { return acceptedValuesForExpenditureSubFundCodes.stream().anyMatch(subFundGroupCode::equalsIgnoreCase); } } return false; }
Source:
<code>public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); if (getView() != null) { for (Entry<Class<? extends Message>, ManualRequestEditorDialog> dialogue : dialogues.entrySet()) { extensionHook.getHookMenu().addToolsMenuItem(dialogue.getValue().getMenuItem()); <START> extensionHook.addOptionsChangedListener(httpSendEditorDialog); <END> } extensionHook.addSessionListener(this); } }</code><technical_language>This done loop, addSessionListener</technical_language>

Target:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); if (getView() != null) { for (Entry<Class<? extends Message>, ManualRequestEditorDialog> dialogue : dialogues.entrySet()) { extensionHook.getHookMenu().addToolsMenuItem(dialogue.getValue().getMenuItem()); } extensionHook.addSessionListener(this); extensionHook.addOptionsChangedListener(httpSendEditorDialog); } }
Source:
<code>private final void importRows(List<T> rows) { final Map<String, T> rowsToImport = rows.stream().filter(getRowFilter()).collect(Collectors.toMap(getRowIdMapper(), row -> row)); final Map<String, C> existingComponents = loadComponents(rowsToImport.keySet()).stream().collect(Collectors.toMap(getComponentIdMapper(), c -> c)); final Collection<C> componentsToAttach = newHashSet(); <START> for (Entry<String, T> rowToImport : rowsToImport.entrySet()) { <END> final String componentId = rowToImport.getKey(); C component = existingComponents.get(componentId); final T row = rowToImport.getValue(); if (component == null) { component = getOrCreate(componentId, componentsToAttach); } else if (skipCurrentRow(row, component)) { getLogger().warn("Not importing component '{}|{}' with effective time '{}'; it should have been filtered from the input file.", row.getClass().getSimpleName(), getRowIdMapper().apply(row), EffectiveTimes.format(row.getEffectiveTime(), DateFormats.SHORT)); continue; } applyRow(component, row, componentsToAttach); } attach(componentsToAttach); }</code><technical_language>super important: iterate ID set here, retrieve RF2 row component a {rowsToImport,existingComponents}.get(componentId) call for symmetry</technical_language>

Target:
private final void importRows(List<T> rows) { final Map<String, T> rowsToImport = rows.stream().filter(getRowFilter()).collect(Collectors.toMap(getRowIdMapper(), row -> row)); final Map<String, C> existingComponents = loadComponents(rowsToImport.keySet()).stream().collect(Collectors.toMap(getComponentIdMapper(), c -> c)); final Collection<C> componentsToAttach = newHashSet(); for (final String componentId : rowsToImport.keySet()) { final T row = rowsToImport.get(componentId); C component = existingComponents.get(componentId); if (component == null) { component = getOrCreateNew(componentId, componentsToAttach); } else if (skipCurrentRow(row, component)) { getLogger().warn("Not importing component '{}|{}' with effective time '{}'; it should have been filtered from the input file.", row.getClass().getSimpleName(), getRowIdMapper().apply(row), EffectiveTimes.format(row.getEffectiveTime(), DateFormats.SHORT)); continue; } applyRow(component, row, componentsToAttach); } attach(componentsToAttach); }
Source:
<code>static HashMap<String, String> urlFormDecodeData(String parameters, String delimiter) { final HashMap<String, String> result = new HashMap<>(); if (!StringExtensions.isNullOrBlank(parameters)) { StringTokenizer parameterTokenizer = new StringTokenizer(parameters, delimiter); while (parameterTokenizer.hasMoreTokens()) { String pair = parameterTokenizer.nextToken(); String[] elements = pair.split("="); String value = null; String key = null; if (elements.length == 2) { try { key = StringExtensions.urlFormDecode(elements[0].trim()); value = StringExtensions.urlFormDecode(elements[1].trim()); } catch (UnsupportedEncodingException e) { Logger.i(TAG, ADALError.ENCODING_IS_NOT_SUPPORTED.getDescription(), e.getMessage(), null); } } else if (elements.length == 1) { try { key = StringExtensions.urlFormDecode(elements[0].trim()); value = ""; } catch (UnsupportedEncodingException e) { Logger.i(TAG, ADALError.ENCODING_IS_NOT_SUPPORTED.getDescription(), e.getMessage(), null); } } <START> if (!StringExtensions.isNullOrBlank(key)) { <END> result.put(key, value); } } } return result; }</code><technical_language>If UnsupportedEncodingException is thrown, this try put(null, null)? more sense skip values? I guess effect is same, right</technical_language>

Target:
static HashMap<String, String> urlFormDecodeData(String parameters, String delimiter) { final HashMap<String, String> result = new HashMap<>(); if (!StringExtensions.isNullOrBlank(parameters)) { StringTokenizer parameterTokenizer = new StringTokenizer(parameters, delimiter); while (parameterTokenizer.hasMoreTokens()) { String pair = parameterTokenizer.nextToken(); String[] elements = pair.split("="); String value = null; String key = null; if (elements.length == 2) { try { key = StringExtensions.urlFormDecode(elements[0].trim()); value = StringExtensions.urlFormDecode(elements[1].trim()); } catch (UnsupportedEncodingException e) { Logger.i(TAG, ADALError.ENCODING_IS_NOT_SUPPORTED.getDescription(), e.getMessage(), null); continue; } } else if (elements.length == 1) { try { key = StringExtensions.urlFormDecode(elements[0].trim()); value = ""; } catch (UnsupportedEncodingException e) { Logger.i(TAG, ADALError.ENCODING_IS_NOT_SUPPORTED.getDescription(), e.getMessage(), null); continue; } } if (!StringExtensions.isNullOrBlank(key)) { result.put(key, value); } } } return result; }
Source:
<code>public EhcacheClientEntity(EntityClientEndpoint<EhcacheEntityMessage, EhcacheEntityResponse> endpoint) { this.endpoint = endpoint; this.messageFactory = new LifeCycleMessageFactory(); endpoint.setDelegate(new EndpointDelegate() { @Override public void handleMessage(EntityResponse messageFromServer) { if (messageFromServer instanceof EhcacheEntityResponse) { fireResponseEvent((EhcacheEntityResponse) messageFromServer); } } @Override public byte[] createExtendedReconnectData() { <START> for (ReconnectListener reconnectListener : reconnectListeners) { <END> reconnectListener.onHandleReconnect(reconnectData); } return reconnectDataCodec.encode(reconnectData); } @Override public void didDisconnectUnexpectedly() { fireDisconnectionEvent(); } }); }</code><technical_language>Here, iterate version of list is a CopyOnWriteArrayList. Is want</technical_language>

Target:
public EhcacheClientEntity(EntityClientEndpoint<EhcacheEntityMessage, EhcacheEntityResponse> endpoint) { this.endpoint = endpoint; this.messageFactory = new LifeCycleMessageFactory(); endpoint.setDelegate(new EndpointDelegate() { @Override public void handleMessage(EntityResponse messageFromServer) { if (messageFromServer instanceof EhcacheEntityResponse) { fireResponseEvent((EhcacheEntityResponse) messageFromServer); } } @Override public byte[] createExtendedReconnectData() { synchronized (lock) { ReconnectMessage reconnectMessage = new ReconnectMessage(clientId, caches); for (ReconnectListener reconnectListener : reconnectListeners) { reconnectListener.onHandleReconnect(reconnectMessage); } return reconnectMessageCodec.encode(reconnectMessage); } } @Override public void didDisconnectUnexpectedly() { fireDisconnectionEvent(); } }); }
Source:
<code>public List<String> getSupportedProducts() { <START> return Arrays.asList(SupportedProduct.ALL); <END> }</code><technical_language>fixed. Component support products if supports DI engine</technical_language>

Target:
public List<String> getSupportedProducts() { return Arrays.asList(SupportedProduct.DI); }
Source:
<code>public void setContent( Metadata d, boolean readOnly ) { this.data = d; tags.clear(); this.readOnly = readOnly; loadData(); if (readOnly) { addTags.setVisible( false ); } else { <START> addTags.addClickHandler( new ClickHandler() { <END> @Override public void onClick( ClickEvent clickEvent ) { String text = newTags.getText(); if (text != null) { String[] tags = text.split( " " ); for (String tag : tags) { addTag( tag ); } newTags.setText( "" ); } } } ); } }</code><technical_language>@UiHandler used. matter if is a click event listener if addTags is hidden. do addTags.setVisible( !readOnly );</technical_language>

Target:
public void setContent( Metadata d, boolean readOnly ) { this.data = d; this.readOnly = readOnly; view.setReadOnly(readOnly); loadData(); }
Source:
<code>private long producerId(long producerTimestamp, int producerPid) { long longPid = producerPid; <START> longPid = longPid << 48; <END> return longPid ^ producerTimestamp; }</code><technical_language>this line folded in line above. optimizer happily do for</technical_language>

Target:
private long producerId(long producerTimestamp, int producerPid) { long longPid = (long) producerPid << 48; return longPid ^ producerTimestamp; }
Source:
<code>public void testExplicitPropertyMappings() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() <START> .put("hive.parquet.writer.block-size", "256MB") <END> .put("hive.parquet.writer.page-size", "2MB") .build(); ParquetFileWriterConfig expected = new ParquetFileWriterConfig() .setBlockSize(new DataSize(256, MEGABYTE)) .setPageSize(new DataSize(2, MEGABYTE)); assertFullMapping(properties, expected); }</code><technical_language>tests more resilient future changes, please pick values actual defaults. For example 234MB 11MB</technical_language>

Target:
public void testExplicitPropertyMappings() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("hive.parquet.writer.block-size", "234MB") .put("hive.parquet.writer.page-size", "11MB") .build(); ParquetFileWriterConfig expected = new ParquetFileWriterConfig() .setBlockSize(new DataSize(234, MEGABYTE)) .setPageSize(new DataSize(11, MEGABYTE)); assertFullMapping(properties, expected); }
Source:
<code>public void run(String[] args) throws Exception { try { options = parser.parse(args); } catch (OptionException e) { Utils.exitWithError(log, e.getMessage() + ". Use --help to get overview of the help options."); <START> System.exit(1); <END> } if (options.has(help)) { parser.printHelpOn(System.out); System.exit(0); } if (options.has(propertiesFile)) { File f = Utils.newFile(options.valueOf(propertiesFile)); aws.setProperites(f); } if (options.has(scale)) { int count = options.valueOf(scale); aws.scaleInstanceCountTo(count); System.exit(0); } if (options.has(makeLB)) { String name = options.valueOf(makeLB); aws.createLoadBalancer(name); System.exit(0); } if (options.has(agentsToLB)) { String name = options.valueOf(agentsToLB); aws.addAgentsToLoadBalancer(name); System.exit(0); } }</code><technical_language>need add system.exit, exitWitherror that</technical_language>

Target:
public void run(String[] args) throws Exception { try { options = parser.parse(args); } catch (OptionException e) { exitWithError(log, e.getMessage() + ". Use --help to get overview of the help options."); } if (options.has(help)) { parser.printHelpOn(System.out); System.exit(0); } if (options.has(propertiesFile)) { File f = newFile(options.valueOf(propertiesFile)); aws.setProperties(f); } if (options.has(scale)) { int count = options.valueOf(scale); aws.scaleInstanceCountTo(count); System.exit(0); } if (options.has(makeLB)) { String name = options.valueOf(makeLB); aws.createLoadBalancer(name); System.exit(0); } if (options.has(agentsToLB)) { String name = options.valueOf(agentsToLB); aws.addAgentsToLoadBalancer(name); System.exit(0); } }