auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String spawnPrefab(@Sender EntityRef sender, @CommandParam("prefabId") String prefabName) { ClientComponent clientComponent = sender.getComponent(ClientComponent.class); LocationComponent characterLocation = clientComponent.character.getComponent(LocationComponent.class); Vector3f spawnPos = characterLocation.getWorldPosition(); Vector3f offset = new Vector3f(characterLocation.getWorldDirection()); offset.scale(2); spawnPos.add(offset); Vector3f dir = new Vector3f(characterLocation.getWorldDirection()); dir.y = 0; if (dir.lengthSquared() > 0.001f) { dir.normalize(); } else { dir.set(Direction.FORWARD.getVector3f()); } Quat4f rotation = Quat4f.shortestArcQuat(Direction.FORWARD.getVector3f(), dir); Optional<Prefab> prefab = Assets.getPrefab(prefabName); if (prefab.isPresent() && prefab.get().getComponent(LocationComponent.class) != null) { entityManager.create(prefab.get(), spawnPos); return "Done"; } else if (!prefab.isPresent()) { return "Unknown prefab"; } else { return "Prefab cannot be spawned (no location component)"; } }

Target:
public String spawnPrefab(@Sender EntityRef sender, @CommandParam("prefabId") String prefabName) { ClientComponent clientComponent = sender.getComponent(ClientComponent.class); LocationComponent characterLocation = clientComponent.character.getComponent(LocationComponent.class); Vector3f spawnPos = characterLocation.getWorldPosition(); Vector3f offset = new Vector3f(characterLocation.getWorldDirection()); offset.scale(2); spawnPos.add(offset); Vector3f dir = new Vector3f(characterLocation.getWorldDirection()); dir.y = 0; if (dir.lengthSquared() > 0.001f) { dir.normalize(); } else { dir.set(Direction.FORWARD.getVector3f()); } return Assets.getPrefab(prefabName).map(prefab -> { LocationComponent loc = prefab.getComponent(LocationComponent.class); if (loc != null) { entityManager.create(prefab, spawnPos); return "Done"; } else { return "Prefab cannot be spawned (no location component)"; } }).orElse("Unknown prefab"); }
Source:
public PlanItem(String id, String definitionRef) { super(); this.id = id; this.definitionRef = definitionRef; }

Target:
public PlanItem(String id, String definitionRef) { this.id = id; this.definitionRef = definitionRef; }
Source:
public void test() throws Exception { Marshaller marshaller = MarshallerFactory.newMarshaller(kbase); try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) { marshaller.marshall(baos, ksession); try (final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray())) { marshaller = MarshallerFactory.newMarshaller(kbase); ksession = marshaller.unmarshall(bais); } } catch (NullPointerException e) { throw new RuntimeException("Consider reopening BZ 1193600!", e); } }

Target:
public void test() throws Exception { Marshaller marshaller = MarshallerFactory.newMarshaller(kbase); try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) { marshaller.marshall(baos, ksession); try (final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray())) { marshaller = MarshallerFactory.newMarshaller(kbase); ksession = marshaller.unmarshall(bais); } } catch (NullPointerException e) { Assertions.fail("Consider reopening BZ 1193600!", e); } }
Source:
public History get(File file, Repository repository, boolean withFiles) throws HistoryException { File cache = getCachedFile(file); if (isUpToDate(file, cache)) { try { return readCache(cache); } catch (Exception e) { LOGGER.log(Level.WARNING, "Error when reading cache file '" + cache, e); } } RuntimeEnvironment env = RuntimeEnvironment.getInstance(); if (isHistoryIndexDone() && repository.hasHistoryForDirectories() && !env.isFetchHistoryWhenNotInCache()) { return null; } final History history; long time; try { time = System.currentTimeMillis(); history = repository.getHistory(file); time = System.currentTimeMillis() - time; } catch (UnsupportedOperationException e) { return null; } if (!file.isDirectory()) { if ((cache != null) && (cache.exists() || (time > env.getHistoryReaderTimeLimit()))) { storeFile(history, file, repository, false); } } return history; }

Target:
public History get(File file, Repository repository, boolean withFiles) throws HistoryException { File cache = getCachedFile(file); if (isUpToDate(file, cache)) { try { return readCache(cache); } catch (Exception e) { LOGGER.log(Level.WARNING, "Error when reading cache file '" + cache, e); } } RuntimeEnvironment env = RuntimeEnvironment.getInstance(); if (isHistoryIndexDone() && repository.hasHistoryForDirectories() && !env.isFetchHistoryWhenNotInCache()) { return null; } final History history; long time; try { time = System.currentTimeMillis(); history = repository.getHistory(file); time = System.currentTimeMillis() - time; } catch (UnsupportedOperationException e) { return null; } if (!file.isDirectory()) { if ((cache != null) && (cache.exists() || (time > env.getHistoryReaderTimeLimit()))) { storeFile(history, file, repository); } } return history; }
Source:
Function<String, SnapshotSender> localSnapshotSenderFactory() { return LocalSnapshotSender::new; }

Target:
Function<String, SnapshotSender> localSnapshotSenderFactory() { return locSndrFactory; }
Source:
public List<Dependency> extract(NpmProject npmProject) { npmProject.getDependencies().forEach(this::populateDependencies); if (!badPackages.isEmpty()) { logger.info((Arrays.toString(badPackages.toArray()))); logger.info("The npm dependencies above could not be found in Artifactory and therefore are not included in the build-info. " + "Make sure the dependencies are available in Artifactory for this build."); } return new ArrayList<>(dependencies.values()); }

