auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void onMessage(final Intent intent) { if (intent == null) { <START> SwrveLogger.e(TAG, "Unexpected null intent"); <END> return; } final Bundle extras = intent.getExtras(); if (extras != null && !extras.isEmpty()) { SwrveLogger.i(TAG, "Received ADM notification: " + extras.toString()); processRemoteNotification(extras); } }</code><technical_language>Needs a error message</technical_language>

Target:
protected void onMessage(final Intent intent) { if (intent == null) { SwrveLogger.e(TAG, "ADM messaging runtimes have called onMessage() with unexpected null intent."); return; } final Bundle extras = intent.getExtras(); if (extras != null && !extras.isEmpty()) { SwrveLogger.i(TAG, "Received ADM notification: " + extras.toString()); processRemoteNotification(extras); } }
Source:
<code>public File getExternalFilesDir(String type) { <START> return ShadowEnvironment.getExternalStoragePublicDirectory(type); <END> }</code><technical_language>prefer call Android API methods here, e.g: Environment.getExternalStoragePublicDirectory() ? if decided change shadow method need refactor this class</technical_language>

Target:
public File getExternalFilesDir(String type) { return Environment.getExternalStoragePublicDirectory(type); }
Source:
<code><START> public static void saveBooleanPreference(String key, boolean value, Context context) { <END> SharedPreferences.Editor appPreferences = getDefaultSharedPreferences(context.getApplicationContext()).edit(); appPreferences.putBoolean(key, value); appPreferences.apply(); }</code><technical_language>I this next methods private</technical_language>

Target:
private static void saveBooleanPreference(String key, boolean value, Context context) { SharedPreferences.Editor appPreferences = getDefaultSharedPreferences(context.getApplicationContext()).edit(); appPreferences.putBoolean(key, value); appPreferences.apply(); }
Source:
<code>public void initialize(Configuration conf, Properties tbl) throws SerDeException { try { String className = tbl <START> .getProperty(org.apache.hadoop.hive.serde.Constants.SERIALIZATION_CLASS); <END> protobufClass = conf.getClassByName(className).asSubclass(Message.class); protobufConverter = ProtobufConverter.newInstance(new TypeRef<Message>(protobufClass){}); } catch (Exception e) { throw new SerDeException(e); } }</code><technical_language>import Constants this fits line</technical_language>

Target:
public void initialize(Configuration conf, Properties tbl) throws SerDeException { try { String className = tbl.getProperty(Constants.SERIALIZATION_CLASS); protobufClass = conf.getClassByName(className).asSubclass(Message.class); protobufConverter = ProtobufConverter.newInstance(protobufClass); } catch (Exception e) { throw new SerDeException(e); } }
Source:
<code>protected void decode(ChannelHandlerContext ctx, ByteBuf buffer) throws InterruptedException { while (!queue.isEmpty()) { RedisCommand<K, V, ?> command = queue.peek(); if (debugEnabled) { logger.debug("{} Queue contains: commands", logPrefix(), queue.size()); } WithLatency withLatency = getWithLatency(command); try { if (!rsm.decode(buffer, command, command.getOutput())) { return; } } catch (Exception e) { <START> rsm.reset(); <END> recordLatency(withLatency, command.getType()); queue.poll(); if (buffer.refCnt() > 0) { buffer.clear(); } try { command.completeExceptionally(e); } catch (Exception ex) { logger.warn("{} Unexpected exception during command completion exceptionally: {}", logPrefix, ex.toString(), ex); } throw e; } recordLatency(withLatency, command.getType()); queue.poll(); try { command.complete(); } catch (Exception e) { logger.warn("{} Unexpected exception during command completion: {}", logPrefix, e.toString(), e); } if (buffer.refCnt() != 0) { buffer.discardReadBytes(); } } }</code><technical_language>This change close Redis connection. catch complete command causing exception close connection (channel.close()). RedisStateMachine is reset in channelInactive. sense clear buffer in channelInactive</technical_language>

Target:
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer) throws InterruptedException { while (!queue.isEmpty()) { RedisCommand<K, V, ?> command = queue.peek(); if (debugEnabled) { logger.debug("{} Queue contains: commands", logPrefix(), queue.size()); } WithLatency withLatency = getWithLatency(command); try { if (!rsm.decode(buffer, command, command.getOutput())) { return; } } catch (Exception e) { recordLatency(withLatency, command.getType()); queue.poll(); try { command.completeExceptionally(e); } catch (Exception ex) { logger.warn("{} Unexpected exception during command completion exceptionally: {}", logPrefix, ex.toString(), ex); } ctx.close(); throw e; } recordLatency(withLatency, command.getType()); queue.poll(); try { command.complete(); } catch (Exception e) { logger.warn("{} Unexpected exception during command completion: {}", logPrefix, e.toString(), e); } if (buffer.refCnt() != 0) { buffer.discardReadBytes(); } } }
Source:
<code>private void editAnalysis() { String selection = createXmlFileString(fAnalysesList.getSelection()[0]); @Nullable File file = XmlUtils.listFiles().get(selection); if (file == null) { Activator.logError(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToEdit, selection)); TraceUtils.displayErrorMsg(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToEdit, selection), NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToEdit, selection)); return; } try { <START> IDE.openEditorOnFileStore(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), EFS.getStore(file.toURI())); <END> } catch (CoreException e) { Activator.logError(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToEdit, selection)); TraceUtils.displayErrorMsg(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToEdit, selection), e.getMessage()); } }</code><technical_language>want close dialog put focus editor. first, I thought dialog I notice editor</technical_language>

