auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Slot requestSlot(String filename, long fileSize, String contentType) throws SmackException.NotConnectedException, InterruptedException, XMPPException.XMPPErrorException, SmackException.NoResponseException { if (uploadService == null) { discoverUploadService(); } if (maxFileSize != null) { if (fileSize > maxFileSize) { throw new IllegalArgumentException("File size must not be greater than " + maxFileSize); } } SlotRequest slotRequest = new SlotRequest(filename, fileSize, contentType); <START> slotRequest.setTo(uploadService); <END> return connection().createStanzaCollectorAndSend(slotRequest).nextResultOrThrow(); }</code><technical_language>assumes uploadService set discoverUploadService(), true. uploadServiceDiscoveryed flag a SmackException thrown is false if user manually upload service</technical_language>

Target:
public Slot requestSlot(String filename, long fileSize, String contentType) throws SmackException, InterruptedException, XMPPException.XMPPErrorException { return requestSlot(filename, fileSize, contentType, null); }
Source:
<code>protected ActionResult execute() { data = new FileUploadPageData(account); BlobInfo blobInfo = extractImageKey(Const.ParamsNames.IMAGE_TO_UPLOAD); if (blobInfo == null) { data.isFileUploaded = false; data.fileSrcUrl = null; log.warning("Image Upload Failed"); statusToAdmin = "Image Upload Failed"; return createAjaxResult(data); } BlobKey blobKey = blobInfo.getBlobKey(); data.isFileUploaded = true; data.fileSrcUrl = Const.ActionURIs.PUBLIC_IMAGE_SERVE + "?blob-key=" + blobKey.getKeyString(); String absoluteFileSrcUrl = Config.getAppUrl(data.fileSrcUrl).toAbsoluteString(); log.info("New Image Uploaded : " + absoluteFileSrcUrl); statusToAdmin = "New Image Uploaded : " + "<a href=" <START> + data.fileSrcUrl + " target=blank>" + absoluteFileSrcUrl + "</a>"; <END> data.ajaxStatus = "Image Successfully Uploaded to Google Cloud Storage"; return createAjaxResult(data); }</code><technical_language>target=\"_blank\"</technical_language>

Target:
protected ActionResult execute() { data = prepareData(); return createAjaxResult(data); }
Source:
<code>private void removeNodeAndUpdateServers(final String hostToRemove) { <START> discoveredServerList.remove(hostToRemove); <END> if (!discoveredServerList.isEmpty()) { client.setServers(discoveredServerList); } else { client.setServers(bootstrapServerList); } }</code><technical_language>info/warn log action</technical_language>

Target:
protected void removeNodeAndUpdateServers(final String hostToRemove) { log.warn("Removing host {}", hostToRemove); discoveredServerList.remove(hostToRemove); if (log.isInfoEnabled()) { log.info("Discovered server pool is now: {}", StringUtils.join(discoveredServerList, ",")); } if (!discoveredServerList.isEmpty()) { client.setServers(discoveredServerList); } else { client.setServers(bootstrapServerList); } }
Source:
<code><START> public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { <END> Lg.i("onActivityResult"); if (requestCode == PICK_CONTACT && resultCode == RESULT_OK) { final Uri contactUri = data.getData(); final Cursor cursor = getActivity().getContentResolver().query(contactUri, null, null, null, null); if (cursor != null) { cursor.moveToFirst(); final String name = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.SORT_KEY_PRIMARY)); final String telephoneNumber = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); cursor.close(); final String simlarId = SimlarNumber.createSimlarId(telephoneNumber); Lg.i("contact: ", name, " ", telephoneNumber, " -> ", simlarId); CallActivity.createCallView(getActivity(), simlarId); } } }</code><technical_language>AFAIK, '{' is in extra line in code</technical_language>

Target:
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { if (requestCode != PICK_CONTACT) { Lg.e("onActivityResult with unknown requestCode=", requestCode); return; } if (resultCode != RESULT_OK) { Lg.i("onActivityResult with resultCode=", resultCode); return; } if (data == null) { Lg.e("onActivityResult without intent data"); return; } final Uri contactUri = data.getData(); if (contactUri == null) { Lg.e("onActivityResult without contactUri data=", data); return; } final Cursor cursor = getActivity().getContentResolver().query(contactUri, null, null, null, null); if (cursor == null) { Lg.e("onActivityResult failed to create cursor for contactUri=", contactUri); return; } cursor.moveToFirst(); final String name = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.SORT_KEY_PRIMARY)); final String telephoneNumber = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); cursor.close(); callContact(name, telephoneNumber); }
Source:
<code>private void analyzeMethod(Method m, ClassContext classContext) throws CFGBuilderException, DataflowAnalysisException { ConstantPoolGen cpg = classContext.getConstantPoolGen(); CFG cfg = classContext.getCFG(m); for (Iterator<Location> i = cfg.locationIterator(); i.hasNext(); ) { Location location = i.next(); Instruction inst = location.getHandle().getInstruction(); if (inst instanceof INVOKEINTERFACE) { INVOKEINTERFACE invoke = (INVOKEINTERFACE) inst; String methodName = invoke.getMethodName(cpg); String className = invoke.getClassName(cpg); if (className.equals("javax.servlet.http.HttpServletResponse") && (methodName.equals("addHeader") || methodName.equals("setHeader"))) { LDC ldc = ByteCode.getPrevInstruction(location.getHandle().getPrev(), LDC.class); if (ldc != null) { <START> if ("Access-Control-Allow-Origin".equals(ldc.getValue(cpg)) && <END> "*".equals(ByteCode.getConstantLDC(location.getHandle().getPrev(), cpg, String.class))) { JavaClass clz = classContext.getJavaClass(); bugReporter.reportBug(new BugInstance(this, PERMISSIVE_CORS, Priorities.HIGH_PRIORITY) .addClass(clz) .addMethod(clz, m) .addSourceLine(classContext, m, location)); } } } } } }</code><technical_language>I test for header case (access-control-allow-origin). <LINK_0></technical_language>

