auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean isHighPriority(IInvokedMethod method) { try { checkForTestAnnotation(method); } catch (IllegalStateException e) { return true; <START> } <END> int high = method.getTestMethod().getPriority(); for (ITestNGMethod test : method.getTestMethod().getTestClass().getTestMethods()) { if (test.getEnabled() && test.getPriority() > high) { return false; } } Test t = method.getTestMethod().getConstructorOrMethod().getMethod().getAnnotation(Test.class); if (!(t.dataProvider().isEmpty())) { int currentInvocationCount = method.getTestMethod().getCurrentInvocationCount(); int parameterInvocationCount = method.getTestMethod().getParameterInvocationCount(); return (currentInvocationCount == parameterInvocationCount); } return true; }</code><technical_language>consider distinct private methods here? throws returns a boolean if annotation check fails</technical_language>

Target:
private boolean isHighPriority(IInvokedMethod method) { if (!isAnnotatedWithTest(method)) { return true; } int high = method.getTestMethod().getPriority(); for (ITestNGMethod test : method.getTestMethod().getTestClass().getTestMethods()) { if (test.getEnabled() && test.getPriority() > high) { return false; } } Test t = method.getTestMethod().getConstructorOrMethod().getMethod().getAnnotation(Test.class); if (!(t.dataProvider().isEmpty())) { int currentInvocationCount = method.getTestMethod().getCurrentInvocationCount(); int parameterInvocationCount = method.getTestMethod().getParameterInvocationCount(); return (currentInvocationCount == parameterInvocationCount); } return true; }
Source:
<code>public void testLeaderMetrics() throws Exception { <START> System.setProperty(Leader.ACK_LOGGING_FREQUENCY, "1"); <END> ServerMetrics.resetAll(); QuorumUtil util = new QuorumUtil(1); util.startAll(); ZooKeeper zk = ClientBase.createZKClient(util.getConnString()); createdLatch = new CountDownLatch(1); zk.exists("/test", new MyWatcher()); zk.create("/test", new byte[2], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); createdLatch.await(); Map<String, Object> values = ServerMetrics.getAllValues(); Assert.assertEquals(2L, values.get("proposal_count")); Assert.assertEquals(2L, values.get("cnt_quorum_ack_latency")); Assert.assertThat((long)values.get("min_quorum_ack_latency"), greaterThan(0L)); int numberOfAckServers = 0; for (int sid = 1; sid<=3; sid++) { String metricName = "min_" + sid + "_ack_latency"; if (values.get(metricName) != null) { numberOfAckServers++; Assert.assertThat((long) values.get("min_" + sid + "_ack_latency"), greaterThanOrEqualTo(0L)); } } Assert.assertThat(numberOfAckServers, greaterThanOrEqualTo(2)); zk.close(); util.shutdownAll(); }</code><technical_language>This work if Leader class initialized. is variable accessible change</technical_language>

Target:
public void testLeaderMetrics() throws Exception { Leader.setAckLoggingFrequency(1); ServerMetrics.getMetrics().resetAll(); QuorumUtil util = new QuorumUtil(1); util.startAll(); ZooKeeper zk = ClientBase.createZKClient(util.getConnString()); createdLatch = new CountDownLatch(1); zk.exists("/test", new MyWatcher()); zk.create("/test", new byte[2], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); createdLatch.await(); Map<String, Object> values = MetricsUtils.currentServerMetrics(); Assert.assertEquals(2L, values.get("proposal_count")); Assert.assertEquals(2L, values.get("cnt_quorum_ack_latency")); Assert.assertThat((long)values.get("min_quorum_ack_latency"), greaterThan(0L)); int numberOfAckServers = 0; for (int sid = 1; sid<=3; sid++) { String metricName = "min_" + sid + "_ack_latency"; if (values.get(metricName) != null) { numberOfAckServers++; Assert.assertThat((long) values.get("min_" + sid + "_ack_latency"), greaterThanOrEqualTo(0L)); } } Assert.assertThat(numberOfAckServers, greaterThanOrEqualTo(2)); zk.close(); util.shutdownAll(); }
Source:
<code>protected BinaryObject(PID pid, Repository repository, RepositoryObjectDataLoader dataLoader) { super(pid, repository, dataLoader); metadataUri = URI.create(pid.getRepositoryUri().toString() <START> + RepositoryPathConstants.FCR_METADATA); <END> }</code><technical_language>This added in cleanup commit, a worried impact of it. change this URIUtil.join() method put pieces ensure is a slash there</technical_language>

Target:
protected BinaryObject(PID pid, Repository repository, RepositoryObjectDataLoader dataLoader) { super(pid, repository, dataLoader); metadataUri = URI.create(URIUtil.join(pid.getRepositoryUri(), RepositoryPathConstants.FCR_METADATA)); }
Source:
<code>public Connection getConnection() throws SQLException { Connection connection = this.cm.getDataSource().getConnection(); if (connection.isValid(TIME_FOR_CONNECTION_VALID_CHECK)) { return connection; } connection.close(); <START> <END> for (int i = 0; i < MAX_TRIES_NEW_CONNECTION; i++) { if(logger.isEnabledFor(Priority.WARN)){ logger.warn("Connection failed: Trying to get new connection. Attempt:" + i); } connection = this.cm.getDataSource().getConnection(); if (connection.isValid(TIME_FOR_CONNECTION_VALID_CHECK)) { return connection; } connection.close(); } logger.warn("Connection failed: Trying to get a connection from a new ConnectionManager"); SqlConfiguration config = SqlConfiguration.getInstance(); this.cm = new ConnectionManager(config); connection = this.cm.getDataSource().getConnection(); if (connection.isValid(TIME_FOR_CONNECTION_VALID_CHECK)) { return connection; } logger.error("Connection failed!"); return connection; }</code><technical_language>unsure this close() calls. I know: database connection close() calls needed in a connection pool managed environment pool management handling connection database</technical_language>

