auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void doBindChildrenInFilter(Component[] shadows) { for (Component shadow : shadows) { ShadowElement se = (ShadowElement) shadow; if (!(shadow instanceof ShadowElement) || !se.getDistributedChildren().isEmpty() || !((ShadowElementCtrl) se).isDynamicValue()) return; List<Component> children = shadow.getChildren(); if (children.size() > 0) { doBindChildrenInFilter(children.toArray(new Component[children.size()])); } else { Events.sendEvent(new Event("onBindInit", (Component) se)); Events.sendEvent(new Event("onBindingReady", (Component) se)); } } }

Target:
private static void doBindChildrenInFilter(Component[] shadows) { for (Component shadow : shadows) { if (shadow instanceof ShadowElement) { ShadowElement se = (ShadowElement) shadow; if (!se.getDistributedChildren().isEmpty() || !((ShadowElementCtrl) se).isDynamicValue()) continue; List<Component> children = shadow.getChildren(); if (children.size() > 0) { doBindChildrenInFilter(children.toArray(new Component[children.size()])); } else { Events.sendEvent(new Event("onBindInit", (Component) se)); Events.sendEvent(new Event("onBindingReady", (Component) se)); } } } }
Source:
private void processTruncationRequestEvent(final WatchedEvent event) { if (event.getType() == EventType.NodeChildrenChanged) { boolean isBare = (!m_BareProcessed.getAndSet(true) && VoltDB.instance().isBare()); loggingLog.info("Scheduling truncation request processing " + (isBare ? 0 : m_truncationGatheringPeriod) + " seconds from now"); m_es.schedule(new Runnable() { @Override public void run() { try { processSnapshotTruncationRequestCreated(event); } catch (Exception e) { VoltDB.crashLocalVoltDB("Error processing snapshot truncation request creation", true, e); } } }, isBare ? 0 : m_truncationGatheringPeriod, TimeUnit.SECONDS); return; } else { VoltDB.crashLocalVoltDB( "Trunction request watcher fired with event type other then created: " + event.getType(), true, null); } }

Target:
private void processTruncationRequestEvent(final WatchedEvent event) { if (event.getType() == EventType.NodeChildrenChanged) { boolean isBare = (!m_BareProcessed.getAndSet(true) && VoltDB.instance().isBare()); int truncationGatheringPeriod = (isBare ? 0 : m_truncationGatheringPeriod); loggingLog.info("Scheduling truncation request processing " + truncationGatheringPeriod + " seconds from now"); m_es.schedule(new Runnable() { @Override public void run() { try { processSnapshotTruncationRequestCreated(event); } catch (Exception e) { VoltDB.crashLocalVoltDB("Error processing snapshot truncation request creation", true, e); } } }, truncationGatheringPeriod, TimeUnit.SECONDS); return; } else { VoltDB.crashLocalVoltDB( "Trunction request watcher fired with event type other then created: " + event.getType(), true, null); } }
Source:
public boolean[] readBoolArray() throws TException { TList tList = protocol.readListBegin(); boolean[] array = new boolean[tList.size]; for (int i = 0; i < tList.size; i++) { array[i] = readBool(); } protocol.readListEnd(); return array; }

Target:
public boolean[] readBoolArray() throws TException { TList list = protocol.readListBegin(); boolean[] array = new boolean[list.size]; for (int i = 0; i < list.size; i++) { array[i] = readBool(); } protocol.readListEnd(); return array; }
Source:
public static String formatDateResponse(String value) { try { Date date = new Date(Long.valueOf(value)); return DATE_RESPONSE_FORMAT.get().format(date); } catch (NumberFormatException e) { log.error("Invalid date response: " + value); } return ""; }

Target:
public static String formatDateResponse(String value) { Date date = parseDatastoreDate(value); if (date != null) { return DATE_RESPONSE_FORMAT.get().format(date); } return ""; }
Source:
public void enqueued( BoltConnection to, Job job ) { checkLimitsOnEnqueue( to, counters.compute( to.id(), ( k, v ) -> v == null ? new AtomicInteger( 0 ) : v ).incrementAndGet() ); }

Target:
public void enqueued( BoltConnection to, Job job ) { checkLimitsOnEnqueue( to, counters.computeIfAbsent( to.id(), k -> new AtomicInteger( 0 ) ).incrementAndGet() ); }
Source:
public Response interceptGeoServerRequest(HttpServletRequest request) throws InterceptorException, URISyntaxException, UnsupportedEncodingException, HttpException { MutableHttpServletRequest mutableRequest = new MutableHttpServletRequest(request); OgcMessage message = getOgcRequest(mutableRequest); URI geoServerBaseUri = getGeoServerBaseURI(message); mutableRequest.setRequestURI(geoServerBaseUri); mutableRequest = ogcMessageDistributor .distributeToRequestInterceptor(mutableRequest, message); Response response = sendRequest(mutableRequest); Response interceptedResponse = ogcMessageDistributor .distributeToResponeInterceptor(response, message); interceptedResponse.setHeaders( getHeadersToForward(interceptedResponse.getHeaders())); return interceptedResponse; }

Target:
public Response interceptGeoServerRequest(HttpServletRequest request) throws InterceptorException, URISyntaxException, HttpException, IOException { MutableHttpServletRequest mutableRequest = new MutableHttpServletRequest(request); OgcMessage message = getOgcRequest(mutableRequest); URI geoServerBaseUri = getGeoServerBaseURI(message); mutableRequest.setRequestURI(geoServerBaseUri); mutableRequest = ogcMessageDistributor .distributeToRequestInterceptor(mutableRequest, message); Response response = sendRequest(mutableRequest); Response interceptedResponse = ogcMessageDistributor .distributeToResponseInterceptor(response, message); interceptedResponse.setHeaders( getHeadersToForward(interceptedResponse.getHeaders())); return interceptedResponse; }
Source:
public ModVersion() { version = new SimpleObjectProperty<>(); id = new SimpleStringProperty(); uid = new SimpleStringProperty(); type = new SimpleObjectProperty<>(); description = new SimpleStringProperty(); filename = new SimpleStringProperty(); icon = new SimpleStringProperty(); ranked = new SimpleBooleanProperty(); hidden = new SimpleBooleanProperty(); createTime = new SimpleObjectProperty<>(); updateTime = new SimpleObjectProperty<>(); thumbnailUrl = new SimpleObjectProperty<>(); downloadUrl = new SimpleObjectProperty<>(); mod = new SimpleObjectProperty<>(); }