Target:
private void analyzeMethod(Method m, ClassContext classContext) throws CFGBuilderException, DataflowAnalysisException { ConstantPoolGen cpg = classContext.getConstantPoolGen(); CFG cfg = classContext.getCFG(m); for (Iterator<Location> i = cfg.locationIterator(); i.hasNext(); ) { Location location = i.next(); Instruction inst = location.getHandle().getInstruction(); if (inst instanceof INVOKEINTERFACE) { INVOKEINTERFACE invoke = (INVOKEINTERFACE) inst; String methodName = invoke.getMethodName(cpg); String className = invoke.getClassName(cpg); if (className.equals("javax.servlet.http.HttpServletResponse") && (methodName.equals("addHeader") || methodName.equals("setHeader"))) { LDC ldc = ByteCode.getPrevInstruction(location.getHandle().getPrev(), LDC.class); if (ldc != null) { String headerValue = ByteCode.getConstantLDC(location.getHandle().getPrev(), cpg, String.class); if ("Access-Control-Allow-Origin".equalsIgnoreCase((String)ldc.getValue(cpg)) && (headerValue.contains("*") || "null".equalsIgnoreCase(headerValue))) { JavaClass clz = classContext.getJavaClass(); bugReporter.reportBug(new BugInstance(this, PERMISSIVE_CORS, Priorities.HIGH_PRIORITY) .addClass(clz) .addMethod(clz, m) .addSourceLine(classContext, m, location)); } } } } } }
Source:
<code>public DataTransactionResult offerToStore(ValueContainer<?> container, Integer value) { final ImmutableValue<Integer> proposedValue = new ImmutableSpongeValue<Integer>(Keys.FIRE_DAMAGE_DELAY, value); if (supports(container)) { final ImmutableValue<Integer> newFireDelayData = new ImmutableSpongeValue<Integer>(Keys.FIRE_DAMAGE_DELAY, value); final ImmutableValue<Integer> oldFireDelayValue = getApiValueFromContainer(container).get().asImmutable(); try { ((net.minecraft.entity.Entity) (container)).fireResistance = value; return DataTransactionBuilder.successReplaceResult(oldFireDelayValue, newFireDelayData); <START> } catch (Exception e) { <END> return DataTransactionBuilder.errorResult(newFireDelayData); } } return DataTransactionBuilder.failResult(proposedValue); }</code><technical_language>catch exception here- throw is DataTransactionBuilder, happen (and suppressed)</technical_language>

Target:
public DataTransactionResult offerToStore(ValueContainer<?> container, Integer value) { final ImmutableValue<Integer> proposedValue = new ImmutableSpongeValue<Integer>(Keys.FIRE_DAMAGE_DELAY, value); if (supports(container)) { final ImmutableValue<Integer> newFireDelayData = new ImmutableSpongeValue<Integer>(Keys.FIRE_DAMAGE_DELAY, value); final ImmutableValue<Integer> oldFireDelayValue = getApiValueFromContainer(container).get().asImmutable(); ((net.minecraft.entity.Entity) (container)).fireResistance = value; return DataTransactionBuilder.successReplaceResult(oldFireDelayValue, newFireDelayData); } return DataTransactionBuilder.failResult(proposedValue); }
Source:
<code>private void loadUsersFromQb() { List<String> tags = new ArrayList<>(); tags.add(App.getSampleConfigs().getUsersTag()); progressBar.setVisibility(View.VISIBLE); QBUsers.getUsersByTags(tags, null).performAsync(new QBEntityCallback<ArrayList<QBUser>>() { @Override public void onSuccess(ArrayList<QBUser> users, Bundle params) { setUserList(users); <START> QBChatDialog oldDialog = (QBChatDialog) getIntent().getSerializableExtra(EXTRA_QB_DIALOG); <END> updateDialog(oldDialog); } @Override public void onError(QBResponseException e) { showErrorSnackbar(R.string.select_users_get_users_error, e, new View.OnClickListener() { @Override public void onClick(View v) { loadUsersFromQb(); } }); progressBar.setVisibility(View.GONE); } }); }</code><technical_language>dialog? rename dialog</technical_language>

Target:
private void loadUsersFromQb() { List<String> tags = new ArrayList<>(); tags.add(App.getSampleConfigs().getUsersTag()); progressBar.setVisibility(View.VISIBLE); QBUsers.getUsersByTags(tags, null).performAsync(new QBEntityCallback<ArrayList<QBUser>>() { @Override public void onSuccess(ArrayList<QBUser> usersByTags, Bundle params) { users = usersByTags; QBChatDialog dialog = (QBChatDialog) getIntent().getSerializableExtra(EXTRA_QB_DIALOG); getDialog(dialog); } @Override public void onError(QBResponseException e) { showErrorSnackbar(R.string.select_users_get_users_error, e, new View.OnClickListener() { @Override public void onClick(View v) { loadUsersFromQb(); } }); progressBar.setVisibility(View.GONE); } }); }
Source:
<code>public void updateInfo(@NotNull final Machine machine) { if (machine.getRecipeType().equals("dockerfile")) { recipeScriptClient.getRecipeScript(machine).then(new Operation<String>() { @Override public void apply(String recipe) throws OperationException { view.setScript(recipe); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError error) throws OperationException { Log.error(RecipeTabPresenter.class, "Failed to get recipe script for machine " + machine.getId() + ": " + error.getMessage()); } }); } <START> view.setScript(""); <END> }</code><technical_language>show empty panel? write "unsupported script type"</technical_language>

