auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static void initOculus() { switch (LWJGLUtil.getPlatform()) { <START> case LWJGLUtil.PLATFORM_WINDOWS: <END> OculusVrHelper.loadNatives(); break; } }</code><technical_language>do if statement here. :)</technical_language>

Target:
private static void initOculus() { if (LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS) { OculusVrHelper.loadNatives(); } }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getActivity().getActionBar() != null) getActivity().getActionBar().setDisplayHomeAsUpEnabled(true); rootView = inflater.inflate(R.layout.dialog_fragment_charge, null); ButterKnife.bind(this, rootView); mChargeDialogPresenter.attachView(this); inflatedueDate(); inflateChargesSpinner(); inflateChargeNameSpinner(); duedateString = chargeDueDate.getText().toString(); duedateString = DateHelper.getDateAsStringUsedForCollectionSheetPayload(duedateString) .replace("-", " "); <START> btSaveCharge.setOnClickListener(new View.OnClickListener() { <END> @Override public void onClick(View view) { ChargesPayload chargesPayload = new ChargesPayload(); chargesPayload.setAmount(etAmoutDue.getEditableText().toString()); chargesPayload.setLocale(chargeLocale.getEditableText().toString()); chargesPayload.setDueDate(duedateString); chargesPayload.setDateFormat("dd MMMM yyyy"); chargesPayload.setChargeId(chargeId); initiateChargesCreation(chargesPayload); } }); return rootView; }</code><technical_language>ButterKhife, Remove OnClickListener implementation ButterKhife @OnClick annotation</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getActivity().getActionBar() != null) getActivity().getActionBar().setDisplayHomeAsUpEnabled(true); rootView = inflater.inflate(R.layout.dialog_fragment_charge, null); ButterKnife.bind(this, rootView); mChargeDialogPresenter.attachView(this); inflatedueDate(); inflateChargesSpinner(); inflateChargeNameSpinner(); duedateString = etChargeDueDate.getText().toString(); duedateString = DateHelper.getDateAsStringUsedForCollectionSheetPayload(duedateString) .replace("-", " "); return rootView; }
Source:
<code>protected void tearDown() throws Exception { SessionUIManager.INSTANCE.getUISession(session).closeEditors(false, Collections.singleton((DialectEditor) editorPart)); <START> DialectUIManager.INSTANCE.closeEditor(editorPart, false); editorPart.getSite().getPage().closeEditor(editorPart, false); <END> TestsUtil.emptyEventsFromUIThread(); super.tearDown(); }</code><technical_language>IMO, DialectUIManager.INSTANCE.closeEditor(edPart,false) is needed: DialectUiManager deactivate de diagram edit part call close () some try/catch, this remove some graphical listeners calling page.close(editorPart, save) aware this page.close() is done in a display.asyncExec runnable</technical_language>

Target:
protected void tearDown() throws Exception { SessionUIManager.INSTANCE.getUISession(session).closeEditors(false, Collections.singleton((DialectEditor) editorPart)); DialectUIManager.INSTANCE.closeEditor(editorPart, false); TestsUtil.emptyEventsFromUIThread(); super.tearDown(); }
Source:
<code>public void testPush() throws InterruptedException { BufferedEventSender sender = new BufferedEventSender(10); List<Event> receivedEvents = new ArrayList<>(); EventSender underlyingSender = receivedEvents::add; BufferedEventSender.Worker resender = sender.newSendWorker(receivedEvents::add, 10); List<Event> sentEvents = Stream.generate(EventTestUtils::newTestEvent) .limit(10) <START> .collect(Collectors.toList()); <END> AsyncEventSender asyncSend = new AsyncEventSender(sender, resender, underlyingSender); asyncSend.push(sentEvents.get(0)); asyncSend.push(sentEvents.subList(1, sentEvents.size())); resender.stopAndWaitForCompletion(); resender.run(); assertThat(receivedEvents).isEqualTo(sentEvents); }</code><technical_language>static import (feel free ignore)</technical_language>

Target:
public void testPush() throws InterruptedException { BufferedEventSender sender = new BufferedEventSender(10); List<Event> receivedEvents = new ArrayList<>(); EventSender underlyingSender = receivedEvents::add; BufferedEventSender.Worker resender = sender.newSendWorker(receivedEvents::add, 10); List<Event> sentEvents = Stream.generate(EventTestUtils::newTestEvent) .limit(10) .collect(toList()); AsyncEventSender asyncSend = new AsyncEventSender(sender, resender, underlyingSender); asyncSend.push(sentEvents.get(0)); asyncSend.push(sentEvents.subList(1, sentEvents.size())); resender.stopAndWaitForCompletion(); resender.run(); assertThat(receivedEvents).isEqualTo(sentEvents); }
Source:
<code>public void waitForState(final Predicate<State> predicate) { await("Predicate on Mesos Master failed").atMost(clusterConfig.getTimeout(), TimeUnit.SECONDS).until(() -> { <START> try { <END> return predicate.test(State.fromJSON(getMaster().getStateInfoJSON().toString())); } catch (InternalServerErrorException e) { return false; } }); }</code><technical_language>I a of non-trivial waits. version of callback return (Runnable) throw AssertionErrors it. timeout expires Awaitility message AssertionError showing failed</technical_language>

Target:
public void waitForState(final Predicate<State> predicate) { await("Mesos master startup" + clusterConfig.getTimeout()).atMost(clusterConfig.getTimeout(), TimeUnit.SECONDS).until(() -> { try { assertTrue(predicate.test(State.fromJSON(getMaster().getStateInfoJSON().toString()))); } catch (InternalServerErrorException | JsonParseException | UnirestException | JsonMappingException e) { throw new AssertionError("Mesos master did not start after " + clusterConfig.getTimeout(), e); } }); }
Source:
<code>public void executeNodeSourceScript(final String script, final String engine, final String nodeSourceName, final Callback<String, String> syncCallBack) { rm.executeNodeSourceScript(LoginModel.getInstance().getSessionId(), script, engine, nodeSourceName, new AsyncCallback<String>() { public void onFailure(Throwable caught) { String msg = JSONUtils.getJsonErrorMessage(caught); LogModel.getInstance() .logImportantMessage("Failed to execute a script " + script + " on node source " + nodeSourceName + " : " + msg); <START> if (msg.equals("HTTP 500 Internal Server Error")) { <END> syncCallBack.onFailure("You are not authorized to execute scripts on this node source. Please contact the administrator."); } else { syncCallBack.onFailure(msg); } } public void onSuccess(String result) { syncCallBack.onSuccess(parseListScriptResult(result)); } }); }</code><technical_language>create a separate private method delegate this error management? handleError(String msg)....</technical_language>