Target:
public ModVersion() { displayName = new SimpleStringProperty(); imagePath = new SimpleObjectProperty<>(); id = new SimpleStringProperty(); uid = new SimpleStringProperty(); description = new SimpleStringProperty(); uploader = new SimpleStringProperty(); selectable = new SimpleBooleanProperty(); version = new SimpleObjectProperty<>(); selected = new SimpleBooleanProperty(); likes = new SimpleIntegerProperty(); played = new SimpleIntegerProperty(); createTime = new SimpleObjectProperty<>(); updateTime = new SimpleObjectProperty<>(); reviewsSummary = new SimpleObjectProperty<>(); downloads = new SimpleIntegerProperty(); thumbnailUrl = new SimpleObjectProperty<>(); comments = new SimpleListProperty<>(FXCollections.observableArrayList()); downloadUrl = new SimpleObjectProperty<>(); mountPoints = new SimpleListProperty<>(FXCollections.observableArrayList()); hookDirectories = new SimpleListProperty<>(FXCollections.observableArrayList()); reviews = new SimpleListProperty<>(FXCollections.observableArrayList(param -> new Observable[]{param.scoreProperty(), param.textProperty()})); modType = new SimpleObjectProperty<>(); filename = new SimpleStringProperty(); icon = new SimpleStringProperty(); ranked = new SimpleBooleanProperty(); hidden = new SimpleBooleanProperty(); mod = new SimpleObjectProperty<>(); }
Source:
public void testReloadBrooklynPropertiesFromFile() throws Exception { File globalPropertiesFile = File.createTempFile("local-brooklyn-properties-test", ".properties"); globalPropertiesFile.deleteOnExit(); String property = "mykey=myval"; Files.write(property, globalPropertiesFile, Charsets.UTF_8); launcher = BrooklynLauncher.newInstance() .webconsole(false) .globalBrooklynPropertiesFile(globalPropertiesFile.getAbsolutePath()) .start(); LocalManagementContext managementContext = (LocalManagementContext)launcher.getServerDetails().getManagementContext(); assertEquals(managementContext.getConfig().getFirst("mykey"), "myval"); property = "mykey=newval"; Files.write(property, globalPropertiesFile, Charsets.UTF_8); managementContext.reloadBrooklynProperties(); assertEquals(managementContext.getConfig().getFirst("mykey"), "newval"); }

Target:
public void testReloadBrooklynPropertiesFromFile() throws Exception { File globalPropertiesFile = File.createTempFile("local-brooklyn-properties-test", ".properties"); try { String property = "mykey=myval"; Files.write(property, globalPropertiesFile, Charsets.UTF_8); launcher = BrooklynLauncher.newInstance() .webconsole(false) .globalBrooklynPropertiesFile(globalPropertiesFile.getAbsolutePath()) .start(); LocalManagementContext managementContext = (LocalManagementContext)launcher.getServerDetails().getManagementContext(); assertEquals(managementContext.getConfig().getFirst("mykey"), "myval"); property = "mykey=newval"; Files.write(property, globalPropertiesFile, Charsets.UTF_8); managementContext.reloadBrooklynProperties(); assertEquals(managementContext.getConfig().getFirst("mykey"), "newval"); } finally { globalPropertiesFile.delete(); } }
Source:
private <D extends AssetData> D loadAssetData(AssetUri uri, boolean logErrors) { if (!uri.isValid()) { return null; } List<URL> urls = getAssetURLs(uri); if (urls.size() == 0) { if (logErrors) { logger.warn("Unable to resolve asset: {}", uri); } return null; } for (URL url : urls) { int extensionIndex = url.toString().lastIndexOf('.'); if (extensionIndex == -1) { continue; } String extension = url.toString().substring(extensionIndex + 1).toLowerCase(Locale.ENGLISH); Map<String, AssetLoader<?>> extensionMap = assetLoaders.get(uri.getAssetType()); if (extensionMap == null) { continue; } AssetLoader<?> loader = extensionMap.get(extension); if (loader == null) { continue; } Module module = moduleManager.getActiveModule(uri.getNormalisedModuleName()); List<URL> deltas; if (uri.getAssetType().isDeltaSupported()) { deltas = Lists.newArrayList(); for (Module deltaModule : moduleManager.getActiveModulesOrderedByDependency()) { AssetSource source = assetSources.get(deltaModule.getId()); if (source != null) { deltas.addAll(source.getDelta(uri)); } } } else { deltas = Collections.emptyList(); } try (InputStream stream = AccessController.doPrivileged(new PrivilegedOpenStream(url))) { urls.remove(url); urls.add(0, url); return (D) loader.load(module, stream, urls, deltas); } catch (PrivilegedActionException e) { logger.error("Error reading asset {}", uri, e.getCause()); return null; } catch (IOException ioe) { logger.error("Error reading asset {}", uri, ioe); return null; } } logger.warn("Unable to resolve asset: {}", uri); return null; }