Target:
public Build extract(NpmProject npmProject) throws Exception { String resolutionRepository = npmProject.getResolutionRepository(); List<String> installationArgs = npmProject.getInstallationArgs(); Path workingDir = npmProject.getWorkingDir(); preparePrerequisites(resolutionRepository, workingDir); createTempNpmrc(workingDir, installationArgs); runInstall(workingDir, installationArgs); restoreNpmrc(workingDir); List<Dependency> dependencies = collectDependencies(workingDir); return createBuild(dependencies); }
Source:
public void collect(List<String> filePathStrings, String binKey, Map<String, String> extras) throws IOException { DepositBinConfiguration config = getConfiguration(binKey); if (config == null) { log.warn("Invalid bin specified: {}", binKey); return; } List<Path> filePaths; if (filePathStrings != null) { filePaths = new ArrayList<>(filePathStrings.size()); for (String filePathString : filePathStrings) { File file = new File(filePathString); Path filePath = file.toPath(); if (!(file.exists() && applicableFile(file, config) && pathInBins(filePath, config.getBinPaths()))) { throw new IOException("Specified file was not a valid target for bin " + config.getName() + ": " + file.getAbsolutePath()); } filePaths.add(filePath); } } else { List<String> fileList = this.listFiles(binKey); filePaths = new ArrayList<>(fileList.size()); for (String filePathString : fileList) { filePaths.add(Paths.get(filePathString)); } } DepositInfo info = makeDeposit(); moveFiles(filePaths, info, config); registerDeposit(info, config, extras); }

Target:
public void collect(List<String> filePathStrings, String binKey, Map<String, String> extras) throws IOException { DepositBinConfiguration config = getConfiguration(binKey); if (config == null) { log.warn("Invalid bin specified: {}", binKey); return; } try { config.getKeyLock().lock(); List<Path> filePaths; if (filePathStrings != null) { filePaths = new ArrayList<>(filePathStrings.size()); for (String filePathString : filePathStrings) { File file = new File(filePathString); Path filePath = file.toPath(); if (!(file.exists() && applicableFile(file, config) && pathInBins(filePath, config.getBinPaths()))) { throw new IOException("Specified file was not a valid target for bin " + config.getName() + ": " + file.getAbsolutePath()); } filePaths.add(filePath); } } else { List<String> fileList = this.listFiles(binKey); filePaths = new ArrayList<>(fileList.size()); for (String filePathString : fileList) { filePaths.add(Paths.get(filePathString)); } } DepositInfo info = makeDeposit(); moveFiles(filePaths, info, config); registerDeposit(info, config, extras); } finally { config.getKeyLock().unlock(); } }
Source:
private void emit(final LogLevel level, final Throwable throwable, final Object... parts) { if (isEnabled(level)) { synchronized (this.out) { this.out.print(level.name()); this.out.print('\t'); this.out.print(getTimestamp()); this.out.print('\t'); this.out.print(this.className); this.out.print('\t'); for (final Object part : parts) { if (part != null && part.getClass().isArray()) { final Class<?> component = part.getClass().getComponentType(); if (component.equals(Boolean.TYPE)) this.out.print(Arrays.toString( (boolean[]) part)); else if (component.equals(Byte.TYPE)) this.out.print(Arrays.toString( (byte[]) part)); else if (component.equals(Character.TYPE)) this.out.print(Arrays.toString( (char[]) part)); else if (component.equals(Double.TYPE)) this.out.print(Arrays.toString( (double[]) part)); else if (component.equals(Float.TYPE)) this.out.print(Arrays.toString( (float[]) part)); else if (component.equals(Integer.TYPE)) this.out.print(Arrays.toString( (int[]) part)); else if (component.equals(Long.TYPE)) this.out.print(Arrays.toString( (long[]) part)); else if (component.equals(Short.TYPE)) this.out.print(Arrays.toString( (short[]) part)); else this.out.print(Arrays.toString( (Object[]) part)); } else { this.out.print(part); } } this.out.println(); if (throwable != null) { throwable.printStackTrace(this.out); } } } }

Target:
private void emit(final LogLevel level, final Throwable throwable, final Object... parts) { if (isEnabled(level)) { StringBuffer tmp = new StringBuffer(); tmp.append(level.name()); tmp.append('\t'); tmp.append(getTimestamp()); tmp.append('\t'); tmp.append(this.className); tmp.append('\t'); for (final Object part : parts) { if (part != null && part.getClass().isArray()) { final Class<?> component = part.getClass().getComponentType(); if (component.equals(Boolean.TYPE)) tmp.append(Arrays.toString( (boolean[]) part)); else if (component.equals(Byte.TYPE)) tmp.append(Arrays.toString( (byte[]) part)); else if (component.equals(Character.TYPE)) tmp.append(Arrays.toString( (char[]) part)); else if (component.equals(Double.TYPE)) tmp.append(Arrays.toString( (double[]) part)); else if (component.equals(Float.TYPE)) tmp.append(Arrays.toString( (float[]) part)); else if (component.equals(Integer.TYPE)) tmp.append(Arrays.toString( (int[]) part)); else if (component.equals(Long.TYPE)) tmp.append(Arrays.toString( (long[]) part)); else if (component.equals(Short.TYPE)) tmp.append(Arrays.toString( (short[]) part)); else tmp.append(Arrays.toString( (Object[]) part)); } else { tmp.append(part); } } if (throwable != null) { synchronized (this.out) { this.out.println(tmp.toString()); throwable.printStackTrace(this.out); } } else { this.out.println(tmp.toString()); } } }
Source:
public void validate_shouldFailValidationIfFieldLengthsAreNotCorrect() throws Exception { Role role = new Role(); role.setRole( "too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text"); role.setDescription( "too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text"); Errors errors = new BindException(role, "type"); dao.validate(role, errors); Assert.assertTrue(errors.hasFieldErrors("role")); }

Target:
public void validate_shouldFailValidationIfFieldLengthsAreNotCorrect() throws Exception { String errorCode = "error.exceededMaxLengthOfField"; String[] RoleFeilds = new String[] { "role", "description" }; Role role = new Role(); role.setRole( "too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text"); role.setDescription( "too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text"); Errors errors = new BindException(role, "type"); dao.validate(role, errors); for (String feilds : RoleFeilds) { FieldError fielderror = errors.getFieldError(feilds); Assert.assertTrue(errorCode.equals(fielderror.getCode())); } }
Source:
private static List<ExtendedTextEdit> convertToExtendedEdit( List<TextEdit> edits, String filePath) { try { if (!isStartWithProject(filePath)) { filePath = prefixProject(filePath); } CharStreamIterator charStreamIter = new CharStreamIterator(CharStreamEditor.forReader(new FileReader(filePath))); return convertToExtendedEdits(edits, charStreamIter); } catch (IOException e) { LOG.error("Can't read file", e); return Collections.emptyList(); } }