Target:
public void updateInfo(@NotNull final Machine machine) { if (machine.getRecipeType() == null) { Log.error(RecipeTabPresenter.class, "Recipe type is null for machine '" + machine.getId() + "'"); view.setScript("Recipe type is null for machine '" + machine.getId() + "'"); return; } switch (machine.getRecipeType()) { case "image": view.setScript("Image location: " + machine.getRecipeLocation()); break; case "dockerfile": recipeScriptClient.getRecipeScript(machine).then(new Operation<String>() { @Override public void apply(String recipe) throws OperationException { view.setScript(recipe); } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError error) throws OperationException { Log.error(RecipeTabPresenter.class, "Failed to get recipe script for machine " + machine.getId() + ": " + error.getMessage()); view.setScript("Failed to get recipe script for machine '" + machine.getId() + "'"); } }); break; case "default": view.setScript("Recipe type: " + machine.getRecipeType()); } }
Source:
<code>public void stapPermissionError() { Process p = null; try { p = new ProcessBuilder("/usr/bin/bash", "-c", "whoami").start(); } catch (IOException e) { e.printStackTrace(); } InputStreamReader isr = new InputStreamReader(p.getInputStream()); BufferedReader br = new BufferedReader(isr); String user = null; try { user = br.readLine(); } catch (IOException e) { e.printStackTrace(); } SystemTapUIErrorMessages message = new SystemTapUIErrorMessages(Messages.getString("CallgraphView.StapError1"), Messages.getString("CallgraphView.StapError1"), Messages.getString("CallgraphView.StapError2") <START> + user + " " + Messages.getString("CallgraphView.StapError3") + "usermod -aG stapdev " + user); END> message.schedule(); }</code><technical_language>is another of above: annotate externalized string {#} for example: User {1} is a member of group {2}. use: NLS.bind(Messages.getString("string.id"), userName, groupName) examples of this in code base</technical_language>

Target:
public void stapPermissionError() { Process p = null; try { p = new ProcessBuilder("/usr/bin/bash", "-c", "whoami").start(); } catch (IOException e) { e.printStackTrace(); } InputStreamReader isr = new InputStreamReader(p.getInputStream()); BufferedReader br = new BufferedReader(isr); String user = null; try { user = br.readLine(); } catch (IOException e) { e.printStackTrace(); } SystemTapUIErrorMessages message = new SystemTapUIErrorMessages( Messages.getString("CallgraphView.StapError1"), Messages.getString("CallgraphView.StapError1"), NLS.bind( Messages.getString("CallgraphView.StapError2"), user)); message.schedule(); }
Source:
<code>public HdfsCopyStats(String source, File destination, boolean enableStatsFile, int maxVersionsStatsFile, boolean isFileCopy, HdfsPathInfo pathInfo) { this.sourceFile = source; this.totalBytesTransferred = 0L; this.bytesTransferredSinceLastReport = 0L; this.pathInfo = pathInfo; this.lastReportNs = System.nanoTime(); this.startTimeMS = System.currentTimeMillis(); initializeStatsFile(destination, enableStatsFile, maxVersionsStatsFile, isFileCopy); <START> aggStats = HdfsFetcherAggStats.getStats(); <END> }</code><technical_language>I remove method getStats aggStats static</technical_language>

Target:
public HdfsCopyStats(String source, File destination, boolean enableStatsFile, int maxVersionsStatsFile, boolean isFileCopy, HdfsPathInfo pathInfo) { this.sourceFile = source; this.totalBytesTransferred = 0L; this.bytesTransferredSinceLastReport = 0L; this.pathInfo = pathInfo; this.lastReportNs = System.nanoTime(); this.startTimeMS = System.currentTimeMillis(); initializeStatsFile(destination, enableStatsFile, maxVersionsStatsFile, isFileCopy); }
Source:
<code>public static boolean isLoggingEnabled() { if (CommCareApplication.instance().getCurrentApp() == null) { return true; } SharedPreferences properties = CommCareApplication.instance().getCurrentApp().getAppPreferences(); String logsEnabled = properties.getString(LOGS_ENABLED, LOGS_ENABLED_YES); <START> return !properties.contains(LOGS_ENABLED) || <END> logsEnabled.equals(LOGS_ENABLED_YES) || logsEnabled.equals(LOGS_ENABLED_ON_DEMAND); }</code><technical_language>this line is redundant, properties.getString() return LOGS_ENABLED_YES if LOGS_ENABLED property</technical_language>

Target:
public static boolean isLoggingEnabled() { if (CommCareApplication.instance().getCurrentApp() == null) { return true; } String logsEnabled = getLogsEnabled(); return logsEnabled.equals(LOGS_ENABLED_YES) || logsEnabled.equals(LOGS_ENABLED_ON_DEMAND); }
Source:
<code>public void unparse( SqlWriter writer, int leftPrec, int rightPrec) { final SqlOperator operator = getOperator(); final SqlDialect dialect = writer.getDialect(); if (leftPrec > operator.getLeftPrec() || (operator.getRightPrec() <= rightPrec && (rightPrec != 0)) || writer.isAlwaysUseParentheses() && isA(SqlKind.EXPRESSION)) { final SqlWriter.Frame frame; if (operator instanceof SqlUnnestOperator) { frame = writer.startList(SqlWriter.FrameTypeEnum.SIMPLE); <START> } else { <END> frame = writer.startList("(", ")"); } dialect.unparseCall(writer, this, 0, 0); writer.endList(frame); } else { dialect.unparseCall(writer, this, leftPrec, rightPrec); } }</code><technical_language>SqlKind.UNNEST instead of instanceOf</technical_language>

Target:
public void unparse( SqlWriter writer, int leftPrec, int rightPrec) { final SqlOperator operator = getOperator(); final SqlDialect dialect = writer.getDialect(); if (leftPrec > operator.getLeftPrec() || (operator.getRightPrec() <= rightPrec && (rightPrec != 0)) || writer.isAlwaysUseParentheses() && isA(SqlKind.EXPRESSION)) { final SqlWriter.Frame frame = writer.startList("(", ")"); dialect.unparseCall(writer, this, 0, 0); writer.endList(frame); } else { dialect.unparseCall(writer, this, leftPrec, rightPrec); } }
Source:
<code><START> protected void onEvent(GHEvent event, String payload) { <END> try { GHEventPayload.Ping ping = GitHub.offline().parseEventPayload(new StringReader(payload), GHEventPayload.Ping.class); GHRepository repository = ping.getRepository(); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getHtmlUrl()); monitor.resolveProblem(GitHubRepositoryName.create(repository.getHtmlUrl().toExternalForm())); } else { GHOrganization organization = ping.getOrganization(); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getUrl()); } else { LOGGER.warn("{} webhook received with unexpected payload", event); } } } catch (IOException e) { LOGGER.warn("Received malformed PingEvent: " + payload, e); } }</code><technical_language>onEvent report errors itself? catch needed</technical_language>