Target:
public Connection getConnection() throws SQLException { Connection connection = this.cm.getDataSource().getConnection(); if (connection.isValid(TIME_FOR_CONNECTION_VALID_CHECK)) { return connection; } for (int i = 0; i < MAX_TRIES_NEW_CONNECTION; i++) { if(logger.isEnabledFor(Priority.WARN)){ logger.warn("Connection failed: Trying to get new connection. Attempt:" + i); } connection = this.cm.getDataSource().getConnection(); if (connection.isValid(TIME_FOR_CONNECTION_VALID_CHECK)) { return connection; } } logger.warn("Connection failed: Trying to get a connection from a new ConnectionManager"); SqlConfiguration config = SqlConfiguration.getInstance(); this.cm = new ConnectionManager(config); connection = this.cm.getDataSource().getConnection(); if (connection.isValid(TIME_FOR_CONNECTION_VALID_CHECK)) { return connection; } logger.error("Connection failed!"); return connection; }
Source:
<code>public boolean ingestableAsTabular(DataFile dataFile) { String mimeType = dataFile.getContentType(); if (mimeType == null) { return false; } <START> switch (mimeType) { <END> case MIME_TYPE_STATA: return true; case MIME_TYPE_STATA13: return true; case MIME_TYPE_RDATA: return true; case MIME_TYPE_CSV: case MIME_TYPE_CSV_ALT: return true; case MIME_TYPE_XLSX: return true; case MIME_TYPE_SPSS_SAV: return true; case MIME_TYPE_SPSS_POR: return true; } return false; }</code><technical_language>add a default case? collapse return trues one</technical_language>

Target:
public boolean ingestableAsTabular(DataFile dataFile) { String mimeType = dataFile.getContentType(); if (mimeType == null) { return false; } switch (mimeType) { case MIME_TYPE_STATA: case MIME_TYPE_STATA13: case MIME_TYPE_RDATA: case MIME_TYPE_CSV: case MIME_TYPE_CSV_ALT: case MIME_TYPE_XLSX: case MIME_TYPE_SPSS_SAV: case MIME_TYPE_SPSS_POR: return true; } return false; }
Source:
<code>public Collection<Object> getAttributeValues(IAtsObject atsObject, IAttributeType attributeType) { <START> return getAttributeValues(atsObject.getStoreObject(), attributeType); <END> }</code><technical_language>Consider adding null check here</technical_language>

Target:
public Collection<Object> getAttributeValues(IAtsObject atsObject, IAttributeType attributeType) { Assert.isNotNull(atsObject, "ATS Object can not be null"); Assert.isNotNull(attributeType, "Attribute Type can not be null"); return getAttributeValues(atsObject.getStoreObject(), attributeType); }
Source:
<code>void setMaximumPoolSize(int maximumPoolSize) { if (executor instanceof ThreadPoolExecutor) { ((ThreadPoolExecutor) executor).setMaximumPoolSize(maximumPoolSize); } else { <START> throw new UnsupportedOperationException(); <END> } }</code><technical_language>For executors a queue, set core size maximum size, setting maximum size change core size. need attributes for queue size maximum queue size</technical_language>

Target:
void setMaximumPoolSize(int maximumPoolSize) { if (executor instanceof ThreadPoolExecutor) { ((ThreadPoolExecutor) executor).setMaximumPoolSize(maximumPoolSize); if (!(((ThreadPoolExecutor)executor).getQueue() instanceof SynchronousQueue)) { ((ThreadPoolExecutor) executor).setCorePoolSize(maximumPoolSize); } } else { throw new UnsupportedOperationException(); } }
Source:
<code>public void sendMessage(String registrationToken, nu.yona.server.messaging.entities.Message message) { Message firebaseMessage = Message.builder().putData("messageId", Long.toString(message.getId())) .setToken(registrationToken).build(); try { FirebaseMessaging.getInstance().send(firebaseMessage); } catch (FirebaseMessagingException e) { <START> logger.error("Error sending message to Firebase server", e); <END> } }</code><technical_language>exception is logged. Instead, I propose wrap rethrow it</technical_language>

Target:
public void sendMessage(String registrationToken, nu.yona.server.messaging.entities.Message message) { if (!yonaProperties.getFirebase().isEnabled()) { return; } Message firebaseMessage = Message.builder().putData("messageId", Long.toString(message.getId())) .setToken(registrationToken).build(); try { FirebaseMessaging.getInstance().send(firebaseMessage); } catch (FirebaseMessagingException e) { throw FirebaseServiceException.couldNotSendMessage(e); } }
Source:
<code>public void setReplicationRoleLocal(String role) { SIDriver.driver().lifecycleManager().setReplicationRole(role); Collection<Context> allContexts= ContextService.getFactory().getAllContexts(LanguageConnectionContext.CONTEXT_ID); <START> for(Context context : allContexts){ <END> ((LanguageConnectionContext)context).setReplicationRole(role); } SpliceLogUtils.info(LOG, "Set replication role to %s", role); }</code><technical_language>I is a good idea throw exception is role match (or add assert)</technical_language>

Target:
private void setReplicationRoleLocal(String role) { SIDriver.driver().lifecycleManager().setReplicationRole(role); Collection<Context> allContexts= ContextService.getFactory().getAllContexts(LanguageConnectionContext.CONTEXT_ID); for(Context context : allContexts){ ((LanguageConnectionContext)context).setReplicationRole(role); } SpliceLogUtils.info(LOG, "Set replication role to %s", role); }
Source:
<code>protected Object columnValue(Object value) { switch (type) { case PATH: case NAME: case STRING: case REFERENCE: case SIMPLEREFERENCE: case WEAKREFERENCE: case URI: return valueFactories.getStringFactory().create(value); case DATE : <START> return ((DateTime) value).getMilliseconds(); <END> } return value; }</code><technical_language>is default case here. longs binaries other PropertyTypes</technical_language>

Target:
protected Object columnValue(Object value) { switch (type) { case PATH: case NAME: case STRING: case REFERENCE: case SIMPLEREFERENCE: case WEAKREFERENCE: case URI: return valueFactories.getStringFactory().create(value); case DATE : return ((DateTime) value).getMilliseconds(); default : return value; } }
Source:
<code>void runConsumers() { for (int i = 0; i < numThreads; i++) { workers.execute(() -> { try { long start = System.nanoTime(); Operation op = operationQueue.take(); op.execute(); long latency = System.nanoTime() - start; <START> System.out.println("nextToken request latency: " + latency); <END> } catch (Exception e) { log.error("Operation failed with", e); } }); } }</code><technical_language>System.out.println() is forbidden. a logger output utility. [printLine]</technical_language>