Target:
public void executeNodeSourceScript(final String script, final String engine, final String nodeSourceName, final Callback<String, String> syncCallBack) { rm.executeNodeSourceScript(LoginModel.getInstance().getSessionId(), script, engine, nodeSourceName, new AsyncCallback<String>() { public void onFailure(Throwable caught) { reportScriptExecutionFailure(caught, script, nodeSourceName, syncCallBack); } public void onSuccess(String result) { syncCallBack.onSuccess(parseAllScriptResults(result)); } }); }
Source:
<code><START> public void setTabs() { <END> List<Fragment> fragmentList = new ArrayList<>(); List<String> titleList = new ArrayList<>(); leaderboardUploadFragment = new LeaderboardUploadFragment(); leaderboardNearbyFragment = new LeaderboardNearbyFragment(); leaderboardUsedFragment = new LeaderboardUsedFragment(); fragmentList.add(leaderboardUploadFragment); titleList.add(getResources().getString(R.string.leaderBoard_upload_title)); fragmentList.add(leaderboardNearbyFragment); titleList.add(getResources().getString(R.string.leaderBoard_nearby_title)); fragmentList.add(leaderboardUsedFragment); titleList.add(getResources().getString(R.string.leaderBoard_used_title)); adapter.setTabData(fragmentList, titleList); adapter.notifyDataSetChanged(); }</code><technical_language>This method need public</technical_language>

Target:
public void setTabs() { List<Fragment> fragmentList = new ArrayList<>(); List<String> titleList = new ArrayList<>(); leaderboardUploadFragment = new LeaderboardFragment(); Bundle uploadArguments = new Bundle(); uploadArguments.putString("FragmentName","upload"); leaderboardUploadFragment.setArguments(uploadArguments); fragmentList.add(leaderboardUploadFragment); titleList.add(getResources().getString(R.string.leaderBoard_upload_title)); leaderboardNearbyFragment = new LeaderboardFragment(); Bundle nearbyArguments = new Bundle(); nearbyArguments.putString("FragmentName","nearby"); leaderboardNearbyFragment.setArguments(nearbyArguments); fragmentList.add(leaderboardNearbyFragment); titleList.add(getResources().getString(R.string.leaderBoard_nearby_title)); leaderboardUsedFragment = new LeaderboardFragment(); Bundle usedArguments = new Bundle(); usedArguments.putString("FragmentName","used"); leaderboardUsedFragment.setArguments(usedArguments); fragmentList.add(leaderboardUsedFragment); titleList.add(getResources().getString(R.string.leaderBoard_used_title)); adapter.setTabData(fragmentList, titleList); adapter.notifyDataSetChanged(); }
Source:
<code>public void setUp() throws Exception { first = new AbstractEntityTest.TestEntity(Point3D.ZERO, Point3D.UNITCUBE); <START> second = new AbstractEntityTest.TestEntity(Point3D.ZERO, Point3D.UNITCUBE); <END> entity = new TestEntity(Point3D.ZERO, Point3D.UNITCUBE); crashMap = mock(CrashMap.class); State.getTrack().setCollisions(crashMap); }</code><technical_language>entities non-mocked test want work. test work, mocked again? <review, testing</technical_language>

Target:
public void setUp() throws Exception { first = mock(AbstractEntity.class); second = mock(AbstractEntity.class); entity = new TestEntity(Point3D.ZERO, Point3D.UNITCUBE); collisionHandler = mock(CollisionHandler.class); State.getTrack().setCollisions(collisionHandler); }
Source:
<code>public boolean shutdown() { mServer.shutdown(); try { <START> mCloser.close(); <END> } catch (IOException e) { LOG.warn("Failed to close resources during shutdown.", e); } mServer.shutdownNow(); try { return mServer.awaitTermination(mServerShutdownTimeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); return false; } }</code><technical_language>Do want close closer server fails shutdown</technical_language>

Target:
public boolean shutdown() { mServer.shutdown(); try { mCloser.close(); } catch (IOException e) { LOG.error("Failed to close resources during shutdown.", e); } mServer.shutdownNow(); try { return mServer.awaitTermination(mServerShutdownTimeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); return false; } }
Source:
<code>public void updated(Map<String, Object> properties) { readProperties(properties); if (pollThreadTask != null && !pollThreadTask.isCancelled()) { pollThreadTask.cancel(true); } if (!this.configEnabled) { disableWatchdog(); } else { pollThreadTask = this.pollThreadExecutor.scheduleAtFixedRate(new Runnable() { @Override public void run() { Thread.currentThread().setName("WatchdogServiceImpl"); <START> doWatchdogLoop(); <END> } }, 0, this.pingInterval, TimeUnit.MILLISECONDS); } }</code><technical_language>a loop anymore. doWatchdog is enough</technical_language>

Target:
public void updated(Map<String, Object> properties) { readProperties(properties); cancelPollTask(); if (!this.configEnabled) { disableWatchdog(); } else { this.pollTask = this.pollExecutor.scheduleAtFixedRate(() -> { Thread.currentThread().setName("WatchdogServiceImpl"); checkCriticalComponents(); }, 0, this.pingInterval, TimeUnit.MILLISECONDS); } }
Source:
<code>public static URLConnection connectToUrl(String u) throws Exception { final URL url = new URL(u); final AtomicReference<Exception> exception = new AtomicReference<Exception>(); Future<URLConnection> f = executor.submit(new Callable<URLConnection>() { public URLConnection call() { try { URLConnection connection = url.openConnection(); TrustingSslSocketFactory.configure(connection); HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String s, SSLSession sslSession) { return true; } }); connection.connect(); connection.getContentLength(); return connection; } catch (Exception e) { exception.set(e); LOG.debug("Error connecting to url "+url+" (propagating)", e); } return null; } }); try { URLConnection result = null; try { result = f.get(60, TimeUnit.SECONDS); } catch (InterruptedException e) { throw e; } catch (Exception e) { throw new IllegalStateException("Connect to URL not complete within 60 seconds, for url "+url+": "+e); } <START> if (exception.get() != null) { <END> LOG.debug("Error connecting to url "+url+", thread caller of "+exception, new Throwable("source of rethrown error "+exception)); throw exception.get(); } else { return result; } } finally { f.cancel(true); } }</code><technical_language>I need this exception check, catching exception in submitted callable. rely return f.get(60) propagating exception if task failed</technical_language>

