auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void onDeepLinkReceived(@NonNull Activity activity, @NonNull final DeepLink deepLink) { logger.debug("DeepLinkManager received DeepLink with data:\n" + deepLink.toString()); final Router router = new Router(new Config(activity)); final String username = new LoginPrefs(activity).getUsername(); @ScreenDef final String screenName = deepLink.getScreenName(); if (username == null) { switch (screenName) { case Screen.COURSE_DISCOVERY: case Screen.PROGRAM_DISCOVERY: case Screen.DEGREE_DISCOVERY: router.showFindCourses(activity, screenName, deepLink.getPathId()); break; default: activity.startActivity(router.getLogInIntent()); break; } return; } switch (screenName) { case Screen.COURSE_DASHBOARD: case Screen.COURSE_VIDEOS: case Screen.COURSE_DISCUSSION: case Screen.COURSE_DATES: case Screen.COURSE_HANDOUT: case Screen.COURSE_ANNOUNCEMENT: case Screen.DISCUSSION_POST: case Screen.DISCUSSION_TOPIC: { router.showCourseDashboardTabs(activity, null, deepLink.getCourseId(), deepLink.getTopicID(), deepLink.getThreadID(), false, screenName); break; } case Screen.PROGRAM: case Screen.COURSE_DISCOVERY: case Screen.PROGRAM_DISCOVERY: case Screen.DEGREE_DISCOVERY: { router.showMainDashboard(activity, screenName, deepLink.getPathId()); break; } case Screen.PROFILE: { router.showUserProfile(activity, username); break; } case Screen.ACCOUNT: { router.showAccountActivity(activity); break; } } }

Target:
public static void onDeepLinkReceived(@NonNull Activity activity, @NonNull final DeepLink deepLink) { logger.debug("DeepLinkManager received DeepLink with data:\n" + deepLink.toString()); final Router router = new Router(new Config(activity)); final String username = new LoginPrefs(activity).getUsername(); @ScreenDef final String screenName = deepLink.getScreenName(); if (username == null) { switch (screenName) { case Screen.COURSE_DISCOVERY: case Screen.PROGRAM_DISCOVERY: case Screen.DEGREE_DISCOVERY: router.showFindCourses(activity, screenName, deepLink.getPathId()); break; default: activity.startActivity(router.getLogInIntent()); break; } return; } switch (screenName) { case Screen.COURSE_DASHBOARD: case Screen.COURSE_VIDEOS: case Screen.COURSE_DISCUSSION: case Screen.COURSE_DATES: case Screen.COURSE_HANDOUT: case Screen.COURSE_ANNOUNCEMENT: case Screen.DISCUSSION_POST: case Screen.DISCUSSION_TOPIC: { router.showCourseDashboardTabs(activity, null, deepLink.getCourseId(), deepLink.getTopicID(), deepLink.getThreadID(), false, screenName); break; } case Screen.PROGRAM: case Screen.COURSE_DISCOVERY: case Screen.PROGRAM_DISCOVERY: case Screen.DEGREE_DISCOVERY: { router.showMainDashboard(activity, screenName, deepLink.getPathId()); break; } case Screen.PROFILE: { router.showUserProfile(activity, username); break; } case Screen.ACCOUNT: { router.showAccountActivity(activity); break; } default: { logger.error(new Exception(String.format("Invalid screen name passed for the deeplink %s", screenName)), true); break; } } }
Source:
public ConnectionPoolConfig(VerifiableProperties verifiableProperties) { connectionPoolReadBufferSizeBytes = verifiableProperties.getIntInRange("connectionpool.read.buffer.size.bytes", 1048576, 1, 1024 * 1024 * 1024); connectionPoolWriteBufferSizeBytes = verifiableProperties.getIntInRange("connectionpool.write.buffer.size.bytes", 1048576, 1, 1024 * 1024 * 1024); connectionPoolReadTimeoutMs = verifiableProperties.getIntInRange("connectionpool.read.timeout.ms", 1500, 1, 100000); connectionPoolConnectTimeoutMs = verifiableProperties.getIntInRange("connectionpool.connect.timeout.ms", 800, 1, 100000); connectionPoolMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("connectionpool.max.connections.per.port.plain.text", 5, 1, 20); connectionPoolMaxConnectionsPerPortSSL = verifiableProperties.getIntInRange("connectionpool.max.connections.per.port.ssl", 2, 1, 20); }

Target:
public ConnectionPoolConfig(VerifiableProperties verifiableProperties) { connectionPoolReadBufferSizeBytes = verifiableProperties.getIntInRange("connectionpool.read.buffer.size.bytes", 1048576, 1, 1024 * 1024 * 1024); connectionPoolWriteBufferSizeBytes = verifiableProperties.getIntInRange("connectionpool.write.buffer.size.bytes", 1048576, 1, 1024 * 1024 * 1024); connectionPoolReadTimeoutMs = verifiableProperties.getIntInRange("connectionpool.read.timeout.ms", 1500, 1, 100000); connectionPoolConnectTimeoutMs = verifiableProperties.getIntInRange("connectionpool.connect.timeout.ms", 800, 1, 100000); connectionPoolMaxConnectionsPerPortPlainText = verifiableProperties.getIntInRange("connectionpool.max.connections.per.port.plain.text", 5, 1, 20); connectionPoolMaxConnectionsPerPortSSL = verifiableProperties.getIntInRange("connectionpool.max.connections.per.port.ssl", 2, 1, 20); connectionPoolSocketResetOnError = verifiableProperties.getBoolean("connectionpool.socket.reset.on.error", true); }
Source:
public static boolean hasBlockCompressedExtension(final Path path) { return hasBlockCompressedExtension(path.getName().toString()); }

Target:
public static boolean hasBlockCompressedExtension(final Path path) { return hasBlockCompressedExtension(path.getFileName().toString()); }
Source:
public void close() { try { flush(); } finally { try { super.close(); } finally { cache.close(cacheName); } } }

