auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setter_list_ownList() { realm.beginTransaction(); RealmList<AllJavaTypes> allTypesRealmModels = new RealmList<>(); for (int i = 0; i < 2; i++) { allTypesRealmModels.add(new AllJavaTypes(i)); } AllJavaTypes model = new AllJavaTypes(2); model.setFieldList(allTypesRealmModels); model = realm.copyToRealm(model); realm.commitTransaction(); assertEquals(2, model.getFieldList().size()); realm.beginTransaction(); <START> model.setFieldList(model.getFieldList()); <END> realm.commitTransaction(); assertEquals(2, model.getFieldList().size()); }</code><technical_language>setting unmanaged list size</technical_language>

Target:
public void setter_list_ownList() { realm.beginTransaction(); RealmList<AllJavaTypes> allTypesRealmModels = new RealmList<>(); for (int i = 0; i < 2; i++) { allTypesRealmModels.add(new AllJavaTypes(i)); } AllJavaTypes model = new AllJavaTypes(2); model.setFieldList(allTypesRealmModels); model = realm.copyToRealm(model); realm.commitTransaction(); assertEquals(2, model.getFieldList().size()); realm.beginTransaction(); model.setFieldList(model.getFieldList()); realm.commitTransaction(); assertEquals(2, model.getFieldList().size()); realm.beginTransaction(); RealmList<AllJavaTypes> unmanagedList = new RealmList<>(); unmanagedList.addAll(realm.copyFromRealm(model.getFieldList())); try { model.setFieldList(unmanagedList); fail(); } catch (IllegalArgumentException ignored) { } }
Source:
<code>private TrackedContentEntry recalculate( final TrackedContentEntry entry ) throws IndyWorkflowException { StoreKey affectedStore = entry.getStoreKey(); String path = entry.getPath(); AccessChannel channel = entry.getAccessChannel(); Transfer transfer = contentManager.getTransfer( affectedStore, path, entry.getEffect() == StoreEffect.UPLOAD ? TransferOperation.UPLOAD : TransferOperation.DOWNLOAD ); <START> if ( transfer == null ) <END> { return null; } contentDigester.removeMetadata( transfer ); TransferMetadata artifactData = contentDigester.digest( affectedStore, path, new EventMetadata( affectedStore.getPackageType() ) ); Map<ContentDigest, String> digests = artifactData.getDigests(); return new TrackedContentEntry( entry.getTrackingKey(), affectedStore, channel, entry.getOriginUrl(), path, entry.getEffect(), artifactData.getSize(), digests.get( ContentDigest.MD5 ), digests.get( ContentDigest.SHA_1 ), digests.get( ContentDigest.SHA_256 ) ); }</code><technical_language>this result in tracking record losing information if entries get promoted a consolidated hosted repo something? safer return partial information passed in, instead of null...</technical_language>

Target:
private TrackedContentEntry recalculate( final TrackedContentEntry entry ) throws IndyWorkflowException { StoreKey affectedStore = entry.getStoreKey(); String path = entry.getPath(); AccessChannel channel = entry.getAccessChannel(); Transfer transfer = contentManager.getTransfer( affectedStore, path, entry.getEffect() == StoreEffect.UPLOAD ? TransferOperation.UPLOAD : TransferOperation.DOWNLOAD ); if ( transfer == null ) { return entry; } contentDigester.removeMetadata( transfer ); TransferMetadata artifactData = contentDigester.digest( affectedStore, path, new EventMetadata( affectedStore.getPackageType() ) ); Map<ContentDigest, String> digests = artifactData.getDigests(); return new TrackedContentEntry( entry.getTrackingKey(), affectedStore, channel, entry.getOriginUrl(), path, entry.getEffect(), artifactData.getSize(), digests.get( ContentDigest.MD5 ), digests.get( ContentDigest.SHA_1 ), digests.get( ContentDigest.SHA_256 ) ); }
Source:
<code><START> private static Map<String, String> readMessagesFromBundle() { <END> try { ResourceBundle bundle = ResourceBundle.getBundle(APP_ERRORS_MESSAGES_FILE_NAME); Map<String, String> messages = new HashMap<String, String>(); for (String key : bundle.keySet()) { messages.put(key, bundle.getString(key)); } return messages; } catch (MissingResourceException e) { log.error("Could not load audit log messages from the file " + APP_ERRORS_MESSAGES_FILE_NAME); throw new ApplicationException(e); } }</code><technical_language>do need convert bundle a map, instead of directly</technical_language>

Target:
private static ResourceBundle readMessagesFromBundle() { try { return ResourceBundle.getBundle(APP_ERRORS_MESSAGES_FILE_NAME); } catch (MissingResourceException e) { log.error("Could not load audit log messages from the file " + APP_ERRORS_MESSAGES_FILE_NAME); throw new ApplicationException(e); } }
Source:
<code>public void testNonExistingClass() throws Exception { exit.expectSystemExitWithStatus(-2); exit.checkAssertionAfterwards(() -> { final String expectedExceptionMessage = errorCounterMessage.getMessage() <START> + System.getProperty("line.separator"); <END> assertEquals(expectedExceptionMessage, systemOut.getLog()); final String cause = "com.puppycrawl.tools.checkstyle.api.CheckstyleException:" + " cannot initialize module TreeWalker - "; assertTrue(systemErr.getLog().startsWith(cause)); }); Main.main("-c", getPath("config-non-existing-classname.xml"), getPath("InputMain.java")); }</code><technical_language>System.getProperty("line.separator") is , please move field name EOL, substitute in cases</technical_language>

Target:
public void testNonExistingClass() throws Exception { exit.expectSystemExitWithStatus(-2); exit.checkAssertionAfterwards(() -> { final String expectedExceptionMessage = errorCounterOneMessage.getMessage() + EOL; assertEquals(expectedExceptionMessage, systemOut.getLog()); final String cause = "com.puppycrawl.tools.checkstyle.api.CheckstyleException:" + " cannot initialize module TreeWalker - "; assertTrue(systemErr.getLog().startsWith(cause)); }); Main.main("-c", getPath("config-non-existing-classname.xml"), getPath("InputMain.java")); }
Source:
<code>public SnapshotImpl updateSnapshot(SnapshotImpl update) throws NotFoundException, ConflictException, SnapshotException { <START> requireNonNull(update, "Required non-null snapshot"); <END> requireNonNull(update.getId(), "Required non-null snapshot id"); return snapshots.put(update.getId(), update); }</code><technical_language>Please throw unsupported operation exception instead, this dao is used. get rid of it</technical_language>

