auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void switchToTab(String tabName) { if (GitHubURL.isPullRequestLoaded(getCurrentUrl())) { int tabIndex = 0; switch(tabName) { case GithubPageElements.DISCUSSION_TAB: tabIndex = 1; break; case GithubPageElements.COMMITS_TAB: tabIndex = 2; break; case GithubPageElements.FILES_TAB: tabIndex = 3; break; default: <START> return; <END> } String xpath = " driver.findElement(By.xpath(String.format(xpath, tabIndex))).click(); } }</code><technical_language>this assertion</technical_language>

Target:
public void switchToTab(String tabName) { if (GitHubURL.isPullRequestLoaded(getCurrentUrl())) { int tabIndex = 0; switch(tabName) { case GithubPageElements.DISCUSSION_TAB: tabIndex = 1; break; case GithubPageElements.COMMITS_TAB: tabIndex = 2; break; case GithubPageElements.FILES_TAB: tabIndex = 3; break; default: assert false; return; } String xpath = " clickElementByXpath(String.format(xpath, tabIndex)); } }
Source:
<code>protected void parse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Element report = DomUtils.getChildElementByTagName(element, XMLConstants.REPORT); if (report!=null) { BeanDefinition bean = parserContext.getDelegate().parseCustomElement(report, builder.getBeanDefinition()); parserContext.getRegistry().registerBeanDefinition(XMLConstants.CUSTOM_REPORTING_SERVICE,bean); } initListeners(element,parserContext, builder); Element testPlan = DomUtils.getChildElementByTagName(element, XMLConstants.TEST_PLAN); BeanDefinitionBuilder generator = BeanDefinitionBuilder.genericBeanDefinition(UserTaskGenerator.class); parserContext.getRegistry().registerBeanDefinition(XMLConstants.GENERATOR, generator.getBeanDefinition()); <START> if (!element.getAttribute(XMLConstants.MONITORING_ENABLE).isEmpty()){ <END> generator.addPropertyValue(XMLConstants.MONITORING_ENABLE, element.getAttribute(XMLConstants.MONITORING_ENABLE)); } setBeanProperty(XMLConstants.CONFIG, testPlan, parserContext, generator.getBeanDefinition()); builder.addPropertyValue(XMLConstants.TASKS, XMLConstants.GENERATOR_GENERATE); }</code><technical_language>monitoring parameter inheritance</technical_language>

Target:
protected void parse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Element report = DomUtils.getChildElementByTagName(element, XMLConstants.REPORT); String reportName = element.getAttribute(XMLConstants.ID)+"-report"; if (report!=null) { BeanDefinition bean = parserContext.getDelegate().parseCustomElement(report, builder.getBeanDefinition()); parserContext.getRegistry().registerBeanDefinition(reportName,bean); }else{ parserContext.getRegistry().registerAlias(reportName, XMLConstants.DEFAULT_REPORTING_SERVICE); } initListeners(element,parserContext, builder); Element testPlan = DomUtils.getChildElementByTagName(element, XMLConstants.TEST_PLAN); BeanDefinitionBuilder generator = BeanDefinitionBuilder.genericBeanDefinition(UserTaskGenerator.class); parserContext.getRegistry().registerBeanDefinition(XMLConstants.GENERATOR, generator.getBeanDefinition()); if (!element.getAttribute(XMLConstants.MONITORING_ENABLE).isEmpty()){ generator.addPropertyValue(XMLConstants.MONITORING_ENABLE, element.getAttribute(XMLConstants.MONITORING_ENABLE)); } generator.addPropertyValue(XMLConstants.CONFIG, parseCustomElement(testPlan, parserContext, generator.getBeanDefinition())); builder.addPropertyValue(XMLConstants.TASKS, XMLConstants.GENERATOR_GENERATE); }
Source:
<code>public int getMaxEnergyStored() { int total = 0; try { for( PartP2PFEPower t : PartP2PFEPower.this.getOutputs() ) { total += t.getOutput().getMaxEnergyStored(); } } <START> catch( GridAccessException e ) <END> { return 0; } return total; }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') log rethrow this exception. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public int getMaxEnergyStored() { int total = 0; try { for( PartP2PFEPower t : PartP2PFEPower.this.getOutputs() ) { total += t.getAttachedEnergyStorage().getMaxEnergyStored(); } } catch( GridAccessException e ) { return 0; } return total; }
Source:
<code>public static void main(String[] args) { <START> BasicConfigurator.configure(); <END> final String streamName = "test"; StreamClient streamClient = new RestStreamClient.Builder("localhost", 10000) .build(); try { streamClient.create(streamName); long currentTTL = streamClient.getTTL(streamName); LOG.info("Get TTL for stream: {}", currentTTL, streamName); long newTTL = 10009907; streamClient.setTTL(streamName, newTTL); LOG.info("Set new TTL for stream: {}", newTTL, streamName); currentTTL = streamClient.getTTL(streamName); LOG.info("Was TTL updated successfully? {}", currentTTL == newTTL ? "YES" : "NO"); StreamWriter streamWriter = streamClient.createWriter(streamName); String log = "192.0.2.0 - - [09/Apr/2012:08:40:43 -0400] \"GET /NoteBook/ HTTP/1.0\" 201 809 \"-\" " + "\"Example v0.0.0 (www.example.org)\""; ListenableFuture<Void> future = streamWriter.write(log, null); LOG.info("Future {}", future.get()); Futures.addCallback(future, new FutureCallback<Void>() { @Override public void onSuccess(Void contents) { LOG.info("Success write stream {}", streamName); } @Override public void onFailure(Throwable throwable) { LOG.error("Exception in stream write process", throwable); } }); streamWriter.close(); streamClient.close(); } catch (Exception e) { LOG.error(e.getMessage(), e); } }</code><technical_language>mentioned above. log4j</technical_language>

Target:
public static void main(String[] args) { final String streamName = "streamName"; try { StreamClient streamClient = RestStreamClient.builder("localhost", 10000).build(); StreamWriter streamWriter = streamClient.createWriter(streamName); try { streamClient.create(streamName); long currentTTL = streamClient.getTTL(streamName); LOG.info("Get TTL for stream: {}", currentTTL, streamName); long newTTL = 18000; streamClient.setTTL(streamName, newTTL); LOG.info("Set new TTL for stream: {}", newTTL, streamName); currentTTL = streamClient.getTTL(streamName); LOG.info("Was TTL updated successfully? {}", currentTTL == newTTL ? "YES" : "NO"); String log = "192.0.2.0 - - [09/Apr/2012:08:40:43 -0400] \"GET /NoteBook/ HTTP/1.0\" 201 809 \"-\" " + "\"Example v0.0.0 (www.example.org)\""; ListenableFuture<Void> future = streamWriter.write(log, null); LOG.info("Future {}", future.get()); Futures.addCallback(future, new FutureCallback<Void>() { @Override public void onSuccess(Void contents) { LOG.info("Success write stream {}", streamName); } @Override public void onFailure(Throwable throwable) { LOG.error("Exception in stream write process", throwable); } }); } finally { streamWriter.close(); streamClient.close(); } } catch (Exception e) { LOG.error(e.getMessage(), e); } }
Source:
<code>public void testExplain() throws Exception { createTable("explain_test"); insertData("explain_test"); try { String query1 = "SELECT * FROM explain_test"; driver.explain(query1,baseConf); String query2 = "SELECT * FROM explain_test1"; driver.explain(query2,baseConf); <START> } catch(GrillException ex) { <END> System.out.println("Error : " + ex); } }</code><technical_language>Put a try-catch for failing explain. do Assert.fail() explain for failing explain</technical_language>

Target:
public void testExplain() throws Exception { createTable("explain_test"); insertData("explain_test"); String query1 = "SELECT * FROM explain_test"; String query2 = "SELECT * FROM explain_test1"; driver.explain(query1,baseConf); try { driver.explain(query2,baseConf); Assert.fail("Running explain on a non existing table."); } catch(GrillException ex) { System.out.println("Error : " + ex); } }
Source:
<code>private void startPlayerActivity() { Intent intent = new Intent(this, OoyalaPlayerTokenPlayerActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.putExtra("embed_code", embedCode); intent.putExtra("pcode", pCode); intent.putExtra("domain", "<LINK_0>"); intent.putExtra("autoPlay", autoPlay); intent.putExtra("apikey", apiKey); intent.putExtra("secret", secret); intent.putExtra("accountid", accountId); <START> startActivityForResult(intent,1); <END> }</code><technical_language>do need call startActivityForResult()? in code onActivityResult() callback checking request code</technical_language>

Target:
private void startPlayerActivity() { Intent intent = new Intent(this, OoyalaPlayerTokenPlayerActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); intent.putExtra("embed_code", embedCode); intent.putExtra("className",this.getClass().getSimpleName()); intent.putExtra("pcode", pCode); intent.putExtra("domain", "<LINK_0>"); intent.putExtra("autoPlay", autoPlay); intent.putExtra("apikey", apiKey); intent.putExtra("secret", secret); intent.putExtra("accountid", accountId); startActivity(intent); }
Source:
<code>public float getPrefHeight () { layout = new GlyphLayout(style.font, model.getValue().toString()); <START> return Float.max(style.background.getMinHeight(), <END> style.background.getTopHeight() + style.background.getBottomHeight() + layout.height); }</code><technical_language>Float.max() is 1.8 work Android GWT. Math.max() instead</technical_language>

Target:
public float getPrefHeight () { return Math.max(style.background.getMinHeight(), style.background.getTopHeight() + style.background.getBottomHeight() + layout.height); }
Source:
<code>public void lock(Object owner) { <START> if (owner == null) { <END> throw new IllegalArgumentException("owner cannot be null"); } synchronized (this.lock) { if (owner.equals(this.owner)) { lockCount++; } else if (this.owner == null) { this.owner = owner; lockCount ++; } else { while (this.owner != null) { try { waiters++; try { lock.wait(); } finally { --waiters; } } catch (InterruptedException e) { throw new RuntimeException(e); } } this.owner = owner; lockCount ++; } } }</code><technical_language>I suggest utilizing <LINK_0> handle i18n of error message</technical_language>

Target:
public void lock(Object owner) { Assert.checkNotNullParam("owner", owner); synchronized (this.lock) { if (Objects.equals(owner, this.owner)) { lockCount++; } else if (this.owner == null) { this.owner = owner; lockCount ++; } else { while (this.owner != null) { try { waiters++; try { lock.wait(); } finally { --waiters; } } catch (InterruptedException e) { throw new RuntimeException(e); } } this.owner = owner; lockCount ++; } } }
Source:
<code>private void update(Username username, HttpLocalizedOperationResult result, EntityConfigUpdateCommand command, PackageRepository repository) { try { goConfigService.updateConfig(command, username); } catch (Exception e) { if (e instanceof GoConfigInvalidException && !result.hasMessage()) { result.unprocessableEntity(entityConfigValidationFailed(repository.getClass().getAnnotation(ConfigTag.class).value(), repository.getId(), e.getMessage())); } else if (e instanceof RulesViolationException || e instanceof SecretResolutionFailureException) { <START> LOGGER.error(e.getMessage(), e); <END> result.unprocessableEntity(saveFailedWithReason(e.getMessage())); } else { if (!result.hasMessage()) { LOGGER.error(e.getMessage(), e); result.internalServerError(saveFailedWithReason("An error occurred while saving the package repository config. Please check the logs for more information.")); } } } }</code><technical_language>log this error</technical_language>

Target:
private void update(Username username, HttpLocalizedOperationResult result, EntityConfigUpdateCommand command, PackageRepository repository) { try { goConfigService.updateConfig(command, username); } catch (Exception e) { if (e instanceof GoConfigInvalidException && !result.hasMessage()) { result.unprocessableEntity(entityConfigValidationFailed(repository.getClass().getAnnotation(ConfigTag.class).value(), repository.getId(), e.getMessage())); } else if (e instanceof RulesViolationException || e instanceof SecretResolutionFailureException) { result.unprocessableEntity(saveFailedWithReason(e.getMessage())); } else { if (!result.hasMessage()) { LOGGER.error(e.getMessage(), e); result.internalServerError(saveFailedWithReason("An error occurred while saving the package repository config. Please check the logs for more information.")); } } } }
Source:
<code>private void checkResponse(Response.StatusType statusType, String subject, String response) { switch (statusType.getFamily()) { case SUCCESSFUL: logger.info("Successful write to schema repo for subject {}", subject); break; case CLIENT_ERROR: logger.warn("Invalid schema for subject {}. Details: {}", subject, response); throw new InvalidSchemaException("Invalid schema. For more details see schema-repo logs."); case SERVER_ERROR: logger.error("Failure write to schema repo for subject {}. Reason: {}", subject, response); throw new SchemaRepoException("Failure write to schema-repo."); default: <START> break; <END> } }</code><technical_language>IMO, in case, throw IllegalStateException pass for this unexpected condition silently. Schema repo respond 3xx, if did, knowing that</technical_language>

Target:
private void checkResponse(Response.StatusType statusType, String subject, String response) { switch (statusType.getFamily()) { case SUCCESSFUL: logger.info("Successful write to schema repo for subject {}", subject); break; case CLIENT_ERROR: logger.warn("Invalid schema for subject {}. Details: {}", subject, response); throw new InvalidSchemaException("Invalid schema. For more details see schema-repo logs."); case SERVER_ERROR: logger.error("Failure write to schema repo for subject {}. Reason: {}", subject, response); throw new SchemaRepoException("Failure write to schema-repo."); default: logger.error("Unknown response from schema-repo. Subject {}, http status {}, Details: {}", subject, statusType.getStatusCode(), response); throw new SchemaRepoException("Unknown response from schema-repo"); } }
Source:
<code>public void onAgreeClicked() { <START> WatchExpression expression = new WatchExpressionImpl(view.getValue(), ""); <END> debuggerPresenter.onAddExpressionBtnClicked(expression); view.close(); }</code><technical_language>I guess add more constructor pass expression</technical_language>

Target:
public void onAgreeClicked() { WatchExpression expression = new WatchExpressionImpl(view.getValue()); debuggerPresenter.onAddExpressionBtnClicked(expression); view.close(); }
Source:
<code>public synchronized void addSegmentChangeRequests(List<DataSegmentChangeRequest> requests) { for (DataSegmentChangeRequest request : requests) { if (changes.size() >= maxSize) { <START> changes.remove(0); <END> } changes.add(new Holder(request, getLastCounter().inc())); } singleThreadedExecutor.execute(resolveWaitingFuturesRunnable); }</code><technical_language>This pre-mature optimization, I worry this data structure is used. option view list a revolving buffer essentially maintain index of oldest "valid" item. replace increment add start search wrapping around</technical_language>

Target:
public synchronized void addSegmentChangeRequests(List<DataSegmentChangeRequest> requests) { for (DataSegmentChangeRequest request : requests) { changes.add(new Holder(request, getLastCounter().inc())); } singleThreadedExecutor.execute(resolveWaitingFuturesRunnable); }
Source:
<code>public JSONObject getOperationSummary() { String operationSummaryJson = artifact.getSoleAttributeAsString(DispoConstants.OperationSummary, "{}"); try { JSONObject toReturn = new JSONObject(operationSummaryJson); return toReturn; <START> } catch (JSONException ex) { <END> throw new OseeCoreException("Could not parse Notes Json", ex); } }</code><technical_language>update throw text? copied</technical_language>

Target:
public JSONObject getOperationSummary() { String operationSummaryJson = artifact.getSoleAttributeAsString(DispoConstants.OperationSummary, "{}"); try { JSONObject toReturn = new JSONObject(operationSummaryJson); return toReturn; } catch (JSONException ex) { throw new OseeCoreException("Could not parse Operation Sumary Json", ex); } }
Source:
<code>public String getQuestionWithExistingResponseSubmissionFormHtml( boolean sessionIsOpen, int qnIdx, int responseIdx, String courseId, int totalNumRecipients, FeedbackResponseDetails existingResponseDetails) { FeedbackNumericalScaleResponseDetails numscaleResponseDetails = (FeedbackNumericalScaleResponseDetails) existingResponseDetails; return Templates.populateTemplate( FormTemplates.NUMSCALE_SUBMISSION_FORM, Slots.QUESTION_INDEX, Integer.toString(qnIdx), Slots.DISABLED, sessionIsOpen ? "" : "disabled", Slots.RESPONSE_INDEX, Integer.toString(responseIdx), Slots.MIN_SCALE, Integer.toString(minScale), Slots.MAX_SCALE, Integer.toString(maxScale), Slots.STEP, StringHelper.toDecimalFormatString(step), "${existingAnswer}", numscaleResponseDetails.getAnswerString(), "${possibleValuesString}", getPossibleValuesStringSubmit(), Slots.FEEDBACK_RESPONSE_TEXT, Const.ParamsNames.FEEDBACK_RESPONSE_TEXT, Slots.NUMSCALE_MIN, Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MIN, Slots.NUMSCALE_MAX, Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MAX, Slots.NUMSCALE_STEP, <START> Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_STEP); <END> }</code><technical_language>fine line breaks, short</technical_language>

Target:
public String getQuestionWithExistingResponseSubmissionFormHtml( boolean sessionIsOpen, int qnIdx, int responseIdx, String courseId, int totalNumRecipients, FeedbackResponseDetails existingResponseDetails) { FeedbackNumericalScaleResponseDetails numscaleResponseDetails = (FeedbackNumericalScaleResponseDetails) existingResponseDetails; return Templates.populateTemplate( FormTemplates.NUMSCALE_SUBMISSION_FORM, Slots.QUESTION_INDEX, Integer.toString(qnIdx), Slots.DISABLED, sessionIsOpen ? "" : "disabled", Slots.RESPONSE_INDEX, Integer.toString(responseIdx), Slots.MIN_SCALE, Integer.toString(minScale), Slots.MAX_SCALE, Integer.toString(maxScale), Slots.STEP, StringHelper.toDecimalFormatString(step), Slots.EXISTING_ANSWER, numscaleResponseDetails.getAnswerString(), Slots.POSSIBLE_VALUES_STRING, getPossibleValuesStringSubmit(), Slots.FEEDBACK_RESPONSE_TEXT, Const.ParamsNames.FEEDBACK_RESPONSE_TEXT, Slots.NUMSCALE_MIN, Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MIN, Slots.NUMSCALE_MAX, Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MAX, Slots.NUMSCALE_STEP, Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_STEP); }
Source:
<code>public VmSnapshotListModel() { setTitle(ConstantsManager.getInstance().getConstants().snapshotsTitle()); setHelpTag(HelpTag.snapshots); setHashName("snapshots"); setNewCommand(new UICommand("New", this)); setPreviewCommand(new UICommand("Preview", this)); setCustomPreviewCommand(new UICommand("CustomPreview", this)); setCommitCommand(new UICommand("Commit", this)); setUndoCommand(new UICommand("Undo", this)); setRemoveCommand(new UICommand("Remove", this)); setCloneVmCommand(new UICommand("CloneVM", this)); setCloneTemplateCommand(new UICommand("CloneTemplate", this)); setCanSelectSnapshot(new EntityModel()); getCanSelectSnapshot().setEntity(true); setSnapshotsMap(new HashMap<Guid, SnapshotModel>()); setVmDisks(new ArrayList<DiskImage>()); setComparator(new Comparator<Snapshot>() { @Override public int compare(Snapshot s1, Snapshot s2) { <START> int typeCompare = Boolean.compare( s1.getType() == SnapshotType.ACTIVE || s1.getType() == SnapshotType.PREVIEW, s2.getType() == SnapshotType.ACTIVE || s2.getType() == SnapshotType.PREVIEW); if (typeCompare != 0) { return typeCompare; } <END> return s2.getCreationDate().compareTo(s1.getCreationDate()); } }); }</code><technical_language>mistake - want ACTIVE PREVIEW snapshots FIRST, last, this result needs revered. for noise, giving -1 for visibility</technical_language>

Target:
public VmSnapshotListModel() { setTitle(ConstantsManager.getInstance().getConstants().snapshotsTitle()); setHelpTag(HelpTag.snapshots); setHashName("snapshots"); setNewCommand(new UICommand("New", this)); setPreviewCommand(new UICommand("Preview", this)); setCustomPreviewCommand(new UICommand("CustomPreview", this)); setCommitCommand(new UICommand("Commit", this)); setUndoCommand(new UICommand("Undo", this)); setRemoveCommand(new UICommand("Remove", this)); setCloneVmCommand(new UICommand("CloneVM", this)); setCloneTemplateCommand(new UICommand("CloneTemplate", this)); setCanSelectSnapshot(new EntityModel()); getCanSelectSnapshot().setEntity(true); setSnapshotsMap(new HashMap<Guid, SnapshotModel>()); setVmDisks(new ArrayList<DiskImage>()); setComparator(new Comparator<Snapshot>() { @Override public int compare(Snapshot s1, Snapshot s2) { int typeCompare = Boolean.compare( s1.getType() == SnapshotType.ACTIVE || s1.getType() == SnapshotType.PREVIEW, s2.getType() == SnapshotType.ACTIVE || s2.getType() == SnapshotType.PREVIEW); if (typeCompare != 0) { return -1 * typeCompare; } return s2.getCreationDate().compareTo(s1.getCreationDate()); } }); }
Source:
<code>public void testSSLFactory() throws Exception { SSLConfig sslConfig = TestSSLUtils.createSSLConfig(); SSLFactory sslFactory = new SSLFactory(sslConfig); SSLContext sslContext = sslFactory.getSSLContext(); SSLSocketFactory socketFactory = sslContext.getSocketFactory(); Assert.assertNotNull(socketFactory); SSLServerSocketFactory serverSocketFactory = sslContext.getServerSocketFactory(); Assert.assertNotNull(serverSocketFactory); SSLEngine clientSSLEngine = sslFactory.createSSLEngine("localhost", 9095, SSLFactory.Mode.CLIENT); Assert.assertEquals(sslContext.getProtocol(), "TLS"); Assert.assertEquals(sslContext.getProvider().getName(), "SunJSSE"); String[] enabledProtocols = clientSSLEngine.getEnabledProtocols(); Assert.assertEquals(enabledProtocols.length, 1); Assert.assertEquals(enabledProtocols[0], "TLSv1.2"); Assert.assertEquals(clientSSLEngine.getSSLParameters().getEndpointIdentificationAlgorithm(), "HTTPS"); Assert.assertEquals(clientSSLEngine.getNeedClientAuth(), false); Assert.assertEquals(clientSSLEngine.getUseClientMode(), true); Assert.assertEquals(clientSSLEngine.getWantClientAuth(), false); String[] enabledCipherSuites = clientSSLEngine.getEnabledCipherSuites(); Assert.assertEquals(enabledCipherSuites.length, 1); Assert.assertEquals(enabledCipherSuites[0], "TLS_RSA_WITH_AES_128_CBC_SHA256"); <START> SSLEngine serverSSLEngine = sslFactory.createSSLEngine("localhost", 9095, SSLFactory.Mode.SERVER); <END> enabledProtocols = serverSSLEngine.getEnabledProtocols(); Assert.assertEquals(enabledProtocols.length, 1); Assert.assertEquals(enabledProtocols[0], "TLSv1.2"); Assert.assertEquals(serverSSLEngine.getSSLParameters().getEndpointIdentificationAlgorithm(), null); Assert.assertEquals(serverSSLEngine.getNeedClientAuth(), true); Assert.assertEquals(serverSSLEngine.getUseClientMode(), false); Assert.assertEquals(serverSSLEngine.getWantClientAuth(), false); enabledCipherSuites = serverSSLEngine.getEnabledCipherSuites(); Assert.assertEquals(enabledCipherSuites.length, 1); Assert.assertEquals(enabledCipherSuites[0], "TLS_RSA_WITH_AES_128_CBC_SHA256"); }</code><technical_language>is difference verification in cases (client server). If of same, consider a utility method for verification purpose</technical_language>

Target:
public void testSSLFactory() throws Exception { SSLConfig sslConfig = TestSSLUtils.createSSLConfig("DC1,DC2,DC3"); SSLFactory sslFactory = new SSLFactory(sslConfig); SSLContext sslContext = sslFactory.getSSLContext(); SSLSocketFactory socketFactory = sslContext.getSocketFactory(); Assert.assertNotNull(socketFactory); SSLServerSocketFactory serverSocketFactory = sslContext.getServerSocketFactory(); Assert.assertNotNull(serverSocketFactory); SSLEngine clientSSLEngine = sslFactory.createSSLEngine("localhost", 9095, SSLFactory.Mode.CLIENT); SSLEngine serverSSLEngine = sslFactory.createSSLEngine("localhost", 9095, SSLFactory.Mode.SERVER); TestSSLUtils.verifySSLConfig(sslContext, clientSSLEngine, true); TestSSLUtils.verifySSLConfig(sslContext, serverSSLEngine, false); }
Source:
<code>private TaskData doInBackgroundDeleteDeck(TaskData... params) { Timber.d("doInBackgroundDeleteDeck"); Collection col = CollectionHelper.getInstance().getCol(mContext); long did = params[0].getLong(); col.getDecks().rem(did, true); final AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); final PendingIntent reminderIntent = PendingIntent.getBroadcast( mContext, (int) did, new Intent(mContext, ReminderReceiver.class).putExtra(ReminderService.EXTRA_DECK_ID, did), 0 ); <START> alarmManager.cancel(reminderIntent); <END> return new TaskData(true); }</code><technical_language>if this belongs here. more sense if service, handling alarm, checks if deck exists, cancel alarm if doesn't</technical_language>

Target:
private TaskData doInBackgroundDeleteDeck(TaskData... params) { Timber.d("doInBackgroundDeleteDeck"); Collection col = CollectionHelper.getInstance().getCol(mContext); long did = params[0].getLong(); col.getDecks().rem(did, true); return new TaskData(true); }
Source:
<code>public void testDefaultConfig() throws Exception { Files.write(springTestFile.toPath(), "modification".getBytes(), StandardOpenOption.SYNC); Thread.sleep(50); Files.write(springTestFile.toPath(), "modification 2".getBytes(), StandardOpenOption.SYNC); MockEndpoint mock = getMockEndpoint("mock:springTest"); <START> mock.setExpectedCount(1); END> mock.setResultWaitTime(1000); mock.assertIsSatisfied(); }</code><technical_language>changing expectation, related production code changed? events (modification modification 2) Please note this test is platform dependent. targetting Linux CI reports issues flakes this test. OS running tests? CI build is here: <LINK_0></technical_language>

Target:
public void testDefaultConfig() throws Exception { Files.write(springTestFile.toPath(), "modification".getBytes(), StandardOpenOption.SYNC); Thread.sleep(50); Files.write(springTestFile.toPath(), "modification 2".getBytes(), StandardOpenOption.SYNC); MockEndpoint mock = getMockEndpoint("mock:springTest"); mock.setExpectedCount(2); mock.setResultWaitTime(1000); mock.assertIsSatisfied(); }
Source:
<code>public EmbeddedZookeeper() throws IOException { <START> this(-1); <END> }</code><technical_language>change this line this(0) remove if (port == -1) in other constructor</technical_language>

Target:
public EmbeddedZookeeper() throws IOException { this(0); }
Source:
<code>private void addResponse(Operation operation, ApiResponse apiResponse) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders()); Map<String, Object> examples = parseExamples(apiResponse.examples()); Response response = new Response() <START> .description(apiResponse.message()).headers(responseHeaders).setExamples(examples); <END> if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }</code><technical_language>call response.setExamples() new line, need of modifying setter behaviour in response POJO</technical_language>

