auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean addDependencies(Set<DependencyType> dependencyTypes, Path pomPath) { List<DynamicPomDependency> deps = new ArrayList<>(); for (DependencyType dep : dependencyTypes) { deps.addAll(mapper.getDependencies(EnumSet.of(dep))); } if (deps.isEmpty()) { return false; } boolean result = false; try { org.uberfire.java.nio.file.Path filePath = Paths.get(pomPath.toURI()); Model model = getPOMModel(filePath); List<Dependency> depsFromPom = model.getDependencies(); Map<String, String> keys = getKeysFromDependencies(model.getDependencies()); for (DynamicPomDependency dep : deps) { <START> boolean internalArtifact = isInternalArtifact(dep); <END> if (!keys.containsKey(getKeyFromDynamicDependency(dep))) { Dependency pomDep = getMavenPomDep(dep, internalArtifact, getKieVersionFromPom(dep, depsFromPom)); model.getDependencies().add(pomDep); result = true; } else { for (Dependency modelDep : depsFromPom) { if (modelDep.getGroupId().equals(dep.getGroupID()) && modelDep.getArtifactId().equals(dep.getArtifactID()) && !modelDep.getVersion().equals(dep.getVersion())) { if (internalArtifact) { modelDep.setVersion(getKieVersionFromPom(dep, depsFromPom)); } else { modelDep.setVersion(dep.getVersion()); } result = true; } } } } if (result) { writePOMModelOnFS(filePath, model); } } catch (Exception ex) { logger.error(ex.getMessage(), ex); result = false; } return result; }</code><technical_language>this code a duplication of addDependency right? please do a refactoring</technical_language>

Target:
public boolean addDependencies(Set<DependencyType> dependencyTypes, Path pomPath) { if (dependencyTypes.isEmpty()) { return false; } List<DynamicPomDependency> deps = configurationMap.getDependencies(dependencyTypes); boolean result = false; try { org.uberfire.java.nio.file.Path filePath = Paths.get(pomPath.toURI()); Model model = getPOMModel(filePath); List<Dependency> depsFromPom = model.getDependencies(); Map<String, String> keys = getKeysFromDependencies(model.getDependencies()); for (DynamicPomDependency dep : deps) { boolean internalArtifact = isInternalArtifact(dep); if (!keys.containsKey(getKeyFromDynamicDependency(dep))) { Dependency pomDep = getMavenPomDep(dep, internalArtifact, getKieVersionFromPom(dep, depsFromPom)); model.getDependencies().add(pomDep); result = true; } else { for (Dependency modelDep : depsFromPom) { if (modelDep.getGroupId().equals(dep.getGroupID()) && modelDep.getArtifactId().equals(dep.getArtifactID()) && !modelDep.getVersion().equals(dep.getVersion())) { if (internalArtifact) { modelDep.setVersion(getKieVersionFromPom(dep, depsFromPom)); } else { modelDep.setVersion(dep.getVersion()); } result = true; } } } } if (result) { writePOMModelOnFS(filePath, model); } } catch (Exception ex) { logger.error(ex.getMessage(), ex); result = false; } return result; }
Source:
<code>public void shouldList_withNoPrefix() throws IOException { final S3FileStore s3FileStore = new S3FileStore(BUCKET_SCHEMA); s3FileStore.initialize(amazonS3Client); <START> final List<String> objectList = s3FileStore.list(BUCKET_NAME, null); <END> assertNotNull(objectList); }</code><technical_language>items expecting in bucket</technical_language>

Target:
public void shouldList_withNoPrefix() throws IOException { final S3FileStore s3FileStore = new S3FileStore(BUCKET_SCHEMA); s3FileStore.initialize(amazonS3Client); final List<FilePath> filePathList = s3FileStore.list(BUCKET_NAME, null); assertNotNull(filePathList); assertTrue(filePathList.size() > 0); }
Source:
<code>public static StorageServerConnections copyOf(StorageServerConnections ssc) { StorageServerConnections copy = new StorageServerConnections(ssc.connection, ssc.id, ssc.iqn, ssc.password, ssc.storageType, ssc.username, ssc.port, ssc.portal, ssc.vfsType, ssc.mountOptions, ssc.nfsVersion, ssc.nfsRetrans, ssc.nfsTimeo); <START> copy.setGlusterVolumeId(ssc.getGlusterVolumeId()); <END> return copy; }</code><technical_language>need set constructor changed</technical_language>

Target:
public static StorageServerConnections copyOf(StorageServerConnections ssc) { return new StorageServerConnections(ssc.connection, ssc.id, ssc.iqn, ssc.password, ssc.storageType, ssc.username, ssc.port, ssc.portal, ssc.vfsType, ssc.mountOptions, ssc.nfsVersion, ssc.nfsRetrans, ssc.nfsTimeo, ssc.glusterVolumeId); }
Source:
<code>static Map<String, HostDevice> filterOrphanedDevices(Map<String, HostDevice> fetchedDevicesMap) { if (!fetchedDevicesMap.containsKey(VdsProperties.ROOT_HOST_DEVICE)) { return <START> Collections.EMPTY_MAP; <END> } Map<String, List<String>> childrenDeviceMap = new HashMap<>(); for (Map.Entry<String, HostDevice> entry : fetchedDevicesMap.entrySet()) { String deviceName = entry.getKey(); HostDevice device = entry.getValue(); MultiValueMapUtils.addToMap(device.getParentDeviceName(), deviceName, childrenDeviceMap); } Stack<String> toTraverse = new Stack<>(); toTraverse.push(VdsProperties.ROOT_HOST_DEVICE); Map<String, HostDevice> result = new HashMap<>(); while (!toTraverse.empty()) { String deviceName = toTraverse.pop(); result.put(deviceName, fetchedDevicesMap.get(deviceName)); if (childrenDeviceMap.containsKey(deviceName)) { childrenDeviceMap.get(deviceName).stream() .filter(child -> !VdsProperties.ROOT_HOST_DEVICE.equals(child)) .forEach(toTraverse::push); } } return result; }</code><technical_language>emptyMap() prevent 'unchecked assignment' warning</technical_language>