Target:
public SnapshotImpl updateSnapshot(SnapshotImpl update) throws NotFoundException, ConflictException, SnapshotException { throw new RuntimeException("Not implemented"); }
Source:
<code>public GridDialect newInstance(Class<? extends GridDialect> clazz) { try { Constructor<?> injector = null; for ( Constructor<?> constructor : clazz.getConstructors() ) { Class<?>[] parameterTypes = constructor.getParameterTypes(); if ( parameterTypes.length == 1 && DatastoreProvider.class.isAssignableFrom( parameterTypes[0] ) ) { injector = constructor; break; } } if ( injector == null ) { log.gridDialectHasNoProperConstructor( clazz ); } GridDialect gridDialect = (GridDialect) injector.newInstance( datastore ); if ( gridDialect instanceof BatchableGridDialect ) { BatchableGridDialect batchable = (BatchableGridDialect) gridDialect; <START> gridDialect = new BatchOperationsDelegator( batchable ); <END> } log.useGridDialect( gridDialect.getClass().getName() ); if ( GridDialectLogger.activationNeeded() ) { gridDialect = new GridDialectLogger<Serializable>( gridDialect ); log.info( "Grid dialect logs are active" ); } else { log.info( "Grid dialect logs are disabled" ); } return gridDialect; } catch ( Exception e ) { throw log.cannotInstantiateGridDialect( clazz, e ); } }</code><technical_language>add new BatchOperationsDelegator<Serializable>(...</technical_language>

Target:
public GridDialect newInstance(Class<? extends GridDialect> clazz) { try { Constructor<?> injector = null; for ( Constructor<?> constructor : clazz.getConstructors() ) { Class<?>[] parameterTypes = constructor.getParameterTypes(); if ( parameterTypes.length == 1 && DatastoreProvider.class.isAssignableFrom( parameterTypes[0] ) ) { injector = constructor; break; } } if ( injector == null ) { log.gridDialectHasNoProperConstructor( clazz ); } GridDialect gridDialect = (GridDialect) injector.newInstance( datastore ); if ( gridDialect instanceof BatchableGridDialect ) { BatchableGridDialect batchable = (BatchableGridDialect) gridDialect; gridDialect = new BatchOperationsDelegator( batchable ); } log.useGridDialect( gridDialect.getClass().getName() ); if ( GridDialectLogger.activationNeeded() ) { gridDialect = new GridDialectLogger( gridDialect ); log.info( "Grid dialect logs are active" ); } else { log.info( "Grid dialect logs are disabled" ); } return gridDialect; } catch ( Exception e ) { throw log.cannotInstantiateGridDialect( clazz, e ); } }
Source:
<code>public CTFTrace(File path) throws CTFReaderException { this.path = path; this.metadata = new Metadata(this); if (!this.path.exists()) { <START> throw new CTFReaderException("Trace doesn't exists. Deleted or moved?"); END> } if (!this.path.isDirectory()) { throw new CTFReaderException("Path must be a valid directory"); } metadata.parse(); if (packetHeaderDecl != null) { packetHeaderDef = packetHeaderDecl.createDefinition(this, "packet.header"); } File[] files = path.listFiles(metadataFileFilter); Arrays.sort(files, metadataComparator); for (File streamFile : files) { openStreamInput(streamFile); } for (Map.Entry<Long, Stream> stream : streams.entrySet()) { Set<StreamInput> inputs = stream.getValue().getStreamInputs(); for (StreamInput s : inputs) { Iterator<Entry<Long, EventDeclaration>> it = s.getStream() .getEvents().entrySet().iterator(); while (it.hasNext()) { Map.Entry<Long, EventDeclaration> pairs = it.next(); Long eventNum = pairs.getKey(); EventDeclaration eventDec = pairs.getValue(); getEvents(s.getStream().getId()).put(eventNum, eventDec); } s.setupIndex(); } } }</code><technical_language>"exist". useful include path in message</technical_language>

Target:
public CTFTrace(File path) throws CTFReaderException { this.path = path; this.metadata = new Metadata(this); if (!this.path.exists()) { throw new CTFReaderException("Trace (" + path.getPath() + ") doesn't exist. Deleted or moved?"); } if (!this.path.isDirectory()) { throw new CTFReaderException("Path must be a valid directory"); } metadata.parse(); if (packetHeaderDecl != null) { packetHeaderDef = packetHeaderDecl.createDefinition(this, "packet.header"); } File[] files = path.listFiles(metadataFileFilter); Arrays.sort(files, metadataComparator); for (File streamFile : files) { openStreamInput(streamFile); } for (Map.Entry<Long, Stream> stream : streams.entrySet()) { Set<StreamInput> inputs = stream.getValue().getStreamInputs(); for (StreamInput s : inputs) { Iterator<Entry<Long, EventDeclaration>> it = s.getStream() .getEvents().entrySet().iterator(); while (it.hasNext()) { Map.Entry<Long, EventDeclaration> pairs = it.next(); Long eventNum = pairs.getKey(); EventDeclaration eventDec = pairs.getValue(); getEvents(s.getStream().getId()).put(eventNum, eventDec); } s.setupIndex(); } } }
Source:
<code>private JsonObject getJsonFile(String jsonFilePath) throws IOException { final URL urlResource = getUrlResource(jsonFilePath); if (urlResource == null) { return null; } <START> File pluginPackageJson = new File(urlResource.getFile()); <END> String jsonString; if (!pluginPackageJson.exists()) { try (InputStream resourceAsStream = this.getClass().getClassLoader() .getResourceAsStream(jsonFilePath)) { if (resourceAsStream != null) { jsonString = FrontendUtils.streamToString(resourceAsStream); } else { return null; } } } else { jsonString = FileUtils.readFileToString(pluginPackageJson, UTF_8); } return Json.parse(jsonString); }</code><technical_language>Wrong variable name left refactoring this method reused ? jsonFile</technical_language>

Target:
private JsonObject getJsonFile(String jsonFilePath) throws IOException { final URL urlResource = getResourceUrl(jsonFilePath); if (urlResource == null) { return null; } File jsonFile = new File(urlResource.getFile()); String jsonString; if (!jsonFile.exists()) { try (InputStream resourceAsStream = this.getClass().getClassLoader() .getResourceAsStream(jsonFilePath)) { if (resourceAsStream != null) { jsonString = FrontendUtils.streamToString(resourceAsStream); } else { return null; } } } else { jsonString = FileUtils.readFileToString(jsonFile, UTF_8); } return Json.parse(jsonString); }
Source:
<code>public Annotation createAnnotation(CoreSession session, Annotation annotation) { ConfigurationService configurationService = Framework.getService(ConfigurationService.class); boolean annotationPlaceless = configurationService.isBooleanPropertyTrue(ANNOTATIONS_PLACELESS_STORAGE_PROPERTY); return CoreInstance.doPrivileged(session, s -> { String path = null; if (!annotationPlaceless) { DocumentModel annotatedDoc = s.getDocument(new IdRef(annotation.getDocumentId())); String parentPath = s.getRootDocument().getPathAsString(); if (annotatedDoc.getPath().segmentCount() > 1) { parentPath += annotatedDoc.getPath().segment(0); } String folderName = "Annotation_" + annotatedDoc.getId() + "_" + annotatedDoc.getVersionLabel(); PathRef ref = new PathRef(parentPath, folderName); if (!s.exists(ref)) { <START> DocumentModel annotationFolderDoc = s.createDocumentModel(parentPath, folderName, "HiddenFolder"); <END> s.createDocument(annotationFolderDoc); s.save(); } path = ref.toString(); } DocumentModel annotationModel = s.createDocumentModel(path, ANNOTATION_NAME, ANNOTATION_DOC_TYPE); setAnnotationProperties(annotationModel, annotation); annotationModel = s.createDocument(annotationModel); return new AnnotationImpl(annotationModel); }); }</code><technical_language>HiddenFolder a constant</technical_language>

Target:
public Annotation createAnnotation(CoreSession session, Annotation annotation) { ConfigurationService configurationService = Framework.getService(ConfigurationService.class); boolean annotationPlaceless = configurationService.isBooleanPropertyTrue( ANNOTATIONS_PLACELESS_STORAGE_PROPERTY); return CoreInstance.doPrivileged(session, s -> { String path = null; if (!annotationPlaceless) { DocumentModel annotatedDoc = s.getDocument(new IdRef(annotation.getDocumentId())); String parentPath = s.getRootDocument().getPathAsString(); if (annotatedDoc.getPath().segmentCount() > 1) { parentPath += annotatedDoc.getPath().segment(0); } PathRef ref = new PathRef(parentPath, ANNOTATION_FOLDER_NAME); DocumentModel annotationFolderDoc = s.createDocumentModel(parentPath, ANNOTATION_FOLDER_NAME, HIDDEN_FOLDER_TYPE); s.getOrCreateDocument(annotationFolderDoc); s.save(); path = ref.toString(); } DocumentModel annotationModel = s.createDocumentModel(path, ANNOTATION_NAME, ANNOTATION_DOC_TYPE); setAnnotationProperties(annotationModel, annotation); annotationModel = s.createDocument(annotationModel); return new AnnotationImpl(annotationModel); }); }
Source:
<code>public void setUpClass() <START> throws Exception { <END> generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "org.carlspring.strongbox.resolve.only:foo", "1.1" ); generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "org.carlspring.strongbox.partial:partial-foo", "3.1", "3.2" ); generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "org.carlspring.strongbox.copy:copy-foo", "1.1", "1.2" ); generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "com.artifacts.to.delete.releases:delete-foo", "1.2.1", "1.2.2" ); generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "org.carlspring.strongbox.partial:partial-foo", "3.1", "3.2" ); generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "org.carlspring.strongbox.browse:foo-bar", "1.0", "2.4" ); new File(TEST_RESOURCES).mkdirs(); }</code><technical_language>Please, move braces next line</technical_language>