Target:
private void addResponse(Operation operation, ApiResponse apiResponse) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders()); Map<String, Object> examples = parseExamples(apiResponse.examples()); Response response = new Response().description(apiResponse.message()).headers(responseHeaders); response.setExamples(examples); if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }
Source:
<code>void testUpdateEntry(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws Exception { dbmsProcessor.setupSharedDatabase(); BibEntry expectedEntry = getBibEntryExample(); dbmsProcessor.insertEntry(expectedEntry); expectedEntry.setType(StandardEntryType.Book); expectedEntry.setField(StandardField.AUTHOR, "Michael J and Hutchings"); expectedEntry.setField(new UnknownField("customField"), "custom value"); expectedEntry.clearField(StandardField.BOOKTITLE); dbmsProcessor.updateEntry(expectedEntry); <START> Optional<BibEntry> actualEntryOptional = dbmsProcessor.getSharedEntry(expectedEntry.getSharedBibEntryData().getSharedID()); <END> assertEquals(expectedEntry, actualEntryOptional.get()); clear(dbmsConnection); }</code><technical_language>actualEntry a name</technical_language>

Target:
void testUpdateEntry(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws Exception { dbmsProcessor.setupSharedDatabase(); BibEntry expectedEntry = getBibEntryExample(); dbmsProcessor.insertEntry(expectedEntry); expectedEntry.setType(StandardEntryType.Book); expectedEntry.setField(StandardField.AUTHOR, "Michael J and Hutchings"); expectedEntry.setField(new UnknownField("customField"), "custom value"); expectedEntry.clearField(StandardField.BOOKTITLE); dbmsProcessor.updateEntry(expectedEntry); Optional<BibEntry> actualEntry = dbmsProcessor.getSharedEntry(expectedEntry.getSharedBibEntryData().getSharedID()); assertEquals(expectedEntry, actualEntry.get()); clear(dbmsConnection); }
Source:
<code>private KieTuple readObjectFromADifferentClassloader(Object o) { ObjectInput in = null; ObjectOutput out; ByteArrayInputStream bis; ByteArrayOutputStream bos = null; try { bos = new ByteArrayOutputStream(); out = new ObjectOutputStream(bos); out.writeObject(o); out.flush(); byte[] objBytes = bos.toByteArray(); bis = new ByteArrayInputStream(objBytes); in = new ObjectInputStream(bis); Object newObj = in.readObject(); return new KieTuple(newObj); } catch (NotSerializableException nse) { <START> logger.debug("Object it not serializable {}", nse.getMessage()); <END> StringBuilder sb = new StringBuilder("NotSerializableException:").append(nse.getMessage()); return new KieTuple(sb.toString()); } catch (IOException ioe) { StringBuilder sb = new StringBuilder("IOException:").append(ioe.getMessage()); return new KieTuple(sb.toString()); } catch (ClassNotFoundException cnfe) { StringBuilder sb = new StringBuilder("ClassNotFoundException:").append(cnfe.getMessage()); return new KieTuple(sb.toString()); } catch (Exception e) { StringBuilder sb = new StringBuilder("Exception:").append(e.getMessage()); return new KieTuple(sb.toString()); } finally { try { if (bos != null) { bos.close(); } if (in != null) { in.close(); } } catch (IOException ex) { logger.error(ex.getMessage()); } } }</code><technical_language>Is this message a debug level? reason hide customers in production</technical_language>

Target:
private KieTuple readObjectFromADifferentClassloader(Object o) { ObjectInput in = null; ObjectOutput out; ByteArrayInputStream bis; ByteArrayOutputStream bos = null; try { bos = new ByteArrayOutputStream(); out = new ObjectOutputStream(bos); out.writeObject(o); out.flush(); byte[] objBytes = bos.toByteArray(); bis = new ByteArrayInputStream(objBytes); in = new ObjectInputStream(bis); Object newObj = in.readObject(); return new KieTuple(newObj); } catch (NotSerializableException nse) { logger.warn("Object it not serializable {}", nse.getMessage()); StringBuilder sb = new StringBuilder("NotSerializableException:").append(nse.getMessage()); return new KieTuple(sb.toString()); } catch (IOException ioe) { StringBuilder sb = new StringBuilder("IOException:").append(ioe.getMessage()); return new KieTuple(sb.toString()); } catch (ClassNotFoundException cnfe) { StringBuilder sb = new StringBuilder("ClassNotFoundException:").append(cnfe.getMessage()); return new KieTuple(sb.toString()); } catch (Exception e) { StringBuilder sb = new StringBuilder("Exception:").append(e.getMessage()); return new KieTuple(sb.toString()); } finally { try { if (bos != null) { bos.close(); } if (in != null) { in.close(); } } catch (IOException ex) { logger.error(ex.getMessage()); } } }
Source:
<code>private String[] loadMinimizedTargets( @NotNull Consumer<String> statusConsumer, @Nullable ProcessAdapter processAdapter ) throws IOException, ExecutionException { statusConsumer.consume("Determining optimal import set..."); final File outputFile = FileUtil.createTempFile("pants_minimzie_run", ".out"); final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); commandLine.addParameter("minimize"); commandLine.addParameter("--minimize-output-file=" + outputFile.getPath()); <START> commandLine.addParameter("::"); <END> LOG.debug(commandLine.toString()); final ProcessOutput processOutput = PantsUtil.getCmdOutput(commandLine, processAdapter); if (processOutput.getStdout().contains("no such option")) { throw new ExternalSystemException("Pants doesn't have necessary APIs. Please upgrade you pants!"); } if (processOutput.checkSuccess(LOG)) { String output = FileUtil.loadFile(outputFile); return output.split("\n"); } else { throw new PantsExecutionException("Failed to update the project!", commandLine.getCommandLineString("pants"), processOutput); } }</code><technical_language>need getAllTargetAddresses instead of hardcoding ::, user selects buildroot/a/b/c:: do buildroot:: P.S. getAllTargetAddresses means target specs, of legacies I yet</technical_language>

Target:
private String[] loadMinimizedTargets( @NotNull Consumer<String> statusConsumer, @Nullable ProcessAdapter processAdapter ) throws IOException, ExecutionException { statusConsumer.consume("Determining optimal import set..."); final File outputFile = FileUtil.createTempFile("pants_minimzie_run", ".out"); final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); commandLine.addParameter("minimize"); commandLine.addParameter("--minimize-output-file=" + outputFile.getPath()); commandLine.addParameters(getAllTargetAddresses()); LOG.debug(commandLine.toString()); final ProcessOutput processOutput = PantsUtil.getCmdOutput(commandLine, processAdapter); if (processOutput.getStdout().contains("no such option")) { throw new ExternalSystemException("Pants doesn't have necessary APIs. Please upgrade you pants!"); } if (processOutput.checkSuccess(LOG)) { String output = FileUtil.loadFile(outputFile); return output.split("\n"); } else { throw new PantsExecutionException("Failed to update the project!", commandLine.getCommandLineString("pants"), processOutput); } }
Source:
<code>protected void createSentIndex() throws DbException { final Schema schema = MyriaConstants.SENT_SCHEMA; List<IndexRef> index = ImmutableList.of(IndexRef.of(schema, "queryId"), IndexRef.of(schema, "fragmentId"), IndexRef.of(schema, <START> "destWorkerId")); <END> try { accessMethod.createIndexIfNotExists(MyriaConstants.SENT_RELATION, schema, index); } catch (DbException e) { LOGGER.error("Couldn't create index for profiling logs:", e); } }</code><technical_language>tested this? I this index is more useful queryId fragmentId. I indexes postgres is a difference. GroupAggregate (cost=0.00..10479.85 rows=315 width=24) (actual time=0.019..0.019 rows=0 loops=1) -> Index Scan "public:logs__myria_indexes:Sending_0_1_4" "public:logs:Sending" (cost=0.00..10417.18 rows=5952 width=24) (actual time=0.018..0.018 rows=0 loops=1) Index Cond: ("queryId" = 4) Total runtime: 0.055 ms GroupAggregate (cost=0.00..10479.85 rows=315 width=24) -> Index Scan "public:logs:Sending_queryId_fragmentId_destWorkerId_idx" "public:logs:Sending" (cost=0.00..10417.18 rows=5952 width=24) Index Cond: ("queryId" = 4) HashAggregate (cost=10476.70..10479.85 rows=315 width=24) (actual time=0.022..0.022 rows=0 loops=1) -> Index Scan "public:logs:Sending_queryId_fragmentId_idx" "public:logs:Sending" (cost=0.00..10417.18 rows=5952 width=24) (actual time=0.021..0.021 rows=0 loops=1) Index Cond: ("queryId" = 4) Total runtime: 0.069 ms</technical_language>

