auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public PhysicalOperation visitFilter(FilterNode node, LocalExecutionPlanContext context) { PlanNode sourceNode = node.getSource(); RowExpression filterExpression = node.getPredicate(); List<Symbol> outputSymbols = node.getOutputSymbols(); return visitScanFilterAndProject(context, node.getId(), sourceNode, Optional.of(filterExpression), AssignmentsUtils.identity(outputSymbols), outputSymbols); }

Target:
public PhysicalOperation visitFilter(FilterNode node, LocalExecutionPlanContext context) { PlanNode sourceNode = node.getSource(); RowExpression filterExpression = node.getPredicate(); List<Symbol> outputSymbols = node.getOutputSymbols(); AssignmentsUtils.Builder identities = AssignmentsUtils.builder(); for (Symbol symbol : outputSymbols) { Type type = requireNonNull(context.getTypes().get(symbol), format("No type for symbol %s", symbol)); identities.put(symbol, new VariableReferenceExpression(symbol.getName(), type)); } return visitScanFilterAndProject(context, node.getId(), sourceNode, Optional.of(filterExpression), identities.build(), outputSymbols); }
Source:
public boolean isOriginalEmptyValue() throws Exception { return !Sets.newHashSet(getOriginal()).equals(emptyValue); }

Target:
public boolean isOriginalEmptyValue() throws Exception { return Objects.equals(emptyValue, Sets.newHashSet(((Iterable<?>) getOriginal()).iterator())); }
Source:
public static double glucoseToMgDl(double mmolL) { return mmolL * 18; }

Target:
public static double glucoseToMgDl(double mmolL) { return mmolL * MG_DL_TO_MMOL_CONSTANT; }
Source:
public ImmutableBoundedValue<Integer> fireTicks() { return ImmutableDataCachingUtil.getValue(ImmutableSpongeBoundedValue.class, Keys.FIRE_TICKS, this.fireTicks, this.fireTicks, intComparator(), 0); }

Target:
public ImmutableBoundedValue<Integer> fireTicks() { return new ImmutableSpongeBoundedValue<Integer>(Keys.FIRE_TICKS, this.fireTicks, 0, intComparator(), 0, Integer.MAX_VALUE); }
Source:
public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vm_name", "description", "domain", "os", "osType", "creation_date", "num_of_monitors", "allowConsoleReconnect", "usb_policy", "is_auto_suspend", "auto_startup", "dedicated_vm_for_vds", "default_display_type", "priority", "default_boot_sequence", "initrd_url", "kernel_url", "kernel_params", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "num_of_cpus" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vds_group_id", "time_zone", "is_stateless", "nice_level", "mem_size_mb", "num_of_sockets", "cpu_per_socket", "iso_path", "userDefinedProperties", "predefinedProperties", "customProperties", "images", "interfaces" })); }

Target:
public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vm_name", "description", "domain", "os", "osType", "creation_date", "num_of_monitors", "allowConsoleReconnect", "usb_policy", "is_auto_suspend", "auto_startup", "dedicated_vm_for_vds", "default_display_type", "priority", "default_boot_sequence", "initrd_url", "kernel_url", "kernel_params", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled"}); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vds_group_id", "time_zone", "is_stateless", "nice_level", "mem_size_mb", "num_of_sockets", "cpu_per_socket", "iso_path", "userDefinedProperties", "predefinedProperties", "customProperties", "images", "interfaces" })); }
Source:
public boolean isCurrentLayoutSlotUnFilled() { log.trace("isCurrentLayoutSlotUnFilled. Wrong epochs: {}, active servers: {}", wrongEpochs, activeLayoutServers ); boolean result = wrongEpochs.keySet().containsAll(activeLayoutServers); if (result) { String msg = "Current layout slot is empty. Filling slot with current layout." + " wrong epochs: {}, active layout servers: {}"; log.info(msg, wrongEpochs, activeLayoutServers); } return result; }

Target:
public boolean isCurrentLayoutSlotUnFilled() { log.trace("isCurrentLayoutSlotUnFilled. Wrong epochs: {}, active servers: {}", wrongEpochs, responsiveServers ); boolean result = wrongEpochs.keySet().containsAll(responsiveServers); if (result) { log.info("Current layout slot is empty. Filling slot with current layout. " + "Wrong epochs: {}, active layout servers: {}", wrongEpochs, responsiveServers); } return result; }
Source:
public BitbucketUrl parse(String url) { Matcher matcher = bitbucketUrlPattern.matcher(url); if (!matcher.matches()) { throw new IllegalArgumentException( String.format( "The given url %s is not a valid Bitbucket server URL. Check either URL or server configuration.", url)); } String host = matcher.group("host"); String project = matcher.group("project"); String repoName = matcher.group("repo"); String branch = matcher.group("branch"); return new BitbucketUrl() .withHostName(host) .withProject(project) .withRepository(repoName) .withBranch(branch) .withFactoryFilename(".factory.json") .withDevfileFilenames(devfileFilenamesProvider.getConfiguredDevfileFilenames()); }

Target:
public BitbucketUrl parse(String url) { if (bitbucketUrlPatterns.isEmpty()) { throw new UnsupportedOperationException( "The Bitbucket integration is not configured properly and cannot be used at this moment." + "Please refer to docs to check the Bitbucket integration instructions"); } Matcher matcher = bitbucketUrlPatterns .stream() .map(pattern -> pattern.matcher(url)) .filter(Matcher::matches) .findFirst() .orElseThrow( () -> new IllegalArgumentException( format( "The given url %s is not a valid Bitbucket server URL. Check either URL or server configuration.", url))); String host = matcher.group("host"); String project = matcher.group("project"); String repoName = matcher.group("repo"); String branch = matcher.group("branch"); return new BitbucketUrl() .withHostName(host) .withProject(project) .withRepository(repoName) .withBranch(branch) .withDevfileFilenames(devfileFilenamesProvider.getConfiguredDevfileFilenames()); }
Source:
public static User map(DirectoryUser entity, User template) { User model = template != null ? template : new User(); model.setName(entity.getFirstName()); model.setUserName(entity.getPrincipal() != null ? entity.getPrincipal() : entity.getName()); model.setUserName(model.getUserName() + "@" + entity.getDirectoryName()); model.setId(DirectoryEntryIdUtils.encode(entity.getId())); model.setLastName(entity.getLastName()); model.setEmail(entity.getEmail()); model.setDepartment(entity.getDepartment()); model.setPrincipal(entity.getPrincipal()); model.setNamespace(entity.getNamespace()); if (entity.getGroups() != null) { model.setGroups(new Groups()); for (DirectoryGroup directoryGroup : entity.getGroups()) { Group group = new Group(); group.setName(directoryGroup.getName()); model.getGroups().getGroups().add(group); } } if (!StringUtils.isEmpty(entity.getDirectoryName())) { Domain dom = new Domain(); dom.setId(new Guid(entity.getDirectoryName().getBytes(Charset.forName("UTF-8")), true).toString()); model.setDomain(dom); } return model; }

