auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shouldThrowStreamsExceptionAtEndIfExceptionDuringSuspend() { expect(active.revokeTasks(revokedTasks, revokedChangelogs)).andReturn(new RuntimeException("")); expect(restoreConsumer.assignment()).andReturn(Collections.emptySet()); <START> <END> replay(); try { taskManager.suspendActiveTasksAndState(revokedPartitions); fail("Should have thrown streams exception"); } catch (final StreamsException e) { } verify(restoreConsumer, active, standby); }</code><technical_language>This is related logic delay removal of changelog topic -- do though</technical_language>

Target:
public void shouldThrowStreamsExceptionAtEndIfExceptionDuringSuspend() { expect(active.suspendOrCloseTasks(revokedTasks, revokedChangelogs)).andReturn(new RuntimeException("")); replay(); try { taskManager.suspendActiveTasksAndState(revokedPartitions); fail("Should have thrown streams exception"); } catch (final StreamsException e) { } verify(restoreConsumer, active, standby); }
Source:
<code>private String formatEntityId(EntityId eid) { final String formattedHBaseRowKey = String.format("hbase=hex:%s", ByteArrayFormatter.toHex(eid.getHBaseRowKey())); <START> if (eid instanceof FormattedEntityId) { <END> final FormattedEntityId feid = (FormattedEntityId) eid; final List<String> components = Lists.newArrayList(); for (Object component: feid.getComponents()) { if (component instanceof Number) { components.add(component.toString()); } else { if (component == null) { components.add("null"); } else { components.add(String.format("'%s'", component)); } } } return String.format("\"[%s]\"", Joiner.on(",").join(components)); } else if (eid instanceof HashedEntityId) { final HashedEntityId hashed = (HashedEntityId) eid; final byte[] kijiRowKey = hashed.getKijiRowKey(); if (kijiRowKey != null) { return String.format("'%s'", Bytes.toString(kijiRowKey)); } } else if (eid instanceof HBaseEntityId) { return formattedHBaseRowKey; } else if (eid instanceof HashPrefixedEntityId) { return String.format("'%s'", Bytes.toString(((HashPrefixedEntityId) eid).getKijiRowKey())); } return formattedHBaseRowKey; }</code><technical_language>hex representation for HashedEntityIds (see instanceof below). In general case, HBase row keys interpreted strings. If add a configurable row formatter kiji ls, user decide more easily wants</technical_language>

Target:
private String formatEntityId(EntityId eid) { final String formattedHBaseRowKey = String.format("hbase='%s'", Bytes.toStringBinary(eid.getHBaseRowKey())); if (eid instanceof FormattedEntityId) { final FormattedEntityId feid = (FormattedEntityId) eid; final List<String> components = Lists.newArrayList(); for (Object component: feid.getComponents()) { if (component instanceof Number) { components.add(component.toString()); } else { if (component == null) { components.add("null"); } else { components.add(String.format("'%s'", component)); } } } return String.format("\"[%s]\"", Joiner.on(",").join(components)); } else if (eid instanceof HashedEntityId) { final HashedEntityId hashed = (HashedEntityId) eid; final byte[] kijiRowKey = hashed.getKijiRowKey(); if (kijiRowKey != null) { return String.format("'%s'", Bytes.toString(kijiRowKey)); } return String.format("hbase=hex:%s", ByteArrayFormatter.toHex(eid.getHBaseRowKey())); } else if (eid instanceof HBaseEntityId) { return formattedHBaseRowKey; } else if (eid instanceof HashPrefixedEntityId) { return String.format("'%s'", Bytes.toString(((HashPrefixedEntityId) eid).getKijiRowKey())); } return formattedHBaseRowKey; }
Source:
<code>public File resolve(File dir, String name) { final File abspn = createFile(name); <START> if (abspn.isAbsolute()) <END> return abspn; return createFile(dir, name); }</code><technical_language>missing braces</technical_language>

Target:
public File resolve(File dir, String name) { final File abspn = createFile(name); if (abspn.isAbsolute()) { return abspn; } return createFile(dir, name); }
Source:
<code>static JsonAdapter<?> generatedAdapter(Moshi moshi, Type type, Class<?> rawType) { String adapterClassName = rawType.getName().replace("$", "_") + "JsonAdapter"; try { @SuppressWarnings("unchecked") Class<? extends JsonAdapter<?>> adapterClass = (Class<? extends JsonAdapter<?>>) Class.forName(adapterClassName, true, rawType.getClassLoader()); if (type instanceof ParameterizedType) { return adapterClass.getDeclaredConstructor(Moshi.class, Type[].class) .newInstance(moshi, ((ParameterizedType) type).getActualTypeArguments()); } else { return adapterClass.getDeclaredConstructor(Moshi.class).newInstance(moshi); } } catch (ClassNotFoundException | NoSuchMethodException e) { throw new RuntimeException( "Failed to find the generated the JsonAdapter for " + rawType, e); <START> } catch (IllegalAccessException | InvocationTargetException | InstantiationException e) { <END> throw new RuntimeException( "Failed to create the generated JsonAdapter for " + rawType, e); } }</code><technical_language>this widen ReflectiveOperationException is API 19+ / Java 7+</technical_language>

Target:
static JsonAdapter<?> generatedAdapter(Moshi moshi, Type type, Class<?> rawType) { String adapterClassName = rawType.getName().replace("$", "_") + "JsonAdapter"; try { @SuppressWarnings("unchecked") Class<? extends JsonAdapter<?>> adapterClass = (Class<? extends JsonAdapter<?>>) Class.forName(adapterClassName, true, rawType.getClassLoader()); if (type instanceof ParameterizedType) { Constructor<? extends JsonAdapter<?>> constructor = adapterClass.getDeclaredConstructor(Moshi.class, Type[].class); constructor.setAccessible(true); return constructor.newInstance(moshi, ((ParameterizedType) type).getActualTypeArguments()); } else { Constructor<? extends JsonAdapter<?>> constructor = adapterClass.getDeclaredConstructor(Moshi.class); constructor.setAccessible(true); return constructor.newInstance(moshi); } } catch (ClassNotFoundException e) { throw new RuntimeException( "Failed to find the generated JsonAdapter class for " + rawType, e); } catch (NoSuchMethodException e) { throw new RuntimeException( "Failed to find the generated JsonAdapter constructor for " + rawType, e); } catch (IllegalAccessException e) { throw new RuntimeException( "Failed to access the generated JsonAdapter for " + rawType, e); } catch (InvocationTargetException e) { throw new RuntimeException( "Failed to construct the generated JsonAdapter for " + rawType, e); } catch (InstantiationException e) { throw new RuntimeException( "Failed to instantiate the generated JsonAdapter for " + rawType, e); } }
Source:
<code>public String getMd5(String str) { <START> if (str.length() == 32) { <END> return str; } MessageDigest md = null; try { md = MessageDigest.getInstance("MD5"); } catch (Exception e) { e.printStackTrace(); } md.update(str.getBytes()); byte b[] = md.digest(); str = byte2hex(b); return str; }</code><technical_language>Magic Number</technical_language>