Target:
public void close() { final LinkedList<RuntimeException> suppressed = executeAll( () -> cache.flush(cacheName), () -> cache.close(cacheName), wrapped()::close ); if (!suppressed.isEmpty()) { throwSuppressed("Caught an exception while closing caching session store for store " + name(), suppressed); } }
Source:
public void removeFirstContainer() throws Exception { int defaultNumInstancesperContainer = 4; topologyConfig.setComponentRam(BOLT_NAME, instanceDefaultResources.getRam()); topologyConfig.setComponentRam(SPOUT_NAME, instanceDefaultResources.getRam()); PackingPlan packingPlan = getFirstFitDecreasingPackingPlan(topology); Assert.assertEquals(packingPlan.getContainers().size(), 2); Assert.assertEquals(totalInstances, packingPlan.getInstanceCount()); int spoutScalingDown = -4; Map<String, Integer> componentChanges = new HashMap<>(); componentChanges.put(SPOUT_NAME, spoutScalingDown); PackingPlan newPackingPlan = getFirstFitDecreasingPackingPlanRepack(topology, packingPlan, componentChanges); Assert.assertEquals(1, newPackingPlan.getContainers().size()); Assert.assertEquals((Integer) (totalInstances + spoutScalingDown), newPackingPlan.getInstanceCount()); AssertPacking.assertNumInstances(newPackingPlan.getContainers(), BOLT_NAME, 3); AssertPacking.assertNumInstances(newPackingPlan.getContainers(), SPOUT_NAME, 0); AssertPacking.assertContainerRam(newPackingPlan.getContainers(), defaultNumInstancesperContainer * instanceDefaultResources.getRam()); }

Target:
public void removeFirstContainer() throws Exception { int defaultNumInstancesperContainer = 4; int spoutScalingDown = -4; Map<String, Integer> componentChanges = new HashMap<>(); componentChanges.put(SPOUT_NAME, spoutScalingDown); int numContainersBeforeRepack = 2; PackingPlan newPackingPlan = doDefaultScalingTest(componentChanges, numContainersBeforeRepack); Assert.assertEquals(1, newPackingPlan.getContainers().size()); Assert.assertEquals((Integer) (totalInstances + spoutScalingDown), newPackingPlan.getInstanceCount()); AssertPacking.assertNumInstances(newPackingPlan.getContainers(), BOLT_NAME, 3); AssertPacking.assertNumInstances(newPackingPlan.getContainers(), SPOUT_NAME, 0); AssertPacking.assertContainerRam(newPackingPlan.getContainers(), defaultNumInstancesperContainer * instanceDefaultResources.getRam()); }
Source:
public void recognizeReceiptInvalidSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); invalidSourceUrlRunner((sourceUrl) -> { ErrorResponseException errorResponseException = assertThrows(ErrorResponseException.class, () -> client.beginRecognizeReceiptsFromUrl(sourceUrl).getSyncPoller().getFinalResult()); assertEquals(INVALID_IMAGE_URL_ERROR_CODE, errorResponseException.getValue().getCode()); assertEquals(IMAGE_URL_IS_BADLY_FORMATTED_ERROR_MESSAGE, errorResponseException.getValue().getMessage()); }); }

Target:
public void recognizeReceiptInvalidSourceUrl(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); invalidSourceUrlRunner((invalidSourceUrl) -> { HttpResponseException errorResponseException = assertThrows(HttpResponseException.class, () -> client.beginRecognizeReceiptsFromUrl(invalidSourceUrl).getSyncPoller().getFinalResult()); ErrorInformation errorInformation = (ErrorInformation) errorResponseException.getValue(); assertEquals(INVALID_IMAGE_URL_ERROR_CODE, errorInformation.getCode()); assertEquals(IMAGE_URL_IS_BADLY_FORMATTED_ERROR_MESSAGE, errorInformation.getMessage()); }); }
Source:
private static List<String> getErlangModulePaths(@NotNull ErlangTarget target, @NotNull CompileContext context, boolean isTest) { List<String> erlangBuilderDirtyFilesInfo = getErlangModulePathsFromTarget(target, context, isTest); return erlangBuilderDirtyFilesInfo != null ? erlangBuilderDirtyFilesInfo : getErlangModulePathsDefault(target, isTest); }

Target:
private static List<String> getErlangModulePaths(@NotNull ErlangTarget target, @NotNull CompileContext context, boolean isTest) { List<String> erlangDirtyModules = getErlangModulePathsFromTarget(target, isTest); if (erlangDirtyModules != null) { return erlangDirtyModules; } String message = "Erlang module " + target.getModule().getName() + " will be fully rebuilt."; LOG.warn(message); context.processMessage(new CompilerMessage(NAME, BuildMessage.Kind.WARNING, message)); return getErlangModulePathsDefault(target, isTest); }
Source:
private void updateActionEnablement(ISelection selection) { if (!(selection instanceof IStructuredSelection)) return; IStructuredSelection sel = (IStructuredSelection) selection; boolean allSelected = !sel.isEmpty() && sel.size() == getTable().getItemCount(); boolean submoduleSelected = false; for (Object item : sel.toArray()) if (((FileDiff) item).isSubmodule()) { submoduleSelected = true; break; } selectAll.setEnabled(!allSelected); copy.setEnabled(!sel.isEmpty()); if (!submoduleSelected) { boolean oneOrMoreSelected = !sel.isEmpty(); open.setEnabled(oneOrMoreSelected); openWorkingTreeVersion.setEnabled(oneOrMoreSelected); compare.setEnabled(sel.size() == 1); blame.setEnabled(oneOrMoreSelected); if (sel.size() == 1) { FileDiff diff = (FileDiff) sel.getFirstElement(); String path = new Path(getRepository().getWorkTree() .getAbsolutePath()).append(diff.getNewPath()) .toOSString(); boolean workTreeFileExists = new File(path).exists(); compareWorkingTreeVersion.setEnabled(workTreeFileExists); openWorkingTreeVersion.setEnabled(openWorkingTreeVersion .isEnabled() && workTreeFileExists); } else compareWorkingTreeVersion.setEnabled(false); } else { open.setEnabled(false); openWorkingTreeVersion.setEnabled(false); compare.setEnabled(false); blame.setEnabled(false); compareWorkingTreeVersion.setEnabled(false); } }

