auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private AbstractPanel getStatusPanel() { NotesTableModel notesTableModel = new NotesTableModel(); notesTable.setModel(notesTableModel); ExtensionHistory extHist = org.parosproxy.paros.control.Control.getSingleton().getExtensionLoader() .getExtension(ExtensionHistory.class); if (extHist != null) { <START> int LastHistoryId = extHist.getLastHistoryId(); <END> int i = 0; while (i++ < LastHistoryId) { HistoryReference hr = extHist.getHistoryReference(i); if (hr != null) { if (hr.hasNote()) { eventConsumerImpl.addRowToNotesTable(i); } } } } notesTable.setColumnSelectionAllowed(false); notesTable.setCellSelectionEnabled(false); notesTable.setRowSelectionAllowed(true); notesTable.setAutoCreateRowSorter(true); notesTable.setColumnControlVisible(true); notesTable .getSelectionModel() .addListSelectionListener(new NotesTableSelectionHandler(notesTable, extHist)); exportButton = new TableExportButton<>(notesTable); JPanel buttonContainer = new JPanel(); buttonContainer.setLayout(new BoxLayout(buttonContainer, BoxLayout.X_AXIS)); buttonContainer.add(reload); buttonContainer.add(exportButton); JPanel pContainer = new JPanel(); pContainer.setLayout(new BoxLayout(pContainer, BoxLayout.Y_AXIS)); pContainer.add(buttonContainer); pContainer.add(new JScrollPane(notesTable)); if (statusPanel != null) { statusPanel.removeAll(); statusPanel.add(pContainer); } else { statusPanel = new AbstractPanel(); statusPanel.setLayout(new CardLayout()); statusPanel.setName(Constant.messages.getString(PREFIX + ".panel.title")); statusPanel.setIcon(ICON); statusPanel.add(pContainer); } return statusPanel; }</code><technical_language>sense move history reference loop update/refresh/reload function refreshes table. statusPanel a member of this class setup init. Instead of removing re-initializing reload</technical_language>

Target:
private AbstractPanel getStatusPanel() { if (statusPanel == null) { statusPanel = new AbstractPanel(); statusPanel.setLayout(new BorderLayout()); statusPanel.setName(Constant.messages.getString(PREFIX + ".panel.title")); statusPanel.setIcon(ICON); statusPanel.add(getToolBar(), BorderLayout.NORTH); statusPanel.add(new JScrollPane(getNotesTable()), BorderLayout.CENTER); } return statusPanel; }
Source:
<code><START> protected void executeCommand() { <END> VDS vds = vdsDao.get(getVdsId()); HostUpgradeManagerResult hostUpgradeManagerResult; try { hostUpgradeManagerResult = availableUpdatesFinder.isUpdateAvailable(vds); if (hostUpgradeManagerResult.isUpdatesAvailable()) { String message = hostUpgradeManagerResult.getAvailablePackages() == null ? "found updates." : String.format("found updates for packages %s", StringUtils.join(hostUpgradeManagerResult.getAvailablePackages(), ", ")); addCustomValue("Message", message); vds.getDynamicData().setUpdateAvailable(hostUpgradeManagerResult.isUpdatesAvailable()); vdsDynamicDao.updateUpdateAvailable(vds.getId(), hostUpgradeManagerResult.isUpdatesAvailable()); } else { addCustomValue("Message", "no updates found."); } getReturnValue().setActionReturnValue(hostUpgradeManagerResult); setSucceeded(true); setCommandStatus(CommandStatus.SUCCEEDED); } catch (Exception e) { log.error("Failed to check if updates are available for host '{}'", vds.getName()); setSucceeded(false); setCommandStatus(CommandStatus.FAILED); } }</code><technical_language>command is complete handling of 'check for updates' - in VdsManager.availableUpdates implements logic</technical_language>

Target:
protected void executeCommand() { HostUpgradeManagerResult hostUpgradeManagerResult = resourceManager.getVdsManager(getVdsId()).checkForUpdates(vdsDao.get(getVdsId())); getReturnValue().setActionReturnValue(hostUpgradeManagerResult); setSucceeded(hostUpgradeManagerResult != null); setCommandStatus(hostUpgradeManagerResult != null ? CommandStatus.SUCCEEDED : CommandStatus.FAILED); }
Source:
<code>public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int indexOfChangeIdLine = 0; boolean inFooter = false; for (int i = lines.length - 1; i >= 0; --i) { if (!inFooter && isEmptyLine(lines[i])) continue; inFooter = true; <START> if (changeIdPattern.matcher(lines[i].trim()).matches()) { <END> indexOfChangeIdLine = i; break; } else if (isEmptyLine(lines[i]) || i == 0) return -1; } int indexOfChangeIdLineinString = 0; for (int i = 0; i < indexOfChangeIdLine; ++i) indexOfChangeIdLineinString += lines[i].length() + delimiter.length(); return indexOfChangeIdLineinString; }</code><technical_language>I trim this leads strange effects amending a commit message indented Change-Id in footer, e.g. test Change-ID: Ic4bfb17d790c1250b7bfc22589bfe473d1509151 in staging view amending a commit deletes Change-Id wrong</technical_language>

Target:
public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int indexOfChangeIdLine = 0; boolean inFooter = false; for (int i = lines.length - 1; i >= 0; --i) { if (!inFooter && isEmptyLine(lines[i])) continue; inFooter = true; if (changeIdPattern.matcher(lines[i].trim()).matches()) { indexOfChangeIdLine = i; break; } else if (isEmptyLine(lines[i]) || i == 0) return -1; } int indexOfChangeIdLineinString = 0; for (int i = 0; i < indexOfChangeIdLine; ++i) indexOfChangeIdLineinString += lines[i].length() + delimiter.length(); return indexOfChangeIdLineinString + lines[indexOfChangeIdLine].indexOf(CHANGE_ID); }
Source:
<code>public Double getAggregate(AverageAccumulator<Double> result) { <START> return (result.value)/result.count; <END> }</code><technical_language>I suggest check count is 0, return null (so aggregate constraint simply match) in case</technical_language>