Target:
public static String getMd5(String str) { if (isMD5(str)) { return str; } MessageDigest md = null; try { md = MessageDigest.getInstance("MD5"); } catch (Exception e) { e.printStackTrace(); } md.update(str.getBytes()); byte b[] = md.digest(); str = byte2hex(b); return str; }
Source:
<code>public boolean analyzeJar(Analyzer analyzer) throws Exception { Parameters header = OSGiHeader.parseHeader(analyzer.getProperty(Constants.EXPORT_APIGUARDIAN, "*")); if (header.isEmpty()) return false; Parameters exportPachages = analyzer.getExportPackage(); Instructions instructions = new Instructions(header); Parameters apiGuardianPackages = new Parameters(); for (Clazz c : analyzer.getClassspace() .values()) { if (c.isModule() || c.isInnerClass() || c.isSynthetic()) { continue; } for (Entry<Instruction, Attrs> entry : instructions.entrySet()) { Instruction instruction = entry.getKey(); if (instruction.matches(c.getFQN())) { if (instruction.isNegated()) { break; } if (c.annotations(API_ANNOTATION) .map(ann -> (String) ann.get(STATUS_PROPERTY)) .anyMatch(status -> !INTERNAL_STATUS.equals(status))) { <START> <END> apiGuardianPackages.add(c.getClassName() .getPackageRef() .getFQN(), entry.getValue()); } } } } exportPachages.putAll(apiGuardianPackages); analyzer.setExportPackage(exportPachages.toString()); return false; }</code><technical_language>noneMatch(INTERNAL_STATUS::equals) more concise</technical_language>

Target:
public boolean analyzeJar(Analyzer analyzer) throws Exception { Parameters header = OSGiHeader.parseHeader(analyzer.getProperty(Constants.EXPORT_APIGUARDIAN)); if (header.isEmpty()) return false; Parameters exportPackages = analyzer.getExportContents(); Instructions instructions = new Instructions(header); Parameters apiGuardianPackages = new Parameters(false); for (Clazz c : analyzer.getClassspace() .values()) { if (c.isModule() || c.isInnerClass() || c.isSynthetic()) { continue; } for (Entry<Instruction, Attrs> entry : instructions.entrySet()) { Instruction instruction = entry.getKey(); if (instruction.matches(c.getFQN())) { if (instruction.isNegated()) { break; } c.annotations(API_ANNOTATION) .map(ann -> Status.valueOf(ann.get(STATUS_PROPERTY))) .max(Status::compareTo) .ifPresent(status -> { Attrs attrs = apiGuardianPackages.computeIfAbsent(c.getClassName() .getPackageRef() .getFQN(), k -> new Attrs(entry.getValue())); attrs.compute(STATUS_PROPERTY, (k, v) -> (v == null) ? status.name() : (Status.valueOf(v) .compareTo(status) > 0 ? v : status.name())); }); } } } apiGuardianPackages.values() .stream() .filter(attrs -> API.Status.valueOf(attrs.get(STATUS_PROPERTY)) == Status.INTERNAL) .forEach(attrs -> { attrs.put(Constants.MANDATORY_DIRECTIVE, STATUS_PROPERTY); attrs.put(Constants.NO_IMPORT_DIRECTIVE, "true"); }); exportPackages.mergeWith(apiGuardianPackages, false); analyzer.setExportContents(exportPackages.toString()); return false; }
Source:
<code>protected Model readModel(String path) { Model model = null; if (path != null) { model = ModelFactory.createDefaultModel(); InputStream inputStream = getClass().getClassLoader().getResourceAsStream(path); model.read(inputStream, "", "TURTLE"); ResIterator subjects = model.listSubjects(); while (subjects.hasNext()) { Resource subject = subjects.next(); if (subject.isURIResource()) { <START> ResourceUtils.renameResource(subject, ""); <END> break; } } try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } return model; }</code><technical_language>this drawback statement's subject node is overwritten? user careful construct this model knowing this. Is a way</technical_language>

Target:
protected Model readModel(String path) { Model model = null; if (path != null) { model = ModelFactory.createDefaultModel(); InputStream inputStream = getClass().getClassLoader().getResourceAsStream(path); model.read(inputStream, "<LINK_0>", "TURTLE"); Resource subject = model.getResource("<LINK_0>"); if (subject != null) { ResourceUtils.renameResource(subject, ""); } try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } return model; }
Source:
<code>public final void onTick(MessageCollector collector, TaskCoordinator coordinator) { onTimer(collector, coordinator); <START> propagateTimer(collector, coordinator); <END> }</code><technical_language>Minor: inline, called else</technical_language>

Target:
public final void onTick(MessageCollector collector, TaskCoordinator coordinator) { onTimer(collector, coordinator); nextOperators.forEach(sub -> sub.onTick(collector, coordinator)); }
Source:
<code>public ScanRuntimeProvider getScanRuntimeProvider(ScanTableSource.Context runtimeProviderContext) { final DataType rowDataType = schema.toPhysicalRowDataType(); final RowTypeInfo rowTypeInfo = (RowTypeInfo) fromDataTypeToLegacyInfo(rowDataType); final JdbcDynamicInputFormat.Builder builder = JdbcDynamicInputFormat.builder() .setDrivername(options.getDriverName()) .setDBUrl(options.getDbURL()) .setUsername(options.getUsername().orElse(null)) .setPassword(options.getPassword().orElse(null)) <START> .setRowTypeInfo(new RowTypeInfo(rowTypeInfo.getFieldTypes(), rowTypeInfo.getFieldNames())); <END> if (readOptions.getFetchSize() != 0) { builder.setFetchSize(readOptions.getFetchSize()); } final JdbcDialect dialect = options.getDialect(); String query = dialect.getSelectFromStatement( options.getTableName(), rowTypeInfo.getFieldNames(), new String[0]); if (readOptions.getPartitionColumnName().isPresent()) { long lowerBound = readOptions.getPartitionLowerBound().get(); long upperBound = readOptions.getPartitionUpperBound().get(); int numPartitions = readOptions.getNumPartitions().get(); builder.setParametersProvider( new JdbcNumericBetweenParametersProvider(lowerBound, upperBound).ofBatchNum(numPartitions)); query += " WHERE " + dialect.quoteIdentifier(readOptions.getPartitionColumnName().get()) + " BETWEEN ? AND ?"; } builder.setQuery(query); final RowType rowType = RowType.of( Arrays.stream(schema.getFieldDataTypes()) .map(DataType::getLogicalType) .toArray(LogicalType[]::new), schema.getFieldNames()); builder.setRowConverter(dialect.getInputConverter(rowType)); return InputFormatProvider.of(builder.build()); }</code><technical_language>This is used</technical_language>

