auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private BucketShards compute() throws SQLException { if (!resultSet.next()) { return endOfData(); } UUID shardUuid = uuidFromBytes(resultSet.getBytes("shard_uuid")); Optional<UUID> deltaShardUuid = Optional.empty(); if (tableSupportsDeltaDelete && resultSet.getBytes("delta_shard_uuid") != null) { deltaShardUuid = Optional.of(uuidFromBytes(resultSet.getBytes("delta_shard_uuid"))); } Set<String> nodeIdentifiers; OptionalInt bucketNumber = OptionalInt.empty(); if (bucketToNode != null) { int bucket = resultSet.getInt("bucket_number"); bucketNumber = OptionalInt.of(bucket); nodeIdentifiers = ImmutableSet.of(getBucketNode(bucket)); } else { List<Integer> nodeIds = intArrayFromBytes(resultSet.getBytes("node_ids")); nodeIdentifiers = getNodeIdentifiers(nodeIds, shardUuid); } ShardNodes shard = new ShardNodes(shardUuid, deltaShardUuid, nodeIdentifiers); return new BucketShards(bucketNumber, ImmutableSet.of(shard)); }

Target:
private BucketShards compute() throws SQLException { if (!resultSet.next()) { return endOfData(); } UUID shardUuid = uuidFromBytes(resultSet.getBytes("shard_uuid")); Optional<UUID> deltaShardUuid = getDeltaShardUuidFromResultSet(); Set<String> nodeIdentifiers; OptionalInt bucketNumber = OptionalInt.empty(); if (bucketToNode != null) { int bucket = resultSet.getInt("bucket_number"); bucketNumber = OptionalInt.of(bucket); nodeIdentifiers = ImmutableSet.of(getBucketNode(bucket)); } else { List<Integer> nodeIds = intArrayFromBytes(resultSet.getBytes("node_ids")); nodeIdentifiers = getNodeIdentifiers(nodeIds, shardUuid); } ShardNodes shard = new ShardNodes(shardUuid, deltaShardUuid, nodeIdentifiers); return new BucketShards(bucketNumber, ImmutableSet.of(shard)); }
Source:
private void save(CompilationUnit cu, Path path) throws IOException { Files.createDirectories(path.getParent()); final String code = new PrettyPrinter().print(cu); Files.write(path, code.getBytes()); }

Target:
private void save(CompilationUnit cu, Path path) throws IOException { Files.createDirectories(path.getParent()); final String code = new PrettyPrinter().print(cu); Files.write(path, code.getBytes(UTF8)); }
Source:
EitherOf3<CatchUpCompleted, ShardProcessingRequested, Nothing> handle(ShardProcessed event) { if (builder().getStatus() == COMPLETED) { return EitherOf3.withC(nothing()); } CatchUpId id = builder().getId(); Optional<CatchUp> stateVisibleToDelivery = findJob(id, event.getRunInfo()); if (stateVisibleToDelivery.isPresent()) { CatchUp observedJob = stateVisibleToDelivery.get(); if (observedJob.getStatus() == FINALIZING) { int indexOfFinalized = event.getIndex() .getIndex(); if (!builder().getFinalizedShardList() .contains(indexOfFinalized)) { builder().addFinalizedShard(indexOfFinalized); } List<Integer> affectedShards = builder().getAffectedShardList(); List<Integer> finalizedShards = builder().getFinalizedShardList(); if (finalizedShards.containsAll(affectedShards)) { CatchUpCompleted completed = completeProcess(builder().getId()); return EitherOf3.withA(completed); } return EitherOf3.withC(nothing()); } } ShardProcessingRequested stillRequested = shardProcessingRequested(id, event.getIndex()); return EitherOf3.withB(stillRequested); }

Target:
EitherOf3<CatchUpCompleted, ShardProcessingRequested, Nothing> handle(ShardProcessed event) { CatchUp.Builder builder = builder(); if (builder.getStatus() == COMPLETED) { return EitherOf3.withC(nothing()); } CatchUpId id = builder.getId(); Optional<CatchUp> stateVisibleToDelivery = findJob(id, event.getRunInfo()); if (stateVisibleToDelivery.isPresent()) { CatchUp observedJob = stateVisibleToDelivery.get(); if (observedJob.getStatus() == FINALIZING) { int indexOfFinalized = event.getIndex() .getIndex(); if (!builder.getFinalizedShardList().contains(indexOfFinalized)) { builder.addFinalizedShard(indexOfFinalized); } List<Integer> affectedShards = builder.getAffectedShardList(); if (builder.getFinalizedShardList().containsAll(affectedShards)) { CatchUpCompleted completed = completeProcess(builder.getId()); return EitherOf3.withA(completed); } return EitherOf3.withC(nothing()); } } ShardProcessingRequested stillRequested = shardProcessingRequested(id, event.getIndex()); return EitherOf3.withB(stillRequested); }
Source:
if (mx.equals("true") || mx.equals("t") || mx.equals("")) { try { Class c = Class.forName("PointerBufferPoolMXBean"); Method method = c.getDeclaredMethod("register"); method.invoke(null); } catch (Throwable t) { logger.warn("Could not load PointerBufferPoolMXBean: " + t); } }

Target:
if (mx.equals("true") || mx.equals("t") || mx.equals("")) { try { Class c = Class.forName("org.bytedeco.javacpp.tools.PointerBufferPoolMXBean"); Method method = c.getDeclaredMethod("register"); method.invoke(null); } catch (ReflectiveOperationException e) { logger.warn("Could not register PointerBufferPoolMXBean: " + e); } }
Source:
public Class<?> getCellClass(int column) { EditedStyleItem item = myAttributes.get(myRowIndex); String value = item.getValue(); String name = item.getName(); AttributeDefinition attrDefinition = myAttributeDefinitions.getAttrDefByName(name); if (ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Color)) { return Color.class; } ResourceUrl url = ResourceUrl.parse(value); if (item.isAttr()) { item.setValue(value); ItemResourceValue resourceValue = (ItemResourceValue) mySelectedStyle.getConfiguration().getResourceResolver().findResValue(value, false); if (resourceValue == null ) { LOG.error("Unable to resolve " + value); return null; } item = new EditedStyleItem(resourceValue, mySelectedStyle); value = item.getValue(); url = ResourceUrl.parse(value); } if ((url != null && url.type == ResourceType.COLOR) || value.startsWith("#")) { return Color.class; } if (url != null && url.type == ResourceType.DRAWABLE) { return DrawableDomElement.class; } if (column == 1) { if (url != null && url.type == ResourceType.STYLE) { return ThemeEditorStyle.class; } if ((url != null && url.type == ResourceType.INTEGER) || ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Integer)) { return Integer.class; } if ((url != null && url.type == ResourceType.BOOL) || value.equals("true") || value.equals("false")) { return Boolean.class; } } return String.class; }