Target:
static Map<String, HostDevice> filterOrphanedDevices(Map<String, HostDevice> fetchedDevicesMap) { if (!fetchedDevicesMap.containsKey(VdsProperties.ROOT_HOST_DEVICE)) { return Collections.emptyMap(); } Map<String, List<String>> childrenDeviceMap = new HashMap<>(); for (Map.Entry<String, HostDevice> entry : fetchedDevicesMap.entrySet()) { String deviceName = entry.getKey(); HostDevice device = entry.getValue(); MultiValueMapUtils.addToMap(device.getParentDeviceName(), deviceName, childrenDeviceMap); } Stack<String> toTraverse = new Stack<>(); toTraverse.push(VdsProperties.ROOT_HOST_DEVICE); Map<String, HostDevice> result = new HashMap<>(); while (!toTraverse.empty()) { String deviceName = toTraverse.pop(); result.put(deviceName, fetchedDevicesMap.get(deviceName)); if (childrenDeviceMap.containsKey(deviceName)) { childrenDeviceMap.get(deviceName).stream() .filter(child -> !VdsProperties.ROOT_HOST_DEVICE.equals(child)) .forEach(toTraverse::push); } } return result; }
Source:
<code>public ListenableFuture<?> commitFiles(ConnectorSession session, String schemaName, String tableName, List<PartitionUpdate> partitionUpdates) { HdfsContext context = new HdfsContext(session, schemaName, tableName); List<ListenableFuture<?>> commitFutures = new ArrayList<>(); for (PartitionUpdate partitionUpdate : partitionUpdates) { Path path = partitionUpdate.getWritePath(); FileSystem fileSystem = getFileSystem(hdfsEnvironment, context, path); for (FileWriteInfo fileWriteInfo : partitionUpdate.getFileWriteInfos()) { checkState(!fileWriteInfo.getWriteFileName().equals(fileWriteInfo.getTargetFileName())); Path source = new Path(path, fileWriteInfo.getWriteFileName()); Path target = new Path(path, fileWriteInfo.getTargetFileName()); commitFutures.add(fileRenameExecutor.submit(() -> renameFile(fileSystem, source, target))); } } ListenableFuture<?> result = whenAllSucceed(commitFutures).call(() -> null, directExecutor()); ListenableFuture<?> ioExceptionHandledResult = catching( result, IOException.class, e -> { result.cancel(true); <START> return new PrestoException(HIVE_FILESYSTEM_ERROR, "Error moving data files to final destination", e); <END> }, directExecutor()); return catching( ioExceptionHandledResult, RuntimeException.class, e -> { result.cancel(true); return e; }, directExecutor()); }</code><technical_language>nit: "renaming" instead of "moving"</technical_language>

Target:
public ListenableFuture<Void> commitFiles(ConnectorSession session, String schemaName, String tableName, List<PartitionUpdate> partitionUpdates) { HdfsContext context = new HdfsContext(session, schemaName, tableName); List<ListenableFuture<Void>> commitFutures = new ArrayList<>(); for (PartitionUpdate partitionUpdate : partitionUpdates) { Path path = partitionUpdate.getWritePath(); FileSystem fileSystem = getFileSystem(hdfsEnvironment, context, path); for (FileWriteInfo fileWriteInfo : partitionUpdate.getFileWriteInfos()) { checkState(!fileWriteInfo.getWriteFileName().equals(fileWriteInfo.getTargetFileName())); Path source = new Path(path, fileWriteInfo.getWriteFileName()); Path target = new Path(path, fileWriteInfo.getTargetFileName()); commitFutures.add(fileRenameExecutor.submit(() -> { renameFile(fileSystem, source, target); return null; })); } } ListenableFuture<Void> result = whenAllSucceed(commitFutures).call(() -> null, directExecutor()); return catching( result, RuntimeException.class, e -> { checkState(e != null, "Null exception is caught during commitFiles"); result.cancel(true); throw e; }, directExecutor()); }
Source:
<code>public boolean setApiKey(String apiKey) throws ConstructorException { <START> try { <END> this.apiKey = apiKey; return true; } catch (Exception exception) { throw new ConstructorException(exception); } }</code><technical_language>A try/catch appears a heavy. I suggest this.apiKey = apiKey;</technical_language>

Target:
public void setApiKey(String apiKey) { this.apiKey = apiKey; }
Source:
<code>public void testDictionaryArtifactToSerializerMappingExtraction() throws IOException { <START> InputStream descIn = getClass().getResourceAsStream( <END> "/opennlp/tools/util/featuregen/TestDictionarySerializerMappingExtractionxml"); Map<String, ArtifactSerializer<?>> mapping = GeneratorFactory.extractArtifactSerializerMappings(descIn); Assert.assertTrue(mapping.get("test.dictionary") instanceof DictionarySerializer); }</code><technical_language>Please wrap this a try-with-resources get stream closed. Some tools complain place a compiler warning</technical_language>

Target:
public void testDictionaryArtifactToSerializerMappingExtraction() throws IOException { try (InputStream descIn = getClass().getResourceAsStream( "/opennlp/tools/util/featuregen/TestDictionarySerializerMappingExtractionxml")) { Map<String, ArtifactSerializer<?>> mapping = GeneratorFactory.extractArtifactSerializerMappings(descIn); Assert.assertTrue(mapping.get("test.dictionary") instanceof DictionarySerializer); } }
Source:
<code>private void titleMatchOnGoogleTask(Task remote) { String title = remote.getValue(Task.TITLE); TodorooCursor<Task> match = taskService.query(Query.select(Task.ID) .join(Join.inner(Metadata.TABLE, Criterion.and(Metadata.KEY.eq(GtasksMetadata.METADATA_KEY), Metadata.TASK.eq(Task.ID)))) .where(Criterion.and(Task.TITLE.eq(title), Task.REMOTE_ID.isNull()))); try { if (match.getCount() > 0) { match.moveToFirst(); Task matchedTitle = new Task(match); <START> remote.setId(matchedTitle.getId()); <END> } } finally { match.close(); } }</code><technical_language>do: remote.setId(match.get(Task.ID));</technical_language>

Target:
private void titleMatchOnGoogleTask(Task remote) { String title = remote.getValue(Task.TITLE); TodorooCursor<Task> match = taskService.query(Query.select(Task.ID) .join(Join.inner(Metadata.TABLE, Criterion.and(Metadata.KEY.eq(GtasksMetadata.METADATA_KEY), Metadata.TASK.eq(Task.ID)))) .where(Criterion.and(Task.TITLE.eq(title), Task.REMOTE_ID.isNull()))); try { if (match.getCount() > 0) { match.moveToFirst(); remote.setId(match.get(Task.ID)); } } finally { match.close(); } }
Source:
<code>public boolean next() throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException { try { if (advance) { advance = false; postChildren = false; popEntriesEqual(); } for (;;) { final AbstractTreeIterator tmin = min(); <START> if (tmin.eof()) { <END> if (depth > 0) { exitSubtree(); if (postOrderTraversal) { advance = true; postChildren = true; return true; } popEntriesEqual(); continue; } return false; } currentHead = tmin; if (isSkipCurrentEntry() || !filter.include(this)) { skipEntriesEqual(); continue; } if (recursive && FileMode.TREE.equals(tmin.mode)) { enterSubtree(); continue; } advance = true; return true; } } catch (StopWalkException stop) { for (final AbstractTreeIterator t : trees) t.stopWalk(); return false; } }</code><technical_language>I rename this variable part of this change. reference new code. bad name be, I a compelling motivation change lines part of this commit. try avoid editing lines to. If t a parameter isSkipCurrentEntry() I willing accept a rename of part of commit. need it, sense</technical_language>