Target:
private static List<ExtendedTextEdit> convertToExtendedEdit( List<TextEdit> edits, String filePath) { if (!isStartWithProject(filePath)) { filePath = prefixProject(filePath); } try (FileReader reader = new FileReader(filePath)) { CharStreamIterator charStreamIter = new CharStreamIterator(CharStreamEditor.forReader(reader)); return convertToExtendedEdits(edits, charStreamIter); } catch (IOException e) { LOG.error("Can't read file", e); return Collections.emptyList(); } }
Source:
public static LockAwareTransactionManager setupTxManager(KeyValueService kvs, TimestampService tsService, SweepStrategyManager ssm, TransactionService txService) { LockClient lockClient = LockClient.of("sweep client"); LockService lockService = LockServiceImpl.create( LockServerOptions.builder().isStandaloneServer(false).build()); Supplier<AtlasDbConstraintCheckingMode> constraints = () -> AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING; ConflictDetectionManager cdm = ConflictDetectionManagers.createWithoutWarmingCache(kvs); Cleaner cleaner = new NoOpCleaner(); LockAwareTransactionManager txManager = new SerializableTransactionManager(kvs, tsService, lockClient, lockService, txService, constraints, cdm, ssm, cleaner, false, 16, 4); setupTables(kvs); return txManager; }

Target:
public static LockAwareTransactionManager setupTxManager(KeyValueService kvs, TimestampService tsService, SweepStrategyManager ssm, TransactionService txService) { LockClient lockClient = LockClient.of("sweep client"); LockService lockService = LockServiceImpl.create( LockServerOptions.builder().isStandaloneServer(false).build()); Supplier<AtlasDbConstraintCheckingMode> constraints = () -> AtlasDbConstraintCheckingMode.NO_CONSTRAINT_CHECKING; ConflictDetectionManager cdm = ConflictDetectionManagers.createWithoutWarmingCache(kvs); Cleaner cleaner = new NoOpCleaner(); LockAwareTransactionManager txManager = new SerializableTransactionManager( kvs, tsService, lockClient, lockService, txService, constraints, cdm, ssm, cleaner, false, AbstractTransactionTest.GET_RANGES_THREAD_POOL_SIZE, AbstractTransactionTest.DEFAULT_GET_RANGES_CONCURRENCY); setupTables(kvs); return txManager; }
Source:
public SProcessDefinition getProcessDefinition(final long processId) throws SProcessDefinitionNotFoundException, SProcessDefinitionReadException { try { final SProcessDefinitionDeployInfo processDeploymentInfo = getProcessDeploymentInfo(processId); final Pair<Long, SProcessDefinition> processWithTimestamp = getFromCache(processId); SProcessDefinition sProcessDefinition; if (processWithTimestamp == null || processWithTimestamp.getKey() != processDeploymentInfo.getLastUpdateDate()) { final DesignProcessDefinition objectFromXML = processDefinitionBARContribution.convertXmlToProcess(processDeploymentInfo.getDesignContent() .getContent()); sProcessDefinition = convertDesignProcessDefinition(objectFromXML); setIdOnProcessDefinition(sProcessDefinition, processId); cache(sProcessDefinition, processDeploymentInfo.getLastUpdateDate()); } else { sProcessDefinition = processWithTimestamp.getValue(); } return sProcessDefinition; } catch (XMLParseException | IOException | SReflectException | SCacheException e) { throw new SProcessDefinitionReadException(e); } }

Target:
public SProcessDefinition getProcessDefinition(final long processId) throws SProcessDefinitionNotFoundException, SProcessDefinitionReadException { try { final SProcessDefinitionDeployInfo processDeploymentInfo = getProcessDeploymentInfo(processId); final Pair<Long, SProcessDefinition> processWithTimestamp = getSProcessDefinitionFromCache(processId); if (isSProcessDefinitionUpToDate(processDeploymentInfo, processWithTimestamp)) { return readSProcessDefinitionFromDatabase(processId, processDeploymentInfo); } else { return processWithTimestamp.getValue(); } } catch (XMLParseException | IOException | SReflectException | SCacheException e) { throw new SProcessDefinitionReadException(e); } }
Source:
protected Warning createWarning(Matcher matcher) { String message = matcher.group(5); String category = classifyIfEmpty(matcher.group(2), message); Priority priority = Priority.LOW; switch (category.charAt(0)){ case 'E': priority = Priority.HIGH; category = "ERROR"; break; case 'W': priority = Priority.NORMAL; category = "WARNING"; break; case 'I': priority = Priority.LOW; category = "IGNORE"; break; } return createWarning(matcher.group(1), getLineNumber(matcher.group(3)), category, message, priority); }

Target:
protected Warning createWarning(Matcher matcher) { String message = matcher.group(4); String category = classifyIfEmpty(matcher.group(1), message); Priority priority = Priority.LOW; switch (category.charAt(0)){ case 'E': priority = Priority.HIGH; category = "ERROR"; break; case 'W': priority = Priority.NORMAL; category = "WARNING"; break; case 'I': priority = Priority.LOW; category = "IGNORE"; break; default: break; } return createWarning(fileName, getLineNumber(matcher.group(2)), category, message, priority); }
Source:
public AsyncFuture<WriteMetadata> write(final WriteMetadata.Request request) { return doto(c -> { final Series series = request.getSeries(); final String id = series.hash(); final String[] indices; try { indices = c.writeIndices(); } catch (NoIndexSelectedException e) { return async.failed(e); } final List<AsyncFuture<WriteMetadata>> writes = new ArrayList<>(); for (final String index : indices) { if (!writeCache.acquire(Pair.of(index, series.getHashCode()), reporter::reportWriteDroppedByCacheHit, reporter::reportWriteDroppedByRateLimit)) { continue; } final XContentBuilder source = XContentFactory.jsonBuilder(); source.startObject(); buildContext(source, series); source.endObject(); final IndexRequestBuilder builder = c .index(index, TYPE_METADATA) .setId(id) .setSource(source) .setOpType(OpType.CREATE); final RequestTimer<WriteMetadata> timer = WriteMetadata.timer(); final FutureReporter.Context writeContext = reporter.setupBackendWriteReporter(); AsyncFuture<WriteMetadata> result = bind(builder.execute()) .directTransform(response -> timer.end()) .catchFailed(throwable -> { if (throwable instanceof VersionConflictEngineException) { reporter.reportWriteDroppedByDuplicate(); return WriteMetadata.of(); } log.error("Metadata write failed: ", throwable); throw new RuntimeException(throwable); }) .onDone(writeContext); writes.add(result); } return async.collect(writes, WriteMetadata.reduce()); }); }