Target:
public static User map(DirectoryUser entity, User template) { User model = template != null ? template : new User(); DbUser dbUser = new DbUser(entity); User result = map(dbUser, model); result.setId(DirectoryEntryIdUtils.encode(entity.getId())); return result; }
Source:
public BytecodeNode visitLambda(LambdaDefinitionExpression lambda, Context context) { checkState(preGeneratedExpressions.getCompiledLambdaMetadata().containsKey(lambda), "lambda expressions map does not contain this lambda definition"); if (MethodHandle.class.equals(context.getLambdaInterface().get())) { throw new PrestoException(FUNCTION_IMPLEMENTATION_ERROR, "Lambda cannot be generated as MethodHandle"); } else { BytecodeGeneratorContext generatorContext = new BytecodeGeneratorContext( RowExpressionCompiler.this, context.getScope(), callSiteBinder, cachedInstanceBinder, registry, preGeneratedExpressions); return generateLambda( generatorContext, ImmutableList.of(), lambda, preGeneratedExpressions.getCompiledLambdaMetadata().get(lambda), context.getLambdaInterface().get()); } }

Target:
public BytecodeNode visitLambda(LambdaDefinitionExpression lambda, Context context) { checkState(preGeneratedExpressions.getCompiledLambdaMap().containsKey(lambda), "lambda expressions map does not contain this lambda definition"); if (!context.lambdaInterface.get().isAnnotationPresent(FunctionalInterface.class)) { throw new VerifyException("lambda should be generated as class annotated with FunctionalInterface"); } BytecodeGeneratorContext generatorContext = new BytecodeGeneratorContext( RowExpressionCompiler.this, context.getScope(), callSiteBinder, cachedInstanceBinder, registry, preGeneratedExpressions); return generateLambda( generatorContext, ImmutableList.of(), preGeneratedExpressions.getCompiledLambdaMap().get(lambda), context.getLambdaInterface().get()); }
Source:
public static void ensureCompiledCallThroughEntrypoint(boolean call) { int count = 0; while (!hasJitCompiledEntrypoint(Main.class, "callThrough")) { int limit = call ? 1 << Math.min(count, 12) : 0; for (int i = 0; i < limit; ++i) { callThrough(Main.class, "doNothing"); } try { Thread.sleep(count >= 12 ? 200 : 100); } catch (Exception e) { } if (++count == 50) { throw new Error("TIMEOUT"); } }; }

Target:
public static void ensureCompiledCallThroughEntrypoint(boolean call) { int count = 0; while (!hasJitCompiledEntrypoint(Main.class, "callThrough")) { final int rampUpCutOff = 12; int limit = call ? 1 << Math.min(count, rampUpCutOff) : 0; for (int i = 0; i < limit; ++i) { callThrough(Main.class, "doNothing"); } try { Thread.sleep(count >= rampUpCutOff ? 200 : 100); } catch (Exception e) { } if (++count == 50) { throw new Error("TIMEOUT"); } }; }
Source:
public static void setFilePermissionsTo700(File file) throws IOException { file.createNewFile(); file.setExecutable(false, false); file.setReadable(false, false); file.setWritable(false, false); file.setReadable(true, true); file.setWritable(true, true); file.setExecutable(true, true); }

Target:
public static void setFilePermissionsTo700(File file) throws IOException { file.createNewFile(); boolean setRead = file.setReadable(false, false) & file.setReadable(true, true); boolean setWrite = file.setWritable(false, false) & file.setWritable(true, true); boolean setExec = file.setExecutable(false, false) & file.setExecutable(true, true); if (setRead && setWrite && setExec) { if (LOG.isTraceEnabled()) LOG.trace("Set permissions to 700 for file {}", file.getAbsolutePath()); } else { if (loggedSetFilePermissionsWarning) { if (LOG.isTraceEnabled()) LOG.trace("Failed to set permissions to 700 for file {}: setRead={}, setWrite={}, setExecutable={}", new Object[] {file.getAbsolutePath(), setRead, setWrite, setExec}); } else { LOG.warn("Failed to set permissions to 700 for file {}: setRead={}, setWrite={}, setExecutable={}; subsequent failures (on any file) will be logged at trace", new Object[] {file.getAbsolutePath(), setRead, setWrite, setExec}); loggedSetFilePermissionsWarning = true; } } }
Source:
private List<JavaType> getCompletedClassSymbolsType(@Nullable String[] bytecodeNames) { if (bytecodeNames == null) { return ImmutableList.of(); } List<JavaType> types = new ArrayList<>(); for (String bytecodeName : bytecodeNames) { JavaSymbol.TypeJavaSymbol completedClassSymbol = getClassSymbol(bytecodeName); if(!completedClassSymbol.isUnknown()) { types.add(completedClassSymbol.type); } } return types; }

Target:
private List<JavaType> getCompletedClassSymbolsType(@Nullable String[] bytecodeNames) { if (bytecodeNames == null) { return ImmutableList.of(); } return Arrays.stream(bytecodeNames).map(bName -> getClassSymbol(bName).type).collect(Collectors.toList()); }
Source:
public static Object[][] disableGptOasis() { return new Object[][]{ { "project43", "SyntheticTests/ProvidersChain", "InstantGlobals.wgAdDriverRubiconFastlaneProviderCountries=[]", "TOP_LEADERBOARD", "Liftium" }, { "project43", "SyntheticTests/ProvidersChain", "InstantGlobals.wgAdDriverRubiconFastlaneProviderCountries=[XX]", "TOP_LEADERBOARD", "RubiconFastlane" }, }; }