Target:
public Double getAggregate(AverageAccumulator<Double> result) { return (result.count == 0) ? null : ((double)result.value)/result.count; }
Source:
<code>public InputStream getObject(String bucketName, String objectName, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException { if ((sse.getType() == ServerSideEncryption.Type.SSE_S3) || (sse.getType() == ServerSideEncryption.Type.SSE_KMS)) { throw new InvalidArgumentException("Encryption type is not supported for this operation."); <START> } else if ((sse.getType() == ServerSideEncryption.Type.SSE_C) && (!this.baseUrl.isHttps())) { <END> throw new InvalidArgumentException("SSE_C provided keys must be made over a secure connection."); } else { Map<String, String> headers = new HashMap<>(); sse.marshal(headers); HttpResponse response = executeGet(bucketName, objectName, headers, null); return response.body().byteStream(); } }</code><technical_language>SSE_C operations performed a secure connection</technical_language>

Target:
public InputStream getObject(String bucketName, String objectName, ServerSideEncryption sse) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException { if ((sse.getType() == ServerSideEncryption.Type.SSE_S3) || (sse.getType() == ServerSideEncryption.Type.SSE_KMS)) { throw new InvalidArgumentException("GetObject doesn't support encryption type " + sse.getType()); } else if ((sse.getType() == ServerSideEncryption.Type.SSE_C) && (!this.baseUrl.isHttps())) { throw new InvalidArgumentException("SSE_C provided keys must be made over a secure connection."); } Map<String, String> headers = new HashMap<>(); sse.marshal(headers); HttpResponse response = executeGet(bucketName, objectName, headers, null); return response.body().byteStream(); }
Source:
<code>public void standbyShouldNotPerformRestoreAtStartup() throws InterruptedException, ExecutionException { final int numMessages = 10; final int key = 1; final Semaphore semaphore = new Semaphore(0); final StreamsBuilder builder = new StreamsBuilder(); builder .table(INPUT_TOPIC_NAME, Consumed.with(Serdes.Integer(), Serdes.Integer()), Materialized.<Integer, Integer, KeyValueStore<Bytes, byte[]>>as(TABLE_NAME) .withCachingDisabled()) .toStream() .peek((k, v) -> semaphore.release()); <START> final KafkaStreams client1 = createClient(builder, streamsConfiguration()); <END> final KafkaStreams client2 = createClient(builder, streamsConfiguration()); final List<KafkaStreams> clients = Arrays.asList(client1, client2); final AtomicLong restoreStartOffset = new AtomicLong(-1); clients.forEach(client -> { client.setGlobalStateRestoreListener(createTrackingRestoreListener(restoreStartOffset)); client.start(); }); waitForClientsToEnterRunningState(clients, 60, TimeUnit.SECONDS); produceValueRange(key, 0, 10); assertThat("all messages in the first batch were processed in a timely manner", semaphore.tryAcquire(numMessages, 60, TimeUnit.SECONDS)); assertThat("no restore has occurred", restoreStartOffset.get(), is(equalTo(-1L))); }</code><technical_language>nit: client1 -> kafkaStreams1 createClient -> createKafkaStreams (similar for other variables clientStates etc) technically a client, consumer producer consumer/producer variable name -- easier read -- unclear client is</technical_language>

Target:
public void standbyShouldNotPerformRestoreAtStartup() throws Exception { final int numMessages = 10; final int key = 1; final Semaphore semaphore = new Semaphore(0); final StreamsBuilder builder = new StreamsBuilder(); builder .table(INPUT_TOPIC_NAME, Consumed.with(Serdes.Integer(), Serdes.Integer()), Materialized.<Integer, Integer, KeyValueStore<Bytes, byte[]>>as(TABLE_NAME) .withCachingDisabled()) .toStream() .peek((k, v) -> semaphore.release()); final KafkaStreams kafkaStreams1 = createKafkaStreams(builder, streamsConfiguration()); final KafkaStreams kafkaStreams2 = createKafkaStreams(builder, streamsConfiguration()); final List<KafkaStreams> kafkaStreamsList = Arrays.asList(kafkaStreams1, kafkaStreams2); produceValueRange(key, 0, 10); final AtomicLong restoreStartOffset = new AtomicLong(-1); kafkaStreamsList.forEach(kafkaStreams -> { kafkaStreams.setGlobalStateRestoreListener(createTrackingRestoreListener(restoreStartOffset, new AtomicLong())); kafkaStreams.start(); }); waitForKafkaStreamssToEnterRunningState(kafkaStreamsList, 60, TimeUnit.SECONDS); assertThat(semaphore.tryAcquire(numMessages, 60, TimeUnit.SECONDS), is(equalTo(true))); assertThat(restoreStartOffset.get(), is(equalTo(-1L))); }
Source:
<code><START> public static URI getRelativeOutputPath(URI baseInputDir, URI inputFile, URI outputDir) { <END> URI relativePath = baseInputDir.relativize(inputFile); Preconditions.checkState(relativePath.getPath().length() > 0 && !relativePath.equals(inputFile), "Unable to extract out the relative path based on base input path: " + baseInputDir); String outputDirStr = outputDir.toString(); outputDir = !outputDirStr.endsWith("/") ? URI.create(outputDirStr.concat("/")) : outputDir; URI relativeOutputURI = outputDir.resolve(relativePath).resolve("."); return relativeOutputURI; }</code><technical_language>this method private</technical_language>

Target:
private static URI getRelativeOutputPath(URI baseInputDir, URI inputFile, URI outputDir) { URI relativePath = baseInputDir.relativize(inputFile); Preconditions.checkState(relativePath.getPath().length() > 0 && !relativePath.equals(inputFile), "Unable to extract out the relative path based on base input path: " + baseInputDir); String outputDirStr = outputDir.toString(); outputDir = !outputDirStr.endsWith("/") ? URI.create(outputDirStr.concat("/")) : outputDir; URI relativeOutputURI = outputDir.resolve(relativePath).resolve("."); return relativeOutputURI; }
Source:
<code>public void deactivate() { <START> logger.debug("Stoppig AKM868 listener..."); <END> if (packetlistener != null) packetlistener.stopListener(); }</code><technical_language>i expect a "stop listener" message in a method stopListener(). move statement change wording</technical_language>

Target:
public void deactivate() { logger.debug("Deactivating AKM868 binding..."); stopListener(); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; if (getClass() != obj.getClass()) return false; GoalDto other = (GoalDto) obj; if (id == null) { <START> if (other.id != null) <END> return false; } else if (!id.equals(other.id)) return false; return true; }</code><technical_language>write this shorter return other.id == null;</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (getClass() != obj.getClass()) { return false; } GoalDto that = (GoalDto) obj; if (this.id == that.id) { return true; } if (this.id == null) { return false; } return this.id.equals(that.id); }
Source:
<code>public void thatLoggingIsntBrokenOnCleanup() throws Exception { BadLogApp.runMe(new String[]{"server"}); LOGGER.info("I'm tearDown the test"); Thread.sleep(100); assertThat(new String(out.toByteArray(), UTF_8)) .contains("Mayday we're going down") <START> .contains("I'm tearDown the test"); <END> assertThat(new String(err.toByteArray(), UTF_8)) .contains("I'm a bad app"); }</code><technical_language>after/tearDown suffered fate</technical_language>