Target:
public static void setUpClass() throws Exception { GENERATOR_BASEDIR = new File(ConfigurationResourceResolver.getVaultDirectory() + "/local"); REPOSITORY_BASEDIR_RELEASES = new File(ConfigurationResourceResolver.getVaultDirectory() + "/storages/storage0/releases"); removeDir(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath() + "/org/carlspring/strongbox/resolve"); removeDir(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath() + "/org/carlspring/strongbox/partial"); removeDir(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath() + "/org/carlspring/strongbox/copy"); removeDir(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath() + "/org/carlspring/strongbox/browse"); removeDir(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath() + "/com/artifacts/to/delete"); generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "org.carlspring.strongbox.resolve.only:foo", "1.1" ); generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "org.carlspring.strongbox.partial:partial-foo", "3.1", "3.2" ); generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "org.carlspring.strongbox.copy:copy-foo", "1.1", "1.2" ); generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "com.artifacts.to.delete.releases:delete-foo", "1.2.1", "1.2.2" ); generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "org.carlspring.strongbox.partial:partial-foo", "3.1", "3.2" ); generateArtifact(REPOSITORY_BASEDIR_RELEASES.getAbsolutePath(), "org.carlspring.strongbox.browse:foo-bar", "1.0", "2.4" ); new File(TEST_RESOURCES).mkdirs(); }
Source:
<code>public void generate(final Ds3ApiSpec spec, final FileUtils fileUtils, final Path destDir, final Ds3DocSpec docSpec) throws IOException { this.fileUtils = fileUtils; this.destDir = destDir; try { final ImmutableList<Ds3Request> ds3Requests = spec.getRequests(); final ImmutableMap<String, Ds3Type> typeMap = removeUnusedTypes( spec.getTypes(), spec.getRequests()); generateCommands(ds3Requests); generateClient(ds3Requests); generateAllTypes(typeMap); } catch (final Exception e) { <START> e.printStackTrace(); <END> } }</code><technical_language>This Log exception logger</technical_language>