Target:
private AssetData loadAssetData(AssetUri uri, boolean logErrors) { if (!uri.isValid()) { return null; } List<URL> urls = getAssetURLs(uri); if (urls.size() == 0) { if (logErrors) { logger.warn("Unable to resolve asset: {}", uri); } return null; } for (URL url : urls) { int extensionIndex = url.toString().lastIndexOf('.'); if (extensionIndex == -1) { continue; } String extension = url.toString().substring(extensionIndex + 1).toLowerCase(Locale.ENGLISH); Map<String, AssetLoader<?>> extensionMap = assetLoaders.get(uri.getAssetType()); if (extensionMap == null) { continue; } AssetLoader<?> loader = extensionMap.get(extension); if (loader == null) { continue; } Module module = moduleManager.getActiveModule(uri.getNormalisedModuleName()); List<URL> deltas; if (uri.getAssetType().isDeltaSupported()) { deltas = Lists.newArrayList(); for (Module deltaModule : moduleManager.getActiveModulesOrderedByDependency()) { AssetSource source = assetSources.get(deltaModule.getId()); if (source != null) { deltas.addAll(source.getDelta(uri)); } } } else { deltas = Collections.emptyList(); } try (InputStream stream = AccessController.doPrivileged(new PrivilegedOpenStream(url))) { urls.remove(url); urls.add(0, url); return loader.load(module, stream, urls, deltas); } catch (PrivilegedActionException e) { logger.error("Error reading asset {}", uri, e.getCause()); return null; } catch (IOException ioe) { logger.error("Error reading asset {}", uri, ioe); return null; } } logger.warn("Unable to resolve asset: {}", uri); return null; }
Source:
TrustManagerFactoryWrapper(TrustManager tm) throws Exception { this.tm = tm; }

Target:
TrustManagerFactoryWrapper(TrustManager tm) { this.tm = ObjectUtil.checkNotNull(tm, "tm"); }
Source:
public void sessionDestroyed(HttpSessionEvent se) { if (authorizationManagers.isEmpty()) { return; } final User currentUser = (User) se.getSession().getAttribute(ServletSecurityAuthenticationService.USER_SESSION_ATTR_NAME); if (currentUser != null && !currentUser.equals(User.ANONYMOUS)) { for (AuthorizationManager authorizationManager : authorizationManagers) { authorizationManager.invalidate(currentUser); } } }

Target:
public void sessionDestroyed(HttpSessionEvent se) { if (authorizationManagers.isEmpty()) { return; } final User currentUser = (User) se.getSession().getAttribute(ServletSecurityAuthenticationService.USER_SESSION_ATTR_NAME); if (!ANONYMOUS.equals(currentUser)) { for (AuthorizationManager authorizationManager : authorizationManagers) { authorizationManager.invalidate(currentUser); } } }
Source:
private void bootstrapLogReplicationService() { try { LogReplicationConfig logReplicationConfig = getLogReplicationConfiguration(getCorfuRuntime()); logReplicationMetadataManager = new LogReplicationMetadataManager(getCorfuRuntime(), topologyDescriptor.getTopologyConfigId(), localClusterDescriptor.getClusterId()); logReplicationServerHandler = new LogReplicationServer(serverContext, logReplicationConfig, logReplicationMetadataManager, localCorfuEndpoint, topologyDescriptor.getTopologyConfigId()); logReplicationServerHandler.setActive(localClusterDescriptor.getRole().equals(ClusterRole.ACTIVE)); interClusterReplicationService = new CorfuInterClusterReplicationServerNode(serverContext, logReplicationServerHandler, logReplicationConfig); replicationContext = new LogReplicationContext(logReplicationConfig, topologyDescriptor, localCorfuEndpoint, interClusterReplicationService.getRouter().getServerAdapter().getChannelContext()); serverCallback.complete(interClusterReplicationService); logReplicationEventListener = new LogReplicationEventListener(this); logReplicationEventListener.start(); serverStarted = true; } catch (Throwable t) { throw t; } }

Target:
private void bootstrapLogReplicationService() { LogReplicationConfig logReplicationConfig = getLogReplicationConfiguration(getCorfuRuntime()); logReplicationMetadataManager = new LogReplicationMetadataManager(getCorfuRuntime(), topologyDescriptor.getTopologyConfigId(), localClusterDescriptor.getClusterId()); logReplicationServerHandler = new LogReplicationServer(serverContext, logReplicationConfig, logReplicationMetadataManager, localCorfuEndpoint, topologyDescriptor.getTopologyConfigId()); logReplicationServerHandler.setActive(localClusterDescriptor.getRole().equals(ClusterRole.ACTIVE)); interClusterReplicationService = new CorfuInterClusterReplicationServerNode(serverContext, logReplicationServerHandler, logReplicationConfig); replicationContext = new LogReplicationContext(logReplicationConfig, topologyDescriptor, localCorfuEndpoint, interClusterReplicationService.getRouter().getServerAdapter().getChannelContext()); serverCallback.complete(interClusterReplicationService); logReplicationEventListener = new LogReplicationEventListener(this); logReplicationEventListener.start(); serverStarted = true; }
Source:
public void shouldDisallowReAddingIndex() throws Exception { SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = new DataIntegrityValidatingStatementOperations( null, innerRead, innerWrite ); when( innerRead.indexGetForLabelAndPropertyKey( state, SchemaBoundary.map( descriptor ) ) ).thenReturn( index ); ctx.indexCreate( state, descriptor ); fail( "Should have thrown exception." ); verify( innerWrite, never() ).indexCreate( eq( state ), anyObject() ); }

Target:
public void shouldDisallowReAddingIndex() throws Exception { SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = new DataIntegrityValidatingStatementOperations( null, innerRead, innerWrite ); when( innerRead.indexGetForLabelAndPropertyKey( state, SchemaBoundary.map( descriptor ) ) ).thenReturn( index ); try { ctx.indexCreate( state, descriptor ); fail( "Should have thrown exception." ); } catch ( AlreadyIndexedException e ) { } verify( innerWrite, never() ).indexCreate( eq( state ), anyObject() ); }
Source:
private static String findTypeParameterDescriptor(Field field, ObjectAnnotations objectAnnotations) { String typeParameterDescriptor = null; final Type genericType = field.getGenericType(); if (genericType instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) genericType; final Type[] actualTypeArguments = parameterizedType.getActualTypeArguments(); if (actualTypeArguments.length > 0) { for (Type typeArgument : actualTypeArguments) { if (typeArgument instanceof ParameterizedType) { ParameterizedType parameterizedTypeArgument = (ParameterizedType) typeArgument; typeParameterDescriptor = parameterizedTypeArgument.getRawType().getTypeName(); break; } else if ((typeArgument instanceof TypeVariable || typeArgument instanceof WildcardType) && !objectAnnotations.has(Relationship.class)) { typeParameterDescriptor = Object.class.getName(); break; } else if (typeArgument instanceof Class) { typeParameterDescriptor = ((Class) typeArgument).getName(); } } } if (typeParameterDescriptor == null) { typeParameterDescriptor = parameterizedType.getRawType().getTypeName(); } } if (typeParameterDescriptor == null && (genericType instanceof TypeVariable)) { typeParameterDescriptor = field.getType().getTypeName(); } return typeParameterDescriptor; }