Target:
private void editAnalysis() { String selection = createXmlFileString(fAnalysesList.getSelection()[0]); @Nullable File file = XmlUtils.listFiles().get(selection); if (file == null) { Activator.logError(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToEdit, selection)); TraceUtils.displayErrorMsg(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToEdit, selection), NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToEdit, selection)); return; } try { IEditorPart editorPart = IDE.openEditorOnFileStore(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), EFS.getStore(file.toURI())); editorPart.addPropertyListener(new IPropertyListener() { @Override public void propertyChanged(Object source, int propId) { if (ISaveablePart.PROP_DIRTY == propId) { if (!editorPart.isDirty()) { loadXmlFile(file, false); } } } }); close(); } catch (CoreException e) { Activator.logError(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToEdit, selection)); TraceUtils.displayErrorMsg(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToEdit, selection), e.getMessage()); } }
Source:
<code>public void incrementUsage( long pageRef ) { long address = offFilePageId( pageRef ); long v = UnsafeUtil.getLongVolatile( address ); long usage = v & 0x07; if ( usage < 4 ) { usage++; <START> UnsafeUtil.compareAndSwapLong( null, address, v, (v & 0xFFFFFFFF_FFFFFFF8L) + usage ); <END> } }</code><technical_language>for mister xFFFFFFFF_FFFFFFF8L</technical_language>

Target:
public void incrementUsage( long pageRef ) { long address = offFilePageId( pageRef ); long v = UnsafeUtil.getLongVolatile( address ); long usage = v & MASK_USAGE_COUNT; if ( usage < 4 ) { usage++; UnsafeUtil.compareAndSwapLong( null, address, v, (v & MASK_NOT_USAGE_COUNT) + usage ); } }
Source:
<code>public Collection<Consumer> getConsumers(Collection<String> consumerIds) { Set<Consumer> consumers = new HashSet<>(); javax.persistence.Query query = this.getEntityManager() <START> .createQuery("SELECT c FROM Consumer c WHERE c.id IN (:cids)"); <END> if (consumerIds != null && !consumerIds.isEmpty()) { for (List<String> block : this.partition(consumerIds)) { query.setParameter("cids", block); consumers.addAll(query.getResultList()); } } return consumers; }</code><technical_language>this loaded session.byMultipleIds(this.entityType()).enableSessionCheck(true).multiLoad(<id list>) similarly in ProductCurator partitioning & checking cache offloaded hibernate</technical_language>

Target:
public Collection<Consumer> getConsumers(Collection<String> consumerIds) { if (consumerIds != null && !consumerIds.isEmpty()) { List<String> cids; if (consumerIds instanceof List) { cids = (List<String>) consumerIds; } else { cids = new ArrayList(consumerIds); } return this.currentSession() .byMultipleIds(this.entityType()) .enableSessionCheck(true) .enableOrderedReturn(false) .multiLoad(cids); } return Collections.emptyList(); }
Source:
<code>String getVersionAsDotX( String version ) { <START> Matcher matcher = Pattern <END> .compile("(\\d+\\.\\d+\\.)") .matcher(version); if ( matcher.find()) { return matcher.group( 1 ) + LOWER_CASE_X; } throw new IllegalArgumentException( String.format("version string '%s' does not match 'major.minor.' pattern", version ) ); }</code><technical_language>Prefer storing compiled pattern a constant for this class. Otherwise, unnecessarily recompile this regex</technical_language>

Target:
String getVersionAsDotX(String version) { Matcher matcher = MAJOR_MINOR_PATTERN.matcher(version); if (matcher.find()) { return matcher.group(1) + LOWER_CASE_X; } throw new IllegalArgumentException( String.format("version string '%s' does not match 'major.minor.' pattern", version)); }
Source:
<code>protected ProductContent initSourceObject() { <START> Content content = new Content(); content.setUuid("test_value"); content.setId("test_value"); content.setType("test_value"); content.setLabel("test_value"); content.setName("test_value"); content.setVendor("test_value"); content.setContentUrl("test_value"); content.setRequiredTags("test_value"); content.setReleaseVersion("test_value"); content.setGpgUrl("test_value"); content.setMetadataExpiration(1234L); content.setModifiedProductIds(Arrays.asList("1", "2", "3")); content.setArches("test_value"); content.setLocked(Boolean.TRUE); <END> ProductContent source = new ProductContent(); source.setContent(content); source.setEnabled(true); return source; }</code><technical_language>Code duplication: This replaced instantiating a ContentTranslatorTest calling initSourceObject()</technical_language>

Target:
protected ProductContent initSourceObject() { Content content = this.contentTranslatorTest.initSourceObject(); ProductContent source = new ProductContent(); source.setContent(content); source.setEnabled(true); return source; }
Source:
<code>public boolean submit(final RequestContext requestContext, final Credential credential) { final String username = credential.getId(); final CouchDbProfileDocument profile = couchDb.findByUsername(username); boolean success = false; if (profile == null) { couchDb.add(new CouchDbProfileDocument(username, null, CollectionUtils.wrap(aupAttributeName, true))); success = true; } else { profile.setAttribute(aupAttributeName, true); UpdateConflictException exception = null; for (int retries = 0; retries < conflictRetries; retries++) { try { exception = null; couchDb.update(profile); success = true; } catch (final UpdateConflictException e) { exception = e; } if (success) { LOGGER.debug("Successfully deleted service [{}].", profile.getUsername()); break; } } if (exception != null) { <START> LOGGER.debug("Could not delete service {}", username, exception.getMessage()); <END> } } return success; }</code><technical_language>Log message here. "service"</technical_language>