Target:
public void generate(final Ds3ApiSpec spec, final FileUtils fileUtils, final Path destDir, final Ds3DocSpec docSpec) throws IOException { this.fileUtils = fileUtils; this.destDir = destDir; try { final ImmutableList<Ds3Request> ds3Requests = spec.getRequests(); final ImmutableMap<String, Ds3Type> typeMap = removeUnusedTypes( spec.getTypes(), spec.getRequests()); generateCommands(ds3Requests); generateClient(ds3Requests); generateAllTypes(typeMap); } catch (final Exception e) { LOG.error("Unable to generate Go SDK code", e); } }
Source:
<code>public void close() { try { if (baseOp != null) baseOp.close(); if (startTime != -1) { String cql = command.toCQLString(); <START> int time = (int) Math.min(TimeUnit.NANOSECONDS.toMicros(System.nanoTime() - startTime), Integer.MAX_VALUE); <END> ColumnFamilyStore cfs = ColumnFamilyStore.getIfExists(baseMetadata.id); if(cfs != null) { cfs.metric.topLocalReadQueryTime.addSample(cql, time); } } } finally { if (indexController != null) { try { indexController.close(); } finally { writeContext.close(); } } } }</code><technical_language>timeMillis millis for brevity</technical_language>

Target:
public void close() { try { if (baseOp != null) baseOp.close(); if (startTimeNanos != -1) { String cql = command.toCQLString(); int timeMicros = (int) Math.min(TimeUnit.NANOSECONDS.toMicros(clock.nanoTime() - startTimeNanos), Integer.MAX_VALUE); ColumnFamilyStore cfs = ColumnFamilyStore.getIfExists(baseMetadata.id); if(cfs != null) cfs.metric.topLocalReadQueryTime.addSample(cql, timeMicros); } } finally { if (indexController != null) { try { indexController.close(); } finally { writeContext.close(); } } } }
Source:
<code>private void assertContainersHaveAccessRules(IJavaProject javaProject) throws JavaModelException { <START> List<IClasspathEntry> containerEntries = Arrays.asList(javaProject.getRawClasspath()).stream() <END> .filter(mavenClasspathEntry()).collect(Collectors.toList()); assertEquals(1, containerEntries.size()); containerEntries.forEach(entry -> { assertNotNull(entry.getAccessRules()); List<IAccessRule> accessRules = Arrays.asList(entry.getAccessRules()); assertEquals(1, accessRules.size()); accessRules.forEach(accessRule -> { assertEquals(IAccessRule.K_DISCOURAGED, accessRule.getKind()); assertEquals("**/internal/**", accessRule.getPattern().toPortableString()); }); }); }</code><technical_language>ok bad, I I checked yet. a more fine grained control dependency</technical_language>

Target:
private void assertContainersHaveAccessRules(IJavaProject javaProject) throws JavaModelException { List<IClasspathEntry> containerEntries = Stream.of(javaProject.getRawClasspath()) .filter(mavenClasspathEntry()).collect(Collectors.toList()); assertEquals(1, containerEntries.size()); containerEntries.forEach(entry -> { assertNotNull(entry.getAccessRules()); List<IAccessRule> accessRules = Arrays.asList(entry.getAccessRules()); assertEquals(1, accessRules.size()); accessRules.forEach(accessRule -> { assertEquals(IAccessRule.K_DISCOURAGED, accessRule.getKind()); assertEquals("**/internal/**", accessRule.getPattern().toPortableString()); }); }); }
Source:
<code>public void setUp() { typeManager = new TypeRegistry(); functionManager = new FunctionManager(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()); <START> optimizer = new ExpressionOptimizer(functionManager, TEST_SESSION); <END> }</code><technical_language>@highker typeManager member variable removed</technical_language>

Target:
public void setUp() { TypeManager typeManager = new TypeRegistry(); functionManager = new FunctionManager(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()); optimizer = new ExpressionOptimizer(functionManager, TEST_SESSION); }
Source:
<code>public void testNewStorageTypes() { <START> assertEquals(9, StorageType.values().length, <END> "A storage type was added/removed. Update this test, and the isFileDomain/isBlockDomain " + "method accordingly"); }</code><technical_language>please change 10</technical_language>

Target:
public void testNewStorageTypes() { assertEquals(10, StorageType.values().length, "A storage type was added/removed. Update this test, and the isFileDomain/isBlockDomain " + "method accordingly"); }
Source:
<code>public void initAccessSettings() { if (dvObject instanceof Dataverse) { authenticatedUsersContributorRoleAlias = ""; List<RoleAssignment> aUsersRoleAssignments = roleService.directRoleAssignments(AuthenticatedUsers.get(), dvObject); for (RoleAssignment roleAssignment : aUsersRoleAssignments) { String roleAlias = roleAssignment.getRole().getAlias(); authenticatedUsersContributorRoleAlias = roleAlias; break; } <START> defaultContributorRoleAlias = ((Dataverse) dvObject).getDefaultContributorRole() == null ? "none" : ((Dataverse) dvObject).getDefaultContributorRole().getAlias(); <END> } }</code><technical_language>this English word "none" moved bundle translated</technical_language>

Target:
public void initAccessSettings() { if (dvObject instanceof Dataverse) { authenticatedUsersContributorRoleAlias = ""; List<RoleAssignment> aUsersRoleAssignments = roleService.directRoleAssignments(AuthenticatedUsers.get(), dvObject); for (RoleAssignment roleAssignment : aUsersRoleAssignments) { String roleAlias = roleAssignment.getRole().getAlias(); authenticatedUsersContributorRoleAlias = roleAlias; break; } defaultContributorRoleAlias = ((Dataverse) dvObject).getDefaultContributorRole() == null ? DataverseRole.NONE : ((Dataverse) dvObject).getDefaultContributorRole().getAlias(); } }
Source:
<code>public MeasureDefinition withObjUriQualifiers(final ObjQualifierConverter objQualifierConverter) { <START> notNull(objQualifierConverter, "'objQualifierConverter' must not be null!"); <END> return new OverPeriodMeasureDefinition(measureIdentifier, copyAttributesWithUriQualifiers(objQualifierConverter)); }</code><technical_language>need write message this validator</technical_language>