Target:
public Class<?> getCellClass(int column) { EditedStyleItem item = myAttributes.get(myRowIndex); String value = item.getValue(); String name = item.getName(); AttributeDefinition attrDefinition = myAttributeDefinitions.getAttrDefByName(name); if (ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Color)) { return Color.class; } ResourceUrl url = ResourceUrl.parse(value); if (item.isAttr()) { item.setValue(value); ItemResourceValue resourceValue = (ItemResourceValue) mySelectedStyle.getConfiguration().getResourceResolver().findResValue(value, false); if (resourceValue == null ) { LOG.error("Unable to resolve " + value); return null; } item = new EditedStyleItem(resourceValue, mySelectedStyle); value = item.getValue(); url = ResourceUrl.parse(value); } ResourceType urlType = null; if (url != null) { urlType = url.type; } if (urlType == ResourceType.COLOR || (value.startsWith("#") && ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Color))) { return Color.class; } if (urlType == ResourceType.DRAWABLE) { return DrawableDomElement.class; } if (column == 1) { if (urlType == ResourceType.STYLE) { return ThemeEditorStyle.class; } if (urlType == ResourceType.INTEGER || ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Integer)) { return Integer.class; } if (urlType == ResourceType.BOOL || ((value.equals("true") || value.equals("false")) && ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Boolean))) { return Boolean.class; } } return String.class; }
Source:
public String render(String template, StatementContext ctx) { final ExtensionMethod extensionMethod = ctx.getExtensionMethod(); final String originalResult = originalEngine.render(template, ctx); if ((extensionMethod != null) && (extensionMethod.getType() != null) && (extensionMethod.getMethod() != null)) { final StringBuilder query = new StringBuilder(originalResult.length() + 100); query.append(" "); query.append(originalResult); return query.toString(); } return originalResult; }

Target:
public String render(String template, StatementContext ctx) { final ExtensionMethod extensionMethod = ctx.getExtensionMethod(); final String originalResult = originalEngine.render(template, ctx); if (extensionMethod == null) { return originalResult; } final StringBuilder query = new StringBuilder(originalResult.length() + 100); query.append(" "); query.append(originalResult); return query.toString(); }
Source:
protected ICleanUpFix createFix(CompilationUnit unit) throws CoreException { if (!isEnabled(CleanUpConstants.NUMBER_SUFFIX)) { return null; } final List<CompilationUnitRewriteOperation> rewriteOperations= new ArrayList<>(); unit.accept(new ASTVisitor() { @Override public boolean visit(NumberLiteral node) { final String token= node.getToken(); if (token.endsWith("l") || token.endsWith("f")) { rewriteOperations.add(new NumberSuffixOperation(node, token)); return false; } return true; } }); if (rewriteOperations.isEmpty()) { return null; } return new CompilationUnitRewriteOperationsFix(MultiFixMessages.CodeStyleCleanUp_numberSuffix_description, unit, rewriteOperations.toArray(new CompilationUnitRewriteOperation[rewriteOperations.size()])); }

Target:
protected ICleanUpFix createFix(CompilationUnit unit) throws CoreException { if (!isEnabled(CleanUpConstants.NUMBER_SUFFIX)) { return null; } final List<CompilationUnitRewriteOperation> rewriteOperations= new ArrayList<>(); unit.accept(new ASTVisitor() { @Override public boolean visit(NumberLiteral node) { final String token= node.getToken(); if (token.endsWith("l") || token.endsWith("d") || token.endsWith("f")) { rewriteOperations.add(new NumberSuffixOperation(node, token)); return false; } return true; } }); if (rewriteOperations.isEmpty()) { return null; } return new CompilationUnitRewriteOperationsFix(MultiFixMessages.CodeStyleCleanUp_numberSuffix_description, unit, rewriteOperations.toArray(new CompilationUnitRewriteOperation[rewriteOperations.size()])); }
Source:
public void setJsonPathTo(String path, String value){ String jsonStr = getResponse().getResponse(); String jsonPath = getPathExpr(path); getResponse().setResponse(pathHelper.updateJsonPathWithValue(jsonStr, jsonPath, value)); }

Target:
public void setJsonPathTo(String path, String value){ String jsonStr = getResponse().getResponse(); String jsonPath = getPathExpr(path); String newResponse = pathHelper.updateJsonPathWithValue(jsonStr, jsonPath, value); getResponse().setResponse(newResponse); }
Source:
public void unzipFlatFileEntryZip() throws IOException { File singleFile = this.resourceLoader.getResource("classpath:testzipdata/single.txt").getFile(); File zip = new File(singleFile.getParentFile(), "flatfileentry.zip"); ZipUtil.packEntry(singleFile, zip, "subfolder/single.txt"); final Resource zipResource = this.resourceLoader.getResource("classpath:testzipdata/flatfileentry.zip"); final InputStream is = zipResource.getInputStream(); final Message<InputStream> message = MessageBuilder.withPayload(is).build(); final UnZipTransformer unZipTransformer = new UnZipTransformer(); unZipTransformer.afterPropertiesSet(); final Message<?> resultMessage = unZipTransformer.transform(message); Assert.assertNotNull(resultMessage); @SuppressWarnings("unchecked") Map<String, byte[]> unzippedData = (Map<String, byte[]>) resultMessage.getPayload(); Assert.assertNotNull(unzippedData); Assert.assertTrue(unzippedData.size() == 1); }

