auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public String getFingerprint() { <END> InstanceIdentityProvider<RSAPublicKey, RSAPrivateKey> provider = InstanceIdentityProvider.get(RSAPrivateKey.class); RSAPublicKey key = provider == null ? null : provider.getPublicKey(); return key == null ? null : KeyUtils.fingerprint(key); }</code><technical_language>ant: deserves a test</technical_language>

Target:
public String getFingerprint() { RSAPublicKey key = InstanceIdentityProvider.RSA.getPublicKey(); if (key == null) { return null; } try { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.reset(); byte[] bytes = digest.digest(key.getEncoded()); StringBuilder result = new StringBuilder(Math.max(0, bytes.length * 3 - 1)); for (int i = 0; i < bytes.length; i++) { if (i > 0) { result.append(':'); } int b = bytes[i] & 0xFF; result.append(Character.forDigit((b>>4)&0x0f, 16)).append(Character.forDigit(b&0xf, 16)); } return result.toString(); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("JLS mandates MD5 support"); } }
Source:
<code>public DataSection isSolvedBody(Patient patient) { String sectionName = "isSolved"; Set<String> present = this.enabledHeaderIdsBySection.get(sectionName); if (present == null || present.isEmpty()) { return null; } DataSection bodySection = new DataSection(); PatientData<SolvedData> patientData = patient.getData("solved"); SolvedData data = patientData != null ? patientData.getValue() : null; int x = 0; if (present.contains(SolvedData.STATUS_PROPERTY_NAME)) { <START> String solved = data != null ? data.getStatus() : null; <END> DataCell cell = new DataCell(solved != null ? ConversionHelpers.strIntegerToStrBool(solved) : "", x, 0); bodySection.addCell(cell); x++; } if (present.contains(SolvedData.PUBMED_ID_PROPERTY_NAME)) { List<String> pubmedIds = data != null ? data.getPubmedIds() : null; if (!pubmedIds.isEmpty()) { int y = 0; for (String id : pubmedIds) { DataCell cell = new DataCell(StringUtils.isBlank(id) ? "" : id, x, y); bodySection.addCell(cell); y++; } x++; } } if (present.contains(SolvedData.NOTES_PROPERTY_NAME)) { String solvedNotes = data != null ? data.getNotes() : null; for (DataCell cell : ConversionHelpers.preventOverflow(solvedNotes, x, 0)) { cell.setMultiline(); bodySection.addCell(cell); } x++; } return bodySection; }</code><technical_language>Java 8, do String solved = data?.getStatus();</technical_language>