Target:
public ScanRuntimeProvider getScanRuntimeProvider(ScanTableSource.Context runtimeProviderContext) { final JdbcRowDataInputFormat.Builder builder = JdbcRowDataInputFormat.builder() .setDrivername(options.getDriverName()) .setDBUrl(options.getDbURL()) .setUsername(options.getUsername().orElse(null)) .setPassword(options.getPassword().orElse(null)); if (readOptions.getFetchSize() != 0) { builder.setFetchSize(readOptions.getFetchSize()); } final JdbcDialect dialect = options.getDialect(); String query = dialect.getSelectFromStatement( options.getTableName(), schema.getFieldNames(), new String[0]); if (readOptions.getPartitionColumnName().isPresent()) { long lowerBound = readOptions.getPartitionLowerBound().get(); long upperBound = readOptions.getPartitionUpperBound().get(); int numPartitions = readOptions.getNumPartitions().get(); builder.setParametersProvider( new JdbcNumericBetweenParametersProvider(lowerBound, upperBound).ofBatchNum(numPartitions)); query += " WHERE " + dialect.quoteIdentifier(readOptions.getPartitionColumnName().get()) + " BETWEEN ? AND ?"; } builder.setQuery(query); final RowType rowType = (RowType) schema.toRowDataType().getLogicalType(); builder.setRowConverter(dialect.getRowConverter(rowType)); builder.setRowDataTypeInfo((TypeInformation<RowData>) runtimeProviderContext .createTypeInformation(schema.toRowDataType())); return InputFormatProvider.of(builder.build()); }
Source:
<code>private <R> R performWithConnection(Function<Object, R> function) { ConnectionSupplier connectionSupplier = getConnectionSupplier(); Object connection = getConnection(connectionSupplier); try { R result = function.apply(connection); connectionSupplier.close(); return result; } catch (Exception e) { if (isFirstPage) { closeDelegate(connection); } extractConnectionException(e).ifPresent(ex -> connectionSupplier.invalidateConnection()); <START> connectionSupplier.invalidateConnection(); <END> throw new MuleRuntimeException(createStaticMessage(COULD_NOT_EXECUTE), e); } }</code><technical_language>Remove this</technical_language>

Target:
private <R> R performWithConnection(Function<Object, R> function) { ConnectionSupplier connectionSupplier = getConnectionSupplier(); Object connection = getConnection(connectionSupplier); try { R result = function.apply(connection); connectionSupplier.close(); return result; } catch (Exception e) { if (isFirstPage) { closeDelegate(connection); } extractConnectionException(e).ifPresent(ex -> connectionSupplier.invalidateConnection()); throw new MuleRuntimeException(createStaticMessage(COULD_NOT_EXECUTE), e); } }
Source:
<code>protected Void call() throws Exception { Objects.requireNonNull(version, "Version hasn't been set."); updateTitle(i18n.get("game.mapGeneration.generateMap.title", version, String.valueOf(seed))); Path workingDirectory = mapGeneratorService.getCustomMapsDirectory(); ProcessBuilder processBuilder = new ProcessBuilder(); processBuilder.inheritIO(); processBuilder.directory(workingDirectory.toFile()); processBuilder.command("java", "-jar", generatorExecutableFile.getAbsolutePath(), ".", String.valueOf(seed), version, mapFilename); logger.info("Starting map generator in directory: with command: {}", processBuilder.directory(), processBuilder.command().stream().reduce((l, r) -> l + " " + r).get()); try { Process process = processBuilder.start(); process.waitFor(MapGeneratorService.getGENERATION_TIMEOUT_SECONDS(), TimeUnit.SECONDS); if (process.isAlive()) { logger.warn("Map generation timed out, killing process..."); process.destroyForcibly(); notificationService.addNotification(new ImmediateNotification(i18n.get("game.mapGeneration.failed.title"), i18n.get("game.mapGeneration.failed.message"), Severity.ERROR)); } else { <START> eventBus.post(new MapGeneratedEvent(mapFilename)); <END> } } catch (IOException | InterruptedException e) { logger.error("Could not start map generator.", e); throw new RuntimeException(); } return null; }</code><technical_language>applicationEventPublisher Bean</technical_language>

Target:
protected Void call() throws Exception { Objects.requireNonNull(version, "Version hasn't been set."); updateTitle(i18n.get("game.mapGeneration.generateMap.title", version, String.valueOf(seed))); Path workingDirectory = mapGeneratorService.getCustomMapsDirectory(); ProcessBuilder processBuilder = new ProcessBuilder(); processBuilder.inheritIO(); processBuilder.directory(workingDirectory.toFile()); processBuilder.command("java", "-jar", generatorExecutableFile.getAbsolutePath(), ".", String.valueOf(seed), version, mapFilename); logger.info("Starting map generator in directory: with command: {}", processBuilder.directory(), processBuilder.command().stream().reduce((l, r) -> l + " " + r).get()); try { Process process = processBuilder.start(); process.waitFor(MapGeneratorService.getGENERATION_TIMEOUT_SECONDS(), TimeUnit.SECONDS); if (process.isAlive()) { logger.warn("Map generation timed out, killing process..."); process.destroyForcibly(); notificationService.addNotification(new ImmediateNotification(i18n.get("game.mapGeneration.failed.title"), i18n.get("game.mapGeneration.failed.message"), Severity.ERROR)); } else { eventBus.post(new MapGeneratedEvent(mapFilename)); } } catch (IOException | InterruptedException e) { logger.error("Could not start map generator.", e); throw new RuntimeException(e); } return null; }
Source:
<code>Trigger dateTrigger() { Date date; DateFormat dateFormat = new SimpleDateFormat(config.getDateFormat()); String dateString = config.getDate() != null ? config.getDate() : new Date().toString(); try { <START> date = dateFormat.parse(dateString); <END> } catch (ParseException pe) { throw new BeanCreationException("Exception parsing the Date format: " + config.getDateFormat(), pe); } return new DateTrigger(date); }</code><technical_language>for talked avoid this date -> toString -> parse -> date logic. SimpleDateFormat a part of TriggerProperties some validation for the: @exception IllegalArgumentException if pattern is invalid SimpleDateFormat ctor. otherwise. I want understand SCS convensions anyway</technical_language>