Target:
void runConsumers() { for (int i = 0; i < numThreads; i++) { workers.execute(() -> { try { long start = System.nanoTime(); Operation op = operationQueue.take(); op.execute(); long latency = System.nanoTime() - start; log.info("nextToken request latency: " + latency); } catch (Exception e) { log.error("Operation failed with", e); } }); } }
Source:
<code>public AbstractExportRepresentationsAsImagesDialog(final Shell shell, final IPath path) { super(shell); initDialogSettings(path); <START> this.autoScaleDiagram = getDialogSettings().getBoolean("autoScaleDiagram"); END> }</code><technical_language>I changed preference in case here, dialog settings do key "autoScaleDiagram", false is returned. Even, if in preference I "true"</technical_language>

Target:
public AbstractExportRepresentationsAsImagesDialog(final Shell shell, final IPath path) { super(shell); initDialogSettings(path); this.autoScaleDiagram = getDialogSettings().getBoolean(AUTO_SCALE_SETTING_PROPERTY); }
Source:
<code>public String installPush( @Nullable String deviceToken, @NonNull PushBackend pushBackend, boolean development ) throws ThingIFException{ <START> return thingIfApi.installPush(deviceToken, pushBackend, development); <END> }</code><technical_language>Adding this a field is good manner</technical_language>

Target:
public String installPush( @Nullable String deviceToken, @NonNull PushBackend pushBackend, boolean development ) throws ThingIFException{ return this.thingIfApi.installPush(deviceToken, pushBackend, development); }
Source:
<code>public void testDriverRegistration() throws Exception { Class.forName("io.crate.client.jdbc.CrateDriver"); <START> String hostPort = String.format(Locale.ENGLISH, "%s:%d", <END> IntegrationTestSuite.crateTestServer.crateHost, IntegrationTestSuite.crateTestServer.transportPort ); Connection c1 = DriverManager.getConnection("crate://" + hostPort); assertThat(c1, instanceOf(CrateConnection.class)); Connection c2 = DriverManager.getConnection("jdbc:crate://" + hostPort); assertThat(c2, instanceOf(CrateConnection.class)); expectedException.expect(SQLException.class); expectedException.expectMessage("Protocol url jdbc-crate:// not supported. Must be one of crate:// or jdbc:crate://"); DriverManager.getConnection("jdbc-crate://" + hostPort); }</code><technical_language>pls rename hostAndPort</technical_language>

Target:
public void testDriverRegistration() throws Exception { Class.forName("io.crate.client.jdbc.CrateDriver"); String hostAndPort = String.format(Locale.ENGLISH, "%s:%d", IntegrationTestSuite.crateTestServer.crateHost, IntegrationTestSuite.crateTestServer.transportPort ); Connection c1 = DriverManager.getConnection("crate://" + hostAndPort); assertThat(c1, instanceOf(CrateConnection.class)); Connection c2 = DriverManager.getConnection("jdbc:crate://" + hostAndPort); assertThat(c2, instanceOf(CrateConnection.class)); expectedException.expect(SQLException.class); expectedException.expectMessage("Protocol url jdbc-crate:// not supported. Must be one of crate:// or jdbc:crate://"); DriverManager.getConnection("jdbc-crate://" + hostAndPort); }
Source:
<code><START> public static Integer extractYearOrNull(String date, Logger log) { <END> if (StringUtils.isNotBlank(date) && date.indexOf('-') == 4) { try { return Integer.valueOf(date.substring(0, date.indexOf('-'))); } catch (NumberFormatException e) { log.warn("unsupported, non integer, format of year value: " + date); return null; } } else { return null; } }</code><technical_language>I do this change ways: 1. Year return change parsing code part java public static Year extractYearOrNull(String date, Logger log) { try { return Year.parse(date.substring(0, date.indexOf('-')), DateTimeFormatter.ofPattern("yyyy")); } catch (DateTimeParseException e) { log.warn("unsupported, integer, format of year value: " + date); return null; } } I working Year is working integer later. 2. change return Integer do check for blank index of -: check is relevant is result of parsing, bad format of date eventually result in exception matter if do checks java public static Integer extractYearOrNull(String date, Logger log) { try { return Integer.valueOf(date.substring(0, date.indexOf('-'))); } catch (DateTimeParseException e) { log.warn("unsupported, integer, format of year value: " + date); return null; } } option number is ok</technical_language>

Target:
public static Year extractYearOrNull(String date, Logger log) { if (StringUtils.isNotBlank(date)) { if (date.indexOf('-') == 4) { try { return Year.parse(date.substring(0, date.indexOf('-')), DateTimeFormatter.ofPattern("yyyy")); } catch (DateTimeParseException e) { log.warn("unsupported, non integer, format of year value: " + date); return null; } } else { log.warn("unsupported format of year value: " + date); } } return null; }
Source:
<code>private ConfigurationService createMockConfigurationServiceForOCDTests(List<String> registeredFactories, List<Tocd> registeredOcds, List<Component> registeredComponents) throws NoSuchFieldException { assertEquals(registeredFactories.size(), registeredOcds.size()); <START> ScrService scrService = new ScrService() { <END> @Override public Component[] getComponents(Bundle bundle) { return null; } @Override public Component[] getComponents(String componentName) { return null; } @Override public Component[] getComponents() { return registeredComponents.toArray(new Component[registeredComponents.size()]); } @Override public Component getComponent(long componentId) { return null; } }; final ConfigurationServiceImpl result = new ConfigurationServiceImpl(); result.setScrService(scrService); TestUtil.setFieldValue(result, "factoryPids", new HashSet<>(registeredFactories)); TestUtil.setFieldValue(result, "ocds", getOcdsMap(registeredFactories, registeredOcds)); return result; }</code><technical_language>methods return null, a mock reacts getComponents()</technical_language>

