auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean isNestedCopyfile(CopyFile copyfile) { <START> if (copyfile.dest.indexOf('/') == -1) return false; for (RepoProject proj : filteredProjects) { if (proj.getPath().compareTo(copyfile.dest) > 0) return false; <END> if (proj.isAncestorOf(copyfile.dest)) { return true; } } return false; }</code><technical_language>nit: missing braces if bodies (<LINK_0></technical_language>

Target:
private boolean isNestedCopyfile(CopyFile copyfile) { if (copyfile.dest.indexOf('/') == -1) { return false; } for (RepoProject proj : filteredProjects) { if (proj.getPath().compareTo(copyfile.dest) > 0) { return false; } if (proj.isAncestorOf(copyfile.dest)) { return true; } } return false; }
Source:
<code>public void createProjectFromXMLWithSpaces() throws IOException { <START> final String xml = "<?xml version='1.0' encoding='UTF-8'?>\n" + <END> "<!DOCTYPE project[\n" + " <!ENTITY foo SYSTEM \"file:/ "]>\n" + "<project>\n" + " <actions/>\n" + " <description>&foo;</description>\n" + " <keepDependencies>false</keepDependencies>\n" + " <properties/>\n" + " <scm class=\"hudson.scm.NullSCM\"/>\n" + " <canRoam>true</canRoam>\n" + " <triggers/>\n" + " <builders/>\n" + " <publishers/>\n" + " <buildWrappers/>\n" + "</project>"; Item foo = r.jenkins.createProjectFromXML("foo bar", new ByteArrayInputStream(xml.getBytes())); assertThat(Items.getConfigFile(foo).asString(), containsString("<description/>")); }</code><technical_language>this test is testing more spaces. ENTITY stripped here</technical_language>

Target:
public void createProjectFromXMLWithSpaces() throws IOException { final String xml = "<?xml version='1.0' encoding='UTF-8'?>\n" + "<project>\n" + " <actions/>\n" + " <description>JENKINS-35638</description>\n" + " <keepDependencies>false</keepDependencies>\n" + " <properties/>\n" + " <scm class=\"hudson.scm.NullSCM\"/>\n" + " <canRoam>true</canRoam>\n" + " <triggers/>\n" + " <builders/>\n" + " <publishers/>\n" + " <buildWrappers/>\n" + "</project>"; Item foo = r.jenkins.createProjectFromXML("foo bar", new ByteArrayInputStream(xml.getBytes())); assertNotNull(foo); }
Source:
<code>public boolean removeAllRps() { try { <START> List<RpObject> rps = this.persistenceEntryManager.findEntries(String.format("%s,%s", new Object[]{getRpOu(), getOxdDn()}), RpObject.class, null); <END> for (RpObject rp : rps) { this.persistenceEntryManager.remove(rp); } LOG.debug("Removed all Rps successfully. "); return true; } catch (Exception e) { if (((e instanceof EntryPersistenceException)) && (e.getMessage().contains("Failed to find entries"))) { LOG.warn("Failed to fetch RpObjects. ", e.getMessage()); return true; } LOG.error("Failed to remove all Rps", e); } return false; }</code><technical_language>is conditional remove, need fetch removing.<LINK_0></technical_language>

Target:
public boolean removeAllRps() { try { this.persistenceEntryManager.remove(String.format("%s,%s", new Object[]{getRpOu(), getOxdDn()}), RpObject.class, null, this.configuration.getPersistenceManagerRemoveCount()); LOG.debug("Removed all Rps successfully. "); return true; } catch (Exception e) { LOG.error("Failed to remove all Rps", e); } return false; }
Source:
<code>public void slicesIncludeDuplicates() { <START> Series series = new Series("777777"); <END> List<List<Integer>> expected = Arrays.asList( Arrays.asList(7, 7, 7), Arrays.asList(7, 7, 7), Arrays.asList(7, 7, 7), Arrays.asList(7, 7, 7) ); List<List<Integer>> actual = series.slices(3); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }</code><technical_language>I indentation is a bit wrong here</technical_language>

Target:
public void slicesIncludeDuplicates() { Series series = new Series("777777"); List<List<String>> expected = Arrays.asList( Arrays.asList("7", "7", "7"), Arrays.asList("7", "7", "7"), Arrays.asList("7", "7", "7"), Arrays.asList("7", "7", "7") ); List<List<String>> actual = series.slices(3); assertEquals(expected, actual); }
Source:
<code>public RuntimeException convert(PersistenceException exception, Object entity) { if (exception instanceof OptimisticLockException) { return new ConcurrentModificationException( "Account has the wrong version number; it may have been saved in the background."); } if (exception.getCause() instanceof org.hibernate.exception.ConstraintViolationException) { Throwable cause = Throwables.getRootCause(exception); String message = cause.getMessage(); if (message != null && entity != null) { HibernateAccount account = (HibernateAccount)entity; EntityAlreadyExistsException eae = null; if (message.matches("Duplicate entry.*for key 'Accounts-StudyId-ExternalId-Index'")) { eae = createEntityAlreadyExistsException("External ID", AccountId.forExternalId(account.getStudyId(), account.getExternalId())); } else if (message.matches("Duplicate entry.*for key 'Accounts-StudyId-Email-Index'")) { eae = createEntityAlreadyExistsException("Email address", AccountId.forEmail(account.getStudyId(), account.getEmail())); } else if (message.matches("Duplicate entry.*for key 'Accounts-StudyId-Phone-Index'")) { eae = createEntityAlreadyExistsException("Phone number", AccountId.forPhone(account.getStudyId(), account.getPhone())); } if (eae != null) { return eae; <START> } <END> } ConstraintViolationException.Builder cveBuilder = new ConstraintViolationException.Builder(); if (message != null) { cveBuilder.withMessage(cause.getMessage()); } return cveBuilder.build(); } return exception; }</code><technical_language>original exception include email address phone number, get logged. I recommend converting a exception a generic message instead</technical_language>

