auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void visitSuper(Node node, Node parent) { Node exprRoot = node; for (; exprRoot.getParent().isGetElem() || exprRoot.getParent().isGetProp(); exprRoot = exprRoot.getParent()) { if (exprRoot.getParent().getFirstChild() != exprRoot) { return; } } Node enclosingMemberDef = NodeUtil.getEnclosingNode( exprRoot, new Predicate<Node>() { @Override public boolean apply(Node n) { switch (n.getToken()) { case MEMBER_FUNCTION_DEF: case GETTER_DEF: case SETTER_DEF: case COMPUTED_PROP: return true; default: return false; } } }); <START> if (exprRoot.getParent().isNew()) { <END> compiler.report(JSError.make(node, INVALID_SUPER)); } else if (NodeUtil.isCallOrNewTarget(exprRoot) && (exprRoot.isSuper() || exprRoot.getFirstChild().isSuper())) { visitSuperCall(node, exprRoot, enclosingMemberDef); } else { visitSuperProperty(node, exprRoot, enclosingMemberDef); } }</code><technical_language>Please add code examples clearer of cases represent. e.g. if (exprRoot.getParent().isNew()) { // new super()</technical_language>

Target:
private void visitSuper(Node node, Node parent) { Preconditions.checkState(node.isSuper()); Node exprRoot = node; if (exprRoot.getParent().isGetElem() || exprRoot.getParent().isGetProp()) { exprRoot = exprRoot.getParent(); } Node enclosingMemberDef = NodeUtil.getEnclosingNode( exprRoot, new Predicate<Node>() { @Override public boolean apply(Node n) { switch (n.getToken()) { case MEMBER_FUNCTION_DEF: case GETTER_DEF: case SETTER_DEF: case COMPUTED_PROP: return true; default: return false; } } }); if (parent.isCall()) { visitSuperCall(node, parent, enclosingMemberDef); } else if (parent.isGetProp() || parent.isGetElem()) { if (parent.getFirstChild() == node) { if (parent.getParent().isCall() && NodeUtil.isCallOrNewTarget(parent)) { visitSuperPropertyCall(node, parent, enclosingMemberDef); } else { visitSuperPropertyAccess(node, parent, enclosingMemberDef); } } else { compiler.report(JSError.make(node, CANNOT_CONVERT_YET, "Only calls to super or to a method of super are supported.")); } } else if (parent.isNew()) { compiler.report(JSError.make(node, INVALID_SUPER_CALL)); } else { compiler.report(JSError.make(node, CANNOT_CONVERT_YET, "Only calls to super or to a method of super are supported.")); } }
Source:
<code>private void closeEventReceivers() { <START> this.eventReceivers.forEach((receiver) -> { receiver.close(); }); <END> }</code><technical_language>strip this a bit java this.eventReceivers.forEach(EventReceiver::close);</technical_language>

Target:
private void closeEventReceivers() { this.eventReceivers.forEach(EventReceiver::close); }
Source:
<code>public CommentedActionDialog(final String title, final String heading, AsyncCallback<T> callback) { super( false, true); this.callback = callback; setGlassEnabled(true); setText(title); addStyleName(Gerrit.RESOURCES.css().commentedActionDialog()); message = new NpTextArea(); message.setCharacterWidth(60); message.setVisibleLines(10); DOM.setElementPropertyBoolean(message.getElement(), "spellcheck", true); sendButton = new Button(Util.C.commentedActionButtonSend()); sendButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { enableButtons(false); onSend(); } }); cancelButton = new Button(Util.C.commentedActionButtonCancel()); DOM.setStyleAttribute(cancelButton.getElement(), "marginLeft", "300px"); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { hide(); } }); final FlowPanel mwrap = new FlowPanel(); mwrap.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage()); mwrap.add(message); buttonPanel = new FlowPanel(); buttonPanel.add(sendButton); buttonPanel.add(cancelButton); panel = new FlowPanel(); panel.add(new SmallHeading(heading)); panel.add(mwrap); panel.add(buttonPanel); add(panel); <START> callback = createCallback(); <END> addCloseHandler(this); }</code><technical_language>this line effect? removed</technical_language>

Target:
public CommentedActionDialog(final String title, final String heading, AsyncCallback<T> callback) { super( false, true); this.callback = callback; setGlassEnabled(true); setText(title); addStyleName(Gerrit.RESOURCES.css().commentedActionDialog()); message = new NpTextArea(); message.setCharacterWidth(60); message.setVisibleLines(10); DOM.setElementPropertyBoolean(message.getElement(), "spellcheck", true); sendButton = new Button(Util.C.commentedActionButtonSend()); sendButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { enableButtons(false); onSend(); } }); cancelButton = new Button(Util.C.commentedActionButtonCancel()); DOM.setStyleAttribute(cancelButton.getElement(), "marginLeft", "300px"); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { hide(); } }); final FlowPanel mwrap = new FlowPanel(); mwrap.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage()); mwrap.add(message); buttonPanel = new FlowPanel(); buttonPanel.add(sendButton); buttonPanel.add(cancelButton); panel = new FlowPanel(); panel.add(new SmallHeading(heading)); panel.add(mwrap); panel.add(buttonPanel); add(panel); addCloseHandler(this); }
Source:
<code>public static VirtualNetwork create(final String name, final String id, final String etag, final String location, final VirtualNetworkProperties properties, final Map<String, String> tags) { <START> return new AutoValue_VirtualNetwork(name, id, etag, location, properties, tags == null ? ImmutableMap.<String, String>builder().build() : ImmutableMap.copyOf(tags)); <END> }</code><technical_language>Simpler ImmutableMap.<String,String>of()</technical_language>