Target:
protected void onEvent(GHEvent event, String payload) { GHEventPayload.Ping ping; try { ping = GitHub.offline().parseEventPayload(new StringReader(payload), GHEventPayload.Ping.class); } catch (IOException e) { LOGGER.warn("Received malformed PingEvent: " + payload, e); return; } GHRepository repository = ping.getRepository(); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getHtmlUrl()); monitor.resolveProblem(GitHubRepositoryName.create(repository.getHtmlUrl().toExternalForm())); } else { GHOrganization organization = ping.getOrganization(); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getUrl()); } else { LOGGER.warn("{} webhook received with unexpected payload", event); } } }
Source:
<code>public SMRLogEntry() { <START> this.type = LogEntryType.SMR_LOG; <END> }</code><technical_language>SMR_LOG -> SMRLOG naming convention consistent</technical_language>

Target:
public SMRLogEntry() { this.type = LogEntryType.SMRLOG; }
Source:
<code>public static String graphvizLogicalPlan(PlanNode plan, TypeProvider types) { PlanFragment fragment = new PlanFragment( new PlanFragmentId("graphviz_plan"), plan, types.allTypes(), SINGLE_DISTRIBUTION, ImmutableList.of(plan.getId()), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), plan.getOutputSymbols()), StageExecutionStrategy.ungroupedExecution(), <START> new StatsAndCosts(ImmutableMap.of(), ImmutableMap.of())); <END> return GraphvizPrinter.printLogical(ImmutableList.of(fragment)); }</code><technical_language>StatsAndCosts.empty()</technical_language>

Target:
public static String graphvizLogicalPlan(PlanNode plan, TypeProvider types) { PlanFragment fragment = new PlanFragment( new PlanFragmentId("graphviz_plan"), plan, types.allTypes(), SINGLE_DISTRIBUTION, ImmutableList.of(plan.getId()), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), plan.getOutputSymbols()), StageExecutionStrategy.ungroupedExecution(), StatsAndCosts.empty()); return GraphvizPrinter.printLogical(ImmutableList.of(fragment)); }
Source:
<code>public void testFindCreditMemoDocument() { VendorCreditMemoDocument vendorCreditMemoDocument = cuBatchExtractServiceImpl.findCreditMemoDocument(EntryFixture.VCM_TWO.createEntry()); assertNotNull("vendor credit memo should have been non-null", vendorCreditMemoDocument); assertEquals("Wrong credit memo document was retrieved", CuCamsTestConstants.DOC_5686500, vendorCreditMemoDocument.getDocumentNumber()); <START> vendorCreditMemoDocument = cuBatchExtractServiceImpl.findCreditMemoDocument(EntryFixture.VCM_ONE.createEntry()); <END> assertNotNull("vendor credit memo should have been non-null", vendorCreditMemoDocument); assertEquals("Wrong credit memo document was retrieved", CuCamsTestConstants.DOC_5319793, vendorCreditMemoDocument.getDocumentNumber()); vendorCreditMemoDocument = cuBatchExtractServiceImpl.findCreditMemoDocument(EntryFixture.VCM_THREE.createEntry()); assertNull("vendor credit memo should have been null", vendorCreditMemoDocument); }</code><technical_language>is this test one</technical_language>

Target:
public void testFindCreditMemoDocument() { VendorCreditMemoDocument vendorCreditMemoDocument = cuBatchExtractServiceImpl.findCreditMemoDocument(EntryFixture.VCM_5319793.createEntry()); assertNotNull("vendor credit memo should have been non-null", vendorCreditMemoDocument); assertEquals("Wrong credit memo document was retrieved", CuCamsTestConstants.DOC_5319793, vendorCreditMemoDocument.getDocumentNumber()); vendorCreditMemoDocument = cuBatchExtractServiceImpl.findCreditMemoDocument(EntryFixture.VCM_NONEXISTENT_DOC.createEntry()); assertNull("vendor credit memo should have been null", vendorCreditMemoDocument); }
Source:
<code>public void onClick(View v) { Parameters params = drone.getAttribute(AttributeType.PARAMETERS); Parameter speed = params.getParameter(WPNAV_SPEED); if(mission == null){ mission = drone.getAttribute(AttributeType.MISSION); } switch(v.getId()){ case R.id.mc_pause: { drone.pauseAtCurrentLocation(); break; } case R.id.mc_restart: { if(mission.getCurrentMissionItem() == mission.getMissionItems().size()){ resetAutoMode(); } msg_mission_set_current msg = new msg_mission_set_current(); msg.seq = 0; ExperimentalApi.sendMavlinkMessage(drone, new MavlinkMessageWrapper(msg)); break; } case R.id.mc_next: { msg_mission_set_current msg = new msg_mission_set_current(); msg.seq = mission.getCurrentMissionItem() + 1; ExperimentalApi.sendMavlinkMessage(drone, new MavlinkMessageWrapper(msg)); break; } case R.id.mc_prev: { msg_mission_set_current msg = new msg_mission_set_current(); msg.seq = mission.getCurrentMissionItem() - 1; ExperimentalApi.sendMavlinkMessage(drone, new MavlinkMessageWrapper(msg)); break; } case R.id.wp_speed_plus: <START> changeWaypointSpeedBy(100.0); <END> break; case R.id.wp_speed_minus: changeWaypointSpeedBy(-100.0); break; } }</code><technical_language>do_change_speed()</technical_language>