Target:
public void thatLoggingIsntBrokenOnCleanup() throws Exception { BadLogApp.runMe(new String[]{"server"}); LOGGER.info("I'm after the test"); Thread.sleep(100); assertThat(new String(out.toByteArray(), UTF_8)) .contains("Mayday we're going down") .contains("I'm after the test"); assertThat(new String(err.toByteArray(), UTF_8)) .contains("I'm a bad app"); }
Source:
<code>public String socialLogin(@RequestParam(value = "type", required = false) String type, ModelMap model, Locale locale) { String socialSignInErrorMessage = messageSource.getMessage("social.signin.failed", new String[] {}, locale); SocialSignInStatus socialSignInStatus = SocialSignInStatus.getSocialSignInStatus(type); String socialSignInCompletionStatus = "danger"; if (type != null) { switch (socialSignInStatus) { case REGISTRATION_SUCCESS: socialSignInErrorMessage = messageSource.getMessage("social.registration.success", new String[] {}, locale); socialSignInCompletionStatus = "success"; break; case REGISTRATION_FAILED: socialSignInErrorMessage = messageSource.getMessage("social.registration.failed", new String[] {}, locale); <START> break; <END> } } model.addAttribute("social_signin_message", socialSignInErrorMessage); model.addAttribute("social_signin_completion_status", socialSignInCompletionStatus); return "login"; }</code><technical_language>case statements indented</technical_language>