Target:
public static URLConnection connectToUrl(String u) throws Exception { final URL url = new URL(u); final AtomicReference<Exception> exception = new AtomicReference<Exception>(); Future<URLConnection> f = executor.submit(new Callable<URLConnection>() { public URLConnection call() { try { URLConnection connection = url.openConnection(); TrustingSslSocketFactory.configure(connection); HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String s, SSLSession sslSession) { return true; } }); connection.connect(); connection.getContentLength(); return connection; } catch (Exception e) { exception.set(e); LOG.debug("Error connecting to url "+url+" (propagating): "+e, e); } return null; } }); try { URLConnection result = null; try { result = f.get(60, TimeUnit.SECONDS); } catch (InterruptedException e) { throw e; } catch (Exception e) { LOG.debug("Error connecting to url "+url+", probably timed out (rethrowing): "+e); throw new IllegalStateException("Connect to URL not complete within 60 seconds, for url "+url+": "+e); } if (exception.get() != null) { LOG.debug("Error connecting to url "+url+", thread caller of "+exception, new Throwable("source of rethrown error "+exception)); throw exception.get(); } else { return result; } } finally { f.cancel(true); } }
Source:
<code>public synchronized TopLevelItem createProjectFromXML(String name, InputStream xml) throws IOException, Failure { <START> Jenkins.checkGoodName(name); <END> acl.checkPermission(Item.CREATE); Jenkins.getInstance().getProjectNamingStrategy().checkName(name); Items.verifyItemDoesNotAlreadyExist(parent, name, null); File configXml = Items.getConfigFile(getRootDirFor(name)).getFile(); final File dir = configXml.getParentFile(); dir.mkdirs(); boolean success = false; try { XMLUtils.safeTransform((Source)new StreamSource(xml), new StreamResult(configXml)); TopLevelItem result = Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<TopLevelItem,IOException>() { @Override public TopLevelItem call() throws IOException { return (TopLevelItem) Items.load(parent, dir); } }); success = acl.getACL().hasCreatePermission(Jenkins.getAuthentication(), parent, result.getDescriptor()) && result.getDescriptor().isApplicableIn(parent); add(result); ItemListener.fireOnCreated(result); Jenkins.getInstance().rebuildDependencyGraphAsync(); return result; } catch (TransformerException e) { success = false; throw new IOException("Failed to persist config.xml", e); } catch (SAXException e) { success = false; throw new IOException("Failed to persist config.xml", e); } catch (IOException e) { success = false; throw e; } catch (RuntimeException e) { success = false; throw e; } finally { if (!success) { Util.deleteRecursive(dir); } } }</code><technical_language>Failure caught rethrown IOException IMHO</technical_language>

Target:
public synchronized TopLevelItem createProjectFromXML(String name, InputStream xml) throws IOException { try { Jenkins.checkGoodName(name); } catch (Failure e){ throw new IOException("Not a valid project name", e); } acl.checkPermission(Item.CREATE); Jenkins.getInstance().getProjectNamingStrategy().checkName(name); Items.verifyItemDoesNotAlreadyExist(parent, name, null); File configXml = Items.getConfigFile(getRootDirFor(name)).getFile(); final File dir = configXml.getParentFile(); dir.mkdirs(); boolean success = false; try { XMLUtils.safeTransform((Source)new StreamSource(xml), new StreamResult(configXml)); TopLevelItem result = Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<TopLevelItem,IOException>() { @Override public TopLevelItem call() throws IOException { return (TopLevelItem) Items.load(parent, dir); } }); success = acl.getACL().hasCreatePermission(Jenkins.getAuthentication(), parent, result.getDescriptor()) && result.getDescriptor().isApplicableIn(parent); add(result); ItemListener.fireOnCreated(result); Jenkins.getInstance().rebuildDependencyGraphAsync(); return result; } catch (TransformerException e) { success = false; throw new IOException("Failed to persist config.xml", e); } catch (SAXException e) { success = false; throw new IOException("Failed to persist config.xml", e); } catch (IOException e) { success = false; throw e; } catch (RuntimeException e) { success = false; throw e; } finally { if (!success) { Util.deleteRecursive(dir); } } }
Source:
<code>public ByteBuffer read(long pos, int cnt) throws IOException { if (ch == null && readAhead > 0 && notInCache(pos)) { open().setReadAheadBytes(readAhead); } DfsBlock block = cache.getOrLoad(file, pos, ctx, () -> { try { return open(); <START> } catch (IOException e) { throw new RuntimeException(e); } <END> }); if (block.start == pos && block.size() >= cnt) { return block.zeroCopyByteBuffer(cnt); } byte[] dst = new byte[cnt]; ByteBuffer buf = ByteBuffer.wrap(dst); buf.position(ctx.copy(file, pos, dst, 0, cnt)); return buf; }</code><technical_language>I need a Supplier throw IOException</technical_language>