Target:
public void onClick(View v) { if(mission == null){ mission = drone.getAttribute(AttributeType.MISSION); } switch(v.getId()){ case R.id.mc_pause: { drone.pauseAtCurrentLocation(); break; } case R.id.mc_restart: { gotoMissionItem(0); break; } case R.id.mc_next: { gotoMissionItem(mission.getCurrentMissionItem() + 1); break; } case R.id.mc_prev: { gotoMissionItem(mission.getCurrentMissionItem() - 1); break; } } }
Source:
<code>public static String encode(CustomPage cp) { StringBuilder encodedCP = new StringBuilder(); if (cp.getPageMatcher() != null) { encodedCP <START> .append(Base64.encodeBase64String(cp.getPageMatcher().getBytes())) <END> .append(FIELD_SEPARATOR); } else { encodedCP.append(Base64.encodeBase64String("".getBytes())).append(FIELD_SEPARATOR); } encodedCP.append(cp.getPageMatcherType().getId()).append(FIELD_SEPARATOR); encodedCP.append(cp.isRegex()).append(FIELD_SEPARATOR); encodedCP.append(cp.getType().getId()).append(FIELD_SEPARATOR); encodedCP.append(cp.isEnabled()).append(FIELD_SEPARATOR); return encodedCP.toString(); }</code><technical_language>JRE classes? - charset</technical_language>

Target:
public static String encode(CustomPage cp) { StringBuilder encodedCP = new StringBuilder(); String matcherComponent = cp.getPageMatcher() != null ? cp.getPageMatcher() : ""; encodedCP .append( new String( Base64.getEncoder() .encode(matcherComponent.getBytes(StandardCharsets.UTF_8)), StandardCharsets.US_ASCII)) .append(FIELD_SEPARATOR); encodedCP.append(cp.getPageMatcherLocation().getId()).append(FIELD_SEPARATOR); encodedCP.append(cp.isRegex()).append(FIELD_SEPARATOR); encodedCP.append(cp.getType().getId()).append(FIELD_SEPARATOR); encodedCP.append(cp.isEnabled()).append(FIELD_SEPARATOR); return encodedCP.toString(); }
Source:
<code>public void checkArtifactSize(String storageId, String repositoryId, MultipartFile uploadedFile) throws ArtifactResolutionException { if (uploadedFile.isEmpty() || uploadedFile.getSize() == 0) { throw new ArtifactResolutionException("Uploaded file is empty."); } Repository repository = getConfiguration().getStorage(storageId) .getRepository(repositoryId); long artifactsMaxSize = repository.getArtifactsMaxSize(); if (artifactsMaxSize > 0) { if (uploadedFile.getSize() > artifactsMaxSize) { <START> throw new ArtifactResolutionException("Uploaded artifact is large for repository " + repositoryId + <END> "."); } } }</code><technical_language>please change error message "The size of artifact exceeds maximum size accepted this repository (${size}/${artifactMaxSize}."</technical_language>

Target:
public void checkArtifactSize(String storageId, String repositoryId, MultipartFile uploadedFile) throws ArtifactResolutionException { if (uploadedFile.isEmpty() || uploadedFile.getSize() == 0) { throw new ArtifactResolutionException("Uploaded file is empty."); } Repository repository = getConfiguration().getStorage(storageId) .getRepository(repositoryId); long artifactMaxSize = repository.getArtifactMaxSize(); if (artifactMaxSize > 0 && uploadedFile.getSize() > artifactMaxSize) { throw new ArtifactResolutionException("The size of the artifact exceeds the maximum size accepted by " + "this repository (" + uploadedFile.getSize() + "/" + artifactMaxSize + ")."); } }
Source:
<code>public Repository getRepository(final File gitDir) { if (gitDir == null) { return null; } File normalizedGitDir = new Path(gitDir.getAbsolutePath()).toFile(); synchronized (repositoryCache) { Reference<Repository> r = repositoryCache.get(normalizedGitDir); Repository result = r != null ? r.get() : null; if (result != null && result.getDirectory().exists()) { return result; } <START> repositoryCache.remove(normalizedGitDir); } IndexDiffCache cache = Activator.getDefault().getIndexDiffCache(); if (cache != null) { cache.remove(normalizedGitDir); <END> } return null; }</code><technical_language>wrap remove() calls additional "if(result!=null)" avoid unnecessary work, if worth making code more unreadable</technical_language>

Target:
public Repository getRepository(final File gitDir) { if (gitDir == null) { return null; } File normalizedGitDir = new Path(gitDir.getAbsolutePath()).toFile(); synchronized (repositoryCache) { Reference<Repository> r = repositoryCache.get(normalizedGitDir); if (r == null) { return null; } Repository result = r.get(); if (result != null && result.getDirectory().exists()) { return result; } repositoryCache.remove(normalizedGitDir); } IndexDiffCache cache = Activator.getDefault().getIndexDiffCache(); if (cache != null) { cache.remove(normalizedGitDir); } return null; }
Source:
<code>public void onReceive(Context context, Intent intent) { String referrer = intent.getStringExtra("referrer"); Log.i(SwrveImp.LOG_TAG, "Received referrer:" + referrer); if (referrer != null) { String decodedReferrer = ""; try { decodedReferrer = URLDecoder.decode(referrer, "UTF-8"); } catch (UnsupportedEncodingException e) { Log.e(SwrveImp.LOG_TAG, "Error decoding the referrer:" + referrer, e); } <START> SharedPreferences.Editor prefs = context.getSharedPreferences(SwrveImp.SDK_PREFS_NAME, 0).edit(); <END> prefs.putString(SwrveImp.SWRVE_REFERRER_ID, decodedReferrer).commit(); } else { Log.e(SwrveImp.LOG_TAG, "Referrer is null."); } }</code><technical_language>Do want save in prefs if empty</technical_language>

Target:
public void onReceive(Context context, Intent intent) { String referrer = intent.getStringExtra(SwrveImp.REFERRER); Log.i(SwrveImp.LOG_TAG, "Received INSTALL_REFERRER broadcast with referrer:" + referrer); if (!SwrveHelper.isNullOrEmpty(referrer)) { try { String decodedReferrer = URLDecoder.decode(referrer, "UTF-8"); SharedPreferences.Editor prefs = context.getSharedPreferences(SwrveImp.SDK_PREFS_NAME, 0).edit(); prefs.putString(SwrveImp.SWRVE_REFERRER_ID, decodedReferrer).commit(); } catch (UnsupportedEncodingException e) { Log.e(SwrveImp.LOG_TAG, "Error decoding the referrer:" + referrer, e); } } }
Source:
<code>public Multimap<String, Class<?>> getIncludes() { <START> initializeIncludesIfNull(); <END> return includes; }</code><technical_language>change lazy initialization getter.. call this method over: java public Multimap<String, Class<?>> getIncludes() { if (includes == null) includes = LinkedListMultimap.create(); return includes; } for excludes</technical_language>