Target:
private void updateActionEnablement(ISelection selection) { if (!(selection instanceof IStructuredSelection)) return; IStructuredSelection sel = (IStructuredSelection) selection; boolean allSelected = !sel.isEmpty() && sel.size() == getTable().getItemCount(); boolean submoduleSelected = false; for (Object item : sel.toArray()) if (((FileDiff) item).isSubmodule()) { submoduleSelected = true; break; } selectAll.setEnabled(!allSelected); copy.setEnabled(!sel.isEmpty()); if (!submoduleSelected) { boolean oneOrMoreSelected = !sel.isEmpty(); open.setEnabled(oneOrMoreSelected); compare.setEnabled(sel.size() == 1); blame.setEnabled(oneOrMoreSelected); if (sel.size() == 1) { FileDiff diff = (FileDiff) sel.getFirstElement(); boolean workTreeFileExists = false; if (diff.getChange() != ChangeType.DELETE) { String path = new Path(getRepository().getWorkTree() .getAbsolutePath()).append(diff.getNewPath()) .toOSString(); workTreeFileExists = new File(path).exists(); } compareWorkingTreeVersion.setEnabled(workTreeFileExists); openWorkingTreeVersion.setEnabled(workTreeFileExists); } else { compareWorkingTreeVersion.setEnabled(false); openWorkingTreeVersion.setEnabled(oneOrMoreSelected); } } else { open.setEnabled(false); openWorkingTreeVersion.setEnabled(false); compare.setEnabled(false); blame.setEnabled(false); compareWorkingTreeVersion.setEnabled(false); } }
Source:
public void run() { try { Model model = load(repoId); response.complete(model); } catch (RepoStoreException e) { logger.error(HTLog.format(repoId, "Failed to load from store")); response.completeExceptionally(e); } }

Target:
public void run() { try { Model model = load(repoId); response.complete(model); } catch (RepoStoreException e) { logger.error(HTLog.format(repoId, "Unable to load from store")); response.completeExceptionally(e); } }
Source:
public OutputStream decorate(final OutputStream logger) throws IOException, InterruptedException { final DateFormat f = UTC_MILLIS.get(); return new LineTransformationOutputStream() { @Override protected void eol(byte[] b, int len) throws IOException { logger.write('['); logger.write(f.format(new Date()).getBytes(StandardCharsets.US_ASCII)); logger.write(']'); logger.write(' '); logger.write(b, 0, len); } }; }

Target:
public OutputStream decorate(final OutputStream logger) throws IOException, InterruptedException { return new LineTransformationOutputStream() { @Override protected void eol(byte[] b, int len) throws IOException { synchronized (logger) { ByteBuffer buffer = ByteBuffer.allocate(1 + 24 + 1 + 1 + len); buffer.put((byte)'['); buffer.put(ZonedDateTime.now(ZoneOffset.UTC).format(UTC_MILLIS).getBytes(StandardCharsets.US_ASCII)); buffer.put((byte)']'); buffer.put((byte)' '); buffer.put(b, 0, len); logger.write(buffer.array(), 0, buffer.position()); } } @Override public void flush() throws IOException { logger.flush(); } @Override public void close() throws IOException { super.close(); logger.close(); } }; }
Source:
public void onProductChange(@NonNull final ICalloutField calloutField) { final QuickInput quickInput = QuickInput.getQuickInputOrNull(calloutField); if (quickInput == null) { return; } boolean isPackingInstructionFieldMissing = !quickInput.hasField(IDDOrderLineQuickInput.COLUMNNAME_M_HU_PI_Item_Product_ID); if (isPackingInstructionFieldMissing) { return; } final IDDOrderLineQuickInput ddOrderLineQuickInput = quickInput.getQuickInputDocumentAs(IDDOrderLineQuickInput.class); final ProductId productId = ProductId.ofRepoIdOrNull( ddOrderLineQuickInput.getM_Product_ID() ); if ( productId == null) { return; } final I_DD_Order ddOrder = quickInput.getRootDocumentAs(I_DD_Order.class); ddOrderLineQuickInput.setM_HU_PI_Item_Product_ID(getDefaultPI(ddOrder, productId).getM_HU_PI_Item_Product_ID()); }

Target:
public void onProductChange(@NonNull final ICalloutField calloutField) { final QuickInput quickInput = QuickInput.getQuickInputOrNull(calloutField); if (quickInput == null) { return; } boolean isPackingInstructionFieldMissing = !quickInput.hasField(IDDOrderLineQuickInput.COLUMNNAME_M_HU_PI_Item_Product_ID); if (isPackingInstructionFieldMissing) { return; } final IDDOrderLineQuickInput ddOrderLineQuickInput = quickInput.getQuickInputDocumentAs(IDDOrderLineQuickInput.class); final ProductId productId = ProductId.ofRepoIdOrNull( ddOrderLineQuickInput.getM_Product_ID() ); if ( productId == null) { return; } final I_DD_Order ddOrder = quickInput.getRootDocumentAs(I_DD_Order.class); final I_M_HU_PI_Item_Product defaultPackingItem = getDefaultPI(ddOrder, productId); if (defaultPackingItem != null) { ddOrderLineQuickInput.setM_HU_PI_Item_Product_ID(defaultPackingItem.getM_HU_PI_Item_Product_ID()); } }
Source:
public ForwardingGridDialect(GridDialect gridDialect) { Contracts.assertParameterNotNull( gridDialect, "gridDialect" ); this.gridDialect = gridDialect; this.batchableGridDialect = asBatchableGridDialectOrNull( gridDialect ); this.queryableGridDialect = (QueryableGridDialect<T>) asQueryableGridDialectOrNull( gridDialect ); }

Target:
public ForwardingGridDialect(GridDialect gridDialect) { Contracts.assertParameterNotNull( gridDialect, "gridDialect" ); this.gridDialect = gridDialect; this.batchableGridDialect = GridDialects.getDialectFacetOrNull( gridDialect, BatchableGridDialect.class ); this.queryableGridDialect = GridDialects.getDialectFacetOrNull( gridDialect, QueryableGridDialect.class ); }
Source:
public AnnotatedChildEntity(EntityModel<C> entityModel, boolean forwardCommands, BiFunction<CommandMessage<?>, P, C> commandTargetResolver, BiFunction<EventMessage<?>, P, Stream<C>> eventTargetResolver) { this.entityModel = entityModel; this.eventTargetResolver = eventTargetResolver; this.commandHandlers = new HashMap<>(); this.commandHandlerInterceptors = new ArrayList<>(); if (forwardCommands) { entityModel.commandHandlers().forEach( (commandType, childHandler) -> commandHandlers.put( commandType, new ChildForwardingCommandMessageHandlingMember<>(childHandler, commandTargetResolver) ) ); commandHandlerInterceptors.addAll( entityModel.commandHandlerInterceptors() .stream() .map(ch -> new ChildForwardingCommandHandlerInterceptorHandlingMember<>(ch, commandTargetResolver)) .collect(Collectors.toList())); } }

