auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>@Override public void createSnapshot(String snpName) { <START> mgr.createSnapshot(snpName).get(); <END> }</code><technical_language>Snapshot operation long, bad for user experience hang this MXBean call. Instead, async operation attributes for current snapshot status (at snapshot name, in process/completed successfully/completed error)</technical_language>

Target:
@Override public void createSnapshot(String snpName) { mgr.createSnapshot(snpName); }
Source:
<code>private static int getTokenType(ParseTree node) { final int tokenType; if (node.getChildCount() == 0) { final int antlrTokenType = ((TerminalNode) node).getSymbol().getType(); if (antlrTokenType == JavadocTokenTypes.HTML_TAG_NAME) { tokenType = JavadocTokenTypes.EMBED_HTML_TAG_NAME; } else if (antlrTokenType == JavadocTokenTypes.EMBED_HTML_TAG_NAME) { <START> tokenType = JavadocTokenTypes.HTML_TAG_NAME; <END> } else { tokenType = antlrTokenType; } } else { final String className = getNodeClassNameWithoutContext(node); final String typeName = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, className); tokenType = JavadocUtils.getTokenId(typeName); } return tokenType; }</code><technical_language>ok, wait then. I thought this happen more often</technical_language>

Target:
private static int getTokenType(ParseTree node) { final int tokenType; if (node.getChildCount() == 0) { final int antlrTokenType = ((TerminalNode) node).getSymbol().getType(); tokenType = mapAntlrTokenTypeToJavadocTokenType(antlrTokenType); } else { final String className = getNodeClassNameWithoutContext(node); final String typeName = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, className); tokenType = JavadocUtils.getTokenId(typeName); } return tokenType; }
Source:
<code><START> public ProjectSpace getTransferringProjectSpace() { <END> return transferringProjectSpace; }</code><technical_language>Optional avoid NPEs for caller, I introduced option some point, ask Edgar pls</technical_language>

Target:
public Optional<ProjectSpace> getTransferringProjectSpace() { return Optional.fromNullable(transferringProjectSpace); }
Source:
<code>public static void createIndex(SamReader reader, File output, Log log) { BAMIndexer indexer = new BAMIndexer(output, reader.getFileHeader()); int totalRecords = 0; for (SAMRecord rec : reader) { if (++totalRecords % 1000000 == 0) { <START> if (null != log) log.debug(totalRecords + " reads processed ..."); <END> } indexer.processAlignment(rec); } indexer.finish(); }</code><technical_language>this log.debug? For example, a tool create index want progress number of records processed. allow this togglable</technical_language>

Target:
public static void createIndex(SamReader reader, File output, Log log) { BAMIndexer indexer = new BAMIndexer(output, reader.getFileHeader()); int totalRecords = 0; for (SAMRecord rec : reader) { if (++totalRecords % 1000000 == 0) { if (null != log) log.info(totalRecords + " reads processed ..."); } indexer.processAlignment(rec); } indexer.finish(); }
Source:
<code><START> public SplunkServiceFactory(SplunkServer splunkServer) { <END> this.splunkServers = Arrays.asList(splunkServer); }</code><technical_language>is - Assert.notNull(splunkServer)</technical_language>

Target:
public SplunkServiceFactory(SplunkServer splunkServer) { Assert.notNull(splunkServer); this.splunkServers = Arrays.asList(splunkServer); }
Source:
<code>public void testPrefixedText() throws Exception { <START> assertEquals(new PageTitle(null, "Test title").getPrefixedText(), "Test_title"); <END> assertEquals(new PageTitle(null, "Test title").getPrefixedText(), "Test_title"); assertEquals(new PageTitle("Talk", "Test title").getPrefixedText(), "Talk:Test_title"); assertEquals(new PageTitle(null, "Test title").getText(), "Test_title"); }</code><technical_language>getText() / getPrefixedText() return form spaces for consistency MediaWiki's Title class (also space form is preferred API dealing titles)</technical_language>

Target:
public void testPrefixedText() throws Exception { assertEquals(new PageTitle(null, "Test title").getPrefixedText(), "Test title"); assertEquals(new PageTitle(null, "Test title").getPrefixedText(), "Test title"); assertEquals(new PageTitle("Talk", "Test title").getPrefixedText(), "Talk:Test title"); assertEquals(new PageTitle(null, "Test title").getText(), "Test title"); }
Source:
<code>public IconDataParcelable(Parcel im) { type = im.readInt(); path = im.readString(); image = im.readInt(); loadingImage = im.readInt(); isImageBroken = im.readInt() == 1; <START> hashCode = im.readInt(); <END> }</code><technical_language>if hashCode null</technical_language>

Target:
public IconDataParcelable(Parcel im) { type = im.readInt(); path = im.readString(); image = im.readInt(); loadingImage = im.readInt(); isImageBroken = im.readInt() == 1; }
Source:
<code>private static void alterTable(Runnable alterTableFunction) { try { alterTableFunction.run(); } catch (Exception e) { <START> log.info("Alter table failed: %s", e); <END> } }</code><technical_language>log.warn(e, "Alter table failed");</technical_language>

Target:
private static void alterTable(Runnable alterTableFunction) { try { alterTableFunction.run(); } catch (Exception e) { log.warn("Alter table failed: %s", e.getMessage()); } }
Source:
<code>private void importUserDefinitions(EList<UserDef> userDefs) throws OseeCoreException { for (UserDef dslUserDef : userDefs) { String dslUserName = Strings.unquote(dslUserDef.getName()); <START> Artifact userArt = null; <END> userArt = UserManager.createUser(getOseeUser(dslUserDef), transaction); if (userArt == null) { userArt = ArtifactTypeManager.addArtifact(CoreArtifactTypes.User, AtsUtil.getAtsBranch(), dslUserName); } if (userArt == null) { throw new OseeStateException(String.format("No user found in datbase with name [%s] from [%s]", dslUserName, modelName), modelName); } } }</code><technical_language>This is needed retained</technical_language>