Target:
public void unzipFlatFileEntryZip() throws IOException { final Resource zipResource = this.resourceLoader.getResource("classpath:testzipdata/flatfileentry.zip"); final InputStream is = zipResource.getInputStream(); final Message<InputStream> message = MessageBuilder.withPayload(is).build(); final UnZipTransformer unZipTransformer = new UnZipTransformer(); unZipTransformer.setZipResultType(ZipResultType.FILE); unZipTransformer.afterPropertiesSet(); final Message<?> resultMessage = unZipTransformer.transform(message); Assert.assertNotNull(resultMessage); @SuppressWarnings("unchecked") Map<String, byte[]> unzippedData = (Map<String, byte[]>) resultMessage.getPayload(); Assert.assertNotNull(unzippedData); Assert.assertTrue(unzippedData.size() == 1); }
Source:
public Response add(Template template) { validateParameters(template, "name", "vm.id|name"); validateEnums(Template.class, template); Guid clusterId = null; VDSGroup cluster = null; if (namedCluster(template)) { clusterId = getClusterId(template); cluster = lookupCluster(clusterId); } VmStatic staticVm = getMapper(Template.class, VmStatic.class).map(template, getVm(cluster, template)); if (namedCluster(template)) { staticVm.setVdsGroupId(clusterId); } staticVm.setUsbPolicy(VmMapper.getUsbPolicyOnCreate(template.getUsb(), cluster != null ? cluster : lookupCluster(staticVm.getVdsGroupId()))); AddVmTemplateParameters params = new AddVmTemplateParameters(staticVm, template.getName(), template.getDescription()); params.setConsoleEnabled(!getConsoleDevicesForEntity(staticVm.getId()).isEmpty()); boolean isDomainSet = false; if (template.isSetStorageDomain() && template.getStorageDomain().isSetId()) { params.setDestinationStorageDomainId(asGuid(template.getStorageDomain().getId())); isDomainSet = true; } params.setDiskInfoDestinationMap(getDiskToDestinationMap(template.getVm(), params.getDestinationStorageDomainId(), isDomainSet)); return performCreate(VdcActionType.AddVmTemplate, params, new QueryIdResolver<Guid>(VdcQueryType.GetVmTemplate, GetVmTemplateParameters.class)); }

Target:
public Response add(Template template) { validateParameters(template, "name", "vm.id|name"); validateEnums(Template.class, template); Guid clusterId = null; VDSGroup cluster = null; if (namedCluster(template)) { clusterId = getClusterId(template); cluster = lookupCluster(clusterId); } VmStatic staticVm = getMapper(Template.class, VmStatic.class).map(template, getVm(cluster, template)); if (namedCluster(template)) { staticVm.setVdsGroupId(clusterId); } staticVm.setUsbPolicy(VmMapper.getUsbPolicyOnCreate(template.getUsb(), cluster != null ? cluster : lookupCluster(staticVm.getVdsGroupId()))); AddVmTemplateParameters params = new AddVmTemplateParameters(staticVm, template.getName(), template.getDescription()); params.setConsoleEnabled(template.getConsole() != null && template.getConsole().isSetEnabled() ? template.getConsole().isEnabled() : !getConsoleDevicesForEntity(staticVm.getId()).isEmpty()); boolean isDomainSet = false; if (template.isSetStorageDomain() && template.getStorageDomain().isSetId()) { params.setDestinationStorageDomainId(asGuid(template.getStorageDomain().getId())); isDomainSet = true; } params.setDiskInfoDestinationMap(getDiskToDestinationMap(template.getVm(), params.getDestinationStorageDomainId(), isDomainSet)); return performCreate(VdcActionType.AddVmTemplate, params, new QueryIdResolver<Guid>(VdcQueryType.GetVmTemplate, GetVmTemplateParameters.class)); }
Source:
public Map<String, String[]> asMap() { Map<String, String[]> map = new HashMap<>(); if (loc != null) { map.put("loc", new String[]{ loc.toString() }); } if (caption != null) { map.put("caption", new String[]{ caption }); } if (geoLocation != null) { map.put("geo_location", new String[]{ geoLocation }); } if (title != null) { map.put("title", new String[]{ title }); } if (license != null) { map.put("license", new String[]{ license.toString() }); } return Collections.unmodifiableMap(map); }

Target:
public Map<String, String[]> asMap() { Map<String, String[]> map = new HashMap<>(); if (loc != null) { map.put(LOC, new String[]{ loc.toString() }); } if (caption != null) { map.put(CAPTION, new String[]{ caption }); } if (geoLocation != null) { map.put(GEO_LOCATION, new String[]{ geoLocation }); } if (title != null) { map.put(TITLE, new String[]{ title }); } if (license != null) { map.put(LICENSE, new String[]{ license.toString() }); } return Collections.unmodifiableMap(map); }
Source:
public VmNetworkInterface get(Guid id) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("id", id); VmNetworkInterface entity = getCallsHandler().executeRead("Getvm_interfaceById", mapper, parameterSource); entity.setVmInterfaceDynamic(DbFacade.getInstance().getVmInterfaceDynamic().get(id)); return entity; }

Target:
public VmNetworkInterface get(Guid id) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("id", id); VmNetworkInterface entity = getCallsHandler().executeRead("Getvm_interfaceById", mapper, parameterSource); return entity; }
Source:
private ThriftPlugin(ThriftPluginInfo info) { this(info.getName(), info.getLocationModule(), info.getPluginSessionProperties()); }

Target:
private ThriftPlugin(ThriftPluginInfo info) { this(info.getName(), info.getModule()); }
Source:
private void toggleAfk(User sender, User user, String message) throws Exception { if (message != null && sender != null) { if (sender.isMuted()) { if (sender.getMuteReason ().equals ("")) { throw new Exception(tl("voiceSilenced")); } else { throw new Exception(tl("voiceSilenced") + tl("muteFormat", sender.getMuteReason ())); } } if (!sender.isAuthorized("essentials.afk.message")) { throw new Exception(tl("noPermToAFKMessage")); } } user.setDisplayNick(); String msg = ""; if (!user.toggleAfk()) { if (!user.isHidden()) { msg = tl("userIsNotAway", user.getDisplayName()); } user.updateActivity(false); } else { if (!user.isHidden()) { if (message != null) { msg = tl("userIsAwayWithMessage", user.getDisplayName(), message); } else { msg = tl("userIsAway", user.getDisplayName()); } } user.setAfkMessage(message); } if (!msg.isEmpty()) { ess.broadcastMessage(user, msg); } }