Target:
public static Object[][] disableGptOasis() { return new Object[][]{ { "project43", "SyntheticTests/ProvidersChain", "InstantGlobals.wgAdDriverRubiconFastlaneProviderCountries=[]", AdsContent.TOP_LB, "Liftium" }, { "project43", "SyntheticTests/ProvidersChain", "InstantGlobals.wgAdDriverRubiconFastlaneProviderCountries=[XX]", AdsContent.TOP_LB, "RubiconFastlane" }, }; }
Source:
protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupId())); VDSReturnValue vdsReturnValue = null; try { vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, createVDSParameters()); } catch (EngineException e) { log.error("Failed to delete image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get(), e); if (!getParameters().isLiveMerge()) { throw e; } } if (vdsReturnValue != null && vdsReturnValue.getCreationInfo() != null) { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); Guid result = createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()); getTaskIdList().add(result); getReturnValue().getVdsmTaskIdList().add(result); log.info("Successfully started task to remove orphaned volumes"); } else if (isMerge(getParentParameters().getParentCommand())) { log.info("Retrying deleting image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get()); MergeStatusReturnValue returnValue = new MergeStatusReturnValue(VmBlockJobType.COMMIT, new HashSet<>(getParameters().getImageList())); getReturnValue().setActionReturnValue(returnValue); ((RemoveSnapshotSingleDiskParameters) getParameters().getParentParameters()). setNextCommandStep(RemoveSnapshotSingleDiskStep.DESTROY_IMAGE); persistCommand(getParameters().getParentCommand()); } setSucceeded(true); setCommandStatus(CommandStatus.SUCCEEDED); }