Target:
public RuntimeException convert(PersistenceException exception, Object entity) { if (exception instanceof OptimisticLockException) { return new ConcurrentModificationException( "Account has the wrong version number; it may have been saved in the background."); } if (exception.getCause() instanceof org.hibernate.exception.ConstraintViolationException) { Throwable cause = Throwables.getRootCause(exception); String message = cause.getMessage(); if (message != null && entity != null) { HibernateAccount account = (HibernateAccount)entity; EntityAlreadyExistsException eae = null; if (message.matches("Duplicate entry.*for key 'Accounts-StudyId-ExternalId-Index'")) { eae = createEntityAlreadyExistsException("External ID", AccountId.forExternalId(account.getStudyId(), account.getExternalId())); } else if (message.matches("Duplicate entry.*for key 'Accounts-StudyId-Email-Index'")) { eae = createEntityAlreadyExistsException("Email address", AccountId.forEmail(account.getStudyId(), account.getEmail())); } else if (message.matches("Duplicate entry.*for key 'Accounts-StudyId-Phone-Index'")) { eae = createEntityAlreadyExistsException("Phone number", AccountId.forPhone(account.getStudyId(), account.getPhone())); } if (eae != null) { return eae; } } return new ConstraintViolationException.Builder() .withMessage("Accounts table constraint prevented save or update.").build(); } return exception; }
Source:
<code>public void OnRestore() { importModel = (ImportVmModel) getWindow(); if (importModel.getProgress() != null) { return; } if (!importModel.Validate()) { return; } cloneVmMap = new HashMap<Guid, VM>(); vmsInSetupMap = new HashMap<Guid, VM>(); <START> if (importModel.hasVmInSystem()) { <END> for (VM vm : (ArrayList<VM>) importModel.getItems()) { if (importModel.isObjectInSetup(vm)) { vmsInSetupMap.put(vm.getId(), vm); } } } excuteImportClone(); }</code><technical_language>do need this 'if' for? supposed indication in model vm is in system user starts importing checking in a loop for VMs marked for import</technical_language>

Target:
public void OnRestore() { importModel = (ImportVmModel) getWindow(); if (importModel.getProgress() != null) { return; } if (!importModel.Validate()) { return; } cloneVmMap = new HashMap<Guid, VM>(); vmsInSetupMap = new HashMap<Guid, VM>(); for (VM vm : (ArrayList<VM>) importModel.getItems()) { if (importModel.isObjectInSetup(vm)) { vmsInSetupMap.put(vm.getId(), vm); } } executeImportClone(); }
Source:
<code>public List<TaskDTO> findOpenTasksWithoutCorrectionForCurrentUser(String sort) throws DataException { <START> LoginForm login = (LoginForm) Helper.getManagedBeanValue("#{LoginForm}"); <END> if (login == null) { return new ArrayList<>(); } List<JSONObject> results = findByProcessingStatusUserAndPriority(TaskStatus.INWORK, login.getMyBenutzer().getId(), 10, sort); return convertJSONObjectsToDTOs(results, false); }</code><technical_language>Rebase error - Helper.getCurrentUser</technical_language>

Target:
public List<TaskDTO> findOpenTasksWithoutCorrectionForCurrentUser(String sort) throws DataException { User user = Helper.getCurrentUser(); if (user == null) { return new ArrayList<>(); } List<JSONObject> results = findByProcessingStatusUserAndPriority(TaskStatus.INWORK, user.getId(), 10, sort); return convertJSONObjectsToDTOs(results, false); }
Source:
<code>public void execute(Object message) throws Exception { for (final ActorRef call : calls) { final Leave leave = new Leave(); call.tell(leave, super.source); } <START> conferenceApiClient = conferenceApiClient(); <END> conferenceApiClient.tell(message, self()); }</code><technical_language>@maria-farooq Is a if a conference remote participants not? This a great improvement in order save resources creating executing ConferenceApiClient</technical_language>

Target:
public void execute(Object message) throws Exception { for (final ActorRef call : calls) { final Leave leave = new Leave(); call.tell(leave, super.source); } kickoutRemoteParticipants(); }
Source:
<code>private static Object handleBootstrapSequencerResponse(ResponseMsg msg, ChannelHandlerContext ctx, IClientRouter r) { BootstrapSequencerResponseMsg responseMsg = msg.getPayload().getBootstrapSequencerResponse(); BootstrapSequencerResponseMsg.Type type = responseMsg.getRespType(); <START> switch (type) { case ACK: return true; case NACK: return false; default: throw new UnsupportedOperationException("Response handler not provided"); } <END> }</code><technical_language>this a boolean return result? I this is done in layout PR</technical_language>