Target:
public AnnotatedChildEntity(EntityModel<C> entityModel, boolean forwardCommands, BiFunction<CommandMessage<?>, P, C> commandTargetResolver, BiFunction<EventMessage<?>, P, Stream<C>> eventTargetResolver) { this.entityModel = entityModel; this.eventTargetResolver = eventTargetResolver; this.commandHandlers = new HashMap<>(); if (forwardCommands) { entityModel.commandHandlers().forEach( (commandType, childHandler) -> commandHandlers .put(commandType, new ChildForwardingCommandMessageHandlingMember<>( entityModel.commandHandlerInterceptors(), childHandler, commandTargetResolver))); } }
Source:
public TurtleRecordWriter(OutputStream out) throws IOException { _ps = new BufferedWriter(new OutputStreamWriter(out, "UTF-8") , BUFFER_SIZE); _decl.clear(); }

Target:
public TurtleRecordWriter(OutputStream out) { bufferedWriter = new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8), BUFFER_SIZE); }
Source:
public OutputToScreenNode(Context context) { super(context); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); worldRenderer = context.get(WorldRenderer.class); WorldRenderer renderer = context.get(WorldRenderer.class); requiresCondition(() -> renderer.getCurrentRenderStage() == MONO || renderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL_URN)); bindFbo = new SetInputTextureFromFbo(0, FINAL_BUFFER, ColorTexture, displayResolutionDependentFBOs, DEFAULT_TEXTURED_MATERIAL_URN, "texture"); addDesiredStateChange(bindFbo); SwappableFBO gBufferPair = displayResolutionDependentFBOs.getGBufferPair(); lastUpdatedGBuffer = gBufferPair.getLastUpdatedFbo(); staleGBuffer = gBufferPair.getStaleFbo(); }

Target:
public OutputToScreenNode(Context context) { super(context); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); worldRenderer = context.get(WorldRenderer.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL_URN)); bindFbo = new SetInputTextureFromFbo(0, FINAL_BUFFER, ColorTexture, displayResolutionDependentFBOs, DEFAULT_TEXTURED_MATERIAL_URN, "texture"); addDesiredStateChange(bindFbo); SwappableFBO gBufferPair = displayResolutionDependentFBOs.getGBufferPair(); lastUpdatedGBuffer = gBufferPair.getLastUpdatedFbo(); staleGBuffer = gBufferPair.getStaleFbo(); }
Source:
public @Nullable QueryTypeDescriptorImpl typeDescriptor(@Nullable String cacheName, String typeName) { return typesByName.get(new QueryTypeNameKey(cacheName, typeName)); }

Target:
public @Nullable GridQueryTypeDescriptor typeDescriptor(@Nullable String cacheName, String typeName) { return typesByName.get(new QueryTypeNameKey(cacheName, typeName)); }
Source:
public QueryIterator(final String chr, final int start, final int end, final List<Block> blocks) throws IOException { this.start = start; this.end = end; chrAlias = chr; mySeekableStream = getSeekableStream(); blockIterator = blocks.iterator(); advanceBlock(); readNextRecord(); chrAlias = (currentRecord == null ? chr : currentRecord.getContig()); }

Target:
public QueryIterator(final String chr, final int start, final int end, final List<Block> blocks) throws IOException { this.start = start; this.end = end; queryChr = chr; mySeekableStream = getSeekableStream(); blockIterator = blocks.iterator(); advanceBlock(); readNextRecord(); chrAlias = (currentRecord == null ? chr : currentRecord.getContig()); }
Source:
BlobStoreCompactor(String dataDir, String storeId, StoreKeyFactory storeKeyFactory, StoreConfig config, StoreMetrics srcMetrics, StoreMetrics tgtMetrics, DiskIOScheduler diskIOScheduler, DiskSpaceAllocator diskSpaceAllocator, Log srcLog, Time time, UUID sessionId, UUID incarnationId) throws IOException, StoreException { this.dataDir = new File(dataDir); this.storeId = storeId; this.storeKeyFactory = storeKeyFactory; this.config = config; this.srcMetrics = srcMetrics; this.tgtMetrics = tgtMetrics; this.srcLog = srcLog; this.diskIOScheduler = diskIOScheduler; this.diskSpaceAllocator = diskSpaceAllocator; this.time = time; this.sessionId = sessionId; this.incarnationId = incarnationId; this.useDirectIO = Platform.isLinux() && config.storeCompactionEnableDirectIO; fixStateIfRequired(); logger.trace("Constructed BlobStoreCompactor for {}", dataDir); }

Target:
BlobStoreCompactor(String dataDir, String storeId, StoreKeyFactory storeKeyFactory, StoreConfig config, StoreMetrics srcMetrics, StoreMetrics tgtMetrics, DiskIOScheduler diskIOScheduler, DiskSpaceAllocator diskSpaceAllocator, Log srcLog, Time time, UUID sessionId, UUID incarnationId) throws IOException, StoreException { this.dataDir = new File(dataDir); this.storeId = storeId; this.storeKeyFactory = storeKeyFactory; this.config = config; this.srcMetrics = srcMetrics; this.tgtMetrics = tgtMetrics; this.srcLog = srcLog; this.diskIOScheduler = diskIOScheduler; this.diskSpaceAllocator = diskSpaceAllocator; this.time = time; this.sessionId = sessionId; this.incarnationId = incarnationId; this.useDirectIO = Utils.isLinux() && config.storeCompactionEnableDirectIO; fixStateIfRequired(); logger.trace("Constructed BlobStoreCompactor for {}", dataDir); }
Source:
public void isConnected(Cardio2eConnectionEvent e) { logger.debug("Cardio is " + (e.getIsConnected() ? "CONNECTED" : "DISCONNECTED") + "."); }

Target:
public void isConnected(Cardio2eConnectionEvent e) { logger.info("Cardio is {}.", (e.getIsConnected() ? "CONNECTED" : "DISCONNECTED")); }
Source:
public boolean isHandleRenamedFiles() { return handleRenamedFiles; }

Target:
public boolean isHandleRenamedFiles() { return handleRenamedFiles != null && handleRenamedFiles; }
Source:
public Iterable<AccountGroup.UUID> getAllOwners() { Set<AccountGroup.UUID> result = new HashSet<AccountGroup.UUID>(); Iterable<ProjectState> tree = tree(); for (ProjectState p : tree) { result.addAll(p.localOwners); } return Collections.unmodifiableSet(result); }