Target:
public Trigger dateTrigger() { return new DateTrigger(config.getDate()); }
Source:
<code>private FeedbackSessionResultsBundle getBundleForQuestionView( String needAjax, String courseId, String feedbackSessionName, InstructorAttributes instructor, InstructorFeedbackResultsPageData data, String selectedSection, SectionDetail selectedSectionDetail, String sortType, String questionId) throws EntityDoesNotExistException { FeedbackSessionResultsBundle bundle; if (questionId == null) { if (ALL_SECTION_OPTION.equals(selectedSection)) { data.setLargeNumberOfRespondents(needAjax != null); bundle = logic.getFeedbackSessionResultsForInstructorWithinRangeFromView( feedbackSessionName, courseId, instructor.email, 1, sortType); bundle.isComplete = true; } else { bundle = logic.getFeedbackSessionResultsForInstructorInSection(feedbackSessionName, courseId, instructor.email, selectedSection, <START> selectedSectionDetail.name()); <END> } } else { if (ALL_SECTION_OPTION.equals(selectedSection)) { bundle = logic.getFeedbackSessionResultsForInstructorFromQuestion(feedbackSessionName, courseId, instructor.email, questionId); } else { bundle = logic.getFeedbackSessionResultsForInstructorFromQuestionInSection( feedbackSessionName, courseId, instructor.email, questionId, selectedSection, selectedSectionDetail.name()); } } return bundle; }</code><technical_language>pass name here</technical_language>

Target:
private FeedbackSessionResultsBundle getBundleForQuestionView( String needAjax, String courseId, String feedbackSessionName, InstructorAttributes instructor, InstructorFeedbackResultsPageData data, String selectedSection, SectionDetail selectedSectionDetail, String sortType, String questionId) throws EntityDoesNotExistException { FeedbackSessionResultsBundle bundle; if (questionId == null) { if (ALL_SECTION_OPTION.equals(selectedSection)) { data.setLargeNumberOfRespondents(needAjax != null); bundle = logic.getFeedbackSessionResultsForInstructorWithinRangeFromView( feedbackSessionName, courseId, instructor.email, 1, sortType); bundle.isComplete = true; } else { bundle = logic.getFeedbackSessionResultsForInstructorInSection(feedbackSessionName, courseId, instructor.email, selectedSection, selectedSectionDetail); } } else { if (ALL_SECTION_OPTION.equals(selectedSection)) { bundle = logic.getFeedbackSessionResultsForInstructorFromQuestion(feedbackSessionName, courseId, instructor.email, questionId); } else { bundle = logic.getFeedbackSessionResultsForInstructorFromQuestionInSection( feedbackSessionName, courseId, instructor.email, questionId, selectedSection, selectedSectionDetail); } } return bundle; }
Source:
<code>public List<String> getExternalLibraries(String workspaceId, String projectName) throws Exception { List<String> result = new ArrayList<>(); HttpJsonResponse response = requestFactory .fromUrl(workspaceAgentApiEndpoint.get(workspaceId) + "java/navigation/libraries") .useGetMethod() .addQueryParam("projectpath", "/" + projectName) .request(); <START> <END> parseResponseAsArray(response) .forEach( jsonElement -> result.add(jsonElement.getAsJsonObject().get("name").getAsString())); return result; }</code><technical_language>I DTO more reliable - this able avoid potential problems changing Jar (library) object. code shorter. **For example add dependency:** xml <dependency> <groupId>org.eclipse.che.plugin</groupId> <artifactId>che-plugin-java-parent</artifactId> </dependency> **And try code like:** java result= DtoFactory. getInstance(). createListDtoFromJson(response.asString(), Jar.class). stream(). map(e->e.getName()). collect(Collectors.toList()); this is opinion. this approach applied for other methods in current PR. WDYT Vitaly</technical_language>

Target:
public List<String> getExternalLibraries(String workspaceId, String projectName) throws Exception { HttpJsonResponse response = requestFactory .fromUrl( workspaceAgentApiEndpointUrlProvider.get(workspaceId) + "java/navigation/libraries") .useGetMethod() .addQueryParam("projectpath", "/" + projectName) .request(); return DtoFactory.getInstance() .createListDtoFromJson(response.asString(), ProjectConfigDto.class) .stream() .map(e -> e.getName()) .collect(Collectors.toList()); }
Source:
<code>public ContentPopulatorSupplier( KeyedFileIndex<String, RoviProgramDescriptionLine> descriptionIndex, KeyedFileIndex<String, RoviEpisodeSequenceLine> episodeSequenceIndex, ContentResolver contentResolver, LoadingCache<String, Optional<Integer>> seasonNumberCache) { <START> this.descriptionIndex = descriptionIndex; <END> this.episodeSequenceIndex = episodeSequenceIndex; this.contentResolver = contentResolver; this.seasonNumberCache = seasonNumberCache; }</code><technical_language>checkNotNull</technical_language>