Target:
public ByteBuffer read(long pos, int cnt) throws IOException { if (ch == null && readAhead > 0 && notInCache(pos)) { open().setReadAheadBytes(readAhead); } DfsBlock block = cache.getOrLoad(file, pos, ctx, () -> { return open(); }); if (block.start == pos && block.size() >= cnt) { return block.zeroCopyByteBuffer(cnt); } byte[] dst = new byte[cnt]; ByteBuffer buf = ByteBuffer.wrap(dst); buf.position(ctx.copy(file, pos, dst, 0, cnt)); return buf; }
Source:
<code>public void delete() throws IOException, InterruptedException { checkPermission(DELETE); if (this instanceof Queue.Task) { <START> Queue.getInstance().cancel((Queue.Task) this); <END> Map<Queue.Executable, Executor> building = new LinkedHashMap<>(); for (Computer c : Jenkins.getInstance().getComputers()) { for (Executor e : c.getOneOffExecutors()) { WorkUnit workUnit = e.getCurrentWorkUnit(); if (workUnit != null && (workUnit.work == this || workUnit.work.getOwnerTask() == this)) { building.put(e.getCurrentExecutable(), e); e.interrupt(); } } for (Executor e : c.getExecutors()) { WorkUnit workUnit = e.getCurrentWorkUnit(); if (workUnit != null && (workUnit.work == this || workUnit.work.getOwnerTask() == this)) { building.put(e.getCurrentExecutable(), e); e.interrupt(); } } } if (!building.isEmpty()) { long expiration = System.nanoTime() + TimeUnit.SECONDS.toNanos(15); while (!building.isEmpty() && expiration - System.nanoTime() > 0L) { for (Iterator<Map.Entry<Queue.Executable, Executor>> iterator = building.entrySet().iterator(); iterator.hasNext(); ) { Map.Entry<Queue.Executable, Executor> entry = iterator.next(); if (!entry.getValue().isAlive() || entry.getKey() != entry.getValue().getCurrentExecutable()) { iterator.remove(); } } Thread.sleep(50L); } if (!building.isEmpty()) { throw new AbortException(Messages.Job_FailureToStopBuilds(building.size(), getFullDisplayName())); } } } super.delete(); Util.deleteRecursive(getBuildDir()); }</code><technical_language>work for Promoted Builds other such... exotic implementations</technical_language>

Target:
@Override public void delete() throws IOException, InterruptedException { super.delete(); Util.deleteRecursive(getBuildDir()); }
Source:
<code>public void testStartpointTimestampVisitorShouldResolveToCorrectOffset() { final Long testTimeStamp = 10L; final KafkaConsumer consumer = Mockito.mock(KafkaConsumer.class); final KafkaStartpointToOffsetResolver kafkaStartpointToOffsetResolver = new KafkaStartpointToOffsetResolver(consumer); final StartpointTimestamp startpointTimestamp = new StartpointTimestamp(testTimeStamp); final Map<TopicPartition, OffsetAndTimestamp> offsetForTimesResult = ImmutableMap.of( TEST_TOPIC_PARTITION, new OffsetAndTimestamp(Long.valueOf(TEST_OFFSET), testTimeStamp)); Mockito.when(consumer.offsetsForTimes(ImmutableMap.of(TEST_TOPIC_PARTITION, testTimeStamp))).thenReturn(offsetForTimesResult); <START> Mockito.doNothing().when(consumer).seek(TEST_TOPIC_PARTITION, Long.valueOf(TEST_OFFSET)); <END> Mockito.when(consumer.position(TEST_TOPIC_PARTITION)).thenReturn(Long.valueOf(TEST_OFFSET)); String resolvedOffset = kafkaStartpointToOffsetResolver.visit(TEST_SYSTEM_STREAM_PARTITION, startpointTimestamp); Assert.assertEquals(TEST_OFFSET, resolvedOffset); }</code><technical_language>this get called</technical_language>

Target:
public void testStartpointTimestampVisitorShouldResolveToCorrectOffset() { final Long testTimeStamp = 10L; final KafkaConsumer consumer = Mockito.mock(KafkaConsumer.class); final KafkaStartpointToOffsetResolver kafkaStartpointToOffsetResolver = new KafkaStartpointToOffsetResolver(consumer); final StartpointTimestamp startpointTimestamp = new StartpointTimestamp(testTimeStamp); final Map<TopicPartition, OffsetAndTimestamp> offsetForTimesResult = ImmutableMap.of( TEST_TOPIC_PARTITION, new OffsetAndTimestamp(Long.valueOf(TEST_OFFSET), testTimeStamp)); Mockito.when(consumer.offsetsForTimes(ImmutableMap.of(TEST_TOPIC_PARTITION, testTimeStamp))).thenReturn(offsetForTimesResult); Mockito.when(consumer.position(TEST_TOPIC_PARTITION)).thenReturn(Long.valueOf(TEST_OFFSET)); String resolvedOffset = kafkaStartpointToOffsetResolver.visit(TEST_SYSTEM_STREAM_PARTITION, startpointTimestamp); Assert.assertEquals(TEST_OFFSET, resolvedOffset); }
Source:
<code>public void showFormulaEditorToEditFormula(View view) { switch (view.getId()) { case R.id.brick_glide_to_edit_text_x: FormulaEditorFragment.showFragment(view, this, BrickField.X_DESTINATION); break; case R.id.brick_glide_to_edit_text_y: FormulaEditorFragment.showFragment(view, this, BrickField.Y_DESTINATION); break; case R.id.brick_glide_to_edit_text_duration: FormulaEditorFragment.showFragment(view, this, BrickField.DURATION_IN_SECONDS); break; default: FormulaEditorFragment.showFragment(view, this, BrickField.DURATION_IN_SECONDS); <START> break; <END> } }</code><technical_language>move default keyword case implement twice. :wink: java case R.id.brick_glide_to_edit_text_duration: default: // Code</technical_language>

Target:
public void showFormulaEditorToEditFormula(View view) { switch (view.getId()) { case R.id.brick_glide_to_edit_text_x: FormulaEditorFragment.showFragment(view, this, BrickField.X_DESTINATION); break; case R.id.brick_glide_to_edit_text_y: FormulaEditorFragment.showFragment(view, this, BrickField.Y_DESTINATION); break; case R.id.brick_glide_to_edit_text_duration: default: FormulaEditorFragment.showFragment(view, this, BrickField.DURATION_IN_SECONDS); break; } }
Source:
<code>public void shouldCreateMultipleToolsAndAggregationResultWithWarningsAggregateTrue() { FreeStyleProject project = createJobWithWorkspaceFile("checkstyle.xml", "pmd-warnings.xml"); enableWarningsAggregation(project, true, "**/checkstyle-issues.txt", new CheckStyle(), "**/pmd-warnings-issues.txt", new Pmd()); AnalysisResult result = scheduleBuildAndAssertStatus(project, Result.SUCCESS); assertThat(result).hasTotalSize(10); assertThat(result.getSizePerOrigin()).containsKeys("checkstyle", "pmd"); assertThat(result).hasOverallResult(Result.SUCCESS); <START> } <END></code><technical_language>assertThat(result).hasId("analysis")</technical_language>