Target:
public static VirtualNetwork create(final String name, final String id, final String etag, final String location, final VirtualNetworkProperties properties, final Map<String, String> tags) { return new AutoValue_VirtualNetwork(name, id, etag, location, properties, tags == null ? null : ImmutableMap.copyOf(tags)); }
Source:
<code>public PartTreeCouchbaseQuery(CouchbaseQueryMethod method, CouchbaseOperations operations, SpelExpressionParser expressionParser, QueryMethodEvaluationContextProvider evaluationContextProvider) { super(method, operations, expressionParser, evaluationContextProvider); this.processor = method.getResultProcessor(); <START> for (PartTree.OrPart parts : this.tree = new PartTree(method.getName(), <END> processor.getReturnedType().getDomainType())) this.context = operations.getConverter().getMappingContext(); this.converter = operations.getConverter(); }</code><technical_language>this anything? some leftover - if removed, please do</technical_language>

Target:
public PartTreeCouchbaseQuery(CouchbaseQueryMethod method, CouchbaseOperations operations, SpelExpressionParser expressionParser, QueryMethodEvaluationContextProvider evaluationContextProvider) { super(method, operations, expressionParser, evaluationContextProvider); ResultProcessor processor = method.getResultProcessor(); this.tree = new PartTree(method.getName(), processor.getReturnedType().getDomainType()); this.converter = operations.getConverter(); }
Source:
<code>public boolean equalsIdentity (Object obj) { if (obj == this) return true; if (!(obj instanceof IdentityMap)) return false; IdentityMap other = (IdentityMap)obj; if (other.size != size) return false; K[] keyTable = this.keyTable; V[] valueTable = this.valueTable; <START> for (int i = 0, n = keyTable.length; i < n; i++) { <END> K key = keyTable[i]; if (key != null && valueTable[i] != other.get(key, dummy)) return false; } return true; }</code><technical_language>++i instead of i++</technical_language>

Target:
public boolean equalsIdentity (Object obj) { if (obj == this) return true; if (!(obj instanceof ObjectMap)) return false; ObjectMap other = (ObjectMap)obj; if (other.size != size) return false; K[] keyTable = this.keyTable; V[] valueTable = this.valueTable; for (int i = 0, n = keyTable.length; i < n; i++) { K key = keyTable[i]; if (key != null && valueTable[i] != other.get(key, dummy)) return false; } return true; }
Source:
<code>public CompletionStage<T> execute(final ActorRef scheduler, final Instant scheduled) { final JobRepository<T> repo = _ref.getRepository(_injector); <START> repo.jobStarted(_cached.getId(), _ref.getOrganization(), scheduled); <END> return _cached.execute(scheduler, scheduled) .handle((result, error) -> { _lastRun = Optional.of(scheduled); if (error == null) { repo.jobSucceeded(_cached.getId(), _ref.getOrganization(), scheduled, result); } else { repo.jobFailed(_cached.getId(), _ref.getOrganization(), scheduled, error); } return null; }); }</code><technical_language>abstraction semantics a bit unclear (as discussed). For example, if jobStarted fails this method throws return a CompletionStage. However, if jobSucceeded jobFailed fail this method returns a failed CompletionStage. Is this method supposed abstract job state management? it? => If should, do completely (e.g. create a CompletionStage do jobStarted step). If not, more reasonable move job state functionality caller (e.g. job executor actor). I *believe* job state is coupled lastRun long lastRun is more sense here. Of course, discussed job reload more complex need job executor non-existence of this job. ... I swinging, I covered this; want recap for others</technical_language>

Target:
public CompletionStage<T> execute(final ActorRef scheduler, final Instant scheduled) { return _cached.execute(scheduler, scheduled); }
Source:
<code>private void writeNotes(Appendable sb, String notesJsonString) throws IOException, JSONException { JSONArray notesArray = new JSONArray(notesJsonString); int count = notesArray.length(); if (count == 0) { sb.append(""); } else { for (int i = 0; i < count; i++) { <START> if (i != 0) { <END> sb.append("<br><br>"); sb.append("---------------------------"); sb.append("<br><br>"); } JSONObject note = notesArray.getJSONObject(i); if (note.has("content")) { sb.append(note.getString("content")); } if (note.has("type")) { sb.append(" Type: "); sb.append(note.getString("type")); } if (note.has("dateString")) { sb.append("<br>"); sb.append(" Date "); sb.append("<br>"); sb.append(note.getString("dateString")); } } } }</code><technical_language>next 3 lines append</technical_language>

Target:
private void writeNotes(Appendable sb, String notesJsonString) throws IOException, JSONException { JSONArray notesArray = new JSONArray(notesJsonString); int count = notesArray.length(); if (count == 0) { sb.append(""); } else { for (int i = 0; i < count; i++) { if (i != 0) { sb.append("<br><br>---------------------------<br><br>"); } JSONObject note = notesArray.getJSONObject(i); if (note.has("content")) { sb.append(note.getString("content")); } if (note.has("type")) { sb.append(String.format("<br><b>Type:</b><i>%s</i><br>", note.getString("type"))); } if (note.has("dateString")) { sb.append(note.getString("dateString")); } } } }
Source:
<code>public void testTransactionManager(@ArquillianResource Bundle bundle) throws Exception { assertEquals("System Bundle ID", 0, context.getBundle().getBundleId()); bundle.start(); assertEquals("Bundle ACTIVE", Bundle.ACTIVE, bundle.getState()); BundleContext context = bundle.getBundleContext(); assertNotNull("BundleContext available", context); <START> assertNotNull("TransactionManager reference available", context.getServiceReference(TransactionManager.class)); <END> bundle.stop(); assertEquals("Bundle RESOLVED", Bundle.RESOLVED, bundle.getState()); }</code><technical_language>Amos, worth a begin/commit transaction too, check reference is valid null</technical_language>