Target:
public AsyncFuture<WriteMetadata> write(final WriteMetadata.Request request) { return doto(c -> { final Series series = request.getSeries(); final String id = series.hash(); final String[] indices; try { indices = c.writeIndices(); } catch (NoIndexSelectedException e) { return async.failed(e); } final List<AsyncFuture<WriteMetadata>> writes = new ArrayList<>(); for (final String index : indices) { if (!writeCache.acquire(Pair.of(index, series.getHashCode()), reporter::reportWriteDroppedByCacheHit, reporter::reportWriteDroppedByRateLimit)) { continue; } final XContentBuilder source = XContentFactory.jsonBuilder(); source.startObject(); buildContext(source, series); source.endObject(); final IndexRequestBuilder builder = c .index(index, TYPE_METADATA) .setId(id) .setSource(source) .setOpType(OpType.CREATE); final RequestTimer<WriteMetadata> timer = WriteMetadata.timer(); final FutureReporter.Context writeContext = reporter.setupBackendWriteReporter(); AsyncFuture<WriteMetadata> result = bind(builder.execute()) .directTransform(response -> timer.end()) .catchFailed(handleVersionConflict(WriteMetadata::of, reporter::reportWriteDroppedByDuplicate)) .onDone(writeContext); writes.add(result); } return async.collect(writes, WriteMetadata.reduce()); }); }
Source:
public void deactivate() { logger.debug("deactivate() is called!"); disconnect(); }

Target:
public void deactivate() { logger.trace("deactivate() is called!"); stopWatchdog(); disconnect(); }
Source:
private String getQualifiedName(AstNode node) { Symbol symbol = getContext().symbolTable().getSymbol(node); if (symbol != null) { return symbol.qualifiedName(); } return ""; }

Target:
private String getQualifiedName(AstNode node) { Symbol symbol = getContext().symbolTable().getSymbol(node); return symbol != null ? symbol.qualifiedName() : ""; }
Source:
public Result implement(EnumerableRelImplementor implementor, Prefer pref) { if (getCall().getKind() == SqlKind.TUMBLE) { return tableValuedFunctionWindowingImplement(implementor, pref); } else { BlockBuilder bb = new BlockBuilder(); final JavaRowFormat format; if (getElementType() == null) { format = JavaRowFormat.ARRAY; } else if (rowType.getFieldCount() == 1 && isQueryable()) { format = JavaRowFormat.SCALAR; } else if (getElementType() instanceof Class && Object[].class.isAssignableFrom((Class) getElementType())) { format = JavaRowFormat.ARRAY; } else { format = JavaRowFormat.CUSTOM; } final PhysType physType = PhysTypeImpl.of(implementor.getTypeFactory(), getRowType(), format, false); RexToLixTranslator t = RexToLixTranslator.forAggregation( (JavaTypeFactory) getCluster().getTypeFactory(), bb, null, implementor.getConformance()); t = t.setCorrelates(implementor.allCorrelateVariables); bb.add(Expressions.return_(null, t.translate(getCall()))); return implementor.result(physType, bb.toBlock()); } }

Target:
public Result implement(EnumerableRelImplementor implementor, Prefer pref) { if (isImplementorDefined((RexCall) getCall())) { return tvfImplementorBasedImplement(implementor, pref); } else { return defaultTableValuedFunctionImplement(implementor, pref); } }
Source:
public Set<Cube> calculate(Cube cube) { ICubicWorld world = cube.getWorld(); ICubeCache cache = world.getCubeCache(); for (int x = -2; x <= 2; ++x) { for (int y = -2; y <= 2; ++y) { for (int z = -2; z <= 2; ++z) { CubeCoords coords = new CubeCoords(cube.getX() + x, cube.getY() + y, cube.getZ() + z); if (!cache.cubeExists(coords) || cache.getCube(coords).getCurrentStage().precedes(generatorStage)) { CubicChunks.LOGGER.error("Missing cube ({})! {}/{}", coords, cache.getCube(coords).getCurrentStage().getName(), generatorStage.getName()); System.exit(1); } } } } setRawSkylight(cube); diffuseSkylight(cube); return Sets.newHashSet(cube); }

Target:
public Set<Cube> calculate(Cube cube) { setRawSkylight(cube); diffuseSkylight(cube); return Sets.newHashSet(cube); }
Source:
private NodeSchemaLoadResult loadSchemaFromYaml(File schemaFile) { LOG.info("Loading network topology layer schema file " + schemaFile); NodeSchemaLoadResult finalSchema; try { FileInputStream fileInputStream = new FileInputStream(schemaFile); Yaml yaml = new Yaml(); NodeSchema nodeTree = yaml.loadAs(fileInputStream, NodeSchema.class); fileInputStream.close(); List<NodeSchema> schemaList = new ArrayList<>(); if (nodeTree.getType() != LayerType.ROOT) { throw new IllegalArgumentException("First layer is not a ROOT node." + " schema file: " + schemaFile.getAbsolutePath()); } schemaList.add(nodeTree); if (nodeTree.getSublayer() != null) { nodeTree = nodeTree.getSublayer().get(0); } while (nodeTree != null) { if (nodeTree.getType() == LayerType.LEAF_NODE && nodeTree.getSublayer() != null) { throw new IllegalArgumentException("Leaf node in the middle of path." + " schema file: " + schemaFile.getAbsolutePath()); } if (nodeTree.getType() == LayerType.ROOT) { throw new IllegalArgumentException("Multiple root nodes are defined." + " schema file: " + schemaFile.getAbsolutePath()); } schemaList.add(nodeTree); if (nodeTree.getSublayer() != null) { nodeTree = nodeTree.getSublayer().get(0); } else { break; } } finalSchema = new NodeSchemaLoadResult(schemaList, true); } catch (Exception e) { throw new IllegalArgumentException("Fail to load network topology node" + " schema file: " + schemaFile.getAbsolutePath() + " , error:" + e.getMessage()); } return finalSchema; }