Target:
private void toggleAfk(User sender, User user, String message) throws Exception { if (message != null && sender != null) { if (sender.isMuted()) { throw new Exception(sender.hasMuteReason() ? tl("voiceSilencedReason", sender.getMuteReason()) : tl("voiceSilenced")); } if (!sender.isAuthorized("essentials.afk.message")) { throw new Exception(tl("noPermToAFKMessage")); } } user.setDisplayNick(); String msg = ""; if (!user.toggleAfk()) { if (!user.isHidden()) { msg = tl("userIsNotAway", user.getDisplayName()); } user.updateActivity(false); } else { if (!user.isHidden()) { if (message != null) { msg = tl("userIsAwayWithMessage", user.getDisplayName(), message); } else { msg = tl("userIsAway", user.getDisplayName()); } } user.setAfkMessage(message); } if (!msg.isEmpty()) { ess.broadcastMessage(user, msg); } }
Source:
public void shouldGenerateNewspaperProcesses() throws Exception { Process completeEdition = ServiceManager.getProcessService().getById(10); Course course = NewspaperCourse.getCourse(); course.splitInto(Granularity.DAYS); NewspaperProcessesGenerator underTest = new NewspaperProcessesGenerator(completeEdition, course); while (underTest.getProgress() < underTest.getNumberOfSteps()) { underTest.nextStep(); } cleanUp(); }

Target:
public void shouldGenerateNewspaperProcesses() throws Exception { Process completeEdition = ServiceManager.getProcessService().getById(10); Course course = NewspaperCourse.getCourse(); course.splitInto(Granularity.DAYS); NewspaperProcessesGenerator underTest = new NewspaperProcessesGenerator(completeEdition, course); while (underTest.getProgress() < underTest.getNumberOfSteps()) { underTest.nextStep(); } Assert.assertEquals("The newspaper processes generator has not been completed!", underTest.getNumberOfSteps(), underTest.getProgress()); cleanUp(); }
Source:
public VisitQueryResult evaluate(VisitQuery definition, EvaluationContext context) throws EvaluationException { context = ObjectUtil.nvl(context, new EvaluationContext()); BasicVisitQuery query = (BasicVisitQuery) definition; VisitQueryResult result = new VisitQueryResult(query, context); if (context.getBaseCohort() != null && context.getBaseCohort().isEmpty()) { return result; } if (context instanceof VisitEvaluationContext) { VisitIdSet baseVisits = ((VisitEvaluationContext) context).getBaseVisits(); if (baseVisits != null && baseVisits.getMemberIds().isEmpty()) { return result; } } HqlQueryBuilder q = new HqlQueryBuilder(); q.select("v.visitId"); q.from(Visit.class, "v"); q.whereIn("v.visitType", query.getVisitTypes()); q.whereGreaterOrEqualTo("v.startDatetime", query.getStartedOnOrAfter()); q.whereLessOrEqualTo("v.startDatetime", query.getStartedOnOrBefore()); q.whereGreaterOrEqualTo("v.stopDatetime", query.getEndedOnOrAfter()); q.whereLessOrEqualTo("v.stopDatetime", query.getEndedOnOrBefore()); q.whereIn("v.location", query.getLocationList()); q.whereEncounterIn("v.visitId", context); for (Object[] row : evaluationService.evaluateToList(q, context)) { result.add((Integer)row[0]); } return result; }

Target:
public VisitQueryResult evaluate(VisitQuery definition, EvaluationContext context) throws EvaluationException { context = ObjectUtil.nvl(context, new EvaluationContext()); BasicVisitQuery query = (BasicVisitQuery) definition; VisitQueryResult result = new VisitQueryResult(query, context); if (context.getBaseCohort() != null && context.getBaseCohort().isEmpty()) { return result; } if (context instanceof VisitEvaluationContext) { VisitIdSet baseVisits = ((VisitEvaluationContext) context).getBaseVisits(); if (baseVisits != null && baseVisits.getMemberIds().isEmpty()) { return result; } } HqlQueryBuilder q = new HqlQueryBuilder(); q.select("v.visitId"); q.from(Visit.class, "v"); q.whereIn("v.visitType", query.getVisitTypes()); q.whereGreaterOrEqualTo("v.startDatetime", query.getStartedOnOrAfter()); q.whereLessOrEqualTo("v.startDatetime", query.getStartedOnOrBefore()); q.whereGreaterOrEqualTo("v.stopDatetime", query.getEndedOnOrAfter()); q.whereLessOrEqualTo("v.stopDatetime", query.getEndedOnOrBefore()); q.whereIn("v.location", query.getLocationList()); q.whereVisitIn("v.visitId", context); for (Object[] row : evaluationService.evaluateToList(q, context)) { result.add((Integer)row[0]); } return result; }
Source:
public void alterPartition(String databaseName, String tableName, PartitionWithStatistics partitionWithStatistics) { Partition oldPartition = getPartition(databaseName, tableName, partitionWithStatistics.getPartition().getValues()) .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionWithStatistics.getPartition().getValues())); Table table = getTable(databaseName, tableName) .orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName))); List<String> partitionColumns = table.getPartitionKeys().stream() .map(FieldSchema::getName) .collect(toImmutableList()); String partitionName = makePartName(partitionColumns, oldPartition.getValues()); List<String> dataColumns = table.getSd().getCols().stream() .map(FieldSchema::getName) .collect(toImmutableList()); List<ColumnStatisticsObj> oldStatistics = getMetastorePartitionColumnStatistics(table.getDbName(), table.getTableName(), ImmutableSet.of(partitionName), dataColumns) .getOrDefault(partitionName, ImmutableList.of()); alterMetastorePartition(databaseName, tableName, toMetastoreApiPartition(partitionWithStatistics)); try { Set<String> columnStatisticsForRemoval = oldStatistics.stream() .map(ColumnStatisticsObj::getColName) .collect(toSet()); columnStatisticsForRemoval.removeAll(partitionWithStatistics.getStatistics().getColumnStatistics().keySet()); for (String columnName : columnStatisticsForRemoval) { deletePartitionColumnStatistics(databaseName, tableName, partitionName, columnName); } storePartitionColumnStatistics(databaseName, tableName, partitionName, partitionWithStatistics); } catch (Throwable t) { try { alterMetastorePartition(databaseName, tableName, oldPartition); } catch (Throwable suppressed) { if (t != suppressed) { t.addSuppressed(suppressed); } } throw t; } }