Target:
protected void createSentIndex() throws DbException { final Schema schema = MyriaConstants.SENT_SCHEMA; List<IndexRef> index = ImmutableList.of(IndexRef.of(schema, "queryId"), IndexRef.of(schema, "fragmentId")); try { accessMethod.createIndexIfNotExists(MyriaConstants.SENT_RELATION, schema, index); } catch (DbException e) { LOGGER.error("Couldn't create index for profiling logs:", e); } }
Source:
<code>public static synchronized void init() { if (_initialized) { LOGGER.info("FunctionRegistry is already initialized"); return; } long startTimeMs = System.currentTimeMillis(); Reflections reflections = new Reflections( new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage("org.apache.pinot")) .filterInputsBy(new FilterBuilder.Include(".*\\.function\\..*")) .setScanners(new MethodAnnotationsScanner())); Set<Method> methodSet = reflections.getMethodsAnnotatedWith(ScalarFunction.class); for (Method method : methodSet) { ScalarFunction scalarFunction = method.getAnnotation(ScalarFunction.class); if (scalarFunction.enabled()) { if (!scalarFunction.name().isEmpty()) { FunctionRegistry.registerFunction(scalarFunction.name(), method); } else { FunctionRegistry.registerFunction(method); } } } <START> LOGGER.info("Initialized FunctionRegistry within {}ms", System.currentTimeMillis() - startTimeMs); <END> _initialized = true; }</code><technical_language>measuring time init functions? do expect a long time? Also, if logging useful log map size here, function registered</technical_language>