Target:
public void testTransactionManager(@ArquillianResource Bundle bundle) throws Exception { assertEquals("System Bundle ID", 0, context.getBundle().getBundleId()); bundle.start(); assertEquals("Bundle ACTIVE", Bundle.ACTIVE, bundle.getState()); BundleContext context = bundle.getBundleContext(); assertNotNull("BundleContext available", context); ServiceReference<TransactionManager> serviceReference = context.getServiceReference(TransactionManager.class); assertNotNull("TransactionManager reference available", serviceReference); TransactionManager tm = context.getService(serviceReference); assertNotNull("TransactionManager service available", tm); tm.begin(); tm.commit(); bundle.stop(); assertEquals("Bundle RESOLVED", Bundle.RESOLVED, bundle.getState()); }
Source:
<code>public void configure(Binder binder) { Jerseys.addResource(binder, ChatHandlerResource.class); LifecycleModule.register(binder, ChatHandlerResource.class); if (properties.containsKey(MAX_CHAT_REQUESTS_PROPERTY)) { final int maxRequests = Integer.parseInt(properties.getProperty(MAX_CHAT_REQUESTS_PROPERTY)); JettyBindings.addQosFilter(binder, "/druid/worker/v1/chat binder.bind(DruidNode.class).annotatedWith(RemoteChatHandler.class).to(Key.get(DruidNode.class, Self.class)); } binder.bind(ServerConfig.class).annotatedWith(RemoteChatHandler.class).to(Key.get(ServerConfig.class)); binder.bind(TLSServerConfig.class).annotatedWith(RemoteChatHandler.class).to(Key.get(TLSServerConfig.class)); }</code><technical_language>This ends unfortunate in _requires_ druid.service set 'default' is binding point this runs, fix :cry:</technical_language>

Target:
public void configure(Binder binder) { Jerseys.addResource(binder, ChatHandlerResource.class); LifecycleModule.register(binder, ChatHandlerResource.class); if (properties.containsKey(MAX_CHAT_REQUESTS_PROPERTY)) { final int maxRequests = Integer.parseInt(properties.getProperty(MAX_CHAT_REQUESTS_PROPERTY)); JettyBindings.addQosFilter( binder, "/druid/worker/v1/chat binder.bind(DruidNode.class).annotatedWith(RemoteChatHandler.class).to(Key.get(DruidNode.class, Self.class)); binder.bind(ServerConfig.class).annotatedWith(RemoteChatHandler.class).to(Key.get(ServerConfig.class)); binder.bind(TLSServerConfig.class).annotatedWith(RemoteChatHandler.class).to(Key.get(TLSServerConfig.class)); }
Source:
<code>public DAnalysis getDAnalysis() { DAnalysis dAnalysis = null; DRepresentation representation = <START> getRepresentation().get(); <END> DRepresentationDescriptor representationDescriptor = new DRepresentationQuery(representation).getRepresentationDescriptor(); EObject rootContainer = EcoreUtil.getRootContainer(representationDescriptor, false); if (rootContainer instanceof DAnalysis) { dAnalysis = (DAnalysis) rootContainer; } return dAnalysis; }</code><technical_language>This method returns Option<DRepresentation>, API null. check 'if getRepresentation().some()" before</technical_language>

Target:
public DAnalysis getDAnalysis() { DAnalysis dAnalysis = null; DRepresentation representation = getRepresentation().get(); if (representation != null) { DRepresentationDescriptor representationDescriptor = new DRepresentationQuery(representation).getRepresentationDescriptor(); EObject rootContainer = EcoreUtil.getRootContainer(representationDescriptor, false); if (rootContainer instanceof DAnalysis) { dAnalysis = (DAnalysis) rootContainer; } } return dAnalysis; }
Source:
<code>void emit(long mreq, Producer mp, long mprod) { boolean newMp = false; if (mp != null) { newMp = true; currentProducer = mp; } else { mp = currentProducer; } long u = requested + mreq; if (u < 0) { u = Long.MAX_VALUE; } <START> u -= mprod; <END> if (u < 0) { throw new IllegalStateException("More produced than requested"); } requested = u; if (mreq > 0 && mp != null) { mp.request(mreq); } else if (newMp && u > 0) { mp.request(u); } }</code><technical_language>Yes. it, retry land MAX_VALUE - 1 restart fast-path in sources</technical_language>

Target:
void emit(long mreq, Producer mp, long mprod) { boolean newMp = false; if (mp != null) { newMp = true; currentProducer = mp; } else { mp = currentProducer; } long u = requested + mreq; if (u < 0) { u = Long.MAX_VALUE; } else if (u != Long.MAX_VALUE) { u -= mprod; if (u < 0) { throw new IllegalStateException("More produced than requested"); } } requested = u; if (mreq > 0 && mp != null) { mp.request(mreq); } else if (newMp && u > 0) { mp.request(u); } }
Source:
<code><START> public SslCertResponse createCertResponse(final SslCertVO cert, final List<LoadBalancerCertMapVO> lbCertMap) { <END> final SslCertResponse response = new SslCertResponse(); final Account account = _accountDao.findByIdIncludingRemoved(cert.getAccountId()); if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) { final Project project = _projectMgr.findByProjectAccountIdIncludingRemoved(account.getId()); if (project != null) { response.setProjectId(project.getUuid()); response.setProjectName(project.getName()); } else { response.setAccountName(account.getAccountName()); } } else { response.setAccountName(account.getAccountName()); } final DomainVO domain = _domainDao.findByIdIncludingRemoved(cert.getDomainId()); response.setDomainId(domain.getUuid()); response.setDomainName(domain.getName()); response.setObjectName("sslcert"); response.setId(cert.getUuid()); response.setCertificate(cert.getCertificate()); response.setFingerprint(cert.getFingerPrint()); if (cert.getChain() != null) { response.setCertchain(cert.getChain()); } if (lbCertMap != null && !lbCertMap.isEmpty()) { final List<String> lbIds = new ArrayList<String>(); for (final LoadBalancerCertMapVO mapVO : lbCertMap) { final LoadBalancer lb = _entityMgr.findById(LoadBalancerVO.class, mapVO.getLbId()); if (lb != null) { lbIds.add(lb.getUuid()); } } response.setLbIds(lbIds); } return response; }</code><technical_language>Please consider adding Preconditions.checkArgument checks: * cert is null * lbCertMap is null</technical_language>

Target:
public SslCertResponse createCertResponse(final SslCertVO cert, final List<LoadBalancerCertMapVO> lbCertMap) { Preconditions.checkNotNull(cert); final SslCertResponse response = new SslCertResponse(); final Account account = _accountDao.findByIdIncludingRemoved(cert.getAccountId()); if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) { final Project project = _projectMgr.findByProjectAccountIdIncludingRemoved(account.getId()); if (project != null) { response.setProjectId(project.getUuid()); response.setProjectName(project.getName()); } else { response.setAccountName(account.getAccountName()); } } else { response.setAccountName(account.getAccountName()); } final DomainVO domain = _domainDao.findByIdIncludingRemoved(cert.getDomainId()); response.setDomainId(domain.getUuid()); response.setDomainName(domain.getName()); response.setObjectName("sslcert"); response.setId(cert.getUuid()); response.setCertificate(cert.getCertificate()); response.setFingerprint(cert.getFingerPrint()); if (cert.getChain() != null) { response.setCertchain(cert.getChain()); } if (lbCertMap != null && !lbCertMap.isEmpty()) { final List<String> lbIds = new ArrayList<String>(); for (final LoadBalancerCertMapVO mapVO : lbCertMap) { final LoadBalancer lb = _entityMgr.findById(LoadBalancerVO.class, mapVO.getLbId()); if (lb != null) { lbIds.add(lb.getUuid()); } } response.setLbIds(lbIds); } return response; }
Source:
<code>public StoreConfig(VerifiableProperties verifiableProperties) { storeKeyFactory = verifiableProperties.getString("store.key.factory", "com.github.ambry.commons.BlobIdFactory"); storeDataFlushIntervalSeconds = verifiableProperties.getLong("store.data.flush.interval.seconds", 60); storeIndexMaxMemorySizeBytes = verifiableProperties.getInt("store.index.max.memory.size.bytes", 20 * 1024 * 1024); storeDataFlushDelaySeconds = verifiableProperties.getInt("store.data.flush.delay.seconds", 5); storeIndexMaxNumberOfInmemElements = verifiableProperties.getInt("store.index.max.number.of.inmem.elements", 10000); storeIndexBloomMaxFalsePositiveProbability = verifiableProperties.getDoubleInRange("store.index.bloom.max.false.positive.probability", 0.01, 0.0, 1.0); storeMaxNumberOfEntriesToReturnFromJournal = verifiableProperties.getIntInRange("store.max.number.of.entries.to.return.from.journal", 5000, 1, 10000); storeDeletedMessageRetentionDays = verifiableProperties.getInt("store.deleted.message.retention.days", 7); storeHardDeleteBytesPerSec = verifiableProperties.getInt("store.hard.delete.bytes.per.sec", 1 * 1024 * 1024); storeEnableHardDelete = verifiableProperties.getBoolean("store.enable.hard.delete", false); storeSegmentSizeInBytes = verifiableProperties.getLongInRange("store.segment.size.in.bytes", Long.MAX_VALUE, 1, Long.MAX_VALUE); <START> storeHardDeleterSleepTimeWhenCaughtUpInMs = <END> verifiableProperties.getLong("store.hard.deleter.sleep.time.when.caught.up.in.ms", 10000); }</code><technical_language>is this exposed? intentionally exposed this sense a config (on basis set it)</technical_language>

Target:
public StoreConfig(VerifiableProperties verifiableProperties) { storeKeyFactory = verifiableProperties.getString("store.key.factory", "com.github.ambry.commons.BlobIdFactory"); storeDataFlushIntervalSeconds = verifiableProperties.getLong("store.data.flush.interval.seconds", 60); storeIndexMaxMemorySizeBytes = verifiableProperties.getInt("store.index.max.memory.size.bytes", 20 * 1024 * 1024); storeDataFlushDelaySeconds = verifiableProperties.getInt("store.data.flush.delay.seconds", 5); storeIndexMaxNumberOfInmemElements = verifiableProperties.getInt("store.index.max.number.of.inmem.elements", 10000); storeIndexBloomMaxFalsePositiveProbability = verifiableProperties.getDoubleInRange("store.index.bloom.max.false.positive.probability", 0.01, 0.0, 1.0); storeMaxNumberOfEntriesToReturnFromJournal = verifiableProperties.getIntInRange("store.max.number.of.entries.to.return.from.journal", 5000, 1, 10000); storeDeletedMessageRetentionDays = verifiableProperties.getInt("store.deleted.message.retention.days", 7); storeHardDeleteBytesPerSec = verifiableProperties.getInt("store.hard.delete.bytes.per.sec", 1 * 1024 * 1024); storeEnableHardDelete = verifiableProperties.getBoolean("store.enable.hard.delete", false); storeSegmentSizeInBytes = verifiableProperties.getLongInRange("store.segment.size.in.bytes", Long.MAX_VALUE, 1, Long.MAX_VALUE); }
Source:
<code>public void start(final BundleContext context) throws Exception { super.start(context); pluginId = context.getBundle().getSymbolicName(); Dictionary<String, String> props = new Hashtable<String, String>(4); props.put(DebugOptions.LISTENER_SYMBOLICNAME, pluginId); context.registerService(DebugOptionsListener.class.getName(), this, props); repositoryCache = new RepositoryCache(); indexDiffCache = new IndexDiffCache(); try { GitProjectData.reconfigureWindowCache(); } catch (RuntimeException e) { logError(CoreText.Activator_ReconfigureWindowCacheError, e); } GitProjectData.attachToWorkspace(true); IEclipsePreferences node = InstanceScope.INSTANCE.getNode(Activator.getPluginId()); String gitPrefix = node.get(GitCorePreferences.core_gitPrefix, null); if (gitPrefix != null) FS.DETECTED.setGitPrefix(new File(gitPrefix)); repositoryUtil = new RepositoryUtil(); secureStore = new EGitSecureStore(SecurePreferencesFactory.getDefault()); registerAutoShareProjects(); if (egitChangeListener == null) { egitChangeListener = new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResource project = event.getResource(); <START> if (project != null && project instanceof IProject) { <END> GitProjectData.reconfigureWindowCache(); } } }; ResourcesPlugin.getWorkspace().addResourceChangeListener(egitChangeListener, IResourceChangeEvent.PRE_DELETE); } }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
public void start(final BundleContext context) throws Exception { super.start(context); pluginId = context.getBundle().getSymbolicName(); Dictionary<String, String> props = new Hashtable<String, String>(4); props.put(DebugOptions.LISTENER_SYMBOLICNAME, pluginId); context.registerService(DebugOptionsListener.class.getName(), this, props); repositoryCache = new RepositoryCache(); indexDiffCache = new IndexDiffCache(); try { GitProjectData.reconfigureWindowCache(); } catch (RuntimeException e) { logError(CoreText.Activator_ReconfigureWindowCacheError, e); } GitProjectData.attachToWorkspace(true); IEclipsePreferences node = InstanceScope.INSTANCE.getNode(Activator.getPluginId()); String gitPrefix = node.get(GitCorePreferences.core_gitPrefix, null); if (gitPrefix != null) FS.DETECTED.setGitPrefix(new File(gitPrefix)); repositoryUtil = new RepositoryUtil(); secureStore = new EGitSecureStore(SecurePreferencesFactory.getDefault()); registerAutoShareProjects(); if (egitChangeListener == null) { egitChangeListener = new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { IResource project = event.getResource(); if (project != null && project instanceof IProject) GitProjectData.reconfigureWindowCache(); } }; ResourcesPlugin.getWorkspace().addResourceChangeListener(egitChangeListener, IResourceChangeEvent.PRE_DELETE); } }
Source:
<code><START> public void channelRead(ChannelHandlerContext ctx, Object obj) <END> throws Exception { logger.trace("Reading on channel {}", ctx.channel()); if (obj instanceof HttpRequest) { if (requestInProgress) { logDurations(); logMessage.append(" : Received request while another request in progress. Resetting log message."); logger.error(logMessage.toString()); } this.requestInProgress = true; this.logMessage = new StringBuilder(); this.requestArrivalTimeInMs = System.currentTimeMillis(); this.requestLastChunkArrivalTimeInMs = INVALID_CHUNK_TIME; this.responseFirstChunkStartTimeInMs = INVALID_CHUNK_TIME; this.request = (HttpRequest) obj; logMessage.append(ctx.channel().remoteAddress()).append(" "); logMessage.append(request.getMethod().toString()).append(" "); logMessage.append(request.getUri()).append(", "); logHeaders("Request", request, publicAccessLogger.getRequestHeaders()); logMessage.append(", "); } else if (obj instanceof HttpContent) { HttpContent httpContent = (HttpContent) obj; if (httpContent instanceof LastHttpContent) { requestLastChunkArrivalTimeInMs = System.currentTimeMillis(); } } else { logger.error("Receiving request (messageReceived) that is not of type HttpRequest or HttpChunk. " + "Receiving request from " + ctx.channel().remoteAddress() + ". " + "Request is of type " + obj.getClass() + ". " + "No action being taken other than logging this unexpected state."); } super.channelRead(ctx, obj); }</code><technical_language>minor: HttpObject for arg</technical_language>

Target:
public void channelRead(ChannelHandlerContext ctx, Object obj) throws Exception { logger.trace("Reading on channel {}", ctx.channel()); if (obj instanceof HttpRequest) { if (request != null) { logDurations(); logMessage.append(" : Received request while another request in progress. Resetting log message."); logger.error(logMessage.toString()); } reset(); requestArrivalTimeInMs = System.currentTimeMillis(); request = (HttpRequest) obj; logMessage.append(ctx.channel().remoteAddress()).append(" "); logMessage.append(request.getMethod().toString()).append(" "); logMessage.append(request.getUri()).append(", "); logHeaders("Request", request, publicAccessLogger.getRequestHeaders()); logMessage.append(", "); } else if (obj instanceof LastHttpContent) { requestLastChunkArrivalTimeInMs = System.currentTimeMillis(); } else if(!(obj instanceof HttpContent)){ logger.error("Receiving request (messageReceived) that is not of type HttpRequest or HttpContent. " + "Receiving request from " + ctx.channel().remoteAddress() + ". " + "Request is of type " + obj.getClass() + ". " + "No action being taken other than logging this unexpected state."); } super.channelRead(ctx, obj); }
Source:
<code>public void inspectRuntimeShape(RuntimeShapeInspector inspector) { <START> inspector.visit("selector", selector); <END> }</code><technical_language>elaborate meaning of "the runtime shape of aggregate()" please</technical_language>

Target:
public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("selector", selector); inspector.visit("lgK", lgK); }
Source:
<code>private void removeFromList(Map source, TypeDefinition value) { List<TypeDefinition> list = (List<TypeDefinition>) source.get(value.getName()); <START> if (list == null) return; <END> list.remove(value); }</code><technical_language>I { open closing braces</technical_language>

Target:
private void removeFromList(Map source, TypeDefinition value) { List<TypeDefinition> list = (List<TypeDefinition>) source.get(value.getName()); if (list == null) { return; } list.remove(value); }
Source:
<code>public boolean checkImages() { <START> boolean allReviewed = true; <END> for (MapillaryImage img : changeset) { allReviewed &= img.isReviewed(); } return allReviewed; }</code><technical_language>check if image is _not_ reviewed. a stream instead? return changeset.stream().allMatch(MapillaryImage::isReviewed) While this (technically) parallelized, I is reason do _right now_</technical_language>

Target:
public boolean checkImages() { return changeset.stream().allMatch(MapillaryImage::isReviewed); }
Source:
<code>protected Jedis getJedis(int db) { int timeoutCount = 0; Jedis jedis; while (true) { try { jedis = getJedisPool().getResource(); if (StringUtils.isNotEmpty(getRedisPassword())) { jedis.auth(getRedisPassword()); } jedis.select(db); break; } catch (JedisConnectionException e) { <START> logger.error(e.getLocalizedMessage(), e); <END> if (++timeoutCount >= 3) { throw e; } } } return jedis; }</code><technical_language>more log: logger.error("Get Redis pool failure more 3 times.")</technical_language>

Target:
protected Jedis getJedis(int db) { int timeoutCount = 0; Jedis jedis; while (true) { try { jedis = getJedisPool().getResource(); if (StringUtils.isNotEmpty(getRedisPassword())) { jedis.auth(getRedisPassword()); } jedis.select(db); break; } catch (JedisConnectionException e) { logger.error(MessageFormat.format("fetch jedis failed on {0} times", String.valueOf(timeoutCount + 1)), e); if (++timeoutCount >= 3) { logger.error("Get Redis pool failure more than 3 times.",e); throw e; } } } return jedis; }
Source:
<code>public void testWithMissingOsInExplicitTargetEnvironment() throws Exception { try { <START> File basedir = getBasedir("projects/explicitenvironment/missingOs"); <END> List<MavenProject> projects = getSortedProjects(basedir); assertEquals(1, projects.size()); assertEquals("missingOs", projects.get(0).getArtifactId()); DefaultTargetPlatformConfigurationReader resolver = lookup(DefaultTargetPlatformConfigurationReader.class); MavenSession session = newMavenSession(projects.get(0), projects); resolver.getTargetPlatformConfiguration(session, session.getCurrentProject()); fail("RuntimeException must be thrown when <os> is missing in the target configuration (environment element)"); } catch (RuntimeException e) { assertTrue(true); } }</code><technical_language>try block cover code exception is expected thrown</technical_language>

Target:
public void testWithMissingOsInExplicitTargetEnvironment() throws Exception { File basedir = getBasedir("projects/explicitenvironment/missingOs"); try { getSortedProjects(basedir); fail("RuntimeException must be thrown when <os> is missing in the target configuration (environment element)"); } catch (RuntimeException e) { assertTrue(e.getMessage().contains( "target-platform-configuration error in project explicitenvironment:missingos:eclipse-plugin")); Throwable cause = e; while (cause.getCause() != null) { cause = cause.getCause(); } assertTrue(cause instanceof TargetPlatformConfigurationException); assertEquals("<os> element is missing within target-platform-configuration (element <environment>)", cause.getMessage()); } }
Source:
<code>public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException { List<String> command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, LTTngControlServiceConstants.OPTION_KERNEL); ICommandResult result = executeCommand(command, monitor, false); List<IBaseEventInfo> events = new ArrayList<>(); if <START> (result.getErrorOutput().length > <END> 0) { if (ignoredPattern(result.getErrorOutput(), LTTngControlServiceConstants.LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN)) { return events; } } if (isError(result)) { throw new ExecutionException(Messages.TraceControl_CommandError + " " + toCommandString(command) + "\n" + result.toString()); } getProviderEventInfo(result.getOutput(), 0, events); return events; }</code><technical_language>is this check necessary</technical_language>