Target:
private NodeSchemaLoadResult loadSchemaFromYaml(File schemaFile) { LOG.info("Loading network topology layer schema file {}", schemaFile); NodeSchemaLoadResult finalSchema; try { Yaml yaml = new Yaml(); NodeSchema nodeTree; try (FileInputStream fileInputStream = new FileInputStream(schemaFile)) { nodeTree = yaml.loadAs(fileInputStream, NodeSchema.class); } List<NodeSchema> schemaList = new ArrayList<>(); if (nodeTree.getType() != LayerType.ROOT) { throw new IllegalArgumentException("First layer is not a ROOT node." + " schema file: " + schemaFile.getAbsolutePath()); } schemaList.add(nodeTree); if (nodeTree.getSublayer() != null) { nodeTree = nodeTree.getSublayer().get(0); } while (nodeTree != null) { if (nodeTree.getType() == LayerType.LEAF_NODE && nodeTree.getSublayer() != null) { throw new IllegalArgumentException("Leaf node in the middle of path." + " schema file: " + schemaFile.getAbsolutePath()); } if (nodeTree.getType() == LayerType.ROOT) { throw new IllegalArgumentException("Multiple root nodes are defined." + " schema file: " + schemaFile.getAbsolutePath()); } schemaList.add(nodeTree); if (nodeTree.getSublayer() != null) { nodeTree = nodeTree.getSublayer().get(0); } else { break; } } finalSchema = new NodeSchemaLoadResult(schemaList, true); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new IllegalArgumentException("Fail to load network topology node" + " schema file: " + schemaFile.getAbsolutePath() + " , error:" + e.getMessage()); } return finalSchema; }
Source:
protected boolean canAddVm(ArrayList<String> reasons, Collection<StorageDomain> destStorages) { VmStatic vmStaticFromParams = getParameters().getVmStaticData(); boolean returnValue = canAddVm(reasons, vmStaticFromParams.getName(), getStoragePoolId() .getValue(), vmStaticFromParams.getPriority()); if (returnValue) { List<ValidationError> validationErrors = validateCustomProperties(vmStaticFromParams); if (!validationErrors.isEmpty()) { new VmHandler().handleCustomPropertiesError(validationErrors, reasons); returnValue = false; } } if (returnValue && shouldCheckSpaceInStorageDomains()) { if (!getStoragePoolId().equals(getStoragePoolIdFromSourceImageContainer())) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH.toString()); returnValue = false; } else { for (StorageDomain domain : destStorages) { StorageDomainValidator storageDomainValidator = new StorageDomainValidator(domain); if (!validate(storageDomainValidator.isDomainWithinThresholds()) || !validate(storageDomainValidator.isDomainHasSpaceForRequest(getNeededDiskSize(domain.getId())))) { return false; } } } } if (returnValue) { returnValue = isDedicatedVdsOnSameCluster(vmStaticFromParams); } return returnValue; }

Target:
protected boolean canAddVm(ArrayList<String> reasons, Collection<StorageDomain> destStorages) { VmStatic vmStaticFromParams = getParameters().getVmStaticData(); boolean returnValue = canAddVm(reasons, vmStaticFromParams.getName(), getStoragePoolId() .getValue(), vmStaticFromParams.getPriority()); if (returnValue) { List<ValidationError> validationErrors = validateCustomProperties(vmStaticFromParams); if (!validationErrors.isEmpty()) { VmHandler.handleCustomPropertiesError(validationErrors, reasons); returnValue = false; } } if (returnValue && shouldCheckSpaceInStorageDomains()) { if (!getStoragePoolId().equals(getStoragePoolIdFromSourceImageContainer())) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH.toString()); returnValue = false; } else { for (StorageDomain domain : destStorages) { StorageDomainValidator storageDomainValidator = new StorageDomainValidator(domain); if (!validate(storageDomainValidator.isDomainWithinThresholds()) || !validate(storageDomainValidator.isDomainHasSpaceForRequest(getNeededDiskSize(domain.getId())))) { return false; } } } } if (returnValue) { returnValue = isDedicatedVdsOnSameCluster(vmStaticFromParams); } return returnValue; }
Source:
protected void releaseInstance(T instance) { if(!created.contains(instance)) { throw new IllegalArgumentException("Given instance of " + instance.getClass().getName() + " is not managed by this provider"); } if(instance instanceof Closeable) { try { ((Closeable)instance).close(); created.remove(instance); } catch (IOException e) { throw new RuntimeException("Failed to close the instance of " + instance.getClass().getName(), e); } } }

Target:
protected void releaseInstance(T instance) throws IOException { if(!created.remove(instance)) { throw new IllegalArgumentException("Given instance of " + instance.getClass().getName() + " is not managed by this provider"); } if(instance instanceof Closeable) { ((Closeable)instance).close(); } }
Source:
public void removed(Provider<E> provider, E element) { final E existingElement; elementWriteLock.lock(); try { final K uid = element.getUID(); existingElement = identifierToElement.get(uid); if (existingElement == null) { logger.debug("{} with key '{}' could not be removed from provider because it does not exist!", element.getClass().getSimpleName(), uid, provider.getClass().getSimpleName()); return; } try { onRemoveElement(existingElement); } catch (final RuntimeException ex) { logger.warn("Could not remove element: {}", ex.getMessage(), ex); return; } identifierToElement.remove(uid); elementToProvider.remove(existingElement); providerToElements.get(provider).remove(existingElement); elements.remove(existingElement); } finally { elementWriteLock.unlock(); } notifyListenersAboutRemovedElement(existingElement); }

Target:
public void removed(Provider<E> provider, E element) { final E existingElement; elementWriteLock.lock(); try { final K uid = element.getUID(); existingElement = identifierToElement.get(uid); if (existingElement == null) { logger.debug("Cannot remove \"{}\" with key \"{}\" from provider \"{}\" because it does not exist!", element.getClass().getSimpleName(), uid, provider.getClass().getSimpleName()); return; } try { onRemoveElement(existingElement); } catch (final RuntimeException ex) { logger.warn("Cannot remove \"{}\" with key \"{}\": {}", element.getClass().getSimpleName(), uid, ex.getMessage(), ex); return; } identifierToElement.remove(uid); elementToProvider.remove(existingElement); providerToElements.get(provider).remove(existingElement); elements.remove(existingElement); } finally { elementWriteLock.unlock(); } notifyListenersAboutRemovedElement(existingElement); }
Source:
public ConfigDescription getConfigDescription(URI uri, Locale locale) { if ("thing".equals(uri.getScheme()) == false) { return null; } if (thingRegistry == null || thingTypeRegistry == null) { return null; } ThingUID thingUID = new ThingUID(uri.getSchemeSpecificPart()); Thing thing = thingRegistry.get(thingUID); if (thing == null) { return null; } ThingType thingType = thingTypeRegistry.getThingType(thing.getThingTypeUID()); if (thingType == null) { return null; } URI configURI = thingType.getConfigDescriptionURI(); if (configURI == null) { return null; } ConfigDescription config = configDescriptionRegistry.getConfigDescription(configURI, locale); if (config == null) { return null; } return config; }