Target:
public void shouldCreateMultipleToolsAndAggregationResultWithWarningsAggregateTrue() { FreeStyleProject project = createJobWithWorkspaceFile("checkstyle.xml", "pmd-warnings.xml"); enableWarningsAggregation(project, true, "**/checkstyle-issues.txt", new CheckStyle(), "**/pmd-warnings-issues.txt", new Pmd()); List<AnalysisResult> results = scheduleBuildAndAssertStatusForBothTools(project, Result.SUCCESS); assertThat(results).hasSize(1); for (AnalysisResult element : results) { assertThat(element.getSizePerOrigin()).containsKeys("checkstyle", "pmd"); assertThat(element).hasTotalSize(10); assertThat(element).hasId("analysis"); assertThat(element).hasOverallResult(Result.SUCCESS); } }
Source:
<code>public String addTenant(Tenant tenant) throws TenantMgtException { String tenantDomain = tenant.getDomain(); int tenantId; validateInputs(tenant); try { TenantMgtUtil.setTenantAdminCreationOperation(true); addAttributeValues(tenant); createTenant(tenant); addTenantAdminUser(tenant); tenantId = tenant.getId(); addClaimsToUserStore(tenant); TenantInfoBean tenantInfoBean = initializeTenantInfoBean(tenantId, tenant); notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); if (INVITE_VIA_EMAIL.equalsIgnoreCase(tenant.getProvisioningMethod())) { <START> if (tenant.getClaimsMap() != null) { tenant.getClaimsMap().put(TENANT_ADMIN_ASK_PASSWORD_CLAIM, "true"); <END> } else { Map<String, String> claimsMap = new HashMap<>(); claimsMap.put(TENANT_ADMIN_ASK_PASSWORD_CLAIM, "true"); tenant.setClaimsMap(claimsMap); } } addAdditionalClaimsToUserStore(tenant); } catch (Exception e) { if (e instanceof TenantMgtException) { throw (TenantMgtException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } log.info("Added the tenant '" + tenantDomain + " [" + tenantId + "]' by '" + PrivilegedCarbonContext.getThreadLocalCarbonContext(). getUsername() + "'"); TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId(), tenant.getTenantUniqueID()); return tenant.getTenantUniqueID(); }</code><technical_language>suggestion if (tenant.getClaimsMap() == null) { tenant.setClaimsMap(new HashMap<>()); } tenant.getClaimsMap().put(TENANT_ADMIN_ASK_PASSWORD_CLAIM, "true");</technical_language>

Target:
public String addTenant(Tenant tenant) throws TenantMgtException { String tenantDomain = tenant.getDomain(); int tenantId; validateInputs(tenant); try { TenantMgtUtil.setTenantAdminCreationOperation(true); addAttributeValues(tenant); createTenant(tenant); addTenantAdminUser(tenant); tenantId = tenant.getId(); addClaimsToUserStore(tenant); TenantInfoBean tenantInfoBean = initializeTenantInfoBean(tenantId, tenant); notifyTenantAddition(tenantInfoBean); TenantMgtUtil.activateTenantInitially(tenantInfoBean, tenantId); if (INVITE_VIA_EMAIL.equalsIgnoreCase(tenant.getProvisioningMethod())) { if (tenant.getClaimsMap() == null) { tenant.setClaimsMap(new HashMap<>()); } tenant.getClaimsMap().put(TENANT_ADMIN_ASK_PASSWORD_CLAIM, "true"); } addAdditionalClaimsToUserStore(tenant); } catch (Exception e) { if (e instanceof TenantMgtException) { throw (TenantMgtException) e; } else { throw new TenantManagementServerException(e.getMessage(), e); } } log.info("Added the tenant '" + tenantDomain + " [" + tenantId + "]' by '" + PrivilegedCarbonContext.getThreadLocalCarbonContext(). getUsername() + "'"); TenantMgtUtil.prepareStringToShowThemeMgtPage(tenant.getId(), tenant.getTenantUniqueID()); return tenant.getTenantUniqueID(); }
Source:
<code>public void testLocateFinest() { assertEquals("Unexpected response", icRoot, icRoot <START> .locateFinest("com.kazgroup.courtlink.domain", "Class")); <END> assertEquals("Unexpected response", icCommon, icRoot .locateFinest("com.kazgroup.courtlink.common.api", "Class")); assertNull("Unexpected response", icRoot.locateFinest("com", "Class")); }</code><technical_language>"Type" ? import of Enum Interface Annotation. <LINK_0></technical_language>

Target:
public void testLocateFinest() { assertEquals("Unexpected response", icRoot, icRoot .locateFinest("com.kazgroup.courtlink.domain", "MyClass")); assertEquals("Unexpected response", icCommon, icRoot .locateFinest("com.kazgroup.courtlink.common.api", "MyClass")); assertNull("Unexpected response", icRoot.locateFinest("com", "MyClass")); }
Source:
<code>public static GenomicVariant fromRegion(String region) { <START> if (!isRegion(region)) <END> throw new IllegalArgumentException("region is invalid"); String chr = getPattern("^\\d{1,2}(?=:)", region); RefType ref_type = null; Integer start = Integer.parseInt(getPattern("(?<=:)\\d+(?=-)", region)); Integer end = Integer.parseInt(getPattern("(?<=-)\\d+(?=:)", region)); Type type = null; String ref = null; String alt = getPattern("(?<=:-?1/)[ATCG]+|-$", region); return new GenomicVariant(chr, ref_type, start, end, type, ref, alt); }</code><technical_language>suggestion if (!isRegion(region)) { ... }</technical_language>