Target:
public boolean submit(final RequestContext requestContext, final Credential credential) { val username = credential.getId(); val profile = couchDb.findByUsername(username); if (profile == null) { couchDb.add(new CouchDbProfileDocument(username, null, CollectionUtils.wrap(aupAttributeName, Boolean.TRUE))); return true; } else { var success = false; profile.setAttribute(aupAttributeName, Boolean.TRUE); UpdateConflictException exception = null; for (int retries = 0; retries < conflictRetries; retries++) { try { exception = null; couchDb.update(profile); success = true; } catch (final UpdateConflictException e) { exception = e; } if (success) { LOGGER.debug("Successfully updated AUP for [{}].", profile.getUsername()); break; } } if (exception != null) { LOGGER.debug("Could not update AUP acceptance for [{}].\n{}", username, exception.getMessage()); } return success; } }
Source:
<code>public void testSignalStartDynamic() throws Exception { KieBase kbase = createKnowledgeBase("BPMN2-SignalStart.bpmn2"); ksession = createKnowledgeSession(kbase); KieServices ks = KieServices.Factory.get(); KieRepository kr = ks.getRepository(); KieContainer kContainer = ks.newKieContainer(kr.getDefaultReleaseId()); kContainer.getKieBase(); final List<Long> list = new ArrayList<Long>(); ksession.addEventListener(new DefaultProcessEventListener() { public void beforeProcessStarted(ProcessStartedEvent event) { logger.info("{}", event.getProcessInstance().getId()); list.add(event.getProcessInstance().getId()); } }); ksession.signalEvent("MySignal", "NewValue"); Assertions.assertThat(getNumberOfProcessInstances("Minimal")).isEqualTo(1); kbase.removeProcess("Minimal"); try { ksession.signalEvent("MySignal", "NewValue"); } catch (IllegalArgumentException e) { <START> Assertions.assertThat(e.getMessage()).isEqualTo("Unknown process ID: Minimal"); <END> } Assertions.assertThat(getNumberOfProcessInstances("Minimal")).isEqualTo(1); }</code><technical_language>this replaced <LINK_0> I learned thanks @rsynek handy :)</technical_language>

Target:
public void testSignalStartDynamic() throws Exception { KieBase kbase = createKnowledgeBase("BPMN2-SignalStart.bpmn2"); ksession = createKnowledgeSession(kbase); KieServices ks = KieServices.Factory.get(); KieRepository kr = ks.getRepository(); KieContainer kContainer = ks.newKieContainer(kr.getDefaultReleaseId()); kContainer.getKieBase(); final List<Long> list = new ArrayList<Long>(); ksession.addEventListener(new DefaultProcessEventListener() { public void beforeProcessStarted(ProcessStartedEvent event) { logger.info("{}", event.getProcessInstance().getId()); list.add(event.getProcessInstance().getId()); } }); ksession.signalEvent("MySignal", "NewValue"); Assertions.assertThat(getNumberOfProcessInstances("Minimal")).isEqualTo(1); kbase.removeProcess("Minimal"); Assertions.assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> { ksession.signalEvent("MySignal", "NewValue"); }) .withMessageContaining("Unknown process ID: Minimal"); Assertions.assertThat(getNumberOfProcessInstances("Minimal")).isEqualTo(1); }
Source:
<code>public static Optional<MeterRegistry> getInstance() { <START> return meterRegistry; <END> }</code><technical_language>a race condition in multi-threaded env</technical_language>

Target:
public static synchronized Optional<MeterRegistry> getInstance() { return meterRegistry; }
Source:
<code>private static List<String> separateChallenges(final String challenges) { String[] splitOnUnquotedCommas = challenges.split(REGEX_SPLIT_UNQUOTED_COMMA, -1); sanitizeWhitespace(splitOnUnquotedCommas); List<String> tokensContainingScheme = extractTokensContainingScheme(splitOnUnquotedCommas); String[] outStrings = new String[tokensContainingScheme.size()]; <START> for (int ii = 0; ii < outStrings.length; ii++) { <END> outStrings[ii] = ""; } writeParsedChallenges(splitOnUnquotedCommas, tokensContainingScheme, outStrings); sanitizeParsedSuffixes(outStrings); return Arrays.asList(outStrings); }</code><technical_language>curious: ii i index</technical_language>

Target:
private static List<String> separateChallenges(final String challenges) throws ResourceAuthenticationChallengeException { final String methodName = ":separateChallenges"; if (StringExtensions.isNullOrBlank(challenges)) { Logger.w(TAG + methodName, "Input String was null"); throw new ResourceAuthenticationChallengeException(AUTH_HEADER_INVALID_FORMAT); } Logger.i(TAG + methodName, "Splitting input String on unquoted commas", "input[" + challenges + "]"); String[] splitOnUnquotedCommas = challenges.split(REGEX_SPLIT_UNQUOTED_COMMA, -1); Logger.i(TAG + methodName, "Splitting input String on unquoted commas", "output[" + Arrays.toString(splitOnUnquotedCommas) + "]"); sanitizeWhitespace(splitOnUnquotedCommas); List<String> tokensContainingScheme = extractTokensContainingScheme(splitOnUnquotedCommas); String[] outStrings = new String[tokensContainingScheme.size()]; for (int ii = 0; ii < outStrings.length; ii++) { outStrings[ii] = ""; } writeParsedChallenges(splitOnUnquotedCommas, tokensContainingScheme, outStrings); sanitizeParsedSuffixes(outStrings); return Arrays.asList(outStrings); }
Source:
<code>public void testRecoveryMonitorWithFailure() throws Exception { RecoveryEnvironmentBean recoveryEnvironmentBean = recoveryPropertyManager.getRecoveryEnvironmentBean(); ArrayList<String> rcvClassNames = new ArrayList<>(); rcvClassNames.add(XATestResourceXARecovery.class.getName()); jtaPropertyManager.getJTAEnvironmentBean().setXaResourceRecoveryClassNames(rcvClassNames); XATestResourceXARecovery.setUseFaultyResources(true); TransactionImple tx = new TransactionImple(0); assertTrue(tx.enlistResource(new XATestResource(XATestResource.OK_JNDI_NAME, false))); assertTrue(tx.enlistResource(new XATestResource(XATestResource.FAULTY_JNDI_NAME, true))); tx.commit(); recoveryEnvironmentBean.setRecoveryBackoffPeriod(1); recoveryEnvironmentBean.setRecoveryListener(true); RecoveryManager manager = RecoveryManager.manager(RecoveryManager.DIRECT_MANAGEMENT); XARecoveryModule xaRecoveryModule = new XARecoveryModule(); manager.addModule(xaRecoveryModule); <START> <END> try { manager.startRecoveryManagerThread(); String host = recoveryEnvironmentBean.getRecoveryAddress(); String rcPort = String.valueOf(recoveryEnvironmentBean.getRecoveryPort()); RecoveryMonitor.main(new String[] {"-verbose", "-port", rcPort, "-host", host}); assertEquals("ERROR", RecoveryMonitor.getResponse()); assertEquals("ERROR", RecoveryMonitor.getSystemOutput()); assertTrue(!xaRecoveryModule.isPeriodicWorkSuccessful()); } finally { manager.terminate(); } }</code><technical_language>a policy of making changes relevant issue fixed. This change unrelated</technical_language>