Target:
public boolean next() throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException { try { if (advance) { advance = false; postChildren = false; popEntriesEqual(); } for (;;) { final AbstractTreeIterator t = min(); if (t.eof()) { if (depth > 0) { exitSubtree(); if (postOrderTraversal) { advance = true; postChildren = true; return true; } popEntriesEqual(); continue; } return false; } currentHead = t; if (!filter.include(this)) { skipEntriesEqual(); continue; } if (recursive && FileMode.TREE.equals(t.mode)) { enterSubtree(); continue; } advance = true; return true; } } catch (StopWalkException stop) { for (final AbstractTreeIterator t : trees) t.stopWalk(); return false; } }
Source:
<code>public Set<TopicLabel> getLabels() { <START> return labels; <END> }</code><technical_language>Topic class setters immutable. returning Set exposing interface allows user modify labels creating new Topic object</technical_language>

Target:
public Set<TopicLabel> getLabels() { return Collections.unmodifiableSet(labels); }
Source:
<code>private List<TabletInfo<T>> listSplits() throws TableNotFoundException, AccumuloSecurityException, AccumuloException { List<Text> splits = new ArrayList<>(env.getConnector().tableOperations().listSplits(env.getTable())); Collections.sort(splits); List<TabletInfo<T>> tablets = new ArrayList<>(splits.size() + 1); for (int i = 0; i < splits.size(); i++) { <START> tablets.add(new TabletInfo<T>(i == 0 ? null : splits.get(i - 1), splits.get(i), supplier.get())); <END> } tablets.add(new TabletInfo<T>(splits.size() == 0 ? null : splits.get(splits.size() - 1), null, supplier.get())); listSplitsTime = System.currentTimeMillis(); return tablets; }</code><technical_language>diamond op</technical_language>

Target:
private List<TabletInfo<T>> listSplits() throws TableNotFoundException, AccumuloSecurityException, AccumuloException { List<Text> splits = new ArrayList<>(env.getConnector().tableOperations().listSplits(env.getTable())); Collections.sort(splits); List<TabletInfo<T>> tablets = new ArrayList<>(splits.size() + 1); for (int i = 0; i < splits.size(); i++) { tablets.add(new TabletInfo<>(i == 0 ? null : splits.get(i - 1), splits.get(i), supplier.get())); } tablets.add(new TabletInfo<>(splits.size() == 0 ? null : splits.get(splits.size() - 1), null, supplier.get())); listSplitsTime = System.currentTimeMillis(); return tablets; }
Source:
<code>public int getEnrolmentByStatus(DeviceIdentifier deviceId, Status status, int tenantId) throws DeviceManagementDAOException { Connection conn; PreparedStatement stmt = null; ResultSet rs = null; try { conn = this.getConnection(); <START> String sql = "SELECT e.ID ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID FROM DM_DEVICE d, DM_DEVICE_TYPE t " + <END> "WHERE d.DEVICE_TYPE_ID = t.ID AND d.DEVICE_IDENTIFICATION = ? AND t.NAME = ? AND d.TENANT_ID = ?) dtm " + "WHERE e.DEVICE_ID = dtm.ID AND e.STATUS = ? AND e.TENANT_ID = ?"; stmt = conn.prepareStatement(sql); stmt.setString(1, deviceId.getId()); stmt.setString(2, deviceId.getType()); stmt.setInt(3, tenantId); stmt.setString(4, status.toString()); stmt.setInt(5, tenantId); rs = stmt.executeQuery(); if (rs.next()) { return rs.getInt("ENROLMENT_ID"); } else { return -1; } } catch (SQLException e) { throw new DeviceManagementDAOException("Error occurred while retrieving the enrolment " + "id of device '" + deviceId + "'", e); } finally { DeviceManagementDAOUtil.cleanupResources(stmt, rs); } }</code><technical_language>This corrected "SELECT e.ID ENROLMENT_ID" -> "SELECT e.ID ENROLMENT_ID"</technical_language>

Target:
public int getEnrolmentByStatus(DeviceIdentifier deviceId, Status status, int tenantId) throws DeviceManagementDAOException { Connection conn; PreparedStatement stmt = null; ResultSet rs = null; try { conn = this.getConnection(); String sql = "SELECT e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID FROM DM_DEVICE d, DM_DEVICE_TYPE t " + "WHERE d.DEVICE_TYPE_ID = t.ID AND d.DEVICE_IDENTIFICATION = ? AND t.NAME = ? AND d.TENANT_ID = ?) dtm " + "WHERE e.DEVICE_ID = dtm.ID AND e.STATUS = ? AND e.TENANT_ID = ?;"; stmt = conn.prepareStatement(sql); stmt.setString(1, deviceId.getId()); stmt.setString(2, deviceId.getType()); stmt.setInt(3, tenantId); stmt.setString(4, status.toString()); stmt.setInt(5, tenantId); rs = stmt.executeQuery(); if (rs.next()) { return rs.getInt("ENROLMENT_ID"); } else { return -1; } } catch (SQLException e) { throw new DeviceManagementDAOException("Error occurred while retrieving the enrolment " + "id of device '" + deviceId + "'", e); } finally { DeviceManagementDAOUtil.cleanupResources(stmt, rs); } }
Source:
<code>protected List<Result> joinEvents(EventGroup eventGroup) { IotasEvent joinedEvent = joiner.join(eventGroup); List<Result> results = new ArrayList<>(); final List<IotasEvent> events = Collections.singletonList(joinedEvent); <START> for (String stream : joinAction.getOutputStreams()) { <END> results.add(new Result(stream, events)); } return results; }</code><technical_language>Minor: getOutputStreams() for this instead of joinAction</technical_language>