Target:
private OCDService createMockConfigurationServiceForOCDTests(List<String> registeredFactories, List<Tocd> registeredOcds, List<Component> registeredComponents) throws NoSuchFieldException { assertEquals(registeredFactories.size(), registeredOcds.size()); ScrService scrService = mock(ScrService.class); when(scrService.getComponents()) .thenReturn(registeredComponents.toArray(new Component[registeredComponents.size()])); final ConfigurationServiceImpl result = new ConfigurationServiceImpl(); result.setScrService(scrService); TestUtil.setFieldValue(result, "factoryPids", new HashSet<>(registeredFactories)); TestUtil.setFieldValue(result, "ocds", getOcdsMap(registeredFactories, registeredOcds)); return result; }
Source:
<code>public static Bundle descriptionToBundle(MediaDescription desc) { Bundle ret = new Bundle(); if (desc == null) return ret; if (desc.getTitle() != null) { ret.putString(MediaMetadata.METADATA_KEY_TITLE, desc.getTitle().toString()); } if (desc.getSubtitle() != null) { ret.putString(MediaMetadata.METADATA_KEY_ARTIST, desc.getSubtitle().toString()); } if (desc.getDescription() != null) { ret.putString(MediaMetadata.METADATA_KEY_ALBUM, desc.getDescription().toString()); } if (desc.getExtras() != null) { try { ret.putAll(desc.getExtras()); } catch (BadParcelableException e) { <START> if (DEBUG) Log.d(TAG, "MediaDescription contains invalid extras", e); <END> } } if (ret.containsKey(GPM_KEY)) { if (DEBUG) Log.d(TAG, "MediaDescription contains GPM data"); ret.putAll(mediaMetadataToBundle((MediaMetadata) ret.get(GPM_KEY))); } return ret; }</code><technical_language>Log.w</technical_language>

Target:
public static Bundle descriptionToBundle(MediaDescription desc) { Bundle ret = new Bundle(); if (desc == null) return ret; if (desc.getTitle() != null) { ret.putString(MediaMetadata.METADATA_KEY_TITLE, desc.getTitle().toString()); } if (desc.getSubtitle() != null) { ret.putString(MediaMetadata.METADATA_KEY_ARTIST, desc.getSubtitle().toString()); } if (desc.getDescription() != null) { ret.putString(MediaMetadata.METADATA_KEY_ALBUM, desc.getDescription().toString()); } if (desc.getExtras() != null) { try { ret.putAll(desc.getExtras()); } catch (BadParcelableException e) { Log.d(TAG, "MediaDescription contains invalid extras", e); } } if (ret.containsKey(GPM_KEY)) { if (DEBUG) Log.d(TAG, "MediaDescription contains GPM data"); ret.putAll(mediaMetadataToBundle((MediaMetadata) ret.get(GPM_KEY))); } return ret; }
Source:
<code>public SwitchingWrapper(OMXMLParserWrapper builder, OMContainer startNode, boolean cache, boolean preserveNamespaceContext) { this.navigator = new OMNavigator(startNode); this.builder = builder; this.rootNode = startNode; this.preserveNamespaceContext = preserveNamespaceContext; if (rootNode instanceof OMElement && ((OMElement)rootNode).getParent() instanceof OMDocument) { needToThrowEndDocument = true; } boolean resetCache = false; try { if (startNode instanceof OMSourcedElement && !cache && builder != null) { if (!builder.isCache()) { resetCache = true; } builder.setCache(true); } } catch (Throwable t) { <START> log.error("Error in setting cache " + t.getMessage()); <END> } currentNode = navigator.getNext(); updateNextNode(); if (resetCache) { builder.setCache(cache); } switchingAllowed = !cache; if (startNode instanceof OMDocument) { try { next(); } catch (XMLStreamException ex) { throw new OMException(ex); } } }</code><technical_language>error t is missing log</technical_language>