Target:
public void testRecoveryMonitorWithFailure() throws Exception { RecoveryEnvironmentBean recoveryEnvironmentBean = recoveryPropertyManager.getRecoveryEnvironmentBean(); ArrayList<String> rcvClassNames = new ArrayList<>(); rcvClassNames.add(XATestResourceXARecovery.class.getName()); jtaPropertyManager.getJTAEnvironmentBean().setXaResourceRecoveryClassNames(rcvClassNames); XATestResourceXARecovery.setUseFaultyResources(true); TransactionImple tx = new TransactionImple(0); assertTrue(tx.enlistResource(new XATestResource(XATestResource.OK_JNDI_NAME, false))); assertTrue(tx.enlistResource(new XATestResource(XATestResource.FAULTY_JNDI_NAME, true))); tx.commit(); recoveryEnvironmentBean.setRecoveryBackoffPeriod(1); recoveryEnvironmentBean.setRecoveryListener(true); RecoveryManager manager = RecoveryManager.manager(RecoveryManager.DIRECT_MANAGEMENT); XARecoveryModule xaRecoveryModule = new XARecoveryModule(); manager.addModule(xaRecoveryModule); try { manager.startRecoveryManagerThread(); String host = recoveryEnvironmentBean.getRecoveryAddress(); String rcPort = String.valueOf(recoveryEnvironmentBean.getRecoveryPort()); RecoveryMonitor.main(new String[] {"-verbose", "-port", rcPort, "-host", host}); assertEquals("ERROR", RecoveryMonitor.getResponse()); assertEquals("ERROR", RecoveryMonitor.getSystemOutput()); assertFalse(xaRecoveryModule.isPeriodicWorkSuccessful()); } finally { manager.terminate(); } }
Source:
<code>private static boolean isRequiredBinding(Element element) { <START> return !hasAnnotationWithNames(element, NULLABLE_ANNOTATION_NAME, OPTIONAL_ANNOTATION_NAME); <END> }</code><technical_language>I want @Optional work for fields, do I want @Nullable work for methods. work for respective binding (method vs. field), ButterKnife's @Optional is supported, annotation named "Optional"</technical_language>

Target:
private static boolean isRequiredBinding(Element element) { return !hasAnnotationWithName(element, NULLABLE_ANNOTATION_NAME); }
Source:
<code>private void setupKeyEvents() { setOnKeyPressed(e -> { if (e.isControlDown()) { return; } if (e.getCode() == KeyCode.ENTER) { e.consume(); if (selectedIndex.isPresent()) { logger.info("Enter key selection on item " + selectedIndex.get()); <START> onItemSelected.accept(selectedIndex.get(), SHOULD_LOAD_BVIEW_ISSUE); <END> } } if (e.getCode() == KeyCode.UP || e.getCode() == KeyCode.DOWN || KeyboardShortcuts.upIssue.match(e) || KeyboardShortcuts.downIssue.match(e)) { e.consume(); handleUpDownKeys(e.getCode() == KeyCode.DOWN || KeyboardShortcuts.downIssue.match(e)); assert selectedIndex.isPresent() : "handleUpDownKeys doesn't set selectedIndex!"; if (!e.isShiftDown()) { logger.info("Enter key selection on item index " + selectedIndex.get()); onItemSelected.accept(selectedIndex.get(), SHOULD_LOAD_BVIEW_ISSUE); } } if (FIRST_ISSUE.match(e)) { e.consume(); selectNthItem(1); } if (LAST_ISSUE.match(e)) { e.consume(); selectNthItem(getItems().size()); } }); }</code><technical_language>This line is repeated in a places. abstract a method explanatory name</technical_language>

Target:
private void setupKeyEvents() { setOnKeyPressed(e -> { if (e.isControlDown()) { return; } if (e.getCode() == KeyCode.ENTER) { e.consume(); if (selectedIndex.isPresent()) { logger.info("Enter key selection on item " + selectedIndex.get()); onItemSelected.accept(selectedIndex.get()); } } if (e.getCode() == KeyCode.UP || e.getCode() == KeyCode.DOWN || KeyboardShortcuts.upIssue.match(e) || KeyboardShortcuts.downIssue.match(e)) { e.consume(); handleUpDownKeys(e.getCode() == KeyCode.DOWN || KeyboardShortcuts.downIssue.match(e)); assert selectedIndex.isPresent() : "handleUpDownKeys doesn't set selectedIndex!"; if (!e.isShiftDown()) { logger.info("Enter key selection on item index " + selectedIndex.get()); onItemSelected.accept(selectedIndex.get()); } } if (FIRST_ISSUE.match(e)) { e.consume(); selectNthItem(1); } if (LAST_ISSUE.match(e)) { e.consume(); selectNthItem(getItems().size()); } }); }
Source:
<code>@Override public void active(boolean active) { if (active) activate(); else <START> deactivate(false); <END> }</code><technical_language>change behavior for deprecated method</technical_language>