Target:
protected List<Result> joinEvents(EventGroup eventGroup) { IotasEvent joinedEvent = joiner.join(eventGroup); List<Result> results = new ArrayList<>(); for (String stream : getOutputStreams()) { results.add(new Result(stream, Collections.singletonList(getIotasEvent(joinedEvent, stream)))); } groupedEvents.invalidate(eventGroup.getGroupId()); return results; }
Source:
<code>public static boolean isCppType(IProject project) { try { if (project.hasNature(CCProjectNature.CC_NATURE_ID)) { return true; } else { return false; } } catch (CoreException ex) { <START> MessageDialogSyncedRunnable.openErrorSyncedRunnable("Error", "Getting Project type error"); END> return false; } }</code><technical_language>This strings externalized</technical_language>

Target:
public static boolean isCppType(IProject project) { try { if (project.hasNature(CCProjectNature.CC_NATURE_ID)) { return true; } else { return false; } } catch (CoreException ex) { MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetProjectType); return false; } }
Source:
<code>public boolean getAwsProxyEnabled(){ <START> return getBoolean("aws.proxy.isEnabled", false); <END> }</code><technical_language>want config default in properties file, is need provide a default in java code</technical_language>

Target:
public boolean getAwsProxyEnabled(){ return getBoolean("aws.proxy.isEnabled"); }
Source:
<code>public static void writeJobIdToFile(String hadoopJobIdFileName, String hadoopJobId) { if (hadoopJobId != null && hadoopJobIdFileName != null) { <START> try (final OutputStream out = java.nio.file.Files.newOutputStream(Paths.get(hadoopJobIdFileName))) { <END> HadoopDruidIndexerConfig.JSON_MAPPER.writeValue( new OutputStreamWriter(out, StandardCharsets.UTF_8), hadoopJobId ); log.info("MR job id [%s] is written to the file [%s]", hadoopJobId, hadoopJobIdFileName); } catch (IOException e) { log.warn(e, "Error writing job id [%s] to the file [%s]", hadoopJobId, hadoopJobIdFileName); } } else { log.info("Either job id or file name is null for the submitted job. Skipping writing the file [%s]", hadoopJobIdFileName); } }</code><technical_language>replace sole of Guava's Files in this class java.nio.file.Files.copy() avoid fully-qualified class name</technical_language>

Target:
public static void writeJobIdToFile(String hadoopJobIdFileName, String hadoopJobId) { if (hadoopJobId != null && hadoopJobIdFileName != null) { try (final OutputStream out = Files.newOutputStream(Paths.get(hadoopJobIdFileName))) { HadoopDruidIndexerConfig.JSON_MAPPER.writeValue( new OutputStreamWriter(out, StandardCharsets.UTF_8), hadoopJobId ); log.info("MR job id [%s] is written to the file [%s]", hadoopJobId, hadoopJobIdFileName); } catch (IOException e) { log.warn(e, "Error writing job id [%s] to the file [%s]", hadoopJobId, hadoopJobIdFileName); } } else { log.info("Either job id or file name is null for the submitted job. Skipping writing the file [%s]", hadoopJobIdFileName); } }
Source:
<code>public void testErrorOnMultipleListBinding() { ObservableList<String> dolphinList = new ObservableArrayList<>(); ObservableList<String> dolphinList2 = new ObservableArrayList<>(); javafx.collections.ObservableList<String> javaFXList = FXCollections.observableArrayList(); FXBinder.bind(javaFXList).to(dolphinList); try { FXBinder.bind(javaFXList).to(dolphinList2); <START> fail("A JavaFX list can only be bound to one Dolphin list"); <END> } catch (Exception e){ } }</code><technical_language>work expected Exception instead</technical_language>

Target:
public void testErrorOnMultipleListBinding() { ObservableList<String> dolphinList = new ObservableArrayList<>(); ObservableList<String> dolphinList2 = new ObservableArrayList<>(); javafx.collections.ObservableList<String> javaFXList = FXCollections.observableArrayList(); FXBinder.bind(javaFXList).to(dolphinList); FXBinder.bind(javaFXList).to(dolphinList2); }
Source:
<code>private void logServerWarnings(List<String> warnings) { StringBuilder statementString = new StringBuilder(); requestLogFormatter.appendRequest( statement, <START> executionProfile.getInt(DefaultDriverOption.REQUEST_LOGGER_MAX_QUERY_LENGTH, 500), <END> executionProfile.getBoolean(DefaultDriverOption.REQUEST_LOGGER_VALUES, false), executionProfile.getInt(DefaultDriverOption.REQUEST_LOGGER_MAX_VALUES, 0), executionProfile.getInt(DefaultDriverOption.REQUEST_LOGGER_MAX_VALUE_LENGTH, 0), statementString); warnings.forEach( (warning) -> { LOG.warn("Query '{}' generated server side warning(s): {}", statementString, warning); }); }</code><technical_language>default values 500, false, 0, 0 in other places, right? (for example in RequestLogger executionProfile.getInt(DefaultDriverOption.REQUEST_LOGGER_MAX_QUERY_LENGTH, 500);) refactor Defaults constants constants in places default is needed (to avoid duplication)</technical_language>

Target:
private void logServerWarnings(List<String> warnings) { StringBuilder statementString = new StringBuilder(); context .getRequestLogFormatter() .appendRequest( statement, executionProfile.getInt( DefaultDriverOption.REQUEST_LOGGER_MAX_QUERY_LENGTH, RequestLogger.DEFAULT_REQUEST_LOGGER_MAX_QUERY_LENGTH), executionProfile.getBoolean( DefaultDriverOption.REQUEST_LOGGER_VALUES, RequestLogger.DEFAULT_REQUEST_LOGGER_SHOW_VALUES), executionProfile.getInt( DefaultDriverOption.REQUEST_LOGGER_MAX_VALUES, RequestLogger.DEFAULT_REQUEST_LOGGER_MAX_VALUES), executionProfile.getInt( DefaultDriverOption.REQUEST_LOGGER_MAX_VALUE_LENGTH, RequestLogger.DEFAULT_REQUEST_LOGGER_MAX_VALUE_LENGTH), statementString); warnings.forEach( (warning) -> LOG.warn("Query '{}' generated server side warning(s): {}", statementString, warning)); }
Source:
<code>public void compute(Iterator<RayMessage> msgIterator) throws Exception { if (getSuperstep() == 1) { <START> initVertex(); <END> if (isStartSeed()) { msgIterator = getStartMessage(); } } scaffold(msgIterator); voteToHalt(); }</code><technical_language>do need this initVertex() here? add in confgure</technical_language>