Target:
public static void init() { }
Source:
<code>public ArrayList<String> getNoisyLocationIDsAsStrings(SQLiteDatabase db, long activityId) { <START> Location zeroDegrees = new Location("null island"); END> zeroDegrees.setLatitude(0); zeroDegrees.setLongitude(0); Location oneDegrees = new Location(zeroDegrees); oneDegrees.setLatitude(1); double toleranceDeg = this.tolerance / zeroDegrees.distanceTo(oneDegrees); String[] pColumns = { "_id", Constants.DB.LOCATION.LATITUDE, Constants.DB.LOCATION.LONGITUDE, Constants.DB.LOCATION.TYPE }; Cursor c = db.query(Constants.DB.LOCATION.TABLE, pColumns, Constants.DB.LOCATION.ACTIVITY + " = " + activityId, null, null, null, Constants.DB.LOCATION.TIME); ArrayList<Location> locations = new ArrayList<>(); ArrayList<String> ids = new ArrayList<>(); ArrayList<String> simplifiedIDs = new ArrayList<>(); if (c.moveToFirst()) { do { int lstate = c.getInt(3); Location l = new Location(String.format("%d", c.getInt(0))); l.setLatitude(c.getDouble(1)); l.setLongitude(c.getDouble(2)); if (!gps_type_only || (lstate == Constants.DB.LOCATION.TYPE_GPS)) { ids.add(l.getProvider()); locations.add(l); } if ((lstate == Constants.DB.LOCATION.TYPE_PAUSE) || (lstate == Constants.DB.LOCATION.TYPE_END)) { if (locations.size() > 2) { Location[] simplifiedLocations = simplifySegment(locations, toleranceDeg); for (Location sl : simplifiedLocations) { simplifiedIDs.add(sl.getProvider()); } } locations = new ArrayList<>(); } } while (c.moveToNext()); } c.close(); ids.removeAll(simplifiedIDs); return ids; }</code><technical_language>new, this a point in activity instead</technical_language>