Target:
public DataSection isSolvedBody(Patient patient) { String sectionName = "isSolved"; Set<String> present = this.enabledHeaderIdsBySection.get(sectionName); if (present == null || present.isEmpty()) { return null; } DataSection bodySection = new DataSection(); PatientData<SolvedData> patientData = patient.getData("solved"); SolvedData data = patientData != null ? patientData.getValue() : null; int x = 0; if (present.contains(SolvedData.STATUS_PROPERTY_NAME)) { String solved = data != null ? data.getStatus() : null; DataCell cell = new DataCell(solved != null ? ConversionHelpers.strIntegerToStrBool(solved) : "", x, 0); bodySection.addCell(cell); x++; } if (present.contains(SolvedData.PUBMED_ID_PROPERTY_NAME)) { List<String> pubmedIds = data != null ? data.getPubmedIds() : Collections.emptyList(); if (!pubmedIds.isEmpty()) { int y = 0; for (String id : pubmedIds) { DataCell cell = new DataCell(StringUtils.isBlank(id) ? "" : id, x, y); bodySection.addCell(cell); y++; } x++; } } if (present.contains(SolvedData.NOTES_PROPERTY_NAME)) { String solvedNotes = data != null ? data.getNotes() : null; for (DataCell cell : ConversionHelpers.preventOverflow(solvedNotes, x, 0)) { cell.setMultiline(); bodySection.addCell(cell); } x++; } return bodySection; }
Source:
<code>public boolean process(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { Object apiTokenValid = request.getAttribute(BasicHeaderApiTokenAuthenticator.class.getName()); <START> if (apiTokenValid != null && apiTokenValid == Boolean.TRUE) { <END> chain.doFilter(request, response); return true; } return false; }</code><technical_language>i.e., java if (Boolean.TRUE.equals(request.getAttribute(BasicHeaderApiTokenAuthenticator.class.getName())) {</technical_language>

Target:
public boolean process(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { if (Boolean.TRUE.equals(request.getAttribute(BasicHeaderApiTokenAuthenticator.class.getName()))) { chain.doFilter(request, response); return true; } return false; }
Source:
<code>public static ImmutableBitmap matchPredicate( final String dimension, final BitmapIndexSelector selector, final Predicate<String> predicate ) { if (predicate == null) { <START> return selector.getBitmapFactory().makeEmptyImmutableBitmap(); <END> } final Indexed<String> dimValues = selector.getDimensionValues(dimension); if (dimValues == null || dimValues.size() == 0) { if (predicate.apply(null)) { return selector.getBitmapFactory().complement( selector.getBitmapFactory().makeEmptyImmutableBitmap(), selector.getNumRows() ); } else { return selector.getBitmapFactory().makeEmptyImmutableBitmap(); } } final BitmapIndex bitmapIndex = selector.getBitmapIndex(dimension); return selector.getBitmapFactory().union( new Iterable<ImmutableBitmap>() { @Override public Iterator<ImmutableBitmap> iterator() { return new Iterator<ImmutableBitmap>() { int currIndex = 0; @Override public boolean hasNext() { return currIndex < bitmapIndex.getCardinality(); } @Override public ImmutableBitmap next() { while (currIndex < bitmapIndex.getCardinality() && !predicate.apply(dimValues.get(currIndex))) { currIndex++; } if (currIndex == bitmapIndex.getCardinality()) { return bitmapIndex.getBitmapFactory().makeEmptyImmutableBitmap(); } return bitmapIndex.getBitmap(currIndex++); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } } ); }</code><technical_language>I in DimensionPredicateFilter 'no predicate' 'matches all'</technical_language>

Target:
public static ImmutableBitmap matchPredicate( final String dimension, final BitmapIndexSelector selector, final Predicate<String> predicate ) { Preconditions.checkNotNull(dimension, "dimension"); Preconditions.checkNotNull(selector, "selector"); Preconditions.checkNotNull(predicate, "predicate"); final Indexed<String> dimValues = selector.getDimensionValues(dimension); if (dimValues == null || dimValues.size() == 0) { if (predicate.apply(null)) { return selector.getBitmapFactory().complement( selector.getBitmapFactory().makeEmptyImmutableBitmap(), selector.getNumRows() ); } else { return selector.getBitmapFactory().makeEmptyImmutableBitmap(); } } final BitmapIndex bitmapIndex = selector.getBitmapIndex(dimension); return selector.getBitmapFactory().union( new Iterable<ImmutableBitmap>() { @Override public Iterator<ImmutableBitmap> iterator() { return new Iterator<ImmutableBitmap>() { int currIndex = 0; @Override public boolean hasNext() { return currIndex < bitmapIndex.getCardinality(); } @Override public ImmutableBitmap next() { while (currIndex < bitmapIndex.getCardinality() && !predicate.apply(dimValues.get(currIndex))) { currIndex++; } if (currIndex == bitmapIndex.getCardinality()) { return bitmapIndex.getBitmapFactory().makeEmptyImmutableBitmap(); } return bitmapIndex.getBitmap(currIndex++); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } } ); }
Source:
<code>@Test public final void blankNodesTest() throws IOException { Dataset ds = null; Model m = ModelFactory.createDefaultModel(); Model m2 = ModelFactory.createDefaultModel(); ds = DatasetFactory.create(m); String namedModelName = "<LINK_0>"; ds.addNamedModel(namedModelName, m2); Resource s = m.createResource(); m.add(s, RDFS.label, "blank node 1 in default graph"); s = m2.createResource(); m2.add(s, RDFS.label, "blank node 2 in named graph"); s = m.createResource(AnonId.create("_:foo")); m.add(s, RDFS.label, "_:foo in default graph"); s = m2.createResource(AnonId.create("_:foo")); m2.add(s, RDFS.label, "_:foo in named graph"); s = m.createResource(AnonId.create("xxx")); m.add(s, RDFS.label, "xxx in default"); s = m2.createResource(AnonId.create("xxx")); m2.add(s, RDFS.label, "xxx in named"); s = m.createResource(AnonId.create("_:b0")); m.add(s, RDFS.label, "? in default graph"); s = m2.createResource(AnonId.create("_:b0")); m2.add(s, RDFS.label, "? in named graph"); String jsonld = dataset2jsonld(ds.asDatasetGraph(), RDFFormat.JSONLD, null); System.out.println(jsonld); <START> assertTrue(jsonld.indexOf("\"_:foo\"") > -1); <END> assertTrue(jsonld.indexOf("\"xxx\"") < 0); Dataset ds2 = jsonld2dataset(jsonld, null); assertTrue(ds2.getDefaultModel().isIsomorphicWith(ds.getDefaultModel())); assertTrue(ds2.getNamedModel(namedModelName).isIsomorphicWith(ds.getNamedModel(namedModelName))); }</code><technical_language>if ( jsonld.contains("\"_:foo\"") )</technical_language>

Target:
@Test public final void blankNodesTest() throws IOException { Dataset ds = null; Model m = ModelFactory.createDefaultModel(); Model m2 = ModelFactory.createDefaultModel(); ds = DatasetFactory.create(m); String namedModelName = "<LINK_0>"; ds.addNamedModel(namedModelName, m2); Resource s = m.createResource(); m.add(s, RDFS.label, "blank node 1 in default graph"); s = m2.createResource(); m2.add(s, RDFS.label, "blank node 2 in named graph"); s = m.createResource(AnonId.create("_:foo")); m.add(s, RDFS.label, "_:foo in default graph"); s = m2.createResource(AnonId.create("_:foo")); m2.add(s, RDFS.label, "_:foo in named graph"); s = m.createResource(AnonId.create("xxx")); m.add(s, RDFS.label, "xxx in default"); s = m2.createResource(AnonId.create("xxx")); m2.add(s, RDFS.label, "xxx in named"); s = m.createResource(AnonId.create("_:b0")); m.add(s, RDFS.label, "? in default graph"); s = m2.createResource(AnonId.create("_:b0")); m2.add(s, RDFS.label, "? in named graph"); String jsonld = dataset2jsonld(ds.asDatasetGraph(), RDFFormat.JSONLD, null); System.out.println(jsonld); assertTrue(jsonld.contains("\"_:foo\"")); assertFalse(jsonld.contains("\"xxx\"")); Dataset ds2 = jsonld2dataset(jsonld, null); assertTrue(ds2.getDefaultModel().isIsomorphicWith(ds.getDefaultModel())); assertTrue(ds2.getNamedModel(namedModelName).isIsomorphicWith(ds.getNamedModel(namedModelName))); }
Source:
<code>public ServerConfigResource(ServerInventory serverInventory, ControlledProcessState processState, String serverName, File domainDataDir, Resource delegate) { super(delegate); this.serverInventory = serverInventory; this.serverName = serverName; this.processState = processState; <START> this.autoStartDataDir = Paths.get(domainDataDir.toURI()).resolve("auto-start"); <END> try { if (Files.notExists(autoStartDataDir)) { Files.createDirectory(autoStartDataDir); } } catch (IOException ex) { HostControllerLogger.ROOT_LOGGER.couldNotCreateDomainAutoStartDirectory(autoStartDataDir, ex); } }</code><technical_language>domainDataDir.toPath()</technical_language>

Target:
public ServerConfigResource(ServerInventory serverInventory, ControlledProcessState processState, String serverName, File domainDataDir, Resource delegate) { super(delegate); this.serverInventory = serverInventory; this.serverName = serverName; this.processState = processState; this.autoStartDataDir = domainDataDir.toPath().resolve("auto-start"); try { if (Files.notExists(autoStartDataDir)) { Files.createDirectory(autoStartDataDir); } } catch (IOException ex) { throw HostControllerLogger.ROOT_LOGGER.couldNotCreateDomainAutoStartDirectory(autoStartDataDir, ex); } }
Source:
<code>public void bulkUpdateAgentAttributes(AgentInstances agentInstances, final Username username, final LocalizedOperationResult result, final List<String> uuids, final List<String> resourcesToAdd, final List<String> resourcesToRemove, final List<String> environmentsToAdd, final List<String> environmentsToRemove, final TriState enable) { Localizable.CurryableLocalizable successMessage = LocalizedMessage.string("BULK_AGENT_UPDATE_SUCESSFUL", StringUtils.join(uuids, ", ")); EntityConfigUpdateCommand<Agents> agentsEntityConfigUpdateCommand = new AgentsEntityConfigUpdateCommand(agentInstances, username, result, uuids, environmentsToAdd, environmentsToRemove, enable, resourcesToAdd, resourcesToRemove, goConfigService); try { goConfigService.updateConfig(agentsEntityConfigUpdateCommand, username); if(result.isSuccessful()){ result.setMessage(successMessage); } <START> } catch (Exception e) { <END> LOGGER.error("There was an error bulk updating agents", e); if (!result.hasMessage()) { result.internalServerError(LocalizedMessage.string("INTERNAL_SERVER_ERROR")); } } }</code><technical_language>Please check messages for validation errors (post validations). add errors agent config object throw GoConfigInvalidException, show 422 (unprocessable entity) instead of 500 (internal server error)</technical_language>

Target:
public void bulkUpdateAgentAttributes(AgentInstances agentInstances, final Username username, final LocalizedOperationResult result, final List<String> uuids, final List<String> resourcesToAdd, final List<String> resourcesToRemove, final List<String> environmentsToAdd, final List<String> environmentsToRemove, final TriState enable) { Localizable.CurryableLocalizable successMessage = LocalizedMessage.string("BULK_AGENT_UPDATE_SUCESSFUL", StringUtils.join(uuids, ", ")); EntityConfigUpdateCommand<Agents> agentsEntityConfigUpdateCommand = new AgentsEntityConfigUpdateCommand(agentInstances, username, result, uuids, environmentsToAdd, environmentsToRemove, enable, resourcesToAdd, resourcesToRemove, goConfigService); try { goConfigService.updateConfig(agentsEntityConfigUpdateCommand, username); if(result.isSuccessful()){ result.setMessage(successMessage); } } catch (Exception e) { LOGGER.error("There was an error bulk updating agents", e); if(e instanceof GoConfigInvalidException && !result.hasMessage()) { result.unprocessableEntity(LocalizedMessage.string("ENTITY_CONFIG_VALIDATION_FAILED", Agents.class.getAnnotation(ConfigTag.class).value(), uuids, e.getMessage())); } else if(!result.hasMessage()) { result.internalServerError(LocalizedMessage.string("INTERNAL_SERVER_ERROR")); } } }
Source:
<code>private static String languageCodeToSubdomain(@NonNull String languageCode) { switch (languageCode) { case AppLanguageLookUpTable.SIMPLIFIED_CHINESE_LANGUAGE_CODE: case AppLanguageLookUpTable.TRADITIONAL_CHINESE_LANGUAGE_CODE: return <START> Locale.CHINA.getLanguage(); <END> case AppLanguageLookUpTable.NORWEGIAN_BOKMAL_LANGUAGE_CODE: return AppLanguageLookUpTable.NORWEGIAN_LEGACY_LANGUAGE_CODE; default: return languageCode; } }</code><technical_language>I forever, this nervous? intent is for return "zh" I guaranteed. implemented a stub in source leaves open funny stuff. this return AppLanguageLookupTable.CHINESE_LANGUAGE_CODE instead</technical_language>

Target:
private static String languageCodeToSubdomain(@NonNull String languageCode) { switch (languageCode) { case AppLanguageLookUpTable.SIMPLIFIED_CHINESE_LANGUAGE_CODE: case AppLanguageLookUpTable.TRADITIONAL_CHINESE_LANGUAGE_CODE: return AppLanguageLookUpTable.CHINESE_LANGUAGE_CODE; case AppLanguageLookUpTable.NORWEGIAN_BOKMAL_LANGUAGE_CODE: return AppLanguageLookUpTable.NORWEGIAN_LEGACY_LANGUAGE_CODE; default: return languageCode; } }
Source:
<code>public void tearDown() throws SQLException { <START> TimeZone.setDefault(saveTZ); <END> TestUtil.dropTable(con, "table1"); TestUtil.closeDB(con); }</code><technical_language>If dedicated java.time methods TimestampUtils this longer necessary</technical_language>

Target:
public void tearDown() throws SQLException { TestUtil.dropTable(con, "table1"); TestUtil.closeDB(con); }
Source:
<code>public DescribeConfigsResponse(Struct struct, short version) { this.data = new DescribeConfigsResponseData(struct, version); if (version == 0) { for (DescribeConfigsResult result : data.results()) { <START> for (DescribeConfigsResponseData.DescribeConfigsResourceResult x : result.configs()) { <END> if (x.isDefault()) { x.setConfigSource(ConfigSource.DEFAULT_CONFIG.id); } else { if (result.resourceType() == ConfigResource.Type.BROKER.id()) { x.setConfigSource(ConfigSource.STATIC_BROKER_CONFIG.id); } else if (result.resourceType() == ConfigResource.Type.TOPIC.id()) { x.setConfigSource(ConfigSource.TOPIC_CONFIG.id); } else { x.setConfigSource(ConfigSource.UNKNOWN_CONFIG.id); } } } } } }</code><technical_language>give variable a name, config</technical_language>

Target:
public DescribeConfigsResponse(Struct struct, short version) { this.data = new DescribeConfigsResponseData(struct, version); if (version == 0) { for (DescribeConfigsResult result : data.results()) { for (DescribeConfigsResponseData.DescribeConfigsResourceResult config : result.configs()) { if (config.isDefault()) { config.setConfigSource(ConfigSource.DEFAULT_CONFIG.id); } else { if (result.resourceType() == ConfigResource.Type.BROKER.id()) { config.setConfigSource(ConfigSource.STATIC_BROKER_CONFIG.id); } else if (result.resourceType() == ConfigResource.Type.TOPIC.id()) { config.setConfigSource(ConfigSource.TOPIC_CONFIG.id); } else { config.setConfigSource(ConfigSource.UNKNOWN.id); } } } } } }
Source:
<code>public int isApplicable(VElement vElement, ViewModelContext context) { if (!VControl.class.isInstance(vElement)) { return NOT_APPLICABLE; } final VControl control = (VControl) vElement; final IObservableValue observableValue = Activator.getDefault().getEMFFormsDatabinding() .getObservableValue(control.getDomainModelReference(), context.getDomainModel()); final EStructuralFeature feature = (EStructuralFeature) observableValue.getValueType(); final EObject eObject = (EObject) ((IObserving) observableValue).getObserved(); <START> return isApplicable(feature, eObject); <END> }</code><technical_language>feature check enough</technical_language>

Target:
public int isApplicable(VElement vElement, ViewModelContext context) { if (!VControl.class.isInstance(vElement)) { return NOT_APPLICABLE; } final VControl control = (VControl) vElement; final IValueProperty valueProperty = Activator.getDefault().getEMFFormsDatabinding() .getValueProperty(control.getDomainModelReference()); final EStructuralFeature feature = (EStructuralFeature) valueProperty.getValueType(); return isApplicable(feature); }
Source:
<code>private URL createSimpleManagementOperationUrl() throws URISyntaxException, IOException { <START> return new URL("http://" + host + ":9990/management?operation=attribute&name=server-state"); <END> }</code><technical_language>This TestSuiteEnvironment.getServerPort() instead of hard-coded port</technical_language>

Target:
private URL createSimpleManagementOperationUrl() throws URISyntaxException, IOException { return new URL("http://" + TestSuiteEnvironment.getServerAddress() + ":" + TestSuiteEnvironment.getServerPort() + "/management?operation=attribute&name=server-state"); }
Source:
<code>public final void checkCreatePermission(@Nonnull ItemGroup c, @Nonnull TopLevelItemDescriptor d) { Authentication a = Jenkins.getAuthentication(); if (!hasCreatePermission(a, c, d)) { throw new AccessDeniedException(Messages.AccessDeniedException2_MissingPermission(a.getName(), <START> "Item/CREATE/" + d.getDisplayName())); <END> } }</code><technical_language>CREATE.getDisplayName() I guess</technical_language>

Target:
public final void checkCreatePermission(@Nonnull ItemGroup c, @Nonnull TopLevelItemDescriptor d) { Authentication a = Jenkins.getAuthentication(); if (!hasCreatePermission(a, c, d)) { throw new AccessDeniedException(Messages.AccessDeniedException2_MissingPermission(a.getName(), Item.CREATE.getDisplayName() + "/" + d.getDisplayName())); } }
Source:
<code>public Validation validate(Validation val) { <START> if (systemEnvironment.getPropertyImpl("jetty.home").equals("")) { <END> systemEnvironment.setProperty("jetty.home", systemEnvironment.getPropertyImpl("user.dir")); } systemEnvironment.setProperty("jetty.base", systemEnvironment.getPropertyImpl("jetty.home")); File home = new File(systemEnvironment.getPropertyImpl("jetty.home")); File work = new File(systemEnvironment.getPropertyImpl("jetty.home"), "work"); if (home.exists()) { if (work.exists()) { try { FileUtils.deleteDirectory(work); } catch (IOException e) { String message = format("Error trying to remove Jetty working directory {0}: {1}", work.getAbsolutePath(), e); return val.addError(new RuntimeException(message)); } } work.mkdir(); } return Validation.SUCCESS; }</code><technical_language>StringUtils.isBlank</technical_language>

Target:
public Validation validate(Validation val) { if (StringUtils.isBlank(systemEnvironment.getPropertyImpl("jetty.home"))) { systemEnvironment.setProperty("jetty.home", systemEnvironment.getPropertyImpl("user.dir")); } systemEnvironment.setProperty("jetty.base", systemEnvironment.getPropertyImpl("jetty.home")); File home = new File(systemEnvironment.getPropertyImpl("jetty.home")); File work = new File(systemEnvironment.getPropertyImpl("jetty.home"), "work"); if (home.exists()) { if (work.exists()) { try { FileUtils.deleteDirectory(work); } catch (IOException e) { String message = format("Error trying to remove Jetty working directory {0}: {1}", work.getAbsolutePath(), e); return val.addError(new RuntimeException(message)); } } work.mkdir(); } return Validation.SUCCESS; }
Source:
<code>private BuildCommand isRepositoryChanged(String workingDir) { return test("-ncontains", <START> "URL: " + StringUtil.removeTrailingSlash(material.getUrl()), <END> svn("info", "--non-interactive", workingDir)); }</code><technical_language>I a newline missing here. fails this test: @Test public void shouldCheckoutIfSvnRepositoryChangesToAParentRepo() throws IOException { String initialRepo = testRepo.projectRepositoryUrl(); runBuild(buildCommand("3", initialRepo), JobResult.Passed); assertThat(console.output(), containsString("Checked out revision 3")); String changedRepo = FileUtil.toFileURI(testRepo.projectRepositoryRoot()); runBuild(buildCommand("4", changedRepo), JobResult.Passed); assertThat(console.output(), containsString("Checked out revision 4")); assertThat(getWorkingDirInfo(workingCopy).getUrl() + "/", is(changedRepo)); } If is right, a removing + "/" in test</technical_language>

Target:
private BuildCommand isRepositoryChanged(String workingDir) { return test("-ncontains", "URL: " + StringUtil.removeTrailingSlash(material.getUrl()) + "\n", svn("info", "--non-interactive", workingDir)); }
Source:
<code>private void parseDelete(final ReceiveCommand cmd) { RefControl ctl = projectControl.controlForRef(cmd.getRefName()); if (ctl.canDelete()) { } else { if (GitRepositoryManager.REF_CONFIG.equals(ctl.getRefName())) { <START> reject(cmd, "Cannot delete project configuration"); <END> } else { addError(Error.DELETE, ctl.getRefName()); reject(cmd, String.format("%s cannot delete references", displayName(ctl))); } } }</code><technical_language>I starting a lowercase in status report git prints</technical_language>

Target:
private void parseDelete(final ReceiveCommand cmd) { RefControl ctl = projectControl.controlForRef(cmd.getRefName()); if (ctl.canDelete()) { } else { if (GitRepositoryManager.REF_CONFIG.equals(ctl.getRefName())) { reject(cmd, "cannot delete project configuration"); } else { addError(Error.DELETE, ctl); reject(cmd, "can not delete references"); } } }
Source:
<code>protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree firstArg = mit.arguments().get(0); ExpressionTree value = getValueOrPropertyDefaultValue(firstArg); <START> if (value.is(Tree.Kind.STRING_LITERAL)) { <END> checkIssue(firstArg, (LiteralTree) value); } }</code><technical_language>In [this check](<LINK_0>, similar ExpressionsHelper.getConstantValueAsString. want consistent. avoid trim quotes line 74</technical_language>

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree firstArg = mit.arguments().get(0); ExpressionTree defaultValue = JavaPropertiesHelper.retrievedPropertyDefaultValue(firstArg); String firstArgStringValue = ExpressionsHelper.getConstantValueAsString(defaultValue != null ? defaultValue : firstArg).value(); if (firstArgStringValue != null) { checkIssue(firstArg, firstArgStringValue); } }
Source:
<code><START> private Endpoint validateIntentForSessionEndpoint(Intent intent) { <END> String sessionEndpointId = intent.getStringExtra(SESSION_ENDPOINT_ID); Endpoint endpoint = CommCareApplication.instance().getCommCarePlatform().getEndpoint(sessionEndpointId); if (endpoint == null) { Hashtable<String, Endpoint> allEndpoints = CommCareApplication.instance().getCommCarePlatform().getAllEndpoints(); String invalidEndpointError = org.commcare.utils.StringUtils.getStringRobust( this, R.string.session_endpoint_unavailable, new String[]{ endpoint.getId(), StringUtils.join(allEndpoints.keySet(), ",")}); UserfacingErrorHandling.createErrorDialog(this, invalidEndpointError, true); return null; } Bundle intentArgumentsAsBundle = intent.getBundleExtra(SESSION_ENDPOINT_ARGUMENTS_BUNDLE); ArrayList intentArgumentsAsList = getIntent().getStringArrayListExtra(SESSION_ENDPOINT_ARGUMENTS_LIST); int numOfArgumentsInIntent = intentArgumentsAsBundle == null ? (intentArgumentsAsList == null ? 0 : intentArgumentsAsList.size()) : intentArgumentsAsBundle.size(); if (endpoint.getArguments().size() != numOfArgumentsInIntent) { String invalidEndpointArgsError = org.commcare.utils.StringUtils.getStringRobust( this, R.string.session_endpoint_invalid_arguments, new String[]{ endpoint.getId(), StringUtils.join(intentArgumentsAsBundle, ","), StringUtils.join(endpoint.getArguments(), ",")}); UserfacingErrorHandling.createErrorDialog(this, invalidEndpointArgsError, true); return null; } return endpoint; }</code><technical_language>do need check block line 219 if this validation code runs first</technical_language>

Target:
private Endpoint validateIntentForSessionEndpoint(Intent intent) { String sessionEndpointId = intent.getStringExtra(SESSION_ENDPOINT_ID); Endpoint endpoint = CommCareApplication.instance().getCommCarePlatform().getEndpoint(sessionEndpointId); if (endpoint == null) { Hashtable<String, Endpoint> allEndpoints = CommCareApplication.instance().getCommCarePlatform().getAllEndpoints(); String invalidEndpointError = org.commcare.utils.StringUtils.getStringRobust( this, R.string.session_endpoint_unavailable, new String[]{ endpoint.getId(), StringUtils.join(allEndpoints.keySet(), ",")}); UserfacingErrorHandling.createErrorDialog(this, invalidEndpointError, true); return null; } return endpoint; }
Source:
<code>protected void showOrHideNodeActions(boolean forLog, ProcessInstanceSummary processInstance) { if (forLog || processInstance.getState() != ProcessInstance.STATE_ACTIVE) { view.showOrHideNodeActions(false); <START> }else{ <END> view.showOrHideNodeActions(true); } }</code><technical_language>formatting</technical_language>

Target:
protected void showOrHideNodeActions(boolean forLog, ProcessInstanceSummary processInstance) { if (forLog || processInstance.getState() != ProcessInstance.STATE_ACTIVE) { view.hideNodeActions(); } else { view.showNodeActions(); } }
Source:
<code>public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { try { getJobManager().join(EasymportJob.class, monitor); } catch (InterruptedException ex) { throw new CoreException(new Status(IStatus.WARNING, Activator.getDefault().getBundle().getSymbolicName(), ex.getMessage(), ex)); } synchronized (this.toProcess) { this.started = true; } try { LifecycleMappingDiscoveryRequest discoveryRequest = LifecycleMappingDiscoveryHelper .createLifecycleMappingDiscoveryRequest(toProcess, monitor); if (discoveryRequest.isMappingComplete()) { return Status.OK_STATUS; } discoverProposals(discoveryRequest, monitor); openProposalWizard(toProcess, discoveryRequest); <START> this.toProcess.clear(); <END> } finally { this.toProcess.clear(); } return Status.OK_STATUS; }</code><technical_language>duplicate</technical_language>

Target:
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { try { getJobManager().join(EasymportJob.class, monitor); } catch (InterruptedException ex) { throw new CoreException(new Status(IStatus.WARNING, Activator.getDefault().getBundle().getSymbolicName(), ex.getMessage(), ex)); } synchronized (this.toProcess) { this.started = true; } try { LifecycleMappingDiscoveryRequest discoveryRequest = LifecycleMappingDiscoveryHelper .createLifecycleMappingDiscoveryRequest(toProcess, monitor); if (discoveryRequest.isMappingComplete()) { return Status.OK_STATUS; } discoverProposals(discoveryRequest, monitor); openProposalWizard(toProcess, discoveryRequest); } finally { this.toProcess.clear(); } return Status.OK_STATUS; }
Source:
<code>private void addActionsToToolbar() { importAction = new Action("Import...") { @Override public void run() { GitCloneWizard wiz = new GitCloneWizard(); wiz.init(null, null); new WizardDialog(getSite().getShell(), wiz).open(); updateDirStrings(new NullProgressMonitor()); } }; <START> importAction.setToolTipText("Import (clone) a Git Repository"); <END> getViewSite().getActionBars().getToolBarManager().add(importAction); addAction = new Action("Add...") { @Override public void run() { RepositorySearchDialog sd = new RepositorySearchDialog( getSite().getShell(), ResourcesPlugin.getWorkspace() .getRoot().getLocation().toOSString(), getGitDirs()); if (sd.open() == Window.OK) { Set<String> dirs = new HashSet<String>(); dirs.addAll(getGitDirs()); if (dirs.addAll(sd.getDirectories())) saveDirStrings(dirs); scheduleRefresh(); } } }; addAction.setToolTipText("Add an existing Git Repository"); getViewSite().getActionBars().getToolBarManager().add(addAction); refreshAction = new Action("Refresh") { @Override public void run() { scheduleRefresh(); } }; getViewSite().getActionBars().getToolBarManager().add(refreshAction); }</code><technical_language>this text needs externalized</technical_language>

Target:
private void addActionsToToolbar() { importAction = new Action( RepositoryViewUITexts.RepositoriesView_Import_Button) { @Override public void run() { GitCloneWizard wiz = new GitCloneWizard(); wiz.init(null, null); new WizardDialog(getSite().getShell(), wiz).open(); updateDirStrings(new NullProgressMonitor()); } }; importAction .setToolTipText(RepositoryViewUITexts.RepositoriesView_Clone_Tooltip); getViewSite().getActionBars().getToolBarManager().add(importAction); addAction = new Action( RepositoryViewUITexts.RepositoriesView_Add_Button) { @Override public void run() { RepositorySearchDialog sd = new RepositorySearchDialog( getSite().getShell(), ResourcesPlugin.getWorkspace() .getRoot().getLocation().toOSString(), getGitDirs()); if (sd.open() == Window.OK) { Set<String> dirs = new HashSet<String>(); dirs.addAll(getGitDirs()); if (dirs.addAll(sd.getDirectories())) saveDirStrings(dirs); scheduleRefresh(); } } }; addAction .setToolTipText(RepositoryViewUITexts.RepositoriesView_AddRepository_Tooltip); getViewSite().getActionBars().getToolBarManager().add(addAction); refreshAction = new Action( RepositoryViewUITexts.RepositoriesView_Refresh_Button) { @Override public void run() { scheduleRefresh(); } }; getViewSite().getActionBars().getToolBarManager().add(refreshAction); }
Source:
<code>void release(Object connection) { <START> Reference<Object> connReference = new Reference<>(connection); <END> lock.lock(); try { int count = getConnectionRefCount(connReference) - 1; ConnectionHandler<Object> connectionHandler = connections.get(connReference).getSecond(); if (count > 0) { connections.put(connReference, new Pair(count, connectionHandler)); return; } if (connectionHandler != null) { connectionHandler.release(); } connections.remove(connReference); } finally { lock.unlock(); } }</code><technical_language>do need synchronize here? I tend no, again, is race condition was</technical_language>

Target:
void release(Object connection) { decreaseConnectionReferenceCount(new Reference<>(connection), connHandler -> { if (connHandler != null) connHandler.release(); }); }
Source:
<code>private void _pushCounters() { int sizeJVMMetrics = 0; _logger.debug("Pushing monitor service counters for {}.", HOSTNAME); Map<Metric, Double> counters = new HashMap<>(); _updateJVMStatsCounters(); <START> sizeJVMMetrics = _metrics.size(); <END> synchronized (_metrics) { counters.putAll(_metrics); _metrics.clear(); } if(counters.size() != sizeJVMMetrics){ _logger.warn("Monitoring Service JVM Metrics and counters size are not equal"); _logger.warn("JVM Metrics size = {}", sizeJVMMetrics); _logger.warn("counters size = {}", counters.size()); } long timestamp = (System.currentTimeMillis() / 60000) * 60000L; for (Entry<Metric, Double> entry : counters.entrySet()) { Map<Long, String> dataPoints = new HashMap<>(1); dataPoints.put(timestamp, String.valueOf(entry.getValue())); entry.getKey().setDatapoints(dataPoints); } if (!isDisposed()) { _logger.info("Pushing monitoring metrics to TSDB.", counters.size()); _tsdbService.putMetrics(new ArrayList<>(counters.keySet())); } }</code><technical_language>This of synchronized block. metrics added _metrics instantiated sizeJVMMetrics</technical_language>

Target:
private void _pushCounters() { int sizeJVMMetrics = 0; _logger.debug("Pushing monitor service counters for {}.", HOSTNAME); Map<Metric, Double> counters = new HashMap<>(); _updateJVMStatsCounters(); synchronized (_metrics) { sizeJVMMetrics = _metrics.size(); counters.putAll(_metrics); _metrics.clear(); } if(counters.size() != sizeJVMMetrics){ _logger.warn("Monitoring Service JVM Metrics and counters size are not equal"); _logger.warn("JVM Metrics size = {}", sizeJVMMetrics); _logger.warn("counters size = {}", counters.size()); } long timestamp = (System.currentTimeMillis() / 60000) * 60000L; for (Entry<Metric, Double> entry : counters.entrySet()) { Map<Long, String> dataPoints = new HashMap<>(1); dataPoints.put(timestamp, String.valueOf(entry.getValue())); entry.getKey().setDatapoints(dataPoints); } if (!isDisposed()) { _logger.info("Pushing monitoring metrics to TSDB.", counters.size()); _tsdbService.putMetrics(new ArrayList<>(counters.keySet())); } }
Source:
<code>public void onCollisionEaten() { element.kill(); element.setSize(0); <START> AudioController.getInstance().playSoundEffect(Options.getInstance().getHitSoundFileName()); <END> }</code><technical_language>playSound effect functions in adio controller wich in turn fetch options menu? this structure is beginning of god behaviour</technical_language>

Target:
public void onCollisionEaten() { element.kill(); element.setSize(0); AudioController.getInstance().playEatSoundEffect(); }
Source:
<code>private Mono<OAuth2AuthorizedClient> refreshIfNecessary(ClientRequest request, ExchangeFunction next, OAuth2AuthorizedClient authorizedClient) { ClientRegistration clientRegistration = authorizedClient.getClientRegistration(); <START> if (AuthorizationGrantType.CLIENT_CREDENTIALS.equals(clientRegistration.getAuthorizationGrantType()) && hasExpired(authorizedClient)) { <END> return createRequest(request) .flatMap(r -> getNewAuthorizedClient(clientRegistration, r)); } else if (shouldRefresh(authorizedClient)) { return createRequest(request) .flatMap(r -> refreshAuthorizedClient(next, authorizedClient, r)); } return Mono.just(authorizedClient); }</code><technical_language>I if a helper method here? isClientCredentialsGrantType(authorizedClient)</technical_language>

Target:
private Mono<OAuth2AuthorizedClient> refreshIfNecessary(ClientRequest request, ExchangeFunction next, OAuth2AuthorizedClient authorizedClient) { ClientRegistration clientRegistration = authorizedClient.getClientRegistration(); if (isClientCredentialsGrantType(clientRegistration) && hasTokenExpired(authorizedClient)) { return createRequest(request) .flatMap(r -> authorizeWithClientCredentials(clientRegistration, r)); } else if (shouldRefresh(authorizedClient)) { return createRequest(request) .flatMap(r -> refreshAuthorizedClient(next, authorizedClient, r)); } return Mono.just(authorizedClient); }
Source:
<code>public void write(final File file) { try { <START> final IntervalListWriter writer = new IntervalListWriter(file, this.header); <END> for (final Interval interval : this) { writer.write(interval); } writer.close(); } catch (final IOException ioe) { throw new SAMException("Error writing out interval list to file: " + file.getAbsolutePath(), ioe); } }</code><technical_language>common refrain, a try-with-resources autoclose this thing</technical_language>

Target:
public void write(final File file) { this.write(file.toPath()); }
Source:
<code>public void replaceTypeToResponse() throws IOException { final String type = "text/plain"; <START> final String header = "Content-Type: "; <END> MatcherAssert.assertThat( new RsPrint( new RsWithType( new RsWithType(new RsEmpty(), "text/xml"), type ) ).print(), Matchers.equalTo( Joiner.on("\r\n").join( "HTTP/1.1 200 OK", header + type, "", "" ) ) ); }</code><technical_language>@Bertram25 this variable once, inline it</technical_language>

Target:
public void replaceTypeToResponse() throws IOException { final String type = "text/plain"; MatcherAssert.assertThat( new RsPrint( new RsWithType( new RsWithType(new RsEmpty(), "text/xml"), type ) ).print(), Matchers.equalTo( Joiner.on("\r\n").join( "HTTP/1.1 200 OK", String.format("Content-Type: %s", type), "", "" ) ) ); }
Source:
<code>public TopNResultBuilder addEntry( String dimName, Object dimValIndex, Object[] metricVals ) { final Map<String, Object> metricValues = Maps.newHashMapWithExpectedSize(metricVals.length + 1); if (shouldAdd(dimName)) { metricValues.put(dimSpec.getOutputName(), dimName); final int extra = metricVals.length % LOOP_UNROLL_COUNT; switch (extra) { case 7: metricValues.put(aggFactoryNames[6], metricVals[6]); case 6: metricValues.put(aggFactoryNames[5], metricVals[5]); case 5: metricValues.put(aggFactoryNames[4], metricVals[4]); case 4: metricValues.put(aggFactoryNames[3], metricVals[3]); case 3: metricValues.put(aggFactoryNames[2], metricVals[2]); case 2: metricValues.put(aggFactoryNames[1], metricVals[1]); case 1: metricValues.put(aggFactoryNames[0], metricVals[0]); } for (int i = extra; i < metricVals.length; i += LOOP_UNROLL_COUNT) { metricValues.put(aggFactoryNames[i + 0], metricVals[i + 0]); metricValues.put(aggFactoryNames[i + 1], metricVals[i + 1]); metricValues.put(aggFactoryNames[i + 2], metricVals[i + 2]); metricValues.put(aggFactoryNames[i + 3], metricVals[i + 3]); metricValues.put(aggFactoryNames[i + 4], metricVals[i + 4]); metricValues.put(aggFactoryNames[i + 5], metricVals[i + 5]); metricValues.put(aggFactoryNames[i + 6], metricVals[i + 6]); metricValues.put(aggFactoryNames[i + 7], metricVals[i + 7]); } pQueue.add(new DimValHolder.Builder().withDimName(dimName).withMetricValues(metricValues).build()); <START> if (this.pQueue.size() > this.threshold) { <END> pQueue.poll(); } } return this; }</code><technical_language>is this. required</technical_language>

Target:
public TopNResultBuilder addEntry( String dimName, Object dimValIndex, Object[] metricVals ) { final Map<String, Object> metricValues = Maps.newHashMapWithExpectedSize(metricVals.length + 1); if (shouldAdd(dimName)) { metricValues.put(dimSpec.getOutputName(), dimName); final int extra = metricVals.length % LOOP_UNROLL_COUNT; switch (extra) { case 7: metricValues.put(aggFactoryNames[6], metricVals[6]); case 6: metricValues.put(aggFactoryNames[5], metricVals[5]); case 5: metricValues.put(aggFactoryNames[4], metricVals[4]); case 4: metricValues.put(aggFactoryNames[3], metricVals[3]); case 3: metricValues.put(aggFactoryNames[2], metricVals[2]); case 2: metricValues.put(aggFactoryNames[1], metricVals[1]); case 1: metricValues.put(aggFactoryNames[0], metricVals[0]); } for (int i = extra; i < metricVals.length; i += LOOP_UNROLL_COUNT) { metricValues.put(aggFactoryNames[i + 0], metricVals[i + 0]); metricValues.put(aggFactoryNames[i + 1], metricVals[i + 1]); metricValues.put(aggFactoryNames[i + 2], metricVals[i + 2]); metricValues.put(aggFactoryNames[i + 3], metricVals[i + 3]); metricValues.put(aggFactoryNames[i + 4], metricVals[i + 4]); metricValues.put(aggFactoryNames[i + 5], metricVals[i + 5]); metricValues.put(aggFactoryNames[i + 6], metricVals[i + 6]); metricValues.put(aggFactoryNames[i + 7], metricVals[i + 7]); } pQueue.add(new DimValHolder.Builder().withDimName(dimName).withMetricValues(metricValues).build()); if (pQueue.size() > threshold) { pQueue.poll(); } } return this; }
Source:
<code><START> public Object java_mutable(Initialized state) { <END> final java.util.ArrayList<Integer> values = state.javaMutable; for (int i = 0; i < CONTAINER_SIZE; i++) { values.remove(0); } require(values, v -> v.isEmpty()); return values; }</code><technical_language>is Object returned instead of a specific type</technical_language>

Target:
public Object java_mutable(Initialized state) { final java.util.ArrayList<Integer> values = state.javaMutable; for (int i = 0; i < CONTAINER_SIZE; i++) { values.remove(0); } assert values.isEmpty(); return values; }
Source:
<code>public void removeFromMapHappyPathMappedKeyTest() throws Exception { Map<String, String> testMap = new HashMap<>(); testMap.put( ActionUtil.QUARTZ_ACTIONCLASS, "one" ); testMap.put( "two", "two" ); testMap.remove( ActionUtil.QUARTZ_ACTIONCLASS ); <START> Assert.assertNull( testMap.get( ActionUtil.QUARTZ_ACTIONCLASS ) ); <END> assertEquals( testMap.get( "two" ), "two" ); }</code><technical_language>Remove 'Assert.'</technical_language>

Target:
public void removeFromMapHappyPathMappedKeyTest() throws Exception { Map<String, String> testMap = new HashMap<>(); testMap.put( ActionUtil.QUARTZ_ACTIONCLASS, "one" ); testMap.put( "two", "two" ); testMap.remove( ActionUtil.QUARTZ_ACTIONCLASS ); assertNull( testMap.get( ActionUtil.QUARTZ_ACTIONCLASS ) ); assertEquals( testMap.get( "two" ), "two" ); }
Source:
<code>public void writeStructuresData(Map<Integer, GlowStructure> structures) { for (GlowStructure structure : structures.values()) { if (structure.isDirty()) { CompoundTag data = null; CompoundTag features = new CompoundTag(); CompoundTag feature = new CompoundTag(); CompoundTag inputRoot; StructureStore<GlowStructure> store = StructureStorage .saveStructure(structure, feature); File structureFile = new File(structureDir, store.getId() + ".dat"); if (structureFile.exists()) { try (NbtInputStream in = new NbtInputStream( new FileInputStream(structureFile))) { inputRoot = in.readCompound(); data = inputRoot.tryGetCompound("data"); if (data != null) { CompoundTag maybeFeatures = data.tryGetCompound("Features"); if (maybeFeatures != null) { features = maybeFeatures; } } } catch (IOException e) { server.getLogger().log(Level.SEVERE, "Failed to read structure data from " + structureFile, e); } } <START> if (data == null) { <END> data = new CompoundTag(); } String key = "[" + structure.getChunkX() + "," + structure.getChunkZ() + "]"; features.putCompound(key, feature); data.putCompound("Features", features); CompoundTag root = new CompoundTag(); root.putCompound("data", data); try (NbtOutputStream nbtOut = new NbtOutputStream( new FileOutputStream(structureFile))) { nbtOut.writeTag(root); } catch (IOException e) { server.getLogger() .log(Level.SEVERE, "Failed to write structure data to " + structureFile, e); } structure.setDirty(false); } } }</code><technical_language>Chain</technical_language>

Target:
public void writeStructuresData(Map<Integer, GlowStructure> structures) { for (GlowStructure structure : structures.values()) { if (structure.isDirty()) { CompoundTag data; CompoundTag features; CompoundTag feature = new CompoundTag(); CompoundTag inputRoot; StructureStore<GlowStructure> store = StructureStorage .saveStructure(structure, feature); File structureFile = new File(structureDir, store.getId() + ".dat"); if (structureFile.exists()) { try (NbtInputStream in = new NbtInputStream( new FileInputStream(structureFile))) { inputRoot = in.readCompound(); data = inputRoot.tryGetCompound("data").orElseGet(CompoundTag::new); } catch (IOException e) { LocalizedStrings.Console.Error.Structure.IO_READ.log(e, structureFile); data = new CompoundTag(); } features = data.tryGetCompound("Features").orElseGet(CompoundTag::new); } else { data = new CompoundTag(); features = new CompoundTag(); } String key = "[" + structure.getChunkX() + "," + structure.getChunkZ() + "]"; features.putCompound(key, feature); data.putCompound("Features", features); CompoundTag root = new CompoundTag(); root.putCompound("data", data); try (NbtOutputStream nbtOut = new NbtOutputStream( new FileOutputStream(structureFile))) { nbtOut.writeTag(root); } catch (IOException e) { LocalizedStrings.Console.Error.Structure.IO_WRITE.log(e, structureFile); } structure.setDirty(false); } } }
Source:
<code>public ApkData[] getProjects(String projects, IAbstractFile buildLog) throws ExportException { ApkData[] apks = getProjects(projects); if (mTarget == Target.RELEASE && buildLog != null && buildLog.exists()) { ApkData[] previousApks = getProjects(buildLog); if (previousApks.length != apks.length) { throw new ExportException(String.format( "Project export is setup differently from previous export at versionCode %d.\n" + <START> "Any change in the multi-apk configuration require a increment of the versionCode.", <END> mVersionCode)); } for (int i = 0 ; i < previousApks.length ; i++) { apks[i].setMinor(previousApks[i].getMinor()); if (apks[i].compareTo(previousApks[i]) != 0) { throw new ExportException(String.format( "Project export is setup differently from previous export at versionCode %d.\n" + "Any change in the multi-apk configuration require a increment of the versionCode.", mVersionCode)); } } } return apks; }</code><technical_language>typo: require_s_ a_n_. below</technical_language>

Target:
public ApkData[] getProjects(String projects, IAbstractFile buildLog) throws ExportException { ApkData[] apks = getProjects(projects); if (mTarget == Target.RELEASE && buildLog != null && buildLog.exists()) { ApkData[] previousApks = getProjects(buildLog); if (previousApks.length != apks.length) { throw new ExportException(String.format( "Project export is setup differently from previous export at versionCode %d.\n" + "Any change in the multi-apk configuration requires an increment of the versionCode.", mVersionCode)); } for (int i = 0 ; i < previousApks.length ; i++) { apks[i].setMinor(previousApks[i].getMinor()); if (apks[i].compareTo(previousApks[i]) != 0) { throw new ExportException(String.format( "Project export is setup differently from previous export at versionCode %d.\n" + "Any change in the multi-apk configuration requires an increment of the versionCode.", mVersionCode)); } } } return apks; }
Source:
<code>public void rocksPathToFileThrowsAnException() { Assertions.assertThatThrownBy(() -> ImmutableRocksDbPersistentStorageConfig.builder() .storagePath(TEST_FOLDER.newFile().getAbsolutePath()) .build()) <START> .isInstanceOf(SafeIllegalStateException.class); <END> }</code><technical_language>nit: prefer static import. useful include a hasMessageContaining exception expect</technical_language>

Target:
public void rocksPathToFileThrowsAnException() throws IOException { Path filePath = TEST_FOLDER.newFile("testFile").toPath(); assertThatThrownBy(() -> ImmutableRocksDbPersistentStorageConfig.builder() .storagePath(TEST_FOLDER.getRoot().toPath().relativize(filePath).toString()) .build()) .isInstanceOf(SafeIllegalStateException.class) .hasMessageContaining("has to point to a directory"); }