Target:
public ContentPopulatorSupplier( KeyedFileIndex<String, RoviProgramDescriptionLine> descriptionIndex, KeyedFileIndex<String, RoviEpisodeSequenceLine> episodeSequenceIndex, ContentResolver contentResolver, LoadingCache<String, Optional<Integer>> seasonNumberCache) { this.descriptionIndex = checkNotNull(descriptionIndex); this.episodeSequenceIndex = checkNotNull(episodeSequenceIndex); this.contentResolver = checkNotNull(contentResolver); this.seasonNumberCache = checkNotNull(seasonNumberCache); }
Source:
<code>public void testSerializeLibraryMessage() throws IOException { List<SongMetadata> library = new ArrayList<SongMetadata>(Arrays.asList( new SongMetadata(69, "Driver that Had a Dick on his Shoulder", "Aziz Ansari", "Dangerously Delicious", "David"), new SongMetadata(1, "Lady with the Puppies", "Aziz Ansari", "Dangerously Delicious", "David"), new SongMetadata(23, "Toronto Customs Lady", "Aziz Ansari", "Dangerously Delicious", "David"))); LibraryMessage oldMessage = new LibraryMessage(library); LibraryMessage newMessage = super.testSerializeMessage(oldMessage); for(int i = 0; i < library.size(); i++) { <START> assertEquals(library.get(i).getId() , newMessage.getLibrary().get(i).getId()); <END> assertEquals(library.get(i).getTitle() , newMessage.getLibrary().get(i).getTitle()); assertEquals(library.get(i).getArtist() , newMessage.getLibrary().get(i).getArtist()); assertEquals(library.get(i).getAlbum() , newMessage.getLibrary().get(i).getAlbum()); assertEquals(library.get(i).getUsername() , newMessage.getLibrary().get(i).getUsername()); } }</code><technical_language>Lets pull library.get(i) newMessage.getLibrary.get(i) a variable top of loop</technical_language>

Target:
public void testSerializeLibraryMessage() throws IOException { List<SongMetadata> library = new ArrayList<SongMetadata>(Arrays.asList( new SongMetadata(69, "Driver that Had a Dick on His Shoulder", "Aziz Ansari", "Dangerously Delicious", "David"), new SongMetadata(1, "Lady with the Puppies", null, "Dangerously Delicious", "David"), new SongMetadata(23, "Toronto Customs Lady", "Aziz Ansari", null, "David"))); new SongMetadata(42, "Motley Crue Tour vs. Aziz Tour", "Aziz Ansari", "Dangerously Delicious", null); LibraryMessage preSerializationLibraryMessage = new LibraryMessage(library); LibraryMessage postSerializationLibraryMessage = super.testSerializeMessage(preSerializationLibraryMessage); for(int i = 0; i < library.size(); i++) { SongMetadata preSerializationSongMetadata = library.get(i); SongMetadata postSerializationSongMetadata = postSerializationLibraryMessage.getLibrary().get(i); assertEquals(preSerializationSongMetadata.getId(), postSerializationSongMetadata.getId()); assertEquals(preSerializationSongMetadata.getTitle(), postSerializationSongMetadata.getTitle()); assertEquals(preSerializationSongMetadata.getArtist(), postSerializationSongMetadata.getArtist()); assertEquals(preSerializationSongMetadata.getAlbum(), postSerializationSongMetadata.getAlbum()); assertEquals(preSerializationSongMetadata.getUsername(), postSerializationSongMetadata.getUsername()); } }
Source:
<code>public boolean equals(final Object obj) { if (!(obj instanceof Parameter)) { return false; } <START> return getName().equals(((Parameter) obj).getName()) <END> && getParameterType().equals(((Parameter) obj).getParameterType()) && getParameterPointerType().equals(((Parameter) obj).getParameterPointerType()) && getTypeModifier().equals(((Parameter) obj).getTypeModifier()); }</code><technical_language>create a new variable for object comparing cast once</technical_language>

Target:
public boolean equals(final Object obj) { if (obj == null) { return false; } if (!(obj instanceof Parameter)) { return false; } final Parameter parameter = (Parameter) obj; return getName().equals(parameter.getName()) && getParameterType().equals(parameter.getParameterType()) && getParameterPointerType().equals(parameter.getParameterPointerType()) && getTypeModifier().equals(parameter.getTypeModifier()); }
Source:
<code><START> public int getValidTime() { <END> return (validTime < MIN_VALID_TIME) || (validTime > MAX_VALID_TIME) ? DEFAULT_VALID_TIME : validTime; }</code><technical_language>I this method public</technical_language>

Target:
private int getValidTime() { String validTimeGp = Context.getAdministrationService() .getGlobalProperty(OpenmrsConstants.GP_PASSWORD_RESET_VALIDTIME); final int validTime = StringUtils.isBlank(validTimeGp) ? DEFAULT_VALID_TIME : Integer.parseInt(validTimeGp); return (validTime < MIN_VALID_TIME) || (validTime > MAX_VALID_TIME) ? DEFAULT_VALID_TIME : validTime; }
Source:
<code>public RankedAdapterFactoryDescriptor.Registry createFilteredAdapterFactoryRegistry() { String disabledAdapterFactoriesString = getEMFComparePreferences().get( EMFComparePreferences.DISABLED_ADAPTER_FACTORY, ""); final List<String> disabledAdapterFactories = Lists.newArrayList(disabledAdapterFactoriesString <START> .split(";")); END> Multimap<Collection<?>, RankedAdapterFactoryDescriptor> filteredRegistry = ImmutableMultimap .copyOf(Multimaps.filterValues(adapterFactoryRegistry, new Predicate<RankedAdapterFactoryDescriptor>() { public boolean apply(RankedAdapterFactoryDescriptor input) { return !disabledAdapterFactories.contains(input.getId()); } })); return new RankedAdapterFactoryDescriptorRegistryImpl( ComposedAdapterFactory.Descriptor.Registry.INSTANCE, filteredRegistry); }</code><technical_language>String#split() is considered harmful. Guava's Splitter.on(";").omitEmptyString().trimResults() instead</technical_language>

Target:
public RankedAdapterFactoryDescriptor.Registry createFilteredAdapterFactoryRegistry() { String disabledAdapterFactoriesString = getEMFComparePreferences().get( EMFComparePreferences.DISABLED_ADAPTER_FACTORY, ""); final List<String> disabledAdapterFactories = Lists.newArrayList(Splitter.on(';').omitEmptyStrings() .trimResults().split(disabledAdapterFactoriesString)); Multimap<Collection<?>, RankedAdapterFactoryDescriptor> filteredBackingMultimap = ImmutableMultimap .copyOf(Multimaps.filterValues(adapterFactoryRegistryBackingMultimap, new Predicate<RankedAdapterFactoryDescriptor>() { public boolean apply(RankedAdapterFactoryDescriptor input) { return !disabledAdapterFactories.contains(input.getId()); } })); return new RankedAdapterFactoryDescriptorRegistryImpl( ComposedAdapterFactory.Descriptor.Registry.INSTANCE, filteredBackingMultimap); }
Source:
<code>public GridType overrideType(Type type) { if ( type == StandardBasicTypes.CALENDAR || type == StandardBasicTypes.CALENDAR_DATE ) { return StringCalendarDateType.INSTANCE; } else if ( type == StandardBasicTypes.BYTE ) { return ByteStringType.INSTANCE; } else if ( type == StandardBasicTypes.SHORT ) { <START> return ShortType.INSTANCE; <END> } else if ( type == StandardBasicTypes.FLOAT ) { return FloatType.INSTANCE; } else if ( type.getReturnedClass() == ObjectId.class ) { return ObjectIdGridType.INSTANCE; } else if ( type instanceof StringAsObjectIdType ) { return StringAsObjectIdGridType.INSTANCE; } return null; }</code><technical_language>created a specific type for MongoDB, is need override type in this case</technical_language>