Target:
private static String findTypeParameterDescriptor(Field field, ObjectAnnotations objectAnnotations) { String typeParameterDescriptor = null; Type genericType = field.getGenericType(); if (genericType instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) genericType; Type[] actualTypeArguments = parameterizedType.getActualTypeArguments(); if (actualTypeArguments.length > 0) { for (Type typeArgument : actualTypeArguments) { if (typeArgument instanceof ParameterizedType) { ParameterizedType parameterizedTypeArgument = (ParameterizedType) typeArgument; typeParameterDescriptor = parameterizedTypeArgument.getRawType().getTypeName(); break; } else if ((typeArgument instanceof TypeVariable || typeArgument instanceof WildcardType) && !objectAnnotations.has(Relationship.class)) { typeParameterDescriptor = Object.class.getName(); break; } else if (typeArgument instanceof Class) { typeParameterDescriptor = ((Class) typeArgument).getName(); } } } if (typeParameterDescriptor == null) { typeParameterDescriptor = parameterizedType.getRawType().getTypeName(); } } if (typeParameterDescriptor == null && (genericType instanceof TypeVariable)) { typeParameterDescriptor = field.getType().getTypeName(); } return typeParameterDescriptor; }
Source:
public AtmosphereFramework destroy() { if (isDestroyed.getAndSet(true)) return this; onPreDestroy(); closeAtmosphereResource(); destroyInterceptors(); BroadcasterFactory factory = broadcasterFactory; if (factory != null) { factory.destroy(); } if (asyncSupport != null && AsynchronousProcessor.class.isAssignableFrom(asyncSupport.getClass())) { ((AsynchronousProcessor) asyncSupport).shutdown(); } for (Entry<String, AtmosphereHandlerWrapper> entry : atmosphereHandlers.entrySet()) { AtmosphereHandlerWrapper handlerWrapper = entry.getValue(); handlerWrapper.atmosphereHandler.destroy(); } if (metaBroadcaster != null) metaBroadcaster.destroy(); if (arFactory != null) arFactory.destroy(); if (sessionFactory != null) sessionFactory.destroy(); WebSocketProcessorFactory.getDefault().destroy(); ExecutorsFactory.reset(config); config.destroy(); resetStates(); onPostDestroy(); try { if (this.shutdownHook != null) { Runtime.getRuntime().removeShutdownHook(this.shutdownHook); shutdownHook = null; } } catch (IllegalStateException ex) { logger.trace("", ex); } return this; }

Target:
public AtmosphereFramework destroy() { if (isDestroyed.getAndSet(true)) return this; onPreDestroy(); closeAtmosphereResource(); destroyInterceptors(); config.destroy(); BroadcasterFactory factory = broadcasterFactory; if (factory != null) { factory.destroy(); } if (asyncSupport != null && AsynchronousProcessor.class.isAssignableFrom(asyncSupport.getClass())) { ((AsynchronousProcessor) asyncSupport).shutdown(); } for (Entry<String, AtmosphereHandlerWrapper> entry : atmosphereHandlers.entrySet()) { AtmosphereHandlerWrapper handlerWrapper = entry.getValue(); handlerWrapper.atmosphereHandler.destroy(); } if (metaBroadcaster != null) metaBroadcaster.destroy(); if (arFactory != null) arFactory.destroy(); if (sessionFactory != null) sessionFactory.destroy(); WebSocketProcessorFactory.getDefault().destroy(); ExecutorsFactory.reset(config); resetStates(); onPostDestroy(); try { if (this.shutdownHook != null) { Runtime.getRuntime().removeShutdownHook(this.shutdownHook); shutdownHook = null; } } catch (IllegalStateException ex) { logger.trace("", ex); } return this; }
Source:
private void startGeoTagging() { Context context = getContext(); Intent intent = new Intent(context, GeoTagImagesService.class); intent.setAction(GeoTagImagesService.ACTION_START_GEOTAGGING); getContext().startService(intent); }

Target:
private void startGeoTagging() { Context context = getContext(); if (context != null) { Intent intent = new Intent(context, GeoTagImagesService.class); intent.setAction(GeoTagImagesService.ACTION_START_GEOTAGGING); context.startService(intent); } }
Source:
protected void generateBVDesignLicenseJsonFile(final String bvDesignLocation) throws BVLicenseParseException { Process p = null; final String errorMessage = this.messageSource.getMessage("bv.design.error.failed.license.generation", null, LocaleContextHolder.getLocale()); try { final ProcessBuilder processBuilder = new ProcessBuilder(bvDesignLocation, "-status", "-json"); processBuilder.directory(new File(bvDesignLocation)); p = processBuilder.start(); p.waitFor(); } catch (final IOException | InterruptedException e) { BVDesignLicenseUtil.LOG.error(errorMessage + ":" + e.getMessage(), e); throw new BVLicenseParseException(errorMessage); } catch (final Exception e) { BVDesignLicenseUtil.LOG.error(errorMessage + ":" + e.getMessage(), e); throw new BVLicenseParseException(errorMessage); } }