Target:
public ConfigDescription getConfigDescription(URI uri, Locale locale) { if ("thing".equals(uri.getScheme()) == false) { return null; } ThingUID thingUID = new ThingUID(uri.getSchemeSpecificPart()); Thing thing = thingRegistry.get(thingUID); if (thing == null) { return null; } ThingType thingType = thingTypeRegistry.getThingType(thing.getThingTypeUID()); if (thingType == null) { return null; } URI configURI = thingType.getConfigDescriptionURI(); if (configURI == null) { return null; } ConfigDescription config = configDescriptionRegistry.getConfigDescription(configURI, locale); if (config == null) { return null; } return config; }
Source:
DefaultOperatorContext( Path projectPath, TaskRequest taskRequest, SecretProvider secretProvider, PrivilegedVariables privilegedVariables) { this.projectPath = projectPath; this.taskRequest = taskRequest; this.secretProvider = secretProvider; this.privilegedVariables = privilegedVariables; }

Target:
DefaultOperatorContext( Path projectPath, TaskRequest taskRequest, SecretProvider secretProvider, PrivilegedVariables privilegedVariables) { this.projectPath = requireNonNull(projectPath, "projectPath"); this.taskRequest = requireNonNull(taskRequest, "taskRequest"); this.secretProvider = requireNonNull(secretProvider, "secretProvider"); this.privilegedVariables = requireNonNull(privilegedVariables, "privilegedVariables"); }
Source:
public void startReset(final String email) { if (mCachedPasswordReset == null || !TextUtils.equals(email, mCachedPasswordReset.first)) { mCachedPasswordReset = Pair.create(email, mAuth.sendPasswordResetEmail(email)); } mFlowHolder.getProgressListener().setValue(false); mCachedPasswordReset.second.addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { mFlowHolder.getProgressListener().setValue(true); mPasswordResetListener.setValue(task.isSuccessful() ? Tasks.forResult(email) : Tasks.<String>forException(task.getException())); } }); }

Target:
public void startReset(final String email) { mProgressLiveData.setValue(new Resource<String>()); getAuth().sendPasswordResetEmail(email) .addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { Resource<String> state = task.isSuccessful() ? new Resource<>(email) : new Resource<String>(task.getException()); mProgressLiveData.setValue(state); } }); }
Source:
private void executeCommand(ChannelHandlerContext ctx, Command command) throws Exception { RedisResponse response; if (!isAuthenticated()) { response = handleUnAuthenticatedCommand(command); writeToChannel(response); return; } if (command.isOfType(RedisCommandType.SELECT) || command.isOfType(RedisCommandType.CONFIG) || command.isOfType(RedisCommandType.PUBSUB)) { writeToChannel(RedisResponse.ok()); return; } if (command.isUnsupported() && !allowUnsupportedCommands()) { writeToChannel( RedisResponse.error(command.getCommandType() + RedisConstants.ERROR_UNSUPPORTED_COMMAND)); return; } if (command.isUnimplemented()) { logger.info("Failed " + command.getCommandType() + " because it is not implemented."); writeToChannel(RedisResponse.error(command.getCommandType() + " is not implemented.")); return; } response = command.execute(this); logResponse(response); writeToChannel(response); if (command.isOfType(RedisCommandType.QUIT)) { channelInactive(ctx); } }

Target:
private void executeCommand(ChannelHandlerContext ctx, Command command) throws Exception { RedisResponse response; if (!isAuthenticated()) { response = handleUnAuthenticatedCommand(command); writeToChannel(response); return; } if (command.isUnsupported() && !allowUnsupportedCommands()) { writeToChannel( RedisResponse.error(command.getCommandType() + RedisConstants.ERROR_UNSUPPORTED_COMMAND)); return; } if (command.isUnimplemented()) { logger.info("Failed " + command.getCommandType() + " because it is not implemented."); writeToChannel(RedisResponse.error(command.getCommandType() + " is not implemented.")); return; } response = command.execute(this); logResponse(response); writeToChannel(response); if (command.isOfType(RedisCommandType.QUIT)) { channelInactive(ctx); } }
Source:
public List<User> call(ApiCaller ac, Deserializer parms) throws PerunException { ac.stateChangingCheck(); return ac.getSearcher().getFacilities(ac.getSession(), parms.read("attributesWithSearchingValues", LinkedHashMap.class)); }

Target:
public List<User> call(ApiCaller ac, Deserializer parms) throws PerunException { ac.stateChangingCheck(); return ac.getSearcher().getUsers(ac.getSession(), parms.read("attributesWithSearchingValues", LinkedHashMap.class)); }
Source:
public Query toQuery( final Set<ValueIndexTerm> terms ) { checkNotNullAndNotEmpty(terms); ValuePackageNameIndexTerm packageTerm = null; ValueProjectRootPathIndexTerm projectTerm = null; ValueResourceIndexTerm ruleTerm = null; for( ValueIndexTerm term : terms ) { if( term instanceof ValuePackageNameIndexTerm ) { packageTerm = (ValuePackageNameIndexTerm) term; } else if ( term instanceof ValueProjectRootPathIndexTerm ) { projectTerm = (ValueProjectRootPathIndexTerm) term; } else if ( term instanceof ValueResourceIndexTerm ) { ruleTerm = (ValueResourceIndexTerm) term; } } SearchEmptyQueryBuilder queryBuilder = new SearchEmptyQueryBuilder() .addTerm( packageTerm ) .addTerm( projectTerm ); if( ruleTerm != null ) { queryBuilder.addTerm(ruleTerm); } else { queryBuilder.addRuleNameWildCardTerm(); } Query build = queryBuilder.build(); String s = build.toString(); return build; }