Target:
public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException { List<String> command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, LTTngControlServiceConstants.OPTION_KERNEL); ICommandResult result = executeCommand(command, monitor, false); List<IBaseEventInfo> events = new ArrayList<>(); if (ignoredPattern(result.getErrorOutput(), LTTngControlServiceConstants.LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN)) { return events; } if (isError(result)) { throw new ExecutionException(Messages.TraceControl_CommandError + " " + toCommandString(command) + "\n" + result.toString()); } getProviderEventInfo(result.getOutput(), 0, events); return events; }
Source:
<code>public void beforeUse(AbstractBuild b, FilePath workspace, BuildListener listener) { if (Util.isOverridden(WorkspaceListener.class, getClass(), "beforeUse", Run.class, FilePath.class, BuildListener.class)) { beforeUse((Run) b, workspace, listener); } else { <START> throw new AssertionError("The plugin '" + this.getClass().getName() + "' still uses " + <END> "deprecated beforeUse(AbstractBuild,FilePath,BuildListener) method. " + "Update the plugin to use beforeUse(Run,FilePath,BuildListener) instead."); } }</code><technical_language>This wrong me. method abstract force forcing a client override this afterDelete(Job). a listener implemented afterDelete in order do something</technical_language>

Target:
@Deprecated public void beforeUse(AbstractBuild b, FilePath workspace, BuildListener listener) { if (Util.isOverridden(WorkspaceListener.class, getClass(), "beforeUse", Run.class, FilePath.class, TaskListener.class)) { beforeUse((Run) b, workspace, listener); } }
Source:
<code><START> public void tearDown() throws Exception { <END> if (realm != null) { realm.close(); } }</code><technical_language>Remove throws Exception</technical_language>