Target:
public SwitchingWrapper(OMXMLParserWrapper builder, OMContainer startNode, boolean cache, boolean preserveNamespaceContext) { this.navigator = new OMNavigator(startNode); this.builder = builder; this.rootNode = startNode; this.preserveNamespaceContext = preserveNamespaceContext; if (rootNode instanceof OMElement && ((OMElement)rootNode).getParent() instanceof OMDocument) { needToThrowEndDocument = true; } boolean resetCache = false; try { if (startNode instanceof OMSourcedElement && !cache && builder != null) { if (!builder.isCache()) { resetCache = true; } builder.setCache(true); } } catch (Throwable t) { log.error("Error in setting cache " + t.getMessage(), t); } currentNode = navigator.getNext(); updateNextNode(); if (resetCache) { builder.setCache(cache); } switchingAllowed = !cache; if (startNode instanceof OMDocument) { try { next(); } catch (XMLStreamException ex) { throw new OMException(ex); } } }
Source:
<code>public Path getPathForMapInsensitive(String approxName) { String normalizedName = approxName.toLowerCase(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(customMapsDirectory)) { for (Path entry : stream) { if (entry.getFileName().toString().toLowerCase().equals(normalizedName)) { return entry; } } <START> } catch (IOException e) { <END> logger.warn("Could not check maps directory", e); } return null; }</code><technical_language>lets simply catch all, returning nul delays issue results in a NPE, suggestion noCatch(()->{ //Your code });</technical_language>

Target:
public Path getPathForMapInsensitive(String approxName) { for (Path entry : noCatch(() -> Files.newDirectoryStream(getMapsDirectory(approxName)))) { if (entry.getFileName().toString().equalsIgnoreCase(approxName)) { return entry; } } return null; }
Source:
<code>private String getType(Contentlet contentlet) { <START> return contentlet.isHost() ? "SITE" : contentlet.getStructure().getName(); <END> }</code><technical_language>check NPE SITE a Constant</technical_language>

Target:
private String getType(Contentlet contentlet) { return contentlet != null && contentlet.isHost() ? SITE_EVENT_SUFFIX : contentlet.getStructure().getName(); }
Source:
<code>static void assertLinesMatch(List<String> expectedLines, List<String> actualLines) { <START> assertLinesMatch(expectedLines, actualLines, () -> ""); <END> }</code><technical_language>suggestion assertLinesMatch(expectedLines, actualLines, (Object) null);</technical_language>

Target:
static void assertLinesMatch(List<String> expectedLines, List<String> actualLines) { assertLinesMatch(expectedLines, actualLines, (Object) null); }
Source:
<code>public boolean run() throws Exception { partitionCount = partitions.size(); List<BoundStatement> stmts; for (PartitionIterator iterator : partitions) while (iterator.hasNext()) <START> stmts.add(bindRow(iterator.next())); <END> rowCount += stmts.size(); for (int j = 0 ; j < stmts.size() ; j += 65535) { List<BoundStatement> substmts = stmts.subList(j, Math.min(j + stmts.size(), j + 65535)); Statement stmt; if (stmts.size() == 1) { stmt = substmts.get(0); } else { BatchStatement batch = new BatchStatement(batchType); batch.setConsistencyLevel(JavaDriverClient.from(cl)); batch.addAll(substmts); stmt = batch; } client.getSession().execute(stmt); } return true; }</code><technical_language>Is this change related fix? is needed</technical_language>

Target:
public boolean run() throws Exception { List<BoundStatement> stmts = new ArrayList<>(); partitionCount = partitions.size(); for (PartitionIterator iterator : partitions) while (iterator.hasNext()) stmts.add(bindRow(iterator.next())); rowCount += stmts.size(); for (int j = 0 ; j < stmts.size() ; j += 65535) { List<BoundStatement> substmts = stmts.subList(j, Math.min(j + stmts.size(), j + 65535)); Statement stmt; if (stmts.size() == 1) { stmt = substmts.get(0); } else { BatchStatement batch = new BatchStatement(batchType); batch.setConsistencyLevel(JavaDriverClient.from(cl)); batch.addAll(substmts); stmt = batch; } client.getSession().execute(stmt); } return true; }
Source:
<code><START> public void testGetFeedbackQuestionsForStudent() { <END> ______TS("Get questions created for single student"); List<FeedbackQuestionAttributes> expectedQuestions = new ArrayList<FeedbackQuestionAttributes>(); expectedQuestions.add(getQuestionFromDatastore("qn1InSession1InCourse1")); expectedQuestions.add(getQuestionFromDatastore("qn2InSession1InCourse1")); expectedQuestions.add(getQuestionFromDatastore("custom.feedback.paths.student.question")); StudentAttributes student = studentsLogic.getStudentForEmail("idOfTypicalCourse1", "student1InCourse1@gmail.tmt"); List<FeedbackQuestionAttributes> actualQuestions = fqLogic.getFeedbackQuestionsForStudent( "First feedback session", "idOfTypicalCourse1", student); assertEquals(actualQuestions, expectedQuestions); }</code><technical_language>testGetFeedbackQuestionsForInstructor updated test custom feedback path</technical_language>

Target:
public void testGetFeedbackQuestionsForStudent() { ______TS("Get questions created for single student"); List<FeedbackQuestionAttributes> expectedQuestions = new ArrayList<FeedbackQuestionAttributes>(); expectedQuestions.add(getQuestionFromDatastore("qn1InSession1InCourse1")); expectedQuestions.add(getQuestionFromDatastore("qn2InSession1InCourse1")); expectedQuestions.add(getQuestionFromDatastore("custom.feedback.paths.student.question")); expectedQuestions.add(getQuestionFromDatastore("custom.feedback.paths.team.question")); StudentAttributes student = studentsLogic.getStudentForEmail("idOfTypicalCourse1", "student5InCourse1@gmail.tmt"); List<FeedbackQuestionAttributes> actualQuestions = fqLogic.getFeedbackQuestionsForStudent( "First feedback session", "idOfTypicalCourse1", student); assertEquals(actualQuestions, expectedQuestions); }
Source:
<code>public Optional<Date> getJobDeadline() { if (variables.containsKey(JOB_DDL)) { try { <START> return Optional.of(ISODateTimeFormat.dateTimeNoMillis() <END> .parseDateTime(variables.get(JOB_DDL).getValue()) .toDate()); } catch (Exception e) { LOGGER.info("Imposible to parse JOB_DDL GI variable as ISO8601 date", e); return Optional.empty(); } } else { return Optional.empty(); } }</code><technical_language>In ExtendedSchedulingPolicy, class ISO8601DateUtil for START_AT value, is format joda ISODateTimeFormat ? Otherwise, create confusion</technical_language>

Target:
public Optional<Date> getJobDeadline() { if (genericInformation.containsKey(JOB_DDL)) { try { return Optional.of(ISO8601DateUtil.toDate(genericInformation.get(JOB_DDL))); } catch (Exception e) { LOGGER.warn("Imposible to parse JOB_DDL GI variable as ISO8601 date", e); } } return Optional.empty(); }
Source:
<code>private ProgramStateAtBlock(CfgBlock block, Map<Symbol, Set<Expression>> initialState) { this.block = block; this.in = initialState; <START> init(); <END> }</code><technical_language>Do need this line</technical_language>

Target:
private ProgramStateAtBlock(CfgBlock block, Map<Symbol, Set<Expression>> initialState) { this.block = block; this.in = initialState; this.block.elements().forEach(element -> updateProgramState(element, out)); }
Source:
<code>public void testBOM() throws Exception { File file = new File("src/test/resources/highlighting/bom.xml"); DefaultInputFile inputFile = new DefaultInputFile("bom.xml") .setLanguage(Xml.KEY) .setType(InputFile.Type.MAIN) .setAbsolutePath(file.getAbsolutePath()); DefaultFileSystem localFS = new DefaultFileSystem(new File(file.getParent())); localFS.add(inputFile).setWorkDir(tmpFolder.newFolder()); XmlFile xmlFile = new XmlFile(inputFile, localFS); List<HighlightingData> highlightingData = new XMLHighlighting(xmlFile, localFS.encoding()).getHighlightingData(); <START> assertEquals(3, highlightingData.size()); <END> assertData(highlightingData.get(0), 0, 6, "k"); }</code><technical_language>@vilchik-elena do care that</technical_language>

Target:
public void testBOM() throws Exception { HighlightingData firstHighlightingData = getFirstHighlightingData("bom.xml"); assertData(firstHighlightingData, 0, 6, "k"); }
Source:
<code>private void enterReloadMessageReadLoop(Socket accept) throws IOException{ <START> BufferedReader in = new BufferedReader(new InputStreamReader(accept.getInputStream())); <END> String line; while ((line = in.readLine()) != null) { DevModeHandler devModeHandler = DevModeHandler .getDevModeHandler(); if ("reload".equals(line) && devModeHandler != null && devModeHandler.getLiveReload() != null) { devModeHandler.getLiveReload().reload(); } } }</code><technical_language>BufferedReader in = new BufferedReader(new InputStreamReader(accept.getInputStream(), StandardCharsets.UTF_8)); suprises encodings</technical_language>

Target:
private void enterReloadMessageReadLoop(Socket accept) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader( accept.getInputStream(), StandardCharsets.UTF_8)); String line; while ((line = in.readLine()) != null) { DevModeHandler devModeHandler = DevModeHandler .getDevModeHandler(); if ("reload".equals(line) && devModeHandler != null && devModeHandler.getLiveReload() != null) { devModeHandler.getLiveReload().reload(); } } }
Source:
<code>private boolean hasRelevantManagementRole(UserEntity user) { if (user.getRoles() == null) { return false ; } boolean hasOrganizationCreateUpdateDeleteRole = false; boolean hasEnvironmentCreateUpdateDeleteRoleExceptApplication = false ; for (UserRoleEntity userRoleEntity : user.getRoles()) { if (userRoleEntity.getPermissions() != null) { RoleScope currentScope = userRoleEntity.getScope() ; for (String permissionName : userRoleEntity.getPermissions().keySet()) { String permissionString = new String(userRoleEntity.getPermissions().get((permissionName))); boolean isCreateUpdateOrDelete = permissionString.contains("C") || permissionString.contains("U") || permissionString.contains("D"); if (currentScope.equals(RoleScope.ORGANIZATION) && isCreateUpdateOrDelete) { <START> hasOrganizationCreateUpdateDeleteRole = true; <END> } if (currentScope.equals(RoleScope.ENVIRONMENT) && !EnvironmentPermission.valueOf(permissionName).equals(EnvironmentPermission.APPLICATION) && isCreateUpdateOrDelete ) { hasEnvironmentCreateUpdateDeleteRoleExceptApplication = true; } } } } return hasOrganizationCreateUpdateDeleteRole || hasEnvironmentCreateUpdateDeleteRoleExceptApplication ; }</code><technical_language>IMHO, this function stop soon hasOrganizationCreateUpdateDeleteRole = true hasEnvironmentCreateUpdateDeleteRoleExceptApplication = true</technical_language>