Target:
public void alterPartition(String databaseName, String tableName, PartitionWithStatistics partitionWithStatistics) { alterPartitionWithoutStatistics(databaseName, tableName, toMetastoreApiPartition(partitionWithStatistics)); storePartitionColumnStatistics(databaseName, tableName, partitionWithStatistics.getPartitionName(), partitionWithStatistics); dropExtraColumnStatisticsAfterAlterPartition(databaseName, tableName, partitionWithStatistics); }
Source:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; J2EContext context = new J2EContext(httpServletRequest, httpServletResponse, sessionStore); if (Pac4jCallbackResource.SELF_URL.equals(httpServletRequest.getRequestURI())) { callbackLogic.perform( context, pac4jConfig, (int code, J2EContext ctx) -> null, "/", true, false, false, null); } else { String uid = securityLogic.perform( context, pac4jConfig, (J2EContext ctx, Collection<CommonProfile> profiles, Object... parameters) -> { if (profiles.isEmpty()) { LOGGER.warn("No profiles found after OIDC auth."); return null; } else { return profiles.iterator().next().getId(); } }, (int code, J2EContext ctx) -> null, null, null, null, null); if (uid != null) { AuthenticationResult authenticationResult = new AuthenticationResult(uid, authorizerName, name, null); servletRequest.setAttribute(AuthConfig.DRUID_AUTHENTICATION_RESULT, authenticationResult); filterChain.doFilter(servletRequest, servletResponse); } } }

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse; J2EContext context = new J2EContext(httpServletRequest, httpServletResponse, sessionStore); if (Pac4jCallbackResource.SELF_URL.equals(httpServletRequest.getRequestURI())) { callbackLogic.perform( context, pac4jConfig, NOOP_HTTP_ACTION_ADAPTER, "/", true, false, false, null); } else { String uid = securityLogic.perform( context, pac4jConfig, (J2EContext ctx, Collection<CommonProfile> profiles, Object... parameters) -> { if (profiles.isEmpty()) { LOGGER.warn("No profiles found after OIDC auth."); return null; } else { return profiles.iterator().next().getId(); } }, NOOP_HTTP_ACTION_ADAPTER, null, null, null, null); if (uid != null) { AuthenticationResult authenticationResult = new AuthenticationResult(uid, authorizerName, name, null); servletRequest.setAttribute(AuthConfig.DRUID_AUTHENTICATION_RESULT, authenticationResult); filterChain.doFilter(servletRequest, servletResponse); } } }
Source:
public void weightedSampleTest() throws Exception { System.getProperties().setProperty("pigunit.randseed", "1"); PigTest test = createPigTest("test/pig/datafu/test/pig/bags/weightedSampleTest.pig"); writeLinesToFile("input", "({(a, 100),(b, 1),(c, 5),(d, 2)})"); test.runScript(); assertOutput(test, "data2", "({(c,5),(a,100),(b,1),(d,2)})"); }

Target:
public void weightedSampleTest() throws Exception { PigTest test = createPigTest("test/pig/datafu/test/pig/bags/weightedSampleTest.pig"); writeLinesToFile("input", "({(a, 100),(b, 1),(c, 5),(d, 2)})"); test.runScript(); assertOutput(test, "data2", "({(a,100),(c,5),(b,1),(d,2)})"); }
Source:
public void close() throws IOException, CopycatException, InterruptedException { timedRotateThread.shutdown(); for (TopicPartition topicPart : writers.keySet()) { rotate(topicPart); } writers.clear(); for (WAL wal : wals.values()) { wal.close(); } wals.clear(); tempFileNames.clear(); recordCounters.clear(); offsets.clear(); tasks.clear(); if (fs != null) { fs.close(); } }

Target:
public void close() throws CopycatException { List<Exception> exceptions = new ArrayList<>(); for (TopicPartition topicPart : assignment) { try { if (writers.containsKey(topicPart)) { closeTempfile(topicPart); appendToWAL(topicPart); commitFile(topicPart); } } catch (IOException e) { log.error("Error rotating when closing task.", tempFileNames.get(topicPart)); exceptions.add(e); } } writers.clear(); for (WAL wal : wals.values()) { try { wal.close(); } catch (CopycatException e) { log.error("Error closing {}.", wal.getLogFile()); exceptions.add(e); } } wals.clear(); tempFileNames.clear(); recordCounters.clear(); offsets.clear(); lastAssignment.clear(); failureTime.clear(); try { storage.close(); } catch (IOException e) { log.error("Error closing storage {}.", storage.url()); exceptions.add(e); } if (exceptions.size() != 0) { StringBuilder sb = new StringBuilder(); for (Exception exception: exceptions) { sb.append(exception.getMessage()); sb.append("\n"); } throw new CopycatException("Error closing writer: " + sb.toString()); } }
Source:
private void validateStreamId(final List<NakadiCursor> cursors, final String streamId, final String subscriptionId) throws ServiceUnavailableException, InvalidCursorException, InvalidStreamIdException, NoSuchEventTypeException, InternalNakadiException { if (!isActiveSession(subscriptionId, streamId)) { throw new InvalidStreamIdException("Session with stream id " + streamId + " not found"); } final HashMap<EventTypePartition, String> partitionSessions = new HashMap<>(); for (final NakadiCursor cursor : cursors) { final EventType eventType = eventTypeRepository.findByName(cursor.getTimeline().getEventType()); final EventTypePartition etPartition = new EventTypePartition(eventType.getName(), cursor.getPartition()); String partitionSession = partitionSessions.get(etPartition); if (partitionSession == null) { partitionSession = getPartitionSession(subscriptionId, eventType.getTopic(), cursor); partitionSessions.put(etPartition, partitionSession); } if (!streamId.equals(partitionSession)) { throw new InvalidStreamIdException("Cursor " + cursor + " cannot be committed with stream id " + streamId); } } }