Target:
public void tearDown() { if (realm != null) { realm.close(); } }
Source:
<code>private static JGroupsModel getModelVersion(ModelTestControllerVersion controllerVersion) { switch (controllerVersion) { case EAP_6_4_0: case EAP_6_4_7: return JGroupsModel.VERSION_1_3_0; case EAP_7_0_0: return JGroupsModel.VERSION_4_0_0; case EAP_7_1_0: return JGroupsModel.VERSION_5_0_0; case EAP_7_2_0_TEMP: <START> return JGroupsModel.VERSION_6_0_0; <END> default: throw new IllegalArgumentException(); } }</code><technical_language>EAP_7_2_0</technical_language>

Target:
private static JGroupsModel getModelVersion(ModelTestControllerVersion controllerVersion) { switch (controllerVersion) { case EAP_6_4_0: case EAP_6_4_7: return JGroupsModel.VERSION_1_3_0; case EAP_7_0_0: return JGroupsModel.VERSION_4_0_0; case EAP_7_1_0: return JGroupsModel.VERSION_5_0_0; case EAP_7_2_0: return JGroupsModel.VERSION_6_0_0; default: throw new IllegalArgumentException(); } }
Source:
<code>public void testExport() { mode = LanguageMode.ECMASCRIPT6; parse("export const x = 1"); parse("export var x = 1"); parse("export function f() {}"); parse("export class c {}"); parse("export {x, y}"); parse("export {x as x1}"); parse("export {x as default, y as y1}"); parseError("export {default as x}", "cannot use keyword 'default' here."); <START> parseError("export {package as x}", <END> "cannot use keyword 'package' here."); parseError("export {package}", "cannot use keyword 'package' here."); parse("export {x as x1, y as y1} from './someModule'"); parse("export {x as x1, y as y1, } from './someModule'"); parse("export {default as d} from './someModule'"); parse("export {x as default, y as y1} from './someModule'"); parse("export {default as default, y as y1} from './someModule'"); parse("export * from './someModule'"); }</code><technical_language>I back, this case. I misunderstanding? allowed export keyword names other default</technical_language>