Target:
public Multimap<String, Class<?>> getIncludes() { if (includes == null) { includes = LinkedListMultimap.create(); } return includes; }
Source:
<code>public List<TestScenario> getScenarios() throws IOException { File folder = new File(directory); File[] scenarioDirectories = folder.listFiles((dir, name) -> name.startsWith(SCENARIO_DIRECTORY_NAME_PREFIX)); List<TestScenario> testScenarios = new ArrayList<>(); for (File directory: scenarioDirectories) { if (directory.isDirectory()) { File scenarioFile = directory.listFiles((dir, name) -> name.equals(SCENARIO_NAME))[0]; String scenarioJson = readFile(scenarioFile); TestScenario testScenario = deserialize(scenarioJson, TestScenario.class); testScenario.setScenarioDirectory(directory.getAbsolutePath()); if (testScenario.getEnvironment().getDockerCompose() != null) { testScenario.getEnvironment().setDockerCompose( <START> directory.getAbsolutePath() + "/" + testScenario.getEnvironment().getDockerCompose()); <END> } testScenarios.add(testScenario); } } return testScenarios; }</code><technical_language>Is this path for container, is a host's path? If a host's path, <LINK_0></technical_language>

Target:
public List<TestScenario> getScenarios() throws IOException { File folder = new File(directory); File[] scenarioDirectories = folder.listFiles((dir, name) -> name.startsWith(SCENARIO_DIRECTORY_NAME_PREFIX)); List<TestScenario> testScenarios = new ArrayList<>(); for (File directory: scenarioDirectories) { if (directory.isDirectory()) { File scenarioFile = directory.listFiles((dir, name) -> name.equals(SCENARIO_NAME))[0]; String scenarioJson = readFile(scenarioFile); TestScenario testScenario = deserialize(scenarioJson, TestScenario.class); testScenario.setScenarioDirectory(directory.getAbsolutePath()); testScenarios.add(testScenario); } } return testScenarios; }
Source:
<code>public static Change.Id changeIdFromDraftComments(String refName) { int d = refName.lastIndexOf('-'); return new Change.Id(Integer.parseInt(refName.substring(d + <START> 1), 10)); <END> }</code><technical_language>This is optional, default, Java do dumb treat leading 0s octal</technical_language>

Target:
public static Change.Id changeIdFromDraftComments(String refName) { int d = refName.lastIndexOf('-'); return new Change.Id(Integer.parseInt(refName.substring(d + 1))); }
Source:
<code>protected List<String> getRequiredBundles() { <START> String orgEclipseUiPluginId = getProjectInfo().isRapOption() ? "org.eclipse.rap.ui" : "org.eclipse.ui" ; <END> String orgEclipseEmfParsleyViewsPluginId = getProjectInfo().isRapOption() ? "org.eclipse.emf.parsley.rap.views" : EmfParsleyViewsActivator.PLUGIN_ID ; return Lists.newArrayList( "org.eclipse.core.runtime", orgEclipseUiPluginId, orgEclipseEmfParsleyViewsPluginId, "org.eclipse.xtext.xbase.lib"); }</code><technical_language>I idea! :) enable, this option, setup for single sourcing optional bundles? I mean: default .ui bundle requirements be. If select this option instead, put required bundles .ui .rap.ui requirements, set optional (this is of strategies for RAP single sourcing; easier setup imported packages)</technical_language>

Target:
protected List<String> getRequiredBundles() { String orgEclipseUiPluginId = getProjectInfo().isRapOption() ? "org.eclipse.rap.ui;resolution:=optional" : "org.eclipse.ui" ; String orgEclipseEmfParsleyViewsPluginId = getProjectInfo().isRapOption() ? "org.eclipse.emf.parsley.rap.views;resolution:=optional" : EmfParsleyViewsActivator.PLUGIN_ID ; return Lists.newArrayList( "org.eclipse.core.runtime", orgEclipseUiPluginId, orgEclipseEmfParsleyViewsPluginId, "org.eclipse.xtext.xbase.lib"); }
Source:
<code>public void refreshCustomizedViewMap(final HelixDataAccessor accessor) { if (_propertyDataChangedMap.get(HelixConstants.ChangeType.CUSTOMIZED_VIEW).getAndSet(false)) { <START> for (String stateType : _aggregationEnabledTypes) { <END> if (!_customizedViewCacheMap.containsKey(stateType)) { CustomizedViewCache newCustomizedViewCache = new CustomizedViewCache(getClusterName(), stateType); _customizedViewCacheMap.put(stateType, newCustomizedViewCache); } _customizedViewCacheMap.get(stateType).refresh(accessor); } Set<String> previousCachedStateTypes = new HashSet<>(_customizedViewCacheMap.keySet()); previousCachedStateTypes.removeAll(_aggregationEnabledTypes); logger.info("Remove customizedView for state: " + previousCachedStateTypes); removeCustomizedViewTypes(new ArrayList<>(previousCachedStateTypes)); } }</code><technical_language>This right. If config types changed refresh items, remove extra types, right</technical_language>

Target:
public void refreshCustomizedViewMap(final HelixDataAccessor accessor) { if (_propertyDataChangedMap.get(HelixConstants.ChangeType.CUSTOMIZED_VIEW).getAndSet(false)) { for (String stateType : _aggregationEnabledTypes) { if (!_customizedViewCacheMap.containsKey(stateType)) { CustomizedViewCache newCustomizedViewCache = new CustomizedViewCache(getClusterName(), stateType); _customizedViewCacheMap.put(stateType, newCustomizedViewCache); } _customizedViewCacheMap.get(stateType).refresh(accessor); } Set<String> previousCachedStateTypes = new HashSet<>(_customizedViewCacheMap.keySet()); previousCachedStateTypes.removeAll(_aggregationEnabledTypes); logger.info("Remove customizedView for state: " + previousCachedStateTypes); removeCustomizedViewTypes(previousCachedStateTypes); } }
Source:
<code>public void testDSLPhrase() throws Exception { try ( Session session = openSession() ) { FullTextSession fullTextSession = Search.getFullTextSession( session ); final QueryBuilder queryBuilder = queryBuilder( fullTextSession ); Query query = queryBuilder .phrase() .onField( "message" ) .sentence( "A very important matter" ) .createQuery(); FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery( query, Letter.class ); String queryString = fullTextQuery.getQueryString(); <START> assertThat( queryString ).isEqualTo( "{\"query\":{\"match_phrase\":{\"message\":{\"query\":\"very important matter\",\"slop\":0,\"boost\":1.0}}}}" ); <END> } }</code><technical_language>need change right now, good know: JsonHelper#assertJsonEquals() allows _'_ instead of escaped _\"_, making a tad nicer read</technical_language>