Target:
protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupId())); VDSReturnValue vdsReturnValue = null; try { vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, createVDSParameters()); } catch (EngineException e) { log.error("Failed to delete image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get(), e); if (!getParameters().isLiveMerge()) { throw e; } } if (vdsReturnValue != null && vdsReturnValue.getCreationInfo() != null) { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); Guid result = createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()); getTaskIdList().add(result); getReturnValue().getVdsmTaskIdList().add(result); log.info("Successfully started task to remove orphaned volumes"); } else if (isMerge(getParentParameters().getParentCommand())) { log.info("Retrying deleting image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get()); MergeStatusReturnValue returnValue = new MergeStatusReturnValue(VmBlockJobType.COMMIT, new HashSet<>(getParameters().getImageList())); getReturnValue().setActionReturnValue(returnValue); ((RemoveSnapshotSingleDiskParameters) getParameters().getParentParameters()). setNextCommandStep(RemoveSnapshotSingleDiskStep.DESTROY_IMAGE); persistCommand(getParameters().getParentCommand()); } setSucceeded(true); }
Source:
public String toString() { String[] ipv4withmask = getIPv4addr(); if (this.ipv4.length == this.subnetMasks.length) { for (int i = 0; i < this.subnetMasks.length; i++) { ipv4withmask[i] += "/" + this.subnetMasks[i]; } } String[] ipv6withprefixlength = getIPv6addr(); if (this.ipv6.length == this.prefixLengths.length) { for (int j = 0; j < this.prefixLengths.length; i++) { ipv6withprefixlength[i] += "/" + this.prefixLengths[i]; } } StringBuilder sb = new StringBuilder(); sb.append("Name: ").append(getName()).append(" ").append("(").append(getDisplayName()).append(")").append("\n"); sb.append(" MAC Address: ").append(getMacaddr()).append("\n"); sb.append(" MTU: ").append(getMTU()).append(", ").append("Speed: ").append(getSpeed()).append("\n"); sb.append(" IPv4: ").append(Arrays.toString(ipv4withmask)).append("\n"); sb.append(" IPv6: ").append(Arrays.toString(ipv6withprefixlength)).append("\n"); sb.append(" Traffic: received ").append(getPacketsRecv()).append(" packets/") .append(FormatUtil.formatBytes(getBytesRecv())).append(" (" + getInErrors() + " err, ") .append(getInDrops() + " drop);"); sb.append(" transmitted ").append(getPacketsSent()).append(" packets/") .append(FormatUtil.formatBytes(getBytesSent())).append(" (" + getOutErrors() + " err, ") .append(getCollisions() + " coll);"); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Name: ").append(getName()).append(" ").append("(").append(getDisplayName()).append(")").append("\n"); sb.append(" MAC Address: ").append(getMacaddr()).append("\n"); sb.append(" MTU: ").append(getMTU()).append(", ").append("Speed: ").append(getSpeed()).append("\n"); String[] ipv4withmask = getIPv4addr(); if (this.ipv4.length == this.subnetMasks.length) { for (int i = 0; i < this.subnetMasks.length; i++) { ipv4withmask[i] += "/" + this.subnetMasks[i]; } } sb.append(" IPv4: ").append(Arrays.toString(ipv4withmask)).append("\n"); String[] ipv6withprefixlength = getIPv6addr(); if (this.ipv6.length == this.prefixLengths.length) { for (int j = 0; j < this.prefixLengths.length; j++) { ipv6withprefixlength[j] += "/" + this.prefixLengths[j]; } } sb.append(" IPv6: ").append(Arrays.toString(ipv6withprefixlength)).append("\n"); sb.append(" Traffic: received ").append(getPacketsRecv()).append(" packets/") .append(FormatUtil.formatBytes(getBytesRecv())).append(" (" + getInErrors() + " err, ") .append(getInDrops() + " drop);"); sb.append(" transmitted ").append(getPacketsSent()).append(" packets/") .append(FormatUtil.formatBytes(getBytesSent())).append(" (" + getOutErrors() + " err, ") .append(getCollisions() + " coll);"); return sb.toString(); }
Source:
public void testRun() throws IOException { String jobFile = JobRunner.jobFileFor(csvFile); String jobCollection = null; JobRunner jobRunner = new JobRunner(); jobRunner.setLogger(logger); jobRunner.setRoles(role); try ( InputStream csvStream = openStream(csvFile); InputStream jobStream = openStream(jobFile); InputStream jobStream2 = openStream(jobFile) ) { jobRunner.run(client, csvStream, jobStream); jobCollection = JobRunner.getJobCollection(jobRunner.getJobId()); ObjectMapper objectMapper = new ObjectMapper(); ObjectNode jobControlObj = (ObjectNode) objectMapper.readTree(jobStream2); testBeforeJobDocument(jobControlObj); testAfterJobDocument(jobControlObj); testJsonDataStructure(jobControlObj); testLoggerStatus(jobRunner.getStatus()); } catch(Exception ex) { ex.printStackTrace(); fail("test exception"); } finally { if (jobCollection != null) { QueryManager queryMgr = client.newQueryManager(); DeleteQueryDefinition deleteDef = queryMgr.newDeleteDefinition(); deleteDef.setCollections(jobCollection); queryMgr.delete(deleteDef); } } }

Target:
public void testRun() throws IOException { String jobFile = JobRunner.jobFileFor(csvFile); String jobCollection = null; JobRunner jobRunner = new JobRunner(); jobRunner.setLogger(logger); jobRunner.setRoles(role); try ( InputStream csvStream = openStream(csvFile); InputStream jobStream = openStream(jobFile); InputStream jobStream2 = openStream(jobFile) ) { jobRunner.run(client, csvStream, jobStream); jobCollection = JobRunner.getJobCollection(jobRunner.getJobId()); ObjectMapper objectMapper = new ObjectMapper(); ObjectNode jobControlObj = (ObjectNode) objectMapper.readTree(jobStream2); testBeforeJobDocument(jobControlObj); testAfterJobDocument(jobControlObj); testJsonDataStructure(jobControlObj); } catch(Exception ex) { ex.printStackTrace(); fail("test exception"); } finally { if (jobCollection != null) { QueryManager queryMgr = client.newQueryManager(); DeleteQueryDefinition deleteDef = queryMgr.newDeleteDefinition(); deleteDef.setCollections(jobCollection); queryMgr.delete(deleteDef); } } }
Source:
boolean validate() { getTemplateName().validateEntity( new IValidation[]{ new LengthValidation(BusinessEntitiesDefinitions.VM_TEMPLATE_NAME_SIZE), new I18NNameValidation(){ @Override protected String end() { return "]*$"; } } }); return getTemplateName().getIsValid(); }

Target:
boolean validate() { getTemplateName().validateEntity( new IValidation[] { new LengthValidation(BusinessEntitiesDefinitions.VM_TEMPLATE_NAME_SIZE), new I18NExtraNameOrNoneValidation() }); return getTemplateName().getIsValid(); }
Source:
public Coordinate geometryCentroid(Geometry g, Envelope bbox, KmlCentroidOptions opts) { if (opts == null) { opts = KmlCentroidOptions.DEFAULT; } if (opts.isClip()) { if (bbox != null) { g = clipGeometry(g, bbox); } else { LOG.warning("Clip option specified for kml centroids, but no bbox available"); } } if (g instanceof GeometryCollection) { g = selectRepresentativeGeometry((GeometryCollection) g); } if (g == null) { return null; } else if (g instanceof Point) { return g.getCoordinate(); } else if (g instanceof LineString) { LineString line = (LineString) g; LengthIndexedLine lil = new LengthIndexedLine(line); return lil.extractPoint(line.getLength() / 2.0); } else if (g instanceof Polygon) { if (opts.isContain()) { try { Point p = RendererUtilities.sampleForInternalPoint( (Polygon)g, null, null, null, -1, opts.getSamples()); if (p != null && !p.isEmpty()) return p.getCoordinate(); } catch(Exception e) { LOG.log(Level.WARNING, "Unable to calculate central point for polygon", e); } } } return g.getCentroid().getCoordinate(); }

Target:
public Coordinate geometryCentroid(Geometry g, Envelope bbox, KmlCentroidOptions opts) { if (opts == null) { opts = KmlCentroidOptions.DEFAULT; } if (opts.isClip()) { if (bbox != null) { g = clipGeometry(g, bbox); } else { LOG.warning("Clip option specified for kml centroids, but no bbox available"); } } if (g instanceof GeometryCollection) { g = selectRepresentativeGeometry((GeometryCollection) g); } if (g == null) { return null; } else if (g instanceof Point) { return g.getCoordinate(); } else if (g instanceof LineString) { LineString line = (LineString) g; LengthIndexedLine lil = new LengthIndexedLine(line); return lil.extractPoint(line.getLength() / 2.0); } else if (g instanceof Polygon) { if (opts.isContain()) { try { Point p = RendererUtilities.sampleForInternalPoint( (Polygon)g, null, null, null, -1, opts.getSamples()); if (p != null && !p.isEmpty()) { return p.getCoordinate(); } } catch(Exception e) { LOG.log(Level.WARNING, "Unable to calculate central point for polygon", e); } } } return g.getCentroid().getCoordinate(); }
Source:
public void testIsStsStorageLocation_StorageLocationNotFound() { when(mockStorageLocationDAO.get(STORAGE_LOCATION_ID)).thenThrow(NotFoundException.class); assertThrows(IllegalArgumentException.class, () -> projectSettingsManagerImpl.isStsStorageLocationSetting( uploadDestinationListSetting), "Storage location " + STORAGE_LOCATION_ID + " not found"); verify(mockStorageLocationDAO).get(STORAGE_LOCATION_ID); }

Target:
public void testIsStsStorageLocation_StorageLocationNotFound() { when(mockStorageLocationDAO.get(STORAGE_LOCATION_ID)).thenThrow(NotFoundException.class); boolean result = projectSettingsManagerImpl.isStsStorageLocationSetting(uploadDestinationListSetting); assertFalse(result); verify(mockStorageLocationDAO).get(STORAGE_LOCATION_ID); }
Source:
public static StructuredRecord asRecord(SparseVector vector) { return StructuredRecord.builder(SPARSE_SCHEMA) .set("size", vector.size()) .set("indices", ArrayUtils.toObject(vector.indices())) .set("vectorValues", ArrayUtils.toObject(vector.values())) .build(); }

Target:
public static StructuredRecord asRecord(SparseVector vector) { return StructuredRecord.builder(SPARSE_SCHEMA) .set("size", vector.size()) .set("indices", vector.indices()) .set("vectorValues", vector.values()) .build(); }
Source:
public SymbolStatsEstimate visitCall(CallExpression call, Void context) { if (resolution.isCastFunction(call.getFunctionHandle())) { return visitCast(call, context); } if (resolution.isNegateFunction(call.getFunctionHandle())) { return visitArithmeticUnary(call, context); } if (StandardFunctionResolution.isArithmeticFunction(call.getFunctionHandle())) { return visitArithmeticBinary(call, context); } Object value = new RowExpressionInterpreter(call, metadata, session, true).optimize(); if (value == null) { return nullStatsEstimate(); } if (value instanceof RowExpression) { return SymbolStatsEstimate.unknown(); } return SymbolStatsEstimate.builder() .setNullsFraction(0) .setDistinctValuesCount(1) .build(); }

Target:
public SymbolStatsEstimate visitCall(CallExpression call, Void context) { if (resolution.isCastFunction(call.getFunctionHandle())) { return visitCast(call, context); } if (resolution.isNegateFunction(call.getFunctionHandle())) { return visitArithmeticUnary(call, context); } FunctionMetadata functionMetadata = metadata.getFunctionManager().getFunctionMetadata(call.getFunctionHandle()); if (functionMetadata.getOperatorType().map(OperatorType::isArithmeticOperator).orElse(false)) { return visitArithmeticBinary(call, context); } Object value = new RowExpressionInterpreter(call, metadata, session, true).optimize(); if (value == null) { return nullStatsEstimate(); } if (value instanceof RowExpression) { return SymbolStatsEstimate.unknown(); } return SymbolStatsEstimate.builder() .setNullsFraction(0) .setDistinctValuesCount(1) .build(); }
Source:
public VolumeBrickModel() { setReplicaCount(new EntityModel()); getReplicaCount().setEntity(2); getReplicaCount().setIsChangable(false); setStripeCount(new EntityModel()); getStripeCount().setEntity(4); getStripeCount().setIsChangable(false); setBricks(new ListModel()); }

Target:
public VolumeBrickModel() { setReplicaCount(new EntityModel()); getReplicaCount().setEntity(VolumeListModel.REPLICATE_COUNT_DEFAULT); getReplicaCount().setIsChangable(false); setStripeCount(new EntityModel()); getStripeCount().setEntity(VolumeListModel.STRIPE_COUNT_DEFAULT); getStripeCount().setIsChangable(false); setBricks(new ListModel()); }
Source:
public void testMakeObject() { final Geometry fish = mockFactory.makeObject(assManager, app); assertTrue(fish != null); }

Target:
public void testMakeObject() { final Geometry fish = mockFactory.makeObject(assManager, app); assertTrue(((FishControl) (fish).getControl(0)).isEnabled()); }
Source:
private void generateReadList(StructMember member, String variable) { ListType type = (ListType) member.getType(); Type elementType = type.getElementType(); if (elementType instanceof PrimitiveType) { buffer.addLine("empty = reader.empty_element()"); buffer.addLine("reader.read()"); buffer.addLine("if not empty:"); buffer.startBlock(); buffer.addLine("%1$s = List()", variable); buffer.addLine("while reader.forward():"); buffer.startBlock(); buffer.addLine("%1$s.append(Reader.read_string(reader))", variable); buffer.endBlock(); buffer.addLine("reader.read()"); buffer.endBlock(); } else if (elementType instanceof StructType) { PythonClassName readerName = pythonNames.getReaderName(elementType); buffer.addLine("%1$s = %2$s.read_many(reader)", variable, readerName.getClassName()); } else { buffer.addLine("reader.next_element()"); } }

Target:
private void generateReadList(StructMember member, String variable) { ListType type = (ListType) member.getType(); Type elementType = type.getElementType(); if (elementType instanceof PrimitiveType) { generateReadPrimitives((PrimitiveType) elementType, variable); } else if (elementType instanceof EnumType) { generateReadEnum((EnumType) elementType, variable); } else if (elementType instanceof StructType) { PythonClassName readerName = pythonNames.getReaderName(elementType); buffer.addLine("%1$s = %2$s.read_many(reader)", variable, readerName.getClassName()); } else { buffer.addLine("reader.next_element()"); } }
Source:
public void initialize() { loginProgressPane.setVisible(false); loginErrorLabel.managedProperty().bind(loginErrorLabel.visibleProperty()); loginErrorLabel.setVisible(false); Font.loadFont(LoginController.class.getResource("/font/dfc-icons.ttf").toExternalForm(), 10); }

Target:
public void initialize() { loginProgressPane.setVisible(false); loginErrorLabel.managedProperty().bind(loginErrorLabel.visibleProperty()); loginErrorLabel.setVisible(false); }
Source:
public static Bitmap rotateImage(final Bitmap bitmap, final String storagePath){ try { ExifInterface exifInterface = new ExifInterface(storagePath); final int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1); Matrix matrix = new Matrix(); switch(orientation) { case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: matrix.postScale(-1.0f, 1.0f); break; case ExifInterface.ORIENTATION_ROTATE_180: matrix.postRotate(180); break; case ExifInterface.ORIENTATION_FLIP_VERTICAL: matrix.postRotate(-90); matrix.postScale(1.0f, -1.0f); break; case ExifInterface.ORIENTATION_TRANSPOSE: matrix.postRotate(-90); matrix.postScale(1.0f, -1.0f); break; case ExifInterface.ORIENTATION_ROTATE_90: matrix.postRotate(90); break; case ExifInterface.ORIENTATION_TRANSVERSE: matrix.postRotate(90); matrix.postScale(1.0f, -1.0f); break; case ExifInterface.ORIENTATION_ROTATE_270: matrix.postRotate(270); break; } final Bitmap resultBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); if (resultBitmap != bitmap) { bitmap.recycle(); } return resultBitmap; } catch (Exception exception) { Log_OC.e("BitmapUtil", "Could not rotate the image: " + storagePath); return bitmap; } }