Target:
public String socialLogin(@RequestParam(value = "type", required = false) String type, ModelMap model, Locale locale) { String socialSignInErrorMessage = messageSource.getMessage("social.signin.failed", new String[] {}, locale); SocialSignInStatus socialSignInStatus = SocialSignInStatus.getSocialSignInStatus(type); String messageType = "danger"; if (type != null) { switch (socialSignInStatus) { case REGISTRATION_SUCCESS: socialSignInErrorMessage = messageSource.getMessage("social.registration.success", new String[] {}, locale); messageType = "success"; break; case REGISTRATION_FAILED: socialSignInErrorMessage = messageSource.getMessage("social.registration.failed", new String[] {}, locale); break; case ACCOUNT_APPROVAL_PENDING: socialSignInErrorMessage = messageSource.getMessage("social.account.approval.pending", new String[] {}, locale); messageType = "info"; break; } } model.addAttribute("social_signin_message", socialSignInErrorMessage); model.addAttribute("message_type", messageType); return "login"; }
Source:
<code>public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { String input = variableMap.getString(HRID_TX_WIDGET_NAME); ArrayList<String> hridTxs = new ArrayList<String>(Arrays.asList(input.split("\\r?\\n"))); for (String hridTx : hridTxs) { String[] pairs = hridTx.split("[,\\s]+"); <START> String hridNumber = pairs[0]; <END> TransactionRecord parentTransactionId = TransactionManager.getTransactionId(Integer.valueOf(pairs[1])); try { Artifact art = ArtifactQuery.getArtifactFromId(hridNumber, AtsUtil.getAtsBranch()); if (art.isOfType(AtsArtifactTypes.TeamWorkflow)) { TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) art; if (AtsBranchManagerCore.isCommittedBranchExists(teamArt)) { AWorkbench.popup("Committed branch already exists. Can not create another working branch once changes have been committed."); return; } AtsBranchManagerCore.createWorkingBranch(teamArt, parentTransactionId, true); } else { AWorkbench.popup("ERROR", "Must enter a Team Workflow HRID"); return; } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }</code><technical_language>Check size of pairs it. throw exception if 2 skip one</technical_language>

Target:
public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { String input = variableMap.getString(HRID_TX_WIDGET_NAME); ArrayList<String> hridTxs = new ArrayList<String>(Arrays.asList(input.split("\\r?\\n"))); for (String hridTx : hridTxs) { String[] pairs = hridTx.split("[,\\s]+"); if (pairs.length == PAIR_SIZE) { String hridNumber = pairs[0]; TransactionRecord parentTransactionId = TransactionManager.getTransactionId(Integer.valueOf(pairs[1])); try { Artifact art = ArtifactQuery.getArtifactFromId(hridNumber, AtsUtil.getAtsBranch()); if (art.isOfType(AtsArtifactTypes.TeamWorkflow)) { TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) art; if (AtsBranchManagerCore.isCommittedBranchExists(teamArt)) { AWorkbench.popup("Committed branch already exists. Can not create another working branch once changes have been committed."); return; } AtsBranchManagerCore.createWorkingBranch(teamArt, parentTransactionId, true); } else { AWorkbench.popup("ERROR", "Must enter a Team Workflow HRID"); return; } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } else { log(String.format("Skipping Input [%s] - Not in usage format <Team Workflow HRID, TransactionId> \n", Arrays.toString(pairs))); } } }
Source:
<code>public void testIteratorNext() { GridPartitionStateMap map = new GridPartitionStateMap(); initMap(map); Iterator<Map.Entry<Integer, GridDhtPartitionState>> iter = map.entrySet().iterator(); Map.Entry<Integer, GridDhtPartitionState> entry1 = iter.next(); Map.Entry<Integer, GridDhtPartitionState> entry2 = iter.next(); iter.remove(); assertNotNull(entry1.getValue()); assertNotNull(entry2.getValue()); <START> assertNotEquals(entry1.getKey(), entry2.getKey()); <END> assertNotEquals(entry1.getValue(), entry2.getValue()); }</code><technical_language>I suggest add space sematic block</technical_language>

Target:
public void testIteratorNext() { GridPartitionStateMap map = new GridPartitionStateMap(); initMap(map); Iterator<Map.Entry<Integer, GridDhtPartitionState>> iter = map.entrySet().iterator(); for (int i = 0; i < map.size() + 1; i++) assertTrue(iter.hasNext()); Map.Entry<Integer, GridDhtPartitionState> entry1 = iter.next(); for (int i = 0; i < map.size() + 1; i++) assertTrue(iter.hasNext()); Map.Entry<Integer, GridDhtPartitionState> entry2 = iter.next(); iter.remove(); assertNotNull(entry1.getValue()); assertNotNull(entry2.getValue()); assertEquals(Integer.valueOf(0), entry1.getKey()); assertEquals(Integer.valueOf(1), entry2.getKey()); assertEquals(GridDhtPartitionState.MOVING, entry1.getValue()); assertEquals(GridDhtPartitionState.RENTING, entry2.getValue()); }
Source:
<code>public void searchesBouts() throws Exception { final Inbox inbox = NbRule.get().aliases().iterate().iterator().next().inbox(); final Bout first = inbox.bout(inbox.start()); final String firsttitle = "bout1 title"; first.rename(firsttitle); first.messages().post("hello"); final Bout second = inbox.bout(inbox.start()); final String secondtitle = "bout2 title"; second.rename(secondtitle); second.messages().post("message with term"); final String thirdtitle = "bout title with term"; inbox.bout(inbox.start()).rename(thirdtitle); <START> final List<String> titles = new ArrayList<>(16); <END> for (final Bout bout : inbox.search("term")) { titles.add(bout.title()); } MatcherAssert.assertThat( titles, Matchers.hasItem(Matchers.equalTo(secondtitle)) ); MatcherAssert.assertThat( titles, Matchers.hasItem(Matchers.equalTo(thirdtitle)) ); MatcherAssert.assertThat( titles, Matchers.not(Matchers.hasItem(Matchers.equalTo(firsttitle))) ); }</code><technical_language>@CarlosGines 16? LinkedList</technical_language>

Target:
public void searchesBouts() throws Exception { final Inbox inbox = NbRule.get().aliases().iterate().iterator().next().inbox(); final Bout first = inbox.bout(inbox.start()); final String firsttitle = "bout1 title"; first.rename(firsttitle); first.messages().post("hello"); final Bout second = inbox.bout(inbox.start()); final String secondtitle = "bout2 title"; second.rename(secondtitle); second.messages().post("message with term"); final String thirdtitle = "bout title with term"; inbox.bout(inbox.start()).rename(thirdtitle); final List<String> titles = new LinkedList<>(); for (final Bout bout : inbox.search("term")) { titles.add(bout.title()); } MatcherAssert.assertThat( titles, Matchers.hasItems(secondtitle, thirdtitle) ); MatcherAssert.assertThat( titles, Matchers.not(Matchers.hasItem(firsttitle)) ); }
Source:
<code>private void initSubTabLayoutPanel() { if (subTabLayoutpanel == null) { subTabLayoutpanel = new TabLayoutPanel(20, Unit.PX); subTabLayoutpanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { if (object != null) { object.setActiveDetailModel(object.getDetailModels().get(event.getSelectedItem())); <START> if (event.getSelectedItem() == 2) { <END> generalView.setMainTabSelectedItem((VM) object.getSelectedItem()); } } } }); ScrollPanel generalPanel = new ScrollPanel(); DetailModelProvider<VmListModel, VmGeneralModel> modelProvider = new DetailModelProvider<VmListModel, VmGeneralModel>() { @Override public VmGeneralModel getModel() { return (VmGeneralModel) object.getDetailModels().get(0); } @Override public void onSubTabSelected() { } }; generalView = new ImportVmGeneralSubTabView(modelProvider, constants); generalPanel.add(generalView); subTabLayoutpanel.add(generalPanel, constants.importVmGeneralSubTabLabel()); ScrollPanel nicPanel = new ScrollPanel(); nicPanel.add(nicTable); subTabLayoutpanel.add(nicPanel, constants.importVmNetworkIntefacesSubTabLabel()); ScrollPanel diskPanel = new ScrollPanel(); diskPanel.add(diskTable); subTabLayoutpanel.add(diskPanel, constants.importVmVirualDisksSubTabLabel()); ScrollPanel appPanel = new ScrollPanel(); appPanel.add(appTable); subTabLayoutpanel.add(appPanel, constants.importVmApplicationslSubTabLabel()); } }</code><technical_language>== 2? 1. This named 2. disks default? (not I mind, still)</technical_language>