Target:
private static Object handleBootstrapSequencerResponse(ResponseMsg msg, ChannelHandlerContext ctx, IClientRouter r) { BootstrapSequencerResponseMsg responseMsg = msg.getPayload().getBootstrapSequencerResponse(); return responseMsg.getIsBootstrapped(); }
Source:
<code>private void buildNewArrayInvocation(BlockBuilder blockBuilder, IdentifierGenerator idGenerator, NewArrayTree tree) { Expression.Variable newArray = variableWithId(idGenerator.newIdFor(tree)); blockBuilder.newObject(newArray, tree.symbolType().fullyQualifiedName(), location(tree)); idGenerator.varForExpression(tree, newArray.id()); List<ExpressionTree> initializers = tree.initializers(); <START> if (!initializers.isEmpty() && isObject(initializers.get(0).symbolType())) { <END> initializers.forEach(i -> { Expression argument = idGenerator.lookupExpressionFor(i); blockBuilder.assignTo(variableWithId(idGenerator.newId()), arraySet(newArray, argument), location(tree)); }); } }</code><technical_language>checking element? java void foo(String tainted) { Object[] array = {0, tainted}; String query = String.format("SELECT * %1 LIMIT %0", array); // ... } For mixed type arrays, want check initializers</technical_language>

Target:
private void buildNewArrayInvocation(BlockBuilder blockBuilder, IdentifierGenerator idGenerator, NewArrayTree tree) { if (tree.type() != null && !isObject(tree.type().symbolType())) { return; } Expression.Variable newArray = variableWithId(idGenerator.newIdFor(tree)); blockBuilder.newObject(newArray, tree.symbolType().fullyQualifiedName(), location(tree)); idGenerator.varForExpression(tree, newArray.id()); tree.initializers().stream().filter(i -> isObject(i.symbolType())).forEach(i -> { Expression argument = idGenerator.lookupExpressionFor(i); blockBuilder.assignTo(variableWithId(idGenerator.newId()), arraySet(newArray, argument), location(tree)); }); }
Source:
<code>public CommandLineParser getCommandLineParser() { if (commandLineParser == null) { commandLineParser = useLegacyParser(getClass()) ? new LegacyCommandLineArgumentParser(this) : new CommandLineArgumentParser(this, Collections.EMPTY_LIST, <START> new HashSet<>(Arrays.asList(CommandLineParserOptions.APPEND_TO_COLLECTIONS))); <END> } return commandLineParser; }</code><technical_language>Collections.singletonList</technical_language>

Target:
public CommandLineParser getCommandLineParser() { if (commandLineParser == null) { commandLineParser = useLegacyParser(getClass()) ? new LegacyCommandLineArgumentParser(this) : new CommandLineArgumentParser(this, Collections.EMPTY_LIST, new HashSet<>(Collections.singleton(CommandLineParserOptions.APPEND_TO_COLLECTIONS))); } return commandLineParser; }
Source:
<code>public static InferredAxiomGenerator<? extends OWLAxiom> getInferredAxiomGenerator( String axGenerator) throws Exception { switch (axGenerator.toLowerCase()) { case "subclass": case "": return new InferredSubClassAxiomGenerator(); case "disjointclasses": return new InferredDisjointClassesAxiomGenerator(); case "equivalentclass": return new InferredEquivalentClassAxiomGenerator(); case "datapropertycharacteristic": return new InferredDataPropertyCharacteristicAxiomGenerator(); <START> case "equivalentdataproperty": <END> return new InferredEquivalentDataPropertiesAxiomGenerator(); case "subdataproperty": return new InferredSubDataPropertyAxiomGenerator(); case "classassertion": return new InferredClassAssertionAxiomGenerator(); case "propertyassertion": return new InferredPropertyAssertionGenerator(); case "equivalentobjectproperty": return new InferredEquivalentObjectPropertyAxiomGenerator(); case "inverseobjectproperties": return new InferredInverseObjectPropertiesAxiomGenerator(); case "objectpropertycharacteristic": return new InferredObjectPropertyCharacteristicAxiomGenerator(); case "subobjectproperty": return new InferredSubObjectPropertyAxiomGenerator(); default: throw new Exception(String.format(axiomGeneratorError, axGenerator)); } }</code><technical_language>For consistency, I this "properties" plural match class name</technical_language>

Target:
public static InferredAxiomGenerator<? extends OWLAxiom> getInferredAxiomGenerator( String axGenerator) { switch (axGenerator.toLowerCase()) { case "subclass": case "": return new InferredSubClassAxiomGenerator(); case "disjointclasses": return new InferredDisjointClassesAxiomGenerator(); case "equivalentclass": return new InferredEquivalentClassAxiomGenerator(); case "datapropertycharacteristic": return new InferredDataPropertyCharacteristicAxiomGenerator(); case "equivalentdataproperties": return new InferredEquivalentDataPropertiesAxiomGenerator(); case "subdataproperty": return new InferredSubDataPropertyAxiomGenerator(); case "classassertion": return new InferredClassAssertionAxiomGenerator(); case "propertyassertion": return new InferredPropertyAssertionGenerator(); case "equivalentobjectproperty": return new InferredEquivalentObjectPropertyAxiomGenerator(); case "inverseobjectproperties": return new InferredInverseObjectPropertiesAxiomGenerator(); case "objectpropertycharacteristic": return new InferredObjectPropertyCharacteristicAxiomGenerator(); case "subobjectproperty": return new InferredSubObjectPropertyAxiomGenerator(); default: throw new IllegalArgumentException(String.format(axiomGeneratorError, axGenerator)); } }
Source:
<code>private void createSearchMenu(Menu menuBar) { MenuItem item = new MenuItem(menuBar, SWT.CASCADE); item.setText(resAddressBook.getString("Search_menu_title")); Menu searchMenu = new Menu(shell, SWT.DROP_DOWN); item.setMenu(searchMenu); item = new MenuItem(searchMenu, SWT.NONE); item.setText(resAddressBook.getString("Find")); item.setAccelerator(SWT.MOD1 + 'F'); item.addSelectionListener(widgetSelectedAdapter( e -> { searchDialog.setMatchCase(false); searchDialog.setMatchWord(false); searchDialog.setSearchDown(true); searchDialog.setSearchString(""); searchDialog.setSelectedSearchArea(0); searchDialog.open(); })); item = new MenuItem(searchMenu, SWT.NONE); item.setText(resAddressBook.getString("Find_next")); item.setAccelerator(SWT.F3); item.addSelectionListener(widgetSelectedAdapter( e -> { <START> searchDialog.open(); <END> })); }</code><technical_language>Put in line</technical_language>

Target:
private void createSearchMenu(Menu menuBar) { MenuItem item = new MenuItem(menuBar, SWT.CASCADE); item.setText(resAddressBook.getString("Search_menu_title")); Menu searchMenu = new Menu(shell, SWT.DROP_DOWN); item.setMenu(searchMenu); item = new MenuItem(searchMenu, SWT.NONE); item.setText(resAddressBook.getString("Find")); item.setAccelerator(SWT.MOD1 + 'F'); item.addSelectionListener(widgetSelectedAdapter( e -> { searchDialog.setMatchCase(false); searchDialog.setMatchWord(false); searchDialog.setSearchDown(true); searchDialog.setSearchString(""); searchDialog.setSelectedSearchArea(0); searchDialog.open(); })); item = new MenuItem(searchMenu, SWT.NONE); item.setText(resAddressBook.getString("Find_next")); item.setAccelerator(SWT.F3); item.addSelectionListener(widgetSelectedAdapter( e -> searchDialog.open())); }
Source:
<code>public void testSizeInExplicitTxWithNonExistent() throws SystemException, NotSupportedException { assertEquals(0, cache.size()); cache.put("k", "v"); TransactionManager tm1 = TestingUtil.getTransactionManager(cache); tm1.begin(); try { <START> cache.get("no-exist"); <END> assertEquals(1, cache.size()); cache.put("no-exist", "value"); assertEquals(2, cache.size()); } finally { tm1.rollback(); } }</code><technical_language>assertNull? withTx... I moved this code another test</technical_language>

Target:
public void testSizeInExplicitTxWithNonExistent() throws Exception { assertEquals(0, cache.size()); cache.put("k", "v"); TransactionManager tm = TestingUtil.getTransactionManager(cache); withTx(tm, () -> { assertNull(cache.get("no-exist")); assertEquals(1, cache.size()); assertNull(cache.put("no-exist", "value")); assertEquals(2, cache.size()); tm.setRollbackOnly(); return null; }); }
Source:
<code>public void returnsNormallyWhenGivenNoMeasurementObjects() throws Exception { when(this.source.getXObjects(any(EntityReference.class))).thenReturn(null); NullPointerException exceptionWhenListIsNull = null; try { this.mocker.getComponentUnderTest().onEvent(event, source, data); } catch(NullPointerException e){ <START> exceptionWhenListIsNull = e; <END> } Assert.assertNull(exceptionWhenListIsNull); }</code><technical_language>need do this. If is exception thrown, test automatically fail. If, however, do want test calling a method throw exception, annotate method with: @Test(expected=NullPointerException.class)</technical_language>

Target:
public void returnsNormallyWhenGivenNoMeasurementObjects() throws Exception { when(this.source.getXObjects(any(EntityReference.class))).thenReturn(null); this.mocker.getComponentUnderTest().onEvent(event, source, data); }
Source:
<code>public WebDataHandler( Config config, IdentityManager identityManager, ObjectMapper objectMapper, Client client) { this.identityManager = identityManager; this.objectMapper = objectMapper; this.client = client; this.url = config.getString(Keys.FORWARD_URL); this.header = config.getString(Keys.FORWARD_HEADER); this.json = config.getBoolean(Keys.FORWARD_JSON); this.retryEnabled = config.getBoolean(Keys.FORWARD_RETRY_ENABLE); Integer retryDelayMin = config.getInteger(Keys.FORWARD_RETRY_DELAY_MIN, 1); <START> this.retryDelayMin = (retryDelayMin > 0 && retryDelayMin < 3600) ? retryDelayMin : 1; <END> Integer retryDelayMax = config.getInteger(Keys.FORWARD_RETRY_DELAY_MAX, 10); this.retryDelayMax = (retryDelayMax > retryDelayMin && retryDelayMax < 3600) ? retryDelayMax : retryDelayMin; Integer deliveryPendingLimit = config.getInteger(Keys.FORWARD_RETRY_PENDING_LIMIT, 100); this.deliveryPendingLimit = (retryDelayMax > 0) ? deliveryPendingLimit : 100; this.deliveryFaliuresInRow = new AtomicInteger(0); this.deliveryPendingCurrent = new AtomicInteger(0); }</code><technical_language>I recommend remove validations for ranges. good reason additional code for it. Configuration is intended for admin users, doing. For other configuration do validation, for consistency remove</technical_language>

Target:
public WebDataHandler( Config config, IdentityManager identityManager, ObjectMapper objectMapper, Client client) { this.identityManager = identityManager; this.objectMapper = objectMapper; this.client = client; this.url = config.getString(Keys.FORWARD_URL); this.header = config.getString(Keys.FORWARD_HEADER); this.json = config.getBoolean(Keys.FORWARD_JSON); this.retryEnabled = config.getBoolean(Keys.FORWARD_RETRY_ENABLE); this.retryDelay = config.getInteger(Keys.FORWARD_RETRY_DELAY, 100); this.retryCount = config.getInteger(Keys.FORWARD_RETRY_COUNT, 10); this.retryLimit = config.getInteger(Keys.FORWARD_RETRY_LIMIT, 100); this.deliveryPending = new AtomicInteger(0); }
Source:
<code>public String toHaskell() { StringBuilder out = new StringBuilder(); if (this.expr.isPresent()) { out.append("\\"); for (FunctionArgument argument : this.arguments) { out.append(" ").append(argument.toHaskell()); } out.append(" = "); out.append(this.expr.get().toHaskell()); <START> } <END> return out.toString(); }</code><technical_language>This is correct, lambda syntax in Haskell is (\x -> x + 10), notice space backslash (although allowed, sure) arrow instead of equals sign</technical_language>

Target:
public String toHaskell() { StringBuilder out = new StringBuilder(); if (!this.arguments.isEmpty()) { out.append("\\"); for (FunctionArgument argument : this.arguments) { out.append(" ").append(argument.toHaskell()); } out.append(" -> "); out.append(this.expr.toHaskell()); } else { out.append(this.expr.toHaskell()); } return out.toString(); }
Source:
<code>protected Node copyGraph(Node start) { Node copiedNode = new Node(); if (start instanceof Relation) copiedNode = new Relation(); copiedNode.setConcept(start.getConcept()); copiedNode.setId(start.getId()); copiedNode.setEventId(start.getEventId()); copiedNode.setType(start.getType()); copiedNode.setTerms(start.getTerms()); if (start instanceof Relation) { Node subject = ((Relation) start).getSubject(); Node predicate = ((Relation) start).getPredicate(); Node object = ((Relation) start).getObject(); ((Relation) copiedNode).setSubject(copyGraph(subject)); ((Relation) copiedNode).setPredicate(copyGraph(predicate)); ((Relation) copiedNode).setObject(copyGraph(object)); } else { <START> copiedNode.setAlternativeIds(start.getAlternativeIds()); <END> } return copiedNode; }</code><technical_language>alternativeIds is a property of node, put in line 198. need for else</technical_language>

Target:
protected Node copyGraph(Node start) { Node copiedNode = new Node(); if (start instanceof Relation) copiedNode = new Relation(); copiedNode.setConcept(start.getConcept()); copiedNode.setId(start.getId()); copiedNode.setEventId(start.getEventId()); copiedNode.setType(start.getType()); copiedNode.setTerms(start.getTerms()); copiedNode.setAlternativeIds(start.getAlternativeIds()); if (start instanceof Relation) { Node subject = ((Relation) start).getSubject(); Node predicate = ((Relation) start).getPredicate(); Node object = ((Relation) start).getObject(); ((Relation) copiedNode).setSubject(copyGraph(subject)); ((Relation) copiedNode).setPredicate(copyGraph(predicate)); ((Relation) copiedNode).setObject(copyGraph(object)); } return copiedNode; }
Source:
<code>public void broadcastState() { <START> Runtime.broadcastStates(); <END> }</code><technical_language>question before.. this handled in base class</technical_language>

Target:
public void broadcastState() { topStom.broadcastState(); midStom.broadcastState(); lowStom.broadcastState(); }
Source:
<code>public String toString() { return "KeepaliveInfo [" + " network=" + mNai.network + " startedState=" + startedStateString(mStartedState) + " " + IpUtils.addressAndPortToString(mPacket.srcAddress, mPacket.srcPort) + "->" + IpUtils.addressAndPortToString(mPacket.dstAddress, mPacket.dstPort) + " interval=" + mInterval + " packetData=" + HexDump.toHexString(mPacket.getPacket()) + <START> " uid=" + mUid + " pid=" + mPid <END> + " ]"; }</code><technical_language>Consider putting UID PID packet data is long</technical_language>

Target:
public String toString() { return "KeepaliveInfo [" + " network=" + mNai.network + " startedState=" + startedStateString(mStartedState) + " " + IpUtils.addressAndPortToString(mPacket.srcAddress, mPacket.srcPort) + "->" + IpUtils.addressAndPortToString(mPacket.dstAddress, mPacket.dstPort) + " interval=" + mInterval + " uid=" + mUid + " pid=" + mPid + " packetData=" + HexDump.toHexString(mPacket.getPacket()) + " ]"; }
Source:
<code>private void checkFeaturesUnset(IdentifiedElement object) { Collection<EStructuralFeature> exceptions = Lists.newArrayList(); Collection<EStructuralFeature> stackOverFlows = Lists.newArrayList(); for (EStructuralFeature f : object.eClass().getEAllStructuralFeatures()) { if (f.isChangeable()) { try { object.eUnset(f); } catch (Exception e) { exceptions.add(f); e.printStackTrace(); } catch (StackOverflowError s) { stackOverFlows.add(f); } } } StringBuilder sb = new StringBuilder(); buildMessage(sb, "Error(s) <START> occured on <END> ", object, exceptions); buildMessage(sb, "StackOverFlow(s) occured on ", object, stackOverFlows); if (sb.length() != 0) { fail(sb.toString()); } }</code><technical_language>occurred</technical_language>

Target:
private void checkFeaturesUnset(IdentifiedElement object) { Collection<EStructuralFeature> exceptions = Lists.newArrayList(); Collection<EStructuralFeature> stackOverFlows = Lists.newArrayList(); for (EStructuralFeature f : object.eClass().getEAllStructuralFeatures()) { if (f.isChangeable()) { try { object.eUnset(f); } catch (Exception e) { exceptions.add(f); e.printStackTrace(); } catch (StackOverflowError s) { stackOverFlows.add(f); } } } StringBuilder sb = new StringBuilder(); buildMessage(sb, "Error(s) occurred on ", object, exceptions); buildMessage(sb, "StackOverFlow(s) occurred on ", object, stackOverFlows); if (sb.length() != 0) { fail(sb.toString()); } }
Source:
<code>public static GluuConfiguration asGluuConfiguration(OxdServerConfiguration configuration) { try { JsonNode node = configuration.getStorageConfiguration(); if (node != null) { return Jackson2.createJsonMapper().treeToValue(node, GluuConfiguration.class); } } catch (Exception e) { LOG.error("Failed to parse GluuConfiguration.", e); } <START> return new GluuConfiguration(); <END> }</code><technical_language>Optional<GluuConfiguration> Optional.absetnt(). caller of this method idea blank/empty object</technical_language>

Target:
public static Optional<GluuConfiguration> asGluuConfiguration(OxdServerConfiguration configuration) { try { JsonNode node = configuration.getStorageConfiguration(); if (node != null) { return Optional.ofNullable(Jackson2.createJsonMapper().treeToValue(node, GluuConfiguration.class)); } } catch (Exception e) { LOG.error("Failed to parse GluuConfiguration.", e); } return Optional.empty(); }
Source:
<code>public Stat setData(String path, byte[] data, int version, long zxid, long time) throws KeeperException.NoNodeException { Stat s = new Stat(); DataNode n = nodes.get(path); if (n == null) { throw new KeeperException.NoNodeException(); } byte[] lastdata = null; synchronized (n) { lastdata = n.data; nodes.preChange(path, n); n.data = data; n.stat.setMtime(time); n.stat.setMzxid(zxid); n.stat.setVersion(version); n.copyStat(s); nodes.postChange(path, n); EphemeralType ephemeralType = EphemeralType.get(n.stat.getEphemeralOwner()); if (ephemeralType == EphemeralType.TTL) { <START> TTLNode ttlNode = ttlMap.get(path); <END> ttls.remove(ttlNode); ttlNode.setExpireTime(n.stat.getMtime() + ephemeralType.getValue(n.stat.getEphemeralOwner())); ttlMap.put(path, ttlNode); ttls.add(ttlNode); } } String lastPrefix = getMaxPrefixWithQuota(path); long dataBytes = data == null ? 0 : data.length; if (lastPrefix != null) { this.updateCountBytes(lastPrefix, dataBytes - (lastdata == null ? 0 : lastdata.length), 0); } nodeDataSize.addAndGet(getNodeSize(path, data) - getNodeSize(path, lastdata)); updateWriteStat(path, dataBytes); dataWatches.triggerWatch(path, EventType.NodeDataChanged); return s; }</code><technical_language>This get is needed. remove ttlMap create a new TTLNode add ttls ttlMap. Then, expireTime in TTLNode final setter removed. i.e. TTLNode ttlNode = ttlMap.remove(path); if (ttlNode != null) { ttls.remove(ttlNode); } ttlNode = new TTLNode(path, n.stat.getMtime() + ephemeralType.getValue(n.stat.getEphemeralOwner())); ttlMap.put(path, ttlNode); ttls.add(ttlNode);</technical_language>

Target:
public Stat setData(String path, byte[] data, int version, long zxid, long time) throws KeeperException.NoNodeException { Stat s = new Stat(); DataNode n = nodes.get(path); if (n == null) { throw new KeeperException.NoNodeException(); } byte[] lastdata = null; synchronized (n) { lastdata = n.data; nodes.preChange(path, n); n.data = data; n.stat.setMtime(time); n.stat.setMzxid(zxid); n.stat.setVersion(version); n.copyStat(s); nodes.postChange(path, n); EphemeralType ephemeralType = EphemeralType.get(n.stat.getEphemeralOwner()); if (ephemeralType == EphemeralType.TTL) { ttlManager.updateTTL(path, n); } } String lastPrefix = getMaxPrefixWithQuota(path); long dataBytes = data == null ? 0 : data.length; if (lastPrefix != null) { this.updateCountBytes(lastPrefix, dataBytes - (lastdata == null ? 0 : lastdata.length), 0); } nodeDataSize.addAndGet(getNodeSize(path, data) - getNodeSize(path, lastdata)); updateWriteStat(path, dataBytes); dataWatches.triggerWatch(path, EventType.NodeDataChanged); return s; }
Source:
<code>public GoogleCloudStorageOptions build() { GoogleCloudStorageOptions instance = autoBuild(); checkArgument( instance.getMaxBytesRewrittenPerCall() <= 0 || instance.getMaxBytesRewrittenPerCall() % (1024 * 1024) == 0, "maxBytesRewrittenPerCall must be an integral multiple of 1 MiB (1048576), but was: %s", instance.getMaxBytesRewrittenPerCall()); checkArgument( instance.getProxyAddress() != null || (instance.getProxyUsername() == null && instance.getProxyPassword() == null), "if proxyAddress is null then proxyUsername and proxyPassword should be null too"); checkArgument( (instance.getProxyUsername() == null) == (instance.getProxyPassword() == null), "both proxyUsername and proxyPassword should be null or not null together"); checkArgument( <START> instance.getEncryptionAlgorithm() != null <END> || (instance.getEncryptionKey() == null && instance.getEncryptionKeyHash() == null), "encryptionAlgorithm, encryptionKey and encryptionKeyHash should be null or not null" + " together"); return instance; }</code><technical_language>check of encryption properties set of set</technical_language>

Target:
public GoogleCloudStorageOptions build() { GoogleCloudStorageOptions instance = autoBuild(); checkArgument( instance.getMaxBytesRewrittenPerCall() <= 0 || instance.getMaxBytesRewrittenPerCall() % (1024 * 1024) == 0, "maxBytesRewrittenPerCall must be an integral multiple of 1 MiB (1048576), but was: %s", instance.getMaxBytesRewrittenPerCall()); checkArgument( instance.getProxyAddress() != null || (instance.getProxyUsername() == null && instance.getProxyPassword() == null), "if proxyAddress is null then proxyUsername and proxyPassword should be null too"); checkArgument( (instance.getProxyUsername() == null) == (instance.getProxyPassword() == null), "both proxyUsername and proxyPassword should be null or not null together"); checkArgument( isAllEncryptionOptionsSetOrUnset(instance), "encryptionAlgorithm, encryptionKey and encryptionKeyHash should be null or not null" + " together"); return instance; }
Source:
<code>public void testParsingSimpleDoc() throws IOException { try (InputStream irishSBXmlIn = <START> IrishSentenceBankDocumentTest.class.getResourceAsStream("irishsentencebank-sample.xml");) { <END> IrishSentenceBankDocument doc = IrishSentenceBankDocument.parse(irishSBXmlIn); List<IrishSentenceBankDocument.IrishSentenceBankSentence> sents = doc.getSentences(); Assert.assertEquals(2, sents.size()); IrishSentenceBankDocument.IrishSentenceBankSentence sent1 = sents.get(0); IrishSentenceBankDocument.IrishSentenceBankSentence sent2 = sents.get(1); Assert.assertEquals("A Dhia, tá mé ag iompar clainne!", sent1.getOriginal()); IrishSentenceBankDocument.IrishSentenceBankFlex[] flex = sent1.getFlex(); Assert.assertEquals(7, flex.length); Assert.assertEquals("A", flex[0].getSurface()); Assert.assertArrayEquals(new String[]{"a"}, flex[0].getFlex()); IrishSentenceBankDocument.IrishSentenceBankFlex[] flex2 = sent2.getFlex(); Assert.assertEquals("ón", flex2[4].getSurface()); Assert.assertArrayEquals(new String[]{"ó", "an"}, flex2[4].getFlex()); Assert.assertEquals("Excuse me, are you from the stone age?", sent2.getTranslation()); TokenSample ts = sent1.getTokenSample(); Span[] spans = ts.getTokenSpans(); Assert.assertEquals(9, spans.length); Assert.assertEquals(24, spans[7].getStart()); Assert.assertEquals(31, spans[7].getEnd()); Assert.assertEquals("clainne", ts.getText().substring(spans[7].getStart(), spans[7].getEnd())); } }</code><technical_language>unnecessary semi-colon</technical_language>

Target:
public void testParsingSimpleDoc() throws IOException { try (InputStream irishSBXmlIn = IrishSentenceBankDocumentTest.class.getResourceAsStream("irishsentencebank-sample.xml")) { IrishSentenceBankDocument doc = IrishSentenceBankDocument.parse(irishSBXmlIn); List<IrishSentenceBankDocument.IrishSentenceBankSentence> sents = doc.getSentences(); Assert.assertEquals(2, sents.size()); IrishSentenceBankDocument.IrishSentenceBankSentence sent1 = sents.get(0); IrishSentenceBankDocument.IrishSentenceBankSentence sent2 = sents.get(1); Assert.assertEquals("A Dhia, tá mé ag iompar clainne!", sent1.getOriginal()); IrishSentenceBankDocument.IrishSentenceBankFlex[] flex = sent1.getFlex(); Assert.assertEquals(7, flex.length); Assert.assertEquals("A", flex[0].getSurface()); Assert.assertArrayEquals(new String[]{"a"}, flex[0].getFlex()); IrishSentenceBankDocument.IrishSentenceBankFlex[] flex2 = sent2.getFlex(); Assert.assertEquals("ón", flex2[4].getSurface()); Assert.assertArrayEquals(new String[]{"ó", "an"}, flex2[4].getFlex()); Assert.assertEquals("Excuse me, are you from the stone age?", sent2.getTranslation()); TokenSample ts = sent1.getTokenSample(); Span[] spans = ts.getTokenSpans(); Assert.assertEquals(9, spans.length); Assert.assertEquals(24, spans[7].getStart()); Assert.assertEquals(31, spans[7].getEnd()); Assert.assertEquals("clainne", ts.getText().substring(spans[7].getStart(), spans[7].getEnd())); } }
Source:
<code>public void testSeek() { boolean result = fIterator.seek(1L); assertTrue(result); CtfTmfEvent event = fIterator.getCurrentEvent(); assertEquals("sys_socketcall", event.getName()); assertEquals(Long.valueOf(17), event.getContent().getFieldValue(Long.class, "call")); result = fIterator.seek(Long.MAX_VALUE); assertFalse(result); assertNull(fIterator.getCurrentEvent()); assertEquals(0L, fIterator.getCurrentTimestamp()); assertFalse(fIterator.advance()); result = fIterator.seek(new CtfLocationInfo(1332160882440133097L, 0L)); CtfTmfEvent <START> middleEvent = <END> fIterator.getCurrentEvent(); assertNotNull(middleEvent); assertEquals(1332170682440133097L, middleEvent.getTimestamp().toNanos()); assertEquals(1332170682440133097L, fIterator.getCurrentTimestamp()); result = fIterator.seek(CtfLocation.INVALID_LOCATION); assertEquals(event, fIterator.getCurrentEvent()); }</code><technical_language>firstEvent</technical_language>

Target:
public void testSeek() { CtfTmfTrace trace = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.TRACE2); try (CtfIterator iterator = (CtfIterator) trace.createIterator()) { assertTrue(iterator.seek(1L)); CtfTmfEvent event = iterator.getCurrentEvent(); assertEquals("sched_stat_runtime", event.getName()); assertEquals(Long.valueOf(2175), event.getContent().getFieldValue(Long.class, "tid")); assertFalse(iterator.seek(Long.MAX_VALUE)); assertNull(iterator.getCurrentEvent()); assertEquals(0L, iterator.getCurrentTimestamp()); assertFalse(iterator.advance()); assertTrue(iterator.seek(new CtfLocationInfo(1331668250328561095L, 0L))); CtfTmfEvent middleEvent = iterator.getCurrentEvent(); assertNotNull(middleEvent); assertEquals(1331668250328561095L, middleEvent.getTimestamp().toNanos()); assertEquals(1331668250328561095L, iterator.getCurrentTimestamp()); assertTrue(iterator.seek(new CtfLocationInfo(1331668247328921944L, 1L))); CtfTmfEvent doubleEvent = iterator.getCurrentEvent(); assertNotNull(doubleEvent); assertEquals(1331668247328921944L, doubleEvent.getTimestamp().toNanos()); assertEquals(1331668247328921944L, iterator.getCurrentTimestamp()); assertEquals("sched_switch", doubleEvent.getName()); assertFalse(iterator.seek(CtfLocation.INVALID_LOCATION)); assertEquals(doubleEvent, iterator.getCurrentEvent()); } trace.dispose(); }
Source:
<code>public void filter(ContainerRequestContext requestContext) throws IOException { final String authorization = requestContext.getHeaderString("Authorization"); final String method = requestContext.getMethod(); String accountId = getAccountId(requestContext); try { rateLimiter.checkRateOf(accountId, method + "-" + authorization, method); } catch (RateLimitException e) { <START> LOGGER.info("Rate limit reached for current service and account [{}]. Sending response '429 Too Many Requests'", accountId); <END> setTooManyRequestsError(); } }</code><technical_language>check rate limiting based a composite key comprised of method api key. sense log api key this log entry mention method account id? I log method part of throwing RateLimiteException necessary add too, happy approve as-is</technical_language>