Target:
public MeasureDefinition withObjUriQualifiers(final ObjQualifierConverter objQualifierConverter) { notNull(objQualifierConverter, "objQualifierConverter"); return new OverPeriodMeasureDefinition(measureIdentifier, copyAttributesWithUriQualifiers(objQualifierConverter)); }
Source:
<code>public ClientResponse invoke(ClientInvocation invocation) { Future<ClientResponse> future = submit(invocation, true, NOP, null); try { return future.get(client.getIdleTimeout(), TimeUnit.MILLISECONDS); } catch (InterruptedException e) { future.cancel(true); throw clientException(e, null); } catch (ExecutionException | TimeoutException e) { <START> throw clientException(e.getCause(), null); END> } }</code><technical_language>PMD complaining here</technical_language>

Target:
public ClientResponse invoke(ClientInvocation invocation) { Future<ClientResponse> future = submit(invocation, true, NOP, null); try { return future.get(1, TimeUnit.HOURS); } catch (InterruptedException e) { future.cancel(true); Thread.currentThread().interrupt(); throw clientException(e, null); } catch (TimeoutException | ExecutionException e) { future.cancel(true); throw clientException(e.getCause(), null); } }
Source:
<code>public MutableRoaringBitmap getDocIds(String searchQuery) { <START> MutableRoaringBitmap docIds = new MutableRoaringBitmap(); <END> Collector docIDCollector = new LuceneDocIdCollector(docIds, _docIdTranslator); try { QueryParser parser = new QueryParser(_column, _standardAnalyzer); Query query = parser.parse(searchQuery); _indexSearcher.search(query, docIDCollector); return docIds; } catch (Exception e) { String msg = "Caught excepttion while searching the text index for column:" + _column + " search query:" + searchQuery; throw new RuntimeException(msg, e); } }</code><technical_language>This change needed</technical_language>

Target:
public MutableRoaringBitmap getDocIds(String searchQuery) { MutableRoaringBitmap docIds = new MutableRoaringBitmap(); Collector docIDCollector = new LuceneDocIdCollector(docIds, _docIdTranslator); try { QueryParser parser = new QueryParser(_column, _standardAnalyzer); if (_useANDForMultiTermQueries) { parser.setDefaultOperator(QueryParser.Operator.AND); } Query query = parser.parse(searchQuery); _indexSearcher.search(query, docIDCollector); return docIds; } catch (Exception e) { String msg = "Caught excepttion while searching the text index for column:" + _column + " search query:" + searchQuery; throw new RuntimeException(msg, e); } }
Source:
<code>public static void register(CommandRegistrationHandler registration, CommandManager commandManager, CommandManagerService commandManagerService, WorldEdit worldEdit) { CommandManager collect = commandManagerService.newCommandManager(); registration.register( collect, ToolCommandsRegistration.builder(), new ToolCommands(worldEdit) ); Set<org.enginehub.piston.Command> commands = collect.getAllCommands() .collect(Collectors.toSet()); for (org.enginehub.piston.Command command : commands) { if (command.getAliases().contains("unbind")) { command = command.toBuilder().aliases( Collections2.filter(command.getAliases(), alias -> !"unbind".equals(alias)) ).build(); } <START> if (command.getAliases().contains("stacker")) { <END> command = command.toBuilder().aliases( Collections2.filter(command.getAliases(), alias -> !"stacker".equals(alias)) ).build(); } commandManager.register(CommandUtil.deprecate( command, "Global tool names cause conflicts " + "and will be removed in WorldEdit 8", ToolCommands::asNonGlobal )); } Set<org.enginehub.piston.Command> nonGlobalCommands = commands.stream() .map(command -> command.toBuilder().aliases( Collections2.filter(command.getAliases(), alias -> !alias.startsWith("/")) ).build() ) .collect(Collectors.toSet()); commandManager.register("tool", command -> { command.addPart(SubCommandPart.builder( TranslatableComponent.of("tool"), TextComponent.of("The tool to bind") ) .withCommands(nonGlobalCommands) .required() .build()); command.description(TextComponent.of("Binds a tool to the item in your hand")); }); }</code><technical_language>combine this previous code some sort of loop</technical_language>

Target:
public static void register(CommandRegistrationHandler registration, CommandManager commandManager, CommandManagerService commandManagerService, WorldEdit worldEdit) { CommandManager collect = commandManagerService.newCommandManager(); registration.register( collect, ToolCommandsRegistration.builder(), new ToolCommands(worldEdit) ); Set<org.enginehub.piston.Command> commands = collect.getAllCommands() .collect(Collectors.toSet()); for (org.enginehub.piston.Command command : commands) { for (String ignoredAlias : IGNORED_GLOBAL_ALIASES) { if (command.getAliases().contains(ignoredAlias)) { command = command.toBuilder().aliases( Collections2.filter(command.getAliases(), alias -> !ignoredAlias.equals(alias)) ).build(); } } commandManager.register(CommandUtil.deprecate( command, "Global tool names cause conflicts " + "and will be removed in WorldEdit 8", ToolCommands::asNonGlobal )); } Set<org.enginehub.piston.Command> nonGlobalCommands = commands.stream() .map(command -> command.toBuilder().aliases( Collections2.filter(command.getAliases(), alias -> !alias.startsWith("/")) ).build() ) .collect(Collectors.toSet()); commandManager.register("tool", command -> { command.addPart(SubCommandPart.builder( TranslatableComponent.of("tool"), TextComponent.of("The tool to bind") ) .withCommands(nonGlobalCommands) .required() .build()); command.description(TextComponent.of("Binds a tool to the item in your hand")); }); }
Source:
<code>protected boolean interceptorMatches(SequentialInterceptor interceptor, Class<? extends SequentialInterceptor> clazz) { Class<? extends SequentialInterceptor> interceptorType = interceptor.getClass(); <START> return clazz == interceptorType || clazz == interceptorType; <END> }</code><technical_language>duplicated condition</technical_language>