Target:
private void importUserDefinitions(EList<UserDef> userDefs) throws OseeCoreException { for (UserDef dslUserDef : userDefs) { String dslUserName = Strings.unquote(dslUserDef.getName()); Artifact userArt = null; if (dslUserDef.getUserDefOption().contains("GetOrCreate")) { userArt = UserManager.createUser(getOseeUser(dslUserDef), transaction); } if (userArt == null) { userArt = ArtifactTypeManager.addArtifact(CoreArtifactTypes.User, AtsUtil.getAtsBranch(), dslUserName); } if (userArt == null) { throw new OseeStateException(String.format("No user found in datbase with name [%s] from [%s]", dslUserName, modelName), modelName); } } }
Source:
<code>private void initializeAnimators() { if (hasSetAnimations()) return; <START> mCircleOneAnimationSet = getAnimatiorSet(mCircleOne); <END> mCircleTwoAnimationSet = getAnimatiorSet(mCircleTwo); mCircleThreeAnimationSet = getAnimatiorSet(mCircleThree); mCircleTwoAnimationSet.setStartDelay(100); mCircleThreeAnimationSet.setStartDelay(200); mCircleOneAnimationSet.start(); mCircleTwoAnimationSet.start(); mCircleThreeAnimationSet.start(); }</code><technical_language>spell animator wrong</technical_language>

Target:
private void initializeAnimators() { if (hasSetAnimations()) return; mCircleOneAnimationSet = getAnimatorSet(mCircleOne); mCircleTwoAnimationSet = getAnimatorSet(mCircleTwo); mCircleThreeAnimationSet = getAnimatorSet(mCircleThree); mCircleTwoAnimationSet.setStartDelay(100); mCircleThreeAnimationSet.setStartDelay(200); mCircleOneAnimationSet.start(); mCircleTwoAnimationSet.start(); mCircleThreeAnimationSet.start(); }
Source:
<code>public SAMFileWriter makeWriter(final SAMFileHeader header, final boolean presorted, final File outputFile, final File referenceFasta) { <START> if (outputFile.getName().endsWith(".cram")) <END> try { return makeCRAMWriter(header, new FileOutputStream(outputFile), referenceFasta); } catch (final FileNotFoundException e) { throw new RuntimeException(e); } return makeSAMOrBAMWriter(header, presorted, outputFile); }</code><technical_language>hard code file extensions a static variable else</technical_language>

Target:
public SAMFileWriter makeWriter(final SAMFileHeader header, final boolean presorted, final File outputFile, final File referenceFasta) { if (outputFile.getName().endsWith(SamReader.Type.CRAM_TYPE.fileExtension())) try { return makeCRAMWriter(header, new FileOutputStream(outputFile), referenceFasta); } catch (final FileNotFoundException e) { throw new RuntimeException(e); } return makeSAMOrBAMWriter(header, presorted, outputFile); }
Source:
<code>public void VetProvidersTests_001_article(String videoUrl, String videoName) { <START> PageObjectLogging.log("", videoUrl, true); <END> WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); ArticlePageObject article = base.openRandomArticle(wikiURL); VisualEditModePageObject visualEditMode = article.goToCurrentArticleEditPage(); visualEditMode.clearContent(); VetAddVideoComponentObject vetAddVideo = visualEditMode.clickVideoButton(); VetOptionsComponentObject vetOptions = vetAddVideo.addVideoByUrl(videoUrl); vetOptions.submit(); visualEditMode.verifyVideo(); visualEditMode.submitArticle(); article.verifyVideo(); FileDetailsPageObject fileDetails = article.clickVideoDetailsButton(); fileDetails.verifyEmbeddedVideoIsPresent(); fileDetails.verifyHeader(videoName); }</code><technical_language>remove this log method call</technical_language>

Target:
public void VetProvidersTests_001_article(String videoUrl, String videoName) { PageObjectLogging.log("", videoUrl, true); WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); ArticlePageObject article = base.openRandomArticle(wikiURL); VisualEditModePageObject visualEditMode = article.goToCurrentArticleEditPage(); visualEditMode.clearContent(); VetAddVideoComponentObject vetAddVideo = visualEditMode.clickVideoButton(); VetOptionsComponentObject vetOptions = vetAddVideo.addVideoByUrl(videoUrl); vetOptions.submit(); visualEditMode.verifyVideo(); visualEditMode.submitArticle(); article.verifyVideo(); FilePagePageObject fileDetails = article.clickVideoDetailsButton(); fileDetails.verifyEmbeddedVideoIsPresent(); fileDetails.verifyHeader(videoName); }
Source:
<code>public void checkExceptionPlacedOnErrorChannel() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "pollingEndpointErrorHandlingTests.xml", this.getClass()); PollableChannel errorChannel = (PollableChannel) context.getBean("errorChannel"); Message errorMessage = errorChannel.receive(5000); assertNotNull("No error message received", errorMessage); assertEquals("Message received was not an ErrorMessage", ErrorMessage.class, errorMessage.getClass()); <START> assertEquals("ErrorMessage payload was not a MessagingException", MessagingException.class, errorMessage.getPayload().getClass()); <END> MessagingException messagingException = (MessagingException) errorMessage.getPayload(); assertNotNull(messagingException.getFailedMessage()); assertNotNull(messagingException.getCause()); context.close(); }</code><technical_language>do exceed 120 line length</technical_language>

Target:
public void checkExceptionPlacedOnErrorChannel() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "pollingEndpointErrorHandlingTests.xml", this.getClass()); PollableChannel errorChannel = (PollableChannel) context.getBean("errorChannel"); Message errorMessage = errorChannel.receive(5000); assertNotNull("No error message received", errorMessage); assertEquals("Message received was not an ErrorMessage", ErrorMessage.class, errorMessage.getClass()); context.close(); }
Source:
<code>public void testSetToDefaultWhenNVPMSSetToDefault() { User target = new User(); target.setAddress( "address" ); target.setEmail( "email" ); target.setName( "name" ); target.setPhone( 12345 ); target.setSettings( new String[]{ "test" } ); UserDTO source = new UserDTO(); source.setContactDataDTO( new ContactDataDTO() ); source.getContactDataDTO().setAddress( "newAddress" ); source.getContactDataDTO().setEmail( null ); source.getContactDataDTO().setPhone( null ); source.setName( null ); UserMapper.INSTANCE.updateUserFromUserAndDefaultDTO( source, target ); assertThat( target.getAddress() ).isEqualTo( "newAddress" ); assertThat( target.getEmail() ).isEqualTo( "" ); assertThat( target.getPhone() ).isEqualTo( 0 ); assertThat( target.getName() ).isEqualTo( "" ); <START> assertThat( target.getPreferences() ).isEmpty(); <END> assertThat( target.getSettings() ).isEmpty(); }</code><technical_language>sense add preferences validate cleared</technical_language>