Target:
public void testExport() { mode = LanguageMode.ECMASCRIPT6; parse("export const x = 1"); parse("export var x = 1"); parse("export function f() {}"); parse("export class c {}"); parse("export {x, y}"); parse("export {x as x1}"); parse("export {x as x1, y as x2}"); parse("export {x as default, y as class}"); parseError("export {default as x}", "cannot use keyword 'default' here."); parseError("export {package as x}", "cannot use keyword 'package' here."); parseError("export {package}", "cannot use keyword 'package' here."); parse("export {x as x1, y as y1} from './someModule'"); parse("export {x as x1, y as y1, } from './someModule'"); parse("export {default as d} from './someModule'"); parse("export {d as default, c as class} from './someModule'"); parse("export {default as default, class as class} from './someModule'"); parse("export {class} from './someModule'"); parse("export * from './someModule'"); }
Source:
<code>public void testTabletDir() { Master master = EasyMock.createMock(Master.class); VolumeManager volumeManager = EasyMock.createMock(VolumeManager.class); ImportedTableInfo iti = new ImportedTableInfo(); iti.tableId = "5"; <START> String[] volumes = {"hdfs://nn1:8020/apps/accumulo1", "hdfs://nn2:8020/applications/accumulo"}; <END> String tabletDir = "/c-00000001"; EasyMock.expect(master.getFileSystem()).andReturn(volumeManager); EasyMock.expect(volumeManager.choose(Optional.of(iti.tableId), volumes)) .andReturn(volumes[1]); EasyMock.replay(master, volumeManager); PopulateMetadataTable pmt = new PopulateMetadataTable(iti); assertEquals(volumes[1] + "/" + iti.tableId + "/" + tabletDir, pmt.getClonedTabletDir(master, volumes, tabletDir)); EasyMock.verify(master, volumeManager); }</code><technical_language>Accumulo 1.9 requires Java 1.7. compile Java 1.7. build Maven, ensure require 1.8, this compilation failures in IDE IDE assumes 1.7 compliance</technical_language>