Target:
public static Bitmap rotateImage(final Bitmap bitmap, final String storagePath){ try { ExifInterface exifInterface = new ExifInterface(storagePath); final int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1); Matrix matrix = new Matrix(); switch(orientation) { case ExifInterface.ORIENTATION_FLIP_HORIZONTAL: matrix.postScale(-1.0f, 1.0f); break; case ExifInterface.ORIENTATION_ROTATE_180: matrix.postRotate(180); break; case ExifInterface.ORIENTATION_FLIP_VERTICAL: matrix.postScale(1.0f, -1.0f); break; case ExifInterface.ORIENTATION_TRANSPOSE: matrix.postRotate(-90); matrix.postScale(1.0f, -1.0f); break; case ExifInterface.ORIENTATION_ROTATE_90: matrix.postRotate(90); break; case ExifInterface.ORIENTATION_TRANSVERSE: matrix.postRotate(90); matrix.postScale(1.0f, -1.0f); break; case ExifInterface.ORIENTATION_ROTATE_270: matrix.postRotate(270); break; } final Bitmap resultBitmap =Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); if (resultBitmap != bitmap) { bitmap.recycle(); } return resultBitmap; } catch (Exception exception) { Log_OC.e("BitmapUtil", "Could not rotate the image: " + storagePath); return bitmap; } }
Source:
public void run() { log.info("Starting " + getWorkerName()); while (true) { try { listenForMessages(); } catch (Throwable e) { log.error("Unexpected error running " + getWorkerName() + ", restarting", e); } } }

