code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { protected ExecutionEntity findFirstParentScopeExecution(ExecutionEntity executionEntity) { ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager(); ExecutionEntity parentScopeExecution = null; ExecutionEntity currentlyExaminedExecution = executionEntityManager.findById(executionEntity.getParentId()); while (currentlyExaminedExecution != null && parentScopeExecution == null) { if (currentlyExaminedExecution.isScope()) { parentScopeExecution = currentlyExaminedExecution; } else { currentlyExaminedExecution = executionEntityManager.findById(currentlyExaminedExecution.getParentId()); } } return parentScopeExecution; } }
public class class_name { protected ExecutionEntity findFirstParentScopeExecution(ExecutionEntity executionEntity) { ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager(); ExecutionEntity parentScopeExecution = null; ExecutionEntity currentlyExaminedExecution = executionEntityManager.findById(executionEntity.getParentId()); while (currentlyExaminedExecution != null && parentScopeExecution == null) { if (currentlyExaminedExecution.isScope()) { parentScopeExecution = currentlyExaminedExecution; // depends on control dependency: [if], data = [none] } else { currentlyExaminedExecution = executionEntityManager.findById(currentlyExaminedExecution.getParentId()); // depends on control dependency: [if], data = [none] } } return parentScopeExecution; } }
public class class_name { public static void closeStreams(Process self) { try { self.getErrorStream().close(); } catch (IOException ignore) {} try { self.getInputStream().close(); } catch (IOException ignore) {} try { self.getOutputStream().close(); } catch (IOException ignore) {} } }
public class class_name { public static void closeStreams(Process self) { try { self.getErrorStream().close(); } catch (IOException ignore) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] try { self.getInputStream().close(); } catch (IOException ignore) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] try { self.getOutputStream().close(); } catch (IOException ignore) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] } }
public class class_name { protected void onBitmapNotAvailable(int position) { BitmapCache bc = cachedBitmaps.get(position); if (bc != null) { bc.status = SlideStatus.NOT_AVAILABLE; bc.bitmap = null; } } }
public class class_name { protected void onBitmapNotAvailable(int position) { BitmapCache bc = cachedBitmaps.get(position); if (bc != null) { bc.status = SlideStatus.NOT_AVAILABLE; // depends on control dependency: [if], data = [none] bc.bitmap = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public EClass getIfcRelConnectsPortToElement() { if (ifcRelConnectsPortToElementEClass == null) { ifcRelConnectsPortToElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(536); } return ifcRelConnectsPortToElementEClass; } }
public class class_name { @Override public EClass getIfcRelConnectsPortToElement() { if (ifcRelConnectsPortToElementEClass == null) { ifcRelConnectsPortToElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(536); // depends on control dependency: [if], data = [none] } return ifcRelConnectsPortToElementEClass; } }
public class class_name { static int measureChildForCells(View child, int cellSize, int cellsRemaining, int parentHeightMeasureSpec, int parentHeightPadding) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); final int childHeightSize = MeasureSpec.getSize(parentHeightMeasureSpec) - parentHeightPadding; final int childHeightMode = MeasureSpec.getMode(parentHeightMeasureSpec); final int childHeightSpec = MeasureSpec.makeMeasureSpec(childHeightSize, childHeightMode); int cellsUsed = 0; if (cellsRemaining > 0) { final int childWidthSpec = MeasureSpec.makeMeasureSpec( cellSize * cellsRemaining, MeasureSpec.AT_MOST); child.measure(childWidthSpec, childHeightSpec); final int measuredWidth = child.getMeasuredWidth(); cellsUsed = measuredWidth / cellSize; if (measuredWidth % cellSize != 0) cellsUsed++; } final ActionMenuItemView itemView = child instanceof ActionMenuItemView ? (ActionMenuItemView) child : null; final boolean expandable = !lp.isOverflowButton && itemView != null && itemView.hasText(); lp.expandable = expandable; lp.cellsUsed = cellsUsed; final int targetWidth = cellsUsed * cellSize; child.measure(MeasureSpec.makeMeasureSpec(targetWidth, MeasureSpec.EXACTLY), childHeightSpec); return cellsUsed; } }
public class class_name { static int measureChildForCells(View child, int cellSize, int cellsRemaining, int parentHeightMeasureSpec, int parentHeightPadding) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); final int childHeightSize = MeasureSpec.getSize(parentHeightMeasureSpec) - parentHeightPadding; final int childHeightMode = MeasureSpec.getMode(parentHeightMeasureSpec); final int childHeightSpec = MeasureSpec.makeMeasureSpec(childHeightSize, childHeightMode); int cellsUsed = 0; if (cellsRemaining > 0) { final int childWidthSpec = MeasureSpec.makeMeasureSpec( cellSize * cellsRemaining, MeasureSpec.AT_MOST); child.measure(childWidthSpec, childHeightSpec); // depends on control dependency: [if], data = [none] final int measuredWidth = child.getMeasuredWidth(); cellsUsed = measuredWidth / cellSize; // depends on control dependency: [if], data = [none] if (measuredWidth % cellSize != 0) cellsUsed++; } final ActionMenuItemView itemView = child instanceof ActionMenuItemView ? (ActionMenuItemView) child : null; final boolean expandable = !lp.isOverflowButton && itemView != null && itemView.hasText(); lp.expandable = expandable; lp.cellsUsed = cellsUsed; final int targetWidth = cellsUsed * cellSize; child.measure(MeasureSpec.makeMeasureSpec(targetWidth, MeasureSpec.EXACTLY), childHeightSpec); return cellsUsed; } }
public class class_name { public static Class<?> determineCommonAncestor(Class<?> clazz1, Class<?> clazz2) { if (clazz1 == null) { return clazz2; } if (clazz2 == null) { return clazz1; } if (clazz1.isAssignableFrom(clazz2)) { return clazz1; } if (clazz2.isAssignableFrom(clazz1)) { return clazz2; } Class<?> ancestor = clazz1; do { ancestor = ancestor.getSuperclass(); if (ancestor == null || Object.class.equals(ancestor)) { return null; } } while (!ancestor.isAssignableFrom(clazz2)); return ancestor; } }
public class class_name { public static Class<?> determineCommonAncestor(Class<?> clazz1, Class<?> clazz2) { if (clazz1 == null) { return clazz2; } if (clazz2 == null) { return clazz1; } if (clazz1.isAssignableFrom(clazz2)) { return clazz1; } if (clazz2.isAssignableFrom(clazz1)) { return clazz2; } Class<?> ancestor = clazz1; do { ancestor = ancestor.getSuperclass(); if (ancestor == null || Object.class.equals(ancestor)) { return null; // depends on control dependency: [if], data = [none] } } while (!ancestor.isAssignableFrom(clazz2)); return ancestor; } }
public class class_name { @SuppressWarnings("NewApi") public URL[] getLocalArtifactUrls(DependencyJar... dependencies) { DependenciesTask dependenciesTask = createDependenciesTask(); configureMaven(dependenciesTask); RemoteRepository remoteRepository = new RemoteRepository(); remoteRepository.setUrl(repositoryUrl); remoteRepository.setId(repositoryId); if (repositoryUserName != null || repositoryPassword != null) { Authentication authentication = new Authentication(); authentication.setUserName(repositoryUserName); authentication.setPassword(repositoryPassword); remoteRepository.addAuthentication(authentication); } dependenciesTask.addConfiguredRemoteRepository(remoteRepository); final Project project = new Project(); dependenciesTask.setProject(project); for (DependencyJar dependencyJar : dependencies) { Dependency dependency = new Dependency(); dependency.setArtifactId(dependencyJar.getArtifactId()); dependency.setGroupId(dependencyJar.getGroupId()); dependency.setType(dependencyJar.getType()); dependency.setVersion(dependencyJar.getVersion()); if (dependencyJar.getClassifier() != null) { dependency.setClassifier(dependencyJar.getClassifier()); } dependenciesTask.addDependency(dependency); } whileLocked(dependenciesTask::execute); @SuppressWarnings("unchecked") Hashtable<String, String> artifacts = project.getProperties(); URL[] urls = new URL[dependencies.length]; for (int i = 0; i < urls.length; i++) { try { urls[i] = Paths.get(artifacts.get(key(dependencies[i]))).toUri().toURL(); } catch (MalformedURLException e) { throw new RuntimeException(e); } } return urls; } }
public class class_name { @SuppressWarnings("NewApi") public URL[] getLocalArtifactUrls(DependencyJar... dependencies) { DependenciesTask dependenciesTask = createDependenciesTask(); configureMaven(dependenciesTask); RemoteRepository remoteRepository = new RemoteRepository(); remoteRepository.setUrl(repositoryUrl); remoteRepository.setId(repositoryId); if (repositoryUserName != null || repositoryPassword != null) { Authentication authentication = new Authentication(); authentication.setUserName(repositoryUserName); // depends on control dependency: [if], data = [(repositoryUserName] authentication.setPassword(repositoryPassword); // depends on control dependency: [if], data = [none] remoteRepository.addAuthentication(authentication); // depends on control dependency: [if], data = [none] } dependenciesTask.addConfiguredRemoteRepository(remoteRepository); final Project project = new Project(); dependenciesTask.setProject(project); for (DependencyJar dependencyJar : dependencies) { Dependency dependency = new Dependency(); dependency.setArtifactId(dependencyJar.getArtifactId()); // depends on control dependency: [for], data = [dependencyJar] dependency.setGroupId(dependencyJar.getGroupId()); // depends on control dependency: [for], data = [dependencyJar] dependency.setType(dependencyJar.getType()); // depends on control dependency: [for], data = [dependencyJar] dependency.setVersion(dependencyJar.getVersion()); // depends on control dependency: [for], data = [dependencyJar] if (dependencyJar.getClassifier() != null) { dependency.setClassifier(dependencyJar.getClassifier()); // depends on control dependency: [if], data = [(dependencyJar.getClassifier()] } dependenciesTask.addDependency(dependency); // depends on control dependency: [for], data = [none] } whileLocked(dependenciesTask::execute); @SuppressWarnings("unchecked") Hashtable<String, String> artifacts = project.getProperties(); URL[] urls = new URL[dependencies.length]; for (int i = 0; i < urls.length; i++) { try { urls[i] = Paths.get(artifacts.get(key(dependencies[i]))).toUri().toURL(); // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } return urls; } }
public class class_name { static Person PromptForAddress(BufferedReader stdin, PrintStream stdout) throws IOException { Person.Builder person = Person.newBuilder(); stdout.print("Enter person ID: "); person.setId(Integer.valueOf(stdin.readLine())); stdout.print("Enter name: "); person.setName(stdin.readLine()); stdout.print("Enter email address (blank for none): "); String email = stdin.readLine(); if (email.length() > 0) { person.setEmail(email); } while (true) { stdout.print("Enter a phone number (or leave blank to finish): "); String number = stdin.readLine(); if (number.length() == 0) { break; } Person.PhoneNumber.Builder phoneNumber = Person.PhoneNumber.newBuilder().setNumber(number); stdout.print("Is this a mobile, home, or work phone? "); String type = stdin.readLine(); if (type.equals("mobile")) { phoneNumber.setType(Person.PhoneType.MOBILE); } else if (type.equals("home")) { phoneNumber.setType(Person.PhoneType.HOME); } else if (type.equals("work")) { phoneNumber.setType(Person.PhoneType.WORK); } else { stdout.println("Unknown phone type. Using default."); } person.addPhones(phoneNumber); } return person.build(); } }
public class class_name { static Person PromptForAddress(BufferedReader stdin, PrintStream stdout) throws IOException { Person.Builder person = Person.newBuilder(); stdout.print("Enter person ID: "); person.setId(Integer.valueOf(stdin.readLine())); stdout.print("Enter name: "); person.setName(stdin.readLine()); stdout.print("Enter email address (blank for none): "); String email = stdin.readLine(); if (email.length() > 0) { person.setEmail(email); } while (true) { stdout.print("Enter a phone number (or leave blank to finish): "); String number = stdin.readLine(); if (number.length() == 0) { break; } Person.PhoneNumber.Builder phoneNumber = Person.PhoneNumber.newBuilder().setNumber(number); stdout.print("Is this a mobile, home, or work phone? "); String type = stdin.readLine(); if (type.equals("mobile")) { phoneNumber.setType(Person.PhoneType.MOBILE); // depends on control dependency: [if], data = [none] } else if (type.equals("home")) { phoneNumber.setType(Person.PhoneType.HOME); // depends on control dependency: [if], data = [none] } else if (type.equals("work")) { phoneNumber.setType(Person.PhoneType.WORK); // depends on control dependency: [if], data = [none] } else { stdout.println("Unknown phone type. Using default."); // depends on control dependency: [if], data = [none] } person.addPhones(phoneNumber); } return person.build(); } }
public class class_name { private void indexCertificate(X509Certificate cert) { X500Principal subject = cert.getSubjectX500Principal(); Object oldEntry = certSubjects.put(subject, cert); if (oldEntry != null) { // assume this is unlikely if (oldEntry instanceof X509Certificate) { if (cert.equals(oldEntry)) { return; } List<X509Certificate> list = new ArrayList<>(2); list.add(cert); list.add((X509Certificate)oldEntry); certSubjects.put(subject, list); } else { @SuppressWarnings("unchecked") // See certSubjects javadoc. List<X509Certificate> list = (List<X509Certificate>)oldEntry; if (list.contains(cert) == false) { list.add(cert); } certSubjects.put(subject, list); } } } }
public class class_name { private void indexCertificate(X509Certificate cert) { X500Principal subject = cert.getSubjectX500Principal(); Object oldEntry = certSubjects.put(subject, cert); if (oldEntry != null) { // assume this is unlikely if (oldEntry instanceof X509Certificate) { if (cert.equals(oldEntry)) { return; // depends on control dependency: [if], data = [none] } List<X509Certificate> list = new ArrayList<>(2); list.add(cert); // depends on control dependency: [if], data = [none] list.add((X509Certificate)oldEntry); // depends on control dependency: [if], data = [none] certSubjects.put(subject, list); // depends on control dependency: [if], data = [none] } else { @SuppressWarnings("unchecked") // See certSubjects javadoc. List<X509Certificate> list = (List<X509Certificate>)oldEntry; if (list.contains(cert) == false) { list.add(cert); // depends on control dependency: [if], data = [none] } certSubjects.put(subject, list); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void setOldWebAppUrl(String webAppUrl) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_SET_OLD_WEBAPP_URL_1, webAppUrl)); } m_webAppUrl = webAppUrl; } }
public class class_name { public void setOldWebAppUrl(String webAppUrl) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_SET_OLD_WEBAPP_URL_1, webAppUrl)); // depends on control dependency: [if], data = [none] } m_webAppUrl = webAppUrl; } }
public class class_name { public void marshall(UpdateVolumeRequest updateVolumeRequest, ProtocolMarshaller protocolMarshaller) { if (updateVolumeRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateVolumeRequest.getVolumeId(), VOLUMEID_BINDING); protocolMarshaller.marshall(updateVolumeRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(updateVolumeRequest.getMountPoint(), MOUNTPOINT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateVolumeRequest updateVolumeRequest, ProtocolMarshaller protocolMarshaller) { if (updateVolumeRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateVolumeRequest.getVolumeId(), VOLUMEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateVolumeRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateVolumeRequest.getMountPoint(), MOUNTPOINT_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Q forShare(boolean fallbackToForUpdate) { SQLTemplates sqlTemplates = configuration.getTemplates(); if (sqlTemplates.isForShareSupported()) { QueryFlag forShareFlag = sqlTemplates.getForShareFlag(); return addFlag(forShareFlag); } if (fallbackToForUpdate) { return forUpdate(); } throw new QueryException("Using forShare() is not supported"); } }
public class class_name { public Q forShare(boolean fallbackToForUpdate) { SQLTemplates sqlTemplates = configuration.getTemplates(); if (sqlTemplates.isForShareSupported()) { QueryFlag forShareFlag = sqlTemplates.getForShareFlag(); return addFlag(forShareFlag); // depends on control dependency: [if], data = [none] } if (fallbackToForUpdate) { return forUpdate(); // depends on control dependency: [if], data = [none] } throw new QueryException("Using forShare() is not supported"); } }
public class class_name { public Message createMessage(String strTrxID) { if (this.getMessageLog(strTrxID) != null) { BaseMessageHeader messageHeader = this.createMessageHeader(); MessageRecordDesc messageData = (MessageRecordDesc)this.createMessageData(); return this.createMessage(messageHeader, messageData); } return null; } }
public class class_name { public Message createMessage(String strTrxID) { if (this.getMessageLog(strTrxID) != null) { BaseMessageHeader messageHeader = this.createMessageHeader(); MessageRecordDesc messageData = (MessageRecordDesc)this.createMessageData(); return this.createMessage(messageHeader, messageData); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private static Class findJavadocClass(java.lang.Class<?> cls, List<Root> dRoots) { final String name = cls.getName().replace('$', '.'); for (Root dRoot : dRoots) { for (Package dPackage : dRoot.getPackage()) { for (Class dClass : dPackage.getClazz()) { if (dClass.getQualified().equals(name)) { return dClass; } } } } return null; } }
public class class_name { private static Class findJavadocClass(java.lang.Class<?> cls, List<Root> dRoots) { final String name = cls.getName().replace('$', '.'); for (Root dRoot : dRoots) { for (Package dPackage : dRoot.getPackage()) { for (Class dClass : dPackage.getClazz()) { if (dClass.getQualified().equals(name)) { return dClass; // depends on control dependency: [if], data = [none] } } } } return null; } }
public class class_name { public String value() { Label lab = label(); if (lab == null) { return null; } return lab.value(); } }
public class class_name { public String value() { Label lab = label(); if (lab == null) { return null; // depends on control dependency: [if], data = [none] } return lab.value(); } }
public class class_name { public static String byteArrayToHexString(byte[] bytes, String prefix, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { sb.append(String.format("%s%02x", prefix, bytes[i])); if (i != bytes.length - 1) { sb.append(separator); } } return sb.toString(); } }
public class class_name { public static String byteArrayToHexString(byte[] bytes, String prefix, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { sb.append(String.format("%s%02x", prefix, bytes[i])); // depends on control dependency: [for], data = [i] if (i != bytes.length - 1) { sb.append(separator); // depends on control dependency: [if], data = [none] } } return sb.toString(); } }
public class class_name { @Override public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException { context.startSubsystemElement(InfinispanSchema.CURRENT.getNamespaceUri(), false); ModelNode model = context.getModelNode(); if (model.isDefined()) { for (Property entry: model.get(ModelKeys.CACHE_CONTAINER).asPropertyList()) { String containerName = entry.getName(); ModelNode container = entry.getValue(); writer.writeStartElement(Element.CACHE_CONTAINER.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), containerName); // AS7-3488 make default-cache a non required attribute // this.writeRequired(writer, Attribute.DEFAULT_CACHE, container, ModelKeys.DEFAULT_CACHE); this.writeListAsAttribute(writer, Attribute.ALIASES, container, ModelKeys.ALIASES); this.writeOptional(writer, Attribute.DEFAULT_CACHE, container, ModelKeys.DEFAULT_CACHE); this.writeOptional(writer, Attribute.JNDI_NAME, container, ModelKeys.JNDI_NAME); this.writeOptional(writer, Attribute.START, container, ModelKeys.START); this.writeOptional(writer, Attribute.MODULE, container, ModelKeys.MODULE); this.writeOptional(writer, Attribute.STATISTICS, container, ModelKeys.STATISTICS); if (container.hasDefined(ModelKeys.TRANSPORT)) { writer.writeStartElement(Element.TRANSPORT.getLocalName()); ModelNode transport = container.get(ModelKeys.TRANSPORT, ModelKeys.TRANSPORT_NAME); this.writeOptional(writer, Attribute.CHANNEL, transport, ModelKeys.CHANNEL); this.writeOptional(writer, Attribute.LOCK_TIMEOUT, transport, ModelKeys.LOCK_TIMEOUT); this.writeOptional(writer, Attribute.STRICT_PEER_TO_PEER, transport, ModelKeys.STRICT_PEER_TO_PEER); this.writeOptional(writer, Attribute.INITIAL_CLUSTER_SIZE, transport, ModelKeys.INITIAL_CLUSTER_SIZE); this.writeOptional(writer, Attribute.INITIAL_CLUSTER_TIMEOUT, transport, ModelKeys.INITIAL_CLUSTER_TIMEOUT); writer.writeEndElement(); } if (container.hasDefined(ModelKeys.SECURITY)) { writer.writeStartElement(Element.SECURITY.getLocalName()); ModelNode security = container.get(ModelKeys.SECURITY, ModelKeys.SECURITY_NAME); if (security.hasDefined(ModelKeys.AUTHORIZATION)) { writer.writeStartElement(Element.AUTHORIZATION.getLocalName()); ModelNode authorization = security.get(ModelKeys.AUTHORIZATION, ModelKeys.AUTHORIZATION_NAME); if (authorization.hasDefined(ModelKeys.MAPPER)) { String mapper = authorization.get(ModelKeys.MAPPER).asString(); if (CommonNameRoleMapper.class.getName().equals(mapper)) { writer.writeEmptyElement(Element.COMMON_NAME_ROLE_MAPPER.getLocalName()); } else if (ClusterRoleMapper.class.getName().equals(mapper)) { writer.writeEmptyElement(Element.CLUSTER_ROLE_MAPPER.getLocalName()); } else if (IdentityRoleMapper.class.getName().equals(mapper)) { writer.writeEmptyElement(Element.IDENTITY_ROLE_MAPPER.getLocalName()); } else { writer.writeStartElement(Element.CUSTOM_ROLE_MAPPER.getLocalName()); writer.writeAttribute(Attribute.CLASS.getLocalName(), mapper); writer.writeEndElement(); } } ModelNode roles = authorization.get(ModelKeys.ROLE); if (roles.isDefined()) { for (ModelNode roleNode : roles.asList()) { ModelNode role = roleNode.get(0); writer.writeStartElement(Element.ROLE.getLocalName()); AuthorizationRoleResource.NAME.marshallAsAttribute(role, writer); this.writeListAsAttribute(writer, Attribute.PERMISSIONS, role, ModelKeys.PERMISSIONS); writer.writeEndElement(); } } writer.writeEndElement(); } writer.writeEndElement(); } if (container.hasDefined(ModelKeys.GLOBAL_STATE)) { writer.writeStartElement(Element.GLOBAL_STATE.getLocalName()); ModelNode globalState = container.get(ModelKeys.GLOBAL_STATE, ModelKeys.GLOBAL_STATE_NAME); writeStatePathElement(Element.PERSISTENT_LOCATION, ModelKeys.PERSISTENT_LOCATION, writer, globalState); writeStatePathElement(Element.SHARED_PERSISTENT_LOCATION, ModelKeys.SHARED_PERSISTENT_LOCATION, writer, globalState); writeStatePathElement(Element.TEMPORARY_LOCATION, ModelKeys.TEMPORARY_LOCATION, writer, globalState); if (globalState.hasDefined(ModelKeys.CONFIGURATION_STORAGE)) { ConfigurationStorage configurationStorage = ConfigurationStorage.valueOf(globalState.get(ModelKeys.CONFIGURATION_STORAGE).asString()); switch (configurationStorage) { case IMMUTABLE: writer.writeEmptyElement(Element.IMMUTABLE_CONFIGURATION_STORAGE.getLocalName()); break; case VOLATILE: writer.writeEmptyElement(Element.VOLATILE_CONFIGURATION_STORAGE.getLocalName()); break; case OVERLAY: writer.writeEmptyElement(Element.OVERLAY_CONFIGURATION_STORAGE.getLocalName()); break; case MANAGED: writer.writeEmptyElement(Element.MANAGED_CONFIGURATION_STORAGE.getLocalName()); break; case CUSTOM: writer.writeStartElement(Element.CUSTOM_CONFIGURATION_STORAGE.getLocalName()); writer.writeAttribute(Attribute.CLASS.getLocalName(), globalState.get(ModelKeys.CONFIGURATION_STORAGE_CLASS).asString()); writer.writeEndElement(); break; } } writer.writeEndElement(); } // write any configured thread pools if (container.hasDefined(ThreadPoolResource.WILDCARD_PATH.getKey())) { writeThreadPoolElements(Element.ASYNC_OPERATIONS_THREAD_POOL, ThreadPoolResource.ASYNC_OPERATIONS, writer, container); writeScheduledThreadPoolElements(Element.EXPIRATION_THREAD_POOL, ScheduledThreadPoolResource.EXPIRATION, writer, container); writeThreadPoolElements(Element.LISTENER_THREAD_POOL, ThreadPoolResource.LISTENER, writer, container); writeScheduledThreadPoolElements(Element.PERSISTENCE_THREAD_POOL, ScheduledThreadPoolResource.PERSISTENCE, writer, container); writeThreadPoolElements(Element.REMOTE_COMMAND_THREAD_POOL, ThreadPoolResource.REMOTE_COMMAND, writer, container); writeScheduledThreadPoolElements(Element.REPLICATION_QUEUE_THREAD_POOL, ScheduledThreadPoolResource.REPLICATION_QUEUE, writer, container); writeThreadPoolElements(Element.STATE_TRANSFER_THREAD_POOL, ThreadPoolResource.STATE_TRANSFER, writer, container); writeThreadPoolElements(Element.TRANSPORT_THREAD_POOL, ThreadPoolResource.TRANSPORT, writer, container); } // write modules if (container.hasDefined(ModelKeys.MODULES)) { writer.writeStartElement(Element.MODULES.getLocalName()); ModelNode modules = container.get(ModelKeys.MODULES, ModelKeys.MODULES_NAME, ModelKeys.MODULE); for (ModelNode moduleNode : modules.asList()) { if (moduleNode.isDefined()) { ModelNode modelNode = moduleNode.get(0); writer.writeStartElement(Element.MODULE.getLocalName()); writeAttribute(writer, modelNode, CacheContainerModuleResource.NAME); if (modelNode.hasDefined(ModelKeys.SLOT)) { writeAttribute(writer, modelNode, CacheContainerModuleResource.SLOT); } writer.writeEndElement(); } } writer.writeEndElement(); } ModelNode configurations = container.get(ModelKeys.CONFIGURATIONS, ModelKeys.CONFIGURATIONS_NAME); // write any existent cache types processCacheConfiguration(writer, container, configurations, ModelKeys.LOCAL_CACHE); processCacheConfiguration(writer, container, configurations, ModelKeys.INVALIDATION_CACHE); processCacheConfiguration(writer, container, configurations, ModelKeys.REPLICATED_CACHE); processCacheConfiguration(writer, container, configurations, ModelKeys.DISTRIBUTED_CACHE); // counters processCounterConfigurations(writer, container); writer.writeEndElement(); } } writer.writeEndElement(); } }
public class class_name { @Override public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException { context.startSubsystemElement(InfinispanSchema.CURRENT.getNamespaceUri(), false); ModelNode model = context.getModelNode(); if (model.isDefined()) { for (Property entry: model.get(ModelKeys.CACHE_CONTAINER).asPropertyList()) { String containerName = entry.getName(); ModelNode container = entry.getValue(); writer.writeStartElement(Element.CACHE_CONTAINER.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), containerName); // AS7-3488 make default-cache a non required attribute // this.writeRequired(writer, Attribute.DEFAULT_CACHE, container, ModelKeys.DEFAULT_CACHE); this.writeListAsAttribute(writer, Attribute.ALIASES, container, ModelKeys.ALIASES); this.writeOptional(writer, Attribute.DEFAULT_CACHE, container, ModelKeys.DEFAULT_CACHE); this.writeOptional(writer, Attribute.JNDI_NAME, container, ModelKeys.JNDI_NAME); this.writeOptional(writer, Attribute.START, container, ModelKeys.START); this.writeOptional(writer, Attribute.MODULE, container, ModelKeys.MODULE); this.writeOptional(writer, Attribute.STATISTICS, container, ModelKeys.STATISTICS); if (container.hasDefined(ModelKeys.TRANSPORT)) { writer.writeStartElement(Element.TRANSPORT.getLocalName()); // depends on control dependency: [if], data = [none] ModelNode transport = container.get(ModelKeys.TRANSPORT, ModelKeys.TRANSPORT_NAME); this.writeOptional(writer, Attribute.CHANNEL, transport, ModelKeys.CHANNEL); // depends on control dependency: [if], data = [none] this.writeOptional(writer, Attribute.LOCK_TIMEOUT, transport, ModelKeys.LOCK_TIMEOUT); // depends on control dependency: [if], data = [none] this.writeOptional(writer, Attribute.STRICT_PEER_TO_PEER, transport, ModelKeys.STRICT_PEER_TO_PEER); // depends on control dependency: [if], data = [none] this.writeOptional(writer, Attribute.INITIAL_CLUSTER_SIZE, transport, ModelKeys.INITIAL_CLUSTER_SIZE); // depends on control dependency: [if], data = [none] this.writeOptional(writer, Attribute.INITIAL_CLUSTER_TIMEOUT, transport, ModelKeys.INITIAL_CLUSTER_TIMEOUT); // depends on control dependency: [if], data = [none] writer.writeEndElement(); // depends on control dependency: [if], data = [none] } if (container.hasDefined(ModelKeys.SECURITY)) { writer.writeStartElement(Element.SECURITY.getLocalName()); // depends on control dependency: [if], data = [none] ModelNode security = container.get(ModelKeys.SECURITY, ModelKeys.SECURITY_NAME); if (security.hasDefined(ModelKeys.AUTHORIZATION)) { writer.writeStartElement(Element.AUTHORIZATION.getLocalName()); // depends on control dependency: [if], data = [none] ModelNode authorization = security.get(ModelKeys.AUTHORIZATION, ModelKeys.AUTHORIZATION_NAME); if (authorization.hasDefined(ModelKeys.MAPPER)) { String mapper = authorization.get(ModelKeys.MAPPER).asString(); if (CommonNameRoleMapper.class.getName().equals(mapper)) { writer.writeEmptyElement(Element.COMMON_NAME_ROLE_MAPPER.getLocalName()); // depends on control dependency: [if], data = [none] } else if (ClusterRoleMapper.class.getName().equals(mapper)) { writer.writeEmptyElement(Element.CLUSTER_ROLE_MAPPER.getLocalName()); // depends on control dependency: [if], data = [none] } else if (IdentityRoleMapper.class.getName().equals(mapper)) { writer.writeEmptyElement(Element.IDENTITY_ROLE_MAPPER.getLocalName()); // depends on control dependency: [if], data = [none] } else { writer.writeStartElement(Element.CUSTOM_ROLE_MAPPER.getLocalName()); // depends on control dependency: [if], data = [none] writer.writeAttribute(Attribute.CLASS.getLocalName(), mapper); // depends on control dependency: [if], data = [none] writer.writeEndElement(); // depends on control dependency: [if], data = [none] } } ModelNode roles = authorization.get(ModelKeys.ROLE); if (roles.isDefined()) { for (ModelNode roleNode : roles.asList()) { ModelNode role = roleNode.get(0); writer.writeStartElement(Element.ROLE.getLocalName()); // depends on control dependency: [for], data = [none] AuthorizationRoleResource.NAME.marshallAsAttribute(role, writer); // depends on control dependency: [for], data = [none] this.writeListAsAttribute(writer, Attribute.PERMISSIONS, role, ModelKeys.PERMISSIONS); // depends on control dependency: [for], data = [none] writer.writeEndElement(); // depends on control dependency: [for], data = [none] } } writer.writeEndElement(); // depends on control dependency: [if], data = [none] } writer.writeEndElement(); // depends on control dependency: [if], data = [none] } if (container.hasDefined(ModelKeys.GLOBAL_STATE)) { writer.writeStartElement(Element.GLOBAL_STATE.getLocalName()); // depends on control dependency: [if], data = [none] ModelNode globalState = container.get(ModelKeys.GLOBAL_STATE, ModelKeys.GLOBAL_STATE_NAME); writeStatePathElement(Element.PERSISTENT_LOCATION, ModelKeys.PERSISTENT_LOCATION, writer, globalState); // depends on control dependency: [if], data = [none] writeStatePathElement(Element.SHARED_PERSISTENT_LOCATION, ModelKeys.SHARED_PERSISTENT_LOCATION, writer, globalState); // depends on control dependency: [if], data = [none] writeStatePathElement(Element.TEMPORARY_LOCATION, ModelKeys.TEMPORARY_LOCATION, writer, globalState); // depends on control dependency: [if], data = [none] if (globalState.hasDefined(ModelKeys.CONFIGURATION_STORAGE)) { ConfigurationStorage configurationStorage = ConfigurationStorage.valueOf(globalState.get(ModelKeys.CONFIGURATION_STORAGE).asString()); switch (configurationStorage) { case IMMUTABLE: writer.writeEmptyElement(Element.IMMUTABLE_CONFIGURATION_STORAGE.getLocalName()); break; case VOLATILE: writer.writeEmptyElement(Element.VOLATILE_CONFIGURATION_STORAGE.getLocalName()); break; case OVERLAY: writer.writeEmptyElement(Element.OVERLAY_CONFIGURATION_STORAGE.getLocalName()); break; case MANAGED: writer.writeEmptyElement(Element.MANAGED_CONFIGURATION_STORAGE.getLocalName()); break; case CUSTOM: writer.writeStartElement(Element.CUSTOM_CONFIGURATION_STORAGE.getLocalName()); writer.writeAttribute(Attribute.CLASS.getLocalName(), globalState.get(ModelKeys.CONFIGURATION_STORAGE_CLASS).asString()); writer.writeEndElement(); break; } } writer.writeEndElement(); // depends on control dependency: [if], data = [none] } // write any configured thread pools if (container.hasDefined(ThreadPoolResource.WILDCARD_PATH.getKey())) { writeThreadPoolElements(Element.ASYNC_OPERATIONS_THREAD_POOL, ThreadPoolResource.ASYNC_OPERATIONS, writer, container); // depends on control dependency: [if], data = [none] writeScheduledThreadPoolElements(Element.EXPIRATION_THREAD_POOL, ScheduledThreadPoolResource.EXPIRATION, writer, container); // depends on control dependency: [if], data = [none] writeThreadPoolElements(Element.LISTENER_THREAD_POOL, ThreadPoolResource.LISTENER, writer, container); // depends on control dependency: [if], data = [none] writeScheduledThreadPoolElements(Element.PERSISTENCE_THREAD_POOL, ScheduledThreadPoolResource.PERSISTENCE, writer, container); // depends on control dependency: [if], data = [none] writeThreadPoolElements(Element.REMOTE_COMMAND_THREAD_POOL, ThreadPoolResource.REMOTE_COMMAND, writer, container); // depends on control dependency: [if], data = [none] writeScheduledThreadPoolElements(Element.REPLICATION_QUEUE_THREAD_POOL, ScheduledThreadPoolResource.REPLICATION_QUEUE, writer, container); // depends on control dependency: [if], data = [none] writeThreadPoolElements(Element.STATE_TRANSFER_THREAD_POOL, ThreadPoolResource.STATE_TRANSFER, writer, container); // depends on control dependency: [if], data = [none] writeThreadPoolElements(Element.TRANSPORT_THREAD_POOL, ThreadPoolResource.TRANSPORT, writer, container); // depends on control dependency: [if], data = [none] } // write modules if (container.hasDefined(ModelKeys.MODULES)) { writer.writeStartElement(Element.MODULES.getLocalName()); // depends on control dependency: [if], data = [none] ModelNode modules = container.get(ModelKeys.MODULES, ModelKeys.MODULES_NAME, ModelKeys.MODULE); for (ModelNode moduleNode : modules.asList()) { if (moduleNode.isDefined()) { ModelNode modelNode = moduleNode.get(0); writer.writeStartElement(Element.MODULE.getLocalName()); // depends on control dependency: [if], data = [none] writeAttribute(writer, modelNode, CacheContainerModuleResource.NAME); // depends on control dependency: [if], data = [none] if (modelNode.hasDefined(ModelKeys.SLOT)) { writeAttribute(writer, modelNode, CacheContainerModuleResource.SLOT); // depends on control dependency: [if], data = [none] } writer.writeEndElement(); // depends on control dependency: [if], data = [none] } } writer.writeEndElement(); // depends on control dependency: [if], data = [none] } ModelNode configurations = container.get(ModelKeys.CONFIGURATIONS, ModelKeys.CONFIGURATIONS_NAME); // write any existent cache types processCacheConfiguration(writer, container, configurations, ModelKeys.LOCAL_CACHE); processCacheConfiguration(writer, container, configurations, ModelKeys.INVALIDATION_CACHE); processCacheConfiguration(writer, container, configurations, ModelKeys.REPLICATED_CACHE); processCacheConfiguration(writer, container, configurations, ModelKeys.DISTRIBUTED_CACHE); // counters processCounterConfigurations(writer, container); writer.writeEndElement(); } } writer.writeEndElement(); } }
public class class_name { public byte[] generateKey(int length) { if (length <= 0) { throw new IllegalArgumentException("长度为:" + length + ", 指定的密钥长度错误!"); } byte[] bts = new byte[length]; Random random = new Random(); for (int i = 0; i < length; i++) { bts[i] = (byte) random.nextInt(255); } return bts; } }
public class class_name { public byte[] generateKey(int length) { if (length <= 0) { throw new IllegalArgumentException("长度为:" + length + ", 指定的密钥长度错误!"); } byte[] bts = new byte[length]; Random random = new Random(); for (int i = 0; i < length; i++) { bts[i] = (byte) random.nextInt(255); // depends on control dependency: [for], data = [i] } return bts; } }
public class class_name { public java.util.List<AliasListEntry> getAliases() { if (aliases == null) { aliases = new com.ibm.cloud.objectstorage.internal.SdkInternalList<AliasListEntry>(); } return aliases; } }
public class class_name { public java.util.List<AliasListEntry> getAliases() { if (aliases == null) { aliases = new com.ibm.cloud.objectstorage.internal.SdkInternalList<AliasListEntry>(); // depends on control dependency: [if], data = [none] } return aliases; } }
public class class_name { public <K, V> Cache<K, V> initCache(final String _cacheName) { if (!exists(_cacheName) && ((EmbeddedCacheManager) getContainer()).getCacheConfiguration(_cacheName) == null) { ((EmbeddedCacheManager) getContainer()).defineConfiguration(_cacheName, "eFaps-Default", new ConfigurationBuilder().build()); } return this.container.getCache(_cacheName, true); } }
public class class_name { public <K, V> Cache<K, V> initCache(final String _cacheName) { if (!exists(_cacheName) && ((EmbeddedCacheManager) getContainer()).getCacheConfiguration(_cacheName) == null) { ((EmbeddedCacheManager) getContainer()).defineConfiguration(_cacheName, "eFaps-Default", new ConfigurationBuilder().build()); // depends on control dependency: [if], data = [none] } return this.container.getCache(_cacheName, true); } }
public class class_name { public <T> List<T> randomElements(List<T> elements, int count) { if (elements.size() >= count) { return extractRandomList(elements, count); } else { List<T> randomElements = new ArrayList<T>(); randomElements.addAll(extractRandomList(elements, count % elements.size())); do { randomElements.addAll(extractRandomList(elements, elements.size())); } while (randomElements.size() < count); return randomElements; } } }
public class class_name { public <T> List<T> randomElements(List<T> elements, int count) { if (elements.size() >= count) { return extractRandomList(elements, count); // depends on control dependency: [if], data = [none] } else { List<T> randomElements = new ArrayList<T>(); randomElements.addAll(extractRandomList(elements, count % elements.size())); // depends on control dependency: [if], data = [none] do { randomElements.addAll(extractRandomList(elements, elements.size())); } while (randomElements.size() < count); return randomElements; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void logModules() { StringBuilder sb = new StringBuilder(); /* if (JniFilePathImpl.isEnabled()) { if (sb.length() > 0) sb.append(" ,"); sb.append(" file"); } else if (JniFilePathImpl.getInitMessage() != null) log.config(" JNI file: " + JniFilePathImpl.getInitMessage()); */ /* else log.info(" JNI file: disabled for unknown reasons"); */ PollTcpManagerBase pollManager = NetworkSystem.currentPollManager(); if (pollManager != null) { if (sb.length() > 0) { sb.append(","); } sb.append(" poll keepalive (max=" + pollManager.pollMax() + ")"); } else if (SelectManagerJni.getInitMessage() != null) { log.config(" JNI poll: " + SelectManagerJni.getInitMessage()); } /* else if (CauchoUtil.isWindows()) log.info(" JNI keepalive: not available on Windows"); else log.info(" JNI keepalive: disabled for unknown reasons"); */ if (JniServerSocketImpl.isEnabled()) { if (sb.length() > 0) sb.append(","); sb.append(" socket"); } else if (JniServerSocketImpl.getInitMessage() != null) { log.config(" JNI socket: " + JniServerSocketImpl.getInitMessage()); } else { log.config(" JNI socket: disabled for unknown reasons"); } if (OpenSSLFactory.isEnabled()) { if (sb.length() > 0) sb.append(","); sb.append(" openssl"); } if (sb.length() > 0) log.info(" Native:" + sb); log.info(""); } }
public class class_name { private void logModules() { StringBuilder sb = new StringBuilder(); /* if (JniFilePathImpl.isEnabled()) { if (sb.length() > 0) sb.append(" ,"); sb.append(" file"); } else if (JniFilePathImpl.getInitMessage() != null) log.config(" JNI file: " + JniFilePathImpl.getInitMessage()); */ /* else log.info(" JNI file: disabled for unknown reasons"); */ PollTcpManagerBase pollManager = NetworkSystem.currentPollManager(); if (pollManager != null) { if (sb.length() > 0) { sb.append(","); // depends on control dependency: [if], data = [none] } sb.append(" poll keepalive (max=" + pollManager.pollMax() + ")"); } else if (SelectManagerJni.getInitMessage() != null) { log.config(" JNI poll: " + SelectManagerJni.getInitMessage()); } /* else if (CauchoUtil.isWindows()) log.info(" JNI keepalive: not available on Windows"); else log.info(" JNI keepalive: disabled for unknown reasons"); */ if (JniServerSocketImpl.isEnabled()) { if (sb.length() > 0) sb.append(","); sb.append(" socket"); // depends on control dependency: [if], data = [none] } else if (JniServerSocketImpl.getInitMessage() != null) { log.config(" JNI socket: " + JniServerSocketImpl.getInitMessage()); // depends on control dependency: [if], data = [none] } else { log.config(" JNI socket: disabled for unknown reasons"); // depends on control dependency: [if], data = [none] } if (OpenSSLFactory.isEnabled()) { if (sb.length() > 0) sb.append(","); sb.append(" openssl"); // depends on control dependency: [if], data = [none] } if (sb.length() > 0) log.info(" Native:" + sb); log.info(""); // depends on control dependency: [if], data = [none] } }
public class class_name { @Override public int removeKamEdges(KamInfo info, int[] edgeIds) { try { KAMUpdateDao updateDao = kamUpdateDao(info); return updateDao.removeKamEdges(edgeIds); } catch (SQLException e) { final String msg = "error removing edges with edge ids"; throw new KAMStoreException(msg, e); } } }
public class class_name { @Override public int removeKamEdges(KamInfo info, int[] edgeIds) { try { KAMUpdateDao updateDao = kamUpdateDao(info); return updateDao.removeKamEdges(edgeIds); // depends on control dependency: [try], data = [none] } catch (SQLException e) { final String msg = "error removing edges with edge ids"; throw new KAMStoreException(msg, e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public boolean getIsEmpty() { if (m_contentValue == null) { // this is the case for non existing values return true; } if (m_contentValue.isSimpleType()) { // return values for simple type return CmsStringUtil.isEmpty(m_contentValue.getStringValue(m_cms)); } else { // nested types are not empty if they have any children in the XML return m_contentValue.getElement().elements().size() > 0; } } }
public class class_name { @Override public boolean getIsEmpty() { if (m_contentValue == null) { // this is the case for non existing values return true; // depends on control dependency: [if], data = [none] } if (m_contentValue.isSimpleType()) { // return values for simple type return CmsStringUtil.isEmpty(m_contentValue.getStringValue(m_cms)); // depends on control dependency: [if], data = [none] } else { // nested types are not empty if they have any children in the XML return m_contentValue.getElement().elements().size() > 0; // depends on control dependency: [if], data = [none] } } }
public class class_name { static String getDNSubField(String varName, String DN) throws CertificateMapperException { if (varName.equals("DN")) { return DN; // return the whole DN } // Parse the DN looking for 'varName' StringTokenizer st = new StringTokenizer(DN); for (;;) { String name, value; try { name = st.nextToken(",= "); value = st.nextToken(","); if (value != null) { value = value.substring(1); } } catch (NoSuchElementException e) { e.getMessage(); break; } if (name.equals(varName)) { return value; } } throw new CertificateMapperException(WIMMessageKey.UNKNOWN_DN_FIELD, Tr.formatMessage( tc, WIMMessageKey.UNKNOWN_DN_FIELD, WIMMessageHelper.generateMsgParms(varName))); } }
public class class_name { static String getDNSubField(String varName, String DN) throws CertificateMapperException { if (varName.equals("DN")) { return DN; // return the whole DN } // Parse the DN looking for 'varName' StringTokenizer st = new StringTokenizer(DN); for (;;) { String name, value; try { name = st.nextToken(",= "); // depends on control dependency: [try], data = [none] value = st.nextToken(","); // depends on control dependency: [try], data = [none] if (value != null) { value = value.substring(1); // depends on control dependency: [if], data = [none] } } catch (NoSuchElementException e) { e.getMessage(); break; } // depends on control dependency: [catch], data = [none] if (name.equals(varName)) { return value; // depends on control dependency: [if], data = [none] } } throw new CertificateMapperException(WIMMessageKey.UNKNOWN_DN_FIELD, Tr.formatMessage( tc, WIMMessageKey.UNKNOWN_DN_FIELD, WIMMessageHelper.generateMsgParms(varName))); } }
public class class_name { private NumberData parseNumberData(LocaleID id, String code, JsonObject root) { NumberData data = getNumberData(id); JsonObject numbers = resolve(root, "numbers"); data.minimumGroupingDigits = Integer.valueOf(string(numbers, "minimumGroupingDigits")); JsonObject symbols = resolve(numbers, "symbols-numberSystem-latn"); data.decimal = string(symbols, "decimal"); data.group = string(symbols, "group"); data.percent = string(symbols, "percentSign"); data.plus = string(symbols, "plusSign"); data.minus = string(symbols, "minusSign"); data.exponential = string(symbols, "exponential"); data.superscriptingExponent = string(symbols, "superscriptingExponent"); data.perMille = string(symbols, "perMille"); data.infinity = string(symbols, "infinity"); data.nan = string(symbols, "nan"); // The fields 'currencyDecimal' and 'currencyGroup' are only defined for a few locales data.currencyDecimal = string(symbols, "currencyDecimal", data.decimal); data.currencyGroup = string(symbols, "currencyGroup", data.group); JsonObject decimalFormats = resolve(numbers, "decimalFormats-numberSystem-latn"); data.decimalFormatStandard = getNumberPattern(string(decimalFormats, "standard")); data.decimalFormatShort = getPluralNumberPattern(resolve(decimalFormats, "short", "decimalFormat")); data.decimalFormatLong = getPluralNumberPattern(resolve(decimalFormats, "long", "decimalFormat")); JsonObject percentFormats = resolve(numbers, "percentFormats-numberSystem-latn"); data.percentFormatStandard = getNumberPattern(string(percentFormats, "standard")); JsonObject currencyFormats = resolve(numbers, "currencyFormats-numberSystem-latn"); data.currencyFormatStandard = getNumberPattern(string(currencyFormats, "standard")); data.currencyFormatAccounting = getNumberPattern(string(currencyFormats, "accounting")); data.currencyFormatShort = getPluralNumberPattern(resolve(currencyFormats, "short", "standard")); data.currencyUnitPattern = new HashMap<>(); for (String key : objectKeys(currencyFormats)) { if (key.startsWith("unitPattern-count")) { data.currencyUnitPattern.put(key, string(currencyFormats, key)); } } return data; } }
public class class_name { private NumberData parseNumberData(LocaleID id, String code, JsonObject root) { NumberData data = getNumberData(id); JsonObject numbers = resolve(root, "numbers"); data.minimumGroupingDigits = Integer.valueOf(string(numbers, "minimumGroupingDigits")); JsonObject symbols = resolve(numbers, "symbols-numberSystem-latn"); data.decimal = string(symbols, "decimal"); data.group = string(symbols, "group"); data.percent = string(symbols, "percentSign"); data.plus = string(symbols, "plusSign"); data.minus = string(symbols, "minusSign"); data.exponential = string(symbols, "exponential"); data.superscriptingExponent = string(symbols, "superscriptingExponent"); data.perMille = string(symbols, "perMille"); data.infinity = string(symbols, "infinity"); data.nan = string(symbols, "nan"); // The fields 'currencyDecimal' and 'currencyGroup' are only defined for a few locales data.currencyDecimal = string(symbols, "currencyDecimal", data.decimal); data.currencyGroup = string(symbols, "currencyGroup", data.group); JsonObject decimalFormats = resolve(numbers, "decimalFormats-numberSystem-latn"); data.decimalFormatStandard = getNumberPattern(string(decimalFormats, "standard")); data.decimalFormatShort = getPluralNumberPattern(resolve(decimalFormats, "short", "decimalFormat")); data.decimalFormatLong = getPluralNumberPattern(resolve(decimalFormats, "long", "decimalFormat")); JsonObject percentFormats = resolve(numbers, "percentFormats-numberSystem-latn"); data.percentFormatStandard = getNumberPattern(string(percentFormats, "standard")); JsonObject currencyFormats = resolve(numbers, "currencyFormats-numberSystem-latn"); data.currencyFormatStandard = getNumberPattern(string(currencyFormats, "standard")); data.currencyFormatAccounting = getNumberPattern(string(currencyFormats, "accounting")); data.currencyFormatShort = getPluralNumberPattern(resolve(currencyFormats, "short", "standard")); data.currencyUnitPattern = new HashMap<>(); for (String key : objectKeys(currencyFormats)) { if (key.startsWith("unitPattern-count")) { data.currencyUnitPattern.put(key, string(currencyFormats, key)); // depends on control dependency: [if], data = [none] } } return data; } }
public class class_name { @Override public String generateExpression(int flagsAdd) { int flags = m_flags | flagsAdd; StringBuilder sb = new StringBuilder(); if (m_leader != null) { sb.append(m_leader); } // Need a non-capturing group when either an explicit non-capturing group is // requested or it is optional. The only case where a non-capturing group isn't // needed for an optional is an explicit capture without leading space. boolean captureGroup = (flags & SQLPatternFactory.CAPTURE) != 0; boolean explicitNonCaptureGroup = !captureGroup && (flags & SQLPatternFactory.GROUP) != 0; boolean optional = ((flags & SQLPatternFactory.OPTIONAL) != 0); // Suppress the leading space at this level when it should be pushed down to the child. boolean leadingSpace = ((flags & SQLPatternFactory.LEADING_SPACE) != 0); boolean leadingSpaceToChild = ((flags & SQLPatternFactory.ADD_LEADING_SPACE_TO_CHILD) != 0); boolean childLeadingSpace = ((flags & SQLPatternFactory.CHILD_SPACE_SEPARATOR) != 0 || (leadingSpace && leadingSpaceToChild)); boolean nonCaptureGroup = (explicitNonCaptureGroup || (optional && (!captureGroup || leadingSpace))); boolean innerOptional = optional && captureGroup && !nonCaptureGroup; boolean outerOptional = optional && nonCaptureGroup; if (nonCaptureGroup) { sb.append("(?:"); } if (leadingSpace && !leadingSpaceToChild) { // Protect something like an OR sequence by using an inner group sb.append("\\s+(?:"); } if (captureGroup) { if (m_captureLabel != null) { sb.append(String.format("(?<%s>", m_captureLabel)); } else { sb.append("("); } } for (int i = 0; i < m_parts.length; ++i) { int flagsAddChild = 0; if (i > 0) { if (m_separator != null) { sb.append(m_separator); } if (childLeadingSpace) { flagsAddChild |= SQLPatternFactory.LEADING_SPACE; } } else if (childLeadingSpace && leadingSpaceToChild) { flagsAddChild |= SQLPatternFactory.LEADING_SPACE; } sb.append(m_parts[i].generateExpression(flagsAddChild)); } if (captureGroup) { sb.append(")"); } if (innerOptional) { sb.append("?"); } if (leadingSpace && !leadingSpaceToChild) { sb.append(")"); } if (nonCaptureGroup) { sb.append(")"); } if (outerOptional) { sb.append("?"); } if (m_trailer != null) { sb.append(m_trailer); } return sb.toString(); } }
public class class_name { @Override public String generateExpression(int flagsAdd) { int flags = m_flags | flagsAdd; StringBuilder sb = new StringBuilder(); if (m_leader != null) { sb.append(m_leader); // depends on control dependency: [if], data = [(m_leader] } // Need a non-capturing group when either an explicit non-capturing group is // requested or it is optional. The only case where a non-capturing group isn't // needed for an optional is an explicit capture without leading space. boolean captureGroup = (flags & SQLPatternFactory.CAPTURE) != 0; boolean explicitNonCaptureGroup = !captureGroup && (flags & SQLPatternFactory.GROUP) != 0; boolean optional = ((flags & SQLPatternFactory.OPTIONAL) != 0); // Suppress the leading space at this level when it should be pushed down to the child. boolean leadingSpace = ((flags & SQLPatternFactory.LEADING_SPACE) != 0); boolean leadingSpaceToChild = ((flags & SQLPatternFactory.ADD_LEADING_SPACE_TO_CHILD) != 0); boolean childLeadingSpace = ((flags & SQLPatternFactory.CHILD_SPACE_SEPARATOR) != 0 || (leadingSpace && leadingSpaceToChild)); boolean nonCaptureGroup = (explicitNonCaptureGroup || (optional && (!captureGroup || leadingSpace))); boolean innerOptional = optional && captureGroup && !nonCaptureGroup; boolean outerOptional = optional && nonCaptureGroup; if (nonCaptureGroup) { sb.append("(?:"); // depends on control dependency: [if], data = [none] } if (leadingSpace && !leadingSpaceToChild) { // Protect something like an OR sequence by using an inner group sb.append("\\s+(?:"); // depends on control dependency: [if], data = [none] } if (captureGroup) { if (m_captureLabel != null) { sb.append(String.format("(?<%s>", m_captureLabel)); // depends on control dependency: [if], data = [none] } else { sb.append("("); // depends on control dependency: [if], data = [none] } } for (int i = 0; i < m_parts.length; ++i) { int flagsAddChild = 0; if (i > 0) { if (m_separator != null) { sb.append(m_separator); // depends on control dependency: [if], data = [(m_separator] } if (childLeadingSpace) { flagsAddChild |= SQLPatternFactory.LEADING_SPACE; // depends on control dependency: [if], data = [none] } } else if (childLeadingSpace && leadingSpaceToChild) { flagsAddChild |= SQLPatternFactory.LEADING_SPACE; // depends on control dependency: [if], data = [none] } sb.append(m_parts[i].generateExpression(flagsAddChild)); // depends on control dependency: [for], data = [i] } if (captureGroup) { sb.append(")"); // depends on control dependency: [if], data = [none] } if (innerOptional) { sb.append("?"); // depends on control dependency: [if], data = [none] } if (leadingSpace && !leadingSpaceToChild) { sb.append(")"); // depends on control dependency: [if], data = [none] } if (nonCaptureGroup) { sb.append(")"); // depends on control dependency: [if], data = [none] } if (outerOptional) { sb.append("?"); // depends on control dependency: [if], data = [none] } if (m_trailer != null) { sb.append(m_trailer); // depends on control dependency: [if], data = [(m_trailer] } return sb.toString(); } }
public class class_name { private HTTPExchange claimExchange(int idx) { assertLocked(); HTTPExchange exch = null; // Claim the exchange for (HTTPExchange toClaim : exchanges) { if (findProcessorForExchange(toClaim) == null) { exch = toClaim; break; } } if (exch != null) { procThreads[idx].procExchange = exch; if (LOG.isLoggable(Level.FINEST)) { LOG.finest( "Thread " + idx + " claimed: " + exch.getRequest().getAttribute(Attributes.RID)); } } else { if (LOG.isLoggable(Level.FINEST)) LOG.finest("Thread " + idx + " will wait for new request..."); } return exch; } }
public class class_name { private HTTPExchange claimExchange(int idx) { assertLocked(); HTTPExchange exch = null; // Claim the exchange for (HTTPExchange toClaim : exchanges) { if (findProcessorForExchange(toClaim) == null) { exch = toClaim; // depends on control dependency: [if], data = [none] break; } } if (exch != null) { procThreads[idx].procExchange = exch; // depends on control dependency: [if], data = [none] if (LOG.isLoggable(Level.FINEST)) { LOG.finest( "Thread " + idx + " claimed: " + exch.getRequest().getAttribute(Attributes.RID)); // depends on control dependency: [if], data = [none] } } else { if (LOG.isLoggable(Level.FINEST)) LOG.finest("Thread " + idx + " will wait for new request..."); } return exch; } }
public class class_name { private static boolean typesEquivalent(Type typeToMatch, GenericArrayType type, ResolutionContext ctx) { if (typeToMatch instanceof GenericArrayType) { GenericArrayType aGat = (GenericArrayType) typeToMatch; return typesEquivalent(aGat.getGenericComponentType(), ctx.resolve(type.getGenericComponentType()), ctx); } if (typeToMatch instanceof Class) { Class<?> aClazz = (Class<?>) typeToMatch; if (aClazz.isArray()) { return typesEquivalent(aClazz.getComponentType(), ctx.resolve(type.getGenericComponentType()), ctx); } } return false; } }
public class class_name { private static boolean typesEquivalent(Type typeToMatch, GenericArrayType type, ResolutionContext ctx) { if (typeToMatch instanceof GenericArrayType) { GenericArrayType aGat = (GenericArrayType) typeToMatch; return typesEquivalent(aGat.getGenericComponentType(), ctx.resolve(type.getGenericComponentType()), ctx); // depends on control dependency: [if], data = [none] } if (typeToMatch instanceof Class) { Class<?> aClazz = (Class<?>) typeToMatch; if (aClazz.isArray()) { return typesEquivalent(aClazz.getComponentType(), ctx.resolve(type.getGenericComponentType()), ctx); } } return false; } }
public class class_name { public int swapIndex(final String index, final String alias) throws IndexException { //IndicesAliasesResponse resp = null; try { /* index is the index we were just indexing into */ final IndicesAdminClient idx = getAdminIdx(); final GetAliasesRequestBuilder igarb = idx.prepareGetAliases( alias); final ActionFuture<GetAliasesResponse> getAliasesAf = idx.getAliases(igarb.request()); final GetAliasesResponse garesp = getAliasesAf.actionGet(); final ImmutableOpenMap<String, List<AliasMetaData>> aliasesmeta = garesp.getAliases(); final IndicesAliasesRequestBuilder iarb = idx.prepareAliases(); final Iterator<String> it = aliasesmeta.keysIt(); while (it.hasNext()) { final String indexName = it.next(); for (final AliasMetaData amd: aliasesmeta.get(indexName)) { if(amd.getAlias().equals(alias)) { iarb.removeAlias(indexName, alias); } } } iarb.addAlias(index, alias); final ActionFuture<IndicesAliasesResponse> af = idx.aliases(iarb.request()); /*resp = */af.actionGet(); return 0; } catch (final ElasticsearchException ese) { // Failed somehow error(ese); return -1; } catch (final IndexException ie) { throw ie; } catch (final Throwable t) { throw new IndexException(t); } } }
public class class_name { public int swapIndex(final String index, final String alias) throws IndexException { //IndicesAliasesResponse resp = null; try { /* index is the index we were just indexing into */ final IndicesAdminClient idx = getAdminIdx(); final GetAliasesRequestBuilder igarb = idx.prepareGetAliases( alias); final ActionFuture<GetAliasesResponse> getAliasesAf = idx.getAliases(igarb.request()); final GetAliasesResponse garesp = getAliasesAf.actionGet(); final ImmutableOpenMap<String, List<AliasMetaData>> aliasesmeta = garesp.getAliases(); final IndicesAliasesRequestBuilder iarb = idx.prepareAliases(); final Iterator<String> it = aliasesmeta.keysIt(); while (it.hasNext()) { final String indexName = it.next(); for (final AliasMetaData amd: aliasesmeta.get(indexName)) { if(amd.getAlias().equals(alias)) { iarb.removeAlias(indexName, alias); // depends on control dependency: [if], data = [none] } } } iarb.addAlias(index, alias); final ActionFuture<IndicesAliasesResponse> af = idx.aliases(iarb.request()); /*resp = */af.actionGet(); return 0; } catch (final ElasticsearchException ese) { // Failed somehow error(ese); return -1; } catch (final IndexException ie) { throw ie; } catch (final Throwable t) { throw new IndexException(t); } } }
public class class_name { private void addLogRecorders(Container result) { for (Map.Entry<String, LogRecorder> entry : logRecorders.entrySet()) { String name = entry.getKey(); String entryName = "nodes/master/logs/custom/{0}.log"; // name to be filtered in the bundle File storedFile = new File(customLogs, name + ".log"); if (storedFile.isFile()) { result.add(new FileContent(entryName, new String[]{name}, storedFile)); } else { // Was not stored for some reason; fine, just load the memory buffer. final LogRecorder recorder = entry.getValue(); result.add(new LogRecordContent(entryName, new String[]{name}) { @Override public Iterable<LogRecord> getLogRecords() { return recorder.getLogRecords(); } }); } } } }
public class class_name { private void addLogRecorders(Container result) { for (Map.Entry<String, LogRecorder> entry : logRecorders.entrySet()) { String name = entry.getKey(); String entryName = "nodes/master/logs/custom/{0}.log"; // name to be filtered in the bundle File storedFile = new File(customLogs, name + ".log"); if (storedFile.isFile()) { result.add(new FileContent(entryName, new String[]{name}, storedFile)); // depends on control dependency: [if], data = [none] } else { // Was not stored for some reason; fine, just load the memory buffer. final LogRecorder recorder = entry.getValue(); result.add(new LogRecordContent(entryName, new String[]{name}) { @Override public Iterable<LogRecord> getLogRecords() { return recorder.getLogRecords(); } }); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void free() throws SQLException { if (freed) { return; } string = null; if (reader != null) { reader.close(); } if (inputStream != null) { try { inputStream.close(); } catch (IOException ioe) { // Do nothing } } freed = true; } }
public class class_name { public void free() throws SQLException { if (freed) { return; } string = null; if (reader != null) { reader.close(); } if (inputStream != null) { try { inputStream.close(); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { // Do nothing } // depends on control dependency: [catch], data = [none] } freed = true; } }
public class class_name { static Matcher ignoreCase(Matcher matcher) { if (matcher instanceof CharClassMatcher) { CharClassMatcher m = matcher.as(); return new CharClassMatcher(m.set(), true); } else if (matcher instanceof CharSeqMatcher) { CharSeqMatcher m = matcher.as(); return new CharSeqMatcher(m.pattern(), true); } else if (matcher instanceof IndexOfMatcher) { IndexOfMatcher m = matcher.as(); return new IndexOfMatcher(m.pattern(), m.next(), true); } else if (matcher instanceof StartsWithMatcher) { StartsWithMatcher m = matcher.as(); return new StartsWithMatcher(m.pattern(), true); } else { return matcher; } } }
public class class_name { static Matcher ignoreCase(Matcher matcher) { if (matcher instanceof CharClassMatcher) { CharClassMatcher m = matcher.as(); return new CharClassMatcher(m.set(), true); // depends on control dependency: [if], data = [none] } else if (matcher instanceof CharSeqMatcher) { CharSeqMatcher m = matcher.as(); return new CharSeqMatcher(m.pattern(), true); // depends on control dependency: [if], data = [none] } else if (matcher instanceof IndexOfMatcher) { IndexOfMatcher m = matcher.as(); return new IndexOfMatcher(m.pattern(), m.next(), true); // depends on control dependency: [if], data = [none] } else if (matcher instanceof StartsWithMatcher) { StartsWithMatcher m = matcher.as(); return new StartsWithMatcher(m.pattern(), true); // depends on control dependency: [if], data = [none] } else { return matcher; // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean addDuplicationStorePolicy(String spaceId, DuplicationStorePolicy dupStore) { LinkedHashSet<DuplicationStorePolicy> dupStores = spaceDuplicationStorePolicies.get(spaceId); if (dupStores == null) { dupStores = new LinkedHashSet<>(); spaceDuplicationStorePolicies.put(spaceId, dupStores); } return dupStores.add(dupStore); } }
public class class_name { public boolean addDuplicationStorePolicy(String spaceId, DuplicationStorePolicy dupStore) { LinkedHashSet<DuplicationStorePolicy> dupStores = spaceDuplicationStorePolicies.get(spaceId); if (dupStores == null) { dupStores = new LinkedHashSet<>(); // depends on control dependency: [if], data = [none] spaceDuplicationStorePolicies.put(spaceId, dupStores); // depends on control dependency: [if], data = [none] } return dupStores.add(dupStore); } }
public class class_name { public static Expression path(Object... pathComponents) { if (pathComponents == null || pathComponents.length == 0) { return EMPTY_INSTANCE; } StringBuilder path = new StringBuilder(); for (Object p : pathComponents) { path.append('.'); if (p instanceof Expression) { path.append(((Expression) p).toString()); } else { path.append(String.valueOf(p)); } } path.deleteCharAt(0); return x(path.toString()); } }
public class class_name { public static Expression path(Object... pathComponents) { if (pathComponents == null || pathComponents.length == 0) { return EMPTY_INSTANCE; // depends on control dependency: [if], data = [none] } StringBuilder path = new StringBuilder(); for (Object p : pathComponents) { path.append('.'); // depends on control dependency: [for], data = [p] if (p instanceof Expression) { path.append(((Expression) p).toString()); // depends on control dependency: [if], data = [none] } else { path.append(String.valueOf(p)); // depends on control dependency: [if], data = [none] } } path.deleteCharAt(0); return x(path.toString()); } }
public class class_name { private static void extractIntersectingState( Collection<KeyedStateHandle> originalSubtaskStateHandles, KeyGroupRange rangeToExtract, List<KeyedStateHandle> extractedStateCollector) { for (KeyedStateHandle keyedStateHandle : originalSubtaskStateHandles) { if (keyedStateHandle != null) { KeyedStateHandle intersectedKeyedStateHandle = keyedStateHandle.getIntersection(rangeToExtract); if (intersectedKeyedStateHandle != null) { extractedStateCollector.add(intersectedKeyedStateHandle); } } } } }
public class class_name { private static void extractIntersectingState( Collection<KeyedStateHandle> originalSubtaskStateHandles, KeyGroupRange rangeToExtract, List<KeyedStateHandle> extractedStateCollector) { for (KeyedStateHandle keyedStateHandle : originalSubtaskStateHandles) { if (keyedStateHandle != null) { KeyedStateHandle intersectedKeyedStateHandle = keyedStateHandle.getIntersection(rangeToExtract); if (intersectedKeyedStateHandle != null) { extractedStateCollector.add(intersectedKeyedStateHandle); // depends on control dependency: [if], data = [(intersectedKeyedStateHandle] } } } } }
public class class_name { private void sawStore(int seen, int pc) { int reg = RegisterUtils.getStoreReg(this, seen); if (catchHandlers.get(pc)) { ignoreRegs.set(reg); ScopeBlock catchSB = findScopeBlock(rootScopeBlock, pc + 1); if ((catchSB != null) && (catchSB.getStart() < pc)) { ScopeBlock sb = new ScopeBlock(pc, catchSB.getFinish()); catchSB.setFinish(getPC() - 1); rootScopeBlock.addChild(sb); } } else if (!monitorSyncPCs.isEmpty()) { ignoreRegs.set(reg); } else if (sawNull) { ignoreRegs.set(reg); } else if (isRiskyStoreClass(reg)) { ignoreRegs.set(reg); } if (!ignoreRegs.get(reg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { UserObject assoc = null; if (stack.getStackDepth() > 0) { OpcodeStack.Item srcItm = stack.getStackItem(0); assoc = (UserObject) srcItm.getUserValue(); if (assoc == null) { if (srcItm.getRegisterNumber() >= 0) { assoc = new UserObject(srcItm.getRegisterNumber()); } } } if ((assoc != null) && assoc.isRisky) { ignoreRegs.set(reg); } else { sb.addStore(reg, pc, assoc); if (sawDup) { sb.addLoad(reg, pc); } } } else { ignoreRegs.set(reg); } } ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { sb.markFieldAssociatedWrites(reg); } } }
public class class_name { private void sawStore(int seen, int pc) { int reg = RegisterUtils.getStoreReg(this, seen); if (catchHandlers.get(pc)) { ignoreRegs.set(reg); // depends on control dependency: [if], data = [none] ScopeBlock catchSB = findScopeBlock(rootScopeBlock, pc + 1); if ((catchSB != null) && (catchSB.getStart() < pc)) { ScopeBlock sb = new ScopeBlock(pc, catchSB.getFinish()); catchSB.setFinish(getPC() - 1); // depends on control dependency: [if], data = [none] rootScopeBlock.addChild(sb); // depends on control dependency: [if], data = [none] } } else if (!monitorSyncPCs.isEmpty()) { ignoreRegs.set(reg); // depends on control dependency: [if], data = [none] } else if (sawNull) { ignoreRegs.set(reg); // depends on control dependency: [if], data = [none] } else if (isRiskyStoreClass(reg)) { ignoreRegs.set(reg); // depends on control dependency: [if], data = [none] } if (!ignoreRegs.get(reg)) { ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { UserObject assoc = null; if (stack.getStackDepth() > 0) { OpcodeStack.Item srcItm = stack.getStackItem(0); assoc = (UserObject) srcItm.getUserValue(); // depends on control dependency: [if], data = [none] if (assoc == null) { if (srcItm.getRegisterNumber() >= 0) { assoc = new UserObject(srcItm.getRegisterNumber()); // depends on control dependency: [if], data = [(srcItm.getRegisterNumber()] } } } if ((assoc != null) && assoc.isRisky) { ignoreRegs.set(reg); // depends on control dependency: [if], data = [none] } else { sb.addStore(reg, pc, assoc); // depends on control dependency: [if], data = [none] if (sawDup) { sb.addLoad(reg, pc); // depends on control dependency: [if], data = [none] } } } else { ignoreRegs.set(reg); // depends on control dependency: [if], data = [none] } } ScopeBlock sb = findScopeBlock(rootScopeBlock, pc); if (sb != null) { sb.markFieldAssociatedWrites(reg); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void call(Env env, Scope scope, ExprList exprList, Writer writer) { if (exprList.length() != parameterNames.length) { throw new TemplateException("Wrong number of argument to call the template function, right number is: " + parameterNames.length, location); } scope = new Scope(scope); if (exprList.length() > 0) { Object[] parameterValues = exprList.evalExprList(scope); for (int i=0; i<parameterValues.length; i++) { scope.setLocal(parameterNames[i], parameterValues[i]); // 参数赋值 } } stat.exec(env, scope, writer); scope.getCtrl().setJumpNone(); // #define 中的 return、continue、break 全部在此消化 } }
public class class_name { public void call(Env env, Scope scope, ExprList exprList, Writer writer) { if (exprList.length() != parameterNames.length) { throw new TemplateException("Wrong number of argument to call the template function, right number is: " + parameterNames.length, location); } scope = new Scope(scope); if (exprList.length() > 0) { Object[] parameterValues = exprList.evalExprList(scope); for (int i=0; i<parameterValues.length; i++) { scope.setLocal(parameterNames[i], parameterValues[i]); // 参数赋值 // depends on control dependency: [for], data = [i] } } stat.exec(env, scope, writer); scope.getCtrl().setJumpNone(); // #define 中的 return、continue、break 全部在此消化 } }
public class class_name { public synchronized void setFlushInterval(long delay, long seconds) { if (m_flush != null) { m_flush.cancel(false); m_flush = null; } if (seconds > 0) { m_flush = m_ses.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { flush(); } catch (Exception e) { loaderLog.error("Failed to flush loader buffer, some tuples may not be inserted.", e); } } }, delay, seconds, TimeUnit.SECONDS); } } }
public class class_name { public synchronized void setFlushInterval(long delay, long seconds) { if (m_flush != null) { m_flush.cancel(false); // depends on control dependency: [if], data = [none] m_flush = null; // depends on control dependency: [if], data = [none] } if (seconds > 0) { m_flush = m_ses.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { flush(); // depends on control dependency: [try], data = [none] } catch (Exception e) { loaderLog.error("Failed to flush loader buffer, some tuples may not be inserted.", e); } // depends on control dependency: [catch], data = [none] } }, delay, seconds, TimeUnit.SECONDS); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static Collection<ActionRef> getActionsInCommon(List<Selectable> selection) { final Collection<ActionRef> actions = new HashSet<>(); final int n = selection.size(); for (int i = 0; i < n; i++) { final Selectable selectable = selection.get(i); if (selectable.hasFeature(Actioner.class)) { final Actioner actioner = selectable.getFeature(Actioner.class); checkActionsInCommon(actioner, actions); } } return actions; } }
public class class_name { private static Collection<ActionRef> getActionsInCommon(List<Selectable> selection) { final Collection<ActionRef> actions = new HashSet<>(); final int n = selection.size(); for (int i = 0; i < n; i++) { final Selectable selectable = selection.get(i); if (selectable.hasFeature(Actioner.class)) { final Actioner actioner = selectable.getFeature(Actioner.class); checkActionsInCommon(actioner, actions); // depends on control dependency: [if], data = [none] } } return actions; } }
public class class_name { private static void doCreateSuperForwarder(ClassNode targetNode, MethodNode forwarderMethod, ClassNode[] interfacesToGenerateForwarderFor, Map<String,ClassNode> genericsSpec) { Parameter[] parameters = forwarderMethod.getParameters(); Parameter[] superForwarderParams = new Parameter[parameters.length]; for (int i = 0; i < parameters.length; i++) { Parameter parameter = parameters[i]; ClassNode originType = parameter.getOriginType(); superForwarderParams[i] = new Parameter(correctToGenericsSpecRecurse(genericsSpec, originType), parameter.getName()); } for (int i = 0; i < interfacesToGenerateForwarderFor.length; i++) { final ClassNode current = interfacesToGenerateForwarderFor[i]; final ClassNode next = i < interfacesToGenerateForwarderFor.length - 1 ? interfacesToGenerateForwarderFor[i + 1] : null; String forwarderName = Traits.getSuperTraitMethodName(current, forwarderMethod.getName()); if (targetNode.getDeclaredMethod(forwarderName, superForwarderParams) == null) { ClassNode returnType = correctToGenericsSpecRecurse(genericsSpec, forwarderMethod.getReturnType()); Statement delegate = next == null ? createSuperFallback(forwarderMethod, returnType) : createDelegatingForwarder(forwarderMethod, next); MethodNode methodNode = targetNode.addMethod(forwarderName, Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, returnType, superForwarderParams, ClassNode.EMPTY_ARRAY, delegate); methodNode.setGenericsTypes(forwarderMethod.getGenericsTypes()); } } } }
public class class_name { private static void doCreateSuperForwarder(ClassNode targetNode, MethodNode forwarderMethod, ClassNode[] interfacesToGenerateForwarderFor, Map<String,ClassNode> genericsSpec) { Parameter[] parameters = forwarderMethod.getParameters(); Parameter[] superForwarderParams = new Parameter[parameters.length]; for (int i = 0; i < parameters.length; i++) { Parameter parameter = parameters[i]; ClassNode originType = parameter.getOriginType(); superForwarderParams[i] = new Parameter(correctToGenericsSpecRecurse(genericsSpec, originType), parameter.getName()); // depends on control dependency: [for], data = [i] } for (int i = 0; i < interfacesToGenerateForwarderFor.length; i++) { final ClassNode current = interfacesToGenerateForwarderFor[i]; final ClassNode next = i < interfacesToGenerateForwarderFor.length - 1 ? interfacesToGenerateForwarderFor[i + 1] : null; String forwarderName = Traits.getSuperTraitMethodName(current, forwarderMethod.getName()); if (targetNode.getDeclaredMethod(forwarderName, superForwarderParams) == null) { ClassNode returnType = correctToGenericsSpecRecurse(genericsSpec, forwarderMethod.getReturnType()); Statement delegate = next == null ? createSuperFallback(forwarderMethod, returnType) : createDelegatingForwarder(forwarderMethod, next); MethodNode methodNode = targetNode.addMethod(forwarderName, Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, returnType, superForwarderParams, ClassNode.EMPTY_ARRAY, delegate); methodNode.setGenericsTypes(forwarderMethod.getGenericsTypes()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public int[] toIntArray () { int[] vals = new int[size()]; int ii = 0; for (Interator it = interator(); (ii < Integer.MAX_VALUE) && it.hasNext(); ) { vals[ii++] = it.nextInt(); } return vals; } }
public class class_name { public int[] toIntArray () { int[] vals = new int[size()]; int ii = 0; for (Interator it = interator(); (ii < Integer.MAX_VALUE) && it.hasNext(); ) { vals[ii++] = it.nextInt(); // depends on control dependency: [for], data = [it] } return vals; } }
public class class_name { public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> listHubSchemasWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { return listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName) .concatMap(new Func1<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>, Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>>>() { @Override public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> call(ServiceResponse<Page<SyncFullSchemaPropertiesInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listHubSchemasNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> listHubSchemasWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { return listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName) .concatMap(new Func1<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>, Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>>>() { @Override public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> call(ServiceResponse<Page<SyncFullSchemaPropertiesInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listHubSchemasNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public List<NodeTypeData> getAllNodeTypes() { if (!haveTypes) try { return super.getAllNodeTypes(); } catch (RepositoryException e) { LOG.error(e.getLocalizedMessage(), e); } return hierarchy.getAllNodeTypes(); } }
public class class_name { public List<NodeTypeData> getAllNodeTypes() { if (!haveTypes) try { return super.getAllNodeTypes(); // depends on control dependency: [try], data = [none] } catch (RepositoryException e) { LOG.error(e.getLocalizedMessage(), e); } // depends on control dependency: [catch], data = [none] return hierarchy.getAllNodeTypes(); } }
public class class_name { public static String hexEncode(final byte[] data) { try { val result = Hex.encodeHex(data); return new String(result); } catch (final Exception e) { return null; } } }
public class class_name { public static String hexEncode(final byte[] data) { try { val result = Hex.encodeHex(data); return new String(result); // depends on control dependency: [try], data = [none] } catch (final Exception e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void doAjax( StaplerRequest req, StaplerResponse rsp, @Header("n") String n ) throws IOException, ServletException { rsp.setContentType("text/html;charset=UTF-8"); // pick up builds to send back List<T> items = new ArrayList<>(); if (n != null) { String nn=null; // we'll compute next n here // list up all builds >=n. for (T t : baseList) { if(adapter.compare(t,n)>=0) { items.add(t); if(adapter.isBuilding(t)) nn = adapter.getKey(t); // the next fetch should start from youngest build in progress } else break; } if (nn==null) { if (items.isEmpty()) { // nothing to report back. next fetch should retry the same 'n' nn=n; } else { // every record fetched this time is frozen. next fetch should start from the next build nn=adapter.getNextKey(adapter.getKey(items.get(0))); } } baseList = items; rsp.setHeader("n",nn); firstTransientBuildKey = nn; // all builds >= nn should be marked transient } HistoryPageFilter page = getHistoryPageFilter(); req.getView(page,"ajaxBuildHistory.jelly").forward(req,rsp); } }
public class class_name { public void doAjax( StaplerRequest req, StaplerResponse rsp, @Header("n") String n ) throws IOException, ServletException { rsp.setContentType("text/html;charset=UTF-8"); // pick up builds to send back List<T> items = new ArrayList<>(); if (n != null) { String nn=null; // we'll compute next n here // list up all builds >=n. for (T t : baseList) { if(adapter.compare(t,n)>=0) { items.add(t); // depends on control dependency: [if], data = [none] if(adapter.isBuilding(t)) nn = adapter.getKey(t); // the next fetch should start from youngest build in progress } else break; } if (nn==null) { if (items.isEmpty()) { // nothing to report back. next fetch should retry the same 'n' nn=n; } else { // every record fetched this time is frozen. next fetch should start from the next build nn=adapter.getNextKey(adapter.getKey(items.get(0))); } } baseList = items; rsp.setHeader("n",nn); firstTransientBuildKey = nn; // all builds >= nn should be marked transient } HistoryPageFilter page = getHistoryPageFilter(); req.getView(page,"ajaxBuildHistory.jelly").forward(req,rsp); } }
public class class_name { public void appendSourceStringForChildren(StringBuilder sb) { for (N child : children) { sb.append(child.toSourceString()); } } }
public class class_name { public void appendSourceStringForChildren(StringBuilder sb) { for (N child : children) { sb.append(child.toSourceString()); // depends on control dependency: [for], data = [child] } } }
public class class_name { private boolean isRepeated(final Annotation targetAnno) { try { final Method method = targetAnno.getClass().getMethod("value"); // 値のクラスタイプがアノテーションの配列かどうかのチェック final Class<?> returnType = method.getReturnType(); if(!(returnType.isArray() && Annotation.class.isAssignableFrom(returnType.getComponentType()))) { return false; } final Annotation[] annos = (Annotation[]) method.invoke(targetAnno); if(annos.length == 0) { return false; } // @Repetableアノテーションが付与されているかどうか if(annos[0].annotationType().getAnnotation(Repeatable.class) != null) { return true; } } catch (Exception e) { } return false; } }
public class class_name { private boolean isRepeated(final Annotation targetAnno) { try { final Method method = targetAnno.getClass().getMethod("value"); // 値のクラスタイプがアノテーションの配列かどうかのチェック final Class<?> returnType = method.getReturnType(); if(!(returnType.isArray() && Annotation.class.isAssignableFrom(returnType.getComponentType()))) { return false; // depends on control dependency: [if], data = [none] } final Annotation[] annos = (Annotation[]) method.invoke(targetAnno); if(annos.length == 0) { return false; // depends on control dependency: [if], data = [none] } // @Repetableアノテーションが付与されているかどうか if(annos[0].annotationType().getAnnotation(Repeatable.class) != null) { return true; // depends on control dependency: [if], data = [none] } } catch (Exception e) { } // depends on control dependency: [catch], data = [none] return false; } }
public class class_name { public static double hypergeometric(int k, int n, int Kp, int Np) { if(k<0 || n<0 || Kp<0 || Np<0) { throw new IllegalArgumentException("All the parameters must be positive."); } Kp = Math.max(k, Kp); Np = Math.max(n, Np); /* //slow! $probability=StatsUtilities::combination($Kp,$k)*StatsUtilities::combination($Np-$Kp,$n-$k)/StatsUtilities::combination($Np,$n); */ //fast and can handle large numbers //Cdf(k)-Cdf(k-1) double probability = approxHypergeometricCdf(k,n,Kp,Np); if(k>0) { probability -= approxHypergeometricCdf(k-1,n,Kp,Np); } return probability; } }
public class class_name { public static double hypergeometric(int k, int n, int Kp, int Np) { if(k<0 || n<0 || Kp<0 || Np<0) { throw new IllegalArgumentException("All the parameters must be positive."); } Kp = Math.max(k, Kp); Np = Math.max(n, Np); /* //slow! $probability=StatsUtilities::combination($Kp,$k)*StatsUtilities::combination($Np-$Kp,$n-$k)/StatsUtilities::combination($Np,$n); */ //fast and can handle large numbers //Cdf(k)-Cdf(k-1) double probability = approxHypergeometricCdf(k,n,Kp,Np); if(k>0) { probability -= approxHypergeometricCdf(k-1,n,Kp,Np); // depends on control dependency: [if], data = [(k] } return probability; } }
public class class_name { private void createKeysIfNotExist() { if (!keyPairExists()) { try { final KeyPair keyPair = generateKeyPair(); save(keyPair); } catch (NoSuchAlgorithmException e) { LOGGER.error("An error occurred generating new keypair"); LOGGER.error(e.getMessage()); } catch (IOException e) { LOGGER.error("An error occurred saving newly generated keypair"); LOGGER.error(e.getMessage()); } } if (!secretKeyExists()) { try { final SecretKey secretKey = generateSecretKey(); save(secretKey); } catch (NoSuchAlgorithmException e) { LOGGER.error("An error occurred generating new secret key"); LOGGER.error(e.getMessage()); } catch (IOException e) { LOGGER.error("An error occurred saving newly generated secret key"); LOGGER.error(e.getMessage()); } } } }
public class class_name { private void createKeysIfNotExist() { if (!keyPairExists()) { try { final KeyPair keyPair = generateKeyPair(); save(keyPair); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException e) { LOGGER.error("An error occurred generating new keypair"); LOGGER.error(e.getMessage()); } catch (IOException e) { // depends on control dependency: [catch], data = [none] LOGGER.error("An error occurred saving newly generated keypair"); LOGGER.error(e.getMessage()); } // depends on control dependency: [catch], data = [none] } if (!secretKeyExists()) { try { final SecretKey secretKey = generateSecretKey(); save(secretKey); // depends on control dependency: [try], data = [none] } catch (NoSuchAlgorithmException e) { LOGGER.error("An error occurred generating new secret key"); LOGGER.error(e.getMessage()); } catch (IOException e) { // depends on control dependency: [catch], data = [none] LOGGER.error("An error occurred saving newly generated secret key"); LOGGER.error(e.getMessage()); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public synchronized List<TaskStatus> getNonRunningTasks() { List<TaskStatus> result = new ArrayList<TaskStatus>(tasks.size()); for(Map.Entry<TaskAttemptID, TaskInProgress> task: tasks.entrySet()) { if (!runningTasks.containsKey(task.getKey())) { result.add(task.getValue().getStatus()); } } return result; } }
public class class_name { public synchronized List<TaskStatus> getNonRunningTasks() { List<TaskStatus> result = new ArrayList<TaskStatus>(tasks.size()); for(Map.Entry<TaskAttemptID, TaskInProgress> task: tasks.entrySet()) { if (!runningTasks.containsKey(task.getKey())) { result.add(task.getValue().getStatus()); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public String getDisplayValue(Locale loc, Object ob) { if( ob == null ) { return ""; } if( ob instanceof Translator ) { @SuppressWarnings("rawtypes") Translation trans = ((Translator)ob).get(loc); if( trans == null ) { return null; } return getDisplayValue(trans.getData()); } else { return getDisplayValue(ob); } } }
public class class_name { public String getDisplayValue(Locale loc, Object ob) { if( ob == null ) { return ""; // depends on control dependency: [if], data = [none] } if( ob instanceof Translator ) { @SuppressWarnings("rawtypes") Translation trans = ((Translator)ob).get(loc); if( trans == null ) { return null; // depends on control dependency: [if], data = [none] } return getDisplayValue(trans.getData()); // depends on control dependency: [if], data = [none] } else { return getDisplayValue(ob); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setTaskIds(java.util.Collection<String> taskIds) { if (taskIds == null) { this.taskIds = null; return; } this.taskIds = new com.amazonaws.internal.SdkInternalList<String>(taskIds); } }
public class class_name { public void setTaskIds(java.util.Collection<String> taskIds) { if (taskIds == null) { this.taskIds = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.taskIds = new com.amazonaws.internal.SdkInternalList<String>(taskIds); } }
public class class_name { @SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "Plugin loading happens only once on Jenkins startup") protected static void addDependencies(URL hpiResUrl, String fromPath, Set<URL> dependencySet) throws URISyntaxException, MalformedURLException { if (dependencySet.contains(hpiResUrl)) { return; } Manifest manifest = parsePluginManifest(hpiResUrl); String dependencySpec = manifest.getMainAttributes().getValue("Plugin-Dependencies"); if (dependencySpec != null) { String[] dependencyTokens = dependencySpec.split(","); ServletContext context = Jenkins.getActiveInstance().servletContext; for (String dependencyToken : dependencyTokens) { if (dependencyToken.endsWith(";resolution:=optional")) { // ignore optional dependencies continue; } String[] artifactIdVersionPair = dependencyToken.split(":"); String artifactId = artifactIdVersionPair[0]; VersionNumber dependencyVersion = new VersionNumber(artifactIdVersionPair[1]); PluginManager manager = Jenkins.getActiveInstance().getPluginManager(); VersionNumber installedVersion = manager.getPluginVersion(manager.rootDir, artifactId); if (installedVersion != null && !installedVersion.isOlderThan(dependencyVersion)) { // Do not downgrade dependencies that are already installed. continue; } URL dependencyURL = context.getResource(fromPath + "/" + artifactId + ".hpi"); if (dependencyURL == null) { // Maybe bundling has changed .jpi files dependencyURL = context.getResource(fromPath + "/" + artifactId + ".jpi"); } if (dependencyURL != null) { // And transitive deps... addDependencies(dependencyURL, fromPath, dependencySet); // And then add the current plugin dependencySet.add(dependencyURL); } } } } }
public class class_name { @SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "Plugin loading happens only once on Jenkins startup") protected static void addDependencies(URL hpiResUrl, String fromPath, Set<URL> dependencySet) throws URISyntaxException, MalformedURLException { if (dependencySet.contains(hpiResUrl)) { return; } Manifest manifest = parsePluginManifest(hpiResUrl); String dependencySpec = manifest.getMainAttributes().getValue("Plugin-Dependencies"); if (dependencySpec != null) { String[] dependencyTokens = dependencySpec.split(","); ServletContext context = Jenkins.getActiveInstance().servletContext; for (String dependencyToken : dependencyTokens) { if (dependencyToken.endsWith(";resolution:=optional")) { // ignore optional dependencies continue; } String[] artifactIdVersionPair = dependencyToken.split(":"); String artifactId = artifactIdVersionPair[0]; VersionNumber dependencyVersion = new VersionNumber(artifactIdVersionPair[1]); PluginManager manager = Jenkins.getActiveInstance().getPluginManager(); VersionNumber installedVersion = manager.getPluginVersion(manager.rootDir, artifactId); if (installedVersion != null && !installedVersion.isOlderThan(dependencyVersion)) { // Do not downgrade dependencies that are already installed. continue; } URL dependencyURL = context.getResource(fromPath + "/" + artifactId + ".hpi"); if (dependencyURL == null) { // Maybe bundling has changed .jpi files dependencyURL = context.getResource(fromPath + "/" + artifactId + ".jpi"); // depends on control dependency: [if], data = [none] } if (dependencyURL != null) { // And transitive deps... addDependencies(dependencyURL, fromPath, dependencySet); // depends on control dependency: [if], data = [(dependencyURL] // And then add the current plugin dependencySet.add(dependencyURL); // depends on control dependency: [if], data = [(dependencyURL] } } } } }
public class class_name { public static void set_goals( String msg, boolean oom , long bytes) { // Our best guess of free memory, as of the last GC cycle final long heapUsed = Boot.HEAP_USED_AT_LAST_GC; final long timeGC = Boot.TIME_AT_LAST_GC; final long freeHeap = MEM_MAX - heapUsed; assert freeHeap >= 0 : "I am really confused about the heap usage; MEM_MAX="+MEM_MAX+" heapUsed="+heapUsed; // Current memory held in the K/V store. final long cacheUsage = myHisto.histo(false)._cached; // Our best guess of POJO object usage: Heap_used minus cache used final long pojoUsedGC = Math.max(heapUsed - cacheUsage,0); // Block allocations if: // the cache is > 7/8 MEM_MAX, OR // we cannot allocate an equal amount of POJOs, pojoUsedGC > freeHeap. // Decay POJOS_USED by 1/8th every 5 sec: assume we got hit with a single // large allocation which is not repeating - so we do not need to have // double the POJO amount. // Keep at least 1/8th heap for caching. // Emergency-clean the cache down to the blocking level. long d = MEM_CRITICAL; // Decay POJO amount long p = pojoUsedGC; long age = (System.currentTimeMillis() - timeGC); // Age since last FullGC age = Math.min(age,10*60*1000 ); // Clip at 10mins while( (age-=5000) > 0 ) p = p-(p>>3); // Decay effective POJO by 1/8th every 5sec d -= 2*p - bytes; // Allow for the effective POJO, and again to throttle GC rate d = Math.max(d,MEM_MAX>>3); // Keep at least 1/8th heap H2O.Cleaner.DESIRED = d; String m=""; if( cacheUsage > H2O.Cleaner.DESIRED ) { m = (CAN_ALLOC?"Blocking! ":"blocked: "); if( oom ) setMemLow(); // Stop allocations; trigger emergency clean Boot.kick_store_cleaner(); } else { // Else we are not *emergency* cleaning, but may be lazily cleaning. setMemGood(); // Cache is as low as we'll go; unblock if( oom ) { // But still have an OOM? m = "Unblock allocations; cache emptied but memory is low: "; // Means the heap is full of uncached POJO's - which cannot be spilled. // Here we enter the zone of possibly dieing for OOM. There's no point // in blocking allocations, as no more memory can be freed by more // cache-flushing. Might as well proceed on a "best effort" basis. Log.warn(Sys.CLEAN,m+" OOM but cache is emptied: MEM_MAX = " + PrettyPrint.bytes(MEM_MAX) + ", DESIRED_CACHE = " + PrettyPrint.bytes(d) +", CACHE = " + PrettyPrint.bytes(cacheUsage) + ", POJO = " + PrettyPrint.bytes(p) + ", this request bytes = " + PrettyPrint.bytes(bytes)); } else { m = "MemGood: "; } } // No logging if under memory pressure: can deadlock the cleaner thread if( Log.flag(Sys.CLEAN) ) { String s = m+msg+", HEAP_LAST_GC="+(heapUsed>>20)+"M, KV="+(cacheUsage>>20)+"M, POJO="+(pojoUsedGC>>20)+"M, free="+(freeHeap>>20)+"M, MAX="+(MEM_MAX>>20)+"M, DESIRED="+(H2O.Cleaner.DESIRED>>20)+"M"+(oom?" OOM!":" NO-OOM"); if( CAN_ALLOC ) Log.debug(Sys.CLEAN ,s); else Log.unwrap(System.err,s); } } }
public class class_name { public static void set_goals( String msg, boolean oom , long bytes) { // Our best guess of free memory, as of the last GC cycle final long heapUsed = Boot.HEAP_USED_AT_LAST_GC; final long timeGC = Boot.TIME_AT_LAST_GC; final long freeHeap = MEM_MAX - heapUsed; assert freeHeap >= 0 : "I am really confused about the heap usage; MEM_MAX="+MEM_MAX+" heapUsed="+heapUsed; // Current memory held in the K/V store. final long cacheUsage = myHisto.histo(false)._cached; // Our best guess of POJO object usage: Heap_used minus cache used final long pojoUsedGC = Math.max(heapUsed - cacheUsage,0); // Block allocations if: // the cache is > 7/8 MEM_MAX, OR // we cannot allocate an equal amount of POJOs, pojoUsedGC > freeHeap. // Decay POJOS_USED by 1/8th every 5 sec: assume we got hit with a single // large allocation which is not repeating - so we do not need to have // double the POJO amount. // Keep at least 1/8th heap for caching. // Emergency-clean the cache down to the blocking level. long d = MEM_CRITICAL; // Decay POJO amount long p = pojoUsedGC; long age = (System.currentTimeMillis() - timeGC); // Age since last FullGC age = Math.min(age,10*60*1000 ); // Clip at 10mins while( (age-=5000) > 0 ) p = p-(p>>3); // Decay effective POJO by 1/8th every 5sec d -= 2*p - bytes; // Allow for the effective POJO, and again to throttle GC rate d = Math.max(d,MEM_MAX>>3); // Keep at least 1/8th heap H2O.Cleaner.DESIRED = d; String m=""; if( cacheUsage > H2O.Cleaner.DESIRED ) { m = (CAN_ALLOC?"Blocking! ":"blocked: "); // depends on control dependency: [if], data = [none] if( oom ) setMemLow(); // Stop allocations; trigger emergency clean Boot.kick_store_cleaner(); // depends on control dependency: [if], data = [none] } else { // Else we are not *emergency* cleaning, but may be lazily cleaning. setMemGood(); // Cache is as low as we'll go; unblock // depends on control dependency: [if], data = [none] if( oom ) { // But still have an OOM? m = "Unblock allocations; cache emptied but memory is low: "; // depends on control dependency: [if], data = [none] // Means the heap is full of uncached POJO's - which cannot be spilled. // Here we enter the zone of possibly dieing for OOM. There's no point // in blocking allocations, as no more memory can be freed by more // cache-flushing. Might as well proceed on a "best effort" basis. Log.warn(Sys.CLEAN,m+" OOM but cache is emptied: MEM_MAX = " + PrettyPrint.bytes(MEM_MAX) + ", DESIRED_CACHE = " + PrettyPrint.bytes(d) +", CACHE = " + PrettyPrint.bytes(cacheUsage) + ", POJO = " + PrettyPrint.bytes(p) + ", this request bytes = " + PrettyPrint.bytes(bytes)); // depends on control dependency: [if], data = [none] } else { m = "MemGood: "; // depends on control dependency: [if], data = [none] } } // No logging if under memory pressure: can deadlock the cleaner thread if( Log.flag(Sys.CLEAN) ) { String s = m+msg+", HEAP_LAST_GC="+(heapUsed>>20)+"M, KV="+(cacheUsage>>20)+"M, POJO="+(pojoUsedGC>>20)+"M, free="+(freeHeap>>20)+"M, MAX="+(MEM_MAX>>20)+"M, DESIRED="+(H2O.Cleaner.DESIRED>>20)+"M"+(oom?" OOM!":" NO-OOM"); if( CAN_ALLOC ) Log.debug(Sys.CLEAN ,s); else Log.unwrap(System.err,s); } } }
public class class_name { @Override public void removeByUuid_C(String uuid, long companyId) { for (CommerceVirtualOrderItem commerceVirtualOrderItem : findByUuid_C( uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceVirtualOrderItem); } } }
public class class_name { @Override public void removeByUuid_C(String uuid, long companyId) { for (CommerceVirtualOrderItem commerceVirtualOrderItem : findByUuid_C( uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceVirtualOrderItem); // depends on control dependency: [for], data = [commerceVirtualOrderItem] } } }
public class class_name { public com.google.protobuf.ByteString getResponseBodyBytes() { java.lang.Object ref = responseBody_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); responseBody_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } }
public class class_name { public com.google.protobuf.ByteString getResponseBodyBytes() { java.lang.Object ref = responseBody_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); responseBody_ = b; // depends on control dependency: [if], data = [none] return b; // depends on control dependency: [if], data = [none] } else { return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Class[] getParameters(String signature) throws FacesException { ArrayList<Class> params = new ArrayList<Class>(); // Signature is of the form // <return-type> S <method-name S? '(' // < <arg-type> ( ',' <arg-type> )* )? ')' int start = signature.indexOf('(') + 1; boolean lastArg = false; while (true) { int p = signature.indexOf(',', start); if (p < 0) { p = signature.indexOf(')', start); if (p < 0) { throw new FacesException("Invalid method signature:" + signature); } lastArg = true; } String arg = signature.substring(start, p).trim(); if (!"".equals(arg)) { try { params.add(ClassUtils.javaDefaultTypeToClass(arg)); } catch (ClassNotFoundException e) { throw new FacesException("Invalid method signature:" + signature); } } if (lastArg) { break; } start = p + 1; } return params.toArray(new Class[params.size()]); } }
public class class_name { public static Class[] getParameters(String signature) throws FacesException { ArrayList<Class> params = new ArrayList<Class>(); // Signature is of the form // <return-type> S <method-name S? '(' // < <arg-type> ( ',' <arg-type> )* )? ')' int start = signature.indexOf('(') + 1; boolean lastArg = false; while (true) { int p = signature.indexOf(',', start); if (p < 0) { p = signature.indexOf(')', start); // depends on control dependency: [if], data = [none] if (p < 0) { throw new FacesException("Invalid method signature:" + signature); } lastArg = true; // depends on control dependency: [if], data = [none] } String arg = signature.substring(start, p).trim(); if (!"".equals(arg)) { try { params.add(ClassUtils.javaDefaultTypeToClass(arg)); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { throw new FacesException("Invalid method signature:" + signature); } // depends on control dependency: [catch], data = [none] } if (lastArg) { break; } start = p + 1; } return params.toArray(new Class[params.size()]); } }
public class class_name { @Override public ExitStatus afterStep(StepExecution stepExecution) { ExitStatus status = stepExecution.getExitStatus(); List<String> errors = getErrors(); if (errors.size() > 0) { status = status.and(ExitStatus.FAILED); for (String error : errors) { status = status.addExitDescription(error); } resetContextState(); stepExecution.upgradeStatus(BatchStatus.FAILED); stepExecution.setTerminateOnly(); log.error("manifest verification finished: step_execution_id={} " + "job_execution_id={} restore_id={} exit_status=\"{}\"", stepExecution.getId(), stepExecution.getJobExecutionId(), restorationId, status); } else { log.info("manifest verification finished:step_execution_id={} " + "job_execution_id={} restore_id={} exit_status=\"{}\"", stepExecution.getId(), stepExecution.getJobExecutionId(), restorationId, status); status = status.and(ExitStatus.COMPLETED); } return status; } }
public class class_name { @Override public ExitStatus afterStep(StepExecution stepExecution) { ExitStatus status = stepExecution.getExitStatus(); List<String> errors = getErrors(); if (errors.size() > 0) { status = status.and(ExitStatus.FAILED); // depends on control dependency: [if], data = [none] for (String error : errors) { status = status.addExitDescription(error); // depends on control dependency: [for], data = [error] } resetContextState(); // depends on control dependency: [if], data = [none] stepExecution.upgradeStatus(BatchStatus.FAILED); // depends on control dependency: [if], data = [none] stepExecution.setTerminateOnly(); // depends on control dependency: [if], data = [none] log.error("manifest verification finished: step_execution_id={} " + "job_execution_id={} restore_id={} exit_status=\"{}\"", stepExecution.getId(), stepExecution.getJobExecutionId(), restorationId, status); // depends on control dependency: [if], data = [none] } else { log.info("manifest verification finished:step_execution_id={} " + "job_execution_id={} restore_id={} exit_status=\"{}\"", stepExecution.getId(), stepExecution.getJobExecutionId(), restorationId, status); // depends on control dependency: [if], data = [none] status = status.and(ExitStatus.COMPLETED); // depends on control dependency: [if], data = [none] } return status; } }
public class class_name { private void addParams(Map<String, Object> dbServiceParams) { if (dbServiceParams != null) { for (String paramName : dbServiceParams.keySet()) { m_serviceParamMap.put(paramName, dbServiceParams.get(paramName)); } } } }
public class class_name { private void addParams(Map<String, Object> dbServiceParams) { if (dbServiceParams != null) { for (String paramName : dbServiceParams.keySet()) { m_serviceParamMap.put(paramName, dbServiceParams.get(paramName)); // depends on control dependency: [for], data = [paramName] } } } }
public class class_name { public static String[] getMethodVariableNames(final Class<?> clazz, final String targetMethodName, final Class<?>[] types) { CtClass cc; CtMethod cm = null; try { if (null == CLASS_POOL.find(clazz.getName())) { CLASS_POOL.insertClassPath(new ClassClassPath(clazz)); } cc = CLASS_POOL.get(clazz.getName()); final CtClass[] ptypes = new CtClass[types.length]; for (int i = 0; i < ptypes.length; i++) { ptypes[i] = CLASS_POOL.get(types[i].getName()); } cm = cc.getDeclaredMethod(targetMethodName, ptypes); } catch (final NotFoundException e) { LOGGER.log(Level.ERROR, "Get method variable names failed", e); } if (null == cm) { return new String[types.length]; } final MethodInfo methodInfo = cm.getMethodInfo(); final CodeAttribute codeAttribute = methodInfo.getCodeAttribute(); final LocalVariableAttribute attr = (LocalVariableAttribute) codeAttribute.getAttribute(LocalVariableAttribute.tag); String[] variableNames = new String[0]; try { variableNames = new String[cm.getParameterTypes().length]; } catch (final NotFoundException e) { LOGGER.log(Level.ERROR, "Get method variable names failed", e); } // final int staticIndex = Modifier.isStatic(cm.getModifiers()) ? 0 : 1; int j = -1; String variableName = null; Boolean ifkill = false; while (!"this".equals(variableName)) { j++; variableName = attr.variableName(j); // to prevent heap error when there being some unknown reasons to resolve the VariableNames if (j > 99) { LOGGER.log(Level.WARN, "Maybe resolve to VariableNames error [class=" + clazz.getName() + ", targetMethodName=" + targetMethodName + ']'); ifkill = true; break; } } if (!ifkill) { for (int i = 0; i < variableNames.length; i++) { variableNames[i] = attr.variableName(++j); } } return variableNames; } }
public class class_name { public static String[] getMethodVariableNames(final Class<?> clazz, final String targetMethodName, final Class<?>[] types) { CtClass cc; CtMethod cm = null; try { if (null == CLASS_POOL.find(clazz.getName())) { CLASS_POOL.insertClassPath(new ClassClassPath(clazz)); // depends on control dependency: [if], data = [none] } cc = CLASS_POOL.get(clazz.getName()); // depends on control dependency: [try], data = [none] final CtClass[] ptypes = new CtClass[types.length]; for (int i = 0; i < ptypes.length; i++) { ptypes[i] = CLASS_POOL.get(types[i].getName()); // depends on control dependency: [for], data = [i] } cm = cc.getDeclaredMethod(targetMethodName, ptypes); // depends on control dependency: [try], data = [none] } catch (final NotFoundException e) { LOGGER.log(Level.ERROR, "Get method variable names failed", e); } // depends on control dependency: [catch], data = [none] if (null == cm) { return new String[types.length]; // depends on control dependency: [if], data = [none] } final MethodInfo methodInfo = cm.getMethodInfo(); final CodeAttribute codeAttribute = methodInfo.getCodeAttribute(); final LocalVariableAttribute attr = (LocalVariableAttribute) codeAttribute.getAttribute(LocalVariableAttribute.tag); String[] variableNames = new String[0]; try { variableNames = new String[cm.getParameterTypes().length]; // depends on control dependency: [try], data = [none] } catch (final NotFoundException e) { LOGGER.log(Level.ERROR, "Get method variable names failed", e); } // depends on control dependency: [catch], data = [none] // final int staticIndex = Modifier.isStatic(cm.getModifiers()) ? 0 : 1; int j = -1; String variableName = null; Boolean ifkill = false; while (!"this".equals(variableName)) { j++; // depends on control dependency: [while], data = [none] variableName = attr.variableName(j); // depends on control dependency: [while], data = [none] // to prevent heap error when there being some unknown reasons to resolve the VariableNames if (j > 99) { LOGGER.log(Level.WARN, "Maybe resolve to VariableNames error [class=" + clazz.getName() + ", targetMethodName=" + targetMethodName + ']'); // depends on control dependency: [if], data = [none] ifkill = true; // depends on control dependency: [if], data = [none] break; } } if (!ifkill) { for (int i = 0; i < variableNames.length; i++) { variableNames[i] = attr.variableName(++j); // depends on control dependency: [for], data = [i] } } return variableNames; } }
public class class_name { private int[] getGenotypesReorderingMap(int numAllele, int[] alleleMap) { int numAlleles = alleleMap.length; // int ploidy = 2; int key = numAllele * 100 + numAlleles; int[] map = genotypeReorderMapCache.get(key); if (map != null) { return map; } else { ArrayList<Integer> mapList = new ArrayList<>(); for (int originalA2 = 0; originalA2 < alleleMap.length; originalA2++) { int newA2 = ArrayUtils.indexOf(alleleMap, originalA2); for (int originalA1 = 0; originalA1 <= originalA2; originalA1++) { int newA1 = ArrayUtils.indexOf(alleleMap, originalA1); if (newA1 <= newA2) { mapList.add((newA2 * (newA2 + 1) / 2 + newA1)); } else { mapList.add((newA1 * (newA1 + 1) / 2 + newA2)); } } } map = new int[mapList.size()]; for (int i = 0; i < mapList.size(); i++) { map[i] = mapList.get(i); } genotypeReorderMapCache.put(key, map); return map; } } }
public class class_name { private int[] getGenotypesReorderingMap(int numAllele, int[] alleleMap) { int numAlleles = alleleMap.length; // int ploidy = 2; int key = numAllele * 100 + numAlleles; int[] map = genotypeReorderMapCache.get(key); if (map != null) { return map; // depends on control dependency: [if], data = [none] } else { ArrayList<Integer> mapList = new ArrayList<>(); for (int originalA2 = 0; originalA2 < alleleMap.length; originalA2++) { int newA2 = ArrayUtils.indexOf(alleleMap, originalA2); for (int originalA1 = 0; originalA1 <= originalA2; originalA1++) { int newA1 = ArrayUtils.indexOf(alleleMap, originalA1); if (newA1 <= newA2) { mapList.add((newA2 * (newA2 + 1) / 2 + newA1)); // depends on control dependency: [if], data = [none] } else { mapList.add((newA1 * (newA1 + 1) / 2 + newA2)); // depends on control dependency: [if], data = [(newA1] } } } map = new int[mapList.size()]; // depends on control dependency: [if], data = [none] for (int i = 0; i < mapList.size(); i++) { map[i] = mapList.get(i); // depends on control dependency: [for], data = [i] } genotypeReorderMapCache.put(key, map); // depends on control dependency: [if], data = [none] return map; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Nonnull private static String _loadConvert (@Nonnull final char [] aIn, final int nOfs, final int nLen, @Nonnull final char [] aConvBuf) { int nCurOfs = nOfs; char [] aOut; if (aConvBuf.length < nLen) { int nNewLen = nLen * 2; if (nNewLen < 0) nNewLen = Integer.MAX_VALUE; aOut = new char [nNewLen]; } else aOut = aConvBuf; char aChar; int nOutLen = 0; final int nEndOfs = nCurOfs + nLen; while (nCurOfs < nEndOfs) { aChar = aIn[nCurOfs++]; if (aChar == '\\') { aChar = aIn[nCurOfs++]; if (aChar == 'u') { // Read the xxxx int nValue = 0; for (int i = 0; i < 4; i++) { aChar = aIn[nCurOfs++]; switch (aChar) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': nValue = (nValue << 4) + aChar - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': nValue = (nValue << 4) + 10 + aChar - 'a'; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': nValue = (nValue << 4) + 10 + aChar - 'A'; break; default: throw new IllegalArgumentException ("Malformed \\uxxxx encoding."); } } aOut[nOutLen++] = (char) nValue; } else { if (aChar == 't') aChar = '\t'; else if (aChar == 'r') aChar = '\r'; else if (aChar == 'n') aChar = '\n'; else if (aChar == 'f') aChar = '\f'; aOut[nOutLen++] = aChar; } } else { aOut[nOutLen++] = aChar; } } return new String (aOut, 0, nOutLen); } }
public class class_name { @Nonnull private static String _loadConvert (@Nonnull final char [] aIn, final int nOfs, final int nLen, @Nonnull final char [] aConvBuf) { int nCurOfs = nOfs; char [] aOut; if (aConvBuf.length < nLen) { int nNewLen = nLen * 2; if (nNewLen < 0) nNewLen = Integer.MAX_VALUE; aOut = new char [nNewLen]; // depends on control dependency: [if], data = [none] } else aOut = aConvBuf; char aChar; int nOutLen = 0; final int nEndOfs = nCurOfs + nLen; while (nCurOfs < nEndOfs) { aChar = aIn[nCurOfs++]; // depends on control dependency: [while], data = [none] if (aChar == '\\') { aChar = aIn[nCurOfs++]; // depends on control dependency: [if], data = [none] if (aChar == 'u') { // Read the xxxx int nValue = 0; for (int i = 0; i < 4; i++) { aChar = aIn[nCurOfs++]; // depends on control dependency: [for], data = [none] switch (aChar) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': nValue = (nValue << 4) + aChar - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': nValue = (nValue << 4) + 10 + aChar - 'a'; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': nValue = (nValue << 4) + 10 + aChar - 'A'; break; default: throw new IllegalArgumentException ("Malformed \\uxxxx encoding."); } } aOut[nOutLen++] = (char) nValue; // depends on control dependency: [if], data = [none] } else { if (aChar == 't') aChar = '\t'; else if (aChar == 'r') aChar = '\r'; else if (aChar == 'n') aChar = '\n'; else if (aChar == 'f') aChar = '\f'; aOut[nOutLen++] = aChar; // depends on control dependency: [if], data = [none] } } else { aOut[nOutLen++] = aChar; // depends on control dependency: [if], data = [none] } } return new String (aOut, 0, nOutLen); } }
public class class_name { void removeRegistrations(String topic) { Collection<Registration> all = registrations.remove(topic); if (all == null) { return; } for (Registration reg : all) { registrationIdMap.remove(reg.getId()); pingNotifiableEventListener(topic, reg, false); } } }
public class class_name { void removeRegistrations(String topic) { Collection<Registration> all = registrations.remove(topic); if (all == null) { return; // depends on control dependency: [if], data = [none] } for (Registration reg : all) { registrationIdMap.remove(reg.getId()); // depends on control dependency: [for], data = [reg] pingNotifiableEventListener(topic, reg, false); // depends on control dependency: [for], data = [reg] } } }
public class class_name { @Override public void open(Configuration configuration) { producer = getKafkaProducer(this.producerConfig); RuntimeContext ctx = getRuntimeContext(); if (null != flinkKafkaPartitioner) { if (flinkKafkaPartitioner instanceof FlinkKafkaDelegatePartitioner) { ((FlinkKafkaDelegatePartitioner) flinkKafkaPartitioner).setPartitions( getPartitionsByTopic(this.defaultTopicId, this.producer)); } flinkKafkaPartitioner.open(ctx.getIndexOfThisSubtask(), ctx.getNumberOfParallelSubtasks()); } LOG.info("Starting FlinkKafkaProducer ({}/{}) to produce into default topic {}", ctx.getIndexOfThisSubtask() + 1, ctx.getNumberOfParallelSubtasks(), defaultTopicId); // register Kafka metrics to Flink accumulators if (!Boolean.parseBoolean(producerConfig.getProperty(KEY_DISABLE_METRICS, "false"))) { Map<MetricName, ? extends Metric> metrics = this.producer.metrics(); if (metrics == null) { // MapR's Kafka implementation returns null here. LOG.info("Producer implementation does not support metrics"); } else { final MetricGroup kafkaMetricGroup = getRuntimeContext().getMetricGroup().addGroup("KafkaProducer"); for (Map.Entry<MetricName, ? extends Metric> metric: metrics.entrySet()) { kafkaMetricGroup.gauge(metric.getKey().name(), new KafkaMetricWrapper(metric.getValue())); } } } if (flushOnCheckpoint && !((StreamingRuntimeContext) this.getRuntimeContext()).isCheckpointingEnabled()) { LOG.warn("Flushing on checkpoint is enabled, but checkpointing is not enabled. Disabling flushing."); flushOnCheckpoint = false; } if (logFailuresOnly) { callback = new Callback() { @Override public void onCompletion(RecordMetadata metadata, Exception e) { if (e != null) { LOG.error("Error while sending record to Kafka: " + e.getMessage(), e); } acknowledgeMessage(); } }; } else { callback = new Callback() { @Override public void onCompletion(RecordMetadata metadata, Exception exception) { if (exception != null && asyncException == null) { asyncException = exception; } acknowledgeMessage(); } }; } } }
public class class_name { @Override public void open(Configuration configuration) { producer = getKafkaProducer(this.producerConfig); RuntimeContext ctx = getRuntimeContext(); if (null != flinkKafkaPartitioner) { if (flinkKafkaPartitioner instanceof FlinkKafkaDelegatePartitioner) { ((FlinkKafkaDelegatePartitioner) flinkKafkaPartitioner).setPartitions( getPartitionsByTopic(this.defaultTopicId, this.producer)); // depends on control dependency: [if], data = [none] } flinkKafkaPartitioner.open(ctx.getIndexOfThisSubtask(), ctx.getNumberOfParallelSubtasks()); // depends on control dependency: [if], data = [none] } LOG.info("Starting FlinkKafkaProducer ({}/{}) to produce into default topic {}", ctx.getIndexOfThisSubtask() + 1, ctx.getNumberOfParallelSubtasks(), defaultTopicId); // register Kafka metrics to Flink accumulators if (!Boolean.parseBoolean(producerConfig.getProperty(KEY_DISABLE_METRICS, "false"))) { Map<MetricName, ? extends Metric> metrics = this.producer.metrics(); if (metrics == null) { // MapR's Kafka implementation returns null here. LOG.info("Producer implementation does not support metrics"); // depends on control dependency: [if], data = [none] } else { final MetricGroup kafkaMetricGroup = getRuntimeContext().getMetricGroup().addGroup("KafkaProducer"); for (Map.Entry<MetricName, ? extends Metric> metric: metrics.entrySet()) { kafkaMetricGroup.gauge(metric.getKey().name(), new KafkaMetricWrapper(metric.getValue())); // depends on control dependency: [for], data = [metric] } } } if (flushOnCheckpoint && !((StreamingRuntimeContext) this.getRuntimeContext()).isCheckpointingEnabled()) { LOG.warn("Flushing on checkpoint is enabled, but checkpointing is not enabled. Disabling flushing."); // depends on control dependency: [if], data = [none] flushOnCheckpoint = false; // depends on control dependency: [if], data = [none] } if (logFailuresOnly) { callback = new Callback() { @Override public void onCompletion(RecordMetadata metadata, Exception e) { if (e != null) { LOG.error("Error while sending record to Kafka: " + e.getMessage(), e); // depends on control dependency: [if], data = [none] } acknowledgeMessage(); } }; // depends on control dependency: [if], data = [none] } else { callback = new Callback() { @Override public void onCompletion(RecordMetadata metadata, Exception exception) { if (exception != null && asyncException == null) { asyncException = exception; // depends on control dependency: [if], data = [none] } acknowledgeMessage(); } }; // depends on control dependency: [if], data = [none] } } }
public class class_name { public OrderableDBInstanceOption withAvailabilityZones(AvailabilityZone... availabilityZones) { if (this.availabilityZones == null) { setAvailabilityZones(new com.amazonaws.internal.SdkInternalList<AvailabilityZone>(availabilityZones.length)); } for (AvailabilityZone ele : availabilityZones) { this.availabilityZones.add(ele); } return this; } }
public class class_name { public OrderableDBInstanceOption withAvailabilityZones(AvailabilityZone... availabilityZones) { if (this.availabilityZones == null) { setAvailabilityZones(new com.amazonaws.internal.SdkInternalList<AvailabilityZone>(availabilityZones.length)); // depends on control dependency: [if], data = [none] } for (AvailabilityZone ele : availabilityZones) { this.availabilityZones.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static void closeQuietly(@WillClose @Nullable Closeable closeable) { try { close(closeable, true); } catch (IOException impossible) { impossible(impossible); } } }
public class class_name { public static void closeQuietly(@WillClose @Nullable Closeable closeable) { try { close(closeable, true); // depends on control dependency: [try], data = [none] } catch (IOException impossible) { impossible(impossible); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void addMethodInfo(MethodDoc method, Content dl) { ClassDoc[] intfacs = method.containingClass().interfaces(); MethodDoc overriddenMethod = method.overriddenMethod(); // Check whether there is any implementation or overridden info to be // printed. If no overridden or implementation info needs to be // printed, do not print this section. if ((intfacs.length > 0 && new ImplementedMethods(method, this.configuration).build().length > 0) || overriddenMethod != null) { MethodWriterImpl.addImplementsInfo(this, method, dl); if (overriddenMethod != null) { MethodWriterImpl.addOverridden(this, method.overriddenType(), overriddenMethod, dl); } } } }
public class class_name { private void addMethodInfo(MethodDoc method, Content dl) { ClassDoc[] intfacs = method.containingClass().interfaces(); MethodDoc overriddenMethod = method.overriddenMethod(); // Check whether there is any implementation or overridden info to be // printed. If no overridden or implementation info needs to be // printed, do not print this section. if ((intfacs.length > 0 && new ImplementedMethods(method, this.configuration).build().length > 0) || overriddenMethod != null) { MethodWriterImpl.addImplementsInfo(this, method, dl); // depends on control dependency: [if], data = [none] if (overriddenMethod != null) { MethodWriterImpl.addOverridden(this, method.overriddenType(), overriddenMethod, dl); // depends on control dependency: [if], data = [none] } } } }
public class class_name { protected void loadLocalDatabases() { final List<String> dbs = new ArrayList<String>(serverInstance.getAvailableStorageNames().keySet()); Collections.sort(dbs); for (final String databaseName : dbs) { if (messageService.getDatabase(databaseName) == null) { ODistributedServerLog.info(this, nodeName, null, DIRECTION.NONE, "Opening database '%s'...", databaseName); // INIT THE STORAGE final ODistributedStorage stg = getStorage(databaseName); executeInDistributedDatabaseLock(databaseName, 60000, null, new OCallable<Object, OModifiableDistributedConfiguration>() { @Override public Object call(OModifiableDistributedConfiguration cfg) { ODistributedServerLog.info(this, nodeName, null, DIRECTION.NONE, "Current node started as %s for database '%s'", cfg.getServerRole(nodeName), databaseName); final ODistributedDatabaseImpl ddb = messageService.registerDatabase(databaseName, cfg); ddb.resume(); // 1ST NODE TO HAVE THE DATABASE cfg.addNewNodeInServerList(nodeName); // COLLECT ALL THE CLUSTERS WITH REMOVED NODE AS OWNER reassignClustersOwnership(nodeName, databaseName, cfg, true); try { ddb.getSyncConfiguration().setLastLSN(nodeName, ((OAbstractPaginatedStorage) stg.getUnderlying()).getLSN(), false); } catch (IOException e) { ODistributedServerLog .error(this, nodeName, null, DIRECTION.NONE, "Error on saving distributed LSN for database '%s' (err=%s).", databaseName, e.getMessage()); } ddb.setOnline(); return null; } }); } } } }
public class class_name { protected void loadLocalDatabases() { final List<String> dbs = new ArrayList<String>(serverInstance.getAvailableStorageNames().keySet()); Collections.sort(dbs); for (final String databaseName : dbs) { if (messageService.getDatabase(databaseName) == null) { ODistributedServerLog.info(this, nodeName, null, DIRECTION.NONE, "Opening database '%s'...", databaseName); // depends on control dependency: [if], data = [none] // INIT THE STORAGE final ODistributedStorage stg = getStorage(databaseName); executeInDistributedDatabaseLock(databaseName, 60000, null, new OCallable<Object, OModifiableDistributedConfiguration>() { @Override public Object call(OModifiableDistributedConfiguration cfg) { ODistributedServerLog.info(this, nodeName, null, DIRECTION.NONE, "Current node started as %s for database '%s'", cfg.getServerRole(nodeName), databaseName); final ODistributedDatabaseImpl ddb = messageService.registerDatabase(databaseName, cfg); ddb.resume(); // 1ST NODE TO HAVE THE DATABASE cfg.addNewNodeInServerList(nodeName); // COLLECT ALL THE CLUSTERS WITH REMOVED NODE AS OWNER reassignClustersOwnership(nodeName, databaseName, cfg, true); try { ddb.getSyncConfiguration().setLastLSN(nodeName, ((OAbstractPaginatedStorage) stg.getUnderlying()).getLSN(), false); // depends on control dependency: [try], data = [none] } catch (IOException e) { ODistributedServerLog .error(this, nodeName, null, DIRECTION.NONE, "Error on saving distributed LSN for database '%s' (err=%s).", databaseName, e.getMessage()); } // depends on control dependency: [catch], data = [none] ddb.setOnline(); return null; } }); // depends on control dependency: [if], data = [none] } } } }
public class class_name { boolean isDeadEnd() { if (isAccepting()) { return false; } for (Transition<DFAState<T>> next : transitions.values()) { if (next.getTo() != this) { return false; } } return true; } }
public class class_name { boolean isDeadEnd() { if (isAccepting()) { return false; // depends on control dependency: [if], data = [none] } for (Transition<DFAState<T>> next : transitions.values()) { if (next.getTo() != this) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { private void elim() { final long steps = this.limits.simpSteps; assert this.level == 0; assert !this.config.plain; if (!this.config.elim) { return; } assert this.simplifier == Simplifier.TOPSIMP; this.simplifier = Simplifier.ELIM; updateCands(); final long limit; if (this.stats.simplifications <= this.config.elmrtc) { limit = Long.MAX_VALUE; } else { limit = this.stats.steps + 10 * steps / sizePenalty(); } while (this.empty == null && !this.candsElim.empty() && this.stats.steps++ < limit) { final int cand = this.candsElim.top(); final long priority = this.candsElim.priority(cand); this.candsElim.pop(cand); if (priority == 0 || !var(cand).free() || donotelim(cand)) { continue; } backward(cand); backward(-cand); if (tryElim(cand)) { doElim(cand); } } assert this.schedule; this.schedule = false; assert this.simplifier == Simplifier.ELIM; this.simplifier = Simplifier.TOPSIMP; dumpEliminatedRedundant(); } }
public class class_name { private void elim() { final long steps = this.limits.simpSteps; assert this.level == 0; assert !this.config.plain; if (!this.config.elim) { return; } // depends on control dependency: [if], data = [none] assert this.simplifier == Simplifier.TOPSIMP; this.simplifier = Simplifier.ELIM; updateCands(); final long limit; if (this.stats.simplifications <= this.config.elmrtc) { limit = Long.MAX_VALUE; } else { // depends on control dependency: [if], data = [none] limit = this.stats.steps + 10 * steps / sizePenalty(); // depends on control dependency: [if], data = [none] } while (this.empty == null && !this.candsElim.empty() && this.stats.steps++ < limit) { final int cand = this.candsElim.top(); final long priority = this.candsElim.priority(cand); this.candsElim.pop(cand); // depends on control dependency: [while], data = [none] if (priority == 0 || !var(cand).free() || donotelim(cand)) { continue; } backward(cand); // depends on control dependency: [while], data = [none] backward(-cand); // depends on control dependency: [while], data = [none] if (tryElim(cand)) { doElim(cand); } // depends on control dependency: [if], data = [none] } assert this.schedule; this.schedule = false; assert this.simplifier == Simplifier.ELIM; this.simplifier = Simplifier.TOPSIMP; dumpEliminatedRedundant(); } }
public class class_name { private boolean checkAndRespond(Request request) { if (!URIBean.checkUri(request.getUrl())) { ServerResponseBean responseBean = new ServerResponseBean(); responseBean.setMsgId(request.getMsgId()); responseBean.setHttpContentType(HttpContentType.APPLICATION_JSON); responseBean.setResponseBody(UnitResponse.createError(Group.CODE_BAD_REQUEST, null, String.format("URI %s is illegal.", request.getUrl())) .toVoJSONString()); IServerResponder.singleton.response(responseBean); return false; } return true; } }
public class class_name { private boolean checkAndRespond(Request request) { if (!URIBean.checkUri(request.getUrl())) { ServerResponseBean responseBean = new ServerResponseBean(); responseBean.setMsgId(request.getMsgId()); // depends on control dependency: [if], data = [none] responseBean.setHttpContentType(HttpContentType.APPLICATION_JSON); // depends on control dependency: [if], data = [none] responseBean.setResponseBody(UnitResponse.createError(Group.CODE_BAD_REQUEST, null, String.format("URI %s is illegal.", request.getUrl())) .toVoJSONString()); // depends on control dependency: [if], data = [none] IServerResponder.singleton.response(responseBean); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public synchronized boolean onRecoverEvaluator(final String evaluatorId) { if (getStateOfPreviousEvaluator(evaluatorId).isFailedOrNotExpected()) { final String errMsg = "Evaluator with evaluator ID " + evaluatorId + " not expected to be alive."; LOG.log(Level.SEVERE, errMsg); throw new DriverFatalRuntimeException(errMsg); } if (getStateOfPreviousEvaluator(evaluatorId) != EvaluatorRestartState.EXPECTED) { LOG.log(Level.WARNING, "Evaluator with evaluator ID " + evaluatorId + " added to the set" + " of recovered evaluators more than once. Ignoring second add..."); return false; } // set the status for this evaluator ID to be reported. setEvaluatorReported(evaluatorId); if (haveAllExpectedEvaluatorsReported()) { onDriverRestartCompleted(false); } return true; } }
public class class_name { public synchronized boolean onRecoverEvaluator(final String evaluatorId) { if (getStateOfPreviousEvaluator(evaluatorId).isFailedOrNotExpected()) { final String errMsg = "Evaluator with evaluator ID " + evaluatorId + " not expected to be alive."; // depends on control dependency: [if], data = [none] LOG.log(Level.SEVERE, errMsg); // depends on control dependency: [if], data = [none] throw new DriverFatalRuntimeException(errMsg); } if (getStateOfPreviousEvaluator(evaluatorId) != EvaluatorRestartState.EXPECTED) { LOG.log(Level.WARNING, "Evaluator with evaluator ID " + evaluatorId + " added to the set" + " of recovered evaluators more than once. Ignoring second add..."); // depends on control dependency: [if], data = [none] return false; // depends on control dependency: [if], data = [none] } // set the status for this evaluator ID to be reported. setEvaluatorReported(evaluatorId); if (haveAllExpectedEvaluatorsReported()) { onDriverRestartCompleted(false); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public XMLWriter createXMLWriter(String systemID) throws KNXMLException { final XMLWriter w = (XMLWriter) create(DEFAULT_WRITER); final EntityResolver res = (EntityResolver) create(DEFAULT_RESOLVER); final OutputStream os = res.resolveOutput(systemID); try { w.setOutput(new OutputStreamWriter(os, "UTF-8"), true); return w; } catch (final UnsupportedEncodingException e) { try { os.close(); } catch (final IOException ignore) {} throw new KNXMLException("encoding UTF-8 unknown"); } } }
public class class_name { public XMLWriter createXMLWriter(String systemID) throws KNXMLException { final XMLWriter w = (XMLWriter) create(DEFAULT_WRITER); final EntityResolver res = (EntityResolver) create(DEFAULT_RESOLVER); final OutputStream os = res.resolveOutput(systemID); try { w.setOutput(new OutputStreamWriter(os, "UTF-8"), true); return w; } catch (final UnsupportedEncodingException e) { try { os.close(); // depends on control dependency: [try], data = [none] } catch (final IOException ignore) {} // depends on control dependency: [catch], data = [none] throw new KNXMLException("encoding UTF-8 unknown"); } } }
public class class_name { protected void activate(ComponentContext compcontext, Map<String, Object> properties) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Activating " + this); } INSTANCE.set(this); this.updateConfiguration(properties); } }
public class class_name { protected void activate(ComponentContext compcontext, Map<String, Object> properties) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Activating " + this); // depends on control dependency: [if], data = [none] } INSTANCE.set(this); this.updateConfiguration(properties); } }
public class class_name { private void parseQuotedSpans(SpanManager sm, Span s, List<Span> quotedSpans, String quotation) { final int qlen = quotation.length(); // get the start position int start = sm.indexOf(quotation, s.getStart(), s.getEnd()); while (start != -1) { // get the end position int end = sm.indexOf(quotation, start + qlen, s.getEnd()); if (end == -1) { break; } // build a new span from start and end position. Span qs = new Span(start, end); quotedSpans.add(qs); // calculate the original src positions. if (calculateSrcSpans) { qs.setSrcSpan(new SrcSpan(sm.getSrcPos(start), sm.getSrcPos(end + qlen - 1) + 1)); } // delete the tags. sm.delete(end, end + qlen); sm.delete(start, start + qlen); // get the next start position start = sm.indexOf(quotation, qs.getEnd(), s.getEnd()); } } }
public class class_name { private void parseQuotedSpans(SpanManager sm, Span s, List<Span> quotedSpans, String quotation) { final int qlen = quotation.length(); // get the start position int start = sm.indexOf(quotation, s.getStart(), s.getEnd()); while (start != -1) { // get the end position int end = sm.indexOf(quotation, start + qlen, s.getEnd()); if (end == -1) { break; } // build a new span from start and end position. Span qs = new Span(start, end); quotedSpans.add(qs); // depends on control dependency: [while], data = [none] // calculate the original src positions. if (calculateSrcSpans) { qs.setSrcSpan(new SrcSpan(sm.getSrcPos(start), sm.getSrcPos(end + qlen - 1) + 1)); // depends on control dependency: [if], data = [none] } // delete the tags. sm.delete(end, end + qlen); // depends on control dependency: [while], data = [none] sm.delete(start, start + qlen); // depends on control dependency: [while], data = [(start] // get the next start position start = sm.indexOf(quotation, qs.getEnd(), s.getEnd()); // depends on control dependency: [while], data = [none] } } }
public class class_name { protected static <M extends Model> int[] findDepth(Clustering<M> c) { final Hierarchy<Cluster<M>> hier = c.getClusterHierarchy(); int[] size = { 0, 0 }; for(It<Cluster<M>> iter = c.iterToplevelClusters(); iter.valid(); iter.advance()) { findDepth(hier, iter.get(), size); } return size; } }
public class class_name { protected static <M extends Model> int[] findDepth(Clustering<M> c) { final Hierarchy<Cluster<M>> hier = c.getClusterHierarchy(); int[] size = { 0, 0 }; for(It<Cluster<M>> iter = c.iterToplevelClusters(); iter.valid(); iter.advance()) { findDepth(hier, iter.get(), size); // depends on control dependency: [for], data = [iter] } return size; } }
public class class_name { public void setResourceType(java.util.Collection<StringFilter> resourceType) { if (resourceType == null) { this.resourceType = null; return; } this.resourceType = new java.util.ArrayList<StringFilter>(resourceType); } }
public class class_name { public void setResourceType(java.util.Collection<StringFilter> resourceType) { if (resourceType == null) { this.resourceType = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.resourceType = new java.util.ArrayList<StringFilter>(resourceType); } }
public class class_name { protected void pImports() { boolean sandbox = Rythm.insideSandbox(); for (String s : imports) { pImport(s, sandbox); } // for (String s : globalImports) { // pImport(s, sandbox); // } // moved to event handler // if (null != importProvider) { // for (String s : importProvider.imports()) { // pImport(s, sandbox); // } // } // replaced by importProvider // IImplicitRenderArgProvider p = implicitRenderArgProvider; // if (null != p) { // for (String s : p.getImplicitImportStatements()) { // pImport(s, sandbox); // } // } // common imports pn("import java.util.*;"); pn("import org.rythmengine.template.TemplateBase;"); if (!sandbox) pn("import java.io.*;"); } }
public class class_name { protected void pImports() { boolean sandbox = Rythm.insideSandbox(); for (String s : imports) { pImport(s, sandbox); // depends on control dependency: [for], data = [s] } // for (String s : globalImports) { // pImport(s, sandbox); // } // moved to event handler // if (null != importProvider) { // for (String s : importProvider.imports()) { // pImport(s, sandbox); // } // } // replaced by importProvider // IImplicitRenderArgProvider p = implicitRenderArgProvider; // if (null != p) { // for (String s : p.getImplicitImportStatements()) { // pImport(s, sandbox); // } // } // common imports pn("import java.util.*;"); pn("import org.rythmengine.template.TemplateBase;"); if (!sandbox) pn("import java.io.*;"); } }
public class class_name { byte[] getBytes() { byte[] ret = new byte[48]; ret[0] = (byte) ( (this.leapIndicator << 6) | (this.version << 3) | this.mode ); // wird nie ausgewertet, da nur auf die Client-Message angewandt if (this.mode != 3) { ret[1] = (byte) this.stratum; ret[2] = (byte) this.pollInterval; ret[3] = this.precision; int rdelay = (int) (this.rootDelay * BIT16); ret[4] = (byte) ((rdelay >> 24) & 0xFF); ret[5] = (byte) ((rdelay >> 16) & 0xFF); ret[6] = (byte) ((rdelay >> 8) & 0xFF); ret[7] = (byte) (rdelay & 0xFF); long rdisp = (long) (this.rootDispersion * BIT16); ret[8] = (byte) ((rdisp >> 24) & 0xFF); ret[9] = (byte) ((rdisp >> 16) & 0xFF); ret[10] = (byte) ((rdisp >> 8) & 0xFF); ret[11] = (byte) (rdisp & 0xFF); for (int i = 0; i < 4; i++) { ret[12 + i] = this.refID[i]; } encode(ret, 16, this.referenceTimestamp); encode(ret, 24, this.originateTimestamp); encode(ret, 32, this.receiveTimestamp); } encode(ret, 40, this.transmitTimestamp); return ret; } }
public class class_name { byte[] getBytes() { byte[] ret = new byte[48]; ret[0] = (byte) ( (this.leapIndicator << 6) | (this.version << 3) | this.mode ); // wird nie ausgewertet, da nur auf die Client-Message angewandt if (this.mode != 3) { ret[1] = (byte) this.stratum; // depends on control dependency: [if], data = [none] ret[2] = (byte) this.pollInterval; // depends on control dependency: [if], data = [none] ret[3] = this.precision; // depends on control dependency: [if], data = [none] int rdelay = (int) (this.rootDelay * BIT16); ret[4] = (byte) ((rdelay >> 24) & 0xFF); // depends on control dependency: [if], data = [none] ret[5] = (byte) ((rdelay >> 16) & 0xFF); // depends on control dependency: [if], data = [none] ret[6] = (byte) ((rdelay >> 8) & 0xFF); // depends on control dependency: [if], data = [none] ret[7] = (byte) (rdelay & 0xFF); // depends on control dependency: [if], data = [none] long rdisp = (long) (this.rootDispersion * BIT16); ret[8] = (byte) ((rdisp >> 24) & 0xFF); // depends on control dependency: [if], data = [none] ret[9] = (byte) ((rdisp >> 16) & 0xFF); // depends on control dependency: [if], data = [none] ret[10] = (byte) ((rdisp >> 8) & 0xFF); // depends on control dependency: [if], data = [none] ret[11] = (byte) (rdisp & 0xFF); // depends on control dependency: [if], data = [none] for (int i = 0; i < 4; i++) { ret[12 + i] = this.refID[i]; // depends on control dependency: [for], data = [i] } encode(ret, 16, this.referenceTimestamp); // depends on control dependency: [if], data = [none] encode(ret, 24, this.originateTimestamp); // depends on control dependency: [if], data = [none] encode(ret, 32, this.receiveTimestamp); // depends on control dependency: [if], data = [none] } encode(ret, 40, this.transmitTimestamp); return ret; } }
public class class_name { public DocumentDescription withPlatformTypes(String... platformTypes) { if (this.platformTypes == null) { setPlatformTypes(new com.amazonaws.internal.SdkInternalList<String>(platformTypes.length)); } for (String ele : platformTypes) { this.platformTypes.add(ele); } return this; } }
public class class_name { public DocumentDescription withPlatformTypes(String... platformTypes) { if (this.platformTypes == null) { setPlatformTypes(new com.amazonaws.internal.SdkInternalList<String>(platformTypes.length)); // depends on control dependency: [if], data = [none] } for (String ele : platformTypes) { this.platformTypes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static JsonNode parse(final String jsonString) { if (Strings.isEmpty(jsonString)) { return newObject(); } try { return createObjectMapper().readValue(jsonString, JsonNode.class); } catch (Throwable e) { throw new ParseException(String.format("can't parse string [%s]", jsonString), e); } } }
public class class_name { public static JsonNode parse(final String jsonString) { if (Strings.isEmpty(jsonString)) { return newObject(); // depends on control dependency: [if], data = [none] } try { return createObjectMapper().readValue(jsonString, JsonNode.class); // depends on control dependency: [try], data = [none] } catch (Throwable e) { throw new ParseException(String.format("can't parse string [%s]", jsonString), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private File extract(InstrumentsVersion version) { if (version.getBuild() == null) { throw new WebDriverException("you are running a version of XCode that is too old " + version); } extractFromJar("instruments"); extractFromJar("InstrumentsShim.dylib"); extractFromJar("ScriptAgentShim.dylib"); if (version.getMajor() >= 6) { extractFromJar("DTMobileISShim.dylib"); } extractFromJar("SimShim.dylib"); extractFromJar("README"); File instruments = new File(workingDirectory, "instruments"); instruments.setExecutable(true); return instruments; } }
public class class_name { private File extract(InstrumentsVersion version) { if (version.getBuild() == null) { throw new WebDriverException("you are running a version of XCode that is too old " + version); } extractFromJar("instruments"); extractFromJar("InstrumentsShim.dylib"); extractFromJar("ScriptAgentShim.dylib"); if (version.getMajor() >= 6) { extractFromJar("DTMobileISShim.dylib"); // depends on control dependency: [if], data = [none] } extractFromJar("SimShim.dylib"); extractFromJar("README"); File instruments = new File(workingDirectory, "instruments"); instruments.setExecutable(true); return instruments; } }
public class class_name { public Node<T> getNext(Node<T> node) { if (node.right != null) { node = node.right; while (node.left != null) node = node.left; return node; } // nothing at right, it may be the parent node if the node is at the left if (node == last) return null; return getNext(root, node.value); } }
public class class_name { public Node<T> getNext(Node<T> node) { if (node.right != null) { node = node.right; // depends on control dependency: [if], data = [none] while (node.left != null) node = node.left; return node; // depends on control dependency: [if], data = [none] } // nothing at right, it may be the parent node if the node is at the left if (node == last) return null; return getNext(root, node.value); } }
public class class_name { public I_CmsXmlSchemaType getSchemaType(String elementPath) { String path = CmsXmlUtils.removeXpath(elementPath); I_CmsXmlSchemaType result = m_elementTypes.get(path); if (result == null) { result = getSchemaTypeRecusive(path); if (result != null) { m_elementTypes.put(path, result); } else { m_elementTypes.put(path, NULL_SCHEMA_TYPE); } } else if (result == NULL_SCHEMA_TYPE) { result = null; } return result; } }
public class class_name { public I_CmsXmlSchemaType getSchemaType(String elementPath) { String path = CmsXmlUtils.removeXpath(elementPath); I_CmsXmlSchemaType result = m_elementTypes.get(path); if (result == null) { result = getSchemaTypeRecusive(path); // depends on control dependency: [if], data = [none] if (result != null) { m_elementTypes.put(path, result); // depends on control dependency: [if], data = [none] } else { m_elementTypes.put(path, NULL_SCHEMA_TYPE); // depends on control dependency: [if], data = [none] } } else if (result == NULL_SCHEMA_TYPE) { result = null; // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public final void annotationElementValuePair(AnnotationDescr descr, AnnotatedDescrBuilder inDescrBuilder) throws RecognitionException { Token key=null; Object val =null; try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:210:3: (key= ID EQUALS_ASSIGN val= annotationValue[inDescrBuilder] ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:210:5: key= ID EQUALS_ASSIGN val= annotationValue[inDescrBuilder] { key=(Token)match(input,ID,FOLLOW_ID_in_annotationElementValuePair1041); if (state.failed) return; match(input,EQUALS_ASSIGN,FOLLOW_EQUALS_ASSIGN_in_annotationElementValuePair1043); if (state.failed) return; pushFollow(FOLLOW_annotationValue_in_annotationElementValuePair1047); val=annotationValue(inDescrBuilder); state._fsp--; if (state.failed) return; if ( state.backtracking==0 ) { if ( buildDescr ) { descr.setKeyValue( (key!=null?key.getText():null), val ); } } } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { public final void annotationElementValuePair(AnnotationDescr descr, AnnotatedDescrBuilder inDescrBuilder) throws RecognitionException { Token key=null; Object val =null; try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:210:3: (key= ID EQUALS_ASSIGN val= annotationValue[inDescrBuilder] ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:210:5: key= ID EQUALS_ASSIGN val= annotationValue[inDescrBuilder] { key=(Token)match(input,ID,FOLLOW_ID_in_annotationElementValuePair1041); if (state.failed) return; match(input,EQUALS_ASSIGN,FOLLOW_EQUALS_ASSIGN_in_annotationElementValuePair1043); if (state.failed) return; pushFollow(FOLLOW_annotationValue_in_annotationElementValuePair1047); val=annotationValue(inDescrBuilder); state._fsp--; if (state.failed) return; if ( state.backtracking==0 ) { if ( buildDescr ) { descr.setKeyValue( (key!=null?key.getText():null), val ); } } // depends on control dependency: [if], data = [none] } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { public boolean isSourceListModified() { if (sourceList != null) { for (int i = 0, size = sourceList.size(); i < size; i++) { if (sourceList.get(i).isModified()) { return true; } } } return false; } }
public class class_name { public boolean isSourceListModified() { if (sourceList != null) { for (int i = 0, size = sourceList.size(); i < size; i++) { if (sourceList.get(i).isModified()) { return true; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { @After(order = ORDER_20, value = {"@mobile or @web"}) public void seleniumTeardown() { if (commonspec.getDriver() != null) { commonspec.getLogger().debug("Shutdown Selenium client"); commonspec.getDriver().close(); commonspec.getDriver().quit(); } } }
public class class_name { @After(order = ORDER_20, value = {"@mobile or @web"}) public void seleniumTeardown() { if (commonspec.getDriver() != null) { commonspec.getLogger().debug("Shutdown Selenium client"); // depends on control dependency: [if], data = [none] commonspec.getDriver().close(); // depends on control dependency: [if], data = [none] commonspec.getDriver().quit(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") private void inheritNamespaces(SchemaImpl schema, Definition wsdl) { Map<String, String> wsdlNamespaces = wsdl.getNamespaces(); for (Entry<String, String> nsEntry: wsdlNamespaces.entrySet()) { if (StringUtils.hasText(nsEntry.getKey())) { if (!schema.getElement().hasAttributeNS(WWW_W3_ORG_2000_XMLNS, nsEntry.getKey())) { schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns:" + nsEntry.getKey(), nsEntry.getValue()); } } else { // handle default namespace if (!schema.getElement().hasAttribute("xmlns")) { schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns" + nsEntry.getKey(), nsEntry.getValue()); } } } } }
public class class_name { @SuppressWarnings("unchecked") private void inheritNamespaces(SchemaImpl schema, Definition wsdl) { Map<String, String> wsdlNamespaces = wsdl.getNamespaces(); for (Entry<String, String> nsEntry: wsdlNamespaces.entrySet()) { if (StringUtils.hasText(nsEntry.getKey())) { if (!schema.getElement().hasAttributeNS(WWW_W3_ORG_2000_XMLNS, nsEntry.getKey())) { schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns:" + nsEntry.getKey(), nsEntry.getValue()); // depends on control dependency: [if], data = [none] } } else { // handle default namespace if (!schema.getElement().hasAttribute("xmlns")) { schema.getElement().setAttributeNS(WWW_W3_ORG_2000_XMLNS, "xmlns" + nsEntry.getKey(), nsEntry.getValue()); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @Override public Double[] getValues(GriddedTile griddedTile, byte[] imageBytes) { BufferedImage image; try { image = ImageUtils.getImage(imageBytes); } catch (IOException e) { throw new GeoPackageException( "Failed to create an image from image bytes", e); } Double[] values = getValues(griddedTile, image); return values; } }
public class class_name { @Override public Double[] getValues(GriddedTile griddedTile, byte[] imageBytes) { BufferedImage image; try { image = ImageUtils.getImage(imageBytes); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new GeoPackageException( "Failed to create an image from image bytes", e); } // depends on control dependency: [catch], data = [none] Double[] values = getValues(griddedTile, image); return values; } }
public class class_name { public static boolean isJavaVersionOK() { boolean isJavaVersionOK = true; String versionStr = System.getProperty("java.version"); String[] parts; double version; if (versionStr.contains(".")) { parts = versionStr.split("\\."); } else { parts = new String[]{versionStr}; } if (parts.length == 1) { try { version = Double.parseDouble(parts[0]); } catch (Exception e) { System.err.println("Unparsable Java version: " + versionStr); return false; } } else { try { version = Double.parseDouble(parts[0]) + Double.parseDouble(parts[1]) / 10; } catch (Exception e) { System.err.println("Unparsable Java version: " + versionStr); return false; } } if (version < 1.8) { isJavaVersionOK = false; System.err.println(); System.err.println(Globals.getWorkbenchInfoString()); System.err.println(); System.err.print("Java 8 or higher is required to run MOA. "); System.err.println("Java version " + versionStr + " found"); } return isJavaVersionOK; } }
public class class_name { public static boolean isJavaVersionOK() { boolean isJavaVersionOK = true; String versionStr = System.getProperty("java.version"); String[] parts; double version; if (versionStr.contains(".")) { parts = versionStr.split("\\."); // depends on control dependency: [if], data = [none] } else { parts = new String[]{versionStr}; // depends on control dependency: [if], data = [none] } if (parts.length == 1) { try { version = Double.parseDouble(parts[0]); // depends on control dependency: [try], data = [none] } catch (Exception e) { System.err.println("Unparsable Java version: " + versionStr); return false; } // depends on control dependency: [catch], data = [none] } else { try { version = Double.parseDouble(parts[0]) + Double.parseDouble(parts[1]) / 10; // depends on control dependency: [try], data = [none] } catch (Exception e) { System.err.println("Unparsable Java version: " + versionStr); return false; } // depends on control dependency: [catch], data = [none] } if (version < 1.8) { isJavaVersionOK = false; // depends on control dependency: [if], data = [none] System.err.println(); // depends on control dependency: [if], data = [none] System.err.println(Globals.getWorkbenchInfoString()); // depends on control dependency: [if], data = [none] System.err.println(); // depends on control dependency: [if], data = [none] System.err.print("Java 8 or higher is required to run MOA. "); // depends on control dependency: [if], data = [none] System.err.println("Java version " + versionStr + " found"); // depends on control dependency: [if], data = [none] } return isJavaVersionOK; } }
public class class_name { @Override public int getInt(int columnIndex) { int value; try { value = resultSet.getInt(resultIndexToResultSetIndex(columnIndex)); } catch (SQLException e) { throw new GeoPackageException( "Failed to get int value for column index: " + columnIndex, e); } return value; } }
public class class_name { @Override public int getInt(int columnIndex) { int value; try { value = resultSet.getInt(resultIndexToResultSetIndex(columnIndex)); // depends on control dependency: [try], data = [none] } catch (SQLException e) { throw new GeoPackageException( "Failed to get int value for column index: " + columnIndex, e); } // depends on control dependency: [catch], data = [none] return value; } }
public class class_name { void sendError(HttpResponseStatus status, Throwable ex) { String msg; if (ex instanceof InvocationTargetException) { msg = String.format("Exception Encountered while processing request : %s", ex.getCause().getMessage()); } else { msg = String.format("Exception Encountered while processing request: %s", ex.getMessage()); } // Send the status and message, followed by closing of the connection. responder.sendString(status, msg, new DefaultHttpHeaders().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE)); if (bodyConsumer != null) { bodyConsumerError(ex); } } }
public class class_name { void sendError(HttpResponseStatus status, Throwable ex) { String msg; if (ex instanceof InvocationTargetException) { msg = String.format("Exception Encountered while processing request : %s", ex.getCause().getMessage()); // depends on control dependency: [if], data = [none] } else { msg = String.format("Exception Encountered while processing request: %s", ex.getMessage()); // depends on control dependency: [if], data = [none] } // Send the status and message, followed by closing of the connection. responder.sendString(status, msg, new DefaultHttpHeaders().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE)); if (bodyConsumer != null) { bodyConsumerError(ex); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public EEnum getIfcFlowDirectionEnum() { if (ifcFlowDirectionEnumEEnum == null) { ifcFlowDirectionEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(992); } return ifcFlowDirectionEnumEEnum; } }
public class class_name { @Override public EEnum getIfcFlowDirectionEnum() { if (ifcFlowDirectionEnumEEnum == null) { ifcFlowDirectionEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI) .getEClassifiers().get(992); // depends on control dependency: [if], data = [none] } return ifcFlowDirectionEnumEEnum; } }
public class class_name { public boolean hasNext() { if(cachedNext != null) { return true; } while(cachedNext == null) { if(br != null) { // attempt to read the next line from this: try { cachedNext = br.readLine(); if(cachedNext == null) { br = null; // next loop: } else { return true; } } catch (IOException e) { e.printStackTrace(); br = null; } } else { // do we have more blocks to use? if(blockItr.hasNext()) { try { br = blockItr.next().readBlock(); } catch (IOException e) { throw new RuntimeIOException(); } } else { return false; } } } return false; } }
public class class_name { public boolean hasNext() { if(cachedNext != null) { return true; // depends on control dependency: [if], data = [none] } while(cachedNext == null) { if(br != null) { // attempt to read the next line from this: try { cachedNext = br.readLine(); // depends on control dependency: [try], data = [none] if(cachedNext == null) { br = null; // depends on control dependency: [if], data = [none] // next loop: } else { return true; // depends on control dependency: [if], data = [none] } } catch (IOException e) { e.printStackTrace(); br = null; } // depends on control dependency: [catch], data = [none] } else { // do we have more blocks to use? if(blockItr.hasNext()) { try { br = blockItr.next().readBlock(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeIOException(); } // depends on control dependency: [catch], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } } return false; } }
public class class_name { public void shutdown() { synchronized (omap) { for (Map.Entry<TapStream, TapConnectionProvider> me : omap.entrySet()) { me.getValue().shutdown(); } } } }
public class class_name { public void shutdown() { synchronized (omap) { for (Map.Entry<TapStream, TapConnectionProvider> me : omap.entrySet()) { me.getValue().shutdown(); // depends on control dependency: [for], data = [me] } } } }
public class class_name { public JsonArray getJsonArray(final String key, final JsonArray def) { JsonArray val = getJsonArray(key); if (val == null) { if (map.containsKey(key)) { return null; } return def; } return val; } }
public class class_name { public JsonArray getJsonArray(final String key, final JsonArray def) { JsonArray val = getJsonArray(key); if (val == null) { if (map.containsKey(key)) { return null; // depends on control dependency: [if], data = [none] } return def; // depends on control dependency: [if], data = [none] } return val; } }
public class class_name { public Collection<String> getLogicTableNames(final String actualTableName) { Collection<String> result = new LinkedList<>(); for (TableRule each : tableRules) { if (each.isExisted(actualTableName)) { result.add(each.getLogicTable()); } } return result; } }
public class class_name { public Collection<String> getLogicTableNames(final String actualTableName) { Collection<String> result = new LinkedList<>(); for (TableRule each : tableRules) { if (each.isExisted(actualTableName)) { result.add(each.getLogicTable()); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { public JsonNode parse(InputStream stream) { synchronized (lock) { try { return mapper.readValue(stream, JsonNode.class); } catch (Exception t) { throw new RuntimeException(t); } } } }
public class class_name { public JsonNode parse(InputStream stream) { synchronized (lock) { try { return mapper.readValue(stream, JsonNode.class); // depends on control dependency: [try], data = [none] } catch (Exception t) { throw new RuntimeException(t); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { boolean verify(byte[] data, int offset, ServerMessageBlock response) { update(macSigningKey, 0, macSigningKey.length); int index = offset; update(data, index, ServerMessageBlock.SIGNATURE_OFFSET); index += ServerMessageBlock.SIGNATURE_OFFSET; byte[] sequence = new byte[8]; ServerMessageBlock.writeInt4(response.signSeq, sequence, 0); update(sequence, 0, sequence.length); index += 8; if( response.command == ServerMessageBlock.SMB_COM_READ_ANDX ) { /* SmbComReadAndXResponse reads directly from the stream into separate byte[] b. */ SmbComReadAndXResponse raxr = (SmbComReadAndXResponse)response; int length = response.length - raxr.dataLength; update(data, index, length - ServerMessageBlock.SIGNATURE_OFFSET - 8); update(raxr.b, raxr.off, raxr.dataLength); } else { update(data, index, response.length - ServerMessageBlock.SIGNATURE_OFFSET - 8); } byte[] signature = digest(); for (int i = 0; i < 8; i++) { if (signature[i] != data[offset + ServerMessageBlock.SIGNATURE_OFFSET + i]) { if( log.level >= 2 ) { log.println( "signature verification failure" ); Hexdump.hexdump( log, signature, 0, 8 ); Hexdump.hexdump( log, data, offset + ServerMessageBlock.SIGNATURE_OFFSET, 8 ); } return response.verifyFailed = true; } } return response.verifyFailed = false; } }
public class class_name { boolean verify(byte[] data, int offset, ServerMessageBlock response) { update(macSigningKey, 0, macSigningKey.length); int index = offset; update(data, index, ServerMessageBlock.SIGNATURE_OFFSET); index += ServerMessageBlock.SIGNATURE_OFFSET; byte[] sequence = new byte[8]; ServerMessageBlock.writeInt4(response.signSeq, sequence, 0); update(sequence, 0, sequence.length); index += 8; if( response.command == ServerMessageBlock.SMB_COM_READ_ANDX ) { /* SmbComReadAndXResponse reads directly from the stream into separate byte[] b. */ SmbComReadAndXResponse raxr = (SmbComReadAndXResponse)response; int length = response.length - raxr.dataLength; update(data, index, length - ServerMessageBlock.SIGNATURE_OFFSET - 8); // depends on control dependency: [if], data = [none] update(raxr.b, raxr.off, raxr.dataLength); // depends on control dependency: [if], data = [none] } else { update(data, index, response.length - ServerMessageBlock.SIGNATURE_OFFSET - 8); // depends on control dependency: [if], data = [none] } byte[] signature = digest(); for (int i = 0; i < 8; i++) { if (signature[i] != data[offset + ServerMessageBlock.SIGNATURE_OFFSET + i]) { if( log.level >= 2 ) { log.println( "signature verification failure" ); // depends on control dependency: [if], data = [none] Hexdump.hexdump( log, signature, 0, 8 ); // depends on control dependency: [if], data = [none] Hexdump.hexdump( log, data, offset + ServerMessageBlock.SIGNATURE_OFFSET, 8 ); // depends on control dependency: [if], data = [none] } return response.verifyFailed = true; // depends on control dependency: [if], data = [none] } } return response.verifyFailed = false; } }