Target:
private void initSubTabLayoutPanel() { if (subTabLayoutpanel == null) { subTabLayoutpanel = new TabLayoutPanel(20, Unit.PX); subTabLayoutpanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { if (object != null) { object.setActiveDetailModel(object.getDetailModels().get(event.getSelectedItem())); if (event.getSelectedItem() == 0) { generalView.setMainTabSelectedItem((VM) object.getSelectedItem()); } } } }); ScrollPanel generalPanel = new ScrollPanel(); DetailModelProvider<VmListModel, VmGeneralModel> modelProvider = new DetailModelProvider<VmListModel, VmGeneralModel>() { @Override public VmGeneralModel getModel() { return (VmGeneralModel) object.getDetailModels().get(0); } @Override public void onSubTabSelected() { } }; generalView = new ImportVmGeneralSubTabView(modelProvider, constants); generalPanel.add(generalView); subTabLayoutpanel.add(generalPanel, constants.importVmGeneralSubTabLabel()); ScrollPanel nicPanel = new ScrollPanel(); nicPanel.add(nicTable); subTabLayoutpanel.add(nicPanel, constants.importVmNetworkIntefacesSubTabLabel()); ScrollPanel diskPanel = new ScrollPanel(); diskPanel.add(diskTable); subTabLayoutpanel.add(diskPanel, constants.importVmVirualDisksSubTabLabel()); ScrollPanel appPanel = new ScrollPanel(); appPanel.add(appTable); subTabLayoutpanel.add(appPanel, constants.importVmApplicationslSubTabLabel()); } }
Source:
<code><START> public void customWithUriVars() throws Exception { <END> MockHttpServletRequest request = formLogin().loginProcessingUrl("/uri-login/{var1}/{var2}", "val1", "val2") .user("username", "admin").password("password", "secret").buildRequest(this.servletContext); CsrfToken token = (CsrfToken) request .getAttribute(CsrfRequestPostProcessor.TestCsrfTokenRepository.TOKEN_ATTR_NAME); assertThat(request.getParameter("username")).isEqualTo("admin"); assertThat(request.getParameter("password")).isEqualTo("secret"); assertThat(request.getMethod()).isEqualTo("POST"); assertThat(request.getParameter(token.getParameterName())) .isEqualTo(token.getToken()); assertThat(request.getRequestURI()).isEqualTo("/uri-login/val1/val2"); }</code><technical_language>This throws clause is redundant</technical_language>

Target:
public void customWithUriVars() { MockHttpServletRequest request = formLogin().loginProcessingUrl("/uri-login/{var1}/{var2}", "val1", "val2") .user("username", "admin").password("password", "secret").buildRequest(this.servletContext); CsrfToken token = (CsrfToken) request .getAttribute(CsrfRequestPostProcessor.TestCsrfTokenRepository.TOKEN_ATTR_NAME); assertThat(request.getParameter("username")).isEqualTo("admin"); assertThat(request.getParameter("password")).isEqualTo("secret"); assertThat(request.getMethod()).isEqualTo("POST"); assertThat(request.getParameter(token.getParameterName())) .isEqualTo(token.getToken()); assertThat(request.getRequestURI()).isEqualTo("/uri-login/val1/val2"); }
Source:
<code>public IBorderItemLocator getNewBorderItemLocator(IFigure mainFigure) { <START> ParameterPositionLocator locator = new ParameterPositionLocator(mainFigure, PositionConstants.NONE); return locator; <END> }</code><technical_language>return (Sonar rule)</technical_language>

Target:
public IBorderItemLocator getNewBorderItemLocator(IFigure mainFigure) { return new ParameterPositionLocator(mainFigure, PositionConstants.NONE); }
Source:
<code>public static void checkRInstallation(final boolean has_chart_output) { <START> if(has_chart_output) { <END> try { RExecutor.executeFromClasspath("picard/analysis/checkRInstallation.R"); } catch (htsjdk.samtools.SAMException e) { throw new PicardException("R is not installed on this machine. It is required for creating the chart."); } } }</code><technical_language>space if (</technical_language>

Target:
public static boolean checkRInstallation(final boolean has_chart_output) { if (has_chart_output) { try { RExecutor.executeFromClasspath("picard/analysis/checkRInstallation.R"); } catch (htsjdk.samtools.SAMException e) { return false; } } return true; }
Source:
<code>public void testNormalizerCannotMergeNonAdjacentRegions() { final TableName tableName = TableName.valueOf(name.getMethodName()); <START> final byte[][] keys = { <END> null, Bytes.toBytes("aa"), Bytes.toBytes("aa1"), Bytes.toBytes("aa1!"), Bytes.toBytes("aa2"), null, }; final List<RegionInfo> regionInfos = createRegionInfos(tableName, keys); final Map<byte[], Integer> regionSizes = createRegionSizesMap(regionInfos, 3, 1, 3, 1, 5); setupMocksForNormalizer(regionSizes, regionInfos); List<NormalizationPlan> plans = normalizer.computePlansForTable(tableName); assertThat(plans, empty()); }</code><technical_language>is a nice move, thank you! I tested patch(sort based regioninfo in getMergePlan()), passed for me. Debugged a bit, regionInfos() is sorted based STARTKEY. need simulate is order in master, changing keys final byte[][] keys = { null, Bytes.toBytes("aa"), Bytes.toBytes("aa1!"), Bytes.toBytes("aa1"), Bytes.toBytes("aa2"), null, }; fix it. regionInfo is key based, order matter</technical_language>

Target:
public void testNormalizerCannotMergeNonAdjacentRegions() { final TableName tableName = TableName.valueOf(name.getMethodName()); final byte[][] keys = { null, Bytes.toBytes("aa"), Bytes.toBytes("aa1!"), Bytes.toBytes("aa1"), Bytes.toBytes("aa2"), null, }; final List<RegionInfo> regionInfos = createRegionInfos(tableName, keys); final Map<byte[], Integer> regionSizes = createRegionSizesMap(regionInfos, 3, 1, 1, 3, 5); setupMocksForNormalizer(regionSizes, regionInfos); List<NormalizationPlan> plans = normalizer.computePlansForTable(tableName); assertThat(plans, empty()); }
Source:
<code>private String getTypeString(ColumnSelectorFactory metricFactory) { String type = inputType; if (type == null) { ColumnCapabilities capabilities = metricFactory.getColumnCapabilities(fieldName); if (capabilities != null) { type = StringUtils.toLowerCase(capabilities.getType().name()); } else { <START> type = "float"; <END> } } return type; }</code><technical_language>nit: worth a static variable</technical_language>

Target:
private String getTypeString(ColumnSelectorFactory metricFactory) { String type = inputType; if (type == null) { ColumnCapabilities capabilities = metricFactory.getColumnCapabilities(fieldName); if (capabilities != null) { type = StringUtils.toLowerCase(capabilities.getType().name()); } else { type = StringUtils.toLowerCase(ValueType.FLOAT.name()); } } return type; }
Source:
<code>@Override public Enumerable<Object[]> scan(final DataContext root) { final AtomicBoolean cancelFlag = DataContext.Variable.CANCEL_FLAG.get(root); return new AbstractEnumerable<Object[]>() { public Enumerator<Object[]> enumerator() { Properties consumerConfig = new Properties(); consumerConfig.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, tableOptions.getBootstrapServers()); consumerConfig.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArrayDeserializer"); consumerConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArrayDeserializer"); if (tableOptions.getConsumerParams() != null) { consumerConfig.putAll(tableOptions.getConsumerParams()); } Consumer consumer; if (tableOptions.getConsumer() != null) { consumer = tableOptions.getConsumer(); } else { consumer = new KafkaConsumer<>(consumerConfig); } if (tableOptions.getTimestamp() != -1) { consumer.subscribe(Collections.singletonList(tableOptions.getTopicName()), new ConsumerRebalanceListener() { @Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) { } @Override public void onPartitionsAssigned(Collection<TopicPartition> partitions) { seekOnTimestamp(consumer, tableOptions.getTopicName(), tableOptions.getTimestamp()); } <START> }); <END> } else { consumer.subscribe(Collections.singletonList(tableOptions.getTopicName())); } return new KafkaMessageEnumerator(consumer, tableOptions.getRowConverter(), cancelFlag); } }; }</code><technical_language>seekToTimestamp is name</technical_language>