Target:
public void run() { log.info("Starting " + getWorkerName()); initializeQueue(); while (true) { try { listenForMessages(); } catch (QueueDoesNotExistException e){ log.warn("Queue does not exist, recreating", queueARN); initializeQueue(); } catch (Exception e) { log.error("Unexpected error running " + getWorkerName() + ", restarting worker", e); try { Thread.sleep(500); } catch (InterruptedException e1) { log.error("Thread interrupted while sleeping", getWorkerName(), e1); } } } }
Source:
private void logAndCheckSkipTest(IllegalStateException e) { LOGGER.error("Cannot initial a docker container because: {}", String.valueOf(e)); if (e.getMessage().startsWith(NO_DOCKER_ENVIRONMENT)) { Assume.assumeTrue(SKIPPING_TEST_CAUTION, false); } }

Target:
private void logAndCheckSkipTest(IllegalStateException e) { LOGGER.error("Cannot initial a docker container", e); if (e.getMessage().startsWith(NO_DOCKER_ENVIRONMENT)) { Assume.assumeTrue(SKIPPING_TEST_CAUTION, false); } }
Source:
public ChangeInfo get() throws RestApiException { String version = getVersion(); Set<ListChangesOption> options = EnumSet.allOf(ListChangesOption.class) .stream() .filter(option -> ListChangesOptionByVersion.isSupportedOnVersion(option, version)) .filter(option -> option != ListChangesOption.CHECK) .collect(Collectors.toSet()); EnumSet enumOption = EnumSet.noneOf(ListChangesOption.class); enumOption.addAll(options); return get(enumOption); }

Target:
public ChangeInfo get() throws RestApiException { return get(ListChangesOptionByVersion.allSupported(serverRestClient.getVersionCached())); }
Source:
public void init() { super.init(); setStorageDomainId(getDiskImage().getStorageIds().get(0)); setStoragePoolId(getDiskImage().getStoragePoolId()); setImageGroupId(getDiskImage().getId()); setVm(vmDao .getVmsWithPlugInfo(getDiskImage().getId()) .stream() .filter(p -> p.getFirst().getStatus() != VMStatus.Down) .filter(p -> p.getSecond().isPlugged()) .map(Pair::getFirst) .findFirst() .orElse(null)); if (getVm() != null) { setVdsId(getVm().getRunOnVds()); } }

Target:
public void init() { super.init(); setStorageDomainId(getDiskImage().getStorageIds().get(0)); setStoragePoolId(getDiskImage().getStoragePoolId()); setImageGroupId(getDiskImage().getId()); setVm(vmDao .getVmsWithPlugInfo(getDiskImage().getId()) .stream() .filter(p -> p.getFirst().getStatus().isRunning()) .filter(p -> p.getSecond().isPlugged()) .map(Pair::getFirst) .findFirst() .orElse(null)); if (getVm() != null) { setVdsId(getVm().getRunOnVds()); } }
Source:
public static @NotNull Map<String, String> sanitizeException(@Nullable Throwable t) { return ImmutableMap.of( "error", t == null ? "null" : (t.getMessage() == null ? t.toString() : t.getMessage()) ); }

Target:
public static Map<String, String> sanitizeException(@Nullable Throwable t) { return ImmutableMap.of( "error", t == null ? "null" : (t.getMessage() == null ? t.toString() : t.getMessage()) ); }
Source:
public void abort(String reason, Throwable cause) { synchronized (this) { if (abortRequested) { LOG.debug( "Abort already in progress. Ignoring the current request with reason: {}", reason); return; } setAbortRequested(); } String msg = "***** ABORTING region server " + this + ": " + reason + " *****"; if (cause != null) { LOG.error(HBaseMarkers.FATAL, msg, cause); } else { LOG.error(HBaseMarkers.FATAL, msg); } LOG.error(HBaseMarkers.FATAL, "RegionServer abort: loaded coprocessors are: " + CoprocessorHost.getLoadedCoprocessors()); try { LOG.info("Dump of metrics as JSON on abort: " + DumpRegionServerMetrics.dumpMetrics()); } catch (MalformedObjectNameException | IOException e) { LOG.warn("Failed dumping metrics", e); } try { if (cause != null) { msg += "\nCause:\n" + Throwables.getStackTraceAsString(cause); } RegionServerStatusService.BlockingInterface rss = rssStub; if (rss != null && this.serverName != null) { ReportRSFatalErrorRequest.Builder builder = ReportRSFatalErrorRequest.newBuilder(); builder.setServer(ProtobufUtil.toServerName(this.serverName)); builder.setErrorMessage(msg); rss.reportRSFatalError(null, builder.build()); } } catch (Throwable t) { LOG.warn("Unable to report fatal error to master", t); } scheduleAbortTimer(); stop(reason, true, null); }