Target:
protected boolean interceptorMatches(SequentialInterceptor interceptor, Class<? extends SequentialInterceptor> clazz) { Class<? extends SequentialInterceptor> interceptorType = interceptor.getClass(); return clazz == interceptorType; }
Source:
<code>protected void onInit() { super.onInit(); if (this.connectionFactory == null) { <START> this.connectionFactory = new TcpNioServerConnectionFactory(super.getPort()); <END> this.connectionFactory.setDeserializer(new ByteArrayLfSerializer()); this.connectionFactory.setBeanFactory(getBeanFactory()); if (this.applicationEventPublisher != null) { this.connectionFactory.setApplicationEventPublisher(this.applicationEventPublisher); } this.connectionFactory.afterPropertiesSet(); } this.connectionFactory.registerListener(this); }</code><technical_language>I need this change. similar structure in UdpSyslogReceivingChannelAdapter override onInit() logic there</technical_language>

Target:
protected void onInit() { super.onInit(); if (this.connectionFactory == null) { this.connectionFactory = new TcpNioServerConnectionFactory(getPort()); this.connectionFactory.setDeserializer(new ByteArrayLfSerializer()); this.connectionFactory.setBeanFactory(getBeanFactory()); if (this.applicationEventPublisher != null) { this.connectionFactory.setApplicationEventPublisher(this.applicationEventPublisher); } this.connectionFactory.afterPropertiesSet(); } this.connectionFactory.registerListener(this); }
Source:
<code>private void releaseSharedSlot(ExecutionSlotSharingGroup executionSlotSharingGroup) { SharedSlot slot = sharedSlots.remove(executionSlotSharingGroup); if (slot != null) { slotProvider.cancelSlotRequest( slot.getPhysicalSlotRequestId(), new FlinkException("Slot is being returned from SlotSharingExecutionSlotAllocator.")); } else { <START> LOG.debug("There is no slot for ExecutionSlotSharingGroup to release", executionSlotSharingGroup); <END> } }</code><technical_language>conditions this branch happen? a SharedSlot this method is called? Making this stricter allow catch other programming errors faster</technical_language>

Target:
private void releaseSharedSlot(ExecutionSlotSharingGroup executionSlotSharingGroup) { SharedSlot slot = sharedSlots.remove(executionSlotSharingGroup); Preconditions.checkNotNull(slot); Preconditions.checkState( slot.isEmpty(), "Trying to remove a shared slot with physical request id %s which has assigned logical slots", slot.getPhysicalSlotRequestId()); slotProvider.cancelSlotRequest( slot.getPhysicalSlotRequestId(), new FlinkException("Slot is being returned from SlotSharingExecutionSlotAllocator.")); }
Source:
<code>public boolean equals(Object o) { <START> if (this == o) { return true; } <END> if (o == null || getClass() != o.getClass()) { return false; } AggregateReadRequest<?> that = (AggregateReadRequest<?>) o; return snapshotTrigger == that.snapshotTrigger && id.equals(that.id); }</code><technical_language>This method tested</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AggregateReadRequest<?> that = (AggregateReadRequest<?>) o; return recordId.equals(that.recordId); }
Source:
<code>public String getCompleted(UUID uuid, String[] args) { String regex = String.join("_", Arrays.copyOfRange(args, 2, args.length)); String category = args[0]; <START> long[] count = { 0 }; <END> achievementCache.getByCategory(category).stream().filter(i -> i.getName().matches(regex)).forEach(achievement -> { count[0] += cacheManager.getReceivedAchievementsCache().getOrDefault(uuid, new HashSet<>()).stream() .filter(i -> { return i.equalsIgnoreCase(achievement.getName()); }).count(); }); return "" + count[0]; }</code><technical_language>avoid this array workaround, introduce a flatMap in stream. lines: long count = achievementCache.getByCategory(category).stream() .filter(i -> i.getName().matches(regex)) .flatMap(achievement -> cacheManager.getReceivedAchievementsCache().getOrDefault(uuid, new HashSet<>()) .stream() .filter(i -> i.equalsIgnoreCase(achievement.getName()))) .count(); return "" + count;</technical_language>

Target:
private String getCompleted(UUID uuid, String[] args) { String regex = String.join("_", Arrays.copyOfRange(args, 1, args.length)); String category = args[0]; return "" + achievementCache.getByCategory(category).stream() .filter(achievement -> achievement.getName().matches(regex) && cacheManager.getReceivedAchievementsCache().getOrDefault(uuid, new HashSet<>()) .contains(achievement.getName())) .count(); }
Source:
<code>public ServiceModel generateService(ApiService service, ApiServiceConfig serviceConfig, ApiRole role, ApiConfigList roleConfig) { String hostname = role.getHostRef().getHostname(); String sslEnabledRaw = getRoleConfigValue(roleConfig, SSL_ENABLED); String scheme = "http"; if (sslEnabledRaw != null) { <START> if (Boolean.parseBoolean(getRoleConfigValue(roleConfig, SSL_ENABLED))) { <END> scheme = "https"; } } String port = getRoleConfigValue(roleConfig, QUERY_SERVER_PORT); ServiceModel model = createServiceModel(String.format(Locale.getDefault(), "%s://%s:%s", scheme, hostname, port)); model.addRoleProperty(getRoleType(), QUERY_SERVER_PORT, port); if (sslEnabledRaw != null) { model.addRoleProperty(getRoleType(), SSL_ENABLED, sslEnabledRaw); } return model; }</code><technical_language>If sslEnabledRaw - need null check sslEnabledRaw parseBoolean</technical_language>