Target:
public GridType overrideType(Type type) { if ( type == StandardBasicTypes.CALENDAR || type == StandardBasicTypes.CALENDAR_DATE ) { return StringCalendarDateType.INSTANCE; } else if ( type == StandardBasicTypes.BYTE ) { return ByteStringType.INSTANCE; } else if ( type.getReturnedClass() == ObjectId.class ) { return ObjectIdGridType.INSTANCE; } else if ( type instanceof StringAsObjectIdType ) { return StringAsObjectIdGridType.INSTANCE; } return null; }
Source:
<code>public static Range empty() { <START> return Range.empty(); <END> }</code><technical_language>is this endless recursion</technical_language>

Target:
public static Range empty() { return EMPTY; }
Source:
<code>private Runnable _confirmSignIn(final String signInChallengeResponse, final Callback<SignInResult> callback) { return new Runnable() { @Override public void run() { if (signInState == null) { callback.onError(new IllegalStateException("Cannot call confirmMFA(String, Callback) " + <START> "without initiating sign-in. This call is used for SMS_MFA and NEW_PASSWORD_REQUIRED" + <END> "sign-in state.")); return; } final CognitoIdentityProviderContinuation detectedContinuation; switch (signInState) { case SMS_MFA: signInMfaContinuation.setMfaCode(signInChallengeResponse); detectedContinuation = signInMfaContinuation; signInCallback = new InternalCallback<SignInResult>(callback); break; case NEW_PASSWORD_REQUIRED: ((NewPasswordContinuation) signInChallengeContinuation) .setPassword(signInChallengeResponse); detectedContinuation = signInChallengeContinuation; signInCallback = new InternalCallback<SignInResult>(callback); break; case DONE: callback.onError(new IllegalStateException("confirmSignIn called after signIn has succeeded")); return; default: callback.onError(new IllegalStateException("confirmSignIn called on unsupported operation, " + "please file a feature request")); return; } if (detectedContinuation != null) { detectedContinuation.continueTask(); } } }; }</code><technical_language>nit: space REQUIRED end quote</technical_language>

Target:
private Runnable _confirmSignIn(final String signInChallengeResponse, final Callback<SignInResult> callback) { return new Runnable() { @Override public void run() { if (signInState == null) { callback.onError(new IllegalStateException("Cannot call confirmSignIn(String, Callback) " + "without initiating sign-in. This call is used for SMS_MFA and NEW_PASSWORD_REQUIRED " + "sign-in state.")); return; } final CognitoIdentityProviderContinuation detectedContinuation; switch (signInState) { case SMS_MFA: signInMfaContinuation.setMfaCode(signInChallengeResponse); detectedContinuation = signInMfaContinuation; signInCallback = new InternalCallback<SignInResult>(callback); break; case NEW_PASSWORD_REQUIRED: ((NewPasswordContinuation) signInChallengeContinuation) .setPassword(signInChallengeResponse); detectedContinuation = signInChallengeContinuation; signInCallback = new InternalCallback<SignInResult>(callback); break; case DONE: callback.onError(new IllegalStateException("confirmSignIn called after signIn has succeeded")); return; default: callback.onError(new IllegalStateException("confirmSignIn called on unsupported operation, " + "please file a feature request")); return; } if (detectedContinuation != null) { detectedContinuation.continueTask(); } } }; }
Source:
<code>public void testHttpsClientDisableCNCheckTrue() { String url = "https://url"; AssertionType assertion = new AssertionType(); assertion.setTransactionTimeout(-1); CONNECTClient<TestServicePortType> endpoint = null; try { PropertyAccessor.getInstance().setProperty(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.DISABLE_CN_CHECK, "true"); boolean disableCNCheck = PropertyAccessor.getInstance() .getPropertyBoolean(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.DISABLE_CN_CHECK); endpoint = createClient(url, assertion); Client client = ClientProxy.getClient(endpoint.getPort()); HTTPConduit conduit = (HTTPConduit) client.getConduit(); TLSClientParameters tlsPara = conduit.getTlsClientParameters(); Assert.assertTrue("disableCNCheck==true", tlsPara.isDisableCNCheck()); } catch (PropertyAccessException ex) { <START> System.out.println("Unable to set in memory property for disable-CN-Check."); <END> } }</code><technical_language>Fail test if get catch. Test pass if line 144 throws exception</technical_language>

Target:
public void testHttpsClientDisableCNCheckTrue() { String url = "https://url"; AssertionType assertion = new AssertionType(); assertion.setTransactionTimeout(-1); CONNECTClient<TestServicePortType> endpoint = null; try { PropertyAccessor.getInstance().setProperty(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.DISABLE_CN_CHECK, "true"); boolean disableCNCheck = PropertyAccessor.getInstance() .getPropertyBoolean(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.DISABLE_CN_CHECK); endpoint = createClient(url, assertion); Client client = ClientProxy.getClient(endpoint.getPort()); HTTPConduit conduit = (HTTPConduit) client.getConduit(); TLSClientParameters tlsPara = conduit.getTlsClientParameters(); Assert.assertTrue("disableCNCheck==true", tlsPara.isDisableCNCheck()); } catch (PropertyAccessException ex) { Assert.fail("Unable to set in memory property for disable-CN-Check."); } }
Source:
<code>private static PathMatcher buildPathMatcherForDirectory(final Path dir) { final StringBuilder builder = buildGlobPatternStringBuilder(dir.toString()); <START> if (builder.charAt(builder.length() - 1) != File.separatorChar) { <END> if (File.separatorChar == '\\') { builder.append('\\'); } builder.append(File.separator); } return FileSystems.getDefault().getPathMatcher("glob:" + builder.toString() + "**"); }</code><technical_language>StringIndexOutOfBoundsException caused I run path_prefix: ./test.csv, worked previous version. Path = "" is considered Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 java.lang.AbstractStringBuilder.charAt(AbstractStringBuilder.java:237) java.lang.StringBuilder.charAt(StringBuilder.java:76) org.embulk.standards.LocalFileInputPlugin.buildPathMatcherForDirectory(LocalFileInputPlugin.java:298) org.embulk.standards.LocalFileInputPlugin.listFiles(LocalFileInputPlugin.java:148) org.embulk.standards.LocalFileInputPlugin.transaction(LocalFileInputPlugin.java:74) org.embulk.spi.FileInputRunner.transaction(FileInputRunner.java:62) org.embulk.exec.BulkLoader.doRun(BulkLoader.java:506) ... 11 more</technical_language>