Target:
public void testDSLPhrase() throws Exception { try ( Session session = openSession() ) { FullTextSession fullTextSession = Search.getFullTextSession( session ); final QueryBuilder queryBuilder = queryBuilder( fullTextSession ); Query query = queryBuilder .phrase() .onField( "message" ) .sentence( "A very important matter" ) .createQuery(); FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery( query, Letter.class ); String queryString = fullTextQuery.getQueryString(); assertJsonEquals( "{'query':{'match_phrase':{'message':{'query':'very important matter','slop':0,'boost':1.0}}}}", queryString ); } }
Source:
<code>public void before() { defaultLocale = Locale.getDefault(Locale.Category.FORMAT); <START> Locale.setDefault(Locale.Category.FORMAT, Locale.US); <END> }</code><technical_language>test pass this change ? I.e. if Category.FORMAT is fallback generic locale</technical_language>

Target:
public void before() { originalFormatLocale = Locale.getDefault(Locale.Category.FORMAT); originalDefaultLocale = Locale.getDefault(); Locale.setDefault(Locale.GERMANY); Locale.setDefault(Locale.Category.FORMAT, Locale.US); }
Source:
<code><START> private static FolderSelectedStateCommand optimizeGroupings(FolderSelectedStateCommand command) { <END> Set<Long> idSet = command.getIdSet(); List<ContiguousIdGroup> idGroups = command.getIdGroups(); if (idGroups != null && idGroups.get(0).getEnd() == ContiguousIdGroup.LAST_ID) { return command; } TreeSet<Long> fullIdSet = new TreeSet<>(); if (idSet != null) { fullIdSet.addAll(command.idSet); } if (idGroups != null) { for (ContiguousIdGroup idGroup : idGroups) { for (long i = idGroup.getStart();i <= idGroup.getEnd();i++) { fullIdSet.add(i); } } } Builder builder = command.newBuilder() .idSet(null) .idRanges(null); List<Long> idList = new ArrayList<>(fullIdSet); int start = 0; for (int i = 1; i < idList.size();i++) { if (idList.get(i - 1) + 1 != idList.get(i)) { checkAndAddIds(builder, idList, start, i - 1); start = i; } } checkAndAddIds(builder, idList, start, idList.size() - 1); FolderSelectedStateCommand tempCommand = builder.build(); command.setIdSet(tempCommand.getIdSet()); command.setIdGroups(tempCommand.getIdGroups()); return command; }</code><technical_language>this method a test of</technical_language>

Target:
static void optimizeGroupings(FolderSelectedStateCommand command) { Set<Long> idSet = command.getIdSet(); List<ContiguousIdGroup> idGroups = command.getIdGroups(); if (idSet.isEmpty() && idGroups.isEmpty()) { return; } if (idGroups.size() == 1 && idGroups.get(0).getEnd() == ContiguousIdGroup.LAST_ID) { return; } TreeSet<Long> fullIdSet = new TreeSet<>(); fullIdSet.addAll(idSet); for (ContiguousIdGroup idGroup : idGroups) { for (long i = idGroup.getStart();i <= idGroup.getEnd();i++) { fullIdSet.add(i); } } command.clearIds(); List<Long> idList = new ArrayList<>(fullIdSet); int start = 0; for (int i = 1; i < idList.size();i++) { if (idList.get(i - 1) + 1 != idList.get(i)) { checkAndAddIds(command, idList, start, i - 1); start = i; } } checkAndAddIds(command, idList, start, idList.size() - 1); }
Source:
<code>private void bindViewHolderToResponseRow(DiscussionResponseViewHolder holder, final int position) { final DiscussionComment comment = discussionResponses.get(position - 1); holder.responseCommentBodyTextView.setText(DiscussionTextUtils.parseHtml(comment.getRenderedBody())); holder.addCommentLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { <START> if (0 == comment.getChildren().size()) { <END> router.showCourseDiscussionAddComment(context, comment); } else { router.showCourseDiscussionComments(context, comment); } } }); holder.authorLayoutViewHolder.setAuthorData(comment); bindNumberCommentsView(holder.numberResponsesViewHolder, comment); final int positionInResponses = position - 1; bindSocialView(holder.socialLayoutViewHolder, positionInResponses, comment); holder.discussionReportViewHolder.reportLayout.setOnClickListener(new View.OnClickListener() { public void onClick(final View v) { FlagCommentTask task = new FlagCommentTask(context, comment, !comment.isAbuseFlagged()) { @Override public void onSuccess(DiscussionComment comment) { if (comment != null) { discussionResponses.remove(positionInResponses); discussionResponses.add(positionInResponses, comment); notifyDataSetChanged(); } } @Override public void onException(Exception ex) { logger.error(ex); } }; task.execute(); } }); holder.discussionReportViewHolder.setReported(comment.isAbuseFlagged()); holder.socialLayoutViewHolder.threadFollowContainer.setVisibility(View.INVISIBLE); }</code><technical_language>Also, I noticed getChildren() technically return null I considered API bug. API is supposed return empty list</technical_language>