Target:
private void validateStreamId(final List<NakadiCursor> cursors, final String streamId, final String subscriptionId) throws ServiceUnavailableException, InvalidCursorException, InvalidStreamIdException, NoSuchEventTypeException, InternalNakadiException { if (!isActiveSession(subscriptionId, streamId)) { throw new InvalidStreamIdException("Session with stream id " + streamId + " not found"); } final HashMap<EventTypePartition, String> partitionSessions = new HashMap<>(); for (final NakadiCursor cursor : cursors) { final EventTypePartition etPartition = new EventTypePartition( cursor.getTimeline().getEventType(), cursor.getPartition()); String partitionSession = partitionSessions.get(etPartition); if (partitionSession == null) { partitionSession = getPartitionSession(subscriptionId, cursor.getTopic(), cursor); partitionSessions.put(etPartition, partitionSession); } if (!streamId.equals(partitionSession)) { throw new InvalidStreamIdException("Cursor " + cursor + " cannot be committed with stream id " + streamId); } } }
Source:
public void run(final ApplicationArguments args) throws Exception { final Optional<Storage> storageOpt = storageDbRepository.getStorage(DEFAULT_STORAGE); if (!storageOpt.isPresent()) { final Storage storage = new Storage(); storage.setId(DEFAULT_STORAGE); storage.setType(Storage.Type.KAFKA); storage.setConfiguration(new Storage.KafkaConfiguration( environment.getProperty("nakadi.zookeeper.exhibitor.brokers"), Integer.valueOf(environment.getProperty("nakadi.zookeeper.exhibitor.port", "0")), environment.getProperty("nakadi.zookeeper.brokers"), environment.getProperty("nakadi.zookeeper.kafkaNamespace", ""))); storageDbRepository.createStorage(storage); } }

Target:
public void run(final ApplicationArguments args) throws InternalNakadiException { final Storage storage = new Storage(); storage.setId(DEFAULT_STORAGE); storage.setType(Storage.Type.KAFKA); storage.setConfiguration(new Storage.KafkaConfiguration( environment.getProperty("nakadi.zookeeper.exhibitor.brokers"), Integer.valueOf(environment.getProperty("nakadi.zookeeper.exhibitor.port", "0")), environment.getProperty("nakadi.zookeeper.brokers"), environment.getProperty("nakadi.zookeeper.kafkaNamespace", ""))); try { storageDbRepository.createStorage(storage); } catch (final DuplicatedStorageIdException e) { LOG.info("Creation of default storage failed: {}", e.getMessage()); } }
Source:
public boolean test() { WidgetHandler.getInstance().setFocus(ib.getSWTWidget()); Display.syncExec(new ResultRunnable<Boolean>() { @Override public Boolean run() { boolean ret = ib.getSWTWidget().forceFocus(); return ret; } }); return ib.getText().contains(text); }

Target:
public boolean test() { WidgetHandler.getInstance().setFocus(ib.getSWTWidget()); Display.syncExec(new Runnable() { @Override public void run() { ib.getSWTWidget().forceFocus(); } }); return ib.getText().contains(text); }
Source:
public static MessageType getSubfieldType(GroupType baseType, Subfield subfield) { checkArgument(subfield.getPath().size() >= 1, "subfield size is less than 1"); ImmutableList.Builder<org.apache.parquet.schema.Type> typeBuilder = ImmutableList.builder(); org.apache.parquet.schema.Type parentType = getParquetTypeByName(subfield.getRootName(), baseType); String rootName = parentType.getName(); for (PathElement field : subfield.getPath()) { if (field instanceof NestedField) { NestedField nestedField = (NestedField) field; org.apache.parquet.schema.Type childType = getParquetTypeByName(nestedField.getName(), parentType.asGroupType()); if (childType != null) { typeBuilder.add(childType); parentType = childType; } else { return new MessageType(rootName, ImmutableList.of()); } } else { typeBuilder.add(parentType.asGroupType().getFields().get(0)); break; } } List<org.apache.parquet.schema.Type> subfieldTypes = typeBuilder.build(); org.apache.parquet.schema.Type type = subfieldTypes.get(subfieldTypes.size() - 1); for (int i = subfieldTypes.size() - 2; i >= 0; --i) { GroupType groupType = subfieldTypes.get(i).asGroupType(); type = new MessageType(groupType.getName(), ImmutableList.of(type)); } return new MessageType(rootName, ImmutableList.of(type)); }

Target:
public static MessageType getSubfieldType(GroupType baseType, Subfield subfield) { checkArgument(subfield.getPath().size() >= 1, "subfield size is less than 1"); ImmutableList.Builder<org.apache.parquet.schema.Type> typeBuilder = ImmutableList.builder(); org.apache.parquet.schema.Type parentType = getParquetTypeByName(subfield.getRootName(), baseType); String rootName = parentType.getName(); for (PathElement field : subfield.getPath()) { if (field instanceof NestedField) { NestedField nestedField = (NestedField) field; org.apache.parquet.schema.Type childType = getParquetTypeByName(nestedField.getName(), parentType.asGroupType()); if (childType == null) { return new MessageType(rootName, ImmutableList.of()); } typeBuilder.add(childType); parentType = childType; } else { typeBuilder.add(parentType.asGroupType().getFields().get(0)); break; } } List<org.apache.parquet.schema.Type> subfieldTypes = typeBuilder.build(); org.apache.parquet.schema.Type type = subfieldTypes.get(subfieldTypes.size() - 1); for (int i = subfieldTypes.size() - 2; i >= 0; --i) { GroupType groupType = subfieldTypes.get(i).asGroupType(); type = new MessageType(groupType.getName(), ImmutableList.of(type)); } return new MessageType(rootName, ImmutableList.of(type)); }
Source:
public void getTriggers(@NonNull Callback<List<Trigger>> callback) { TriggerService service = retrofit.create(TriggerService.class); Map<String, String> map = new HashMap<>(); String cred = new String(Base64.encode(("jdoe:password").getBytes(), Base64.NO_WRAP)); map.put("Authorization", "Basic "+cred); map.put("Hawkular-Tenant", "hawkular"); Call call = service.get(map); call.enqueue(callback); }