Target:
public Query toQuery( final Set<ValueIndexTerm> terms ) { checkNotNullAndNotEmpty(terms); ValuePackageNameIndexTerm packageTerm = null; ValueProjectRootPathIndexTerm projectTerm = null; ValueResourceIndexTerm ruleTerm = null; for( ValueIndexTerm term : terms ) { if( term instanceof ValuePackageNameIndexTerm ) { packageTerm = (ValuePackageNameIndexTerm) term; } else if ( term instanceof ValueProjectRootPathIndexTerm ) { projectTerm = (ValueProjectRootPathIndexTerm) term; } else if ( term instanceof ValueResourceIndexTerm ) { ruleTerm = (ValueResourceIndexTerm) term; } } SearchEmptyQueryBuilder queryBuilder = new SearchEmptyQueryBuilder() .addTerm( packageTerm ) .addTerm( projectTerm ); if( ruleTerm != null ) { queryBuilder.addTerm(ruleTerm); } else { queryBuilder.addRuleNameWildCardTerm(); } return queryBuilder.build(); }
Source:
public void setPorts(List<PortMapping> ports) { this.ports.addAll(ports); }

Target:
public void setPorts(List<PortMapping> ports) { if (ports != null) { this.ports.addAll(ports); } }
Source:
@Test public void missingConnectionHeader() throws IOException { webServer.enqueue(new MockResponse() .setResponseCode(101) .setHeader("Upgrade", "websocket") .setHeader("Sec-WebSocket-Accept", "ujmZX4KXZqjwy6vi1aQFH5p4Ygk=")); newWebSocket(); clientListener.assertFailure(101, null, ProtocolException.class, "Expected 'Connection' header value 'Upgrade' but was 'null'"); client.connectionPool().evictAll(); assertEquals(0, client.connectionPool().connectionCount()); }

Target:
@Test public void missingConnectionHeader() throws IOException { webServer.enqueue(new MockResponse() .setResponseCode(101) .setHeader("Upgrade", "websocket") .setHeader("Sec-WebSocket-Accept", "ujmZX4KXZqjwy6vi1aQFH5p4Ygk=")); newWebSocket(); clientListener.assertFailure(101, null, ProtocolException.class, "Expected 'Connection' header value 'Upgrade' but was 'null'"); ensureAllConnectionsReleased(client); }
Source:
public void searchRelatedPersonByIdentifier_shouldReturnResourceIfExists() { List<RelatedPerson> relatedPersonList = getService().searchRelatedPersonByIdentifier(PATIENT_IDENTIFIER); assertEquals(relatedPersonList.size(), 3); assertNotNull(relatedPersonList); assertEquals(relatedPersonList.get(0).getGender().getDisplay(), "Male"); assertEquals(relatedPersonList.get(0).getId(), "b70cb368-cf80-4a22-9d75-5d0d1f9b75dc"); assertEquals(relatedPersonList.get(0).getPatient().getReference(), "person/ba1b19c2-3ed6-4f63-b8c0-f762dc8d7562"); assertEquals(relatedPersonList.get(1).getGender().getDisplay(), "Male"); assertEquals(relatedPersonList.get(1).getId(), "c18717dd-5d78-4a0e-84fc-ee62c5f0676a"); assertEquals(relatedPersonList.get(0).getPatient().getReference(), "person/ba1b19c2-3ed6-4f63-b8c0-f762dc8d7562"); assertEquals(relatedPersonList.get(2).getGender().getDisplay(), "Male"); assertEquals(relatedPersonList.get(2).getId(), "ee232368-cf80-4a22-9d75-5d0d9dce"); }

Target:
public void searchRelatedPersonByIdentifier_shouldReturnResourceIfExists() { List<RelatedPerson> relatedPersonList = getService().searchRelatedPersonByIdentifier(PATIENT_IDENTIFIER); assertEquals(relatedPersonList.size(), 3); assertEquals(relatedPersonList.get(0).getGender().getDisplay(), "Male"); assertEquals(relatedPersonList.get(0).getId(), "b70cb368-cf80-4a22-9d75-5d0d1f9b75dc"); assertEquals(relatedPersonList.get(0).getPatient().getReference(), "person/ba1b19c2-3ed6-4f63-b8c0-f762dc8d7562"); }
Source:
public void getRecipientsToReplyTo_should_prefer_replyTo_over_any_other_field() { when(message.getReplyTo()).thenReturn(replyToAddresses); when(message.getListPost()).thenReturn(listPostAddresses); when(message.getFrom()).thenReturn(fromAddresses); assertSame(replyToAddresses, ReplyToParser.getRecipientsToReplyTo(message)); }

Target:
public void getRecipientsToReplyTo_should_prefer_replyTo_over_any_other_field() throws MessagingException { when(message.getReplyTo()).thenReturn(replyToAddresses); when(message.getHeader(ListHeaders.LIST_POST_HEADER)).thenReturn(new String[]{listPostHeaderValue}); when(message.getFrom()).thenReturn(fromAddresses); assertSame(replyToAddresses, ReplyToParser.getRecipientsToReplyTo(message)); }
Source:
private RestClient getRestClient(String uri, Map<String, String> httpConfig) { uri = RestliUtils.sanitizeUri(uri); RestClient restClient; String key = getKey(uri, httpConfig); restClient = _restClients.getOrDefault(key, null); if (restClient == null) { restClient = new RestClient(new TransportClientAdapter(CLIENT_FACTORY.getClient(httpConfig)), uri); _restClients.put(key, restClient); } return restClient; }