Target:
public void compute(Iterator<RayMessage> msgIterator) throws Exception { if (getSuperstep() == 1) { if (isStartSeed()) { msgIterator = getStartMessage(); } } scaffold(msgIterator); voteToHalt(); }
Source:
<code>public void testRowValueConstructorInWhereWithEqualsExpression() throws Exception { long ts = nextTimestamp(); String tenantId = getOrganizationId(); <START> initATableValues("aTable", tenantId, getDefaultSplits(tenantId), null, ts, getUrl()); <END> String query = "SELECT a_integer, x_integer FROM aTable WHERE ?=organization_id AND (a_integer, x_integer) = (7, 5)"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, tenantId); ResultSet rs = statement.executeQuery(); int count = 0; while(rs.next()) { assertTrue(rs.getInt(1) == 7); assertTrue(rs.getInt(2) == 5); count++; } assertTrue(count == 1); } finally { conn.close(); } }</code><technical_language>Static constant, please</technical_language>

Target:
public void testRowValueConstructorInWhereWithEqualsExpression() throws Exception { long ts = nextTimestamp(); String tenantId = getOrganizationId(); initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), null, ts, getUrl()); String query = "SELECT a_integer, x_integer FROM aTable WHERE ?=organization_id AND (a_integer, x_integer) = (7, 5)"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); Connection conn = DriverManager.getConnection(getUrl(), props); try { PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, tenantId); ResultSet rs = statement.executeQuery(); int count = 0; while(rs.next()) { assertTrue(rs.getInt(1) == 7); assertTrue(rs.getInt(2) == 5); count++; } assertTrue(count == 1); } finally { conn.close(); } }
Source:
<code><START> public void processSingleReferenceSlice(final Slice slice) { <END> System.out.println(slice.toString()); try { final int reference = slice.sequenceId; if (reference == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) { return; } if (slice.sequenceId == Slice.MULTI_REFERENCE) { throw new SAMException("Expecting a single reference slice."); } if (reference != currentReference) { advanceToReference(reference); } indexBuilder.processAlignment(slice); } catch (final Exception e) { throw new SAMException("Exception creating BAM index for slice " + slice, e); } }</code><technical_language>name</technical_language>

Target:
public void processSingleReferenceSlice(final Slice slice) { try { final int reference = slice.sequenceId; if (reference == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) { return; } if (slice.sequenceId == Slice.MULTI_REFERENCE) { throw new SAMException("Expecting a single reference slice."); } if (reference != currentReference) { advanceToReference(reference); } indexBuilder.processSingleReferenceSlice(slice); } catch (final Exception e) { throw new SAMException("Exception creating BAM index for slice " + slice, e); } }
Source:
<code>private static void test(Shell shell) { File libsFolder = new File("nativeLibs"); createEmptyFolder(libsFolder); <START> boolean isMacOS = (System.getProperty("os.name").indexOf("mac") >= 0); <END> ProcessBuilder processBuilder = new ProcessBuilder( System.getProperty("java.home") + "/bin/java", "-Dswt.library.path=" + libsFolder.getAbsolutePath(), "-classpath", System.getProperty("java.class.path"), isMacOS ? "-XstartOnFirstThread" : "", Bug547109_JvmCrashNativeLibraryLoad.class.getName(), ARG_NO_UI ); processBuilder.inheritIO(); int numErrors = 0; try { Process[] processes = new Process[15]; for (int i = 0; i < processes.length; i++) { processes[i] = processBuilder.start(); } for (int i = 0; i < processes.length; i++) { int exitCode = processes[i].waitFor(); if (EXIT_CODE_GOOD != exitCode) numErrors++; } } catch (Throwable ex) { ex.printStackTrace(); } String message = String.format("%d crashes/errors detected", numErrors); MessageBox dialog = new MessageBox(shell, SWT.ICON_INFORMATION); dialog.setMessage(message); dialog.open(); }</code><technical_language>This indexOf("Mac OS X")</technical_language>