Target:
public void getTriggers(@NonNull Callback<List<Trigger>> callback) { TriggerService service = retrofit.create(TriggerService.class); Call call = service.get(); call.enqueue(callback); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String postType = getArguments().getString(ARG_POST_TYPE); boolean isNewPost = getArguments() != null && getArguments().getBoolean(ARG_IS_NEW_POST); String localeString = getArguments().getString(ARG_LOCALE); Bundle translations = getArguments().getBundle(ARG_TRANSLATIONS); mWPAndroidGlueCode = new WPAndroidGlueCode(); mWPAndroidGlueCode.onCreate(getContext()); mWPAndroidGlueCode.onCreateView( getContext(), mHtmlModeEnabled, getActivity().getApplication(), BuildConfig.DEBUG, BuildConfig.BUILD_GUTENBERG_FROM_SOURCE, postType, isNewPost, localeString, translations, getContext().getResources().getColor(R.color.background_color)); mHasReceivedAnyContent = false; }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String postType = getArguments().getString(ARG_POST_TYPE); boolean isNewPost = getArguments() != null && getArguments().getBoolean(ARG_IS_NEW_POST); String localeString = getArguments().getString(ARG_LOCALE); Bundle translations = getArguments().getBundle(ARG_TRANSLATIONS); boolean isDarkMode = getArguments().getBoolean(ARG_PREFERRED_COLOR_SCHEME); mWPAndroidGlueCode = new WPAndroidGlueCode(); mWPAndroidGlueCode.onCreate(getContext()); mWPAndroidGlueCode.onCreateView( getContext(), mHtmlModeEnabled, getActivity().getApplication(), BuildConfig.DEBUG, BuildConfig.BUILD_GUTENBERG_FROM_SOURCE, postType, isNewPost, localeString, translations, getContext().getResources().getColor(R.color.background_color), isDarkMode); mHasReceivedAnyContent = false; }
Source:
public Lock lock(String resourceId, Long ttl) throws LightblueException { acquire(resourceId, ttl); return new Lock(resourceId); }

Target:
public Lock lock(String resourceId, Long ttl) throws LightblueException { if (acquire(resourceId, ttl)) { return new Lock(resourceId); } return null; }
Source:
public Authentication authenticate(Authentication authentication) throws AuthenticationException { @SuppressWarnings("unchecked") Map<String, String> details = (Map<String, String>) authentication .getDetails(); String[] credentials = parseCredentials(details.get("Authorization")); String accessKey = credentials[0]; String clientSignature = credentials[1]; ApiUser apiUser = findUser(accessKey); if (apiUser != null) { Date date = parseDate(details.get("Date")); long clientTime = date.getTime(); long serverTime = new Date().getTime(); long timeDelta = 600000; if (serverTime - timeDelta < clientTime && clientTime < serverTime + timeDelta) { String payload = buildPayload(date, details.get("Resource")); String serverSignature = MD5Util.generateHMAC(payload, apiUser.getSecret()); if (clientSignature.equals(serverSignature)) { return new ApiUserAuthentication(apiUser); } } } throw new BadCredentialsException("Authorization Required"); }

Target:
public Authentication authenticate(Authentication authentication) throws AuthenticationException { @SuppressWarnings("unchecked") Map<String, String> details = (Map<String, String>) authentication .getDetails(); String[] credentials = parseCredentials(details.get("Authorization")); String accessKey = credentials[0]; String clientSignature = credentials[1]; ApiUser apiUser = findUser(accessKey); if (apiUser == null) { throw new BadCredentialsException("Authorization Required"); } Date date = parseDate(details.get("Date")); long clientTime = date.getTime(); long serverTime = new Date().getTime(); long timeDelta = 600000; if (serverTime - timeDelta < clientTime && clientTime < serverTime + timeDelta) { String payload = buildPayload(details.get("HTTP-Verb"), date, details.get("Resource")); String serverSignature = MD5Util.generateHMAC(payload, apiUser.getSecret()); if (clientSignature.equals(serverSignature)) { return new ApiUserAuthentication(apiUser); } } throw new BadCredentialsException("Authorization Required"); }
Source:
protected void log(int priority, String tag, String message, Throwable t) { NetworkPeerManager peerManager = NetworkPeerManager.getInstanceOrNull(); if (peerManager == null) { return; } Console.MessageLevel logLevel; switch (priority) { case Log.VERBOSE: case Log.DEBUG: logLevel = Console.MessageLevel.DEBUG; break; case Log.INFO: logLevel = Console.MessageLevel.LOG; break; case Log.WARN: logLevel = Console.MessageLevel.WARNING; break; case Log.ERROR: logLevel = Console.MessageLevel.ERROR; break; default: logLevel = Console.MessageLevel.LOG; } CLog.writeToConsole( peerManager, logLevel, Console.MessageSource.OTHER, message ); }

Target:
protected void log(int priority, String tag, String message, Throwable t) { ConsolePeerManager peerManager = ConsolePeerManager.getInstanceOrNull(); if (peerManager == null) { return; } Console.MessageLevel logLevel; switch (priority) { case Log.VERBOSE: case Log.DEBUG: logLevel = Console.MessageLevel.DEBUG; break; case Log.INFO: logLevel = Console.MessageLevel.LOG; break; case Log.WARN: logLevel = Console.MessageLevel.WARNING; break; case Log.ERROR: logLevel = Console.MessageLevel.ERROR; break; default: logLevel = Console.MessageLevel.LOG; } CLog.writeToConsole( logLevel, Console.MessageSource.OTHER, message ); }
Source:
protected void unmapSecondaryIndexes(K key, V value) { if (value == null) { log.trace("Attempting to build an index with a null value, skipping."); return; } try { for (Index.Spec<K, V, ? extends Comparable> index : indexSpec) { String indexName = index.getName().get(); Map<Comparable, Map<K, V>> secondaryIndex = secondaryIndexes.get(indexName); for (Comparable indexKey : index.getMultiValueIndexFunction().apply(key, value)) { Map<K, V> slot = secondaryIndex.get(indexKey); if (slot != null) { slot.remove(key, value); } } } } catch (Exception e) { log.error("Received an exception while computing the index. " + "This is most likely an issue with the client's indexing function. {}", e); clearIndex(); throw e; } }