Target:
public Iterable<AccountGroup.UUID> getAllOwners() { Set<AccountGroup.UUID> result = new HashSet<AccountGroup.UUID>(); Iterable<ProjectState> tree = tree(); for (ProjectState p : tree) { result.addAll(p.localOwners); } return result; }
Source:
protected Map<Guid, KeyValuePairCompat<String, List<Guid>>> populateVmsMetadataForOvfUpdate(List<Guid> idsToProcess) { Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = new HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>(); List<VM> vms = getVmDao().getVmsByIds(idsToProcess); for (VM vm : vms) { if (VMStatus.ImageLocked != vm.getstatus()) { VmHandler.updateDisksFromDb(vm); if (verifyDisksNotLocked(vm.getDiskList())) { loadVmData(vm); Long currentDbGeneration = getVmStaticDao().getDbGeneration(vm.getId()); if (vm.getStaticData().getDb_generation() == currentDbGeneration.longValue()) { buildMetadataDictionaryForVm(vm, vmsAndTemplateMetadata); proccessedIdsInfo.add(vm.getId()); proccessedOvfGenerationsInfo.add(vm.getStaticData().getDb_generation()); } } } } return vmsAndTemplateMetadata; }

Target:
protected Map<Guid, KeyValuePairCompat<String, List<Guid>>> populateVmsMetadataForOvfUpdate(List<Guid> idsToProcess) { Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = new HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>(); List<VM> vms = getVmDao().getVmsByIds(idsToProcess); for (VM vm : vms) { if (VMStatus.ImageLocked != vm.getstatus()) { updateVmDisksFromDb(vm); if (verifyDisksNotLocked(vm.getDiskList())) { loadVmData(vm); Long currentDbGeneration = getVmStaticDao().getDbGeneration(vm.getId()); if (vm.getStaticData().getDb_generation().equals(currentDbGeneration)) { buildMetadataDictionaryForVm(vm, vmsAndTemplateMetadata); proccessedIdsInfo.add(vm.getId()); proccessedOvfGenerationsInfo.add(vm.getStaticData().getDb_generation()); } } } } return vmsAndTemplateMetadata; }
Source:
public List<Tree> children() { return elements.stream().map(element -> (Tree) element).collect(Collectors.toList()); }

Target:
public List<Tree> children() { return Collections.unmodifiableList(elements); }
Source:
public void init(final ProcessorContext context) { internalProcessorContext = (InternalProcessorContext) context; final String threadId = Thread.currentThread().getName(); suppressionEmitSensor = ProcessorNodeMetrics.suppressionEmitSensor( threadId, context.taskId().toString(), internalProcessorContext.currentNode().name(), internalProcessorContext.metrics() ); buffer = requireNonNull((TimeOrderedKeyValueBuffer<K, V>) context.getStateStore(storeName)); buffer.setSerdesIfNull((Serde<K>) context.keySerde(), (Serde<V>) context.valueSerde()); }

Target:
public void init(final ProcessorContext context) { internalProcessorContext = (InternalProcessorContext) context; suppressionEmitSensor = ProcessorNodeMetrics.suppressionEmitSensor( Thread.currentThread().getName(), context.taskId().toString(), internalProcessorContext.currentNode().name(), internalProcessorContext.metrics() ); buffer = requireNonNull((TimeOrderedKeyValueBuffer<K, V>) context.getStateStore(storeName)); buffer.setSerdesIfNull((Serde<K>) context.keySerde(), (Serde<V>) context.valueSerde()); }
Source:
public FluentWaitElementListMatcher not() { FluentWaitElementListMatcher ret = new FluentWaitElementListMatcher(search, wait, untilElements); ret.negation = !negation; return ret; }

Target:
public FluentWaitElementListMatcher not() { FluentWaitElementListMatcher negatedConditions = new FluentWaitElementListMatcher(search, wait, untilElements); negatedConditions.negation = !negation; return negatedConditions; }
Source:
public static void addSmelting(int fluidOutput, IItemStack itemInput, int meltingPoint) { FluidStack fluid = FluidRegistry.getFluidStack("glass", fluidOutput); if (fluid == null){ LogHelper.logWarning("Liquid Class is null for the Thermionic Fabricator"); return; } ModTweaker.LATE_ADDITIONS.add(new AddSmelting(new FabricatorSmeltingRecipe(toStack(itemInput), fluid, meltingPoint))); }

Target:
public static void addSmelting(int fluidOutput, IItemStack itemInput, int meltingPoint) { FluidStack fluid = FluidRegistry.getFluidStack("glass", fluidOutput); if (fluid == null){ LogHelper.logWarning("Liquid Glass is null for the Thermionic Fabricator"); return; } ModTweaker.LATE_ADDITIONS.add(new AddSmelting(new FabricatorSmeltingRecipe(toStack(itemInput), fluid, meltingPoint))); }
Source:
public int hashCode() { return Objects.hashCode( broadcaster, mediaType, availableFrom, channelGroups, genres, publisher, uri, aliasNamespace, aliasNamespace ); }

Target:
public int hashCode() { return Objects.hashCode( broadcaster, mediaType, availableFrom, channelGroups, genres, publisher, uri, aliasNamespace, aliasValue ); }
Source:
public void handle(HttpExchange t) throws IOException { String rawQuery = t.getRequestURI().getQuery(); String response = "Invalid Parameters. job_id is a required URL parameter."; int statusCode = 400; String[] params = rawQuery.split("&"); for (String param : params) { String[] parts = param.split("="); String key = URLDecoder.decode(parts[0], "UTF-8"); if (key.equals("job_id")) { response = GetSuperstepData(URLDecoder.decode(parts[1], "UTF-8")); statusCode = 200; } } t.sendResponseHeaders(statusCode, response.length()); OutputStream os = t.getResponseBody(); os.write(response.getBytes()); os.close(); }

Target:
public void handle(HttpExchange t) throws IOException { String rawQuery = t.getRequestURI().getQuery(); String jobId = null; String[] params = rawQuery.split("&"); for (String param : params) { String[] parts = param.split("="); String key = URLDecoder.decode(parts[0], "UTF-8"); if (key.equals("job_id")) { jobId = URLDecoder.decode(parts[1], "UTF-8"); } } String response; int statusCode; if (jobId == null) { statusCode = HttpURLConnection.HTTP_BAD_REQUEST; response = "Invalid parameters. job_id is a required parameter"; } else { statusCode = HttpURLConnection.HTTP_OK; response = GetSuperstepData(jobId); } t.sendResponseHeaders(statusCode, response.length()); OutputStream os = t.getResponseBody(); os.write(response.getBytes()); os.close(); }
Source:
protected void configure(Object... args) { int index = 0; try { this.credentials = Credentials.getCredentialsBase64((byte[]) args[index++]); } catch (KeyException e1) { logger.debug("Cannot decrypt credentials", e1); } try { this.maxNodes = Integer.parseInt(args[index++].toString()); this.persistedInfraVariables.put(NB_HANDLED_NODES_KEY, 0); } catch (Exception e) { throw new IllegalArgumentException("Cannot determine max node"); } try { this.nodeTimeout = Integer.parseInt(args[index++].toString()); } catch (Exception e) { logger.warn("Cannot determine node timeout, using default:" + this.nodeTimeout, e); } this.paProperties = args[index].toString(); }