Target:
private static void test(Shell shell) { File libsFolder = new File("nativeLibs"); createEmptyFolder(libsFolder); boolean isMacOS = Platform.PLATFORM.equalsIgnoreCase("cocoa"); ProcessBuilder processBuilder = new ProcessBuilder( System.getProperty("java.home") + "/bin/java", "-Dswt.library.path=" + libsFolder.getAbsolutePath(), "-classpath", System.getProperty("java.class.path"), isMacOS ? "-XstartOnFirstThread" : "", Bug547109_JvmCrashNativeLibraryLoad.class.getName(), ARG_NO_UI ); processBuilder.inheritIO(); int numErrors = 0; try { Process[] processes = new Process[15]; for (int i = 0; i < processes.length; i++) { processes[i] = processBuilder.start(); } for (int i = 0; i < processes.length; i++) { int exitCode = processes[i].waitFor(); if (EXIT_CODE_GOOD != exitCode) numErrors++; } } catch (Throwable ex) { ex.printStackTrace(); } String message = String.format("%d crashes/errors detected", numErrors); MessageBox dialog = new MessageBox(shell, SWT.ICON_INFORMATION); dialog.setMessage(message); dialog.open(); }
Source:
<code>public void run() { int attempt = 0; while (true) { <START> if (Thread.interrupted()) { <END> return; } attempt++; long sleep = calculateExponentialDelay(attempt - 1, TimeUnit.MINUTES.toMillis(5)); if (sleep > 0) { try { Thread.sleep(sleep); } catch (InterruptedException e) { RealmLog.debug("Incremental backoff was interrupted."); return; } } T response = execute(); if (isSuccess(response)) { onSuccess(response); break; } else { if (shouldAbortTask(response) || attempt == maxRetries + 1) { onError(response); break; } } } }</code><technical_language>simplify expression condition in while while(!Thread.interrupted()) { //... }</technical_language>

Target:
public void run() { int attempt = 0; while (!Thread.interrupted()) { attempt++; long sleep = calculateExponentialDelay(attempt - 1, TimeUnit.MINUTES.toMillis(5)); if (sleep > 0) { try { Thread.sleep(sleep); } catch (InterruptedException e) { RealmLog.debug("Incremental backoff was interrupted."); return; } } T response = execute(); if (isSuccess(response)) { onSuccess(response); break; } else { if (shouldAbortTask(response) || attempt == maxRetries + 1) { onError(response); break; } } } }
Source:
<code>public DhcpInfo getDhcpInfo() { enforceAccessPermission(); if (mVerboseLoggingEnabled) { mLog.info("getDhcpInfo uid=%").c(Binder.getCallingUid()).flush(); } <START> DhcpInfo dhcpInfo = mClientModeImpl.syncGetDhcpInfo(); return dhcpInfo; <END> }</code><technical_language>return mClientModeImpl.getSyncDhcpInfo. If want introduce a local final</technical_language>

Target:
public DhcpInfo getDhcpInfo() { enforceAccessPermission(); if (mVerboseLoggingEnabled) { mLog.info("getDhcpInfo uid=%").c(Binder.getCallingUid()).flush(); } return mClientModeImpl.syncGetDhcpInfo(); }
Source:
<code>public void handleStatement(Statement statement) throws RDFHandlerException { String subject = statement.getSubject().stringValue(); <START> if (subject.contains("/Special:EntityData/") && !subject.contains("/wiki/Special:EntityData/")) { <END> subject = subject.replace("/Special:EntityData/", "/wiki/Special:EntityData/"); } if (subject.contains("ontology-0.0.1")) { subject = subject.replace("ontology-0.0.1", "ontology"); } if (!statement.getSubject().stringValue().equals(subject)) { statement = new StatementImpl(new URIImpl(subject), statement.getPredicate(), statement.getObject()); } next.handleStatement(statement); }</code><technical_language>fixed in deployed version</technical_language>

Target:
public void handleStatement(Statement statement) throws RDFHandlerException { String subject = statement.getSubject().stringValue(); if (subject.contains("ontology-0.0.1")) { subject = subject.replace("ontology-0.0.1", "ontology"); } if (!statement.getSubject().stringValue().equals(subject)) { statement = new StatementImpl(new URIImpl(subject), statement.getPredicate(), statement.getObject()); } next.handleStatement(statement); }
Source:
<code>public static IInputValidator getRefNameInputValidator( final Repository repo, final String refPrefix, final boolean errorOnEmptyName) { return new IInputValidator() { public String isValid(String newText) { if (newText.length() == 0) { if (errorOnEmptyName) return UIText.ValidationUtils_PleaseEnterNameMessage; else return null; } String testFor = refPrefix + newText; if (!Repository.isValidRefName(testFor)) return NLS.bind( UIText.ValidationUtils_InvalidRefNameMessage, testFor); try { if (repo.resolve(testFor) != null) return NLS.bind( UIText.ValidationUtils_RefAlreadyExistsMessage, testFor); RefDatabase refDatabase = repo.getRefDatabase(); boolean nameConflicting = refDatabase.isNameConflicting(testFor); if (nameConflicting) <START> return UIText.ValidationUtils_RefNameConflictsWithExistingMessage; <END> } catch (IOException e1) { Activator.logError(NLS.bind( UIText.ValidationUtils_CanNotResolveRefMessage, testFor), e1); return e1.getMessage(); } return null; } }; }</code><technical_language>show conflicting ref</technical_language>

Target:
public static IInputValidator getRefNameInputValidator( final Repository repo, final String refPrefix, final boolean errorOnEmptyName) { return new IInputValidator() { public String isValid(String newText) { if (newText.length() == 0) { if (errorOnEmptyName) return UIText.ValidationUtils_PleaseEnterNameMessage; else return null; } String testFor = refPrefix + newText; if (!Repository.isValidRefName(testFor)) return NLS.bind( UIText.ValidationUtils_InvalidRefNameMessage, testFor); try { if (repo.resolve(testFor) != null) return NLS.bind( UIText.ValidationUtils_RefAlreadyExistsMessage, testFor); RefDatabase refDatabase = repo.getRefDatabase(); List<String> conflictingNames = refDatabase.getConflictingNames(testFor); if (!conflictingNames.isEmpty()) { String joined = StringUtils.join(conflictingNames, ", "); return NLS.bind( UIText.ValidationUtils_RefNameConflictsWithExistingMessage, joined); } } catch (IOException e1) { Activator.logError(NLS.bind( UIText.ValidationUtils_CanNotResolveRefMessage, testFor), e1); return e1.getMessage(); } return null; } }; }
Source:
<code>public int computeCellInfoMinInterval() { <START> if (mIsScreenOn && (!mIsWifiConnected || mIsCharging)) { <END> return CELL_INFO_INTERVAL_SHORT_MS; } return CELL_INFO_INTERVAL_LONG_MS; }</code><technical_language>split this in blocks? if (mIsScreenOn && !mIsWifiConnected) { // Screen + wifi means device is return CELL_INFO_INTERVAL_SHORT_MS; } else if (mIsScreenOn && mIsCharging) { // Screen + charging means device is in a car home return CELL_INFO_INTERVAL_SHORT_MS; } else { return CELL_INFO_INTERVAL_LONG_MS; }</technical_language>

Target:
public int computeCellInfoMinInterval() { if (mIsScreenOn && !mIsWifiConnected) { return CELL_INFO_INTERVAL_SHORT_MS; } else if (mIsScreenOn && mIsCharging) { return CELL_INFO_INTERVAL_SHORT_MS; } else { return CELL_INFO_INTERVAL_LONG_MS; } }
Source:
<code>private boolean isMemberInGracePeriod(Map<String, String> membershipExpirationRules, String membershipExpiration) throws InternalErrorException { if (membershipExpirationRules.get(AbstractMembershipExpirationRulesModule.membershipGracePeriodKeyName) == null) { return true; } if (membershipExpiration == null) { return true; } String gracePeriod = membershipExpirationRules.get(AbstractMembershipExpirationRulesModule.membershipGracePeriodKeyName); Pattern p = Pattern.compile("([0-9]+)([dmy]?)"); Matcher m = p.matcher(gracePeriod); if (!m.matches()) { throw new InternalErrorException("Wrong format of gracePeriod in VO membershipExpirationRules attribute. gracePeriod: " + gracePeriod); } int amount = Integer.valueOf(m.group(1)); <START> TemporalUnit field; <END> String dmyString = m.group(2); if (dmyString.equals("d")) { field = ChronoUnit.DAYS; } else if (dmyString.equals("m")) { field = ChronoUnit.MONTHS; } else if (dmyString.equals("y")) { field = ChronoUnit.YEARS; } else { throw new InternalErrorException("Wrong format of gracePeriod in VO membershipExpirationRules attribute. gracePeriod: " + gracePeriod); } LocalDate beginOfGracePeriod = LocalDate.parse(membershipExpiration, DateTimeFormatter.ISO_LOCAL_DATE); beginOfGracePeriod = beginOfGracePeriod.minus(amount, field); if (beginOfGracePeriod.isBefore(LocalDate.now())) { return true; } return false; }</code><technical_language>I a name for this variable. gracePeriodTimeUnit</technical_language>

Target:
private boolean isMemberInGracePeriod(Map<String, String> membershipExpirationRules, String membershipExpiration) throws InternalErrorException { if (membershipExpirationRules.get(AbstractMembershipExpirationRulesModule.membershipGracePeriodKeyName) == null) { return true; } if (membershipExpiration == null) { return true; } String gracePeriod = membershipExpirationRules.get(AbstractMembershipExpirationRulesModule.membershipGracePeriodKeyName); Pattern p = Pattern.compile("([0-9]+)([dmy]?)"); Matcher m = p.matcher(gracePeriod); if (!m.matches()) { throw new InternalErrorException("Wrong format of gracePeriod in VO membershipExpirationRules attribute. gracePeriod: " + gracePeriod); } int amount = Integer.valueOf(m.group(1)); TemporalUnit gracePeriodTimeUnit; String dmyString = m.group(2); if (dmyString.equals("d")) { gracePeriodTimeUnit = ChronoUnit.DAYS; } else if (dmyString.equals("m")) { gracePeriodTimeUnit = ChronoUnit.MONTHS; } else if (dmyString.equals("y")) { gracePeriodTimeUnit = ChronoUnit.YEARS; } else { throw new InternalErrorException("Wrong format of gracePeriod in VO membershipExpirationRules attribute. gracePeriod: " + gracePeriod); } LocalDate beginOfGracePeriod = LocalDate.parse(membershipExpiration, DateTimeFormatter.ISO_LOCAL_DATE); beginOfGracePeriod = beginOfGracePeriod.minus(amount, gracePeriodTimeUnit); if (beginOfGracePeriod.isBefore(LocalDate.now())) { return true; } return false; }
Source:
<code>public OngoingStubbing<T> thenThrow(Class<? extends Throwable> toBeThrown, Class<? extends Throwable>... nextToBeThrown) { if (nextToBeThrown == null) { <START> return abortNullExceptionType(); <END> } OngoingStubbing<T> stubbing = thenThrow(toBeThrown); for (Class<? extends Throwable> t : nextToBeThrown) { stubbing = stubbing.thenThrow(t); } return stubbing; }</code><technical_language>This a change in behavior. is driving this? careful making changes in behavior issues migrating newer version of Mockito</technical_language>

Target:
public OngoingStubbing<T> thenThrow(Class<? extends Throwable> toBeThrown, Class<? extends Throwable>... nextToBeThrown) { if (nextToBeThrown == null) { return thenThrow((Class<Throwable>) null); } OngoingStubbing<T> stubbing = thenThrow(toBeThrown); for (Class<? extends Throwable> t : nextToBeThrown) { stubbing = stubbing.thenThrow(t); } return stubbing; }
Source:
<code><START> public void enabling_organizations_should_remove_template_rule_and_custom_rule() { <END> RuleDefinitionDto template = db.rules().insert(r -> r.setIsTemplate(true)); RuleDefinitionDto custom = db.rules().insert(r -> r.setTemplateId(template.getId())); UserDto user = db.users().insertUser(); db.users().insertDefaultGroup(db.getDefaultOrganization(), "sonar-users"); logInAsSystemAdministrator(user.getLogin()); assertThat(db.getDbClient().ruleDao().selectAllDefinitions(db.getSession())).extracting(RuleDefinitionDto::getStatus).containsOnly(RuleStatus.READY); call(); assertThat(db.getDbClient().ruleDao().selectAllDefinitions(db.getSession())).extracting(RuleDefinitionDto::getStatus).containsOnly(RuleStatus.REMOVED); @SuppressWarnings("unchecked") Class<ArrayList<RuleKey>> listClass = (Class<ArrayList<RuleKey>>)(Class)ArrayList.class; ArgumentCaptor<ArrayList<RuleKey>> indexedRuleKeys = ArgumentCaptor.forClass(listClass); verify(ruleIndexer).indexRuleDefinitions(indexedRuleKeys.capture()); assertThat(indexedRuleKeys.getValue()).containsExactlyInAnyOrder(template.getKey(), custom.getKey()); }</code><technical_language>UT missing ensuring regular rules removed</technical_language>

Target:
public void enabling_organizations_should_remove_template_rule_and_custom_rule() { RuleDefinitionDto normal = db.rules().insert(); RuleDefinitionDto template = db.rules().insert(r -> r.setIsTemplate(true)); RuleDefinitionDto custom = db.rules().insert(r -> r.setTemplateId(template.getId())); UserDto user = db.users().insertUser(); db.users().insertDefaultGroup(db.getDefaultOrganization(), "sonar-users"); logInAsSystemAdministrator(user.getLogin()); assertThat(db.getDbClient().ruleDao().selectAllDefinitions(db.getSession())) .extracting(RuleDefinitionDto::getKey, RuleDefinitionDto::getStatus) .containsExactlyInAnyOrder( tuple(normal.getKey(), RuleStatus.READY), tuple(template.getKey(), RuleStatus.READY), tuple(custom.getKey(), RuleStatus.READY) ); call(); assertThat(db.getDbClient().ruleDao().selectAllDefinitions(db.getSession())) .extracting(RuleDefinitionDto::getKey, RuleDefinitionDto::getStatus) .containsExactlyInAnyOrder( tuple(normal.getKey(), RuleStatus.READY), tuple(template.getKey(), RuleStatus.REMOVED), tuple(custom.getKey(), RuleStatus.REMOVED) ); @SuppressWarnings("unchecked") Class<ArrayList<RuleKey>> listClass = (Class<ArrayList<RuleKey>>)(Class)ArrayList.class; ArgumentCaptor<ArrayList<RuleKey>> indexedRuleKeys = ArgumentCaptor.forClass(listClass); verify(ruleIndexer).indexRuleDefinitions(indexedRuleKeys.capture()); assertThat(indexedRuleKeys.getValue()).containsExactlyInAnyOrder(template.getKey(), custom.getKey()); }
Source:
<code>private void initStore() { <START> int initialBlockBufferSize = (int) max(MINIMUM_BUFFER_SIZE, rowGroupSize / schema.getColumns() <END> .size() / 5); pageStore = new ColumnChunkPageWriteStore(compressor, schema, initialBlockBufferSize); int initialPageBufferSize = max(MINIMUM_BUFFER_SIZE, min(pageSize + pageSize / 10, initialBlockBufferSize)); columnStore = new ColumnWriteStoreImpl(pageStore, pageSize, initialPageBufferSize, dictionaryPageSize, enableDictionary, writerVersion); MessageColumnIO columnIO = new ColumnIOFactory(validating).getColumnIO(schema); writeSupport.prepareForWrite(columnIO.getRecordWriter(columnStore)); }</code><technical_language>parquet.Ints.checkedCast get a negative out of this cast. <LINK_0></technical_language>

Target:
private void initStore() { int initialBlockBufferSize = Ints.checkedCast(max(MINIMUM_BUFFER_SIZE, rowGroupSize / schema.getColumns().size() / 5)); pageStore = new ColumnChunkPageWriteStore(compressor, schema, initialBlockBufferSize); int initialPageBufferSize = max(MINIMUM_BUFFER_SIZE, min(pageSize + pageSize / 10, initialBlockBufferSize)); columnStore = parquetProperties.newColumnWriteStore( schema, pageStore, pageSize, initialPageBufferSize); MessageColumnIO columnIO = new ColumnIOFactory(validating).getColumnIO(schema); writeSupport.prepareForWrite(columnIO.getRecordWriter(columnStore)); }
Source:
<code>protected void optimizeJoinGroup(AST2BOpContext ctx, StaticAnalysis sa, IBindingSet[] bSets, JoinGroupNode op) { Collection<ServiceNode> serviceNodes = LabelServiceUtils.getLabelServiceNodes(op).collect(Collectors.toList()); <START> for (ServiceNode serviceNode: serviceNodes) { <END> if (Boolean.TRUE.equals(serviceNode.annotations().get(LabelService.DISABLE_REORDERING_ANNOTATION))) { return; } processProjection(serviceNode); final JoinGroupNode joinGroup = (JoinGroupNode) op; joinGroup.removeChild(serviceNode); int lastJoinIndex = findLatestPossiblePositionForTheLabelServiceNode(sa, serviceNode, joinGroup); joinGroup.addArg(lastJoinIndex + 1, (BOp) serviceNode); } }</code><technical_language>need list forEach before</technical_language>

Target:
protected void optimizeJoinGroup(AST2BOpContext ctx, StaticAnalysis sa, IBindingSet[] bSets, JoinGroupNode op) { Collection<ServiceNode> serviceNodes = LabelServiceUtils.getLabelServiceNodes(op).collect(Collectors.toList()); for (ServiceNode serviceNode: serviceNodes) { if (Boolean.TRUE.equals(serviceNode.annotations().get(LabelService.DISABLE_REORDERING_ANNOTATION))) { return; } processProjection(serviceNode); op.removeChild(serviceNode); int lastJoinIndex = findLatestPossiblePositionForTheLabelServiceNode(sa, serviceNode, op); op.addArg(lastJoinIndex + 1, serviceNode); } }
Source:
<code>public Boolean checkWDL(File content){ Pattern taskPattern = Pattern.compile("(.*)(task)(\\s)(.*)(\\{)"); Pattern wfPattern = Pattern.compile("(.*)(workflow)(\\s)(.*)(\\{)"); String line; Integer counter = 0; try{ <START> InputStreamReader is = new InputStreamReader(new FileInputStream(content.getPath()),StandardCharsets.UTF_8); <END> BufferedReader bufferedReader = new BufferedReader(is); ArrayList<String> lines = new ArrayList<>(); while((line = bufferedReader.readLine()) != null) { Matcher m = taskPattern.matcher(line); lines.add(line); if (m.find()) { counter++; } } bufferedReader.close(); if(counter>0){ for(String l : lines) { Matcher m = wfPattern.matcher(l); if(m.find()){ return true; } } return false; } } catch (IOException e){ e.printStackTrace(); } return false; }</code><technical_language>deal here, please nio2 methods</technical_language>

Target:
public Boolean checkWDL(File content){ Pattern taskPattern = Pattern.compile("(.*)(task)(\\s)(.*)(\\{)"); Pattern wfPattern = Pattern.compile("(.*)(workflow)(\\s)(.*)(\\{)"); Integer counter = 0; Path p = Paths.get(content.getPath()); try{ List<String> fileContent = java.nio.file.Files.readAllLines(p, StandardCharsets.UTF_8); for(String line: fileContent){ Matcher m = taskPattern.matcher(line); if (m.find()) { counter++; } } if(counter>0){ for(String l : fileContent) { Matcher m = wfPattern.matcher(l); if(m.find()){ return true; } } return false; } } catch (IOException e){ throw new RuntimeException("Failed to get content of entry file.", e); } return false; }
Source:
<code>public static FullTextIndexItem property(@NonNull String property) { if(property == null) { <START> throw new IllegalArgumentException("property is null"); <END> } return new FullTextIndexItem(Expression.property(property)); }</code><technical_language>Summary: 1. Removed @throws IllegalArgumentException alias is null. is required declare throwing a runtime exception. declared this in other places e.g. Database class well. 2. Remove extra empty line if(<variable> == null) {. 3. Add a space if (. if (<variable> == null). 4. Add . (full stop) end of "... is null" -> ... is null. 5. Do for other methods</technical_language>

Target:
public static FullTextIndexItem property(@NonNull String property) { if (property == null) { throw new IllegalArgumentException("property is null."); } return new FullTextIndexItem(Expression.property(property)); }
Source:
<code>public static String getSqlFromSearchString(String searchString) { if (StringUtils.isBlank(searchString)) { return null; } <START> searchString = textToLDapSearch(searchString); <END> if (searchString.startsWith(PLUS_SIGN)) { return getSqlForClassicSearchFormat(searchString); } else if (searchString.startsWith(OPEN_PARENS)) { Filter filter; try { filter = Filter.create(searchString); } catch (LDAPException ex) { throw new IllegalArgumentException("Invalid Search Parameter"); } return getSqlFromLdapFilter(filter); } else { throw new IllegalArgumentException("Invalid Search Parameter"); } }</code><technical_language>Do need call this textToLDapSearch() here? this if searchString is for Classic search, do this</technical_language>

Target:
public static String getSqlFromSearchString(String searchString) { if (StringUtils.isBlank(searchString)) { return null; } if (searchString.startsWith(PLUS_SIGN)) { return getSqlForClassicSearchFormat(searchString); } else if (searchString.startsWith(OPEN_PARENS)) { searchString = textToLDapSearch(searchString); Filter filter; try { filter = Filter.create(searchString); } catch (LDAPException ex) { throw new IllegalArgumentException("Invalid LDAP Search Parameter"); } return getSqlFromLdapFilter(filter); } else { throw new IllegalArgumentException("Invalid Search Parameter: Search must begin with a '+' or a '(' character"); } }