Target:
public void filter(ContainerRequestContext requestContext) throws IOException { final String authorization = requestContext.getHeaderString("Authorization"); final String method = requestContext.getMethod(); String accountId = getAccountId(requestContext); try { rateLimiter.checkRateOf(accountId, method + "-" + authorization, method); } catch (RateLimitException e) { LOGGER.info("Rate limit reached for current service [account - {}, method - {}]. Sending response '429 Too Many Requests'", accountId, method); setTooManyRequestsError(); } }
Source:
<code>protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException { conn = ((JdbcSchema) db).getConnection(); dialect = ((JdbcSchema) db).getDialect(); Map<String, PrimaryKey> corrections = findPKUpdates(); if (corrections.isEmpty()) { return; } ui.message("Wrong Primary Key Column Order Detected"); ui.message("The following tables are affected:"); ui.message(Joiner.on(", ").join(corrections.keySet())); <START> if (ui.yesno(true, "Fix primary keys column order")) { <END> ui.message("fixing primary keys..."); JdbcExecutor executor = new JdbcExecutor(conn); try { for (Map.Entry<String, PrimaryKey> c : corrections.entrySet()) { ui.message(String.format(" table: %s ... ", c.getKey())); recreatePK(executor, c.getKey(), c.getValue(), ui); ui.message("done"); } ui.message("done"); } finally { executor.close(); } } }</code><technical_language>I agree, offer option</technical_language>