Target:
protected void configure(Object... args) { int index = 0; try { Object possibleCredentials = args[index++]; if (possibleCredentials != null) { this.credentials = Credentials.getCredentialsBase64((byte[]) possibleCredentials); } } catch (KeyException e1) { throw new IllegalArgumentException("Cannot decrypt credentials", e1); } try { this.maxNodes = Integer.parseInt(args[index++].toString()); this.persistedInfraVariables.put(NB_HANDLED_NODES_KEY, 0); } catch (Exception e) { throw new IllegalArgumentException("Cannot determine max node"); } try { this.nodeTimeout = Integer.parseInt(args[index++].toString()); } catch (Exception e) { logger.warn("Cannot determine node timeout, using default:" + this.nodeTimeout, e); } this.paProperties = args[index].toString(); }
Source:
public void removeLeftoverDevices(VmBase vmBase) { List<VmDevice> spiceChannels = vmDeviceDao.getVmDeviceByVmIdTypeAndDevice( vmBase.getId(), VmDeviceGeneralType.CHANNEL, VmDeviceType.SPICEVMC.getName()); if (!hasGraphicsDevice(vmBase.getId(), GraphicsType.SPICE)) { removeVmDevices(spiceChannels); } }

Target:
public void removeLeftoverDevices(VmBase vmBase) { if (!hasGraphicsDevice(vmBase.getId(), GraphicsType.SPICE)) { List<VmDevice> spiceChannels = vmDeviceDao.getVmDeviceByVmIdTypeAndDevice( vmBase.getId(), VmDeviceGeneralType.CHANNEL, VmDeviceType.SPICEVMC.getName()); removeVmDevices(spiceChannels); } }
Source:
public void createStripeGatewayAccountWithCredentials() throws Exception { Map<String, Object> payload = ImmutableMap.of( "type", "test", "payment_provider", "stripe", "service_name", "My shiny new stripe service", "credentials", ImmutableMap.of( "credentials_type", "stripe", "account_id", "abc")); String gatewayAccountId = givenSetup() .body(toJson(payload)) .post(ACCOUNTS_API_URL) .then() .statusCode(201) .contentType(JSON) .body("gateway_account_id", not(isEmptyString())) .body("service_name", is("My shiny new stripe service")) .body("type", is("test")) .body("links.size()", is(1)) .body("links[0].href", matchesPattern("https://localhost:[0-9]*/v1/api/accounts/[0-9]*")) .body("links[0].rel", is("self")) .body("links[0].method", is("GET")) .extract() .body() .jsonPath() .getString("gateway_account_id"); Optional<GatewayAccountEntity> gatewayAccount = gatewayAccountDao.findById(Long.valueOf(gatewayAccountId)); assertThat(gatewayAccount.isPresent(), is(true)); assertThat(gatewayAccount.get().getCredentials().get("account_id"), is("abc")); }

Target:
public void createStripeGatewayAccountWithCredentials() throws Exception { Map<String, Object> payload = ImmutableMap.of( "type", "test", "payment_provider", "stripe", "service_name", "My shiny new stripe service", "credentials", ImmutableMap.of("stripe_account_id", "abc")); String gatewayAccountId = givenSetup() .body(toJson(payload)) .post(ACCOUNTS_API_URL) .then() .statusCode(201) .contentType(JSON) .body("gateway_account_id", not(isEmptyString())) .body("service_name", is("My shiny new stripe service")) .body("type", is("test")) .body("links.size()", is(1)) .body("links[0].href", matchesPattern("https://localhost:[0-9]*/v1/api/accounts/[0-9]*")) .body("links[0].rel", is("self")) .body("links[0].method", is("GET")) .extract() .body() .jsonPath() .getString("gateway_account_id"); Optional<GatewayAccountEntity> gatewayAccount = gatewayAccountDao.findById(Long.valueOf(gatewayAccountId)); assertThat(gatewayAccount.isPresent(), is(true)); assertThat(gatewayAccount.get().getCredentials().get("stripe_account_id"), is("abc")); }
Source:
public void dispose() { phone.mCM.unregisterForSIMLockedOrAbsent(this); phone.mCM.unregisterForOffOrNotAvailable(this); phone.mCM.unregisterForSIMReady(this); this.removeCallbacksAndMessages(null); this.absentRegistrants = null; this.pinLockedRegistrants = null; this.networkLockedRegistrants = null; this.status = null; this.phone = null; }

Target:
public void dispose() { phone.mCM.unregisterForSIMLockedOrAbsent(this); phone.mCM.unregisterForOffOrNotAvailable(this); phone.mCM.unregisterForSIMReady(this); }
Source:
public InputKind(String relpath, Class inputClass, String kind) { this.relpath = relpath; this.inputClass = inputClass; this.kind = kind; knownKinds.put(kind, this); }

Target:
private InputKind(String relpath, Class inputClass, String kind) { this.relpath = relpath; this.inputClass = inputClass; this.kind = kind; knownKinds.put(kind, this); }
Source:
private int compareValues(Value a, Value b, int sortType) { if (a == b) { return 0; } if (a == null) { return -1; } else if (b == null) { return 1; } boolean aNull = a == ValueNull.INSTANCE; boolean bNull = b == ValueNull.INSTANCE; if (aNull || bNull) { return SortOrder.compareNull(aNull, sortType); } int t2 = Value.getHigherOrder(a.getType(), b.getType()); String[] enumerators = ValueEnum.getEnumeratorsForBinaryOperation(a, b); int comp = a.convertTo(t2, -1, mode, null, enumerators) .compareTypeSafe(b.convertTo(t2, -1, mode, null, enumerators), compareMode); if ((sortType & SortOrder.DESCENDING) != 0) { comp = -comp; } return comp; }