Target:
private boolean hasRelevantManagementRole(UserEntity user) { if (user.getRoles() == null) { return false ; } for (UserRoleEntity userRoleEntity : user.getRoles()) { if (userRoleEntity.getPermissions() != null) { RoleScope currentScope = userRoleEntity.getScope() ; for (String permissionName : userRoleEntity.getPermissions().keySet()) { String permissionString = new String(userRoleEntity.getPermissions().get((permissionName))); boolean isCreateUpdateOrDelete = permissionString.contains("C") || permissionString.contains("U") || permissionString.contains("D"); if (currentScope.equals(RoleScope.ORGANIZATION) && isCreateUpdateOrDelete) { return true ; } if (currentScope.equals(RoleScope.ENVIRONMENT) && !EnvironmentPermission.valueOf(permissionName).equals(EnvironmentPermission.APPLICATION) && isCreateUpdateOrDelete ) { return true; } } } } return false; }
Source:
<code>public KmlLayer(GoogleMap map, InputStream stream, FragmentActivity activity, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager) throws XmlPullParserException, IOException { if (stream == null) { throw new IllegalArgumentException("KML InputStream cannot be null"); } KmlRenderer renderer = new KmlRenderer(map, activity, markerManager, polygonManager, polylineManager, groundOverlayManager); BufferedInputStream bis = new BufferedInputStream(stream); bis.mark(1024); ZipInputStream zip = new ZipInputStream(bis); try { KmlParser parser = null; ZipEntry entry = zip.getNextEntry(); if (entry != null) { while (entry != null) { if (parser == null && entry.getName().toLowerCase().endsWith(".kml")) { parser = parseKml(zip); } else { <START> Bitmap bitmap = BitmapFactory.decodeStream(zip); <END> if (bitmap != null) { renderer.cacheBitmap(entry.getName(), bitmap); } } entry = zip.getNextEntry(); } } else { bis.reset(); parser = parseKml(bis); } if (parser == null) { throw new IllegalArgumentException("KML not found in InputStream"); } renderer.storeKmlData(parser.getStyles(), parser.getStyleMaps(), parser.getPlacemarks(), parser.getContainers(), parser.getGroundOverlays()); storeRenderer(renderer); } finally { stream.close(); bis.close(); zip.close(); } }</code><technical_language>other file types (e.g. .mp3), good check image is if not, log Log.w file type is supported</technical_language>

Target:
public KmlLayer(GoogleMap map, InputStream stream, FragmentActivity activity, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager) throws XmlPullParserException, IOException { if (stream == null) { throw new IllegalArgumentException("KML InputStream cannot be null"); } KmlRenderer renderer = new KmlRenderer(map, activity, markerManager, polygonManager, polylineManager, groundOverlayManager); BufferedInputStream bis = new BufferedInputStream(stream); bis.mark(1024); ZipInputStream zip = new ZipInputStream(bis); try { KmlParser parser = null; ZipEntry entry = zip.getNextEntry(); if (entry != null) { HashMap<String, Bitmap> images = new HashMap<>(); while (entry != null) { if (parser == null && entry.getName().toLowerCase().endsWith(".kml")) { parser = parseKml(zip); } else { Bitmap bitmap = BitmapFactory.decodeStream(zip); if (bitmap != null) { images.put(entry.getName(), bitmap); } else { Log.w("KmlLayer", "Unsupported KMZ contents file type: " + entry.getName()); } } entry = zip.getNextEntry(); } if (parser == null) { throw new IllegalArgumentException("KML not found in InputStream"); } renderer.storeKmzData(parser.getStyles(), parser.getStyleMaps(), parser.getPlacemarks(), parser.getContainers(), parser.getGroundOverlays(), images); } else { bis.reset(); parser = parseKml(bis); renderer.storeKmlData(parser.getStyles(), parser.getStyleMaps(), parser.getPlacemarks(), parser.getContainers(), parser.getGroundOverlays()); } storeRenderer(renderer); } finally { stream.close(); bis.close(); zip.close(); } }
Source:
<code>public void execute(ProcessContext context) throws Exception { WorkflowProcessInstance pi = context.getNodeInstance().getProcessInstance(); NodeInstance nodeInstance = findNodeByUniqueId(pi.getNodeInstances(), attachedToNodeId); if (nodeInstance != null) { <START> ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).cancel(TIMED); <END> } }</code><technical_language>I CancelNodeInstanceAction is in multiple cases, boundary escalation boundary error events, I grasp meaning of TIMED cancel type in this context</technical_language>