Target:
@Override public void active(boolean active) { cluster().active(active); }
Source:
<code>private void recurseAddFiles(Element fdNode, File f1, String requestNumber, String directoryName, Session sess) throws Exception{ String files[] = f1.list(); String fullPath = f1.getAbsolutePath() + File.separator; if(f1.list() == null || f1.list().length == 0){ return; } if(includeUploadStagingDir.equals("N") && f1.getName().equals(Constants.UPLOAD_STAGING_DIR)){ return; } if(f1.isDirectory()){ if(!directoryName.equals("")){ directoryName += "/" + f1.getName(); } else{ directoryName = f1.getName(); } } for(int i = 0; i < files.length; i++){ File f = new File(fullPath + files[i]); FileDescriptor fd = new FileDescriptor(requestNumber, f.getName(), f, f.getName()); fd.setDirectoryName(directoryName); fd.excludeMethodFromXML("getChildren"); Element fileNode = fd.toXMLDocument(null, fd.DATE_OUTPUT_ALTIO).getRootElement(); fileNode.setAttribute("isSelected", "N"); fileNode.setAttribute("state", "unchecked"); fileNode.setAttribute("canDelete", "Y"); fileNode.setAttribute("canRename", "Y"); StringBuffer fname = new StringBuffer(); fname.append(fullPath.substring(fullPath.indexOf(Request.getBaseRequestNumber(fd.getNumber()))).replace("\\","/")); fname.append(f.getName()); <START> fileNode.setAttribute("linkedSampleNumber", getLinkedSampleNumber(sess, fname.toString())); <END> fileNode.setAttribute("viewURL", fd.getViewURL(viewType)); if(f.isDirectory()) { fileNode.setAttribute("type", "dir"); recurseAddFiles(fileNode, f, requestNumber, directoryName, sess); } fdNode.addContent(fileNode); } }</code><technical_language>get rid of fname fd.getZipEntryName()</technical_language>