Target:
private RestClient getRestClient(String uri, Map<String, String> httpConfig) { String canonicalUri = RestliUtils.sanitizeUri(uri); RestClient restClient; String key = getKey(uri, httpConfig); restClient = _restClients.computeIfAbsent(key, (k) -> new RestClient(new TransportClientAdapter(CLIENT_FACTORY.getClient(httpConfig)), canonicalUri)); return restClient; }
Source:
void decorate(JCheckBox pullBeforeField, JLabel pullBeforeOverrideLabel, JComboBox pullBeforeOverrideField, JTextPane textpanel) { pullBeforeField.setText(savePasswordsConsent ? "Pull before export" : "Pull before export (Requires Remember passwords in Settings)"); pullBeforeField.setVisible(!isOverridePanel); pullBeforeField.setEnabled(savePasswordsConsent && hasTransferSettings); pullBeforeOverrideLabel.setVisible(isOverridePanel); pullBeforeOverrideField.setVisible(isOverridePanel); pullBeforeOverrideField.setEnabled(savePasswordsConsent && hasTransferSettings); textpanel.setVisible(isOverridePanel && (!savePasswordsConsent || !hasTransferSettings)); textpanel.setText(!savePasswordsConsent ? "You can't pull before exporting forms until you give your consent to store passwords on the Settings panel" : !hasTransferSettings ? "Please, pull this form once again to be able to check these checkboxes" : ""); }

Target:
void decorate(JCheckBox pullBeforeField, JLabel pullBeforeOverrideLabel, JComboBox pullBeforeOverrideField, JTextPane textpanel) { pullBeforeField.setVisible(!isOverridePanel); pullBeforeField.setEnabled(savePasswordsConsent && (!isOverridePanel || hasTransferSettings)); pullBeforeOverrideLabel.setVisible(isOverridePanel); pullBeforeOverrideField.setVisible(isOverridePanel); pullBeforeOverrideField.setEnabled(savePasswordsConsent && hasTransferSettings); textpanel.setVisible(!savePasswordsConsent || !hasTransferSettings || !isOverridePanel); textpanel.setText(savePasswordsConsent ? hasTransferSettings && isOverridePanel ? "" : REQUIRE_PULL_TEXT : REQUIRE_SAVE_PASSWORDS ); }
Source:
public void testFilterVariableToSelectModelElementVariableMigration() { copyFilesToTestProject(SiriusTestsPlugin.PLUGIN_ID, REPRESENTATIONS_FILE_PATH, MODELER_FILE_NAME); ResourceSet set = new ResourceSetImpl(); Group group = null; try { group = (Group) ModelUtils.load(URI.createPlatformResourceURI(TEMPORARY_PROJECT_NAME + "/" + MODELER_FILE_NAME, true), set); } catch (IOException e) { e.printStackTrace(); } assertNotNull("Group is not retrieved.", group); String version = group.getVersion(); assertTrue("Before save, the migration framework will return true even if the migration has been done during load.", VSMMigrationService.getInstance().isMigrationNeeded(Version.parseVersion(version))); try { group.eResource().save(Collections.emptyMap()); } catch (IOException e) { e.printStackTrace(); } version = group.getVersion(); assertFalse("The version tag should now be set telling that the migration was done.", VSMMigrationService.getInstance().isMigrationNeeded(Version.parseVersion(version))); checkVSMMigrationEffect(group); }

Target:
public void testFilterVariableToSelectModelElementVariableMigration() { copyFilesToTestProject(SiriusTestsPlugin.PLUGIN_ID, REPRESENTATIONS_FILE_PATH, MODELER_FILE_NAME); ResourceSet set = new ResourceSetImpl(); Group group = null; try { group = (Group) ModelUtils.load(URI.createPlatformResourceURI(TEMPORARY_PROJECT_NAME + "/" + MODELER_FILE_NAME, true), set); } catch (IOException e) { fail("Pb when loading the resource : " + e.getMessage()); } assertNotNull("Group is not retrieved.", group); String version = group.getVersion(); assertTrue("Before save, the migration framework will return true even if the migration has been done during load.", VSMMigrationService.getInstance().isMigrationNeeded(Version.parseVersion(version))); try { group.eResource().save(Collections.emptyMap()); } catch (IOException e) { fail("Pb when saving the resource : " + e.getMessage()); } version = group.getVersion(); assertFalse("The version tag should now be set telling that the migration was done.", VSMMigrationService.getInstance().isMigrationNeeded(Version.parseVersion(version))); checkVSMMigrationEffect(group); }
Source:
public static void treeNode(PrintStream out, Description description) { String location = description.getClassName() + "." + description.getMethodName(); out.println(create("suiteTreeNode", new Pair("name", escape(description.getMethodName())), new Pair("location", "java:test://" + escape(location)))); }

Target:
public static void treeNode(PrintStream out, Description description) { String location = description.getClassName() + "." + description.getMethodName(); out.println(create(SUITE_TREE_NODE, new Pair(NAME, escape(description.getMethodName())), new Pair(LOCATION, "java:test://" + escape(location)))); }
Source:
public void onPauseGame() { Toast.makeText(this, "Game Paused", Toast.LENGTH_SHORT).show(); game.onPauseGame(); }

Target:
public void onPauseGame() { Toast.makeText(this, "Game Paused", Toast.LENGTH_SHORT).show(); game.pause(); }
Source:
private void loadPayload() { VmDeviceDAO dao = getDbFacade().getVmDeviceDao(); List<VmDevice> disks = dao.getVmDeviceByVmIdAndType(getParameters().getVmId(), VmDeviceGeneralType.DISK); for (VmDevice disk : disks) { if (VmPayload.isPayload(disk.getSpecParams())) { VmPayload payload = new VmPayload(disk); payload.setDeviceType(VmDeviceType.valueOf(disk.getDevice().toUpperCase())); getVm().setVmPayload(payload); break; } } }

Target:
private void loadPayload() { VmDeviceDAO dao = getDbFacade().getVmDeviceDao(); List<VmDevice> disks = dao.getVmDeviceByVmIdAndType(getParameters().getVmId(), VmDeviceGeneralType.DISK); for (VmDevice disk : disks) { if (VmPayload.isPayload(disk.getSpecParams())) { VmPayload payload = new VmPayload(disk); getVm().setVmPayload(payload); break; } } }
Source:
public static void putLabels(ObjectMeta metadata, Map<String, String> labels) { if (labels == null || labels.isEmpty()) { return; } labels.forEach((k, v) -> putLabel(metadata, k, v)); }

Target:
public static void putLabels(ObjectMeta metadata, Map<String, String> labels) { if (labels == null || labels.isEmpty()) { return; } Map<String, String> metaLabels = metadata.getLabels(); if (metaLabels == null) { metadata.setLabels(new HashMap<>(labels)); } else { metaLabels.putAll(labels); } }