Target:
public void execute(ProcessContext context) throws Exception { WorkflowProcessInstance pi = context.getNodeInstance().getProcessInstance(); NodeInstance nodeInstance = findNodeByUniqueId(pi.getNodeInstances(), attachedToNodeId); if (nodeInstance != null) { ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).cancel(SKIPPED); } }
Source:
<code>public void userOnDesktopCanAddPostWithoutTitle() { PostsListPage postList = new PostsListPage().open(); PostsCreatorDesktop postsCreator = postList.getPostCreatorDesktop(); postsCreator .clickPostCreator() .closeGuidelinesMessage() <START> .fillPostContent("dupakupa123") <END> .selectCategory(0); Assertion.assertTrue(postsCreator.isPostButtonActive()); postsCreator.clickSubmitButton(); Post post = postList.getPost(); post.getNewestPost() .ifPresent(webElement -> { Assertion.assertEquals("now", webElement.findElement(By.className("timestamp")).getText()); Assertion.assertEquals("", webElement.findElement(By.className("post-title")).getText()); }); }</code><technical_language>Please change for some valuable test content</technical_language>

Target:
public void userOnDesktopCanAddPostWithoutTitle() { final String description = createUniqueDescription(); PostsListPage postListPage = new PostsListPage().open(); PostsCreator postsCreator = postListPage.getPostsCreatorDesktop(); final CategoryPill categoryPill = fillPostCategoryWith(postsCreator, description); postsCreator.clickSubmitButton(); PostEntity postEntity = postListPage.getPost() .waitForPostToAppearWith(description) .getTheNewestPost(); assertThatPostWasAddedWith(postEntity, description, categoryPill.getName()); }
Source:
<code>protected TextTemplate(String openArg, String closeArg, Object[] elements) { this.openArg = openArg; this.closeArg = closeArg; for (Object element : elements) { if (element instanceof Arg.Builder) { element = ((Arg.Builder) element).build(); } this.elements.add(element); if (element instanceof Arg) { Arg newArg = (Arg) element; newArg.openArg = this.openArg; newArg.closeArg = this.closeArg; Arg oldArg = this.arguments.get(newArg.name); if (oldArg != null && !oldArg.equals(newArg)) { throw new TextTemplateArgumentException("Tried to supply an unequal argument with a duplicate name \"" + newArg.name + "\" to TextTemplate."); } <START> arguments.put(newArg.name, newArg); <END> } } }</code><technical_language>this</technical_language>

Target:
TextTemplate(String openArg, String closeArg, Object[] elements) { this.openArg = openArg; this.closeArg = closeArg; ImmutableList.Builder<Object> elementList = ImmutableList.builder(); Map<String, Arg> argumentMap = new HashMap<>(); for (Object element : elements) { if (element instanceof Arg.Builder) { element = ((Arg.Builder) element).build(); } if (element instanceof Arg) { Arg newArg = new Arg((Arg) element, this.openArg, this.closeArg); Arg oldArg = argumentMap.get(newArg.name); if (oldArg != null && !oldArg.equals(newArg)) { throw new TextTemplateArgumentException("Tried to supply an unequal argument with a duplicate name \"" + newArg.name + "\" to TextTemplate."); } argumentMap.put(newArg.name, newArg); element = newArg; } elementList.add(element); } this.elements = elementList.build(); this.arguments = ImmutableMap.copyOf(argumentMap); Text.Builder builder = null; for (Object element : this.elements) { builder = apply(element, builder); } this.text = Optional.ofNullable(builder).orElse(Text.builder()).build(); }
Source:
<code>public Lower() { super(new Column[] { <START> new Column("org/apache/tajo/storage/text", TajoDataTypes.Type.TEXT) <END> }); }</code><technical_language>This changed while refactor 'text'</technical_language>

Target:
public Lower() { super(new Column[] { new Column("text", TajoDataTypes.Type.TEXT) }); }
Source:
<code>private PartitionIterator resolveWithReplicaFilteringProtection(E replicas, RepairedDataTracker repairedDataTracker) { ResolveContext firstPhaseContext = new ResolveContext(replicas); ResolveContext secondPhaseContext = new ResolveContext(replicas); ReplicaFilteringProtection<E> rfp = new ReplicaFilteringProtection<>(replicaPlan().keyspace(), command, replicaPlan().consistencyLevel(), queryStartNanoTime, firstPhaseContext.replicas); PartitionIterator firstPhasePartitions = resolveInternal(firstPhaseContext, rfp.mergeController(), i -> shortReadProtectedResponse(i, firstPhaseContext), UnaryOperator.identity()); PartitionIterators.consume(firstPhasePartitions); responses.clearUnsafe(); <START> <END> return resolveWithReadRepair(secondPhaseContext, rfp::queryProtectedPartitions, results -> command.rowFilter().filter(results, command.metadata(), command.nowInSec()), repairedDataTracker); }</code><technical_language>index range read trigger speculative read retry.. ok</technical_language>