Target:
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException { conn = ((JdbcSchema) db).getConnection(); dialect = ((JdbcSchema) db).getDialect(); Map<String, PrimaryKey> corrections = findPKUpdates(); if (corrections.isEmpty()) { return; } ui.message("Wrong Primary Key Column Order Detected"); ui.message("The following tables are affected:"); ui.message(Joiner.on(", ").join(corrections.keySet())); ui.message("fixing primary keys..."); JdbcExecutor executor = new JdbcExecutor(conn); try { for (Map.Entry<String, PrimaryKey> c : corrections.entrySet()) { ui.message(String.format(" table: %s ... ", c.getKey())); recreatePK(executor, c.getKey(), c.getValue(), ui); ui.message("done"); } ui.message("done"); } finally { executor.close(); } }
Source:
<code>public String getName() { <START> return this.id; <END> }</code><technical_language>If a translation if possible</technical_language>

Target:
public String getName() { return this.translation.get(); }
Source:
<code><START> public WriteResult<org.atlasapi.segment.Segment, org.atlasapi.segment.Segment> migrateLegacySegment(Id legacyId) <END> throws UnresolvedLegacySegmentException { log.trace("Attempting to resolve legacy segment with ID: in Deer first", legacyId); Iterable<Segment> segments = segmentStore.resolveSegments(ImmutableList.of(legacyId)); Optional<Segment> existingSegment = Optional.fromNullable(Iterables.getOnlyElement(segments, null)); if (existingSegment.isPresent()) { log.trace("Legacy segment already present in Deer, returning..."); return WriteResult.<org.atlasapi.segment.Segment, org.atlasapi.segment.Segment>unwritten(existingSegment.get()) .withPrevious(existingSegment.get()) .build(); } org.atlasapi.media.segment.Segment owlSegment = resolveLegacySegment(legacyId); Segment deerSegment = legacySegmentTransformer.createDescribed(owlSegment); return segmentStore.writeSegment(deerSegment); }</code><technical_language>do need full Segment path here</technical_language>