Target:
public void abort(String reason, Throwable cause) { if (!setAbortRequested()) { LOG.debug( "Abort already in progress. Ignoring the current request with reason: {}", reason); return; } String msg = "***** ABORTING region server " + this + ": " + reason + " *****"; if (cause != null) { LOG.error(HBaseMarkers.FATAL, msg, cause); } else { LOG.error(HBaseMarkers.FATAL, msg); } LOG.error(HBaseMarkers.FATAL, "RegionServer abort: loaded coprocessors are: " + CoprocessorHost.getLoadedCoprocessors()); try { LOG.info("Dump of metrics as JSON on abort: " + DumpRegionServerMetrics.dumpMetrics()); } catch (MalformedObjectNameException | IOException e) { LOG.warn("Failed dumping metrics", e); } try { if (cause != null) { msg += "\nCause:\n" + Throwables.getStackTraceAsString(cause); } RegionServerStatusService.BlockingInterface rss = rssStub; if (rss != null && this.serverName != null) { ReportRSFatalErrorRequest.Builder builder = ReportRSFatalErrorRequest.newBuilder(); builder.setServer(ProtobufUtil.toServerName(this.serverName)); builder.setErrorMessage(msg); rss.reportRSFatalError(null, builder.build()); } } catch (Throwable t) { LOG.warn("Unable to report fatal error to master", t); } scheduleAbortTimer(); stop(reason, true, null); }
Source:
public void prepareSplitsForEpoch() { trainingDataSplits.clear(); final Set<K> keys = memoryStore.getAll().keySet(); final int sizeOfTrainingDataSplit = keys.size() / numMiniBatchesPerEpoch; int splitIndex = 0; for (final K key : keys) { if (trainingDataSplits.size() < splitIndex + 1) { trainingDataSplits.add(new ArrayList()); } trainingDataSplits.get(splitIndex).add(key); if (trainingDataSplits.get(splitIndex).size() == sizeOfTrainingDataSplit && (splitIndex + 1) < numMiniBatchesPerEpoch) { splitIndex++; } } currentMiniBatch = 0; }

Target:
public void prepareSplitsForEpoch() { trainingDataSplits.clear(); final Set<K> keys = memoryStore.getAll().keySet(); final int sizeOfTrainingDataSplit = keys.size() / numMiniBatchesPerEpoch; final int numberOfSplitsToTakeExtra = keys.size() % numMiniBatchesPerEpoch; List<K> currentSplitList = null; int splitSize = 0; for (final K key : keys) { if (currentSplitList == null) { final int splitIndex = trainingDataSplits.size(); trainingDataSplits.add(new ArrayList<>()); currentSplitList = trainingDataSplits.get(splitIndex); splitSize = splitIndex < numberOfSplitsToTakeExtra ? sizeOfTrainingDataSplit + 1 : sizeOfTrainingDataSplit; } currentSplitList.add(key); if (currentSplitList.size() == splitSize) { currentSplitList = null; } } trainingDataSplitsIterator = trainingDataSplits.iterator(); }
Source:
public void testReferenceSourceUpperCasesBases() throws NoSuchAlgorithmException, IOException { final String sequenceName = "1"; final String nonIupacCharacters = "1=eE"; final byte[] originalRefBases = (nonIupacCharacters+SequenceUtil.IUPAC_CODES_STRING).getBytes(); SAMSequenceRecord sequenceRecord = new SAMSequenceRecord(sequenceName, originalRefBases.length); InMemoryReferenceSequenceFile memoryReferenceSequenceFile = new InMemoryReferenceSequenceFile(); memoryReferenceSequenceFile.add(sequenceName, Arrays.copyOf(originalRefBases, originalRefBases.length)); Assert.assertEquals(memoryReferenceSequenceFile.getSequence(sequenceName).getBases(), originalRefBases); ReferenceSource referenceSource = new ReferenceSource(memoryReferenceSequenceFile); byte[] refBasesFromSource = referenceSource.getReferenceBases(sequenceRecord, false); Assert.assertNotEquals(refBasesFromSource, originalRefBases); Assert.assertEquals(refBasesFromSource, SequenceUtil.upperCase(originalRefBases)); }

Target:
public void testReferenceSourceUpperCasesBases() { final String sequenceName = "1"; final String nonIupacCharacters = "1=eE"; final byte[] originalRefBases = (nonIupacCharacters + SequenceUtil.getIUPACCodesString()).getBytes(); SAMSequenceRecord sequenceRecord = new SAMSequenceRecord(sequenceName, originalRefBases.length); InMemoryReferenceSequenceFile memoryReferenceSequenceFile = new InMemoryReferenceSequenceFile(); memoryReferenceSequenceFile.add(sequenceName, Arrays.copyOf(originalRefBases, originalRefBases.length)); Assert.assertEquals(memoryReferenceSequenceFile.getSequence(sequenceName).getBases(), originalRefBases); ReferenceSource referenceSource = new ReferenceSource(memoryReferenceSequenceFile); byte[] refBasesFromSource = referenceSource.getReferenceBases(sequenceRecord, false); Assert.assertNotEquals(refBasesFromSource, originalRefBases); Assert.assertEquals(refBasesFromSource, SequenceUtil.upperCase(originalRefBases)); }
Source:
public void testHidingTags() throws ApiException { ApiClient client = getAdminWebClient(); ContainersApi containersApi = new ContainersApi(client); DockstoreTool c = containersApi.getContainerByToolPath(REGISTRY_HUB_DOCKER_COM_SEQWARE_SEQWARE, null); assertEquals("should see one tag as an admin, saw " + c.getWorkflowVersions().size(), 2, c.getWorkflowVersions().size()); ApiClient muggleClient = getWebClient(); ContainersApi muggleContainersApi = new ContainersApi(muggleClient); final DockstoreTool registeredContainer = muggleContainersApi.getPublishedContainer(c.getId(), null); assertEquals("should see no tags as a regular user, saw " + registeredContainer.getWorkflowVersions().size(), 1, registeredContainer.getWorkflowVersions().size()); }

Target:
public void testHidingTags() throws ApiException { ApiClient client = getAdminWebClient(); ContainersApi containersApi = new ContainersApi(client); DockstoreTool c = containersApi.getContainerByToolPath(REGISTRY_HUB_DOCKER_COM_SEQWARE_SEQWARE, null); assertEquals("should see all tags even if hidden as an admin", 2, c.getWorkflowVersions().size()); ApiClient muggleClient = getWebClient(); ContainersApi muggleContainersApi = new ContainersApi(muggleClient); final DockstoreTool registeredContainer = muggleContainersApi.getPublishedContainer(c.getId(), null); assertEquals("should only see non-hidden tags as a regular user", 1, registeredContainer.getWorkflowVersions().size()); }
Source:
public void streamerRespectsMaxMessageSize() { InternalDistributedMember member1; member1 = new InternalDistributedMember("localhost", 1234); DistributionMessage message = new SerialAckedMessage(); message.setRecipients(Arrays.asList(member1)); when(connection1.getRemoteAddress()).thenReturn(member1); when(connection1.getRemoteVersion()).thenReturn(KnownVersion.CURRENT); when(connection1.getSendBufferSize()).thenReturn(Connection.MAX_MSG_SIZE * 2); List<Connection> connections = Arrays.asList(connection1); final BaseMsgStreamer msgStreamer = MsgStreamer.create(connections, message, false, stats, pool); assertThat(((MsgStreamer) msgStreamer).getBuffer().capacity()) .isEqualTo(Connection.MAX_MSG_SIZE); }