Target:
@Override public Enumerable<Object[]> scan(final DataContext root) { final AtomicBoolean cancelFlag = DataContext.Variable.CANCEL_FLAG.get(root); return new AbstractEnumerable<Object[]>() { public Enumerator<Object[]> enumerator() { Properties consumerConfig = new Properties(); consumerConfig.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, tableOptions.getBootstrapServers()); consumerConfig.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArrayDeserializer"); consumerConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArrayDeserializer"); if (tableOptions.getConsumerParams() != null) { consumerConfig.putAll(tableOptions.getConsumerParams()); } Consumer consumer; if (tableOptions.getConsumer() != null) { consumer = tableOptions.getConsumer(); } else { consumer = new KafkaConsumer<>(consumerConfig); } if (tableOptions.getTimestamp() != -1) { consumer.subscribe(Collections.singletonList(tableOptions.getTopicName()), new ConsumerRebalanceListener() { @Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) { } @Override public void onPartitionsAssigned(Collection<TopicPartition> partitions) { seekToTimestamp(consumer, tableOptions.getTopicName(), tableOptions.getTimestamp()); } }); } else { consumer.subscribe(Collections.singletonList(tableOptions.getTopicName())); } return new KafkaMessageEnumerator(consumer, tableOptions.getRowConverter(), cancelFlag); } }; }
Source:
<code>private void checkForCredentialUri(LiteralTree literal) { String possibleUrl = CheckUtils.trimQuotes(literal.value()); URI uri = null; try { uri = new URI(possibleUrl); } catch (URISyntaxException e) { return; } if (uri.getUserInfo() != null) { Matcher m = Pattern.compile("(\\S+):(\\S+)").matcher(uri.getUserInfo()); <START> if (m.find() && !m.group(1).equals(m.group(2)) && !DEFAULT_CREDENTIAL_URI_PATTERN.matcher(uri.getUserInfo()).find()) { <END> context().newIssue(this, literal, MESSAGE_URI); } } }</code><technical_language>a regular expression for DEFAULT_CREDENTIAL_URI_PATTERN, I simpler userInfo.equals("user:password") || userInfo.equals("username:password")</technical_language>

Target:
private void checkForCredentialUri(LiteralTree literal) { String possibleUrl = CheckUtils.trimQuotes(literal.value()); URI uri = null; try { uri = new URI(possibleUrl); } catch (URISyntaxException e) { return; } if (uri.getUserInfo() != null) { String userInfo = uri.getUserInfo(); Matcher m = Pattern.compile("(\\S+):(\\S+)").matcher(userInfo); if (m.find() && !m.group(1).equals(m.group(2)) && !userInfo.equals("user:password") && !userInfo.equals("username:password")) { context().newIssue(this, literal, MESSAGE_URI); } } }
Source:
<code>public void persistMethodToSession( Session session, int contextId, SessionManagementMethod method) throws DatabaseException { if (!(method instanceof ScriptBasedSessionManagementMethod)) { throw new UnsupportedSessionManagementMethodException( "Script based session management type only supports: " + ScriptBasedSessionManagementMethod.class.getName()); } ScriptBasedSessionManagementMethod scriptMethod = (ScriptBasedSessionManagementMethod) method; session.setContextData( contextId, RecordContext.TYPE_SESSION_MANAGEMENT_FIELD_1, <START> scriptMethod.script.getName()); <END> session.setContextData( contextId, RecordContext.TYPE_SESSION_MANAGEMENT_FIELD_2, EncodingUtils.mapToString(scriptMethod.paramValues)); }</code><technical_language>save context script (or import context)</technical_language>

Target:
public void persistMethodToSession( Session session, int contextId, SessionManagementMethod method) throws DatabaseException { if (!(method instanceof ScriptBasedSessionManagementMethod)) { throw new UnsupportedSessionManagementMethodException( "Script based session management type only supports: " + ScriptBasedSessionManagementMethod.class.getName()); } ScriptBasedSessionManagementMethod scriptMethod = (ScriptBasedSessionManagementMethod) method; if (scriptMethod.script != null) { session.setContextData( contextId, RecordContext.TYPE_SESSION_MANAGEMENT_FIELD_1, scriptMethod.script.getName()); } session.setContextData( contextId, RecordContext.TYPE_SESSION_MANAGEMENT_FIELD_2, EncodingUtils.mapToString(scriptMethod.paramValues)); }
Source:
<code>private static boolean isDateOrCollection(VariableTree variableTree) { <START> return variableTree.symbol().type().is("java.util.Date") || <END> (variableTree.symbol().type().isSubtypeOf("java.util.Collection") && !variableTree.symbol().type().isSubtypeOf("com.google.common.collect.ImmutableCollection")); }</code><technical_language>extract type variableTree.symbol().type() in order call 3 times in worst cases</technical_language>