Target:
private void bindViewHolderToResponseRow(DiscussionResponseViewHolder holder, final int position) { final DiscussionComment comment = discussionResponses.get(position - 1); holder.responseCommentBodyTextView.setText(DiscussionTextUtils.parseHtml(comment.getRenderedBody())); holder.addCommentLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (comment.getChildren().isEmpty()) { router.showCourseDiscussionAddComment(context, comment); } else { router.showCourseDiscussionComments(context, comment); } } }); holder.authorLayoutViewHolder.setAuthorData(comment); bindNumberCommentsView(holder.numberResponsesViewHolder, comment); final int positionInResponses = position - 1; bindSocialView(holder.socialLayoutViewHolder, positionInResponses, comment); holder.discussionReportViewHolder.reportLayout.setOnClickListener(new View.OnClickListener() { public void onClick(final View v) { FlagCommentTask task = new FlagCommentTask(context, comment, !comment.isAbuseFlagged()) { @Override public void onSuccess(DiscussionComment comment) { if (comment != null) { discussionResponses.remove(positionInResponses); discussionResponses.add(positionInResponses, comment); notifyDataSetChanged(); } } @Override public void onException(Exception ex) { logger.error(ex); } }; task.execute(); } }); holder.discussionReportViewHolder.setReported(comment.isAbuseFlagged()); holder.socialLayoutViewHolder.threadFollowContainer.setVisibility(View.INVISIBLE); }
Source:
<code>public static IndexPredicateAnalyzer createAnalyzer(boolean equalOnly) { IndexPredicateAnalyzer analyzer = new IndexPredicateAnalyzer(); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"); if (equalOnly) { return analyzer; } <START> analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrGreaterThan"); <END> analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNotEqual"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFBetween"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNull"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNotNull"); return analyzer; }</code><technical_language>Is a reason hard-coded strings _Class_.getName()</technical_language>

Target:
public static IndexPredicateAnalyzer createAnalyzer(boolean equalOnly) { IndexPredicateAnalyzer analyzer = new IndexPredicateAnalyzer(); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqual"); if (equalOnly) { return analyzer; } analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic" + ".GenericUDFOPEqualOrGreaterThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic" + ".GenericUDFOPEqualOrLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPGreaterThan"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNotEqual"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFBetween"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFIn"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNull"); analyzer.addComparisonOp("org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNotNull"); return analyzer; }
Source:
<code>public void resourceOffers(SchedulerDriver driver, List<Protos.Offer> offers) { synchronized (_offersLock) { if (_offers == null) { return; } LOG.debug("resourceOffers: Currently have offers buffered {}", _offers.size(), (_offers.size() > 0 ? (":" + offerMapToString(_offers)) : "")); for (Protos.Offer offer : offers) { if (isHostAccepted(offer.getHostname())) { LOG.debug("resourceOffers: Recording offer from host: {}, offerId: {}", offer.getHostname(), offer.getId().getValue()); _offers.put(offer.getId(), offer); } else { <START> LOG.debug("resourceOffers: Declining offer from host: offerId: {}", <END> offer.getHostname(), offer.getId().getValue()); driver.declineOffer(offer.getId()); } } LOG.debug("resourceOffers: After processing offers, now have offers buffered: {}", _offers.size(), offerMapToString(_offers)); } }</code><technical_language>minor: , removed, is inconsistent previous debug message for "Recording offer". i.e., remove comma both, leave in both</technical_language>

Target:
public void resourceOffers(SchedulerDriver driver, List<Protos.Offer> offers) { synchronized (_offersLock) { if (_offers == null) { return; } LOG.debug("resourceOffers: Currently have offers buffered {}", _offers.size(), (_offers.size() > 0 ? (":" + offerMapToString(_offers)) : "")); for (Protos.Offer offer : offers) { if (isHostAccepted(offer.getHostname())) { LOG.debug("resourceOffers: Recording offer from host: {}, offerId: {}", offer.getHostname(), offer.getId().getValue()); _offers.put(offer.getId(), offer); } else { LOG.debug("resourceOffers: Declining offer from host: {}, offerId: {}", offer.getHostname(), offer.getId().getValue()); driver.declineOffer(offer.getId()); } } LOG.debug("resourceOffers: After processing offers, now have offers buffered: {}", _offers.size(), offerMapToString(_offers)); } }
Source:
<code>private void changePlayPauseState(final String state) { if (mPlayer == null || state == null) { return; } mPlayer.postDelayed(new Runnable() { @Override public void run() { if (KPlayerListener.PauseKey.equals(state)) { <START> if ("pause".equals(mLastSentEvent)){ <END> return; } if (mPlayer != null && !mPlayer.isPlaying()) { mLastSentEvent = "pause"; mListener.eventWithValue(KWVCPlayer.this, KPlayerListener.PauseKey, null); return; } } else if (KPlayerListener.PlayKey.equals(state)) { if ("play".equals(mLastSentEvent)){ return; } if (mPlayer != null && mPlayer.isPlaying()) { mListener.eventWithValue(KWVCPlayer.this, KPlayerListener.PlayKey, null); mLastSentEvent = "pause"; return; } } else { Log.e(TAG, "Unsupported state " + state + " was used in changePlayPauseState"); return; } changePlayPauseState(state); } }, 100); }</code><technical_language>KPlayerListener.PauseKey instead of string "pause"</technical_language>

Target:
private void changePlayPauseState(final String state) { if (mPlayer == null || state == null) { return; } mPlayer.postDelayed(new Runnable() { @Override public void run() { if (KPlayerListener.PauseKey.equals(state)) { if (KPlayerListener.PauseKey.equals(mLastSentEvent)){ return; } if (mPlayer != null && !mPlayer.isPlaying()) { mLastSentEvent = KPlayerListener.PauseKey; mListener.eventWithValue(KWVCPlayer.this, KPlayerListener.PauseKey, null); return; } } else if (KPlayerListener.PlayKey.equals(state)) { if (KPlayerListener.PlayKey.equals(mLastSentEvent)){ return; } if (mPlayer != null && mPlayer.isPlaying()) { mListener.eventWithValue(KWVCPlayer.this, KPlayerListener.PlayKey, null); mLastSentEvent = KPlayerListener.PauseKey; return; } } else { Log.e(TAG, "Unsupported state " + state + " was used in changePlayPauseState"); return; } changePlayPauseState(state); } }, 100); }