Target:
public void streamerRespectsMaxMessageSize() { InternalDistributedMember member1; member1 = new InternalDistributedMember("localhost", 1234); DistributionMessage message = new SerialAckedMessage(); message.setRecipients(Arrays.asList(member1)); when(connection1.getRemoteAddress()).thenReturn(member1); when(connection1.getRemoteVersion()).thenReturn(KnownVersion.CURRENT); when(connection1.getSendBufferSize()).thenReturn(Connection.MAX_MSG_SIZE + 1); List<Connection> connections = Arrays.asList(connection1); final BaseMsgStreamer msgStreamer = MsgStreamer.create(connections, message, false, stats, pool); assertThat(((MsgStreamer) msgStreamer).getBuffer().capacity()) .isEqualTo(Connection.MAX_MSG_SIZE); }
Source:
public BlobDownloadResponse downloadWithResponse(OutputStream stream, BlobRange range, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, Context context) { Context updatedContext = context == null ? Context.NONE.addData(CoreConstants.DISABLE_BUFFER_COPY, true) : context.addData(CoreConstants.DISABLE_BUFFER_COPY, true); StorageImplUtils.assertNotNull("stream", stream); Mono<BlobDownloadResponse> download = client .downloadWithResponse(range, options, requestConditions, getRangeContentMd5, updatedContext) .flatMap(response -> response.getValue().reduce(stream, (outputStream, buffer) -> { try { outputStream.write(FluxUtil.byteBufferToArray(buffer)); return outputStream; } catch (IOException ex) { throw logger.logExceptionAsError(Exceptions.propagate(new UncheckedIOException(ex))); } }).thenReturn(new BlobDownloadResponse(response))); return blockWithOptionalTimeout(download, timeout); }

Target:
public BlobDownloadResponse downloadWithResponse(OutputStream stream, BlobRange range, DownloadRetryOptions options, BlobRequestConditions requestConditions, boolean getRangeContentMd5, Duration timeout, Context context) { StorageImplUtils.assertNotNull("stream", stream); Mono<BlobDownloadResponse> download = client .downloadWithResponse(range, options, requestConditions, getRangeContentMd5, context) .flatMap(response -> response.getValue().reduce(stream, (outputStream, buffer) -> { try { outputStream.write(FluxUtil.byteBufferToArray(buffer)); return outputStream; } catch (IOException ex) { throw logger.logExceptionAsError(Exceptions.propagate(new UncheckedIOException(ex))); } }).thenReturn(new BlobDownloadResponse(response))); return blockWithOptionalTimeout(download, timeout); }
Source:
public List<SecurityTeam> getSecurityTeams(PerunSession sess) throws PrivilegeException, InternalErrorException { Utils.checkPerunSession(sess); if (AuthzResolverBlImpl.isAuthorized(sess, Role.PERUNADMIN) || AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { return getSecurityTeamsManagerBl().getAllSecurityTeams(sess); } else if (AuthzResolverBlImpl.isAuthorized(sess, Role.SECURITYADMIN)) { List<SecurityTeam> securityTeams = new ArrayList<>(); for (PerunBean st: AuthzResolver.getComplementaryObjectsForRole(sess, Role.SECURITYADMIN, SecurityTeam.class)) { securityTeams.add((SecurityTeam) st); } return securityTeams; } else { throw new PrivilegeException("getSecurityTeams"); } }

Target:
public List<SecurityTeam> getSecurityTeams(PerunSession sess) throws PrivilegeException, InternalErrorException { Utils.checkPerunSession(sess); if (AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { return getSecurityTeamsManagerBl().getAllSecurityTeams(sess); } else if (AuthzResolver.isAuthorized(sess, Role.SECURITYADMIN)) { List<SecurityTeam> securityTeams = new ArrayList<>(); for (PerunBean st: AuthzResolver.getComplementaryObjectsForRole(sess, Role.SECURITYADMIN, SecurityTeam.class)) { securityTeams.add((SecurityTeam) st); } return securityTeams; } else { throw new PrivilegeException("getSecurityTeams"); } }
Source:
private void outputProcedures(Configuration config) { File outputFile = new File(config.m_getOutput); if (outputFile.exists() && !config.m_forceGetCreate) { System.err.println("FATAL: Failed to save classes, file already exists: " + config.m_getOutput); VoltDB.exit(-1); } try { InMemoryJarfile catalogJar = CatalogUtil.loadInMemoryJarFile(MiscUtils.fileToBytes(new File (config.m_pathToCatalog))); InMemoryJarfile filteredJar = CatalogUtil.getClassesFromJar(catalogJar); filteredJar.writeToFile(outputFile); System.out.println("Classes file in jar file saved at " + outputFile.getPath()); } catch (IOException e) { System.err.println("FATAL: Failed to read classes " + config.m_pathToCatalog + " : " + e.getMessage()); VoltDB.exit(-1); } }

Target:
private int outputProcedures(Configuration config) { File outputFile = new File(config.m_getOutput); if (outputFile.exists() && !config.m_forceGetCreate) { consoleLog.fatal("Failed to save classes, file already exists: " + config.m_getOutput); return -1; } try { InMemoryJarfile catalogJar = CatalogUtil.loadInMemoryJarFile(MiscUtils.fileToBytes(new File (config.m_pathToCatalog))); InMemoryJarfile filteredJar = CatalogUtil.getCatalogJarWithoutDefaultArtifacts(catalogJar); filteredJar.writeToFile(outputFile); consoleLog.info("Classes file in jar file saved at " + outputFile.getPath()); } catch (IOException e) { consoleLog.fatal("Failed to read classes " + config.m_pathToCatalog + " : " + e.getMessage()); return -1; } return 0; }