Target:
protected void generateBVDesignLicenseJsonFile(final String bvDesignLocation) throws BVLicenseParseException { try { final String bvDesignDirectory = new File(bvDesignLocation).getParent(); bvDesignLicenseProcessRunner.setDirectory(bvDesignDirectory); bvDesignLicenseProcessRunner.run(bvDesignLocation, "-status", "-json"); } catch (final Exception e) { final String errorMessage = this.messageSource.getMessage("bv.design.error.failed.license.generation", null, LocaleContextHolder.getLocale()); BVDesignLicenseUtil.LOG.error(errorMessage + ":" + e.getMessage(), e); throw new BVLicenseParseException(errorMessage); } }
Source:
protected void customizeBinding(Map<String, Object> binding, Cell cell, boolean html, ServiceProvider provider, Locale locale) { FunctionDefinition<? extends ParameterDefinition> function = loadFunction( cell.getTransformationIdentifier(), provider); binding.put("_constraintsEvaluated", false); binding.put("_hasValue", false); binding.put("_isReference", false); if (!function.getTarget().isEmpty() && !cell.getTarget().isEmpty()) { ParameterDefinition parameterDefinition = function.getTarget().iterator().next(); Entity entity = cell.getTarget().get(parameterDefinition.getName()).iterator().next(); if (entity != null) { ChildContext childContext = entity.getDefinition().getPropertyPath().iterator() .next(); PropertyDefinition resultProperty = childContext.getChild().asProperty(); TypeDefinition resultPropertyType = resultProperty.getPropertyType(); boolean isReference = resultProperty.getConstraint(Reference.class).isReference(); binding.put("_isReference", isReference); if (!isReference) { boolean hasValue = resultPropertyType.getConstraint(HasValueFlag.class) .isEnabled(); binding.put("_hasValue", hasValue); } else { binding.put("_hasValue", true); } binding.put("_constraintsEvaluated", true); } } }

Target:
protected void customizeBinding(Map<String, Object> binding, Cell cell, boolean html, ServiceProvider provider, Locale locale) { binding.put("_constraintsEvaluated", false); binding.put("_hasValue", false); binding.put("_isReference", false); Entity entity = CellUtil.getFirstEntity(cell.getTarget()); if (entity != null && entity.getDefinition().getDefinition() instanceof PropertyDefinition) { PropertyDefinition resultProperty = (PropertyDefinition) entity.getDefinition() .getDefinition(); TypeDefinition resultPropertyType = resultProperty.getPropertyType(); boolean isReference = resultProperty.getConstraint(Reference.class).isReference(); binding.put("_isReference", isReference); if (isReference) { binding.put("_hasValue", true); } else { boolean hasValue = resultPropertyType.getConstraint(HasValueFlag.class).isEnabled(); binding.put("_hasValue", hasValue); } binding.put("_constraintsEvaluated", true); } }
Source:
public void startServer() throws IOException, CommandFailedException { controller.start(ManualTests.ARQUILLIAN_CONTAINER); offlineClient = ManagementClient.offline( OfflineOptions.standalone() .rootDirectory(new File(System.getProperty("user.dir"), "target/jboss-as")) .configurationFile("standalone.xml") .build()); offlineClient.apply(CONFIGURATION_BACKUP.backup()); }

Target:
public void startServer() throws IOException, CommandFailedException { offlineClient = ManagementClient.offline( OfflineOptions.standalone() .rootDirectory(new File(System.getProperty("user.dir"), "target/jboss-as")) .configurationFile("standalone.xml") .build()); offlineClient.apply(CONFIGURATION_BACKUP.backup()); controller.start(ManualTests.ARQUILLIAN_CONTAINER); }
Source:
public static SubmoduleWalk forPath(Repository repository, AnyObjectId treeId, String path) throws IOException { try (SubmoduleWalk generator = new SubmoduleWalk(repository)) { generator.setTree(treeId); PathFilter filter = PathFilter.create(path); generator.setFilter(filter); generator.setRootTree(treeId); while (generator.next()) if (filter.isDone(generator.walk)) { return generator; } return null; } catch (IOException e) { throw e; } }

Target:
public static SubmoduleWalk forPath(Repository repository, AnyObjectId treeId, String path) throws IOException { try (SubmoduleWalk generator = new SubmoduleWalk(repository)) { try { generator.setTree(treeId); PathFilter filter = PathFilter.create(path); generator.setFilter(filter); generator.setRootTree(treeId); while (generator.next()) if (filter.isDone(generator.walk)) return generator; } catch (IOException e) { generator.close(); throw e; } } return null; }
Source:
public ILaunchConfiguration[] getMappedConfigurations(IResource resource) { List<ILaunchConfiguration> configurations = new ArrayList<>(); for (ILaunchConfiguration config : getAllLaunchConfigurations()) { try { IResource[] resources = config.getMappedResources(); if(resources != null) { for (IResource resource2 : resources) { if(resource2.equals(resource)) { configurations.add(config); break; } else if (resource.getType() == IResource.PROJECT && resource2.getType() == IResource.FILE){ if (resource2.getProject().equals(resource)) { configurations.add(config); break; } } } } } catch (CoreException ce) { DebugPlugin.log(ce); } } return configurations.toArray(new ILaunchConfiguration[configurations.size()]); }

Target:
public ILaunchConfiguration[] getMappedConfigurations(IResource resource) { List<ILaunchConfiguration> configurations = new ArrayList<>(); for (ILaunchConfiguration config : getAllLaunchConfigurations()) { try { IResource[] resources = config.getMappedResources(); if(resources != null) { for (IResource res : resources) { if(res.equals(resource)) { configurations.add(config); break; } else if (resource.getType() == IResource.PROJECT && res.getType() == IResource.FILE){ if (res.getProject().equals(resource)) { configurations.add(config); break; } } } } } catch (CoreException ce) { DebugPlugin.log(ce); } } return configurations.toArray(new ILaunchConfiguration[configurations.size()]); }
Source:
public void setNewName(String newName) { this.fRenameResourceProcessor.setNewResourceName(newName); super.setForcePreview(true); super.setForceFinish(true); }