Target:
public void testSetToDefaultWhenNVPMSSetToDefault() { User target = new User(); target.setAddress( "address" ); target.setEmail( "email" ); target.setName( "name" ); target.setPhone( 12345 ); target.addPreference( "preference" ); target.setSettings( new String[]{ "test" } ); UserDTO source = new UserDTO(); source.setContactDataDTO( new ContactDataDTO() ); source.getContactDataDTO().setAddress( "newAddress" ); source.getContactDataDTO().setEmail( null ); source.getContactDataDTO().setPhone( null ); source.setName( null ); UserMapper.INSTANCE.updateUserFromUserAndDefaultDTO( source, target ); assertThat( target.getAddress() ).isEqualTo( "newAddress" ); assertThat( target.getEmail() ).isEqualTo( "" ); assertThat( target.getPhone() ).isEqualTo( 0 ); assertThat( target.getName() ).isEqualTo( "" ); assertThat( target.getPreferences() ).containsOnly( "preference" ); assertThat( target.getSettings() ).isEmpty(); }
Source:
<code>public void onSucceeded(Guid cmdId, List<Guid> childCmdIds) { <START> getCommand(cmdId).onStopVmsSucceeded(); <END> CommandCoordinatorUtil.removeAllCommandsInHierarchy(cmdId); }</code><technical_language>setTaskGroupSuccess=false</technical_language>

Target:
public void onSucceeded(Guid cmdId, List<Guid> childCmdIds) { RemoveVmPoolCommand<? extends VmPoolParametersBase> cmd = getCommand(cmdId); CommandCoordinatorUtil.removeAllCommandsInHierarchy(cmdId); cmd.getParameters().setTaskGroupSuccess(true); cmd.endAction(); }
Source:
<code>public static FlowMap getFlowMap(long dpid) throws ConfigError { FVLog.log(LogLevel.TRACE,null,"FlowSpaceUtil: getFlowMap"); FlowMap fm = FVConfig.getFlowSpaceFlowMap(); switch (fm.getType()) { case LINEAR: FVLog.log(LogLevel.DEBUG,null,"FlowSpaceUtil: It is a Linear Flowmap"); return FlowSpaceUtil.getSubFlowMap(fm, dpid, new FVMatch()); case FEDERATED: <START> FVLog.log(LogLevel.DEBUG,null,"FlowSpaceUtil: It is a Federated Flowmap"); <END> return fm; default: FVLog.log(LogLevel.ERROR, null, "Unknown FlowMap type"); throw new RuntimeException("Unknown FlowMap type; time to quit"); } }</code><technical_language>need</technical_language>

Target:
public static FlowMap getFlowMap(long dpid) throws ConfigError { FlowMap fm = FVConfig.getFlowSpaceFlowMap(); switch (fm.getType()) { case LINEAR: return FlowSpaceUtil.getSubFlowMap(fm, dpid, new FVMatch()); case FEDERATED: return fm; default: logger.error("Unknown FlowMap type"); throw new RuntimeException("Unknown FlowMap type; time to quit"); } }
Source:
<code>private JSONObject _getJSONObject(byte[] array) throws JSONException { <START> return new JSONObject(new JSONTokener(new String(array))); <END> }</code><technical_language>new String(byte[]) a charset is dangerous. default charset is supposed UTF-8 Android, I feel more comfortable charset explicitly. - JSONTokener is superfluous JSONObject construct a String</technical_language>

Target:
private JSONObject _getJSONObject(byte[] array) throws JSONException, UnsupportedEncodingException { return new JSONObject(new String(array, "UTF-8")); }
Source:
<code>private Map.Entry<LookupBean, LookupExtractorFactoryContainer> startLookup(LookupBean lookupBean) { LookupExtractorFactoryContainer container = lookupBean.getContainer(); LOG.info("Starting lookup [%s]:[%s]", lookupBean.getName(), container); try { if (container.getLookupExtractorFactory().start()) { LOG.info("Started lookup [%s]:[%s]", lookupBean.getName(), container); return new AbstractMap.SimpleImmutableEntry<>(lookupBean, container); } else { LOG.error("Failed to start lookup [%s]:[%s]", lookupBean.getName(), container); return null; } } catch (Exception e) { <START> LOG.error(e, "Failed to start lookup [%s]:[%s]", lookupBean.getName(), container); <END> throw e; } }</code><technical_language>If this throws error need log it. throw new RE(e, "Failed start lookup [%s]:[%s]", lookupBean.getName(), container);</technical_language>

Target:
private Map.Entry<String, LookupExtractorFactoryContainer> startLookup(LookupBean lookupBean) { LookupExtractorFactoryContainer container = lookupBean.getContainer(); LOG.info("Starting lookup [%s]:[%s]", lookupBean.getName(), container); try { if (container.getLookupExtractorFactory().start()) { LOG.info("Started lookup [%s]:[%s]", lookupBean.getName(), container); return new AbstractMap.SimpleImmutableEntry<>(lookupBean.getName(), container); } else { LOG.error("Failed to start lookup [%s]:[%s]", lookupBean.getName(), container); return null; } } catch (RuntimeException e) { throw new RE(e, "Failed to start lookup [%s]:[%s]", lookupBean.getName(), container); } }
Source:
<code>public Endpoint referenceEndpoint(ServerLocation server, DistributedMember memberId) { <START> Endpoint endpoint = endpointMap.get(memberId); <END> boolean addedEndpoint = false; if (endpoint == null || endpoint.isClosed()) { synchronized (this) { endpoint = endpointMap.get(memberId); if (endpoint == null || endpoint.isClosed()) { ConnectionStats stats = getStats(server); Map<DistributedMember, Endpoint> endpointMapTemp = new HashMap<>(endpointMap); endpoint = new Endpoint(this, ds, server, stats, memberId); listener.clearPdxRegistry(endpoint); endpointMapTemp.put(memberId, endpoint); endpointMap = Collections.unmodifiableMap(endpointMapTemp); addedEndpoint = true; poolStats.setServerCount(endpointMap.size()); } } } endpoint.addReference(); if (addedEndpoint) { listener.endpointNowInUse(endpoint); } return endpoint; }</code><technical_language>This is is causing ConnectionPoolImplJUnitTest failure. test creates servers a pool in JVM, servers membership ID. If delete test replace a distributedTest creates servers in JVMs pass</technical_language>