Target:
private static boolean isDateOrCollection(VariableTree variableTree) { Type type = variableTree.symbol().type(); return type.is("java.util.Date") || (type.isSubtypeOf("java.util.Collection") && !type.isSubtypeOf("com.google.common.collect.ImmutableCollection")); }
Source:
<code>private int <START> handleSystemPropertiesIntegerValue(String <END> property, int defaultValue) { int value = defaultValue; try { value = Integer.parseInt(System.getProperty(property)); } catch (NumberFormatException exception) { IStatus status = new Status(IStatus.WARNING, SiriusServerPlugin.PLUGIN_ID, Messages.SiriusServerConfigurator_wrongPropertyTypeWarning, exception); SiriusServerPlugin.getPlugin().getLog().log(status); } return value; }</code><technical_language>I propose replace this code: private int handleSystemPropertiesIntegerValue(String property, int defaultValue) { int = defaultValue; Integer valueInt = Integer.getInteger(property); if (valueInt == null) { IStatus status = new Status(IStatus.WARNING, SiriusServerPlugin.PLUGIN_ID, MessageFormat.format(Messages.SiriusServerConfigurator_wrongPropertyTypeWarning, property, defaultValue)); SiriusServerPlugin.getPlugin().getLog().log(status); } else { = valueInt.intValue(); } return value; } avoid display a call stack in console is a warning</technical_language>

Target:
private int handleSystemPropertiesIntegerValue(String property, int defaultValue) { int value = defaultValue; String propertyValue = System.getProperty(property); try { value = Integer.parseInt(propertyValue); } catch (NumberFormatException exception) { String message = String.format(Messages.SiriusServerConfigurator_wrongPropertyTypeWarning, propertyValue); IStatus status = new Status(IStatus.ERROR, SiriusServerPlugin.PLUGIN_ID, message, exception); SiriusServerPlugin.getPlugin().getLog().log(status); } return value; }
Source:
<code>private KdumpDetectionResult detectHostKdumping() { VdsKdumpStatus kdumpStatus; long messageInterval = TimeUnit.SECONDS.toMillis( Config.<Integer>getValue(ConfigValues.FenceKdumpMessageInterval)); Calendar cal = Calendar.getInstance(); cal.add(Calendar.SECOND, Config.<Integer>getValue(ConfigValues.KdumpStartedTimeout)); long timeout = cal.getTimeInMillis(); boolean kdumpDetected = false; while (true) { if (!isListenerAlive()) { return KdumpDetectionResult.LISTENER_NOT_ALIVE; } kdumpStatus = vdsKdumpStatusDao.get(getVdsId()); if (kdumpStatus == null) { if (timeout < System.currentTimeMillis()) { return KdumpDetectionResult.KDUMP_NOT_DETECTED; } } else { if (!kdumpDetected) { kdumpDetected = true; auditLogDirector.log(this, AuditLogType.KDUMP_FLOW_DETECTED_ON_VDS); setVdsStatus(VDSStatus.Kdumping); restartVdsVms(); executeFenceVdsManuallyAction(); } if (kdumpStatus.getStatus() == KdumpFlowStatus.FINISHED) { <START> auditLogDirector.log(this, AuditLogType.KDUMP_FLOW_FINISHED_ON_VDS); <END> setVdsStatus(VDSStatus.NonResponsive); return KdumpDetectionResult.KDUMP_FINISHED; } } ThreadUtils.sleep(messageInterval); } }</code><technical_language>do need explicit logging? Logging performed command result defined in getAuditLogTypeValue(), I missing something</technical_language>

Target:
private KdumpDetectionResult detectHostKdumping() { VdsKdumpStatus kdumpStatus; long messageInterval = TimeUnit.SECONDS.toMillis( Config.<Integer>getValue(ConfigValues.FenceKdumpMessageInterval)); Calendar cal = Calendar.getInstance(); cal.add(Calendar.SECOND, Config.<Integer>getValue(ConfigValues.KdumpStartedTimeout)); long timeout = cal.getTimeInMillis(); boolean kdumpDetected = false; while (true) { if (!isListenerAlive()) { return KdumpDetectionResult.LISTENER_NOT_ALIVE; } kdumpStatus = vdsKdumpStatusDao.get(getVdsId()); if (kdumpStatus == null) { if (timeout < System.currentTimeMillis()) { return KdumpDetectionResult.KDUMP_NOT_DETECTED; } } else { if (!kdumpDetected) { kdumpDetected = true; auditLogDirector.log(this, AuditLogType.KDUMP_FLOW_DETECTED_ON_VDS); setVdsStatus(VDSStatus.Kdumping); restartVdsVms(); executeFenceVdsManuallyAction(); } if (kdumpStatus.getStatus() == KdumpFlowStatus.FINISHED) { setVdsStatus(VDSStatus.NonResponsive); return KdumpDetectionResult.KDUMP_FINISHED; } } ThreadUtils.sleep(messageInterval); } }
Source:
<code>public String generateReplacementToken(String token, int len){ StringBuffer newToken = new StringBuffer(); int passes = 1; if(len > 32){ passes = (len/32) + 1; } for(int i = 0; i < passes; i++){ newToken.append( <START> ("" + (UUID.nameUUIDFromBytes(token.getBytes())).toString()) <END> .replaceAll("-", "") ); } String replacement = newToken.toString().substring(0, len); return replacement; }</code><technical_language>suggestion UUID.nameUUIDFromBytes(token.getBytes()).toString()</technical_language>

Target:
public String generateReplacementToken(String token, int len){ StringBuilder newToken = new StringBuilder(); int passes = 1; if(len > 32){ passes = (len/32) + 1; } for(int i = 0; i < passes; i++){ newToken.append( UUID.nameUUIDFromBytes(token.getBytes()).toString() .replaceAll("-", "") ); } String replacement = newToken.toString().substring(0, len); return replacement; }
Source:
<code><START> public synchronized void flush() throws IOException { <END> flushRotatedLogs(); flushCurrentLog(); }</code><technical_language>reason synchronized method</technical_language>