Target:
public void setNewName(String newName) { this.fRenameResourceProcessor.setNewResourceName(newName); }
Source:
protected ReviewInput createReview() { SecurityContext old = ACL.impersonate(ACL.SYSTEM); try { String message = parameterExpander.getBuildCompletedMessage(memoryImprint, listener); Collection<ReviewLabel> scoredLabels = new ArrayList<ReviewLabel>(); if (memoryImprint.getEvent().isScorable()) { if (config.isRestCodeReview()) { Integer crValue = parameterExpander.getMinimumCodeReviewValue(memoryImprint, true); if (crValue != null && crValue != Integer.MAX_VALUE) { scoredLabels.add(new ReviewLabel( LABEL_CODEREVIEW, crValue)); } } if (config.isRestVerified()) { Integer verValue = parameterExpander.getMinimumVerifiedValue(memoryImprint, true); if (verValue != null && verValue != Integer.MAX_VALUE) { scoredLabels.add(new ReviewLabel( LABEL_VERIFIED, verValue)); } } } Notify notificationLevel = parameterExpander.getHighestNotificationLevel(memoryImprint, true); List<GerritMessageProvider> gerritMessageProviders = GerritMessageProvider.all(); Collection<CommentedFile> commentedFiles = new ArrayList<CommentedFile>(); if (gerritMessageProviders != null) { for (GerritMessageProvider gerritMessageProvider : gerritMessageProviders) { for (BuildMemory.MemoryImprint.Entry e : memoryImprint.getEntries()) { try { commentedFiles.addAll(gerritMessageProvider.getFileComments(e.getBuild())); } catch (Exception ef) { listener.error(ef.getMessage()); } } } } return new ReviewInput(message, scoredLabels, commentedFiles).setNotify(notificationLevel) .setTag("jenkins-gerrit-trigger"); } finally { SecurityContextHolder.setContext(old); } }

Target:
protected ReviewInput createReview() { SecurityContext old = ACL.impersonate(ACL.SYSTEM); try { String message = parameterExpander.getBuildCompletedMessage(memoryImprint, listener); Collection<ReviewLabel> scoredLabels = new ArrayList<ReviewLabel>(); if (memoryImprint.getEvent().isScorable()) { if (config.isRestCodeReview()) { Integer crValue = parameterExpander.getMinimumCodeReviewValue(memoryImprint, true); if (crValue != null && crValue != Integer.MAX_VALUE) { scoredLabels.add(new ReviewLabel( LABEL_CODEREVIEW, crValue)); } } if (config.isRestVerified()) { Integer verValue = parameterExpander.getMinimumVerifiedValue(memoryImprint, true); if (verValue != null && verValue != Integer.MAX_VALUE) { scoredLabels.add(new ReviewLabel( LABEL_VERIFIED, verValue)); } } } Notify notificationLevel = parameterExpander.getHighestNotificationLevel(memoryImprint, true); List<GerritMessageProvider> gerritMessageProviders = GerritMessageProvider.all(); Collection<CommentedFile> commentedFiles = new ArrayList<CommentedFile>(); if (gerritMessageProviders != null) { for (GerritMessageProvider gerritMessageProvider : gerritMessageProviders) { for (BuildMemory.MemoryImprint.Entry e : memoryImprint.getEntries()) { try { commentedFiles.addAll(gerritMessageProvider.getFileComments(e.getBuild())); } catch (Exception ef) { listener.error(ef.getMessage()); } } } } return new ReviewInput(message, scoredLabels, commentedFiles).setNotify(notificationLevel) .setTag(Constants.TAG_VALUE); } finally { SecurityContextHolder.setContext(old); } }
Source:
private List<RichAttribute> getUserFacilityAttributes(PerunSession sess, Vo vo, AttributeDefinition attrDef) throws InternalErrorException, AttributeNotExistsException, WrongAttributeAssignmentException { List<RichAttribute> listOfRichAttributes = new ArrayList<>(); List<Group> groupsFromVo = getPerunBl().getGroupsManagerBl().getGroups(sess, vo); for (Group groupElement : groupsFromVo) { List<Facility> groupFacilities = getPerunBl().getFacilitiesManagerBl().getAssignedFacilities(sess, groupElement); List<Member> groupMembers = getPerunBl().getGroupsManagerBl().getGroupMembersExceptInvalid(sess, groupElement); List<User> groupUsers = new ArrayList<>(); for (Member memberElement : groupMembers) { groupUsers.add(getPerunBl().getUsersManagerBl().getUserByMember(sess, memberElement)); } for (Facility facilityElement : groupFacilities) { for (User userElement : groupUsers) { Attribute attribute = getPerunBl().getAttributesManagerBl().getAttribute(sess, facilityElement, userElement, attrDef.getName()); listOfRichAttributes.add(new RichAttribute<>(facilityElement, userElement, attribute)); } } } listOfRichAttributes = new ArrayList<>(new HashSet<>(listOfRichAttributes)); return listOfRichAttributes; }

Target:
private List<RichAttribute> getUserFacilityAttributes(PerunSession sess, Vo vo, AttributeDefinition attrDef) throws InternalErrorException, AttributeNotExistsException, WrongAttributeAssignmentException { List<RichAttribute> listOfRichAttributes = new ArrayList<>(); List<Group> groupsFromVo = getPerunBl().getGroupsManagerBl().getGroups(sess, vo); for (Group groupElement : groupsFromVo) { List<Facility> groupFacilities = getPerunBl().getFacilitiesManagerBl().getAssignedFacilities(sess, groupElement); List<Member> groupMembers = getPerunBl().getGroupsManagerBl().getGroupMembers(sess, groupElement); List<Member> allowedMembers = new ArrayList<>(); for(Member memberElement : groupMembers) { if(getPerunBl().getMembersManagerBl().isMemberAllowed(sess, memberElement)) { allowedMembers.add(memberElement); } } List<User> groupUsers = new ArrayList<>(); for (Member memberElement : allowedMembers) { groupUsers.add(getPerunBl().getUsersManagerBl().getUserByMember(sess, memberElement)); } for (Facility facilityElement : groupFacilities) { for (User userElement : groupUsers) { Attribute attribute = getPerunBl().getAttributesManagerBl().getAttribute(sess, facilityElement, userElement, attrDef.getName()); listOfRichAttributes.add(new RichAttribute<>(facilityElement, userElement, attribute)); } } } listOfRichAttributes = new ArrayList<>(new HashSet<>(listOfRichAttributes)); return listOfRichAttributes; }
Source:
private PyUDFExpression() { name = ""; outputType = Type.BLOB_TYPE; }