Target:
public void testTabletDir() { Master master = EasyMock.createMock(Master.class); VolumeManager volumeManager = EasyMock.createMock(VolumeManager.class); ImportedTableInfo iti = new ImportedTableInfo(); iti.tableId = "5"; String[] volumes = new String[] {"hdfs://nn1:8020/apps/accumulo1", "hdfs://nn2:8020/applications/accumulo"}; String tabletDir = "/c-00000001"; EasyMock.expect(master.getFileSystem()).andReturn(volumeManager); EasyMock.expect(volumeManager.choose(Optional.of(iti.tableId), volumes)).andReturn(volumes[1]); EasyMock.replay(master, volumeManager); PopulateMetadataTable pmt = new PopulateMetadataTable(iti); assertEquals(volumes[1] + "/" + ServerConstants.TABLE_DIR + "/" + iti.tableId + "/" + tabletDir, pmt.getClonedTabletDir(master, volumes, tabletDir)); EasyMock.verify(master, volumeManager); }
Source:
<code>private void writeChunkToOutputStream(byte[] chunk, int offset, int length) { if (compressor == null) { compressedOutputStream.write(chunk, offset, length); return; } checkArgument(length <= buffer.length, "Write chunk length must be less than compression buffer size"); int minCompressionBufferSize = compressor.maxCompressedLength(length); if (compressionBuffer.length < minCompressionBufferSize) { compressionBuffer = new byte[minCompressionBufferSize]; } int compressedSize = compressor.compress(chunk, offset, length, compressionBuffer, 0, compressionBuffer.length); if (compressedSize < length) { <START> assert PAGE_HEADER_SIZE + compressedSize <= maxBufferSize; <END> int chunkHeader = (compressedSize << 1); compressedOutputStream.write(chunkHeader & 0x00_00FF); compressedOutputStream.write((chunkHeader & 0x00_FF00) >> 8); compressedOutputStream.write((chunkHeader & 0xFF_0000) >> 16); compressedOutputStream.writeBytes(compressionBuffer, 0, compressedSize); } else { assert PAGE_HEADER_SIZE + length <= maxBufferSize; int header = (length << 1) + 1; compressedOutputStream.write(header & 0x00_00FF); compressedOutputStream.write((header & 0x00_FF00) >> 8); compressedOutputStream.write((header & 0xFF_0000) >> 16); compressedOutputStream.writeBytes(chunk, offset, length); } }</code><technical_language>assert length <= maxBufferSize. Checking compressed size is incorrect compressed size length. maxBufferSize accounts for PAGE_HEADER_SIZE in addition length result in incorrect assertions</technical_language>