Target:
public Endpoint referenceEndpoint(ServerLocation server, DistributedMember memberId) { Endpoint endpoint = endpointMap.get(server); boolean addedEndpoint = false; if (endpoint == null || endpoint.isClosed()) { synchronized (this) { endpoint = endpointMap.get(server); if (endpoint == null || endpoint.isClosed()) { ConnectionStats stats = getStats(server); Map<ServerLocation, Endpoint> endpointMapTemp = new HashMap<>(endpointMap); endpoint = new Endpoint(this, ds, server, stats, memberId); listener.clearPdxRegistry(endpoint); endpointMapTemp.put(server, endpoint); endpointMap = Collections.unmodifiableMap(endpointMapTemp); addedEndpoint = true; poolStats.setServerCount(endpointMap.size()); } } } endpoint.addReference(); if (addedEndpoint) { listener.endpointNowInUse(endpoint); } return endpoint; }
Source:
<code>public final This bindBeanList(String key, List<?> values, List<String> propertyNames) { if (values.isEmpty()) { throw new IllegalArgumentException( getClass().getSimpleName() + ".bindBeanList was called with no values."); } if (propertyNames.isEmpty()) { throw new IllegalArgumentException( getClass().getSimpleName() + ".bindBeanList was called with no properties."); } StringBuilder names = new StringBuilder(); for (int valueIndex = 0; valueIndex < values.size(); valueIndex++) { if (valueIndex > 0) { names.append(','); } Object bean = values.get(valueIndex); BeanPropertyArguments beanProperties = new BeanPropertyArguments(null, bean, getContext()); names.append("("); for (int propertyIndex = 0; propertyIndex < propertyNames.size(); propertyIndex++) { if (propertyIndex > 0) { names.append(","); } String propertyName = propertyNames.get(propertyIndex); String name = "__" + key + "_" + valueIndex + "_" + propertyName; names.append(':').append(name); <START> bind(name, beanProperties.find(propertyName).get()); <END> } names.append(")"); } return define(key, names.toString()); }</code><technical_language>This orElseThrow a descriptive message instead of get</technical_language>

Target:
public final This bindBeanList(String key, List<?> values, List<String> propertyNames) throws UnableToCreateStatementException { if (values.isEmpty()) { throw new IllegalArgumentException( getClass().getSimpleName() + ".bindBeanList was called with no values."); } if (propertyNames.isEmpty()) { throw new IllegalArgumentException( getClass().getSimpleName() + ".bindBeanList was called with no properties."); } StringBuilder names = new StringBuilder(); for (int valueIndex = 0; valueIndex < values.size(); valueIndex++) { if (valueIndex > 0) { names.append(','); } Object bean = values.get(valueIndex); BeanPropertyArguments beanProperties = new BeanPropertyArguments(null, bean, getContext()); names.append("("); for (int propertyIndex = 0; propertyIndex < propertyNames.size(); propertyIndex++) { if (propertyIndex > 0) { names.append(","); } String propertyName = propertyNames.get(propertyIndex); String name = "__" + key + "_" + valueIndex + "_" + propertyName; names.append(':').append(name); Argument argument = beanProperties.find(propertyName) .orElseThrow(() -> new UnableToCreateStatementException("Unable to get " + propertyName + " argument for " + bean, getContext())); bind(name, argument); } names.append(")"); } return define(key, names.toString()); }
Source:
<code>private <M extends Message> void validateVersion(@Nullable M previousMetadata, @Nullable M userMetadata) { for (Descriptors.FieldDescriptor fieldDescriptor : userMetadata.getDescriptorForType().getFields()) { if (!fieldDescriptor.getOptions().getExtension(CorfuOptions.schema).getVersion()) { continue; } if (!versionTypes.contains(fieldDescriptor.getType())) { throw new IllegalArgumentException("Version field needs to be an Integer or Long type."+ <START> " Current type="+fieldDescriptor.getType()); <END> } long validatingVersion = (long) userMetadata.getField(fieldDescriptor); if (validatingVersion <= 0) { continue; } long previousVersion = Optional.ofNullable(previousMetadata) .map(m -> (Long) m.getField(fieldDescriptor)) .orElse(-1L); if (validatingVersion != previousVersion) { throw new RuntimeException("Stale object Exception: " + previousVersion + " != " + validatingVersion); } } }</code><technical_language>please code reformat</technical_language>

Target:
private void validateVersion(@Nullable M previousMetadata, @Nullable M userMetadata) { for (Descriptors.FieldDescriptor fieldDescriptor : userMetadata.getDescriptorForType().getFields()) { if (!fieldDescriptor.getOptions().getExtension(CorfuOptions.schema).getVersion()) { continue; } if (!versionTypes.contains(fieldDescriptor.getType())) { throw new IllegalArgumentException("Version field needs to be an Integer or Long type." + " Current type=" + fieldDescriptor.getType()); } long validatingVersion = (long) userMetadata.getField(fieldDescriptor); if (validatingVersion <= 0) { continue; } long previousVersion = Optional.ofNullable(previousMetadata) .map(m -> (Long) m.getField(fieldDescriptor)) .orElse(-1L); if (validatingVersion != previousVersion) { throw new RuntimeException("Stale object Exception: " + previousVersion + " != " + validatingVersion); } } }
Source:
<code>private Dialog createDeleteDialog(){ return new AlertDialog.Builder(this) .setMessage(R.string.remove_folder_confirm) .setPositiveButton(android.R.string.yes, (dialogInterface, i) -> { getApi().removeFolder(mFolder.id); SharedPreferences prefs = this.getSharedPreferences(ShareActivity.SHARED_PREFS_SAVED_DIRECTORIES, MODE_PRIVATE); <START> prefs.edit().remove(mFolder.id).apply(); <END> finish(); }) .setNegativeButton(android.R.string.no, null) .create(); }</code><technical_language>handle this in RestApi.removeFolder(), in case function is called else. dont need set MODE_PRIVATE, default</technical_language>