Target:
private static PathMatcher buildPathMatcherForDirectory(final Path dir) { final String dirString = dir.toString(); final int dirLength = dirString.length(); final StringBuilder builder = buildGlobPatternStringBuilder(dirString); if (dirLength > 1 && builder.charAt(dirLength - 1) != File.separatorChar) { if (File.separatorChar == '\\') { builder.append('\\'); } builder.append(File.separator); } return FileSystems.getDefault().getPathMatcher("glob:" + builder.toString() + "**"); }
Source:
<code>public boolean hasBombs() { <START> return bombs != 0; <END> }</code><technical_language>this <= 0? decrementBombs a 0 check</technical_language>

Target:
public boolean hasBombs() { return bombs > 0; }
Source:
<code>protected void doRun() throws Exception { try { <START> logger.fine("doRun called: Computing Node metrics"); <END> DatadogClient client = DatadogUtilities.getDatadogClient(); String hostname = DatadogUtilities.getHostname("null"); long projectCount = 0; try { projectCount = Jenkins.getInstance().getAllItems(Project.class).size(); } catch (NullPointerException e){ logger.fine("Could not retrieve projects"); } long pluginCount = 0; try { pluginCount = Jenkins.getInstance().pluginManager.getPlugins().size(); } catch (NullPointerException e){ logger.fine("Could not retrieve plugins"); } client.gauge("jenkins.project.count", projectCount, hostname, null); client.gauge("jenkins.plugin.count", pluginCount, hostname, null); } catch (Exception e) { logger.warning("Unexpected exception occurred - " + e.getMessage()); } }</code><technical_language>node metrics</technical_language>

Target:
protected void doRun() throws Exception { try { logger.fine("doRun called: Computing Jenkins metrics"); DatadogClient client = DatadogUtilities.getDatadogClient(); String hostname = DatadogUtilities.getHostname("null"); long projectCount = 0; try { projectCount = Jenkins.getInstance().getAllItems(Project.class).size(); } catch (NullPointerException e){ logger.fine("Could not retrieve projects"); } long pluginCount = 0; try { pluginCount = Jenkins.getInstance().pluginManager.getPlugins().size(); } catch (NullPointerException e){ logger.fine("Could not retrieve plugins"); } client.gauge("jenkins.project.count", projectCount, hostname, null); client.gauge("jenkins.plugin.count", pluginCount, hostname, null); } catch (Exception e) { logger.warning("Unexpected exception occurred - " + e.getMessage()); } }
Source:
<code>private static boolean hasMultipleWindowServices() { synchronized (fgServices) { return fgServices.size() <START> >= 2; <END> } }</code><technical_language>"> 1" is more natural</technical_language>

Target:
private static boolean hasMultipleWindowServices() { synchronized (fgServices) { return fgServices.size() > 1; } }
Source:
<code>public void clear() { notifyInactive(); <START> Log.d(TAG, "MeteringRepeating clear!"); <END> if (mDeferrableSurface != null) { mDeferrableSurface.close(); } mDeferrableSurface = null; super.clear(); }</code><technical_language>Please guard debug logs a static DEBUG boolean is initialized Log.isLoggable()</technical_language>

Target:
public void clear() { notifyInactive(); if (DEBUG) { Log.d(TAG, "MeteringRepeating clear!"); } if (mDeferrableSurface != null) { mDeferrableSurface.close(); } mDeferrableSurface = null; super.clear(); }
Source:
<code>public void smokeTestExport() throws Exception { ConfiguratorRegistry registry = ConfiguratorRegistry.get(); ConfigurationContext context = new ConfigurationContext(registry); <START> CNode yourAttribute = Util.getUnclassifiedRoot(context).get("scriptApproval"); <END> String exported = Util.toYamlString(yourAttribute); String expected = Util.toStringFromYamlFile(this, "smoke_test_expected.yaml"); assertEquals(exported, expected); }</code><technical_language>I suggest adding a static import for Util intended done this reads suggestion CNode yourAttribute = getUnclassifiedRoot(context).get("scriptApproval");</technical_language>