Target:
public ArrayList<String> getNoisyLocationIDsAsStrings(SQLiteDatabase db, long activityId) { String[] pColumns = { "_id", Constants.DB.LOCATION.LATITUDE, Constants.DB.LOCATION.LONGITUDE, Constants.DB.LOCATION.TYPE }; Cursor c = db.query(Constants.DB.LOCATION.TABLE, pColumns, Constants.DB.LOCATION.ACTIVITY + " = " + activityId, null, null, null, Constants.DB.LOCATION.TIME); ArrayList<Location> locations = new ArrayList<>(); ArrayList<String> ids = new ArrayList<>(); ArrayList<String> simplifiedIDs = new ArrayList<>(); if (c.moveToFirst()) { do { int lstate = c.getInt(3); Location l = new Location(String.format(Locale.US, "%d", c.getInt(0))); l.setLatitude(c.getDouble(1)); l.setLongitude(c.getDouble(2)); if (lstate == Constants.DB.LOCATION.TYPE_GPS) { ids.add(l.getProvider()); locations.add(l); } if ((lstate == Constants.DB.LOCATION.TYPE_PAUSE) || (lstate == Constants.DB.LOCATION.TYPE_END)) { if (locations.size() > 2) { Location[] simplifiedLocations = simplifySegment(locations); for (Location sl : simplifiedLocations) { simplifiedIDs.add(sl.getProvider()); } } locations = new ArrayList<>(); } } while (c.moveToNext()); } c.close(); ids.removeAll(simplifiedIDs); return ids; }
Source:
<code>public static SavingsAccountFragment newInstance(int id, boolean isGroupAccount) { SavingsAccountFragment savingsAccountFragment = new SavingsAccountFragment(); Bundle args = new Bundle(); <START> args.putInt(isGroupAccount ? Constants.GROUP_ID : Constants.CLIENT_ID, id); <END> savingsAccountFragment.setArguments(args); return savingsAccountFragment; }</code><technical_language>add isGroupAccount boolean in this bundle : java args.putBoolean(String key, boolean value)</technical_language>