Target:
public ServiceModel generateService(ApiService service, ApiServiceConfig serviceConfig, ApiRole role, ApiConfigList roleConfig) { String hostname = role.getHostRef().getHostname(); String sslEnabledRaw = getRoleConfigValue(roleConfig, SSL_ENABLED); String scheme = "http"; if (Boolean.parseBoolean(sslEnabledRaw)) { scheme = "https"; } String port = getRoleConfigValue(roleConfig, QUERY_SERVER_PORT); ServiceModel model = createServiceModel(String.format(Locale.getDefault(), "%s://%s:%s", scheme, hostname, port)); model.addRoleProperty(getRoleType(), QUERY_SERVER_PORT, port); if (sslEnabledRaw != null) { model.addRoleProperty(getRoleType(), SSL_ENABLED, sslEnabledRaw); } return model; }
Source:
<code>private void setWikidataEditCount() { String userName = sessionManager.getUserName(); if (StringUtils.isBlank(userName)) { return; } <START> wikidataEditsText.setText(String.valueOf(0)); <END> compositeDisposable.add(okHttpJsonApiClient .getWikidataEdits(userName) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(edits -> { numberOfEdits = edits; wikidataEditsText.setText(String.valueOf(edits)); }, e -> { Timber.e("Error:" + e); })); }</code><technical_language>Is a reason String.valueOf(0) instead of "0"</technical_language>

Target:
private void setWikidataEditCount() { String userName = sessionManager.getUserName(); if (StringUtils.isBlank(userName)) { return; } compositeDisposable.add(okHttpJsonApiClient .getWikidataEdits(userName) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(edits -> { numberOfEdits = edits; wikidataEditsText.setText(String.valueOf(edits)); }, e -> { Timber.e("Error: " + e); })); }
Source:
<code>public void addOutputData(long checkpointId, ResultSubpartitionInfo info, int startSeqNum, Buffer... data) { <START> LOG.debug("{} add output data, checkpoint id: {}, channel: {}, startSeqNum: {}, num buffers: {}", <END> taskName, checkpointId, info, startSeqNum, data == null ? 0 : data.length); enqueue(write(checkpointId, info, checkBufferType(data)), false); }</code><technical_language>a separate line</technical_language>

Target:
public void addOutputData(long checkpointId, ResultSubpartitionInfo info, int startSeqNum, Buffer... data) { LOG.debug( "{} adding output data, checkpoint id: {}, channel: {}, startSeqNum: {}, num buffers: {}", taskName, checkpointId, info, startSeqNum, data == null ? 0 : data.length); enqueue(write(checkpointId, info, checkBufferType(data)), false); }
Source:
<code><START> public int compare(Task a, Task b) { <END> return new CompareToBuilder() .append(b.getPriority(), a.getPriority()) .append(a.getId(), b.getId()) .toComparison(); }</code><technical_language>other change done weeks in optaplanner-examples codebase convert Comparators CompareToBuilder static Comparator.comparing(...). performs better, important in context of a server app, require a dependency external library</technical_language>

Target:
public int compare(Task a, Task b) { return COMPARATOR.compare(a, b); }
Source:
<code>public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View root = inflater.inflate(R.layout.all_episodes_fragment, container, false); txtvInformation = root.findViewById(R.id.txtvInformation); recyclerView = root.findViewById(android.R.id.list); recyclerView.setVisibility(View.GONE); recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool()); setupLoadMoreScrollListener(); RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator(); if (animator instanceof SimpleItemAnimator) { ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false); } SwipeRefreshLayout swipeRefreshLayout = root.findViewById(R.id.swipeRefresh); swipeRefreshLayout.setOnRefreshListener(() -> { AutoUpdateManager.runImmediate(requireContext()); new Handler().postDelayed(() -> <START> getActivity().runOnUiThread(() -> swipeRefreshLayout.setRefreshing(false)) <END> , 1000); }); progLoading = root.findViewById(R.id.progLoading); progLoading.setVisibility(View.VISIBLE); loadingMoreView = root.findViewById(R.id.loadingMore); emptyView = new EmptyViewHandler(getContext()); emptyView.attachToRecyclerView(recyclerView); emptyView.setIcon(R.attr.feed); emptyView.setTitle(R.string.no_all_episodes_head_label); emptyView.setMessage(R.string.no_all_episodes_label); createRecycleAdapter(recyclerView, emptyView); emptyView.hide(); return root; }</code><technical_language>I need getActivity().runOnUiThread. Handlers created UI thread run runnable UI thread, too</technical_language>