Target:
public void smokeTestExport() throws Exception { ConfiguratorRegistry registry = ConfiguratorRegistry.get(); ConfigurationContext context = new ConfigurationContext(registry); CNode yourAttribute = getSecurityRoot(context).get("scriptApproval"); String exported = toYamlString(yourAttribute); String expected = toStringFromYamlFile(this, "smoke_test_expected.yaml"); assertEquals(exported, expected); }
Source:
<code>public void testToString() { DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS"); Date d0 = new Date(0); Date d1 = new Date(12345000L); <START> Date d2 = new Date(85166000L); <END> assertEquals("toString", df.format(d0) + " 000 000", ts0.toString()); assertEquals("toString", df.format(d1) + " 000 000", ts1.toString()); assertEquals("toString", df.format(d2) + " 000 000", ts2.toString()); }</code><technical_language>prefer if Date initialized ts's getValue converted s ms</technical_language>

Target:
public void testToString() { DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS"); Date d0 = new Date(ts0.getValue()*1000); Date d1 = new Date(ts1.getValue()*1000); Date d2 = new Date(ts2.getValue()*1000); assertEquals("toString", df.format(d0) + " 000 000", ts0.toString()); assertEquals("toString", df.format(d1) + " 000 000", ts1.toString()); assertEquals("toString", df.format(d2) + " 000 000", ts2.toString()); }
Source:
<code>protected void setup(Binder binder) { binder.bind(HiveMetastoreClientFactory.class).in(Scopes.SINGLETON); binder.bind(HiveCluster.class).to(StaticHiveCluster.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(StaticMetastoreConfig.class); <START> binder.bind(HiveMetastore.class).to(ThriftHiveMetastore.class).in(Scopes.SINGLETON); <END> configBinder(binder).bindConfig(ThriftHiveMetastoreConfig.class); if (buildConfigObject(HiveClientConfig.class).getRecordingPath() != null) { binder.bind(ExtendedHiveMetastore.class) .annotatedWith(ForRecordingHiveMetastore.class) .to(BridgingHiveMetastore.class) .in(Scopes.SINGLETON); binder.bind(ExtendedHiveMetastore.class) .annotatedWith(ForCachingHiveMetastore.class) .to(RecordingHiveMetastore.class) .in(Scopes.SINGLETON); binder.bind(RecordingHiveMetastore.class).in(Scopes.SINGLETON); newExporter(binder).export(RecordingHiveMetastore.class) .as(generatedNameOf(RecordingHiveMetastore.class, connectorId)); } else { binder.bind(ExtendedHiveMetastore.class) .annotatedWith(ForCachingHiveMetastore.class) .to(BridgingHiveMetastore.class) .in(Scopes.SINGLETON); } binder.bind(ExtendedHiveMetastore.class).to(CachingHiveMetastore.class).in(Scopes.SINGLETON); newExporter(binder).export(HiveMetastore.class) .as(generatedNameOf(ThriftHiveMetastore.class, connectorId)); newExporter(binder).export(ExtendedHiveMetastore.class) .as(generatedNameOf(CachingHiveMetastore.class, connectorId)); }</code><technical_language>add this binder.bind(HiveMetastore.class).to(ThriftHiveMetastore.class... line</technical_language>

Target:
protected void setup(Binder binder) { binder.bind(HiveMetastoreClientFactory.class).in(Scopes.SINGLETON); binder.bind(HiveCluster.class).to(StaticHiveCluster.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(StaticMetastoreConfig.class); configBinder(binder).bindConfig(ThriftHiveMetastoreConfig.class); binder.bind(HiveMetastore.class).to(ThriftHiveMetastore.class).in(Scopes.SINGLETON); if (buildConfigObject(HiveClientConfig.class).getRecordingPath() != null) { binder.bind(ExtendedHiveMetastore.class) .annotatedWith(ForRecordingHiveMetastore.class) .to(BridgingHiveMetastore.class) .in(Scopes.SINGLETON); binder.bind(ExtendedHiveMetastore.class) .annotatedWith(ForCachingHiveMetastore.class) .to(RecordingHiveMetastore.class) .in(Scopes.SINGLETON); binder.bind(RecordingHiveMetastore.class).in(Scopes.SINGLETON); newExporter(binder).export(RecordingHiveMetastore.class) .as(generatedNameOf(RecordingHiveMetastore.class, connectorId)); } else { binder.bind(ExtendedHiveMetastore.class) .annotatedWith(ForCachingHiveMetastore.class) .to(BridgingHiveMetastore.class) .in(Scopes.SINGLETON); } binder.bind(ExtendedHiveMetastore.class).to(CachingHiveMetastore.class).in(Scopes.SINGLETON); newExporter(binder).export(HiveMetastore.class) .as(generatedNameOf(ThriftHiveMetastore.class, connectorId)); newExporter(binder).export(ExtendedHiveMetastore.class) .as(generatedNameOf(CachingHiveMetastore.class, connectorId)); }
Source:
<code>public void initLandmarkWeights(final int lmIdx, int lmNodeId, final long rowSize) { IntObjectMap<SPTEntry> map = from ? bestWeightMapFrom : bestWeightMapTo; final AtomicInteger maxedout = new AtomicInteger(0); final Map.Entry<Double, Double> finalMaxWeight = new MapEntry<>(0d, 0d); map.forEach(new IntObjectProcedure<SPTEntry>() { @Override public void apply(int nodeId, SPTEntry b) { if (!lms.setWeight(lmIdx, nodeId, rowSize, b.weight, from)) { maxedout.incrementAndGet(); finalMaxWeight.setValue(Math.max(b.weight, finalMaxWeight.getValue())); } } }); if ((double) maxedout.get() / map.size() > 0.1) { if (from){ LOGGER.warn("landmark " + lmIdx + " (" + nodeAccess.getLatitude(lmNodeId) + "," + nodeAccess.getLongitude(lmNodeId) + "): " + "too many backward weights were maxed out (" + maxedout.get() + "/" + map.size() + "). Use a bigger factor than " + lms.factor + ". For example use the following in the config.properties: weighting=" + weighting.getName() + "|maximum=" + finalMaxWeight.getValue() * 1.2); }else{ LOGGER.warn("landmark " + lmIdx + " (" + nodeAccess.getLatitude(lmNodeId) + "," + nodeAccess.getLongitude(lmNodeId) + "): " + "too many delta weights were maxed out (" + maxedout.get() + "/" + map.size() + "). Use a bigger factor than " + lms.factor + ". For example use the following in the config.properties: weighting=" + weighting.getName() + "|maximum=" + finalMaxWeight.getValue() * 1.2); <START> } <END> } }</code><technical_language>sense short "if-then-else" form string LOGGER.warn("blup" + (from? "too weights" : "too delta weights")</technical_language>

Target:
public void initLandmarkWeights(final int lmIdx, int lmNodeId, final long rowSize) { IntObjectMap<SPTEntry> map = from ? bestWeightMapFrom : bestWeightMapTo; final AtomicInteger maxedout = new AtomicInteger(0); final Map.Entry<Double, Double> finalMaxWeight = new MapEntry<>(0d, 0d); map.forEach(new IntObjectProcedure<SPTEntry>() { @Override public void apply(int nodeId, SPTEntry b) { if (!lms.setWeight(lmIdx, nodeId, rowSize, b.weight, from)) { maxedout.incrementAndGet(); finalMaxWeight.setValue(Math.max(b.weight, finalMaxWeight.getValue())); } } }); if ((double) maxedout.get() / map.size() > 0.1) { LOGGER.warn("landmark " + lmIdx + " (" + nodeAccess.getLatitude(lmNodeId) + "," + nodeAccess.getLongitude(lmNodeId) + "): " + "too many " + (from ? "backward" : "delta") + " weights were maxed out (" + maxedout.get() + "/" + map.size() + "). Factor is too small " + lms.factor + ". To fix this increase maximum in config.yml: prepare.lm.weighting: " + weighting.getName() + "|maximum=" + finalMaxWeight.getValue() * 1.2); } }