Target:
public static SavingsAccountFragment newInstance(int id, boolean isGroupAccount) { SavingsAccountFragment savingsAccountFragment = new SavingsAccountFragment(); Bundle args = new Bundle(); args.putInt(isGroupAccount ? Constants.GROUP_ID : Constants.CLIENT_ID, id); args.putBoolean(Constants.GROUP_ACCOUNT, isGroupAccount); savingsAccountFragment.setArguments(args); return savingsAccountFragment; }
Source:
<code>private void visitBlock(IPDOMVisitor visitor) throws CoreException { Database db = linkage.getDB(); <START> for (int item = 0; item < nextMemberPosition; item++) { <END> final long memberRecord = db.getRecPtr(getMemberRecord(item)); if (record == 0) { throw new NullPointerException(); } PDOMNode node = linkage.getNode(memberRecord); if (visitor.visit(node) && node != null) { node.accept(visitor); } visitor.leave(node); } }</code><technical_language>Iterate encountering 0</technical_language>

Target:
private void visitBlock(IPDOMVisitor visitor) throws CoreException { if (record == 0) { throw new NullPointerException(); } int item = 0; long memberRecord; while ((memberRecord = getMemberRecord(item++)) != 0) { PDOMNode node = linkage.getNode(memberRecord); if (visitor.visit(node) && node != null) { node.accept(visitor); } visitor.leave(node); } }
Source:
<code>public List<FrameworkFulfillment> findByProjectModelId(Integer projectModelId) { return em().createQuery( "SELECT ff " + "FROM ProjectModel pm " + "JOIN pm.frameworkFulfillments ff " + "JOIN FETCH ff.frameworkElementImplementations fei " + "WHERE pm.id = :projectModelId " + <START> "AND ff.framework.availabilityStatus = 'AVAILABLE' ", <END> FrameworkFulfillment.class ).setParameter("projectModelId", projectModelId).getResultList(); }</code><technical_language>'AVAILABLE' hard-coded passed Hibernate parameter setParameter. Also, ease "find usages". problem in method below</technical_language>