Target:
public static GenomicVariant fromRegion(String region) { if (!isRegion(region)) { throw new IllegalArgumentException("region is invalid"); } String chr = getPattern("^\\d{1,2}(?=:)", region); RefType ref_type = null; Integer start = Integer.parseInt(getPattern("(?<=:)\\d+(?=-)", region)); Integer end = Integer.parseInt(getPattern("(?<=-)\\d+(?=:)", region)); Type type = null; String ref = null; String alt = getPattern("(?<=:-?1/)[ATCG]+|-$", region); return new GenomicVariant(chr, ref_type, start, end, type, ref, alt); }
Source:
<code><START> public void accept(CorenodeEvent event) { <END> currentView.computeIfAbsent(event.keyHash, k -> new Stat(event.username, MaybeMultihash.empty(), 0, Collections.emptySet())); usage.putIfAbsent(event.username, 0L); ForkJoinPool.commonPool().submit(() -> processCorenodeEvent(event.username, event.keyHash)); }</code><technical_language>return caller happened this fail</technical_language>

Target:
public void accept(CorenodeEvent event) { currentView.computeIfAbsent(event.keyHash, k -> new Stat(event.username, MaybeMultihash.empty(), 0, Collections.emptySet())); usage.putIfAbsent(event.username, new Usage(0, defaultQuota)); ForkJoinPool.commonPool().submit(() -> processCorenodeEvent(event.username, event.keyHash)); }
Source:
<code>private void goNStepsBack(int steps) { int zPosition = sprite.look.getZIndex(); int newSpriteZIndex = Math.max(zPosition - steps, Constants.Z_INDEX_FIRST_SPRITE); List<Sprite> spriteList = ProjectManager.getInstance().getCurrentProject().getSpriteListWithClones(); for (int i = 0; i < spriteList.size(); i++) { int currentSpriteZIndex = spriteList.get(i).look.getZIndex(); if (steps > 0 && currentSpriteZIndex >= newSpriteZIndex && currentSpriteZIndex < zPosition) { spriteList.get(i).look.setZIndex(currentSpriteZIndex + 1); } else if (currentSpriteZIndex <= newSpriteZIndex && currentSpriteZIndex > zPosition) { spriteList.get(i).look.setZIndex(currentSpriteZIndex - 1); } <START> } <END> sprite.look.setZIndex(newSpriteZIndex); }</code><technical_language>this loop do useful? z-index of a is changed, others automatically updated correctly well. sufficient set z-index of current sprite only. Please recheck</technical_language>

Target:
private void goNStepsBack(int steps) { int zPosition = sprite.look.getZIndex(); int newSpriteZIndex = Math.max(zPosition - steps, Constants.Z_INDEX_FIRST_SPRITE); sprite.look.setZIndex(newSpriteZIndex); }
Source:
<code>public Response generateNodes() { List<DeviceOrganizationVisNode> result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); result = dops.generateNodes(); if (result.isEmpty()) { String msg = "No Devices enrolled and visible"; log.error(msg); <START> return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); <END> } return Response.status(Response.Status.OK).entity(result).build(); }</code><technical_language>IMO, this is error. log a debug log. response NOT_FOUND devices enrolled system in order generate nodes</technical_language>

Target:
public Response generateNodes() { List<DeviceOrganizationVisNode> result; DeviceOrganizationProviderService dops = new DeviceOrganizationProviderServiceImpl(); result = dops.generateNodes(); if (result.isEmpty()) { String msg = "No Devices enrolled and visible"; if (log.isDebugEnabled()) { log.debug(msg); } return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(result).build(); }
Source:
<code><START> public BUILDER setName(String name) { <END> this.name = name; return (BUILDER) this; }</code><technical_language>assert name != null;</technical_language>

Target:
public BUILDER setName(String name) { assert name != null; this.name = name; return (BUILDER) this; }
Source:
<code>public void setWorldBorder(@Nullable WorldBorder border, Cause cause) { if (this.worldBorder == border) { return; } if (!SpongeImpl.postEvent(SpongeEventFactory.createChangeWorldBorderEventTargetPlayer(cause, Optional.ofNullable(this.worldBorder), Optional.ofNullable(border), this))) { this.worldBorder = border; if (this.worldBorder != null) { ((net.minecraft.world.border.WorldBorder) this.worldBorder).addListener(new PlayerOwnBorderListener((EntityPlayerMP) (Object) this)); this.connection.sendPacket(new SPacketWorldBorder((net.minecraft.world.border.WorldBorder) (Object) this.worldBorder, SPacketWorldBorder.Action.INITIALIZE)); } <START> else { END> this.connection.sendPacket(new SPacketWorldBorder(new net.minecraft.world.border.WorldBorder(), SPacketWorldBorder.Action.INITIALIZE)); } } }</code><technical_language>} else line</technical_language>

Target:
public void setWorldBorder(@Nullable WorldBorder border, Cause cause) { if (this.worldBorder == border) { return; } if (!SpongeImpl.postEvent(SpongeEventFactory.createChangeWorldBorderEventTargetPlayer(cause, Optional.ofNullable(this.worldBorder), Optional.ofNullable(border), this))) { if (this.worldBorder != null) { ((net.minecraft.world.border.WorldBorder) this.worldBorder).listeners.remove(this.borderListener); } this.worldBorder = border; if (this.worldBorder != null) { ((net.minecraft.world.border.WorldBorder) this.worldBorder).addListener(this.borderListener); this.connection.sendPacket(new SPacketWorldBorder((net.minecraft.world.border.WorldBorder) (Object) this.worldBorder, SPacketWorldBorder.Action.INITIALIZE)); } else { this.connection.sendPacket(new SPacketWorldBorder(this.world.getWorldBorder(), SPacketWorldBorder.Action.INITIALIZE)); } } }
Source:
<code>public void testCast() throws Exception { final DefaultConfiguration configurationTestCast = createCheckConfig(WhitespaceAfterCheck.class); configurationTestCast.addAttribute("tokens", "TYPECAST"); final String[] expected = { "88:21: " + getCheckMessage(MSG_WS_TYPECAST), }; <START> verify(configurationTestCast, getPath("InputWhitespaceAfter.java"), <END> expected); }</code><technical_language>InputWhitespaceAfterTypecast</technical_language>