Target:
public WriteResult<Segment, Segment> migrateLegacySegment(Id legacyId) throws UnresolvedLegacySegmentException { log.trace("Attempting to resolve legacy segment with ID: in Deer first", legacyId); Iterable<Segment> segments = segmentStore.resolveSegments(ImmutableList.of(legacyId)); Optional<Segment> existingSegment = Optional.fromNullable(Iterables.getOnlyElement(segments, null)); if (existingSegment.isPresent()) { log.trace("Legacy segment already present in Deer, returning..."); return WriteResult.<org.atlasapi.segment.Segment, org.atlasapi.segment.Segment>unwritten(existingSegment.get()) .withPrevious(existingSegment.get()) .build(); } org.atlasapi.media.segment.Segment owlSegment = resolveLegacySegment(legacyId); Segment deerSegment = legacySegmentTransformer.createDescribed(owlSegment); return segmentStore.writeSegment(deerSegment); }
Source:
<code>public void setCorrelationId(String correlationId) { if (correlationId == null) { this.correlationId = Guid.NewGuid().toString(); } else if (correlationId.length() <= 100) { this.correlationId = correlationId; } else { this.correlationId = correlationId.substring(0, 100); } <START> } <END></code><technical_language>I manipulate correlation Id. I add input validator for validating correlation Id length</technical_language>