Target:
private int compareValues(Value a, Value b, int sortType) { if (a == b) { return 0; } if (a == null) { return -1; } else if (b == null) { return 1; } boolean aNull = a == ValueNull.INSTANCE; boolean bNull = b == ValueNull.INSTANCE; if (aNull || bNull) { return SortOrder.compareNull(aNull, sortType); } int t2 = Value.getHigherOrder(a.getType(), b.getType()); if (t2 == Value.ENUM) { String[] enumerators = ValueEnum.getEnumeratorsForBinaryOperation(a, b); a = a.convertToEnum(enumerators); b = b.convertToEnum(enumerators); } else { a = a.convertTo(t2, -1, mode); b = b.convertTo(t2, -1, mode); } int comp = a.compareTypeSafe(b, compareMode); if ((sortType & SortOrder.DESCENDING) != 0) { comp = -comp; } return comp; }
Source:
public static void send(Message message, OutputStream outputStream) throws IOException { synchronized (outputStream) { log.trace("Writing on: " + outputStream); StringBuffer toSend = new StringBuffer(message.getCommand().toString()); toSend.append("\n"); Iterator<String> keys = message.getHeaders().keySet().iterator(); while (keys.hasNext()) { String key = keys.next(); String value = message.getHeaders().get(key); toSend.append(key); toSend.append(":"); toSend.append(value); toSend.append("\n"); } toSend.append("\n"); outputStream.write(toSend.toString().getBytes()); if (message.getBody() != null) { outputStream.write(message.getBody()); } outputStream.write("\000\n\n".getBytes()); log.trace("Wrote on: " + outputStream); } }

Target:
public static void send(Message message, OutputStream outputStream) throws IOException { log.trace("Writing on: " + outputStream); synchronized (outputStream) { outputStream.write(message.getCommand().getBytes()); outputStream.write(EOL); for (Map.Entry<String, String> header : message.getHeaders().entrySet()) { outputStream.write(header.getKey().getBytes()); outputStream.write(COLON); outputStream.write(header.getValue().getBytes()); outputStream.write(EOL); } outputStream.write(EOL); if(message.getBody() != null) { outputStream.write(message.getBody()); } outputStream.write(EOM); } log.trace("Wrote on: " + outputStream); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); String title = extras.getString(GraphView.TITLE); if (title == null) { requestWindowFeature(Window.FEATURE_NO_TITLE); } else if (title.length() > 0) { setTitle(title); } String html = extras.getString(GraphView.HTML); mView = new GraphView(this, title, true); try { WebView view = (WebView) mView.getView(html); setContentView(view); } catch (InvalidStateException e) { e.printStackTrace(); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); String title = extras.getString(GraphView.TITLE); if (title == null) { requestWindowFeature(Window.FEATURE_NO_TITLE); } else if (title.length() > 0) { setTitle(title); } String html = extras.getString(GraphView.HTML); mView = new GraphView(this, title, true); try { WebView view = (WebView) mView.getView(html); setContentView(view); } catch (InvalidStateException e) { e.printStackTrace(); finish(); } }
Source:
public Integer invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { if (f.exists() && f.length() > 0) { try { Charset cs = transcodingCharset(charset); String fileString = Files.readFirstLine(f, cs != null ? cs : Charset.defaultCharset()); if (fileString == null || fileString.isEmpty()) { return null; } else { fileString = fileString.trim(); if (fileString.isEmpty()) { return null; } else { return Integer.parseInt(fileString); } } } catch (NumberFormatException x) { throw new IOException("corrupted content in " + f + ": " + x, x); } } return null; }

Target:
public Integer invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { if (f.exists() && f.length() > 0) { try { String fileString = Files.readFirstLine(f, Charset.defaultCharset()); if (fileString == null || fileString.isEmpty()) { return null; } else { fileString = fileString.trim(); if (fileString.isEmpty()) { return null; } else { return Integer.parseInt(fileString); } } } catch (NumberFormatException x) { throw new IOException("corrupted content in " + f + ": " + x, x); } } return null; }
Source:
public void onResume(Activity activity) { if (isLightModeCahnged(activity)) { Intent intent = activity.getIntent(); activity.finish(); activity.overridePendingTransition(0, 0); activity.startActivity(intent); activity.overridePendingTransition(0, 0); } }

Target:
public void onResume(Activity activity) { if (isLightModeChanged(activity)) { Intent intent = activity.getIntent(); activity.finish(); activity.overridePendingTransition(0, 0); activity.startActivity(intent); activity.overridePendingTransition(0, 0); } }
Source:
private String runSshCommand(URIish sshUri, FS fs, String command) throws IOException { RemoteSession session = null; Process process = null; StreamCopyThread errorThread = null; try (MessageWriter stderr = new MessageWriter()) { session = SshSessionFactory.getInstance().getSession(sshUri, null, fs, 5_000); process = session.exec(command, 0); errorThread = new StreamCopyThread(process.getErrorStream(), stderr.getRawStream()); errorThread.start(); try (BufferedReader reader = new BufferedReader( new InputStreamReader(process.getInputStream(), Constants.CHARSET))) { return reader.readLine(); } } finally { if (process != null) { process.destroy(); } if (errorThread != null) { try { errorThread.halt(); } catch (InterruptedException e) { } finally { errorThread = null; } } if (session != null) { SshSessionFactory.getInstance().releaseSession(session); } } }

Target:
private String runSshCommand(URIish sshUri, FS fs, String command) throws IOException { RemoteSession session = null; Process process = null; StreamCopyThread errorThread = null; try (MessageWriter stderr = new MessageWriter()) { session = SshSessionFactory.getInstance().getSession(sshUri, null, fs, 5_000); process = session.exec(command, 0); errorThread = new StreamCopyThread(process.getErrorStream(), stderr.getRawStream()); errorThread.start(); try (BufferedReader reader = new BufferedReader( new InputStreamReader(process.getInputStream(), org.eclipse.jgit.lib.Constants.CHARSET))) { return reader.readLine(); } } finally { if (process != null) { process.destroy(); } if (errorThread != null) { try { errorThread.halt(); } catch (InterruptedException e) { } finally { errorThread = null; } } if (session != null) { SshSessionFactory.getInstance().releaseSession(session); } } }
Source:
public synchronized Address<? extends Node> getOrCreateNodeByRecipe(RecipeTraceInfo recipeTrace) { ReteNodeRecipe recipe = recipeTrace.getRecipe(); Address<? extends Node> result = getNodesByRecipe().get(recipe); if (result != null) { if (getRecipeTraces().add(recipeTrace)) result.getNodeCache().assignTraceInfo(recipeTrace); } else { ReteNodeRecipe canonicalRecipe = recognizer.canonicalizeRecipe(recipe); if (canonicalRecipe != recipe) { result = getNodesByRecipe().get(canonicalRecipe); if (result != null) { recipeTrace.shadowWithEquivalentRecipe(canonicalRecipe); getNodesByRecipe().put(recipe, result); if (getRecipeTraces().add(recipeTrace)) result.getNodeCache().assignTraceInfo(recipeTrace); ensureParents(recipeTrace); } else { if (recipe instanceof IndexerRecipe) { } else { throw new IllegalStateException(); } } } if (result == null) { final Node freshNode = instantiateNodeForRecipe(recipeTrace, recipe); result = reteContainer.makeAddress(freshNode); } } return result; }