Target:
private PartitionIterator resolveWithReplicaFilteringProtection(E replicas, RepairedDataTracker repairedDataTracker) { ResolveContext firstPhaseContext = new ResolveContext(replicas); ResolveContext secondPhaseContext = new ResolveContext(replicas); ReplicaFilteringProtection<E> rfp = new ReplicaFilteringProtection<>(replicaPlan().keyspace(), command, replicaPlan().consistencyLevel(), queryStartNanoTime, firstPhaseContext.replicas); PartitionIterator firstPhasePartitions = resolveInternal(firstPhaseContext, rfp.mergeController(), i -> shortReadProtectedResponse(i, firstPhaseContext), UnaryOperator.identity()); PartitionIterators.consume(firstPhasePartitions); firstPhasePartitions.close(); responses.clearUnsafe(); return resolveWithReadRepair(secondPhaseContext, rfp::queryProtectedPartitions, results -> command.rowFilter().filter(results, command.metadata(), command.nowInSec()), repairedDataTracker); }
Source:
<code>public void verifySummaryText(String targetText) { <START> waitForValueToBePresentInElementsAttributeByCss( <END> summaryTextString, "value", targetText); PageObjectLogging.log("verifySummaryText", "verifying the summary shows " + targetText, true); }</code><technical_language>wrong formatting - parameter in new line</technical_language>

Target:
public void verifySummaryText(String targetText) { waitForElementByElement(previewZoomer); waitForValueToBePresentInElementsAttributeByElement( summaryTextBox, "value", targetText ); PageObjectLogging.log( "verifySummaryText", "The summary shows " + targetText, true ); }
Source:
<code>private Object toObject(byte[] arrayDate) throws IOException, ClassNotFoundException { ByteArrayInputStream bis = new ByteArrayInputStream(arrayDate); ObjectInputStream in = new ObjectInputStream(bis); <START> return in.readObject(); <END> }</code><technical_language>need close streams</technical_language>

Target:
private Object toObject(byte[] arrayDate) { ByteArrayInputStream bis = new ByteArrayInputStream(arrayDate); ObjectInputStream in = null; try { in = new ObjectInputStream(bis); return in.readObject(); } catch (IOException e) { log.error("Error while reading the registry", e); } catch (ClassNotFoundException e) { log.error("unable to access readObject method ", e); } finally { try { in.close(); bis.close(); } catch (IOException e) { log.error("Error while closing the registry stream", e); } } return null; }
Source:
<code>public final boolean existPartitionMethod(final String databaseName, final String tableName) <START> throws UndefinedTableException { <END> try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName); final ReturnState state = stub.existPartitionMethod(null, request); if (isThisError(state, UNDEFINED_PARTITION_METHOD)) { return false; } throwsIfThisError(state, UndefinedTableException.class); ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }</code><technical_language>UndefinedDatabaseException occur</technical_language>

Target:
public final boolean existPartitionMethod(final String databaseName, final String tableName) throws UndefinedDatabaseException, UndefinedTableException { try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, tableName); final ReturnState state = stub.existPartitionMethod(null, request); if (isThisError(state, UNDEFINED_PARTITION_METHOD)) { return false; } throwsIfThisError(state, UndefinedDatabaseException.class); throwsIfThisError(state, UndefinedTableException.class); ensureOk(state); return true; } catch (ServiceException e) { throw new RuntimeException(e); } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { Timber.d("onCreate()"); String action = getIntent().getAction(); Timber.d(String.format("action = %s", action)); if(action != null) switch (action) { case Intent.ACTION_VIEW: <START> initalizeDeck(getIntent().getExtras()); <END> break; default: } super.onCreate(savedInstanceState); }</code><technical_language>reduce this to: if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { //initialize }</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { Timber.d("onCreate()"); if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { Timber.d("onCreate() :: received Intent with action = %s", getIntent().getAction()); selectDeckFromExtra(); } super.onCreate(savedInstanceState); }
Source:
<code>public void activate(Map<String, Object> properties) { String cipherTarget = (String) properties.getOrDefault("CIPHER_TARGET", SymmetricKeyCipher.CIPHER_ID); storageCipher = allAvailableStorageCiphers.stream() .filter(cipher -> cipher.getUniqueCipherId().equals(cipherTarget)).findFirst(); <START> logger.debug("Using Cipher: {}", storageCipher.orElse(null)); <END> loadAllHandlesAndTokens(); }</code><technical_language>Replace "null" "Identity"</technical_language>

Target:
public void activate(Map<String, Object> properties) throws GeneralSecurityException { String cipherTarget = (String) properties.getOrDefault("CIPHER_TARGET", SymmetricKeyCipher.CIPHER_ID); storageCipher = allAvailableStorageCiphers.stream() .filter(cipher -> cipher.getUniqueCipherId().equals(cipherTarget)).findFirst(); logger.debug("Using Cipher: {}", storageCipher .orElseThrow(() -> new GeneralSecurityException("No StorageCipher with target=" + cipherTarget))); }
Source:
<code>public Model resolveRawModel( final ProjectVersionRef ref ) throws ManipulationException { Transfer transfer; try { transfer = galleyWrapper.resolveArtifact( ref.asPomArtifact() ); } catch ( final TransferException e ) { <START> throw new ManipulationException( "Failed to resolve POM: %s.%n--> %s", e, ref, e.getMessage() ); <END> } if ( transfer == null ) { throw new ManipulationException( "Failed to resolve POM: " + ref.asPomArtifact() ); } try (InputStream in = transfer.openInputStream()) { return new MavenXpp3Reader().read( in ); } catch ( final IOException | XmlPullParserException e ) { throw new ManipulationException( "Failed to build model for POM: %s.%n--> %s", e, ref, e.getMessage() ); } }</code><technical_language>More %n</technical_language>

Target:
public Model resolveRawModel( final ProjectVersionRef ref ) throws ManipulationException { Transfer transfer; try { transfer = galleyWrapper.resolveArtifact( ref.asPomArtifact() ); } catch ( final TransferException e ) { throw new ManipulationException( "Failed to resolve POM: " + ref + "." + System.lineSeparator() + "--> " + e.getMessage(), e ); } if ( transfer == null ) { throw new ManipulationException( "Failed to resolve POM: " + ref.asPomArtifact() ); } try (InputStream in = transfer.openInputStream()) { return new MavenXpp3Reader().read( in ); } catch ( final IOException | XmlPullParserException e ) { throw new ManipulationException( "Failed to build model for POM: " + ref + "." + System.lineSeparator() + "--> " + e.getMessage(), e ); } }