Target:
public void setCorrelationId(String correlationId) { this.correlationId = correlationId; }
Source:
<code>private static Method findGetter(String propertyName, Object target) { String capitalized = propertyName.substring(0, 1).toUpperCase(ENGLISH) + propertyName.substring(1); Method getter = findMethod("get" + capitalized, target); <START> if (getter != null && !Modifier.isStatic(getter.getModifiers())) return getter; <END> if (bareNamePropertyMethods) { getter = findMethod(propertyName, target); if (getter != null && !Modifier.isStatic(getter.getModifiers())) return getter; } Method isAccessor = findMethod("is" + capitalized, target); return (isAccessor != null && !Modifier.isStatic(isAccessor.getModifiers())) ? isAccessor: null; }</code><technical_language>let' s extract a static isValidGetter(Method method) method capture getter != null && !Modifier.isStatic(getter.getModifiers()) repeated 3 times, more readable too</technical_language>

Target:
private static Method findGetter(String propertyName, Object target) { String capitalized = propertyName.substring(0, 1).toUpperCase(ENGLISH) + propertyName.substring(1); Method getter = findMethod("get" + capitalized, target); if (isValidGetter(getter)) return getter; if (bareNamePropertyMethods) { getter = findMethod(propertyName, target); if (isValidGetter(getter)) return getter; } Method isAccessor = findMethod("is" + capitalized, target); return (isValidGetter(isAccessor)) ? isAccessor: null; }
Source:
<code>protected void publishToMessageProcessor(CarbonMessage cMsg) { if (HTTPTransportContextHolder.getInstance().getHandlerExecutor() != null) { HTTPTransportContextHolder.getInstance().getHandlerExecutor().executeAtSourceRequestReceiving(cMsg); } CarbonMessageProcessor carbonMessageProcessor = HTTPTransportContextHolder.getInstance() .getMessageProcessor(); if (carbonMessageProcessor != null) { try { carbonMessageProcessor.receive(cMsg, new ResponseCallback(this.ctx)); } catch (Exception e) { LOGGER.error("Error while submitting CarbonMessage to CarbonMessageProcessor.", e); } } else { <START> LOGGER.error("Cannot find registered MessageProcessor to forward the message."); <END> } }</code><technical_language>continue flow here</technical_language>