Target:
protected void unmapSecondaryIndexes(K key, V value) { if (value == null) { return; } try { for (Index.Spec<K, V, ? extends Comparable> index : indexSpec) { String indexName = index.getName().get(); Map<Comparable, Map<K, V>> secondaryIndex = secondaryIndexes.get(indexName); for (Comparable indexKey : index.getMultiValueIndexFunction().apply(key, value)) { Map<K, V> slot = secondaryIndex.get(indexKey); if (slot != null) { slot.remove(key, value); } } } } catch (Exception e) { log.error("Received an exception while computing the index. " + "This is most likely an issue with the client's indexing function. {}", e); clearIndex(); throw e; } }
Source:
public void deleteErrorLogsByDate() throws Exception { CountDownAsyncJobListener countDownListener = new CountDownAsyncJobListener(2); ((ExecutorServiceImpl) getExecutorService()).addAsyncJobListener(countDownListener); KieSession ksession = createKSession(ASYNC_DATA_EXEC); WorkItemManager wim = ksession.getWorkItemManager(); wim.registerWorkItemHandler("async", new AsyncWorkItemHandler(getExecutorService())); Map<String, Object> pm = new HashMap<String, Object>(); pm.put("command", "org.jbpm.test.jobexec.UserFailingCommand"); ProcessInstance pi = ksession.startProcess(ASYNC_DATA_EXEC_ID, pm); countDownListener.waitTillCompleted(); List<ErrorInfo> errorList = getExecutorService().getAllErrors(new QueryContext()); Assertions.assertThat(errorList).hasSize(2); int resultCount = auditService.errorInfoLogDeleteBuilder() .date(errorList.get(0).getTime()) .build() .execute(); int deleted = 1; int remaining = 1; if (errorList.get(0).getTime().compareTo(errorList.get(1).getTime())==0) { deleted=2; remaining=0; } Assertions.assertThat(resultCount).isEqualTo(deleted); Assertions.assertThat(getExecutorService().getAllErrors(new QueryContext())).hasSize(remaining); ksession.abortProcessInstance(pi.getId()); }

Target:
public void deleteErrorLogsByDate() throws Exception { CountDownAsyncJobListener countDownListener = new CountDownAsyncJobListener(2); ((ExecutorServiceImpl) getExecutorService()).addAsyncJobListener(countDownListener); KieSession ksession = createKSession(ASYNC_DATA_EXEC); WorkItemManager wim = ksession.getWorkItemManager(); wim.registerWorkItemHandler("async", new AsyncWorkItemHandler(getExecutorService())); Map<String, Object> pm = new HashMap<String, Object>(); pm.put("command", "org.jbpm.test.jobexec.UserFailingCommand"); ProcessInstance pi = ksession.startProcess(ASYNC_DATA_EXEC_ID, pm); countDownListener.waitTillCompleted(); List<ErrorInfo> errorList = getExecutorService().getAllErrors(new QueryContext()); Assertions.assertThat(errorList).hasSize(2); int resultCount = auditService.errorInfoLogDeleteBuilder() .date(errorList.get(0).getTime()) .build() .execute(); int deleted = 1; int remaining = 1; if (errorList.get(0).getTime().equals(errorList.get(1).getTime())) { deleted=2; remaining=0; } Assertions.assertThat(resultCount).isEqualTo(deleted); Assertions.assertThat(getExecutorService().getAllErrors(new QueryContext())).hasSize(remaining); ksession.abortProcessInstance(pi.getId()); }
Source:
public void addModelSubstitute(String fromClass, String toClass) throws GenerateException { try { Type type = _mapper.constructType(Class.forName(fromClass)); Type toType = _mapper.constructType(Class.forName(toClass)); modelSubtitutes.put(type, toType); } catch (ClassNotFoundException e) { LOGGER.warn("Problem with load " + fromClass + ". Mapping will be ignored."); } }

Target:
public void addModelSubstitute(String fromClass, String toClass) throws GenerateException { Type type = null; Type toType = null; try { type = _mapper.constructType(Class.forName(fromClass)); } catch (ClassNotFoundException e) { LOGGER.warn("Problem with loading " + fromClass + ". Mapping will be ignored."); } try { toType = _mapper.constructType(Class.forName(toClass)); } catch (ClassNotFoundException e) { LOGGER.warn("Problem with loading " + toClass + ". Mapping will be ignored."); } if(type != null && toType != null) { modelSubtitutes.put(type, toType); } }
Source:
public Single<Boolean> put(@NonNull final T id, @NonNull final U item) { checkNotNull(id); checkNotNull(item); final int hash = getHashCodeForId(id); U newItem = item; boolean valuesEqual = false; if (cache.containsKey(hash)) { final U currentItem = cache.get(hash); valuesEqual = newItem.equals(currentItem); if (!valuesEqual) { Log.v(TAG, "Merging values at " + id); try { newItem = putMergeFunction.apply(currentItem, newItem); } catch (Exception e) { Log.e(TAG, "Error merging!", e); } valuesEqual = newItem.equals(currentItem); } } if (valuesEqual) { Log.v(TAG, "Data already up to date at " + id); return Single.just(false); } cache.put(hash, newItem); subject.onNext(new StoreItem<>(id, newItem)); if (subjectCache.containsKey(hash)) { subjectCache.get(hash).onNext(newItem); } return Single.just(true); }

Target:
public Single<Boolean> put(@NonNull final T id, @NonNull final U item) { checkNotNull(id); checkNotNull(item); final int hash = getHashCodeForId(id); U newItem = item; boolean valuesEqual = false; if (cache.containsKey(hash)) { final U currentItem = cache.get(hash); valuesEqual = newItem.equals(currentItem); if (!valuesEqual) { Log.v(TAG, "Merging values at " + id); try { newItem = putMergeFunction.apply(currentItem, newItem); } catch (Exception e) { return Single.error(e); } valuesEqual = newItem.equals(currentItem); } } if (valuesEqual) { Log.v(TAG, "Data already up to date at " + id); return Single.just(false); } cache.put(hash, newItem); subject.onNext(new StoreItem<>(id, newItem)); if (subjectCache.containsKey(hash)) { subjectCache.get(hash).onNext(newItem); } return Single.just(true); }
Source:
private IPath getReferencePointRelativePath(@NotNull VirtualFile file) { String referencePointPath = virtualFile.getPath(); String filePath = file.getPath(); if (!filePath.startsWith(referencePointPath)) { return null; } try { Path relativePath = Paths.get(virtualFile.getPath()).relativize(Paths.get(file.getPath())); return IntelliJPathImpl.fromString(relativePath.toString()); } catch (IllegalArgumentException e) { log.warn( "Could not find a relative path from the base file " + virtualFile + " to the file " + file, e); return null; } }

Target:
private IPath getReferencePointRelativePath(@NotNull VirtualFile file) { String referencePointPath = virtualFile.getPath(); String filePath = file.getPath(); if (!filePath.startsWith(referencePointPath)) { return null; } try { Path relativePath = Paths.get(referencePointPath).relativize(Paths.get(filePath)); return IntelliJPathImpl.fromString(relativePath.toString()); } catch (IllegalArgumentException e) { log.warn( "Could not find a relative path from the base file " + virtualFile + " to the file " + file, e); return null; } }