Target:
private Dialog createDeleteDialog(){ return new AlertDialog.Builder(this) .setMessage(R.string.remove_folder_confirm) .setPositiveButton(android.R.string.yes, (dialogInterface, i) -> { getApi().removeFolder(mFolder.id); finish(); }) .setNegativeButton(android.R.string.no, null) .create(); }
Source:
<code>private static byte[] floatToByteArray(final float floatValue) { <START> ByteBuffer buffer = ByteBuffer.allocate(FLOAT_BYTES_LENGTH).order(ByteOrder.LITTLE_ENDIAN); <END> return buffer.putFloat(floatValue).array(); }</code><technical_language>final</technical_language>

Target:
private static byte[] floatToByteArray(final float floatValue) { final ByteBuffer buffer = ByteBuffer.allocate(FLOAT_BYTES_LENGTH).order(ByteOrder.LITTLE_ENDIAN); return buffer.putFloat(floatValue).array(); }
Source:
<code>public int getQuotaCount() { MapSqlParameterSource parameterSource = new MapSqlParameterSource(); <START> return getCallsHandler().executeRead("GetQuotaCount", new ParameterizedRowMapper<Integer>() { <END> @Override public Integer mapRow(ResultSet resultSet, int i) throws SQLException { return (Integer) resultSet.getObject(1); } }, parameterSource); }</code><technical_language>Please perform new a static field</technical_language>

Target:
public int getQuotaCount() { MapSqlParameterSource parameterSource = new MapSqlParameterSource(); return getCallsHandler().executeRead("get_quota_count", intMapper, parameterSource).intValue(); }
Source:
<code>public void run() { if (_enablePartitionAssignment) { <START> _datastreamTask.acquire(ACQUIRE_TIMEOUT); <END> } super.run(); }</code><technical_language>if time out</technical_language>

Target:
public void run() { if (_enablePartitionAssignment) { try { _datastreamTask.acquire(LOCK_ACQUIRE_TIMEOUT); } catch (DatastreamRuntimeException ex) { LOG.error("Failed to acquire lock for datastreamTask {}", _datastreamTask); _dynamicMetricsManager.createOrUpdateMeter(CLASS_NAME, NUM_LOCK_FAILS, 1); throw ex; } } super.run(); }
Source:
<code>public ImageDescriptor getImageDescriptor() { if (fImageDescriptor == null) { String path = fConfig.getAttribute("icon"); if (path != null) { <START> fImageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(fConfig.getNamespaceIdentifier(), path); <END> } } return fImageDescriptor; }</code><technical_language>JFYI, is a org.eclipse.jface.resource.ResourceLocator.imageDescriptorFromBundle(String bundleSymbolicName, String imageFilePath)</technical_language>