Target:
private void recurseAddFiles(Element fdNode, File f1, String requestNumber, String directoryName, Session sess) throws Exception{ String files[] = f1.list(); String fullPath = f1.getAbsolutePath() + File.separator; if(f1.list() == null || f1.list().length == 0){ return; } if(includeUploadStagingDir.equals("N") && f1.getName().equals(Constants.UPLOAD_STAGING_DIR)){ return; } if(f1.isDirectory()){ if(!directoryName.equals("")){ directoryName += "/" + f1.getName(); } else{ directoryName = f1.getName(); } } for(int i = 0; i < files.length; i++){ File f = new File(fullPath + files[i]); String fName = this.getPathForZipFileName(f, requestNumber); FileDescriptor fd = new FileDescriptor(requestNumber, f.getName(), f, fName); fd.setDirectoryName(directoryName); fd.excludeMethodFromXML("getChildren"); Element fileNode = fd.toXMLDocument(null, fd.DATE_OUTPUT_ALTIO).getRootElement(); fileNode.setAttribute("isSelected", "N"); fileNode.setAttribute("state", "unchecked"); fileNode.setAttribute("canDelete", "Y"); fileNode.setAttribute("canRename", "Y"); fileNode.setAttribute("linkedSampleNumber", getLinkedSampleNumber(sess, fd.getZipEntryName())); fileNode.setAttribute("viewURL", fd.getViewURL(viewType)); if(f.isDirectory()) { fileNode.setAttribute("type", "dir"); recurseAddFiles(fileNode, f, requestNumber, directoryName, sess); } fdNode.addContent(fileNode); } }
Source:
<code>public void tearDown() { try { fResource.getProject().delete(true, null); } catch (CoreException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>too, log error</technical_language>

Target:
public void tearDown() throws CoreException { if (fResource != null && fResource.exists()) { fResource.getProject().delete(true, null); } }
Source:
<code>public static List<String> getAuthenticatedUserRoles(IdentityProvider identityProvider) { <START> List<String> roles = identityProvider.getRoles(); <END> if (roles == null || roles.isEmpty()) { roles = new ArrayList<>(); roles.add(""); } return roles; }</code><technical_language>a null check identityProvider, prior calling getRoles method. like... List<String> roles = (identityProvider != null) ? identityProvider.getRoles():null;</technical_language>

Target:
public static List<String> getAuthenticatedUserRoles(IdentityProvider identityProvider) { List<String> roles = identityProvider != null ? identityProvider.getRoles() : new ArrayList<>(); if (roles == null || roles.isEmpty()) { roles = new ArrayList<>(); roles.add(""); } return roles; }
Source:
<code>public KafkaForkliftProducer(String topic, KafkaProducer<?, ?> kafkaProducer) { this.kafkaProducer = kafkaProducer; this.topic = topic; Schema.Parser parser = new Schema.Parser(); <START> this.forkliftSchema = parser.parse( <END> "{\"type\":\"record\",\"name\":\"ForkliftMessage\"," + " \"doc\":\"Non-Avro messages sent through forklift use this schema.\",\"fields\":" + "[{\"name\":\"forkliftValue\",\"type\":\"string\",\"default\":\"\", \"doc\":\"The forklift message. " + "3 formats are supported. 1: string value, 2: Json object," + "3: Map represented by key,value entries delimited with newline\"}," + "{\"name\":\"forkliftProperties\",\"type\":\"string\",\"default\":\"\"," + "\"doc\":\"Properties added to support forklift interfaces. Format is key,value entries delimited with new lines\"}]}"); }</code><technical_language>this constant shared producers? static</technical_language>

Target:
public KafkaForkliftProducer(String topic, KafkaProducer<?, ?> kafkaProducer) { this.kafkaProducer = kafkaProducer; this.topic = topic; }
Source:
<code>public boolean isSet(final String name) { <START> return isMapped(name) && getHeaderMapRaw().get(name) < values.length; <END> }</code><technical_language>boxing is please focus this PR new API. If want code base consistently boxing style a PR IMO. But: I prefer boxing unboxing takes place is free; this compiler opportunity flag unintentional boxing unboxing programmer decide happen</technical_language>

Target:
public boolean isSet(final String name) { return isMapped(name) && getHeaderMapRaw().get(name).intValue() < values.length; }
Source:
<code>private String updateIconUri(MPart part) { MPartDescriptor desc = modelService.getPartDescriptor(part.getElementId()); <START> String iconURI = desc != null && desc.getIconURI() != null ? desc.getIconURI() : part.getIconURI(); <END> part.getTransientData().put(ICON_URI_FOR_PART, iconURI); return iconURI; }</code><technical_language>This code raises more (previously existing) concerns: 1. iconURI higher priority descriptor part? 2. if iconURI of descriptor is changed</technical_language>

Target:
private String updateIconUri(MPart part) { MPartDescriptor desc = modelService.getPartDescriptor(part.getElementId()); String iconURI = part.getIconURI(); if (iconURI == null && desc != null) { iconURI = desc.getIconURI(); } part.getTransientData().put(ICON_URI_FOR_PART, iconURI); return iconURI; }
Source:
<code>public void testCreate() throws StripeException { Map<String, Object> item = new HashMap<String, Object>(); item.put("plan", "silver-plan_123-898"); List<Object> items = new LinkedList<Object>(); items.add(item); Map<String, Object> params = new HashMap<String, Object>(); params.put("customer", "cus_123"); params.put("items", items); <START> Subscription subscription = Subscription.create(params); <END> assertNotNull(subscription); verifyRequest( APIResource.RequestMethod.POST, "/v1/subscriptions", params ); }</code><technical_language>called resource</technical_language>

Target:
public void testCreate() throws StripeException { final Map<String, Object> item = new HashMap<String, Object>(); item.put("plan", "silver-plan_123-898"); final List<Object> items = new LinkedList<Object>(); items.add(item); final Map<String, Object> params = new HashMap<String, Object>(); params.put("customer", "cus_123"); params.put("items", items); final Subscription subscription = Subscription.create(params); assertNotNull(subscription); verifyRequest( APIResource.RequestMethod.POST, "/v1/subscriptions", params ); }
Source:
<code>public List<Predicate<Entity>> createPredicates(Map<String, String> arguments, String mainSelector, ICommandSender sender, Vec3d position) { List<Predicate<Entity>> predicates = Lists.newArrayList(); String health = arguments.get("forge:min_health"); if (health != null) { final boolean invert = health.startsWith("!"); if (invert) { health = health.substring(1); } try { final int value = Integer.parseInt(health); predicates.add(new Predicate<Entity>() { @Override public boolean apply(@Nullable Entity input) { if (!(input instanceof EntityLivingBase)) return false; boolean health = ((EntityLivingBase) input).getHealth() >= value; <START> return invert && !health || !invert && health; <END> } }); } catch (NumberFormatException e) { sender.sendMessage(new TextComponentString("Entity selector 'forge:min_health' has to be an integer")); } } return predicates; }</code><technical_language>changed invert != health</technical_language>

Target:
public List<Predicate<Entity>> createPredicates(Map<String, String> arguments, String mainSelector, ICommandSender sender, Vec3d position) { String health = arguments.get("forge:min_health"); if (health != null) { final boolean invert = health.startsWith("!"); if (invert) { health = health.substring(1); } try { final int value = Integer.parseInt(health); return Collections.<Predicate<Entity>>singletonList(new Predicate<Entity>() { @Override public boolean apply(@Nullable Entity input) { if (!(input instanceof EntityLivingBase)) return false; return (((EntityLivingBase) input).getHealth() >= value)!=invert; } }); } catch (NumberFormatException e) { sender.sendMessage(new TextComponentString("Entity selector 'forge:min_health' has to be an integer")); } } return Collections.emptyList(); }
Source:
<code>protected Application configure() { HiveConf conf = new HiveConf(); conf.addResource(Thread.currentThread().getContextClassLoader().getResource("grillserver-default.xml")); <START> conf.addResource(Thread.currentThread().getContextClassLoader().getResource("grill-site.xml")); <END> GrillApplication.init(conf); return new GrillApplication(); }</code><technical_language>Lets this a method in GrillServices get conf</technical_language>

Target:
protected Application configure() { return new GrillApplication(); }
Source:
<code>public String getFirstName() { <START> return mFirstName; <END> }</code><technical_language>StringUtils.notNullStr(mFirstName) null is returned. for getLastName() getAboutMe(). This code calls routines worry null, accidentally write nulls db</technical_language>

Target:
public String getFirstName() { return StringUtils.notNullStr(mFirstName); }
Source:
<code>protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { try { String name = desc.getName(); return Class.forName(name, false, classLoader); } catch (ClassNotFoundException e) { try { return super.resolveClass(desc); } catch (ClassNotFoundException e1) { try { return BeanManagerImpl.class.getClassLoader().loadClass(desc.getName()); } catch (ClassNotFoundException cnfe) { if (lastResortClassLoader != null) { return lastResortClassLoader.loadClass(desc.getName()); } else { <START> throw new ClassNotFoundException(cnfe.getMessage(), cnfe.getCause()); <END> } } } } }</code><technical_language>simply throw cnfe</technical_language>

Target:
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { try { String name = desc.getName(); return Class.forName(name, false, tccl); } catch (ClassNotFoundException e) { try { return super.resolveClass(desc); } catch (ClassNotFoundException e1) { try { return BeanManagerImpl.class.getClassLoader().loadClass(desc.getName()); } catch (ClassNotFoundException cnfe) { if (optionalClassLoader != null) { return optionalClassLoader.loadClass(desc.getName()); } else { throw cnfe; } } } } }
Source:
<code>public List<Task<? extends Serializable>> handle(Context context) throws SemanticException { AlterPartitionMessage msg = deserializer.getAlterPartitionMessage(context.dmd.getPayload()); String actualDbName = context.isDbNameEmpty() ? msg.getDB() : context.dbName; String actualTblName = context.isTableNameEmpty() ? msg.getTable() : context.tableName; Map<String, String> partSpec = new LinkedHashMap<>(); try { org.apache.hadoop.hive.metastore.api.Table tblObj = msg.getTableObj(); Iterator<String> afterIterator = msg.getPtnObjAfter().getValuesIterator(); for (FieldSchema fs : tblObj.getPartitionKeys()) { partSpec.put(fs.getName(), afterIterator.next()); } } catch (Exception e) { if (!(e instanceof SemanticException)) { throw new SemanticException("Error reading message members", e); } else { throw (SemanticException) e; } } <START> TruncateTableDesc truncateTableDesc = new TruncateTableDesc(actualDbName + "." + actualTblName, partSpec, <END> eventOnlyReplicationSpec(context)); Task<DDLWork> truncatePtnTask = TaskFactory.get( new DDLWork(readEntitySet, writeEntitySet, truncateTableDesc), context.hiveConf); context.log.debug("Added truncate ptn task : {}:{}", truncatePtnTask.getId(), truncateTableDesc.getTableName()); databasesUpdated.put(actualDbName, context.dmd.getEventTo()); tablesUpdated.put(actualDbName + "." + actualTblName, context.dmd.getEventTo()); return Collections.singletonList(truncatePtnTask); }</code><technical_language>i code width moves 100 characters, want format</technical_language>

Target:
public List<Task<? extends Serializable>> handle(Context context) throws SemanticException { AlterPartitionMessage msg = deserializer.getAlterPartitionMessage(context.dmd.getPayload()); String actualDbName = context.isDbNameEmpty() ? msg.getDB() : context.dbName; String actualTblName = context.isTableNameEmpty() ? msg.getTable() : context.tableName; Map<String, String> partSpec = new LinkedHashMap<>(); try { org.apache.hadoop.hive.metastore.api.Table tblObj = msg.getTableObj(); Iterator<String> afterIterator = msg.getPtnObjAfter().getValuesIterator(); for (FieldSchema fs : tblObj.getPartitionKeys()) { partSpec.put(fs.getName(), afterIterator.next()); } } catch (Exception e) { if (!(e instanceof SemanticException)) { throw new SemanticException("Error reading message members", e); } else { throw (SemanticException) e; } } TruncateTableDesc truncateTableDesc = new TruncateTableDesc( actualDbName + "." + actualTblName, partSpec, context.eventOnlyReplicationSpec()); Task<DDLWork> truncatePtnTask = TaskFactory.get( new DDLWork(readEntitySet, writeEntitySet, truncateTableDesc), context.hiveConf); context.log.debug("Added truncate ptn task : {}:{}", truncatePtnTask.getId(), truncateTableDesc.getTableName()); databasesUpdated.put(actualDbName, context.dmd.getEventTo()); tablesUpdated.put(actualDbName + "." + actualTblName, context.dmd.getEventTo()); return Collections.singletonList(truncatePtnTask); }
Source:
<code>public void importProjectFromSVN(Object rootLocation, String[] projectLocations) { try { if (rootLocation instanceof IRepositoryResource) { } else { rootLocation = createRepositoryLocation(rootLocation.toString(), null); } List<IRepositoryResource> doCeckout_tmp = new ArrayList<IRepositoryResource>(); for (String location : projectLocations) { doCeckout_tmp.add(getRepositoryProjectResource((IRepositoryLocation) rootLocation, location)); } final IRepositoryResource[] doCeckout = doCeckout_tmp.toArray(new IRepositoryResource[] {}); Display.getDefault().syncExec(new Runnable() { @Override public void run() { Shell sh = Display.getDefault().getActiveShell(); IActionOperation op = ExtensionsManager.getInstance().getCurrentCheckoutFactory() .getCheckoutOperation(sh, doCeckout, null, true, null, SVNDepth.INFINITY, false); UIMonitorUtility.doTaskNowDefault(op, true); } }); } catch (Exception ex) { <START> System.out.println(ex.getMessage()); <END> } }</code><technical_language>print show for user. logger report error/warning goues error view</technical_language>

Target:
public void importProjectFromSVN(Object rootLocation, String[] projectLocations) { try { if (rootLocation instanceof IRepositoryResource) { } else { rootLocation = createRepositoryLocation(rootLocation.toString(), null, null); } List<IRepositoryResource> doCeckout_tmp = new ArrayList<IRepositoryResource>(); for (String location : projectLocations) { doCeckout_tmp.add(getRepositoryProjectResource((IRepositoryLocation) rootLocation, location)); } final IRepositoryResource[] doCeckout = doCeckout_tmp.toArray(new IRepositoryResource[] {}); Display.getDefault().syncExec(new Runnable() { @Override public void run() { Shell sh = Display.getDefault().getActiveShell(); IActionOperation op = ExtensionsManager.getInstance().getCurrentCheckoutFactory() .getCheckoutOperation(sh, doCeckout, null, true, null, SVNDepth.INFINITY, false); UIMonitorUtility.doTaskNowDefault(op, true); } }); } catch (Exception ex) { System.out.println(ex.getMessage()); } }
Source:
<code>public DbUser doLogin(Map<String, Object> authResult) throws IOException, ServletException { DbUser user = null; try { String profileName = (String) authResult.get(FiltersHelper.Constants.REQUEST_PROFILE_KEY); ExtMap authRecord = (ExtMap) authResult.get(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY); if (authRecord != null) { <START> InitialContext context = new InitialContext(); <END> try { VdcLoginReturnValueBase returnValue = (VdcLoginReturnValueBase) FiltersHelper.getBackend(context).login(new LoginUserParameters( profileName, authRecord, VdcActionType.LoginUser, (AuthType) authResult.get(FiltersHelper.Constants.REQUEST_AUTH_TYPE_KEY) ) ); if (returnValue.getSucceeded()) { authResult.put( SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY, returnValue.getSessionId() ); log.info("returnValue.getSessionId() = " + returnValue.getSessionId()); user = (DbUser) returnValue.getActionReturnValue(); ((EnginePrincipal) this.getIdentity()).setEngineSessionId(returnValue.getSessionId()); } } finally { context.close(); } } } catch (Exception ex) { log.error("Error in login to engine ", ex); } return user; }</code><technical_language>Double try of new InitialContext? IMHO Mike Kolesnik added some utility Autoclosable wrapper - a. I suggest move uutils b. here</technical_language>

Target:
public DbUser doLogin(Map<String, Object> authResult) throws IOException, ServletException { DbUser user = null; String profileName = (String) authResult.get(FiltersHelper.Constants.REQUEST_PROFILE_KEY); ExtMap authRecord = (ExtMap) authResult.get(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY); if (authRecord != null) { try { VdcLoginReturnValueBase returnValue = (VdcLoginReturnValueBase) BackendUtils.getBackendLocal(log).login(new LoginUserParameters( profileName, authRecord, VdcActionType.LoginUser, (AuthType) authResult.get(FiltersHelper.Constants.REQUEST_AUTH_TYPE_KEY) ) ); if (returnValue.getSucceeded()) { authResult.put( SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY, returnValue.getSessionId() ); log.info("returnValue.getSessionId() = " + returnValue.getSessionId()); user = (DbUser) returnValue.getActionReturnValue(); ((EnginePrincipal) this.getIdentity()).setEngineSessionId(returnValue.getSessionId()); } } catch (Exception ex) { log.error("Error in login to engine ", ex); } } return user; }
Source:
<code>public List<Class> getSupportedTypes() { <START> return new ArrayList<>(Arrays.asList(boolean.class, Boolean.class)); <END> }</code><technical_language>return Arrays.asList(boolean.class, Boolean.class)</technical_language>

Target:
public List<Class> getSupportedTypes() { return Arrays.asList(boolean.class, Boolean.class); }
Source:
<code>public String[] getColumnTexts(@NonNull ITimeGraphEntry entry) { String[] texts = new <START> String[fColumns.length]; <END> for (int i = 0; i < fColumns.length; i++) { texts[i] = fLabelProvider.getColumnText(entry, i); } return texts; }</code><technical_language>Null pointer..</technical_language>

Target:
public String[] getColumnTexts(@NonNull ITimeGraphEntry entry) { String[] texts = null; if (fColumns != null) { texts = new String[fColumns.length]; for (int i = 0; i < fColumns.length; i++) { texts[i] = fLabelProvider.getColumnText(entry, i); } } else { texts = new String[1]; texts[0] = entry.getName(); } return texts; }
Source:
<code>public NodeValue getAccValue() { if ( count == 0 ) return noValuesToMedian ; if ( super.errorCount != 0 ) return null ; double[] arrDouble = new double[collection.size()]; for(int i=0; i<collection.size(); i++){ <START> arrDouble[i] = Double.parseDouble(collection.get(i).toString()); <END> } System.out.println(new Median().evaluate(arrDouble)); return (NodeValue.makeDecimal((new Median().evaluate(arrDouble )))); }</code><technical_language>NodeValue.getDouble() parsed</technical_language>

Target:
public NodeValue getAccValue() { double median; if ( count == 0 ) return noValuesToMedian ; if ( super.errorCount != 0 ) return null ; int indexsize = collection.size(); double[] arrDouble = new double[indexsize]; for(int i=0; i<indexsize; i++){ arrDouble[i] = collection.get(i).getDouble(); } Arrays.sort(arrDouble); if(indexsize%2!=0) { median = arrDouble[(indexsize/2)]; }else { median = ((arrDouble[(indexsize/2)]+arrDouble[((indexsize/2)-1)])/2); } return NodeValue.makeDecimal(median); }
Source:
<code>public void testCreateShareableSuccess() throws Exception { when(subjectIdentity.getIdentityAttribute()).thenReturn(TEST_ID_ATTR); Map<String, SortedSet<String>> attrs = ImmutableMap.of(TEST_ID_ATTR, ImmutableSortedSet.of("owner")); <START> ShareableMetacardPreIngestPlugin wpip = makePlugin(attrs); <END> ShareableMetacardImpl shareableMetacard = new ShareableMetacardImpl(); wpip.process(new CreateRequestImpl(shareableMetacard)); assertThat(shareableMetacard.getOwner(), is("owner")); }</code><technical_language>wpip? preingestPlugin plugin instead</technical_language>

Target:
public void testCreateShareableSuccess() throws Exception { when(subjectIdentity.getIdentityAttribute()).thenReturn(TEST_ID_ATTR); ShareableMetacardPreIngestPlugin plugin = makePlugin(); ShareableMetacardImpl shareableMetacard = new ShareableMetacardImpl(); shareableMetacard.setTags(Collections.singleton(WorkspaceAttributes.WORKSPACE_TAG)); plugin.process(new CreateRequestImpl(shareableMetacard)); assertThat(shareableMetacard.getOwner(), is("owner")); }
Source:
<code>public void testSimple() { TestTransaction tx1 = new TestTransaction(env); <START> tx1.mutate().row("row1").fam("fam1").qual("q1").set("v1"); <END> tx1.mutate().row("row2").fam("fam1").qual("q2").set("v2"); tx1.mutate().row("row2").fam("fam2").qual("q3").set("v3"); tx1.mutate().row("row2").fam("fam2").qual("q1").set("v4"); tx1.done(); MiniAppRunner runner = new MiniAppRunner(config); runner.waitUntilFinished(); Assert.assertEquals(4, runner.scan(new String[] {})); Assert.assertEquals(1, runner.scan(new String[] {"-r", "row1"})); Assert.assertEquals(3, runner.scan(new String[] {"-r", "row2"})); Assert.assertEquals(2, runner.scan(new String[] {"-c", "fam1"})); Assert.assertEquals(1, runner.scan(new String[] {"-c", "fam1:q2"})); }</code><technical_language>this create notifications</technical_language>

Target:
public void testSimple() { try(TypedTransaction tx1 = tl.wrap(client.newTransaction())){ tx1.mutate().row("row1").fam("ingest").qual("num").set(1); tx1.mutate().row("row2").fam("ingest").qual("num").set(1); tx1.mutate().row("row3").fam("ingest").qual("num").set(1); tx1.commit(); } Environment env = new Environment(config); MiniAppRunner runner = new MiniAppRunner(config); Assert.assertEquals(3, runner.countNotifications(env)); runner.waitUntilFinished(); Assert.assertEquals(0, runner.countNotifications(env)); Assert.assertEquals(3, runner.scan(new String[] {})); Assert.assertEquals(1, runner.scan(new String[] {"-r", "row1"})); Assert.assertEquals(1, runner.scan(new String[] {"-r", "row2"})); Assert.assertEquals(3, runner.scan(new String[] {"-c", "count"})); Assert.assertEquals(0, runner.scan(new String[] {"-c", "ingest"})); }
Source:
<code><START> public Builder queryString(String queryString) { <END> command.queryString = queryString; return builder; }</code><technical_language>boilerplate :\ this easier do [AutoValue](<LINK_0></technical_language>

Target:
public Builder queryString(String queryString) { command.queryString = queryString; return this; }