Target:
public void testCast() throws Exception { final DefaultConfiguration configurationTestCast = createCheckConfig(WhitespaceAfterCheck.class); configurationTestCast.addAttribute("tokens", "TYPECAST"); final String[] expected = { "88:21: " + getCheckMessage(MSG_WS_TYPECAST), }; verify(configurationTestCast, getPath("InputWhitespaceAfterTypeCast.java"), expected); }
Source:
<code>private TWKBMetadata readMetadata() throws IOException { int geometryTypeAndPrecision = dis.readByte(); int geometryType = geometryTypeAndPrecision & 0x0F; <START> int precision = zigzagDecode((geometryTypeAndPrecision & 0xF0) >> 4); <END> metadata.setType(geometryType); metadata.setPrecision(precision); byte header = dis.readByte(); metadata.setHeader(header); int dims = 2; if (metadata.hasExtendedDims()) { int dimensions = dis.readByte(); if ((dimensions & 0x01) > 0) { dims += 1; } if ((dimensions & 0x02) > 0) { dims += 1; } if ((dimensions & 0x01) > 0) { metadata.setHasM(true); metadata.setMprecision((dimensions & 0xE0) >> 5); } if ((dimensions & 0x02) > 0) { metadata.setHasZ(true); metadata.setZprecision((dimensions & 0x1C) >> 2); } } metadata.setDims(dims); if (metadata.hasSize()) { metadata.setSize(dis.readSignedInt()); } else { metadata.setSize(1); } if (metadata.hasBBOX()) { CoordinateSequence bbox = csFactory.create(2, dims); for (int i = 0; i < dims; i++) { double min = readNextDouble(metadata.getScale(0)); double delta = readNextDouble(metadata.getScale(0)); bbox.setOrdinate(0, i, min); bbox.setOrdinate(1, i, min + delta); } metadata.setEnvelope(bbox); } return metadata; }</code><technical_language>this unsigned shift >>>? bits zero</technical_language>

Target:
private TWKBMetadata readMetadata() throws IOException { int geometryTypeAndPrecision = dis.readByte(); int geometryType = geometryTypeAndPrecision & 0x0F; int precision = zigzagDecode((geometryTypeAndPrecision & 0xF0) >>> 4); metadata.setType(geometryType); metadata.setPrecision(precision); byte header = dis.readByte(); metadata.setHeader(header); int dims = 2; if (metadata.hasExtendedDims()) { int dimensions = dis.readByte(); if ((dimensions & 0x01) > 0) { dims += 1; metadata.setHasM(true); metadata.setMprecision((dimensions & 0xE0) >> 5); } if ((dimensions & 0x02) > 0) { dims += 1; metadata.setHasZ(true); metadata.setZprecision((dimensions & 0x1C) >> 2); } } metadata.setDims(dims); if (metadata.hasSize()) { metadata.setSize(dis.readSignedInt()); } else { metadata.setSize(1); } if (metadata.hasBBOX()) { CoordinateSequence bbox = csFactory.create(2, dims); for (int i = 0; i < dims; i++) { double min = readNextDouble(metadata.getScale(0)); double delta = readNextDouble(metadata.getScale(0)); bbox.setOrdinate(0, i, min); bbox.setOrdinate(1, i, min + delta); } metadata.setEnvelope(bbox); } return metadata; }
Source:
<code><START> public Long getFirstOffset() { <END> try { return journal.firstKey(); } catch (NoSuchElementException e) { return null; } }</code><technical_language>do methods</technical_language>

Target:
public long getFirstOffset() { Map.Entry<Long, StoreKey> first = journal.firstEntry(); return first == null ? -1 : first.getKey(); }
Source:
<code>private Producer<String, String> setKafkaProducer() { Properties props = new Properties(); props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, config.getBootstrapServers()); props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, DEFAULT_KEY_SERIALIZER); props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, DEFAULT_VALUE_SERIALIZER); props.put(ProducerConfig.RETRIES_CONFIG, DEFAULT_RETRIES); props.putAll(config.getKafkaProducerConfig()); queueMemoryBound = (props.containsKey(ProducerConfig.BUFFER_MEMORY_CONFIG) ? Long.parseLong(props.getProperty(ProducerConfig.BUFFER_MEMORY_CONFIG)) : queueMemoryBound); <START> <END> return new KafkaProducer<>(props); }</code><technical_language>Hello~ classes in jars in extensions directory loaded URLClassloader, KafkaProducer appClassLoader load classes in org.apache.kafka.common.config.ConfigDef parseType() this lead org.apache.kafka.common.config.ConfigException. is problem I got. I some code in KafkaIndexTask, in method newConsumer() as: ClassLoader currCtxCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); // ignore some code ... }finally { Thread.currentThread().setContextClassLoader(currCtxCl); } This solve problem. I ask encounter this problem</technical_language>

Target:
private Producer<String, String> setKafkaProducer() { ClassLoader currCtxCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); Properties props = new Properties(); props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, config.getBootstrapServers()); props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); props.put(ProducerConfig.RETRIES_CONFIG, DEFAULT_RETRIES); props.putAll(config.getKafkaProducerConfig()); return new KafkaProducer<>(props); } finally { Thread.currentThread().setContextClassLoader(currCtxCl); } }
Source:
<code>public BreakpointManagerImpl(final EditorAgent editorAgent, final DebuggerManager debuggerManager, final ConsolePart console, final EventBus eventBus) { this.editorAgent = editorAgent; this.breakpoints = new HashMap<>(); this.debuggerManager = debuggerManager; this.console = console; eventBus.addHandler(EditorOpenedEvent.TYPE, new EditorOpenedEventHandler() { @Override public void onEditorOpened(EditorOpenedEvent event) { BreakpointManagerImpl.this.onEditorOpened(event.getFile(), event.getEditor()); <START> } <END> }); }</code><technical_language>simply call onEditorOpened()</technical_language>

Target:
public BreakpointManagerImpl(final EditorAgent editorAgent, final DebuggerManager debuggerManager, final ConsolePart console, final EventBus eventBus) { this.editorAgent = editorAgent; this.breakpoints = new HashMap<>(); this.debuggerManager = debuggerManager; this.console = console; eventBus.addHandler(EditorOpenedEvent.TYPE, new EditorOpenedEventHandler() { @Override public void onEditorOpened(EditorOpenedEvent event) { doOpenEditor(event.getFile(), event.getEditor()); } }); }
Source:
<code>EnumValueElement(Text key, Class<T> type) { super(key); this.type = type; <START> this.values = Arrays.stream(type.getFields()) <END> .filter(Field::isEnumConstant) .collect(Collectors.toMap( field -> field.getName().toLowerCase(), field -> Enum.valueOf(type, field.getName()), (value, value2) -> { throw new UnsupportedOperationException(type.getCanonicalName() + " contains more than one enum constant " + "with the same name, only differing by capitalization, which is unsupported."); } )); }</code><technical_language>getEnumConstants here</technical_language>