Target:
protected void publishToMessageProcessor(CarbonMessage cMsg) { if (HTTPTransportContextHolder.getInstance().getHandlerExecutor() != null) { HTTPTransportContextHolder.getInstance().getHandlerExecutor().executeAtSourceRequestReceiving(cMsg); } CarbonMessageProcessor carbonMessageProcessor = HTTPTransportContextHolder.getInstance() .getMessageProcessor(); if (carbonMessageProcessor != null) { try { carbonMessageProcessor.receive(cMsg, null); } catch (Exception e) { logger.error("Error while submitting CarbonMessage to CarbonMessageProcessor.", e); ctx.channel().close(); } } else { logger.error("Cannot find registered MessageProcessor to forward the message."); ctx.channel().close(); } }
Source:
<code>public Order addTicketToOrder(Long orderId, TicketType type, boolean pickupService, boolean chMember) { Order order = getOrderById(orderId); <START> if (!order.getStatus().equals(OrderStatus.ANONYMOUS) && !order.getStatus().equals(OrderStatus.ASSIGNED)) { <END> throw new ImmutableOrderException(orderId); } if (order.getTickets().size() >= ORDER_LIMIT) { throw new IllegalStateException("Order limit reached"); } Ticket ticket; if (order.getUser() != null) { ticket = ticketService.requestTicketOfType(order.getUser(), type, pickupService, chMember); } else { ticket = ticketService.requestTicketOfType(type, pickupService, chMember); } order.addTicket(ticket); return orderRepository.save(order); }</code><technical_language>I change condition java !(order.getStatus().equals(OrderStatus.ANONYMOUS) || order.getStatus().equals(OrderStatus.ASSIGNED))</technical_language>

Target:
public Order addTicketToOrder(Long orderId, TicketType type, boolean pickupService, boolean chMember) { Order order = getOrderById(orderId); if (!(order.getStatus().equals(OrderStatus.ANONYMOUS) || order.getStatus().equals(OrderStatus.ASSIGNED))) { throw new ImmutableOrderException(orderId); } if (order.getTickets().size() >= ORDER_LIMIT) { throw new IllegalStateException("Order limit reached"); } Ticket ticket; if (order.getUser() != null) { ticket = ticketService.requestTicketOfType(order.getUser(), type, pickupService, chMember); } else { ticket = ticketService.requestTicketOfType(type, pickupService, chMember); } order.addTicket(ticket); return orderRepository.save(order); }