Target:
public synchronized Address<? extends Node> getOrCreateNodeByRecipe(RecipeTraceInfo recipeTrace) { ReteNodeRecipe recipe = recipeTrace.getRecipe(); Address<? extends Node> result = getNodesByRecipe().get(recipe); if (result != null) { if (getRecipeTraces().add(recipeTrace)) result.getNodeCache().assignTraceInfo(recipeTrace); } else { ReteNodeRecipe canonicalRecipe = recognizer.canonicalizeRecipe(recipe); if (canonicalRecipe != recipe) { result = getNodesByRecipe().get(canonicalRecipe); if (result != null) { recipeTrace.shadowWithEquivalentRecipe(canonicalRecipe); getNodesByRecipe().put(recipe, result); if (getRecipeTraces().add(recipeTrace)) result.getNodeCache().assignTraceInfo(recipeTrace); ensureParents(recipeTrace); } else { if (recipe instanceof IndexerRecipe) { } else { throw new IllegalStateException( "This should not happen: " + "non-indexer nodes are are supposed to be constructed " + "as soon as they are designated as canonical recipes"); } } } if (result == null) { final Node freshNode = instantiateNodeForRecipe(recipeTrace, recipe); result = reteContainer.makeAddress(freshNode); } } return result; }
Source:
public String changePasswordRandom(PerunSession session, User user, String loginNamespace) throws PasswordOperationTimeoutException, LoginNotExistsException, InternalErrorException, PasswordChangeFailedException { char[] possibleCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%&*()-_=+;:,<.>/?" .toCharArray(); String newRandomPassword = RandomStringUtils.random(12, 0, possibleCharacters.length - 1, false, false, possibleCharacters, new SecureRandom()); try { changePassword(session, user, loginNamespace, null, newRandomPassword, false); } catch (PasswordDoesntMatchException | PasswordStrengthFailedException e) { throw new InternalError(e); } String template = getPasswordResetTemplate(session, loginNamespace); String userLogin; try { Attribute userLoginAttribute = getPerunBl().getAttributesManagerBl().getAttribute(session, user, AttributesManager.NS_USER_ATTR_DEF + ":login-namespace:" + loginNamespace); userLogin = (String) userLoginAttribute.getValue(); } catch (WrongAttributeAssignmentException | AttributeNotExistsException e) { throw new InternalError(e); } return template .replace("{password}", newRandomPassword) .replace("{login}", userLogin); }

Target:
public String changePasswordRandom(PerunSession session, User user, String loginNamespace) throws PasswordOperationTimeoutException, LoginNotExistsException, InternalErrorException, PasswordChangeFailedException { char[] possibleCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%&*()-_=+;:,<.>/?" .toCharArray(); String newRandomPassword = RandomStringUtils.random(12, 0, possibleCharacters.length - 1, false, false, possibleCharacters, new SecureRandom()); try { changePassword(session, user, loginNamespace, null, newRandomPassword, false); } catch (PasswordDoesntMatchException | PasswordStrengthFailedException e) { throw new InternalErrorException(e); } String template = getPasswordResetTemplate(session, loginNamespace); String userLogin; try { Attribute userLoginAttribute = getPerunBl().getAttributesManagerBl().getAttribute(session, user, AttributesManager.NS_USER_ATTR_DEF + ":login-namespace:" + loginNamespace); userLogin = (String) userLoginAttribute.getValue(); } catch (WrongAttributeAssignmentException | AttributeNotExistsException e) { throw new InternalErrorException(e); } return template .replace("{password}", StringEscapeUtils.escapeHtml4(newRandomPassword)) .replace("{login}", StringEscapeUtils.escapeHtml4(userLogin)); }
Source:
public void saveGlobalProperties_shouldAssignUuidToAllNewProperties() throws Exception { List<GlobalProperty> globalProperties = Context.getAdministrationService().getAllGlobalProperties(); globalProperties.remove(3); globalProperties.add(new GlobalProperty("new prop", "new prop value", "desc")); Context.getAdministrationService().saveGlobalProperties(globalProperties); Assert.assertNotNull(Context.getAdministrationService().getGlobalPropertyObject("new prop").getUuid()); }

Target:
public void saveGlobalProperties_shouldAssignUuidToAllNewProperties() throws Exception { List<GlobalProperty> globalProperties = Context.getAdministrationService().getAllGlobalProperties(); globalProperties.add(new GlobalProperty("new prop", "new prop value", "desc")); Context.getAdministrationService().saveGlobalProperties(globalProperties); Assert.assertNotNull(Context.getAdministrationService().getGlobalPropertyObject("new prop").getUuid()); }
Source:
private JBIterable<PsiErrorElement> errorElements(PsiElement root) { return SyntaxTraverser.psiTraverser(root).traverse().filter(PsiErrorElement.class); }

Target:
private static JBIterable<PsiErrorElement> errorElements(PsiElement root) { return SyntaxTraverser.psiTraverser(root).traverse().filter(PsiErrorElement.class); }
Source:
public List<ModuleMetaData> getAllModule() { JsonModuleMetaDataProvider provider = new JsonModuleMetaDataProvider(new JsonFlowMetaDataProvider()); return this.moduleMetadata.values().stream() .map(moduleMetadata -> provider.deserialiseModule(moduleMetadata)) .collect(Collectors.toList()); }

Target:
public List<ModuleMetaData> getAllModule() { return this.moduleMetadata.values().stream() .map(moduleMetadata -> provider.deserialiseModule(moduleMetadata)) .collect(Collectors.toList()); }
Source:
public Expr toExpr() { return new LongExpr(value == null ? null : (value).longValue()); }

Target:
public Expr toExpr() { return new LongExpr(value == null ? null : value.longValue()); }