Target:
EnumValueElement(Text key, Class<T> type) { super(key); this.type = type; this.values = Arrays.stream(type.getEnumConstants()) .collect(Collectors.toMap( value -> value.name().toLowerCase(), Function.identity(), (value, value2) -> { throw new UnsupportedOperationException(type.getCanonicalName() + " contains more than one enum constant " + "with the same name, only differing by capitalization, which is unsupported."); } )); }
Source:
<code>public int handleCommand(final Namespace ns, final Manager m) { if (!m.isRegistered()) { System.err.println("User is not registered."); return 1; } List<ContactInfo> contacts = m.getContacts(); for (ContactInfo c : contacts) { <START> System.out.println(String.format("Id: %s Name: %s", c.number, c.name)); <END> } return 0; }</code><technical_language>I for contacts Number: instead of Id:. good</technical_language>

Target:
public int handleCommand(final Namespace ns, final Manager m) { if (!m.isRegistered()) { System.err.println("User is not registered."); return 1; } List<ContactInfo> contacts = m.getContacts(); for (ContactInfo c : contacts) { System.out.println(String.format("Number: %s Name: %s", c.number, c.name)); } return 0; }
Source:
<code><START> public String getId() { <END> return name; }</code><technical_language>This unused</technical_language>

Target:
public String getId() { return getType() + ":" + getName(); }
Source:
<code>public void getsMultipleSingleSelection() throws Exception { bot.radio("SWT.MULTI").click(); bot.checkBox("Multiple Columns").select(); bot.checkBox("Listen").select(); bot.button("Clear").click(); tree = bot.treeInGroup("Tree"); tree.select(new int[] { 1, 2 }); TableCollection selection = tree.selection(); assertEquals("Node 2", selection.get(0, 0)); assertEquals("databases", selection.get(0, 1)); assertEquals("2556", selection.get(0, 2)); assertEquals("tomorrow", selection.get(0, 3)); assertEquals(new TableRow(new String[] { "Node 3", "images", "91571", "yesterday" }), selection.get(1)); SWTBotText text = bot.textInGroup("Listeners"); <START> assertEventMatches(text, "Selection [13]: SelectionEvent{Tree time=-550222256 data=null item=TreeItem {Node 2} detail=0 x=0 y=0 width=0 height=0 stateMask=0x80000 text=null doit=true}"); <END> assertEventMatches(text, "MouseDown [3]: MouseEvent{Tree time=-550222259 data=null button=1 stateMask=0x0 x=0 y=0 count=1}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Tree time=-550222255 data=null button=1 stateMask=0x80000 x=0 y=0 count=1}"); assertEventMatches(text, "Selection [13]: SelectionEvent{Tree time=-550222256 data=null item=TreeItem {Node 3} detail=0 x=0 y=0 width=0 height=0 stateMask=0xc0000 text=null doit=true}"); assertEventMatches(text, "MouseDown [3]: MouseEvent{Tree time=-550222259 data=null button=1 stateMask=0x40000 x=0 y=0 count=1}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Tree time=-550222255 data=null button=1 stateMask=0xc0000 x=0 y=0 count=1}"); }</code><technical_language>Selection MouseDown</technical_language>

Target:
public void getsMultipleSingleSelection() throws Exception { bot.radio("SWT.MULTI").click(); bot.checkBox("Multiple Columns").select(); bot.checkBox("Listen").select(); bot.button("Clear").click(); tree = bot.treeInGroup("Tree"); tree.select(new int[] { 1, 2 }); TableCollection selection = tree.selection(); assertEquals("Node 2", selection.get(0, 0)); assertEquals("databases", selection.get(0, 1)); assertEquals("2556", selection.get(0, 2)); assertEquals("tomorrow", selection.get(0, 3)); assertEquals(new TableRow(new String[] { "Node 3", "images", "91571", "yesterday" }), selection.get(1)); SWTBotText text = bot.textInGroup("Listeners"); assertEventMatches(text, "MouseDown [3]: MouseEvent{Tree time=-550222259 data=null button=1 stateMask=0x0 x=0 y=0 count=1}"); assertEventMatches(text, "Selection [13]: SelectionEvent{Tree time=-550222256 data=null item=TreeItem {Node 2} detail=0 x=0 y=0 width=0 height=0 stateMask=0x80000 text=null doit=true}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Tree time=-550222255 data=null button=1 stateMask=0x80000 x=0 y=0 count=1}"); assertEventMatches(text, "MouseDown [3]: MouseEvent{Tree time=-550222259 data=null button=1 stateMask=0x40000 x=0 y=0 count=1}"); assertEventMatches(text, "Selection [13]: SelectionEvent{Tree time=-550222256 data=null item=TreeItem {Node 3} detail=0 x=0 y=0 width=0 height=0 stateMask=0xc0000 text=null doit=true}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Tree time=-550222255 data=null button=1 stateMask=0xc0000 x=0 y=0 count=1}"); }
Source:
<code>boolean isLandscape() { <START> final DisplayMetrics metrics = playerImpl != null && playerImpl.getParentActivity() != null ? <END> playerImpl.getParentActivity().getResources().getDisplayMetrics() : getResources().getDisplayMetrics(); return metrics.heightPixels < metrics.widthPixels; }</code><technical_language>Add parenthesis suggestion final DisplayMetrics metrics = (playerImpl != null && playerImpl.getParentActivity() != null)</technical_language>

Target:
boolean isLandscape() { final DisplayMetrics metrics = (playerImpl != null && playerImpl.getParentActivity() != null) ? playerImpl.getParentActivity().getResources().getDisplayMetrics() : getResources().getDisplayMetrics(); return metrics.heightPixels < metrics.widthPixels; }