Target:
public void flush() throws IOException { flushRotatedLogs(); flushCurrentLog(); }
Source:
<code>public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { <START> if (loading) { <END> if (totalItemCount > previousTotal) { loading = false; previousTotal = totalItemCount; currentPage++; } } if (!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) { processLoadRegisteredUsers(); loading = true; } }</code><technical_language>Surround this this check (alCustomizationSettings.isRegisteredUserContactListCall() || ApplozicSetting.getInstance(getActivity()).isRegisteredUsersContactCall()) && Utils.isInternetAvailable(getActivity().getApplicationContext()) && TextUtils.isEmpty(userPreference.getContactsGroupId())</technical_language>

Target:
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (loading && ((alCustomizationSettings.isRegisteredUserContactListCall() || ApplozicSetting.getInstance(getActivity()).isRegisteredUsersContactCall()) && Utils.isInternetAvailable(getActivity().getApplicationContext()) && TextUtils.isEmpty(userPreference.getContactsGroupId())) && (totalItemCount > previousTotal)) { loading = false; previousTotal = totalItemCount; currentPage++; } if ((!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) && (!MobiComKitPeopleActivity.isSearching)) { processLoadRegisteredUsers(); loading = true; } }
Source:
<code>int deliver(String urlString, JsonStream.Streamable streamable, Map<String, String> headers) throws DeliveryFailureException { checkHasNetworkConnection(); HttpURLConnection conn = null; try { URL url = new URL(urlString); conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setChunkedStreamingMode(0); conn.addRequestProperty("Content-Type", "application/json"); for (Map.Entry<String, String> entry : headers.entrySet()) { conn.addRequestProperty(entry.getKey(), entry.getValue()); } JsonStream stream = null; try { OutputStream out = conn.getOutputStream(); Charset charset = Charset.forName("UTF-8"); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, charset)); stream = new JsonStream(writer); streamable.toStream(stream); } finally { IOUtils.closeQuietly(stream); } return conn.getResponseCode(); } catch (IOException exception) { throw new DeliveryFailureException("IOException encountered in request", exception); } catch (Exception exception) { Logger.warn("Unexpected error delivering payload", exception); <START> return 400; <END> } finally { IOUtils.close(conn); } }</code><technical_language>This a constant, more declarative 400 is here</technical_language>

Target:
int deliver(String urlString, JsonStream.Streamable streamable, Map<String, String> headers) throws DeliveryFailureException { checkHasNetworkConnection(); HttpURLConnection conn = null; try { URL url = new URL(urlString); conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setChunkedStreamingMode(0); conn.addRequestProperty("Content-Type", "application/json"); for (Map.Entry<String, String> entry : headers.entrySet()) { conn.addRequestProperty(entry.getKey(), entry.getValue()); } JsonStream stream = null; try { OutputStream out = conn.getOutputStream(); Charset charset = Charset.forName("UTF-8"); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, charset)); stream = new JsonStream(writer); streamable.toStream(stream); } finally { IOUtils.closeQuietly(stream); } return conn.getResponseCode(); } catch (IOException exception) { throw new DeliveryFailureException("IOException encountered in request", exception); } catch (Exception exception) { Logger.warn("Unexpected error delivering payload", exception); return HTTP_BAD_REQUEST; } finally { IOUtils.close(conn); } }
Source:
<code>public static GridClient startClient(GridClientConfiguration clientCfg) throws Exception { GridClient client = GridClientFactory.start(clientCfg); if (!client.connected()) { GridClientException lastErr = client.checkLastError(); <START> client.close(); <END> throw lastErr; } return client; }</code><technical_language>if close() throws another exception? lastErr lost. try-catch client.close() put exception suppressed if happens</technical_language>

Target:
public static GridClient startClient(GridClientConfiguration clientCfg) throws Exception { GridClient client = GridClientFactory.start(clientCfg); if (!client.connected()) { GridClientException lastErr = client.checkLastError(); try { client.close(); } catch (Throwable e) { lastErr.addSuppressed(e); } throw lastErr; } return client; }
Source:
<code>public boolean allowsScriptWithNonce(@Nonnull String nonce) { if (this.allowsUnsafeInlineScript()) { return true; } ScriptSrcElemDirective scriptSrcElemDirective = this.getDirectiveByType(ScriptSrcElemDirective.class); <START> if (scriptSrcElemDirective == null) { <END> ScriptSrcDirective scriptSrcDirective = this.getDirectiveByType(ScriptSrcDirective.class); if (scriptSrcDirective == null) { return this.defaultsAllowNonce(nonce); } return scriptSrcDirective.matchesNonce(nonce); } return scriptSrcElemDirective.matchesNonce(nonce); }</code><technical_language>flatten this branching testing != null instead returning</technical_language>

Target:
public boolean allowsScriptWithNonce(@Nonnull String nonce) { if (this.allowsUnsafeInlineScript()) { return true; } ScriptSrcElemDirective scriptSrcElemDirective = this.getDirectiveByType(ScriptSrcElemDirective.class); if (scriptSrcElemDirective != null) { return scriptSrcElemDirective.matchesNonce(nonce); } ScriptSrcDirective scriptSrcDirective = this.getDirectiveByType(ScriptSrcDirective.class); if (scriptSrcDirective != null) { return scriptSrcDirective.matchesNonce(nonce); } return this.defaultsAllowNonce(nonce); }
Source:
<code>public static Drawable getBuildImage(String state) { Context context = TravisApp.getAppContext(); switch (state) { case STATE_CREATED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_created_16dp); case STATE_STARTED: AnimatedVectorDrawableCompat drawable = AnimatedVectorDrawableCompat .create(context, R.drawable.ic_build_state_started_16dp); <START> drawable.start(); <END> return drawable; case STATE_PASSED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_passed_16dp); case STATE_CANCELED: case STATE_ERRORED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_errored_16dp); case STATE_FAILED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_failed_16dp); default: return null; } }</code><technical_language>is NullPointerException</technical_language>

Target:
public static Drawable getBuildImage(String state) { Context context = TravisApp.getAppContext(); switch (state) { case STATE_CREATED: case STATE_STARTED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_created_16dp); case STATE_PASSED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_passed_16dp); case STATE_CANCELED: case STATE_ERRORED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_errored_16dp); case STATE_FAILED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_failed_16dp); default: return null; } }
Source:
<code>public T getLens() { <START> return lens; <END> }</code><technical_language>this</technical_language>

Target:
public T getLens() { return this.lens; }