Target:
public ImageDescriptor getImageDescriptor() { if (fImageDescriptor == null) { String path = fConfig.getAttribute("icon"); if (path != null) { fImageDescriptor = ResourceLocator.imageDescriptorFromBundle(fConfig.getNamespaceIdentifier(), path) .orElse(null); } } return fImageDescriptor; }
Source:
<code>public HelperPublisher(final int from, final int to, final Function<Integer, T> create, final Executor executor) { super(new Iterable<T>() { { if(from > to) throw new IllegalArgumentException("from must be equal or greater than to!"); } @Override public Iterator<T> iterator() { return new Iterator<T>() { private int at = from; @Override public boolean hasNext() { return at < to; } @Override public T next() { if (!hasNext()) return Collections.<T>emptyList().iterator().next(); else try { return create.apply(at++); } catch (Throwable t) { throw new HelperPublisherException( <START> String.format("Failed to create element in %s for id %s!", getClass().getSimpleName(), at - 1), t); <END> } } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }, executor); }</code><technical_language>purpose of "getClass().getSimpleName()"</technical_language>

Target:
public HelperPublisher(final int from, final int to, final Function<Integer, T> create, final Executor executor) { super(new Iterable<T>() { { if(from > to) throw new IllegalArgumentException("from must be equal or greater than to!"); } @Override public Iterator<T> iterator() { return new Iterator<T>() { private int at = from; @Override public boolean hasNext() { return at < to; } @Override public T next() { if (!hasNext()) return Collections.<T>emptyList().iterator().next(); else try { return create.apply(at++); } catch (Throwable t) { throw new IllegalStateException(String.format("Failed to create element for id %d!", at - 1), t); } } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }, executor); }
Source:
<code>public Optional<JmxDump> getJMXDump() { out.println( "Finding running instance of neo4j" ); Optional<Long> pid = getPid(); if ( pid.isPresent() ) { try { LocalVirtualMachine vm = LocalVirtualMachine.from( pid.get() ); out.println( "Attached to running process with process id " + pid.get() ); try { JmxDump jmxDump = JmxDump.connectTo( vm.getJmxAddress() ); jmxDump.attachSystemProperties( vm.getSystemProperties() ); out.println( "Connected to JMX endpoint" ); return Optional.of( jmxDump ); } catch ( IOException e ) { printError( "Unable to communicate with JMX endpoint. Reason: " + e.getMessage(), e ); } } catch ( Throwable e ) { if ( e instanceof IOException ) { printError( "Unable to connect to process. Reason: " + e.getMessage(), e ); } else if ( e instanceof java.lang.NoClassDefFoundError ) { printError( "Unable to attach to process. Reason: JDK is not available, please point " + "environment variable JAVA_HOME to a valid JDK location.", e); } else { throw new RuntimeException( e ); <START> } <END> } } else { out.println( "No running instance of neo4j was found. Online reports will be omitted." ); } return Optional.empty(); }</code><technical_language>instanceof instead of multiple catch blocks</technical_language>

Target:
public Optional<JmxDump> getJMXDump() { out.println( "Finding running instance of neo4j" ); Optional<Long> pid = getPid(); if ( pid.isPresent() ) { try { LocalVirtualMachine vm = LocalVirtualMachine.from( pid.get() ); out.println( "Attached to running process with process id " + pid.get() ); try { JmxDump jmxDump = JmxDump.connectTo( vm.getJmxAddress() ); jmxDump.attachSystemProperties( vm.getSystemProperties() ); out.println( "Connected to JMX endpoint" ); return Optional.of( jmxDump ); } catch ( IOException e ) { printError( "Unable to communicate with JMX endpoint. Reason: " + e.getMessage(), e ); } } catch ( java.lang.NoClassDefFoundError e ) { printError( "Unable to attach to process. Reason: JDK is not available, please point " + "environment variable JAVA_HOME to a valid JDK location.", e); } catch ( IOException e ) { printError( "Unable to connect to process. Reason: " + e.getMessage(), e ); } } else { out.println( "No running instance of neo4j was found. Online reports will be omitted." ); } return Optional.empty(); }
Source:
<code>private static boolean sameConstraintWhenSameProgramPoint(ExplodedGraph.Node currentNode, Symbol symbol, Class<? extends Constraint> domain) { ProgramState programState = currentNode.programState; SymbolicValue sv = programState.getValue(symbol); if (sv == null) { return false; } Constraint constraint = programState.getConstraint(sv, domain); if (constraint == null) { return false; } Collection<Node> siblingNodes = currentNode.siblings(); <START> return siblingNodes.isEmpty() || siblingNodes.stream() <END> .map(node -> node.programState) .allMatch(ps -> { SymbolicValue siblingSV = ps.getValue(symbol); if (siblingSV == null) { return false; } Constraint siblingConstraint = ps.getConstraint(siblingSV, domain); return constraint.equals(siblingConstraint); }); }</code><technical_language>allMatch returns true for empty stream, separate test for emptiness is necessary</technical_language>

Target:
private static boolean sameConstraintWhenSameProgramPoint(ExplodedGraph.Node currentNode, Symbol symbol, Class<? extends Constraint> domain) { ProgramState programState = currentNode.programState; SymbolicValue sv = programState.getValue(symbol); if (sv == null) { return false; } Constraint constraint = programState.getConstraint(sv, domain); if (constraint == null) { return false; } Collection<Node> siblingNodes = currentNode.siblings(); return siblingNodes.stream() .map(node -> node.programState) .allMatch(ps -> { SymbolicValue siblingSV = ps.getValue(symbol); if (siblingSV == null) { return false; } Constraint siblingConstraint = ps.getConstraint(siblingSV, domain); return constraint.equals(siblingConstraint); }); }
Source:
<code>public <VO, VR> KStream<K, VR> join(final KStream<K, VO> otherStream, final ValueJoiner<? super V, ? super VO, ? extends VR> joiner, final JoinWindows windows, final StreamJoined<K, V, VO> streamJoined) { return doJoin( <START> otherStream, <END> joiner, windows, streamJoined, new KStreamImplJoin(this, false, false) ); }</code><technical_language>nit: doJoin(otherStream, (no new line)</technical_language>

Target:
public <VO, VR> KStream<K, VR> join(final KStream<K, VO> otherStream, final ValueJoiner<? super V, ? super VO, ? extends VR> joiner, final JoinWindows windows, final StreamJoined<K, V, VO> streamJoined) { return doJoin(otherStream, joiner, windows, streamJoined, new KStreamImplJoin(builder, false, false) ); }
Source:
<code>private boolean iterateOverQuark(ITmfStateSystem stateSystem, int quark, String[] subAttributePath, IProgressMonitor monitor) { try { long curTime = stateSystem.getStartTime(); long limit = stateSystem.getCurrentEndTime(); while (curTime > stateSystem.getCurrentEndTime()) { <START> stateSystem.waitUntilBuilt(500); <END> } while (curTime < limit) { if (monitor.isCanceled()) { return false; } int callStackQuark = stateSystem.getQuarkRelative(quark, subAttributePath); fCurrentQuarks = stateSystem.getSubAttributes(callStackQuark, false); if (fCurrentQuarks.isEmpty()) { return false; } final int depth = 0; int quarkParent = fCurrentQuarks.get(depth); ITmfStateInterval interval = stateSystem.querySingleState(curTime, quarkParent); ITmfStateValue stateValue = interval.getStateValue(); if (!stateValue.isNull()) { long intervalStart = interval.getStartTime(); long intervalEnd = interval.getEndTime(); CalledFunction segment = new CalledFunction(intervalStart, intervalEnd + 1, stateValue.unboxLong(), depth); boolean findChildren = findChildren(segment, depth, stateSystem, fCurrentQuarks.size() + fCurrentQuarks.get(depth), monitor); fRootFunctions.add(segment); if (!findChildren) { return false; } } curTime = interval.getEndTime() + 1; } } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { Activator.getInstance().logError(Messages.QueringStateSystemError, e); return false; } return true; }</code><technical_language>waited for module completion earlier, wait also. if is completed, updating limit here, in while below, limit end of state system</technical_language>

Target:
private boolean iterateOverQuark(ITmfStateSystem stateSystem, int quark, String[] subAttributePath, IProgressMonitor monitor) { try { long curTime = stateSystem.getStartTime(); long limit = stateSystem.getCurrentEndTime(); while (curTime < limit) { if (monitor.isCanceled()) { return false; } int callStackQuark = stateSystem.getQuarkRelative(quark, subAttributePath); fCurrentQuarks = stateSystem.getSubAttributes(callStackQuark, false); if (fCurrentQuarks.isEmpty()) { return false; } final int depth = 0; int quarkParent = fCurrentQuarks.get(depth); ITmfStateInterval interval = stateSystem.querySingleState(curTime, quarkParent); ITmfStateValue stateValue = interval.getStateValue(); if (!stateValue.isNull()) { long intervalStart = interval.getStartTime(); long intervalEnd = interval.getEndTime(); CalledFunction segment = new CalledFunction(intervalStart, intervalEnd + 1, stateValue.unboxLong(), depth); fRootFunctions.add(segment); if (!findChildren(segment, depth, stateSystem, fCurrentQuarks.size() + fCurrentQuarks.get(depth), monitor)) { return false; } } curTime = interval.getEndTime() + 1; } } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) { Activator.getInstance().logError(Messages.QueringStateSystemError, e); return false; } return true; }
Source:
<code>private Table addDataForTesting(String rowKeyPrefix, byte[] qualA) throws IOException { Table table = getConnection().getTable(TABLE_NAME); for (int i = 0; i < 100; i++) { String indexStr = String.valueOf(i); byte[] rowKey = Bytes.toBytes(rowKeyPrefix + indexStr); Put put = new Put(rowKey).addColumn(COLUMN_FAMILY, qualA, Bytes.toBytes(indexStr)); <START> table.put(put); <END> } return table; }</code><technical_language>Please do a table.put(List<Put>) instead</technical_language>

Target:
private Table addDataForTesting(String rowKeyPrefix, byte[] qualA) throws IOException { Table table = getConnection().getTable(TABLE_NAME); List<Put> puts = new ArrayList<>(); for (int i = 0; i < 100; i++) { String indexStr = String.valueOf(i); byte[] rowKey = Bytes.toBytes(rowKeyPrefix + indexStr); puts.add(new Put(rowKey).addColumn(COLUMN_FAMILY, qualA, Bytes.toBytes(indexStr))); } table.put(puts); return table; }
Source:
<code>public <T> T getInitParameter(String name, Class<T> clazz) { Object o = properties.get(name); if (o != null) { if (clazz.isInstance(o)) { return (T) properties.get(name); } else throw new ClassCastException(name + " property is not of type " + clazz.getCanonicalName()); <START> } else return null; <END> }</code><technical_language>need explicit block</technical_language>

Target:
public <T> T getInitParameter(String name, Class<T> clazz) { Object o = properties.get(name); if (o != null) { if (clazz.isInstance(o)) { return (T) properties.get(name); } else { throw new ClassCastException(name + " property is not of type " + clazz.getCanonicalName()); } } else { return null; } }
Source:
<code>protected PatchSetDetail getPatchSetDetail(PatchSet.Id idBase, PatchSet.Id idTarget, IProgressMonitor monitor) throws GerritException { <START> PatchSetDetail patchSetDetail = null; <END> if (!GerritVersion.isVersion2120OrLater(getVersion())) { return super.getPatchSetDetail(idBase, idTarget, monitor); } else { patchSetDetail = new PatchSetDetail(); CommitInfo commitInfo = retrieveCommitInfo(idTarget, monitor); patchSetDetail.setInfo(adaptRestPatchSetInfo(commitInfo, idTarget)); patchSetDetail.setPatchSet(adaptRestPatchSet(commitInfo, idTarget)); patchSetDetail.setPatches(adaptRestPatches(idTarget, monitor)); } return patchSetDetail; }</code><technical_language>Generally, initializing a variable a garbage is a bad practice. Consider moving declaration line 94</technical_language>

Target:
protected PatchSetDetail getPatchSetDetail(PatchSet.Id idBase, PatchSet.Id idTarget, IProgressMonitor monitor) throws GerritException { if (!GerritVersion.isVersion2120OrLater(getVersion())) { return super.getPatchSetDetail(idBase, idTarget, monitor); } PatchSetDetail patchSetDetail = new PatchSetDetail(); CommitInfo commitInfo = retrieveCommitInfo(idTarget, monitor); patchSetDetail.setInfo(adaptRestPatchSetInfo(commitInfo, idTarget)); patchSetDetail.setPatchSet(adaptRestPatchSet(commitInfo, idTarget)); patchSetDetail.setPatches(adaptRestPatches(idTarget, monitor)); return patchSetDetail; }
Source:
<code>private Artifact getTopContainer() throws OseeCoreException { Artifact root = null; if (this.equals(OseeSystemArtifacts.getDefaultHierarchyRootArtifact(getBranch()))) { root = this; } else { for (Artifact parent = getParent(); parent != null; parent = parent.getParent()) { root = parent; <START> } <END> } return root; }</code><technical_language>some kind of cycle detection here. org.eclipse.osee.framework.core.dsl.ui.integration.ArtifactDataProviderImpl - getHierarchy method for example</technical_language>

Target:
private Artifact getTopContainer() throws OseeCoreException { Artifact root = null; if (this.equals(OseeSystemArtifacts.getDefaultHierarchyRootArtifact(getBranch()))) { root = this; } else { Set<Artifact> set = new HashSet<Artifact>(); set.add(this); for (Artifact parent = getParent(); parent != null; parent = parent.getParent()) { if (set.add(parent)) { root = parent; } else { OseeLog.log(Activator.class, Level.SEVERE, String.format("Cycle detected with artifact: %s", parent)); root = null; break; } } } return root; }
Source:
<code>private void restoreNote(NotebookSocket conn, Message fromMessage) throws IOException { String noteId = (String) fromMessage.get("id"); if (noteId == null) { return; } <START> NotebookService notebookService = new NotebookService(notebook()); <END> notebookService.restoreNote(noteId, getServiceContext(fromMessage), new WebSocketServiceCallback<Note>(conn)); }</code><technical_language>this, too</technical_language>

Target:
private void restoreNote(NotebookSocket conn, Message fromMessage) throws IOException { String noteId = (String) fromMessage.get("id"); if (noteId == null) { return; } getNotebookService().restoreNote(noteId, getServiceContext(fromMessage), new WebSocketServiceCallback<Note>(conn)); }
Source:
<code>private static void loadExtensions(ModuleService moduleService, Map<String, Object> argMap) { ExtensionsManager extensionsManager = new ExtensionsManager(); <START> moduleService.getContext().put(ModuleService.EXTENSION_MANAGER, extensionsManager); <END> Map<String, ExtensionProxy> proxies = moduleService.getContext().get(ModuleService.EXTENSIONS_MAP); List<File> files = (List<File>)argMap.get("extension-file"); if(files == null) { files = listFiles( ((String) argMap.get("extensions-dir")).replace("@ENGINE_ETC@", ENGINE_ETC), "properties" ); } for(File f : files) { logger.debug("Loading extension file '{}'", f.getName()); try { proxies.put(extensionsManager.load(f), null); } catch (Exception ex) { logger.error(ex.getMessage()); logger.debug("Exception:", ex); } } for(Map.Entry<String, ExtensionProxy> entry : proxies.entrySet()) { extensionsManager.initialize(entry.getKey()); entry.setValue(extensionsManager.getExtensionByName(entry.getKey())); logger.debug("Extension '{}' initilized", entry.getKey()); } }</code><technical_language>this belongs previous patch, no</technical_language>

Target:
private static void loadExtensions(ModuleService moduleService, Map<String, Object> argMap) { ExtensionsManager extensionsManager = new ExtensionsManager(); moduleService.getContext().put(ModuleService.EXTENSION_MANAGER, extensionsManager); Map<String, ExtensionProxy> proxies = moduleService.getContext().get(ModuleService.EXTENSIONS_MAP); List<File> files = (List<File>)argMap.get("extension-file"); if(files == null) { files = listFiles( ((String) argMap.get("extensions-dir")).replace("@ENGINE_ETC@", ENGINE_ETC), "properties" ); } for(File f : files) { logger.debug("Loading extension file '{}'", f.getName()); try { proxies.put(extensionsManager.load(f), null); } catch (Exception ex) { logger.error("Can't load extension '{}', ignoring.", f.getName()); logger.debug("Exception:", ex); } } for(Map.Entry<String, ExtensionProxy> entry : proxies.entrySet()) { extensionsManager.initialize(entry.getKey()); entry.setValue(extensionsManager.getExtensionByName(entry.getKey())); logger.debug("Extension '{}' initilized", entry.getKey()); } }
Source:
<code>public static ConfigSyntax syntaxFromExtension(String filename) { if (filename == null) return null; <START> if (filename.endsWith(".json")) <END> return ConfigSyntax.JSON; else if (filename.endsWith(".conf")) return ConfigSyntax.CONF; else if (filename.endsWith(".properties")) return ConfigSyntax.PROPERTIES; else return null; }</code><technical_language>this "else if" I think</technical_language>

Target:
public static ConfigSyntax syntaxFromExtension(String filename) { if (filename == null) return null; else if (filename.endsWith(".json")) return ConfigSyntax.JSON; else if (filename.endsWith(".conf")) return ConfigSyntax.CONF; else if (filename.endsWith(".properties")) return ConfigSyntax.PROPERTIES; else return null; }
Source:
<code>public void onRecipeCraftedEvent(OnRecipeCrafted event, EntityRef entity) { EntityRef ingredients[] = event.getIngredients(); <START> LOGGER.info(ingredients[0].getComponent(GenomeComponent.class).genes); <END> LOGGER.info(ingredients[1].getComponent(GenomeComponent.class).genes); LOGGER.info(entity.toString()); SimpleGenomeManager genomeManager = new SimpleGenomeManager(); boolean result = genomeManager.applyBreeding(ingredients[0], ingredients[1], entity); LOGGER.info(result + ""); if (entity.hasComponent(GenomeComponent.class)) { GenomeMap genomeMap = genomeRegistry.getGenomeDefinition(entity.getComponent(GenomeComponent.class).genomeId).getGenomeMap(); float newFilling = genomeMap.getProperty("filling", entity.getComponent(GenomeComponent.class).genes, Float.class); entity.send(new ModifyFilling(newFilling)); } }</code><technical_language>Logging removed merge</technical_language>

Target:
public void onRecipeCraftedEvent(OnRecipeCrafted event, EntityRef entity) { EntityRef ingredients[] = event.getIngredients(); if (ingredients.length != 2) { return; } if (!(ingredients[0].hasComponent(GenomeComponent.class) || ingredients[1].hasComponent(GenomeComponent.class))) { return; } SimpleGenomeManager genomeManager = new SimpleGenomeManager(); boolean result = genomeManager.applyBreeding(ingredients[0], ingredients[1], entity); if (entity.hasComponent(GenomeComponent.class)) { GenomeMap genomeMap = genomeRegistry.getGenomeDefinition(entity.getComponent(GenomeComponent.class).genomeId).getGenomeMap(); float newFilling = genomeMap.getProperty("filling", entity.getComponent(GenomeComponent.class).genes, Float.class); entity.send(new ModifyFilling(newFilling)); } }
Source:
<code><START> public Vector2 worldToScreen(SolShip ship) { <END> Vector2 distanceDifference = new Vector2(this.getPosition()); distanceDifference.sub(ship.getPosition()); distanceDifference.x /= this.getViewWidth(); distanceDifference.x = .5f - distanceDifference.x; distanceDifference.y /= this.getViewHeight(); distanceDifference.y = .5f - distanceDifference.y; distanceDifference.y -= .1f; return distanceDifference; }</code><technical_language>Please try do similar is in screenToWorld. Also, return position, offset y do (offest in usage if needed)</technical_language>

Target:
public Vector2 worldToScreen(SolShip ship) { Vector2 distanceDifference = new Vector2(this.getPosition()); distanceDifference.sub(ship.getPosition()); distanceDifference.x /= this.getViewWidth(); distanceDifference.x = .5f - distanceDifference.x; distanceDifference.y /= this.getViewHeight(); distanceDifference.y = .5f - distanceDifference.y; return distanceDifference; }
Source:
<code><START> protected RulesCache( @GerritServerConfig Config config, SitePaths site) { <END> this.config = config; this.site = site; }</code><technical_language>Style-nit: Space "("</technical_language>

Target:
protected RulesCache ( @GerritServerConfig Config config, SitePaths site) { this.cacheDir = site.resolve( config.getString("cache", null, "directory")); if (this.cacheDir != null) { this.rulesDir = new File(cacheDir, "rules"); } else { this.rulesDir = null; } }
Source:
<code>public void load() { images.clear(); File brushDir = new File(worldEdit.getPlatformManager().getConfiguration().getWorkingDirectory(), "brushes"); if (!brushDir.exists() || !brushDir.isDirectory()) { return; } for (File file : brushDir.listFiles()) { String fileName = file.getName(); if (fileName.indexOf(' ') != -1) { <START> logger.warn("Brush file '{}' contains spaces.", fileName); <END> continue; } BufferedImage image; try { image = ImageIO.read(file); } catch (IOException e) { logger.error("Error reading file from brushes directory", e); continue; } int index = fileName.lastIndexOf('.'); String brushName = index != -1 ? fileName.substring(0, index) : fileName; images.put(brushName.toLowerCase(Locale.ROOT), image); } if (!images.isEmpty()) { logger.info("Loaded image brushes", images.size()); } }</code><technical_language>This... issue? Arguments spaces "", I a reason ban spaces</technical_language>

Target:
public void load() { images.clear(); File brushDir = new File(worldEdit.getPlatformManager().getConfiguration().getWorkingDirectory(), "brushes"); if (!brushDir.exists() || !brushDir.isDirectory()) { return; } for (File file : brushDir.listFiles()) { BufferedImage image; try { image = ImageIO.read(file); } catch (IOException e) { logger.error("Error reading file from brushes directory", e); continue; } String fileName = file.getName(); int index = fileName.lastIndexOf('.'); String brushName = index != -1 ? fileName.substring(0, index) : fileName; images.put(brushName.toLowerCase(Locale.ROOT), image); } if (!images.isEmpty()) { logger.info("Loaded image brushes", images.size()); } }