Target:
private void writeChunkToOutputStream(byte[] chunk, int offset, int length) { if (compressor == null) { compressedOutputStream.write(chunk, offset, length); return; } checkArgument(length <= buffer.length, "Write chunk length must be less than compression buffer size"); int minCompressionBufferSize = compressor.maxCompressedLength(length); if (compressionBuffer.length < minCompressionBufferSize) { compressionBuffer = new byte[minCompressionBufferSize]; } int compressedSize = compressor.compress(chunk, offset, length, compressionBuffer, 0, compressionBuffer.length); if (compressedSize < length) { int chunkHeader = (compressedSize << 1); compressedOutputStream.write(chunkHeader & 0x00_00FF); compressedOutputStream.write((chunkHeader & 0x00_FF00) >> 8); compressedOutputStream.write((chunkHeader & 0xFF_0000) >> 16); compressedOutputStream.writeBytes(compressionBuffer, 0, compressedSize); } else { int header = (length << 1) + 1; compressedOutputStream.write(header & 0x00_00FF); compressedOutputStream.write((header & 0x00_FF00) >> 8); compressedOutputStream.write((header & 0xFF_0000) >> 16); compressedOutputStream.writeBytes(chunk, offset, length); } }
Source:
<code>public void shouldPassTheValidationIfAllTheFieldsAreNonEmpty() { <START> Config config = new Config(); <END> config.setName(NAME); config.setOpenMrsVersion(OPEN_MRS_VERSION); config.setOpenMrsUrl(OPEN_MRS_URL); config.setUsername(USERNAME); config.setPassword(PASSWORD); config.setMotechPatientIdentifierTypeName(MOTECH_PATIENT_IDENTIFIER_TYPE_NAME); config.setPatientIdentifierTypeNames(new ArrayList<>()); validateConfig(config); }</code><technical_language>is a lot of duplicated code here, please constructor a private method for setting fields</technical_language>

Target:
public void shouldPassTheValidationIfAllTheFieldsAreNonEmpty() { configValidator(NAME, OPEN_MRS_VERSION, OPEN_MRS_URL, USERNAME, PASSWORD, MOTECH_PATIENT_IDENTIFIER_TYPE_NAME, new ArrayList<>()); }
Source:
<code>private void pullRecords() { ConsumerRecords<K, V> records = consumer.poll(Duration.ofMillis(100)); for (ConsumerRecord record : records) { bufferedRecords.add(record); } <START> consumer.commitSync(); <END> }</code><technical_language>If commitSync() api, set enable.auto.commit false create KafkaConsumer instance</technical_language>

Target:
private void pullRecords() { ConsumerRecords<K, V> records = consumer.poll(Duration.ofMillis(100)); for (ConsumerRecord record : records) { bufferedRecords.add(record); } }
Source:
<code>public void damage(double amount, Entity source, DamageCause cause) { if (!DamageCause.LIGHTNING.equals(cause)) { <START> super.damage(amount, source, cause); <END> } world.spawn(this.location, Witch.class); remove(); }</code><technical_language>This call EntityDamageEvent cancelled plugins -- internal method returns false event is cancelled, subsequent actions (like converting) cancelled too</technical_language>

Target:
public void damage(double amount, Entity source, DamageCause cause) { if (!DamageCause.LIGHTNING.equals(cause)) { super.damage(amount, source, cause); return; } Witch witch = world.spawn(this.location, Witch.class); witch.damage(amount, source, cause); witch.setFireTicks(this.getFireTicks()); remove(); }
Source:
<code>public Map<String,List<ProblemDetailInformation>> getDetails() { <START> Map<String,List<ProblemDetailInformation>> jsonObj = new HashMap<String,List<ProblemDetailInformation>>(); <END> List<ProblemDetailInformation> problems = new ArrayList<>(); Map<String,String> tidToNameMap = Tables.getIdToNameMap(HdfsZooInstance.getInstance()); if (Monitor.getProblemException() == null) { for (Entry<String,Map<ProblemType,Integer>> entry : Monitor.getProblemSummary().entrySet()) { ArrayList<ProblemReport> problemReports = new ArrayList<>(); Iterator<ProblemReport> iter = entry.getKey() == null ? ProblemReports.getInstance(Monitor.getContext()).iterator() : ProblemReports.getInstance( Monitor.getContext()).iterator(entry.getKey()); while (iter.hasNext()) problemReports.add(iter.next()); for (ProblemReport pr : problemReports) { String tableName = Tables.getPrintableTableNameFromId(tidToNameMap, pr.getTableName()); problems.add(new ProblemDetailInformation(tableName, entry.getKey(), pr.getProblemType().name(), pr.getServer(), pr.getTime(), pr.getResource(), pr .getException())); } } } jsonObj.put("problemDetails", problems); return jsonObj; }</code><technical_language>new HashMap<>()</technical_language>

Target:
public ProblemDetail getDetails() { ProblemDetail problems = new ProblemDetail(); Map<String,String> tidToNameMap = Tables.getIdToNameMap(HdfsZooInstance.getInstance()); if (Monitor.getProblemException() == null) { for (Entry<String,Map<ProblemType,Integer>> entry : Monitor.getProblemSummary().entrySet()) { ArrayList<ProblemReport> problemReports = new ArrayList<>(); Iterator<ProblemReport> iter = entry.getKey() == null ? ProblemReports.getInstance(Monitor.getContext()).iterator() : ProblemReports.getInstance( Monitor.getContext()).iterator(entry.getKey()); while (iter.hasNext()) problemReports.add(iter.next()); for (ProblemReport pr : problemReports) { String tableName = Tables.getPrintableTableNameFromId(tidToNameMap, pr.getTableName()); problems.addProblemDetail(new ProblemDetailInformation(tableName, entry.getKey(), pr.getProblemType().name(), pr.getServer(), pr.getTime(), pr .getResource(), pr.getException())); } } } return problems; }
Source:
<code>public CaseCommentList getComments(String containerId, String caseId, Integer page, Integer pageSize) { <START> Collection<CommentInstance> caseComments = caseService.getCaseComments(caseId, page, pageSize, ConvertUtils.buildQueryContext(page, pageSize)); <END> logger.debug("Comments for case are {}", caseId, caseComments); List<CaseComment> comments = ConvertUtils.transformCaseComments(caseComments); CaseCommentList commentsList = new CaseCommentList(comments); return commentsList; }</code><technical_language>page pageSize is needed info is set query context</technical_language>

Target:
public CaseCommentList getComments(String containerId, String caseId, Integer page, Integer pageSize) { Collection<CommentInstance> caseComments = caseService.getCaseComments(caseId, ConvertUtils.buildQueryContext(page, pageSize)); logger.debug("Comments for case are {}", caseId, caseComments); List<CaseComment> comments = ConvertUtils.transformCaseComments(caseComments); CaseCommentList commentsList = new CaseCommentList(comments); return commentsList; }