Target:
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View root = inflater.inflate(R.layout.all_episodes_fragment, container, false); txtvInformation = root.findViewById(R.id.txtvInformation); recyclerView = root.findViewById(android.R.id.list); recyclerView.setVisibility(View.GONE); recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool()); setupLoadMoreScrollListener(); RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator(); if (animator instanceof SimpleItemAnimator) { ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false); } SwipeRefreshLayout swipeRefreshLayout = root.findViewById(R.id.swipeRefresh); swipeRefreshLayout.setOnRefreshListener(() -> { AutoUpdateManager.runImmediate(requireContext()); new Handler().postDelayed(() -> swipeRefreshLayout.setRefreshing(false), getResources().getInteger(R.integer.swipe_to_refresh_duration_in_ms)); }); progLoading = root.findViewById(R.id.progLoading); progLoading.setVisibility(View.VISIBLE); loadingMoreView = root.findViewById(R.id.loadingMore); emptyView = new EmptyViewHandler(getContext()); emptyView.attachToRecyclerView(recyclerView); emptyView.setIcon(R.attr.feed); emptyView.setTitle(R.string.no_all_episodes_head_label); emptyView.setMessage(R.string.no_all_episodes_label); createRecycleAdapter(recyclerView, emptyView); emptyView.hide(); return root; }
Source:
<code>public void throw_IllegalArgumentException_if_trying_to_update_builtin_rule_description() throws Exception { logInAsQProfileAdministrator(); RuleDefinitionDto templateRule = db.rules().insert( r -> r.setRuleKey(RuleKey.of("java", "S001")), <START> r -> r.setIsTemplate(true), <END> r -> r.setCreatedAt(PAST), r -> r.setDescription("Old description"), r -> r.setUpdatedAt(PAST)); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Not a custom rule"); ws.newRequest().setMethod("POST") .setParam("key", templateRule.getKey().toString()) .setParam("name", "My custom rule") .setParam("markdown_description", "New description") .execute(); }</code><technical_language>A template rule is necessarily a built-in rule. Please simply creation of rule db.rules().insert(), need override</technical_language>

Target:
public void throw_IllegalArgumentException_if_trying_to_update_builtin_rule_description() throws Exception { logInAsQProfileAdministrator(); RuleDefinitionDto rule = db.rules().insert(); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Not a custom rule"); ws.newRequest().setMethod("POST") .setParam("key", rule.getKey().toString()) .setParam("name", rule.getName()) .setParam("markdown_description", "New description") .execute(); }
Source:
<code>protected void readTimedOut(ChannelHandlerContext ctx) throws Exception { if (!closed) { <START> ctx.fireExceptionCaught(new ReadTimeoutException()); <END> ctx.close(); closed = true; } }</code><technical_language>this left as-is? fine it, follow pattern of rest of PR</technical_language>

Target:
protected void readTimedOut(ChannelHandlerContext ctx) throws Exception { if (!closed) { ctx.fireExceptionCaught(ReadTimeoutException.INSTANCE); ctx.close(); closed = true; } }
Source:
<code>public Sequence<T> run(final Query<T> query, final Map<String, Object> responseContext) { final ServiceMetricEvent.Builder builder = builderFn.apply(query); for (Map.Entry<String, String> userDimension : userDimensions.entrySet()) { builder.setDimension(userDimension.getKey(), userDimension.getValue()); } return Sequences.wrap( new LazySequence<>(new Supplier<Sequence<T>>() { @Override public Sequence<T> get() { return queryRunner.run(query, responseContext); } }), new SequenceWrapper() { private long startTime; @Override public void before() { startTime = System.currentTimeMillis(); } @Override public void after(boolean isDone, Throwable thrown) { try { long timeTaken = System.currentTimeMillis() - startTime; emitter.emit(builder.build(metricName, timeTaken)); if (creationTime > 0) { emitter.emit(builder.build("query/wait/time", startTime - creationTime)); } } finally { if (thrown != null) { builder.setDimension(DruidMetrics.STATUS, "failed"); } else if (!isDone) { <START> builder.setDimension(DruidMetrics.STATUS, "short"); <END> } } } } ); }</code><technical_language>sketchy call builder.setDimension here, emitter.emit(builder.build(...)) called. This in editing a hashmap handed emitter</technical_language>

Target:
public Sequence<T> run(final Query<T> query, final Map<String, Object> responseContext) { final ServiceMetricEvent.Builder builder = builderFn.apply(query); for (Map.Entry<String, String> userDimension : userDimensions.entrySet()) { builder.setDimension(userDimension.getKey(), userDimension.getValue()); } return Sequences.wrap( new LazySequence<>(new Supplier<Sequence<T>>() { @Override public Sequence<T> get() { return queryRunner.run(query, responseContext); } }), new SequenceWrapper() { private long startTime; @Override public void before() { startTime = System.currentTimeMillis(); } @Override public void after(boolean isDone, Throwable thrown) { if (thrown != null) { builder.setDimension(DruidMetrics.STATUS, "failed"); } else if (!isDone) { builder.setDimension(DruidMetrics.STATUS, "short"); } long timeTaken = System.currentTimeMillis() - startTime; emitter.emit(builder.build(metricName, timeTaken)); if (creationTime > 0) { emitter.emit(builder.build("query/wait/time", startTime - creationTime)); } } } ); }
Source:
<code>public JobModel getJobModel() { LOG.info("Reading the job model from blob."); JobModelBundle jmBundle = getJobModelBundle(); if (jmBundle == null) { LOG.error("Job Model details don't exist on the blob."); return null; } JobModel jm = jmBundle.getCurrJobModel(); <START> if (jm == null) { <END> LOG.error("Job Model doesn't exist on the blob."); } return jm; }</code><technical_language>curious: is this case possible, jobModelBundle is available, current JobModel</technical_language>

Target:
public JobModel getJobModel() { LOG.info("Reading the job model from blob."); JobModelBundle jmBundle = getJobModelBundle(); if (jmBundle == null) { LOG.error("Job Model details don't exist on the blob."); return null; } JobModel jm = jmBundle.getCurrJobModel(); return jm; }
Source:
<code>public CompareToBuilder append(final boolean lhs, final boolean rhs) { if (comparison != 0) { return this; } if (lhs == rhs) { return this; } if (lhs) { <START> comparison = +1; <END> } else { comparison = -1; } return this; }</code><technical_language>do need + here</technical_language>

Target:
public CompareToBuilder append(final boolean lhs, final boolean rhs) { if (comparison != 0) { return this; } if (lhs == rhs) { return this; } if (lhs) { comparison = 1; } else { comparison = -1; } return this; }
Source:
<code>private void reset(Reader reader) throws IOException { length = 0; lineOffsets = null; List<Integer> newOffsets = new ArrayList<>(); newOffsets.add(0); int c; while ((c = reader.read()) != -1) { ++length; redo_c: <START> while (true) { <END> switch (c) { case '\r': c = reader.read(); if (c == -1) { newOffsets.add(length); break redo_c; } ++length; if (c == '\n') { newOffsets.add(length); break redo_c; } newOffsets.add(length - 1); continue redo_c; case '\n': newOffsets.add(length); break redo_c; default: } break; } } count = newOffsets.size(); if (newOffsets.get(newOffsets.size() - 1) < length) { newOffsets.add(length); } lineOffsets = new int[newOffsets.size()]; for (int i = 0; i < lineOffsets.length; ++i) { lineOffsets[i] = newOffsets.get(i); } }</code><technical_language>seriously? do want for endless cycles goto? Basic? :-D (yes, easy for complain, this raises eyebrows, a way) (the mind a jflex lexer, if problem line # too)</technical_language>

Target:
private void reset(Reader reader) throws IOException { length = 0; lineOffsets = null; List<Integer> newOffsets = new ArrayList<>(); LineBreakerScanner scanner = new LineBreakerScanner(reader); scanner.setTarget(newOffsets); scanner.consume(); length = scanner.getLength(); count = newOffsets.size() - 1; lineOffsets = new int[newOffsets.size()]; for (int i = 0; i < lineOffsets.length; ++i) { lineOffsets[i] = newOffsets.get(i); } }