Target:
public List<FrameworkFulfillment> findByProjectModelId(Integer projectModelId) { return em().createQuery( "SELECT ff " + "FROM ProjectModel pm " + "JOIN pm.frameworkFulfillments ff " + "JOIN FETCH ff.frameworkElementImplementations fei " + "WHERE pm.id = :projectModelId " + "AND ff.framework.availabilityStatus = :status ", FrameworkFulfillment.class) .setParameter("projectModelId", projectModelId) .setParameter("status", Framework.AvailabilityStatus.AVAILABLE.name()) .getResultList(); }
Source:
<code><START> public static void run(Repository repository, Work work) throws IOException { try (ConfigScope scope = new ConfigScope(repository)) { work.execute(); <END> } }</code><technical_language>confused me, eventually this next static method named other around? Right static run() calls instance execute, static execute() calls instance run. avoid confusion, eventually name 2 methods identically? confuse compiler? BTW: class I thought describing lambda idea</technical_language>

Target:
public static void run(Repository repository, Work work) throws IOException { try (ConfigScope scope = new ConfigScope(repository)) { work.run(); } }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.status) { startActivity(new Intent(getActivity(), StatusActivity.class)); return true; } else if (item.getItemId() == R.id.about) { startActivity(new Intent(getActivity(), AboutActivity.class)); return true; } else if (item.getItemId() == R.id.sosBroadcast) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View dialogView = inflater.inflate(R.layout.sos_setting_field, null); final EditText sosEditText = (EditText) dialogView.findViewById(R.id.sosEditText); String broadcast = sharedPreferences.getString(MainFragment.KEY_BROADCAST, ""); if(broadcast.trim().length() > 0) { sosEditText.setText(broadcast); } builder.setMessage(R.string.settings_sos_broadcast_summary) .setTitle(R.string.settings_sos_broadcast_title) .setView(dialogView); <START> builder.setPositiveButton("Save", new DialogInterface.OnClickListener() { <END> @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(KEY_BROADCAST, sosEditText.getText().toString()); editor.commit(); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); AlertDialog dialog = builder.create(); dialog.show(); } return super.onOptionsItemSelected(item); }</code><technical_language>Hardcoded text is acceptable</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.status) { startActivity(new Intent(getActivity(), StatusActivity.class)); return true; } else if (item.getItemId() == R.id.about) { startActivity(new Intent(getActivity(), AboutActivity.class)); return true; } else if (item.getItemId() == R.id.sosBroadcast) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View dialogView = inflater.inflate(R.layout.sos_setting_field, null); final EditText sosEditText = (EditText) dialogView.findViewById(R.id.sosEditText); String broadcast = sharedPreferences.getString(MainFragment.KEY_BROADCAST, ""); if (broadcast.trim().length() > 0) { sosEditText.setText(broadcast); } builder.setMessage(R.string.settings_sos_broadcast_summary) .setTitle(R.string.settings_sos_broadcast_title) .setView(dialogView); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(KEY_BROADCAST, sosEditText.getText().toString()); editor.commit(); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.create().show(); } return super.onOptionsItemSelected(item); }
Source:
<code>public static void setInstance(Object source, @MappingTarget Object target) { Integer level = LEVEL.get(); fireMethodCalled( level, "setInstance", source, target ); if ( level == null ) { LEVEL.set( 1 ); MAPPING.set( new IdentityHashMap<Object, Object>() ); } else { <START> LEVEL.set( level.intValue() + 1 ); <END> } MAPPING.get().put( source, target ); }</code><technical_language>needed unboxing</technical_language>

Target:
public static void setInstance(Object source, @MappingTarget Object target) { Integer level = LEVEL.get(); fireMethodCalled( level, "setInstance", source, target ); if ( level == null ) { LEVEL.set( 1 ); MAPPING.set( new IdentityHashMap<Object, Object>() ); } else { LEVEL.set( level + 1 ); } MAPPING.get().put( source, target ); }