Target:
private PyUDFExpression()
Source:
public JcrNode addNode( String repository, String workspace, String path, String name, String primaryType ) throws RemoteException { Session session = connector().find(repository).session(workspace); try { Node parent = (Node)session.getItem(path); Node n = parent.addNode(name, primaryType); JcrNode node = new JcrNode(repository, workspace, n.getName(), n.getPath(), n.getPrimaryNodeType().getName()); node.setMixins(mixinTypes(n)); node.setProperties(getProperties(repository, workspace, path, n)); node.setPropertyDefs(propertyDefs(n)); return node; } catch (RepositoryException e) { e.printStackTrace(); throw new RemoteException(e.getMessage()); } }

Target:
public JcrNode addNode( String repository, String workspace, String path, String name, String primaryType ) throws RemoteException { Session session = connector().find(repository).session(workspace); try { Node parent = (Node)session.getItem(path); Node n = parent.addNode(name, primaryType); JcrNode node = new JcrNode(repository, workspace, n.getName(), n.getPath(), n.getPrimaryNodeType().getName()); node.setMixins(mixinTypes(n)); node.setProperties(getProperties(repository, workspace, path, n)); node.setPropertyDefs(propertyDefs(n)); return node; } catch (RepositoryException e) { logger.debug("Could not add node: " + e.getMessage()); throw new RemoteException(e.getMessage()); } }
Source:
protected void executeCommand() { Guid storageDomainId = getStorageDomainId(); StoragePoolParametersBase parameters = new StoragePoolParametersBase(getStoragePoolId()); ActionReturnValue actionReturnValue = runInternalAction(ActionType.ProcessOvfUpdateForStoragePool, parameters, getContext()); Set<Guid> proccessedDomains = actionReturnValue.getActionReturnValue(); if (actionReturnValue.getSucceeded() && proccessedDomains != null && proccessedDomains.contains(storageDomainId)) { runInternalActionWithTasksContext(ActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams()); } log.info("OVFs update was ignored - nothing to update for storage domain '{}'", storageDomainId); setSucceeded(true); }

Target:
protected void executeCommand() { Guid storageDomainId = getStorageDomainId(); StoragePoolParametersBase parameters = new StoragePoolParametersBase(getStoragePoolId()); ActionReturnValue actionReturnValue = runInternalAction(ActionType.ProcessOvfUpdateForStoragePool, parameters, getContext()); Set<Guid> proccessedDomains = actionReturnValue.getActionReturnValue(); if (actionReturnValue.getSucceeded() && proccessedDomains != null && proccessedDomains.contains(storageDomainId)) { runInternalActionWithTasksContext(ActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams()); } else { log.info("OVFs update was ignored - nothing to update for storage domain '{}'", storageDomainId); } setSucceeded(true); }
Source:
static public DecimalType deviationSince(Item item, AbstractInstant timestamp, String serviceName) { DecimalType variance = varianceSince(item, timestamp, defaultService); double deviation = Math.sqrt(variance.doubleValue()); return new DecimalType(deviation); }

Target:
static public DecimalType deviationSince(Item item, AbstractInstant timestamp, String serviceName) { DecimalType variance = varianceSince(item, timestamp, serviceName); double deviation = Math.sqrt(variance.doubleValue()); return new DecimalType(deviation); }
Source:
public void postFailure(NamingException ex, int retryCount) { super.postFailure(ex, retryCount); LOGGER.info("Retry failure: {}\n Retrying in seconds", ex.getLocalizedMessage(), getRetryInterval(retryCount) / 1000); }

Target:
public void postFailure(NamingException ex, int retryCount) { super.postFailure(ex, retryCount); LOGGER.info("Retry failure. Retrying in seconds", getRetryInterval(retryCount) / 1000, ex); }
Source:
public FormValidation doCheckExample(@QueryParameter final String example, @QueryParameter final String regexp, @QueryParameter final String script) { if (StringUtils.isNotBlank(example) && StringUtils.isNotBlank(regexp) && StringUtils.isNotBlank(script)) { FormValidation response = parseExample(script, example, regexp, containsNewline(regexp)); if (example.length() <= MAX_EXAMPLE_SIZE) { return response; } return FormValidation.aggregate(Arrays.asList(FormValidation.warning("Long examples will be truncated"), response)); } else { return FormValidation.ok(); } }

Target:
public FormValidation doCheckExample(@QueryParameter final String example, @QueryParameter final String regexp, @QueryParameter final String script) { if (StringUtils.isNotBlank(example) && StringUtils.isNotBlank(regexp) && StringUtils.isNotBlank(script)) { FormValidation response = parseExample(script, example, regexp, containsNewline(regexp)); if (example.length() <= MAX_EXAMPLE_SIZE) { return response; } return FormValidation.aggregate(Arrays.asList(FormValidation.warning(Messages.GroovyParser_long_examples_will_be_truncated()), response)); } else { return FormValidation.ok(); } }
Source:
public void test_getListBlobItemDruidFactory_canCreateListBlobItemDruid() { final Properties props = new Properties(); props.put("druid.azure.account", AZURE_ACCOUNT_NAME); props.put("druid.azure.key", AZURE_ACCOUNT_KEY); props.put("druid.azure.container", AZURE_CONTAINER); injector = makeInjectorWithProperties(props); ListBlobItemHolderFactory factory = injector.getInstance(ListBlobItemHolderFactory.class); ListBlobItemHolder object1 = factory.create(blobItem1); ListBlobItemHolder object2 = factory.create(blobItem2); Assert.assertNotNull(object1); Assert.assertNotNull(object2); Assert.assertNotSame(object1, object2); }

Target:
public void test_getListBlobItemDruidFactory_canCreateListBlobItemDruid() { injector = makeInjectorWithProperties(PROPERTIES); ListBlobItemHolderFactory factory = injector.getInstance(ListBlobItemHolderFactory.class); ListBlobItemHolder object1 = factory.create(blobItem1); ListBlobItemHolder object2 = factory.create(blobItem2); Assert.assertNotNull(object1); Assert.assertNotNull(object2); Assert.assertNotSame(object1, object2); }
Source:
protected Image getDecorationImage(EditPart editPart) { if (isBroken(editPart)) { return WorkspaceImageFigure.flyWeightImage("/org.eclipse.sirius.diagram.ui/icons/delete.gif"); } else { return DiagramUIPlugin.getPlugin().getImage(SiriusEditPlugin.Implementation.getBundledImageDescriptor("icons/full/decorator/permission_denied.gif")); } }

Target:
protected Image getDecorationImage(EditPart editPart) { if (isBroken(editPart)) { return DiagramUIPlugin.getPlugin().getImage(DiagramUIPlugin.Implementation.getBundledImageDescriptor(DiagramImagesPath.DELETE_FROM_DIAGRAM_ICON)); } else { return DiagramUIPlugin.getPlugin().getImage(SiriusEditPlugin.Implementation.getBundledImageDescriptor("icons/full/decorator/permission_denied.gif")); } }
Source:
public Object setArg(String key, Object value) { Object oldVal = allArgs.put(key, value); allArgsReadOnly = Collections.unmodifiableMap(allArgs); return oldVal; }

Target:
public Object setArg(String key, Object value) { return allArgs.put(key, value); }
Source:
public void locatorLauncherUsesSpecifiedConfigFileWithGeodePlugins() throws Exception { ProcessBuilder processBuilder = new ProcessBuilder() .redirectErrorStream(true) .redirectOutput(stdoutFile.toFile()) .directory(temporaryFolder.getRoot()) .command("java", "-Dgemfire.http-service-port=" + httpServicePort, "-Dgemfire.jmx-manager-start=true", "-Djava.awt.headless=true", "-Dlog4j.configurationFile=" + configWithGeodePluginsFile.toAbsolutePath(), "-cp", geodeDependencies.toFile().getAbsolutePath(), "org.apache.geode.distributed.LocatorLauncher", "start", LOCATOR_NAME, "--port", String.valueOf(locatorPort)); System.out.println("Launching command: " + processBuilder.command()); locator = processBuilder .start(); assertThat(locator.isAlive()).isTrue(); await().untilAsserted(() -> { assertThat(locatorLogFile) .doesNotExist(); assertThat(pulseLogFile) .doesNotExist(); LogFileAssert.assertThat(stdoutFile.toFile()) .exists() .contains("Located war: geode-pulse") .contains("Adding webapp /pulse") .contains("Starting server location for Distribution Locator") .doesNotContain("geode-pulse war file was not found") .doesNotContain("java.lang.IllegalStateException: No factory method found for class"); }); }

Target:
public void locatorLauncherUsesSpecifiedConfigFileWithGeodePlugins() throws Exception { ProcessBuilder processBuilder = new ProcessBuilder() .redirectErrorStream(true) .redirectOutput(stdoutFile.toFile()) .directory(temporaryFolder.getRoot()) .command(javaBin.toFile().getAbsolutePath(), "-Dgemfire.http-service-port=" + httpServicePort, "-Dgemfire.jmx-manager-start=true", "-Djava.awt.headless=true", "-Dlog4j.configurationFile=" + configWithGeodePluginsFile.toAbsolutePath(), "-cp", geodeDependencies.toFile().getAbsolutePath(), "org.apache.geode.distributed.LocatorLauncher", "start", LOCATOR_NAME, "--port", String.valueOf(locatorPort)); System.out.println("Environment: " + System.getenv()); System.out.println("Launching command: " + processBuilder.command()); locator = processBuilder .start(); assertThat(locator.isAlive()).isTrue(); await().untilAsserted(() -> { assertThat(locatorLogFile) .as(locatorLogFile.toFile().getAbsolutePath()) .doesNotExist(); assertThat(pulseLogFile) .as(pulseLogFile.toFile().getAbsolutePath()) .doesNotExist(); LogFileAssert.assertThat(stdoutFile.toFile()) .as(stdoutFile.toFile().getAbsolutePath()) .exists() .contains("Located war: geode-pulse") .contains("Adding webapp /pulse") .contains("Starting server location for Distribution Locator") .doesNotContain("geode-pulse war file was not found") .doesNotContain("java.lang.IllegalStateException: No factory method found for class"); }); }
Source:
private boolean isTaskCompleted( ScheduledTask<?> task ) { return !task.getTaskState().isActiveOrSubmitted(); }

Target:
private boolean isTaskCompleted( ScheduledTask<?> task ) { return TaskState.WAITING.equals( task.getTaskState() ) || TaskState.FINISHED.equals( task.getTaskState() ) || TaskState.BROKEN.equals( task.getTaskState() ) || TaskState.CANCELLED.equals( task.getTaskState() ); }
Source:
public double pvbp(KnownAmountPaymentPeriod period, RatesProvider provider) { return 0; }

Target:
public double pvbp(KnownAmountPaymentPeriod period, RatesProvider provider) { throw new UnsupportedOperationException("Unable to calculate PVBP for KnownAmountPaymentPeriod"); }
Source:
public void install(File artifact) throws Exception { LOGGER.debug("ConnectorDeployer.install(\"{}\")", artifact.getAbsolutePath()); ConnectorFile configFile = oldConfigs.get(artifact); Dictionary<String, Object> properties = new Hashtable<String, Object>(configFile.getProperties()); if (properties.get(Constants.SERVICE_RANKING) == null && ConnectorFile.isRootService(artifact)) { properties.put(Constants.SERVICE_RANKING, "-1"); } LOGGER.info("Loading instance {}", configFile.getConnectorId()); authenticate(AUTH_USER, AUTH_PASSWORD); serviceManager.create(configFile.getConnectorId(), new ConnectorDescription(configFile.getAttributes(), properties)); }

Target:
public void install(File artifact) throws Exception { LOGGER.debug("ConnectorDeployer.install(\"{}\")", artifact.getAbsolutePath()); ConnectorFile configFile = oldConfigs.get(artifact); Dictionary<String, Object> properties = new Hashtable<String, Object>(configFile.getProperties()); if (properties.get(Constants.SERVICE_RANKING) == null && ConnectorFile.isRootService(artifact)) { properties.put(Constants.SERVICE_RANKING, "-1"); } LOGGER.info("Loading instance {}", configFile.getConnectorId()); login(); try { serviceManager.create(configFile.getConnectorId(), new ConnectorDescription(configFile.getAttributes(), properties)); } finally { logout(); } }