code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void debug( Object messagePattern, Object arg ) { if( m_delegate.isDebugEnabled() ) { String msgStr = (String) messagePattern; msgStr = MessageFormatter.format( msgStr, arg ); m_delegate.debug( msgStr, null ); } } }
public class class_name { public void debug( Object messagePattern, Object arg ) { if( m_delegate.isDebugEnabled() ) { String msgStr = (String) messagePattern; msgStr = MessageFormatter.format( msgStr, arg ); // depends on control dependency: [if], data = [none] m_delegate.debug( msgStr, null ); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void writeAccessControlEntry(CmsRequestContext context, CmsResource resource, CmsAccessControlEntry ace) throws CmsException, CmsSecurityException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_CONTROL, true, CmsResourceFilter.ALL); if (ace.getPrincipal().equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID)) { // only vfs managers can set the overwrite all ACE checkRoleForResource(dbc, CmsRole.VFS_MANAGER, resource); } m_driverManager.writeAccessControlEntry(dbc, resource, ace); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_WRITE_ACL_ENTRY_1, context.getSitePath(resource)), e); } finally { dbc.clear(); } } }
public class class_name { public void writeAccessControlEntry(CmsRequestContext context, CmsResource resource, CmsAccessControlEntry ace) throws CmsException, CmsSecurityException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_CONTROL, true, CmsResourceFilter.ALL); if (ace.getPrincipal().equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID)) { // only vfs managers can set the overwrite all ACE checkRoleForResource(dbc, CmsRole.VFS_MANAGER, resource); // depends on control dependency: [if], data = [none] } m_driverManager.writeAccessControlEntry(dbc, resource, ace); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_WRITE_ACL_ENTRY_1, context.getSitePath(resource)), e); } finally { dbc.clear(); } } }
public class class_name { public byte[] toByteArray() { short bootstrapMethodsAttrNameIndex = 0; int attributeCount = 0; short sourceFileAttributeNameIndex = 0; if (itsBootstrapMethods != null) { ++attributeCount; bootstrapMethodsAttrNameIndex = itsConstantPool.addUtf8("BootstrapMethods"); } if (itsSourceFileNameIndex != 0) { ++attributeCount; sourceFileAttributeNameIndex = itsConstantPool.addUtf8( "SourceFile"); } // Don't calculate the data size until we know how many bootstrap // methods there will be. int offset = 0; int dataSize = getWriteSize(); byte[] data = new byte[dataSize]; offset = putInt32(FileHeaderConstant, data, offset); offset = putInt16(MinorVersion, data, offset); offset = putInt16(MajorVersion, data, offset); offset = itsConstantPool.write(data, offset); offset = putInt16(itsFlags, data, offset); offset = putInt16(itsThisClassIndex, data, offset); offset = putInt16(itsSuperClassIndex, data, offset); offset = putInt16(itsInterfaces.size(), data, offset); for (int i = 0; i < itsInterfaces.size(); i++) { int interfaceIndex = ((Short) (itsInterfaces.get(i))).shortValue(); offset = putInt16(interfaceIndex, data, offset); } offset = putInt16(itsFields.size(), data, offset); for (int i = 0; i < itsFields.size(); i++) { ClassFileField field = (ClassFileField) itsFields.get(i); offset = field.write(data, offset); } offset = putInt16(itsMethods.size(), data, offset); for (int i = 0; i < itsMethods.size(); i++) { ClassFileMethod method = (ClassFileMethod) itsMethods.get(i); offset = method.write(data, offset); } offset = putInt16(attributeCount, data, offset); // attributes count if (itsBootstrapMethods != null) { offset = putInt16(bootstrapMethodsAttrNameIndex, data, offset); offset = putInt32(itsBootstrapMethodsLength + 2, data, offset); offset = putInt16(itsBootstrapMethods.size(), data, offset); for (int i = 0; i < itsBootstrapMethods.size(); i++) { BootstrapEntry entry = (BootstrapEntry) itsBootstrapMethods.get(i); System.arraycopy(entry.code, 0, data, offset, entry.code.length); offset += entry.code.length; } } if (itsSourceFileNameIndex != 0) { offset = putInt16(sourceFileAttributeNameIndex, data, offset); offset = putInt32(2, data, offset); offset = putInt16(itsSourceFileNameIndex, data, offset); } if (offset != dataSize) { // Check getWriteSize is consistent with write! throw new RuntimeException(); } return data; } }
public class class_name { public byte[] toByteArray() { short bootstrapMethodsAttrNameIndex = 0; int attributeCount = 0; short sourceFileAttributeNameIndex = 0; if (itsBootstrapMethods != null) { ++attributeCount; // depends on control dependency: [if], data = [none] bootstrapMethodsAttrNameIndex = itsConstantPool.addUtf8("BootstrapMethods"); // depends on control dependency: [if], data = [none] } if (itsSourceFileNameIndex != 0) { ++attributeCount; // depends on control dependency: [if], data = [none] sourceFileAttributeNameIndex = itsConstantPool.addUtf8( "SourceFile"); // depends on control dependency: [if], data = [none] } // Don't calculate the data size until we know how many bootstrap // methods there will be. int offset = 0; int dataSize = getWriteSize(); byte[] data = new byte[dataSize]; offset = putInt32(FileHeaderConstant, data, offset); offset = putInt16(MinorVersion, data, offset); offset = putInt16(MajorVersion, data, offset); offset = itsConstantPool.write(data, offset); offset = putInt16(itsFlags, data, offset); offset = putInt16(itsThisClassIndex, data, offset); offset = putInt16(itsSuperClassIndex, data, offset); offset = putInt16(itsInterfaces.size(), data, offset); for (int i = 0; i < itsInterfaces.size(); i++) { int interfaceIndex = ((Short) (itsInterfaces.get(i))).shortValue(); offset = putInt16(interfaceIndex, data, offset); // depends on control dependency: [for], data = [none] } offset = putInt16(itsFields.size(), data, offset); for (int i = 0; i < itsFields.size(); i++) { ClassFileField field = (ClassFileField) itsFields.get(i); offset = field.write(data, offset); // depends on control dependency: [for], data = [none] } offset = putInt16(itsMethods.size(), data, offset); for (int i = 0; i < itsMethods.size(); i++) { ClassFileMethod method = (ClassFileMethod) itsMethods.get(i); offset = method.write(data, offset); // depends on control dependency: [for], data = [none] } offset = putInt16(attributeCount, data, offset); // attributes count if (itsBootstrapMethods != null) { offset = putInt16(bootstrapMethodsAttrNameIndex, data, offset); // depends on control dependency: [if], data = [none] offset = putInt32(itsBootstrapMethodsLength + 2, data, offset); // depends on control dependency: [if], data = [(itsBootstrapMethods] offset = putInt16(itsBootstrapMethods.size(), data, offset); // depends on control dependency: [if], data = [(itsBootstrapMethods] for (int i = 0; i < itsBootstrapMethods.size(); i++) { BootstrapEntry entry = (BootstrapEntry) itsBootstrapMethods.get(i); System.arraycopy(entry.code, 0, data, offset, entry.code.length); // depends on control dependency: [for], data = [none] offset += entry.code.length; // depends on control dependency: [for], data = [none] } } if (itsSourceFileNameIndex != 0) { offset = putInt16(sourceFileAttributeNameIndex, data, offset); // depends on control dependency: [if], data = [none] offset = putInt32(2, data, offset); // depends on control dependency: [if], data = [none] offset = putInt16(itsSourceFileNameIndex, data, offset); // depends on control dependency: [if], data = [(itsSourceFileNameIndex] } if (offset != dataSize) { // Check getWriteSize is consistent with write! throw new RuntimeException(); } return data; } }
public class class_name { public Object setStatus(int iStatus, Object comp, Object cursor) { Cursor oldCursor = null; if (comp instanceof Component) if (SwingUtilities.isEventDispatchThread()) // Just being careful { oldCursor = ((Component)comp).getCursor(); if (cursor == null) cursor = (Cursor)Cursor.getPredefinedCursor(iStatus); ((Component)comp).setCursor((Cursor)cursor); } if (m_statusbar != null) m_statusbar.setStatus(iStatus); return oldCursor; } }
public class class_name { public Object setStatus(int iStatus, Object comp, Object cursor) { Cursor oldCursor = null; if (comp instanceof Component) if (SwingUtilities.isEventDispatchThread()) // Just being careful { oldCursor = ((Component)comp).getCursor(); // depends on control dependency: [if], data = [none] if (cursor == null) cursor = (Cursor)Cursor.getPredefinedCursor(iStatus); ((Component)comp).setCursor((Cursor)cursor); // depends on control dependency: [if], data = [none] } if (m_statusbar != null) m_statusbar.setStatus(iStatus); return oldCursor; } }
public class class_name { public Metadata createMetadata() { Metadata metadata = new Metadata(); for (TagValue tag : getMetadata().getTags()) { if (tag.getCardinality() == 1) { abstractTiffType t = tag.getValue().get(0); if (t.isIFD()) { Metadata metadata2 = ((IFD) t).createMetadata(); for (String key : metadata2.keySet()) { metadata.add(key, metadata2.get(key)); } } else if (t.containsMetadata()) { try { Metadata meta = t.createMetadata(); metadata.addMetadata(meta); } catch (Exception ex) { // TODO: What? } } } } return metadata; } }
public class class_name { public Metadata createMetadata() { Metadata metadata = new Metadata(); for (TagValue tag : getMetadata().getTags()) { if (tag.getCardinality() == 1) { abstractTiffType t = tag.getValue().get(0); if (t.isIFD()) { Metadata metadata2 = ((IFD) t).createMetadata(); for (String key : metadata2.keySet()) { metadata.add(key, metadata2.get(key)); // depends on control dependency: [for], data = [key] } } else if (t.containsMetadata()) { try { Metadata meta = t.createMetadata(); metadata.addMetadata(meta); // depends on control dependency: [try], data = [none] } catch (Exception ex) { // TODO: What? } // depends on control dependency: [catch], data = [none] } } } return metadata; } }
public class class_name { public ISession createSession(String sessionId, boolean newId) { //create local variable - JIT performance improvement final boolean isTraceOn = com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled(); //need some way to checkForDuplicateCreatedIds or synchronize on some object or something ... look at in-memory if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) { StringBuffer sb = new StringBuffer("id = ").append(sessionId).append(appNameForLogging); LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[CREATE_SESSION], sb.toString()); } if (inProcessOfStopping) { throwException("SessionContext.createWhenStop"); } BackedSession session = null; session = createSessionObject(sessionId); session.updateLastAccessTime(session.getCreationTime()); session.setInsert(); // flag new session for insertion into store session.setMaxInactiveInterval((int) _smc.getSessionInvalidationTime()); session.setUserName(ANONYMOUS_USER); _sessions.put(sessionId, session); // if (session.duplicateIdDetected) { // could happen on zOS if key is defined incorrectly - perhaps doesn't include appname // // other than that, this really should never happen - duplicate ids should not be generated // LoggingUtil.SESSION_LOGGER_CORE.logp(Level.WARNING, methodClassName, methodNames[CREATE_SESSION], "Store.createSessionIdAlreadyExists"); // session = null; // } if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) { LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[CREATE_SESSION], "session = " + session); } return session; } }
public class class_name { public ISession createSession(String sessionId, boolean newId) { //create local variable - JIT performance improvement final boolean isTraceOn = com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled(); //need some way to checkForDuplicateCreatedIds or synchronize on some object or something ... look at in-memory if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) { StringBuffer sb = new StringBuffer("id = ").append(sessionId).append(appNameForLogging); LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[CREATE_SESSION], sb.toString()); // depends on control dependency: [if], data = [none] } if (inProcessOfStopping) { throwException("SessionContext.createWhenStop"); // depends on control dependency: [if], data = [none] } BackedSession session = null; session = createSessionObject(sessionId); session.updateLastAccessTime(session.getCreationTime()); session.setInsert(); // flag new session for insertion into store session.setMaxInactiveInterval((int) _smc.getSessionInvalidationTime()); session.setUserName(ANONYMOUS_USER); _sessions.put(sessionId, session); // if (session.duplicateIdDetected) { // could happen on zOS if key is defined incorrectly - perhaps doesn't include appname // // other than that, this really should never happen - duplicate ids should not be generated // LoggingUtil.SESSION_LOGGER_CORE.logp(Level.WARNING, methodClassName, methodNames[CREATE_SESSION], "Store.createSessionIdAlreadyExists"); // session = null; // } if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) { LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[CREATE_SESSION], "session = " + session); // depends on control dependency: [if], data = [none] } return session; } }
public class class_name { private void addShutdownHook(boolean isClient) { if (shutdownHook == null) { shutdownHook = new ShutdownHook(isClient); Runtime.getRuntime().addShutdownHook(shutdownHook); } } }
public class class_name { private void addShutdownHook(boolean isClient) { if (shutdownHook == null) { shutdownHook = new ShutdownHook(isClient); // depends on control dependency: [if], data = [none] Runtime.getRuntime().addShutdownHook(shutdownHook); // depends on control dependency: [if], data = [(shutdownHook] } } }
public class class_name { public static List<ComponentWithContext> collateVisibles(final WComponent comp) { final List<ComponentWithContext> list = new ArrayList<>(); WComponentTreeVisitor visitor = new WComponentTreeVisitor() { @Override public VisitorResult visit(final WComponent comp) { // In traversing the tree, special components like WInvisbleContainer, WRepeatRoot are still traversed // (so ignore them) if (comp.isVisible()) { list.add(new ComponentWithContext(comp, UIContextHolder.getCurrent())); } return VisitorResult.CONTINUE; } }; traverseVisible(comp, visitor); return list; } }
public class class_name { public static List<ComponentWithContext> collateVisibles(final WComponent comp) { final List<ComponentWithContext> list = new ArrayList<>(); WComponentTreeVisitor visitor = new WComponentTreeVisitor() { @Override public VisitorResult visit(final WComponent comp) { // In traversing the tree, special components like WInvisbleContainer, WRepeatRoot are still traversed // (so ignore them) if (comp.isVisible()) { list.add(new ComponentWithContext(comp, UIContextHolder.getCurrent())); // depends on control dependency: [if], data = [none] } return VisitorResult.CONTINUE; } }; traverseVisible(comp, visitor); return list; } }
public class class_name { protected void detectHandlerMethods() { processAtmostRequestMappingInfo(); try { registerNativeFunctionHandlers( handlerMappingInfoStorage.getHandlerMappingInfos(), NativeFunctionResponseBodyHandler.class); registerNativeFunctionHandlers( handlerMappingInfoStorage.getHandlerWithViewMappingInfos(), NativeFunctionModelAndViewHandler.class); } catch (Exception e) { e.printStackTrace(); } } }
public class class_name { protected void detectHandlerMethods() { processAtmostRequestMappingInfo(); try { registerNativeFunctionHandlers( handlerMappingInfoStorage.getHandlerMappingInfos(), NativeFunctionResponseBodyHandler.class); // depends on control dependency: [try], data = [none] registerNativeFunctionHandlers( handlerMappingInfoStorage.getHandlerWithViewMappingInfos(), NativeFunctionModelAndViewHandler.class); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @ShellMethod(key = "add-properties", value = "Add properties associated with a CAS group/module to a Properties/Yaml configuration file.") public static void add( @ShellOption(value = {"file"}, help = "Path to the CAS configuration file", defaultValue = "/etc/cas/config/cas.properties") final String file, @ShellOption(value = {"group"}, help = "Group/module whose associated settings should be added to the CAS configuration file") final String group) throws Exception { if (StringUtils.isBlank(file)) { LOGGER.warn("Configuration file must be specified"); return; } val filePath = new File(file); if (filePath.exists() && (filePath.isDirectory() || !filePath.canRead() || !filePath.canWrite())) { LOGGER.warn("Configuration file [{}] is not readable/writable or is not a path to a file", filePath.getCanonicalPath()); return; } val results = findProperties(group); LOGGER.info("Located [{}] properties matching [{}]", results.size(), group); switch (FilenameUtils.getExtension(filePath.getName()).toLowerCase()) { case "properties": createConfigurationFileIfNeeded(filePath); val props = loadPropertiesFromConfigurationFile(filePath); writeConfigurationPropertiesToFile(filePath, results, props); break; case "yml": createConfigurationFileIfNeeded(filePath); val yamlProps = CasCoreConfigurationUtils.loadYamlProperties(new FileSystemResource(filePath)); writeYamlConfigurationPropertiesToFile(filePath, results, yamlProps); break; default: LOGGER.warn("Configuration file format [{}] is not recognized", filePath.getCanonicalPath()); } } }
public class class_name { @ShellMethod(key = "add-properties", value = "Add properties associated with a CAS group/module to a Properties/Yaml configuration file.") public static void add( @ShellOption(value = {"file"}, help = "Path to the CAS configuration file", defaultValue = "/etc/cas/config/cas.properties") final String file, @ShellOption(value = {"group"}, help = "Group/module whose associated settings should be added to the CAS configuration file") final String group) throws Exception { if (StringUtils.isBlank(file)) { LOGGER.warn("Configuration file must be specified"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } val filePath = new File(file); if (filePath.exists() && (filePath.isDirectory() || !filePath.canRead() || !filePath.canWrite())) { LOGGER.warn("Configuration file [{}] is not readable/writable or is not a path to a file", filePath.getCanonicalPath()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } val results = findProperties(group); LOGGER.info("Located [{}] properties matching [{}]", results.size(), group); switch (FilenameUtils.getExtension(filePath.getName()).toLowerCase()) { case "properties": createConfigurationFileIfNeeded(filePath); val props = loadPropertiesFromConfigurationFile(filePath); writeConfigurationPropertiesToFile(filePath, results, props); break; case "yml": createConfigurationFileIfNeeded(filePath); val yamlProps = CasCoreConfigurationUtils.loadYamlProperties(new FileSystemResource(filePath)); writeYamlConfigurationPropertiesToFile(filePath, results, yamlProps); break; default: LOGGER.warn("Configuration file format [{}] is not recognized", filePath.getCanonicalPath()); } } }
public class class_name { public static void generateExplorerTypesXml( Element startNode, List<CmsExplorerTypeSettings> explorerTypes, boolean module) { // we need the default access node later to check if the explorer type is an individual setting CmsExplorerTypeAccess defaultAccess = null; if (OpenCms.getWorkplaceManager() != null) { defaultAccess = OpenCms.getWorkplaceManager().getDefaultAccess(); } // get the menu rule translator to eliminate eventual legacy menu rules Iterator<CmsExplorerTypeSettings> i = explorerTypes.iterator(); while (i.hasNext()) { // create an explorer type node CmsExplorerTypeSettings settings = i.next(); if (settings.isAddititionalModuleExplorerType() == module) { Element explorerTypeElement = startNode.addElement(N_EXPLORERTYPE); explorerTypeElement.addAttribute(A_NAME, settings.getName()); explorerTypeElement.addAttribute(A_KEY, settings.getKey()); String originalIcon = settings.getOriginalIcon(); if (CmsStringUtil.isNotEmpty(originalIcon)) { explorerTypeElement.addAttribute(A_ICON, settings.getOriginalIcon()); } if (CmsStringUtil.isNotEmpty(settings.getBigIcon())) { explorerTypeElement.addAttribute(A_BIGICON, settings.getBigIcon()); } if (CmsStringUtil.isNotEmpty(settings.getSmallIconStyle())) { explorerTypeElement.addAttribute(A_SMALLICONSTYLE, settings.getSmallIconStyle()); } if (CmsStringUtil.isNotEmpty(settings.getBigIconStyle())) { explorerTypeElement.addAttribute(A_BIGICONSTYLE, settings.getBigIconStyle()); } if (settings.getReference() != null) { explorerTypeElement.addAttribute(A_REFERENCE, settings.getReference()); } if (settings.getElementView() != null) { explorerTypeElement.addAttribute(A_ELEMENTVIEW, settings.getElementView()); } if (settings.isView()) { explorerTypeElement.addAttribute(A_ISVIEW, "true"); } if (settings.getNamePattern() != null) { explorerTypeElement.addAttribute(A_NAME_PATTERN, settings.getNamePattern()); } if (settings.getViewOrder(false) != null) { explorerTypeElement.addAttribute(A_VIEW_ORDER, "" + settings.getViewOrder(false)); } // create subnode <newresource> Element newResElement = explorerTypeElement.addElement(N_NEWRESOURCE); newResElement.addAttribute(A_CREATABLE, String.valueOf(settings.isCreatable())); newResElement.addAttribute(A_ORDER, settings.getNewResourceOrder()); newResElement.addAttribute(A_AUTOSETNAVIGATION, String.valueOf(settings.isAutoSetNavigation())); newResElement.addAttribute(A_AUTOSETTITLE, String.valueOf(settings.isAutoSetTitle())); newResElement.addAttribute(A_INFO, settings.getInfo()); newResElement.addAttribute(A_KEY, settings.getTitleKey()); // create subnode <accesscontrol> CmsExplorerTypeAccess access = settings.getAccess(); if (access != defaultAccess) { // don't output the node if this is in fact the default access settings List<String> accessEntries = new ArrayList<String>(access.getAccessEntries().keySet()); // sort accessEntries Collections.sort(accessEntries); if (accessEntries.size() > 0) { Element accessControlElement = explorerTypeElement.addElement(N_ACCESSCONTROL); Iterator<String> k = accessEntries.iterator(); while (k.hasNext()) { String key = k.next(); String value = settings.getAccess().getAccessEntries().get(key); Element accessEntryElement = accessControlElement.addElement(N_ACCESSENTRY); accessEntryElement.addAttribute(A_PRINCIPAL, key); accessEntryElement.addAttribute(A_PERMISSIONS, value); } } } // create subnode <editoptions> if (settings.hasEditOptions()) { Element editOptionsElement = explorerTypeElement.addElement(N_EDITOPTIONS); Element defaultPropertiesElement = editOptionsElement.addElement(N_DEFAULTPROPERTIES); defaultPropertiesElement.addAttribute(A_ENABLED, String.valueOf(settings.isPropertiesEnabled())); defaultPropertiesElement.addAttribute( A_SHOWNAVIGATION, String.valueOf(settings.isShowNavigation())); Iterator<String> m = settings.getProperties().iterator(); while (m.hasNext()) { defaultPropertiesElement.addElement(N_DEFAULTPROPERTY).addAttribute(A_NAME, m.next()); } } Map<String, CmsIconRule> iconRules = settings.getIconRules(); if ((iconRules != null) && !iconRules.isEmpty()) { Element iconRulesElem = explorerTypeElement.addElement(N_ICONRULES); for (Map.Entry<String, CmsIconRule> entry : iconRules.entrySet()) { CmsIconRule rule = entry.getValue(); Element ruleElem = iconRulesElem.addElement(N_ICONRULE); String icon = rule.getIcon(); String bigIcon = rule.getBigIcon(); String extension = rule.getExtension(); ruleElem.addAttribute(A_EXTENSION, extension); if (icon != null) { ruleElem.addAttribute(A_ICON, icon); } if (bigIcon != null) { ruleElem.addAttribute(A_BIGICON, bigIcon); } if (rule.getSmallIconStyle() != null) { ruleElem.addAttribute(A_SMALLICONSTYLE, rule.getSmallIconStyle()); } if (rule.getBigIconStyle() != null) { ruleElem.addAttribute(A_BIGICONSTYLE, rule.getBigIconStyle()); } } } } } } }
public class class_name { public static void generateExplorerTypesXml( Element startNode, List<CmsExplorerTypeSettings> explorerTypes, boolean module) { // we need the default access node later to check if the explorer type is an individual setting CmsExplorerTypeAccess defaultAccess = null; if (OpenCms.getWorkplaceManager() != null) { defaultAccess = OpenCms.getWorkplaceManager().getDefaultAccess(); // depends on control dependency: [if], data = [none] } // get the menu rule translator to eliminate eventual legacy menu rules Iterator<CmsExplorerTypeSettings> i = explorerTypes.iterator(); while (i.hasNext()) { // create an explorer type node CmsExplorerTypeSettings settings = i.next(); if (settings.isAddititionalModuleExplorerType() == module) { Element explorerTypeElement = startNode.addElement(N_EXPLORERTYPE); explorerTypeElement.addAttribute(A_NAME, settings.getName()); // depends on control dependency: [if], data = [none] explorerTypeElement.addAttribute(A_KEY, settings.getKey()); // depends on control dependency: [if], data = [none] String originalIcon = settings.getOriginalIcon(); if (CmsStringUtil.isNotEmpty(originalIcon)) { explorerTypeElement.addAttribute(A_ICON, settings.getOriginalIcon()); // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isNotEmpty(settings.getBigIcon())) { explorerTypeElement.addAttribute(A_BIGICON, settings.getBigIcon()); // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isNotEmpty(settings.getSmallIconStyle())) { explorerTypeElement.addAttribute(A_SMALLICONSTYLE, settings.getSmallIconStyle()); // depends on control dependency: [if], data = [none] } if (CmsStringUtil.isNotEmpty(settings.getBigIconStyle())) { explorerTypeElement.addAttribute(A_BIGICONSTYLE, settings.getBigIconStyle()); // depends on control dependency: [if], data = [none] } if (settings.getReference() != null) { explorerTypeElement.addAttribute(A_REFERENCE, settings.getReference()); // depends on control dependency: [if], data = [none] } if (settings.getElementView() != null) { explorerTypeElement.addAttribute(A_ELEMENTVIEW, settings.getElementView()); // depends on control dependency: [if], data = [none] } if (settings.isView()) { explorerTypeElement.addAttribute(A_ISVIEW, "true"); // depends on control dependency: [if], data = [none] } if (settings.getNamePattern() != null) { explorerTypeElement.addAttribute(A_NAME_PATTERN, settings.getNamePattern()); // depends on control dependency: [if], data = [none] } if (settings.getViewOrder(false) != null) { explorerTypeElement.addAttribute(A_VIEW_ORDER, "" + settings.getViewOrder(false)); // depends on control dependency: [if], data = [none] } // create subnode <newresource> Element newResElement = explorerTypeElement.addElement(N_NEWRESOURCE); newResElement.addAttribute(A_CREATABLE, String.valueOf(settings.isCreatable())); // depends on control dependency: [if], data = [none] newResElement.addAttribute(A_ORDER, settings.getNewResourceOrder()); // depends on control dependency: [if], data = [none] newResElement.addAttribute(A_AUTOSETNAVIGATION, String.valueOf(settings.isAutoSetNavigation())); // depends on control dependency: [if], data = [none] newResElement.addAttribute(A_AUTOSETTITLE, String.valueOf(settings.isAutoSetTitle())); // depends on control dependency: [if], data = [none] newResElement.addAttribute(A_INFO, settings.getInfo()); // depends on control dependency: [if], data = [none] newResElement.addAttribute(A_KEY, settings.getTitleKey()); // depends on control dependency: [if], data = [none] // create subnode <accesscontrol> CmsExplorerTypeAccess access = settings.getAccess(); if (access != defaultAccess) { // don't output the node if this is in fact the default access settings List<String> accessEntries = new ArrayList<String>(access.getAccessEntries().keySet()); // sort accessEntries Collections.sort(accessEntries); // depends on control dependency: [if], data = [(access] if (accessEntries.size() > 0) { Element accessControlElement = explorerTypeElement.addElement(N_ACCESSCONTROL); Iterator<String> k = accessEntries.iterator(); while (k.hasNext()) { String key = k.next(); String value = settings.getAccess().getAccessEntries().get(key); Element accessEntryElement = accessControlElement.addElement(N_ACCESSENTRY); accessEntryElement.addAttribute(A_PRINCIPAL, key); // depends on control dependency: [while], data = [none] accessEntryElement.addAttribute(A_PERMISSIONS, value); // depends on control dependency: [while], data = [none] } } } // create subnode <editoptions> if (settings.hasEditOptions()) { Element editOptionsElement = explorerTypeElement.addElement(N_EDITOPTIONS); Element defaultPropertiesElement = editOptionsElement.addElement(N_DEFAULTPROPERTIES); defaultPropertiesElement.addAttribute(A_ENABLED, String.valueOf(settings.isPropertiesEnabled())); // depends on control dependency: [if], data = [none] defaultPropertiesElement.addAttribute( A_SHOWNAVIGATION, String.valueOf(settings.isShowNavigation())); // depends on control dependency: [if], data = [none] Iterator<String> m = settings.getProperties().iterator(); while (m.hasNext()) { defaultPropertiesElement.addElement(N_DEFAULTPROPERTY).addAttribute(A_NAME, m.next()); // depends on control dependency: [while], data = [none] } } Map<String, CmsIconRule> iconRules = settings.getIconRules(); if ((iconRules != null) && !iconRules.isEmpty()) { Element iconRulesElem = explorerTypeElement.addElement(N_ICONRULES); for (Map.Entry<String, CmsIconRule> entry : iconRules.entrySet()) { CmsIconRule rule = entry.getValue(); Element ruleElem = iconRulesElem.addElement(N_ICONRULE); String icon = rule.getIcon(); String bigIcon = rule.getBigIcon(); String extension = rule.getExtension(); ruleElem.addAttribute(A_EXTENSION, extension); // depends on control dependency: [for], data = [none] if (icon != null) { ruleElem.addAttribute(A_ICON, icon); // depends on control dependency: [if], data = [none] } if (bigIcon != null) { ruleElem.addAttribute(A_BIGICON, bigIcon); // depends on control dependency: [if], data = [none] } if (rule.getSmallIconStyle() != null) { ruleElem.addAttribute(A_SMALLICONSTYLE, rule.getSmallIconStyle()); // depends on control dependency: [if], data = [none] } if (rule.getBigIconStyle() != null) { ruleElem.addAttribute(A_BIGICONSTYLE, rule.getBigIconStyle()); // depends on control dependency: [if], data = [none] } } } } } } }
public class class_name { protected HttpUriRequest buildMethod(final String method, final String path, final Map<String, Object> params) { if (StringUtils.equalsIgnoreCase(method, HttpGet.METHOD_NAME)) { return generateGetRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpPost.METHOD_NAME)) { return generatePostRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpPut.METHOD_NAME)) { return generatePutRequest(path, params); } else if (StringUtils.equalsIgnoreCase(method, HttpDelete.METHOD_NAME)) { return generateDeleteRequest(path); } else { throw new RuntimeException("Must not be here."); } } }
public class class_name { protected HttpUriRequest buildMethod(final String method, final String path, final Map<String, Object> params) { if (StringUtils.equalsIgnoreCase(method, HttpGet.METHOD_NAME)) { return generateGetRequest(path, params); // depends on control dependency: [if], data = [none] } else if (StringUtils.equalsIgnoreCase(method, HttpPost.METHOD_NAME)) { return generatePostRequest(path, params); // depends on control dependency: [if], data = [none] } else if (StringUtils.equalsIgnoreCase(method, HttpPut.METHOD_NAME)) { return generatePutRequest(path, params); // depends on control dependency: [if], data = [none] } else if (StringUtils.equalsIgnoreCase(method, HttpDelete.METHOD_NAME)) { return generateDeleteRequest(path); // depends on control dependency: [if], data = [none] } else { throw new RuntimeException("Must not be here."); } } }
public class class_name { private void buildClassPath() throws InterruptedException, IOException, CheckedAnalysisException { IClassPathBuilder builder = classFactory.createClassPathBuilder(bugReporter); { HashSet<String> seen = new HashSet<>(); for (String path : project.getFileArray()) { if (seen.add(path)) { builder.addCodeBase(classFactory.createFilesystemCodeBaseLocator(path), true); } } for (String path : project.getAuxClasspathEntryList()) { if (seen.add(path)) { builder.addCodeBase(classFactory.createFilesystemCodeBaseLocator(path), false); } } } builder.scanNestedArchives(analysisOptions.scanNestedArchives); builder.build(classPath, progressReporter); appClassList = builder.getAppClassList(); if (PROGRESS) { System.out.println(appClassList.size() + " classes scanned"); } // If any of the application codebases contain source code, // add them to the source path. // Also, use the last modified time of application codebases // to set the project timestamp. List<String> pathNames = new ArrayList<>(); for (Iterator<? extends ICodeBase> i = classPath.appCodeBaseIterator(); i.hasNext();) { ICodeBase appCodeBase = i.next(); if (appCodeBase.containsSourceFiles()) { String pathName = appCodeBase.getPathName(); if (pathName != null) { pathNames.add(pathName); } } project.addTimestamp(appCodeBase.getLastModifiedTime()); } project.addSourceDirs(pathNames); } }
public class class_name { private void buildClassPath() throws InterruptedException, IOException, CheckedAnalysisException { IClassPathBuilder builder = classFactory.createClassPathBuilder(bugReporter); { HashSet<String> seen = new HashSet<>(); for (String path : project.getFileArray()) { if (seen.add(path)) { builder.addCodeBase(classFactory.createFilesystemCodeBaseLocator(path), true); // depends on control dependency: [if], data = [none] } } for (String path : project.getAuxClasspathEntryList()) { if (seen.add(path)) { builder.addCodeBase(classFactory.createFilesystemCodeBaseLocator(path), false); // depends on control dependency: [if], data = [none] } } } builder.scanNestedArchives(analysisOptions.scanNestedArchives); builder.build(classPath, progressReporter); appClassList = builder.getAppClassList(); if (PROGRESS) { System.out.println(appClassList.size() + " classes scanned"); } // If any of the application codebases contain source code, // add them to the source path. // Also, use the last modified time of application codebases // to set the project timestamp. List<String> pathNames = new ArrayList<>(); for (Iterator<? extends ICodeBase> i = classPath.appCodeBaseIterator(); i.hasNext();) { ICodeBase appCodeBase = i.next(); if (appCodeBase.containsSourceFiles()) { String pathName = appCodeBase.getPathName(); if (pathName != null) { pathNames.add(pathName); // depends on control dependency: [if], data = [(pathName] } } project.addTimestamp(appCodeBase.getLastModifiedTime()); } project.addSourceDirs(pathNames); } }
public class class_name { public static void main(String args[]) { if (args.length < 2) { System.err.println("arguments: file1 [file2 ...] destfile"); } else { try { int pageOffset = 0; ArrayList master = new ArrayList(); int f = 0; String outFile = args[args.length-1]; Document document = null; PdfCopy writer = null; while (f < args.length-1) { // we create a reader for a certain document PdfReader reader = new PdfReader(args[f]); reader.consolidateNamedDestinations(); // we retrieve the total number of pages int n = reader.getNumberOfPages(); List bookmarks = SimpleBookmark.getBookmark(reader); if (bookmarks != null) { if (pageOffset != 0) SimpleBookmark.shiftPageNumbers(bookmarks, pageOffset, null); master.addAll(bookmarks); } pageOffset += n; System.out.println("There are " + n + " pages in " + args[f]); if (f == 0) { // step 1: creation of a document-object document = new Document(reader.getPageSizeWithRotation(1)); // step 2: we create a writer that listens to the document writer = new PdfCopy(document, new FileOutputStream(outFile)); // step 3: we open the document document.open(); } // step 4: we add content PdfImportedPage page; for (int i = 0; i < n; ) { ++i; page = writer.getImportedPage(reader, i); writer.addPage(page); System.out.println("Processed page " + i); } writer.freeReader(reader); f++; } if (!master.isEmpty()) writer.setOutlines(master); // step 5: we close the document document.close(); } catch(Exception e) { e.printStackTrace(); } } } }
public class class_name { public static void main(String args[]) { if (args.length < 2) { System.err.println("arguments: file1 [file2 ...] destfile"); } else { try { int pageOffset = 0; ArrayList master = new ArrayList(); int f = 0; String outFile = args[args.length-1]; Document document = null; PdfCopy writer = null; while (f < args.length-1) { // we create a reader for a certain document PdfReader reader = new PdfReader(args[f]); reader.consolidateNamedDestinations(); // depends on control dependency: [while], data = [none] // we retrieve the total number of pages int n = reader.getNumberOfPages(); List bookmarks = SimpleBookmark.getBookmark(reader); if (bookmarks != null) { if (pageOffset != 0) SimpleBookmark.shiftPageNumbers(bookmarks, pageOffset, null); master.addAll(bookmarks); // depends on control dependency: [if], data = [(bookmarks] } pageOffset += n; // depends on control dependency: [while], data = [none] System.out.println("There are " + n + " pages in " + args[f]); // depends on control dependency: [while], data = [none] if (f == 0) { // step 1: creation of a document-object document = new Document(reader.getPageSizeWithRotation(1)); // depends on control dependency: [if], data = [none] // step 2: we create a writer that listens to the document writer = new PdfCopy(document, new FileOutputStream(outFile)); // depends on control dependency: [if], data = [none] // step 3: we open the document document.open(); // depends on control dependency: [if], data = [none] } // step 4: we add content PdfImportedPage page; for (int i = 0; i < n; ) { ++i; // depends on control dependency: [for], data = [i] page = writer.getImportedPage(reader, i); // depends on control dependency: [for], data = [i] writer.addPage(page); // depends on control dependency: [for], data = [none] System.out.println("Processed page " + i); // depends on control dependency: [for], data = [i] } writer.freeReader(reader); // depends on control dependency: [while], data = [none] f++; // depends on control dependency: [while], data = [none] } if (!master.isEmpty()) writer.setOutlines(master); // step 5: we close the document document.close(); // depends on control dependency: [try], data = [none] } catch(Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static String implode(String glue, Object[] pieces) { if ( pieces == null ) { return null; } StringBuffer sb = new StringBuffer(); for ( Object o : pieces ) { if ( sb.length() > 0 ) { sb.append(glue); } sb.append(o.toString()); } return sb.toString(); } }
public class class_name { public static String implode(String glue, Object[] pieces) { if ( pieces == null ) { return null; // depends on control dependency: [if], data = [none] } StringBuffer sb = new StringBuffer(); for ( Object o : pieces ) { if ( sb.length() > 0 ) { sb.append(glue); // depends on control dependency: [if], data = [none] } sb.append(o.toString()); // depends on control dependency: [for], data = [o] } return sb.toString(); } }
public class class_name { @SuppressWarnings("PMD.EmptyCatchBlock") private synchronized void cleanup(final WatchKey key) { logger.trace("cleanUp {}", key); try { key.cancel(); }catch(Exception ex) { //trap } Collection<SFMF4JWatchListener> listeners = listenersByWatchKey.remove(key); if (listeners != null && !listeners.isEmpty()) { logger.warn("Cleaning up key but listeners are still registered."); } String path = pathsByWatchKey.remove(key); if (path != null) { watchKeysByPath.remove(path); } } }
public class class_name { @SuppressWarnings("PMD.EmptyCatchBlock") private synchronized void cleanup(final WatchKey key) { logger.trace("cleanUp {}", key); try { key.cancel(); // depends on control dependency: [try], data = [none] }catch(Exception ex) { //trap } // depends on control dependency: [catch], data = [none] Collection<SFMF4JWatchListener> listeners = listenersByWatchKey.remove(key); if (listeners != null && !listeners.isEmpty()) { logger.warn("Cleaning up key but listeners are still registered."); // depends on control dependency: [if], data = [none] } String path = pathsByWatchKey.remove(key); if (path != null) { watchKeysByPath.remove(path); // depends on control dependency: [if], data = [(path] } } }
public class class_name { public void marshall(PutMediaRequest putMediaRequest, ProtocolMarshaller protocolMarshaller) { if (putMediaRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putMediaRequest.getStreamName(), STREAMNAME_BINDING); protocolMarshaller.marshall(putMediaRequest.getStreamARN(), STREAMARN_BINDING); protocolMarshaller.marshall(putMediaRequest.getFragmentTimecodeType(), FRAGMENTTIMECODETYPE_BINDING); protocolMarshaller.marshall(putMediaRequest.getProducerStartTimestamp(), PRODUCERSTARTTIMESTAMP_BINDING); protocolMarshaller.marshall(putMediaRequest.getPayload(), PAYLOAD_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(PutMediaRequest putMediaRequest, ProtocolMarshaller protocolMarshaller) { if (putMediaRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(putMediaRequest.getStreamName(), STREAMNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMediaRequest.getStreamARN(), STREAMARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMediaRequest.getFragmentTimecodeType(), FRAGMENTTIMECODETYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMediaRequest.getProducerStartTimestamp(), PRODUCERSTARTTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(putMediaRequest.getPayload(), PAYLOAD_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 static BlockAndLocation[] locatedBlocks2BlockLocations( LocatedBlocks blocks) { if (blocks == null) { return new BlockAndLocation[0]; } int nrBlocks = blocks.locatedBlockCount(); BlockAndLocation[] blkLocations = new BlockAndLocation[nrBlocks]; if (nrBlocks == 0) { return blkLocations; } int idx = 0; for (LocatedBlock blk : blocks.getLocatedBlocks()) { assert idx < nrBlocks : "Incorrect index"; DatanodeInfo[] locations = blk.getLocations(); String[] hosts = new String[locations.length]; String[] names = new String[locations.length]; String[] racks = new String[locations.length]; for (int hCnt = 0; hCnt < locations.length; hCnt++) { hosts[hCnt] = locations[hCnt].getHostName(); names[hCnt] = locations[hCnt].getName(); NodeBase node = new NodeBase(names[hCnt], locations[hCnt].getNetworkLocation()); racks[hCnt] = node.toString(); } Block block = blk.getBlock(); blkLocations[idx] = new BlockAndLocation(block.getBlockId(), block.getGenerationStamp(), names, hosts, racks, blk.getStartOffset(), block.getNumBytes(), blk.isCorrupt()); idx++; } return blkLocations; } }
public class class_name { public static BlockAndLocation[] locatedBlocks2BlockLocations( LocatedBlocks blocks) { if (blocks == null) { return new BlockAndLocation[0]; // depends on control dependency: [if], data = [none] } int nrBlocks = blocks.locatedBlockCount(); BlockAndLocation[] blkLocations = new BlockAndLocation[nrBlocks]; if (nrBlocks == 0) { return blkLocations; // depends on control dependency: [if], data = [none] } int idx = 0; for (LocatedBlock blk : blocks.getLocatedBlocks()) { assert idx < nrBlocks : "Incorrect index"; DatanodeInfo[] locations = blk.getLocations(); String[] hosts = new String[locations.length]; String[] names = new String[locations.length]; String[] racks = new String[locations.length]; for (int hCnt = 0; hCnt < locations.length; hCnt++) { hosts[hCnt] = locations[hCnt].getHostName(); // depends on control dependency: [for], data = [hCnt] names[hCnt] = locations[hCnt].getName(); // depends on control dependency: [for], data = [hCnt] NodeBase node = new NodeBase(names[hCnt], locations[hCnt].getNetworkLocation()); racks[hCnt] = node.toString(); // depends on control dependency: [for], data = [hCnt] } Block block = blk.getBlock(); blkLocations[idx] = new BlockAndLocation(block.getBlockId(), block.getGenerationStamp(), names, hosts, racks, blk.getStartOffset(), block.getNumBytes(), blk.isCorrupt()); // depends on control dependency: [for], data = [blk] idx++; // depends on control dependency: [for], data = [none] } return blkLocations; } }
public class class_name { public Map<String, DesignDocument.View> generateViewsFromPersistentType( final Class<?> persistentType) { Assert.notNull(persistentType, "persistentType may not be null"); final Map<String, DesignDocument.View> views = new HashMap<String, DesignDocument.View>(); createDeclaredViews(views, persistentType); eachField(persistentType, new Predicate<Field>() { public boolean apply(Field input) { if (hasAnnotation(input, DocumentReferences.class)) { generateView(views, input); } return false; } }); return views; } }
public class class_name { public Map<String, DesignDocument.View> generateViewsFromPersistentType( final Class<?> persistentType) { Assert.notNull(persistentType, "persistentType may not be null"); final Map<String, DesignDocument.View> views = new HashMap<String, DesignDocument.View>(); createDeclaredViews(views, persistentType); eachField(persistentType, new Predicate<Field>() { public boolean apply(Field input) { if (hasAnnotation(input, DocumentReferences.class)) { generateView(views, input); // depends on control dependency: [if], data = [none] } return false; } }); return views; } }
public class class_name { public static synchronized void putChannelGroup(WonderPushChannelGroup channelGroup) { try { if (_putChannelGroup(channelGroup)) { save(); } } catch (Exception ex) { Log.e(WonderPush.TAG, "Unexpected error while putting channel group " + channelGroup, ex); } } }
public class class_name { public static synchronized void putChannelGroup(WonderPushChannelGroup channelGroup) { try { if (_putChannelGroup(channelGroup)) { save(); // depends on control dependency: [if], data = [none] } } catch (Exception ex) { Log.e(WonderPush.TAG, "Unexpected error while putting channel group " + channelGroup, ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Resource[] getResources(String locationPattern) { try { return resolver.getResources(locationPattern); } catch (IOException e) { throw MiscUtil.toUnchecked(e); } } }
public class class_name { public static Resource[] getResources(String locationPattern) { try { return resolver.getResources(locationPattern); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw MiscUtil.toUnchecked(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void setService(final String name, final FrameworkSupportService service){ synchronized (services){ if(null==services.get(name) && null!=service) { services.put(name, service); }else if(null==service) { services.remove(name); } } } }
public class class_name { @Override public void setService(final String name, final FrameworkSupportService service){ synchronized (services){ if(null==services.get(name) && null!=service) { services.put(name, service); // depends on control dependency: [if], data = [none] }else if(null==service) { services.remove(name); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Binder foldVoid(MethodHandle function) { if (type().returnType() == void.class) { return fold(function); } else { return fold(function.asType(function.type().changeReturnType(void.class))); } } }
public class class_name { public Binder foldVoid(MethodHandle function) { if (type().returnType() == void.class) { return fold(function); // depends on control dependency: [if], data = [none] } else { return fold(function.asType(function.type().changeReturnType(void.class))); // depends on control dependency: [if], data = [void.class)] } } }
public class class_name { public void setLoop(boolean doLoop, GVRContext gvrContext) { if (this.loop != doLoop ) { // a change in the loop for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { if (doLoop) gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.REPEATED); else gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.ONCE); } // be sure to start the animations if loop is true if ( doLoop ) { for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { gvrKeyFrameAnimation.start(gvrContext.getAnimationEngine() ); } } this.loop = doLoop; } } }
public class class_name { public void setLoop(boolean doLoop, GVRContext gvrContext) { if (this.loop != doLoop ) { // a change in the loop for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { if (doLoop) gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.REPEATED); else gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.ONCE); } // be sure to start the animations if loop is true if ( doLoop ) { for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { gvrKeyFrameAnimation.start(gvrContext.getAnimationEngine() ); // depends on control dependency: [for], data = [gvrKeyFrameAnimation] } } this.loop = doLoop; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String getHostnameValue() { if (!hostnameInitialised) { synchronized (LOCK) { if (!hostnameInitialised) { hostname = lookupHostname(); hostnameInitialised = true; } } } return hostname; } }
public class class_name { public static String getHostnameValue() { if (!hostnameInitialised) { synchronized (LOCK) { // depends on control dependency: [if], data = [none] if (!hostnameInitialised) { hostname = lookupHostname(); // depends on control dependency: [if], data = [none] hostnameInitialised = true; // depends on control dependency: [if], data = [none] } } } return hostname; } }
public class class_name { public static ReleaseId toReleaseId(String releaseId) { if (releaseId != null) { String[] gav = releaseId.split(":", 3); String groupId = gav.length > 0 ? gav[0] : null; String artifactId = gav.length > 1 ? gav[1] : null; String version = gav.length > 2 ? gav[2] : null; return KieServices.Factory.get().newReleaseId(groupId, artifactId, version); } return null; } }
public class class_name { public static ReleaseId toReleaseId(String releaseId) { if (releaseId != null) { String[] gav = releaseId.split(":", 3); String groupId = gav.length > 0 ? gav[0] : null; String artifactId = gav.length > 1 ? gav[1] : null; String version = gav.length > 2 ? gav[2] : null; return KieServices.Factory.get().newReleaseId(groupId, artifactId, version); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public Page serviceAt(String uri, Class<?> pageClass) { // Handle subpaths, registering each as a separate instance of the page // tuple. for (Method method : pageClass.getDeclaredMethods()) { if (method.isAnnotationPresent(At.class)) { // This is a subpath expression. At at = method.getAnnotation(At.class); String subpath = at.value(); // Validate subpath if (!subpath.startsWith("/") || subpath.isEmpty() || subpath.length() == 1) { throw new IllegalArgumentException(String.format( "Subpath At(\"%s\") on %s.%s() must begin with a \"/\" and must not be empty", subpath, pageClass.getName(), method.getName())); } subpath = uri + subpath; // Register as headless web service. doAt(subpath, pageClass, true); } } return doAt(uri, pageClass, true); } }
public class class_name { public Page serviceAt(String uri, Class<?> pageClass) { // Handle subpaths, registering each as a separate instance of the page // tuple. for (Method method : pageClass.getDeclaredMethods()) { if (method.isAnnotationPresent(At.class)) { // This is a subpath expression. At at = method.getAnnotation(At.class); String subpath = at.value(); // Validate subpath if (!subpath.startsWith("/") || subpath.isEmpty() || subpath.length() == 1) { throw new IllegalArgumentException(String.format( "Subpath At(\"%s\") on %s.%s() must begin with a \"/\" and must not be empty", subpath, pageClass.getName(), method.getName())); } subpath = uri + subpath; // depends on control dependency: [if], data = [none] // Register as headless web service. doAt(subpath, pageClass, true); // depends on control dependency: [if], data = [none] } } return doAt(uri, pageClass, true); } }
public class class_name { public CommandLine setOverwrittenOptionsAllowed(boolean newValue) { getCommandSpec().parser().overwrittenOptionsAllowed(newValue); for (CommandLine command : getCommandSpec().subcommands().values()) { command.setOverwrittenOptionsAllowed(newValue); } return this; } }
public class class_name { public CommandLine setOverwrittenOptionsAllowed(boolean newValue) { getCommandSpec().parser().overwrittenOptionsAllowed(newValue); for (CommandLine command : getCommandSpec().subcommands().values()) { command.setOverwrittenOptionsAllowed(newValue); // depends on control dependency: [for], data = [command] } return this; } }
public class class_name { static public void recursiveCreateDirectory(FTPClient ftpClient, String path) throws IOException { logger.info("Create Directory: {}", path); int createDirectoryStatus = ftpClient.mkd(path); // makeDirectory... logger.debug("Create Directory Status: {}", createDirectoryStatus); if (createDirectoryStatus == FTP_FILE_NOT_FOUND) { int sepIdx = path.lastIndexOf('/'); if (sepIdx > -1) { String parentPath = path.substring(0, sepIdx); recursiveCreateDirectory(ftpClient, parentPath); logger.debug("2'nd CreateD irectory: {}", path); createDirectoryStatus = ftpClient.mkd(path); // makeDirectory... logger.debug("2'nd Create Directory Status: {}", createDirectoryStatus); } } } }
public class class_name { static public void recursiveCreateDirectory(FTPClient ftpClient, String path) throws IOException { logger.info("Create Directory: {}", path); int createDirectoryStatus = ftpClient.mkd(path); // makeDirectory... logger.debug("Create Directory Status: {}", createDirectoryStatus); if (createDirectoryStatus == FTP_FILE_NOT_FOUND) { int sepIdx = path.lastIndexOf('/'); if (sepIdx > -1) { String parentPath = path.substring(0, sepIdx); recursiveCreateDirectory(ftpClient, parentPath); // depends on control dependency: [if], data = [none] logger.debug("2'nd CreateD irectory: {}", path); // depends on control dependency: [if], data = [none] createDirectoryStatus = ftpClient.mkd(path); // makeDirectory... // depends on control dependency: [if], data = [none] logger.debug("2'nd Create Directory Status: {}", createDirectoryStatus); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void alias( double value , String name ) { if( isReserved(name)) throw new RuntimeException("Reserved word or contains a reserved character. '"+name+"'"); VariableDouble old = (VariableDouble)variables.get(name); if( old == null ) { variables.put(name, new VariableDouble(value)); }else { old.value = value; } } }
public class class_name { public void alias( double value , String name ) { if( isReserved(name)) throw new RuntimeException("Reserved word or contains a reserved character. '"+name+"'"); VariableDouble old = (VariableDouble)variables.get(name); if( old == null ) { variables.put(name, new VariableDouble(value)); // depends on control dependency: [if], data = [none] }else { old.value = value; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static void log(Category category, String prepared, String sql) { if (logger != null && isCategoryOk(category)) { doLog(-1, category, prepared, sql); } } }
public class class_name { public static void log(Category category, String prepared, String sql) { if (logger != null && isCategoryOk(category)) { doLog(-1, category, prepared, sql); // depends on control dependency: [if], data = [none] } } }
public class class_name { FunctionTypeBuilder inferTemplateTypeName(@Nullable JSDocInfo info, @Nullable JSType ownerType) { // NOTE: these template type names may override a list // of inherited ones from an overridden function. if (info != null && !maybeUseNativeClassTemplateNames(info)) { ImmutableList<TemplateType> templates = buildTemplateTypesFromJSDocInfo(info, !(isConstructor || isInterface)); if (!templates.isEmpty()) { this.templateTypeNames = templates; } } ImmutableList<TemplateType> ownerTypeKeys = ownerType != null ? ownerType.getTemplateTypeMap().getTemplateKeys() : ImmutableList.of(); if (!templateTypeNames.isEmpty() || !ownerTypeKeys.isEmpty()) { // TODO(sdh): The order of these should be switched to avoid class templates shadowing // method templates, but this currently loosens type checking of arrays more than we'd like. // See http://github.com/google/closure-compiler/issues/2973 registerTemplates( Iterables.concat(templateTypeNames, ownerTypeKeys), contents.getSourceNode()); } return this; } }
public class class_name { FunctionTypeBuilder inferTemplateTypeName(@Nullable JSDocInfo info, @Nullable JSType ownerType) { // NOTE: these template type names may override a list // of inherited ones from an overridden function. if (info != null && !maybeUseNativeClassTemplateNames(info)) { ImmutableList<TemplateType> templates = buildTemplateTypesFromJSDocInfo(info, !(isConstructor || isInterface)); if (!templates.isEmpty()) { this.templateTypeNames = templates; // depends on control dependency: [if], data = [none] } } ImmutableList<TemplateType> ownerTypeKeys = ownerType != null ? ownerType.getTemplateTypeMap().getTemplateKeys() : ImmutableList.of(); if (!templateTypeNames.isEmpty() || !ownerTypeKeys.isEmpty()) { // TODO(sdh): The order of these should be switched to avoid class templates shadowing // method templates, but this currently loosens type checking of arrays more than we'd like. // See http://github.com/google/closure-compiler/issues/2973 registerTemplates( Iterables.concat(templateTypeNames, ownerTypeKeys), contents.getSourceNode()); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { public void swap(Tree<T> node) { Tree<T> thisParent = this.parent; List<Tree<T>> thisChildren = new ArrayList<>(this.children); this.removeFromParent(); if (node.parent != null) { node.parent.add(this); } node.children.forEach(this::add); node.removeFromParent(); if (thisParent != null) { thisParent.add(node); } thisChildren.forEach(node::add); } }
public class class_name { public void swap(Tree<T> node) { Tree<T> thisParent = this.parent; List<Tree<T>> thisChildren = new ArrayList<>(this.children); this.removeFromParent(); if (node.parent != null) { node.parent.add(this); // depends on control dependency: [if], data = [none] } node.children.forEach(this::add); node.removeFromParent(); if (thisParent != null) { thisParent.add(node); // depends on control dependency: [if], data = [none] } thisChildren.forEach(node::add); } }
public class class_name { private void updatePreferenceCache() { for (PrefsProtos.Pref pref : service.listPrefs(true, null)) { preferences.add(new ScopePreference(this, pref)); } } }
public class class_name { private void updatePreferenceCache() { for (PrefsProtos.Pref pref : service.listPrefs(true, null)) { preferences.add(new ScopePreference(this, pref)); // depends on control dependency: [for], data = [pref] } } }
public class class_name { private List<Proposition> filterMatches(Proposition inProposition, Collection<Proposition> propositions, Set<Proposition> cache) { TemporalProposition inTp = null; if (this.relation != null) { if (inProposition instanceof TemporalProposition) { inTp = (TemporalProposition) inProposition; } } List<Proposition> result = new ArrayList<>(); if (propositions != null) { for (Proposition proposition : propositions) { if (cache.add(proposition) && isMatch(proposition) && hasAllowedValue(proposition)) { if (inTp != null && proposition instanceof TemporalProposition) { TemporalProposition tp = (TemporalProposition) proposition; if (!this.relation.hasRelation(tp.getInterval(), inTp.getInterval())) { continue; } } result.add(proposition); } } } return result; } }
public class class_name { private List<Proposition> filterMatches(Proposition inProposition, Collection<Proposition> propositions, Set<Proposition> cache) { TemporalProposition inTp = null; if (this.relation != null) { if (inProposition instanceof TemporalProposition) { inTp = (TemporalProposition) inProposition; // depends on control dependency: [if], data = [none] } } List<Proposition> result = new ArrayList<>(); if (propositions != null) { for (Proposition proposition : propositions) { if (cache.add(proposition) && isMatch(proposition) && hasAllowedValue(proposition)) { if (inTp != null && proposition instanceof TemporalProposition) { TemporalProposition tp = (TemporalProposition) proposition; if (!this.relation.hasRelation(tp.getInterval(), inTp.getInterval())) { continue; } } result.add(proposition); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { protected IRExpression compileExpansionDirectlyToArray( IType rootType, IType rootComponentType, IType resultType, IType resultCompType ) { // Evaluate the root and assign it to a temp variable IRSymbol tempRoot = _cc().makeAndIndexTempSymbol( getDescriptor( rootType ) ); IRStatement tempRootAssignment = buildAssignment( tempRoot, ExpressionTransformer.compile( _expr().getRootExpression(), _cc() ) ); // Create the result array and assign it to a temp variable IRSymbol resultArray = _cc().makeAndIndexTempSymbol( getDescriptor( resultType ) ); IRStatement arrayCreation = buildAssignment( resultArray, makeArray( resultCompType, createArrayLengthExpression( rootType, tempRoot ) ) ); // Create the loop that populates the array IRForEachStatement forLoop = createArrayStoreLoop(rootType, rootComponentType, resultCompType, tempRoot, resultArray); // Build the expansion out of the array creation, for loop, and identifier IRExpression expansion = buildComposite( arrayCreation, forLoop, identifier( resultArray ) ); // Short-circuit if we're not dealing with primitive types if (!rootComponentType.isPrimitive() && !resultCompType.isPrimitive()) { return buildComposite( tempRootAssignment, buildNullCheckTernary( identifier( tempRoot ), checkCast( _expr().getType(), makeArray(resultCompType, numericLiteral(0)) ), checkCast( _expr().getType(), expansion ) ) ); } else { return buildComposite( tempRootAssignment, checkCast( _expr().getType(), expansion ) ); } } }
public class class_name { protected IRExpression compileExpansionDirectlyToArray( IType rootType, IType rootComponentType, IType resultType, IType resultCompType ) { // Evaluate the root and assign it to a temp variable IRSymbol tempRoot = _cc().makeAndIndexTempSymbol( getDescriptor( rootType ) ); IRStatement tempRootAssignment = buildAssignment( tempRoot, ExpressionTransformer.compile( _expr().getRootExpression(), _cc() ) ); // Create the result array and assign it to a temp variable IRSymbol resultArray = _cc().makeAndIndexTempSymbol( getDescriptor( resultType ) ); IRStatement arrayCreation = buildAssignment( resultArray, makeArray( resultCompType, createArrayLengthExpression( rootType, tempRoot ) ) ); // Create the loop that populates the array IRForEachStatement forLoop = createArrayStoreLoop(rootType, rootComponentType, resultCompType, tempRoot, resultArray); // Build the expansion out of the array creation, for loop, and identifier IRExpression expansion = buildComposite( arrayCreation, forLoop, identifier( resultArray ) ); // Short-circuit if we're not dealing with primitive types if (!rootComponentType.isPrimitive() && !resultCompType.isPrimitive()) { return buildComposite( tempRootAssignment, buildNullCheckTernary( identifier( tempRoot ), checkCast( _expr().getType(), makeArray(resultCompType, numericLiteral(0)) ), checkCast( _expr().getType(), expansion ) ) ); // depends on control dependency: [if], data = [none] } else { return buildComposite( tempRootAssignment, checkCast( _expr().getType(), expansion ) ); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Object toObject(VectorTile.Tile.Value value) { Object result = null; if(value.hasDoubleValue()) { result = value.getDoubleValue(); } else if(value.hasFloatValue()) { result = value.getFloatValue(); } else if(value.hasIntValue()) { result = value.getIntValue(); } else if(value.hasBoolValue()) { result = value.getBoolValue(); } else if(value.hasStringValue()) { result = value.getStringValue(); } else if(value.hasSintValue()) { result = value.getSintValue(); } else if(value.hasUintValue()) { result = value.getUintValue(); } return result; } }
public class class_name { public static Object toObject(VectorTile.Tile.Value value) { Object result = null; if(value.hasDoubleValue()) { result = value.getDoubleValue(); // depends on control dependency: [if], data = [none] } else if(value.hasFloatValue()) { result = value.getFloatValue(); // depends on control dependency: [if], data = [none] } else if(value.hasIntValue()) { result = value.getIntValue(); // depends on control dependency: [if], data = [none] } else if(value.hasBoolValue()) { result = value.getBoolValue(); // depends on control dependency: [if], data = [none] } else if(value.hasStringValue()) { result = value.getStringValue(); // depends on control dependency: [if], data = [none] } else if(value.hasSintValue()) { result = value.getSintValue(); // depends on control dependency: [if], data = [none] } else if(value.hasUintValue()) { result = value.getUintValue(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public synchronized void cancel() // d583637 { ivIsCanceled = true; stopAlarm(); // F743-33394 - Wait for the sweep to finish. while (ivIsRunning) { try { wait(); } catch (InterruptedException ex) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "interrupted", ex); Thread.currentThread().interrupt(); } } ivActivator = null; } }
public class class_name { public synchronized void cancel() // d583637 { ivIsCanceled = true; stopAlarm(); // F743-33394 - Wait for the sweep to finish. while (ivIsRunning) { try { wait(); // depends on control dependency: [try], data = [none] } catch (InterruptedException ex) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "interrupted", ex); Thread.currentThread().interrupt(); } // depends on control dependency: [catch], data = [none] } ivActivator = null; } }
public class class_name { @Nonnull public static char [] replaceMultiple (@Nullable final char [] aInput, @Nonnull final char [] aSearchChars, @Nonnull final char [] [] aReplacementStrings) { ValueEnforcer.notNull (aSearchChars, "SearchChars"); ValueEnforcer.notNull (aReplacementStrings, "ReplacementStrings"); ValueEnforcer.isEqual (aSearchChars.length, aReplacementStrings.length, "array length mismatch"); // Any input text? if (aInput == null || aInput.length == 0) return ArrayHelper.EMPTY_CHAR_ARRAY; // Any replacement patterns? if (aSearchChars.length == 0) return aInput; // get result length final int nResultLen = getReplaceMultipleResultLength (aInput, aSearchChars, aReplacementStrings); // nothing to replace in here? if (nResultLen == CGlobal.ILLEGAL_UINT) return aInput; // build result final char [] aOutput = new char [nResultLen]; int nOutputIndex = 0; // For all input chars for (final char cInput : aInput) { boolean bFoundReplacement = false; for (int nPatternIndex = 0; nPatternIndex < aSearchChars.length; nPatternIndex++) { if (cInput == aSearchChars[nPatternIndex]) { final char [] aReplacement = aReplacementStrings[nPatternIndex]; final int nReplacementLength = aReplacement.length; System.arraycopy (aReplacement, 0, aOutput, nOutputIndex, nReplacementLength); nOutputIndex += nReplacementLength; bFoundReplacement = true; break; } } if (!bFoundReplacement) { // copy char as is aOutput[nOutputIndex++] = cInput; } } return aOutput; } }
public class class_name { @Nonnull public static char [] replaceMultiple (@Nullable final char [] aInput, @Nonnull final char [] aSearchChars, @Nonnull final char [] [] aReplacementStrings) { ValueEnforcer.notNull (aSearchChars, "SearchChars"); ValueEnforcer.notNull (aReplacementStrings, "ReplacementStrings"); ValueEnforcer.isEqual (aSearchChars.length, aReplacementStrings.length, "array length mismatch"); // Any input text? if (aInput == null || aInput.length == 0) return ArrayHelper.EMPTY_CHAR_ARRAY; // Any replacement patterns? if (aSearchChars.length == 0) return aInput; // get result length final int nResultLen = getReplaceMultipleResultLength (aInput, aSearchChars, aReplacementStrings); // nothing to replace in here? if (nResultLen == CGlobal.ILLEGAL_UINT) return aInput; // build result final char [] aOutput = new char [nResultLen]; int nOutputIndex = 0; // For all input chars for (final char cInput : aInput) { boolean bFoundReplacement = false; for (int nPatternIndex = 0; nPatternIndex < aSearchChars.length; nPatternIndex++) { if (cInput == aSearchChars[nPatternIndex]) { final char [] aReplacement = aReplacementStrings[nPatternIndex]; final int nReplacementLength = aReplacement.length; System.arraycopy (aReplacement, 0, aOutput, nOutputIndex, nReplacementLength); // depends on control dependency: [if], data = [none] nOutputIndex += nReplacementLength; // depends on control dependency: [if], data = [none] bFoundReplacement = true; // depends on control dependency: [if], data = [none] break; } } if (!bFoundReplacement) { // copy char as is aOutput[nOutputIndex++] = cInput; // depends on control dependency: [if], data = [none] } } return aOutput; } }
public class class_name { private static String[] tokenizePathAsArray(String path) { String root = null; if (FileUtil.isAbsolutePath(path)) { String[] s = FileUtil.dissect(path); root = s[0]; path = s[1]; } char sep = File.separatorChar; int start = 0; int len = path.length(); int count = 0; for (int pos = 0; pos < len; pos++) { if (path.charAt(pos) == sep) { if (pos != start) { count++; } start = pos + 1; } } if (len != start) { count++; } String[] l = new String[count + ((root == null) ? 0 : 1)]; if (root != null) { l[0] = root; count = 1; } else { count = 0; } start = 0; for (int pos = 0; pos < len; pos++) { if (path.charAt(pos) == sep) { if (pos != start) { String tok = path.substring(start, pos); l[count++] = tok; } start = pos + 1; } } if (len != start) { String tok = path.substring(start); l[count/*++*/] = tok; } return l; } }
public class class_name { private static String[] tokenizePathAsArray(String path) { String root = null; if (FileUtil.isAbsolutePath(path)) { String[] s = FileUtil.dissect(path); root = s[0]; // depends on control dependency: [if], data = [none] path = s[1]; // depends on control dependency: [if], data = [none] } char sep = File.separatorChar; int start = 0; int len = path.length(); int count = 0; for (int pos = 0; pos < len; pos++) { if (path.charAt(pos) == sep) { if (pos != start) { count++; // depends on control dependency: [if], data = [none] } start = pos + 1; // depends on control dependency: [if], data = [none] } } if (len != start) { count++; // depends on control dependency: [if], data = [none] } String[] l = new String[count + ((root == null) ? 0 : 1)]; if (root != null) { l[0] = root; // depends on control dependency: [if], data = [none] count = 1; // depends on control dependency: [if], data = [none] } else { count = 0; // depends on control dependency: [if], data = [none] } start = 0; for (int pos = 0; pos < len; pos++) { if (path.charAt(pos) == sep) { if (pos != start) { String tok = path.substring(start, pos); l[count++] = tok; // depends on control dependency: [if], data = [none] } start = pos + 1; // depends on control dependency: [if], data = [none] } } if (len != start) { String tok = path.substring(start); l[count/*++*/] = tok; // depends on control dependency: [if], data = [none] } return l; } }
public class class_name { @Override protected void closeStartElement(boolean emptyElem) throws XMLStreamException { mStartElementOpen = false; try { if (emptyElem) { mWriter.writeStartTagEmptyEnd(); } else { mWriter.writeStartTagEnd(); } } catch (IOException ioe) { throw new WstxIOException(ioe); } if (mValidator != null) { mVldContent = mValidator.validateElementAndAttributes(); } // Need bit more special handling for empty elements... if (emptyElem) { SimpleOutputElement curr = mCurrElem; mCurrElem = curr.getParent(); if (mCurrElem.isRoot()) { // Did we close the root? (isRoot() returns true for the virtual "document node") mState = STATE_EPILOG; } if (mValidator != null) { mVldContent = mValidator.validateElementEnd (curr.getLocalName(), curr.getNamespaceURI(), curr.getPrefix()); } if (mPoolSize < MAX_POOL_SIZE) { curr.addToPool(mOutputElemPool); mOutputElemPool = curr; ++mPoolSize; } } } }
public class class_name { @Override protected void closeStartElement(boolean emptyElem) throws XMLStreamException { mStartElementOpen = false; try { if (emptyElem) { mWriter.writeStartTagEmptyEnd(); // depends on control dependency: [if], data = [none] } else { mWriter.writeStartTagEnd(); // depends on control dependency: [if], data = [none] } } catch (IOException ioe) { throw new WstxIOException(ioe); } if (mValidator != null) { mVldContent = mValidator.validateElementAndAttributes(); } // Need bit more special handling for empty elements... if (emptyElem) { SimpleOutputElement curr = mCurrElem; mCurrElem = curr.getParent(); if (mCurrElem.isRoot()) { // Did we close the root? (isRoot() returns true for the virtual "document node") mState = STATE_EPILOG; // depends on control dependency: [if], data = [none] } if (mValidator != null) { mVldContent = mValidator.validateElementEnd (curr.getLocalName(), curr.getNamespaceURI(), curr.getPrefix()); // depends on control dependency: [if], data = [none] } if (mPoolSize < MAX_POOL_SIZE) { curr.addToPool(mOutputElemPool); // depends on control dependency: [if], data = [none] mOutputElemPool = curr; // depends on control dependency: [if], data = [none] ++mPoolSize; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static Object invokeGroovyObjectInvoker(MissingMethodException e, Object receiver, String name, Object[] args) { if (e instanceof MissingMethodExecutionFailed) { throw (MissingMethodException)e.getCause(); } else if (receiver.getClass() == e.getType() && e.getMethod().equals(name)) { //TODO: we should consider calling this one directly for MetaClassImpl, // then we save the new method selection // in case there's nothing else, invoke the object's own invokeMethod() return ((GroovyObject)receiver).invokeMethod(name, args); } else { throw e; } } }
public class class_name { public static Object invokeGroovyObjectInvoker(MissingMethodException e, Object receiver, String name, Object[] args) { if (e instanceof MissingMethodExecutionFailed) { throw (MissingMethodException)e.getCause(); } else if (receiver.getClass() == e.getType() && e.getMethod().equals(name)) { //TODO: we should consider calling this one directly for MetaClassImpl, // then we save the new method selection // in case there's nothing else, invoke the object's own invokeMethod() return ((GroovyObject)receiver).invokeMethod(name, args); // depends on control dependency: [if], data = [none] } else { throw e; } } }
public class class_name { private void printClassList(PrintStream out, Iterable<EntityIdValue> classes) { out.print(",\""); boolean first = true; for (EntityIdValue superClass : classes) { if (first) { first = false; } else { out.print("@"); } // makeshift escaping for Miga: out.print(getClassLabel(superClass).replace("@", "@")); } out.print("\""); } }
public class class_name { private void printClassList(PrintStream out, Iterable<EntityIdValue> classes) { out.print(",\""); boolean first = true; for (EntityIdValue superClass : classes) { if (first) { first = false; // depends on control dependency: [if], data = [none] } else { out.print("@"); // depends on control dependency: [if], data = [none] } // makeshift escaping for Miga: out.print(getClassLabel(superClass).replace("@", "@")); // depends on control dependency: [for], data = [superClass] } out.print("\""); } }
public class class_name { @Override public void doConnectionSetup(Connection conn) throws SQLException { SQLWarning warn = conn.getWarnings(); if (warn != null) { SQLException sqlex = null; String sqlstate = warn.getSQLState(); if (sqlstate.equals("010UF")) { // jConnect cannot connect to the database specified in the connection URL. sqlex = new SQLException(warn.getMessage(), sqlstate); // OK we have the main exception, now chain all of the rest SQLException sqlex2; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, sqlstate + warn.getMessage()); warn = warn.getNextWarning(); while (warn != null) { sqlex2 = new SQLException(warn.getMessage(), warn.getSQLState()); sqlex.setNextException(sqlex2); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, warn.getSQLState() + warn.getMessage()); warn = warn.getNextWarning(); } throw sqlex; } } } }
public class class_name { @Override public void doConnectionSetup(Connection conn) throws SQLException { SQLWarning warn = conn.getWarnings(); if (warn != null) { SQLException sqlex = null; String sqlstate = warn.getSQLState(); if (sqlstate.equals("010UF")) { // jConnect cannot connect to the database specified in the connection URL. sqlex = new SQLException(warn.getMessage(), sqlstate); // OK we have the main exception, now chain all of the rest SQLException sqlex2; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, sqlstate + warn.getMessage()); warn = warn.getNextWarning(); while (warn != null) { sqlex2 = new SQLException(warn.getMessage(), warn.getSQLState()); // depends on control dependency: [while], data = [(warn] sqlex.setNextException(sqlex2); // depends on control dependency: [while], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, warn.getSQLState() + warn.getMessage()); warn = warn.getNextWarning(); // depends on control dependency: [while], data = [none] } throw sqlex; } } } }
public class class_name { BaseRow removeLast() { Map.Entry<BaseRow, Collection<BaseRow>> last = treeMap.lastEntry(); BaseRow lastElement = null; if (last != null) { Collection<BaseRow> list = last.getValue(); lastElement = getLastElement(list); if (lastElement != null) { if (list.remove(lastElement)) { currentTopNum -= 1; } if (list.size() == 0) { treeMap.remove(last.getKey()); } } } return lastElement; } }
public class class_name { BaseRow removeLast() { Map.Entry<BaseRow, Collection<BaseRow>> last = treeMap.lastEntry(); BaseRow lastElement = null; if (last != null) { Collection<BaseRow> list = last.getValue(); lastElement = getLastElement(list); // depends on control dependency: [if], data = [none] if (lastElement != null) { if (list.remove(lastElement)) { currentTopNum -= 1; // depends on control dependency: [if], data = [none] } if (list.size() == 0) { treeMap.remove(last.getKey()); // depends on control dependency: [if], data = [none] } } } return lastElement; } }
public class class_name { @Override public void close() { if (client != null) { try { client.close(); } catch (final IOException e) { LOGGER.error("Unable to close HTTP client", e); } } } }
public class class_name { @Override public void close() { if (client != null) { try { client.close(); // depends on control dependency: [try], data = [none] } catch (final IOException e) { LOGGER.error("Unable to close HTTP client", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static void renew(GramJob job, GSSCredential newCred, boolean limitedDelegation) throws GramException, GSSException { GSSCredential currentCred = getJobCredentials(job); GlobusURL jobURL = job.getID(); if (jobURL == null) { throw new GramException(GramException.ERROR_JOB_CONTACT_NOT_SET); } GSSManager manager = ExtendedGSSManager.getInstance(); GssSocket socket = null; try { ExtendedGSSContext context = (ExtendedGSSContext)manager.createContext(null, GSSConstants.MECH_OID, currentCred, GSSContext.DEFAULT_LIFETIME); context.setOption(GSSConstants.GSS_MODE, GSIConstants.MODE_SSL); context.setOption(GSSConstants.DELEGATION_TYPE, (limitedDelegation) ? GSIConstants.DELEGATION_TYPE_LIMITED : GSIConstants.DELEGATION_TYPE_FULL); GssSocketFactory factory = GssSocketFactory.getDefault(); socket = (GssSocket)factory.createSocket(jobURL.getHost(), jobURL.getPort(), context); socket.setAuthorization(SelfAuthorization.getInstance()); OutputStream out = socket.getOutputStream(); InputStream in = socket.getInputStream(); // send GRAM protocol "renew" String msg = GRAMProtocol.RENEW(jobURL.getURL(), jobURL.getHost()); out.write(msg.getBytes()); out.flush(); debug("RENEW SENT:", msg); GatekeeperReply reply = new GatekeeperReply(in); debug("RENEW RECEIVED:", reply); // proceed w/ delegation only if response looks ok checkHttpReply(reply.httpCode); if (reply.failureCode == GramException.JOB_CONTACT_NOT_FOUND) { throw new GramException(GramException.JOB_CONTACT_NOT_FOUND); } reply = renewDelegationHandshake(context, newCred, (GSIGssOutputStream) out, (GSIGssInputStream) in); debug("RENEW RECEIVED: ", reply); checkHttpReply(reply.httpCode); if (reply.failureCode == GramException.DELEGATION_FAILED) { throw new GramException(GramException.DELEGATION_FAILED); } job.setCredentials(newCred); } catch (IOException e) { throw new GramException(GramException.ERROR_CONNECTION_FAILED, e); } finally { if (socket != null) { try { socket.close(); } catch (Exception e) {} } } } }
public class class_name { public static void renew(GramJob job, GSSCredential newCred, boolean limitedDelegation) throws GramException, GSSException { GSSCredential currentCred = getJobCredentials(job); GlobusURL jobURL = job.getID(); if (jobURL == null) { throw new GramException(GramException.ERROR_JOB_CONTACT_NOT_SET); } GSSManager manager = ExtendedGSSManager.getInstance(); GssSocket socket = null; try { ExtendedGSSContext context = (ExtendedGSSContext)manager.createContext(null, GSSConstants.MECH_OID, currentCred, GSSContext.DEFAULT_LIFETIME); context.setOption(GSSConstants.GSS_MODE, GSIConstants.MODE_SSL); context.setOption(GSSConstants.DELEGATION_TYPE, (limitedDelegation) ? GSIConstants.DELEGATION_TYPE_LIMITED : GSIConstants.DELEGATION_TYPE_FULL); GssSocketFactory factory = GssSocketFactory.getDefault(); socket = (GssSocket)factory.createSocket(jobURL.getHost(), jobURL.getPort(), context); socket.setAuthorization(SelfAuthorization.getInstance()); OutputStream out = socket.getOutputStream(); InputStream in = socket.getInputStream(); // send GRAM protocol "renew" String msg = GRAMProtocol.RENEW(jobURL.getURL(), jobURL.getHost()); out.write(msg.getBytes()); out.flush(); debug("RENEW SENT:", msg); GatekeeperReply reply = new GatekeeperReply(in); debug("RENEW RECEIVED:", reply); // proceed w/ delegation only if response looks ok checkHttpReply(reply.httpCode); if (reply.failureCode == GramException.JOB_CONTACT_NOT_FOUND) { throw new GramException(GramException.JOB_CONTACT_NOT_FOUND); } reply = renewDelegationHandshake(context, newCred, (GSIGssOutputStream) out, (GSIGssInputStream) in); debug("RENEW RECEIVED: ", reply); checkHttpReply(reply.httpCode); if (reply.failureCode == GramException.DELEGATION_FAILED) { throw new GramException(GramException.DELEGATION_FAILED); } job.setCredentials(newCred); } catch (IOException e) { throw new GramException(GramException.ERROR_CONNECTION_FAILED, e); } finally { if (socket != null) { try { socket.close(); } catch (Exception e) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none] } } } }
public class class_name { public static String getProjectName( File inputDefFile) { String projectName = null; if( inputDefFile != null) { String inputBase = FilenameUtils.getBaseName( inputDefFile.getName()); projectName = inputBase.toLowerCase().endsWith( "-input") ? inputBase.substring( 0, inputBase.length() - "-input".length()) : inputBase; } return projectName; } }
public class class_name { public static String getProjectName( File inputDefFile) { String projectName = null; if( inputDefFile != null) { String inputBase = FilenameUtils.getBaseName( inputDefFile.getName()); projectName = inputBase.toLowerCase().endsWith( "-input") ? inputBase.substring( 0, inputBase.length() - "-input".length()) : inputBase; // depends on control dependency: [if], data = [none] } return projectName; } }
public class class_name { @SuppressWarnings("unchecked") public TemporalDataModelIF<Long, Long> runLenskitRecommender(final RUN_OPTIONS opts, final DataAccessObject trainingModel, final DataAccessObject testModel) throws RecommenderException { if (isAlreadyRecommended()) { return null; } LenskitConfiguration config = new LenskitConfiguration(); // int nItems = new PrefetchingItemDAO(trainingModel).getItemIds().size(); LongSet items = RatingSummary.create(trainingModel).getItems(); int nItems = items.size(); try { config.bind(ItemScorer.class).to((Class<? extends ItemScorer>) Class.forName(getProperties().getProperty(RecommendationRunner.RECOMMENDER))); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new RecommenderException("Problem with ItemScorer: " + e.getMessage()); } if (getProperties().getProperty(RecommendationRunner.RECOMMENDER).contains(".user.")) { config.bind(NeighborFinder.class).to(LiveNeighborFinder.class); if (getProperties().getProperty(RecommendationRunner.NEIGHBORHOOD).equals("-1")) { getProperties().setProperty(RecommendationRunner.NEIGHBORHOOD, Math.round(Math.sqrt(nItems)) + ""); } config.set(NeighborhoodSize.class).to(Integer.parseInt(getProperties().getProperty(RecommendationRunner.NEIGHBORHOOD))); } if (getProperties().containsKey(RecommendationRunner.SIMILARITY)) { try { config.within(ItemSimilarity.class). bind(VectorSimilarity.class). to((Class<? extends VectorSimilarity>) Class.forName(getProperties().getProperty(RecommendationRunner.SIMILARITY))); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new RecommenderException("Problem with ItemSimilarity: " + e.getMessage()); } } if (getProperties().containsKey(RecommendationRunner.FACTORS)) { config.bind(BaselineScorer.class, ItemScorer.class).to(UserMeanItemScorer.class); config.bind(StoppingCondition.class).to(IterationCountStoppingCondition.class); config.bind(BiasModel.class).to(UserItemBiasModel.class); config.set(IterationCount.class).to(DEFAULT_ITERATIONS); if (getProperties().getProperty(RecommendationRunner.FACTORS).equals("-1")) { getProperties().setProperty(RecommendationRunner.FACTORS, Math.round(Math.sqrt(nItems)) + ""); } config.set(FeatureCount.class).to(Integer.parseInt(getProperties().getProperty(RecommendationRunner.FACTORS))); } RatingVectorPDAO test = new StandardRatingVectorPDAO(testModel); LenskitRecommender rec = null; try { LenskitRecommenderEngine engine = LenskitRecommenderEngine.build(config, trainingModel); rec = engine.createRecommender(trainingModel); } catch (RecommenderBuildException e) { LOGGER.error(e.getMessage()); e.printStackTrace(); throw new RecommenderException("Problem with LenskitRecommenderEngine: " + e.getMessage()); } ItemRecommender irec = null; ItemScorer iscore = null; if (rec != null) { irec = rec.getItemRecommender(); iscore = rec.getItemScorer(); } assert irec != null; assert iscore != null; TemporalDataModelIF<Long, Long> model = null; switch (opts) { case RETURN_AND_OUTPUT_RECS: case RETURN_RECS: model = new TemporalDataModel<>(); break; default: model = null; } String name = null; switch (opts) { case RETURN_AND_OUTPUT_RECS: case OUTPUT_RECS: name = getFileName(); break; default: name = null; } boolean createFile = true; for (IdBox<Long2DoubleMap> u : test.streamUsers()) { long user = u.getId(); // The following does not return anything // List<Long> recItems = irec.recommend(user, nItems); // List<RecommenderIO.Preference<Long, Long>> prefs = new ArrayList<>(); Map<Long, Double> results = iscore.score(user, items); for (Long i : items) { // Result r = iscore.score(user, i); // if (r != null) { if (results.containsKey(i)) { // Double s = r.getScore(); Double s = results.get(i); prefs.add(new RecommenderIO.Preference<>(user, i, s)); } } // RecommenderIO.writeData(user, prefs, getPath(), name, !createFile, model); createFile = false; } rec.close(); return model; } }
public class class_name { @SuppressWarnings("unchecked") public TemporalDataModelIF<Long, Long> runLenskitRecommender(final RUN_OPTIONS opts, final DataAccessObject trainingModel, final DataAccessObject testModel) throws RecommenderException { if (isAlreadyRecommended()) { return null; } LenskitConfiguration config = new LenskitConfiguration(); // int nItems = new PrefetchingItemDAO(trainingModel).getItemIds().size(); LongSet items = RatingSummary.create(trainingModel).getItems(); int nItems = items.size(); try { config.bind(ItemScorer.class).to((Class<? extends ItemScorer>) Class.forName(getProperties().getProperty(RecommendationRunner.RECOMMENDER))); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new RecommenderException("Problem with ItemScorer: " + e.getMessage()); } if (getProperties().getProperty(RecommendationRunner.RECOMMENDER).contains(".user.")) { config.bind(NeighborFinder.class).to(LiveNeighborFinder.class); if (getProperties().getProperty(RecommendationRunner.NEIGHBORHOOD).equals("-1")) { getProperties().setProperty(RecommendationRunner.NEIGHBORHOOD, Math.round(Math.sqrt(nItems)) + ""); } config.set(NeighborhoodSize.class).to(Integer.parseInt(getProperties().getProperty(RecommendationRunner.NEIGHBORHOOD))); } if (getProperties().containsKey(RecommendationRunner.SIMILARITY)) { try { config.within(ItemSimilarity.class). bind(VectorSimilarity.class). to((Class<? extends VectorSimilarity>) Class.forName(getProperties().getProperty(RecommendationRunner.SIMILARITY))); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new RecommenderException("Problem with ItemSimilarity: " + e.getMessage()); } } if (getProperties().containsKey(RecommendationRunner.FACTORS)) { config.bind(BaselineScorer.class, ItemScorer.class).to(UserMeanItemScorer.class); config.bind(StoppingCondition.class).to(IterationCountStoppingCondition.class); config.bind(BiasModel.class).to(UserItemBiasModel.class); config.set(IterationCount.class).to(DEFAULT_ITERATIONS); if (getProperties().getProperty(RecommendationRunner.FACTORS).equals("-1")) { getProperties().setProperty(RecommendationRunner.FACTORS, Math.round(Math.sqrt(nItems)) + ""); } config.set(FeatureCount.class).to(Integer.parseInt(getProperties().getProperty(RecommendationRunner.FACTORS))); } RatingVectorPDAO test = new StandardRatingVectorPDAO(testModel); LenskitRecommender rec = null; try { LenskitRecommenderEngine engine = LenskitRecommenderEngine.build(config, trainingModel); rec = engine.createRecommender(trainingModel); } catch (RecommenderBuildException e) { LOGGER.error(e.getMessage()); e.printStackTrace(); throw new RecommenderException("Problem with LenskitRecommenderEngine: " + e.getMessage()); } ItemRecommender irec = null; ItemScorer iscore = null; if (rec != null) { irec = rec.getItemRecommender(); iscore = rec.getItemScorer(); } assert irec != null; assert iscore != null; TemporalDataModelIF<Long, Long> model = null; switch (opts) { case RETURN_AND_OUTPUT_RECS: case RETURN_RECS: model = new TemporalDataModel<>(); break; default: model = null; } String name = null; switch (opts) { case RETURN_AND_OUTPUT_RECS: case OUTPUT_RECS: name = getFileName(); break; default: name = null; } boolean createFile = true; for (IdBox<Long2DoubleMap> u : test.streamUsers()) { long user = u.getId(); // The following does not return anything // List<Long> recItems = irec.recommend(user, nItems); // List<RecommenderIO.Preference<Long, Long>> prefs = new ArrayList<>(); Map<Long, Double> results = iscore.score(user, items); for (Long i : items) { // Result r = iscore.score(user, i); // if (r != null) { if (results.containsKey(i)) { // Double s = r.getScore(); Double s = results.get(i); prefs.add(new RecommenderIO.Preference<>(user, i, s)); // depends on control dependency: [if], data = [none] } } // RecommenderIO.writeData(user, prefs, getPath(), name, !createFile, model); createFile = false; } rec.close(); return model; } }
public class class_name { public ENTITY findOne(Match... matches) { List<ENTITY> os = find(Arrays.asList(matches), null, 0, 1); if (os == null || os.size() == 0) { return null; } return os.get(0); } }
public class class_name { public ENTITY findOne(Match... matches) { List<ENTITY> os = find(Arrays.asList(matches), null, 0, 1); if (os == null || os.size() == 0) { return null; // depends on control dependency: [if], data = [none] } return os.get(0); } }
public class class_name { public static boolean isMessyCode(String strName) { Pattern p = Pattern.compile("\\s*|t*|r*|n*"); Matcher m = p.matcher(strName); String after = m.replaceAll(""); String temp = after.replaceAll("\\p{P}", ""); char[] ch = temp.trim().toCharArray(); float chLength = ch.length; float count = 0; for (int i = 0; i < ch.length; i++) { char c = ch[i]; if (!Character.isLetterOrDigit(c)) { if (!isChinese(c)) { count = count + 1; } } } float result = count / chLength; if (result > 0.4) { return true; } else { return false; } } }
public class class_name { public static boolean isMessyCode(String strName) { Pattern p = Pattern.compile("\\s*|t*|r*|n*"); Matcher m = p.matcher(strName); String after = m.replaceAll(""); String temp = after.replaceAll("\\p{P}", ""); char[] ch = temp.trim().toCharArray(); float chLength = ch.length; float count = 0; for (int i = 0; i < ch.length; i++) { char c = ch[i]; if (!Character.isLetterOrDigit(c)) { if (!isChinese(c)) { count = count + 1; // depends on control dependency: [if], data = [none] } } } float result = count / chLength; if (result > 0.4) { return true; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } }
public class class_name { public int getVisibleRowCapacity() { int rh = getCalculatedRowHeight(); double visibleHeight = getVisibleHeight(); int rows = (int) ((visibleHeight < 1) ? 0 : Math.floor(visibleHeight / rh)); int calcHeight = rh * rows; while (calcHeight < visibleHeight) { rows++; calcHeight = rh * rows; } logger.finest("row height: " + rh + " visibleHeight: " + visibleHeight + " visible rows: " + rows + " calcHeight: " + calcHeight); return rows; } }
public class class_name { public int getVisibleRowCapacity() { int rh = getCalculatedRowHeight(); double visibleHeight = getVisibleHeight(); int rows = (int) ((visibleHeight < 1) ? 0 : Math.floor(visibleHeight / rh)); int calcHeight = rh * rows; while (calcHeight < visibleHeight) { rows++; // depends on control dependency: [while], data = [none] calcHeight = rh * rows; // depends on control dependency: [while], data = [none] } logger.finest("row height: " + rh + " visibleHeight: " + visibleHeight + " visible rows: " + rows + " calcHeight: " + calcHeight); return rows; } }
public class class_name { public java.awt.Image createAwtImage(Color foreground, Color background) { int f = foreground.getRGB(); int g = background.getRGB(); Canvas canvas = new Canvas(); int barWidth = (int)x; if (barWidth <= 0) barWidth = 1; int barDistance = (int)n; if (barDistance <= barWidth) barDistance = barWidth + 1; int barShort = (int)size; if (barShort <= 0) barShort = 1; int barTall = (int)barHeight; if (barTall <= barShort) barTall = barShort + 1; int width = ((code.length() + 1) * 5 + 1) * barDistance + barWidth; int pix[] = new int[width * barTall]; byte bars[] = getBarsPostnet(code); byte flip = 1; if (codeType == PLANET) { flip = 0; bars[0] = 0; bars[bars.length - 1] = 0; } int idx = 0; for (int k = 0; k < bars.length; ++k) { boolean dot = (bars[k] == flip); for (int j = 0; j < barDistance; ++j) { pix[idx + j] = ((dot && j < barWidth) ? f : g); } idx += barDistance; } int limit = width * (barTall - barShort); for (int k = width; k < limit; k += width) System.arraycopy(pix, 0, pix, k, width); idx = limit; for (int k = 0; k < bars.length; ++k) { for (int j = 0; j < barDistance; ++j) { pix[idx + j] = ((j < barWidth) ? f : g); } idx += barDistance; } for (int k = limit + width; k < pix.length; k += width) System.arraycopy(pix, limit, pix, k, width); Image img = canvas.createImage(new MemoryImageSource(width, barTall, pix, 0, width)); return img; } }
public class class_name { public java.awt.Image createAwtImage(Color foreground, Color background) { int f = foreground.getRGB(); int g = background.getRGB(); Canvas canvas = new Canvas(); int barWidth = (int)x; if (barWidth <= 0) barWidth = 1; int barDistance = (int)n; if (barDistance <= barWidth) barDistance = barWidth + 1; int barShort = (int)size; if (barShort <= 0) barShort = 1; int barTall = (int)barHeight; if (barTall <= barShort) barTall = barShort + 1; int width = ((code.length() + 1) * 5 + 1) * barDistance + barWidth; int pix[] = new int[width * barTall]; byte bars[] = getBarsPostnet(code); byte flip = 1; if (codeType == PLANET) { flip = 0; // depends on control dependency: [if], data = [none] bars[0] = 0; // depends on control dependency: [if], data = [none] bars[bars.length - 1] = 0; // depends on control dependency: [if], data = [none] } int idx = 0; for (int k = 0; k < bars.length; ++k) { boolean dot = (bars[k] == flip); for (int j = 0; j < barDistance; ++j) { pix[idx + j] = ((dot && j < barWidth) ? f : g); // depends on control dependency: [for], data = [j] } idx += barDistance; // depends on control dependency: [for], data = [none] } int limit = width * (barTall - barShort); for (int k = width; k < limit; k += width) System.arraycopy(pix, 0, pix, k, width); idx = limit; for (int k = 0; k < bars.length; ++k) { for (int j = 0; j < barDistance; ++j) { pix[idx + j] = ((j < barWidth) ? f : g); // depends on control dependency: [for], data = [j] } idx += barDistance; // depends on control dependency: [for], data = [none] } for (int k = limit + width; k < pix.length; k += width) System.arraycopy(pix, limit, pix, k, width); Image img = canvas.createImage(new MemoryImageSource(width, barTall, pix, 0, width)); return img; } }
public class class_name { protected void onRemoved() { List<FilterChangeListener> listeners = getAllListeners(); for (FilterChangeListener listener : listeners) { listener.onRemove(this); } } }
public class class_name { protected void onRemoved() { List<FilterChangeListener> listeners = getAllListeners(); for (FilterChangeListener listener : listeners) { listener.onRemove(this); // depends on control dependency: [for], data = [listener] } } }
public class class_name { private void clearMetadata(DeviceAnnouncement announcement) { final int player = announcement.getNumber(); // Iterate over a copy to avoid concurrent modification issues for (DeckReference deck : new HashSet<DeckReference>(hotCache.keySet())) { if (deck.player == player) { hotCache.remove(deck); if (deck.hotCue == 0) { deliverTrackMetadataUpdate(player, null); // Inform listeners the metadata is gone. } } } } }
public class class_name { private void clearMetadata(DeviceAnnouncement announcement) { final int player = announcement.getNumber(); // Iterate over a copy to avoid concurrent modification issues for (DeckReference deck : new HashSet<DeckReference>(hotCache.keySet())) { if (deck.player == player) { hotCache.remove(deck); // depends on control dependency: [if], data = [none] if (deck.hotCue == 0) { deliverTrackMetadataUpdate(player, null); // Inform listeners the metadata is gone. // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @Override public void logout() { if (!isAuthenticated()) return; // call cleanSubject() if there is an AuthConfigProvider for the HttpServlet layer and appContext. String appContext = this.buildAppContext(); if (AuthConfigFactory.getFactory().getConfigProvider(layer, appContext, null) != null) { Subject authenticatedSubject = this.getAuthenticatedSubject(); MessageInfo messageInfo = this.buildMessageInfo(); this.manager.cleanSubject(messageInfo, authenticatedSubject, layer, appContext, handler); } // following the return from cleanSubject(), logout must perform the regular logout processing. super.logout(); } }
public class class_name { @Override public void logout() { if (!isAuthenticated()) return; // call cleanSubject() if there is an AuthConfigProvider for the HttpServlet layer and appContext. String appContext = this.buildAppContext(); if (AuthConfigFactory.getFactory().getConfigProvider(layer, appContext, null) != null) { Subject authenticatedSubject = this.getAuthenticatedSubject(); MessageInfo messageInfo = this.buildMessageInfo(); this.manager.cleanSubject(messageInfo, authenticatedSubject, layer, appContext, handler); // depends on control dependency: [if], data = [none] } // following the return from cleanSubject(), logout must perform the regular logout processing. super.logout(); } }
public class class_name { private InputStream parseEntity(DataSource ds) { try { return ds.getInputStream(); } catch (IOException e) { throw new RuntimeException(e); } } }
public class class_name { private InputStream parseEntity(DataSource ds) { try { return ds.getInputStream(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static <T> Collection<T> addAll(Collection<T> collection, T[] values) { if (null != collection && null != values) { for (T value : values) { collection.add(value); } } return collection; } }
public class class_name { public static <T> Collection<T> addAll(Collection<T> collection, T[] values) { if (null != collection && null != values) { for (T value : values) { collection.add(value); // depends on control dependency: [for], data = [value] } } return collection; } }
public class class_name { public void viewLocationDidChange (int dx, int dy) { if (_renderOrder >= HUD_LAYER) { setLocation(_bounds.x + dx, _bounds.y + dy); } } }
public class class_name { public void viewLocationDidChange (int dx, int dy) { if (_renderOrder >= HUD_LAYER) { setLocation(_bounds.x + dx, _bounds.y + dy); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void showCache(Formatter format) { ArrayList<CacheElement.CacheFile> allFiles = new ArrayList<>(files.size()); for (CacheElement elem : cache.values()) { allFiles.addAll(elem.list); } Collections.sort(allFiles); // sort so oldest are on top format.format("%nFileCacheARC %s (min=%d softLimit=%d hardLimit=%d scour=%d):%n", name, minElements, softLimit, hardLimit, period); format.format("isLocked accesses lastAccess location %n"); for (CacheElement.CacheFile file : allFiles) { String loc = file.ncfile != null ? file.ncfile.getLocation() : "null"; CalendarDate cd = CalendarDate.of(file.getLastAccessed()); format.format("%8s %9d %s %s %n", file.isLocked, file.getCountAccessed(), CalendarDateFormatter.toTimeUnits(cd), loc); } showStats(format); } }
public class class_name { @Override public void showCache(Formatter format) { ArrayList<CacheElement.CacheFile> allFiles = new ArrayList<>(files.size()); for (CacheElement elem : cache.values()) { allFiles.addAll(elem.list); // depends on control dependency: [for], data = [elem] } Collections.sort(allFiles); // sort so oldest are on top format.format("%nFileCacheARC %s (min=%d softLimit=%d hardLimit=%d scour=%d):%n", name, minElements, softLimit, hardLimit, period); format.format("isLocked accesses lastAccess location %n"); for (CacheElement.CacheFile file : allFiles) { String loc = file.ncfile != null ? file.ncfile.getLocation() : "null"; CalendarDate cd = CalendarDate.of(file.getLastAccessed()); format.format("%8s %9d %s %s %n", file.isLocked, file.getCountAccessed(), CalendarDateFormatter.toTimeUnits(cd), loc); // depends on control dependency: [for], data = [file] } showStats(format); } }
public class class_name { public void removeSnapshots() { VersionList versionToRemove = new VersionList(); // collect Versions to be removed for (Version ver : this) { if (ver.isSnapshot()) { versionToRemove.add(ver); } } // remove them this.removeAll(versionToRemove); } }
public class class_name { public void removeSnapshots() { VersionList versionToRemove = new VersionList(); // collect Versions to be removed for (Version ver : this) { if (ver.isSnapshot()) { versionToRemove.add(ver); // depends on control dependency: [if], data = [none] } } // remove them this.removeAll(versionToRemove); } }
public class class_name { public EClass getEDI() { if (ediEClass == null) { ediEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(239); } return ediEClass; } }
public class class_name { public EClass getEDI() { if (ediEClass == null) { ediEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(239); // depends on control dependency: [if], data = [none] } return ediEClass; } }
public class class_name { public static Type getType(Field field) { if (null == field) { return null; } Type type = field.getGenericType(); if (null == type) { type = field.getType(); } return type; } }
public class class_name { public static Type getType(Field field) { if (null == field) { return null; // depends on control dependency: [if], data = [none] } Type type = field.getGenericType(); if (null == type) { type = field.getType(); // depends on control dependency: [if], data = [none] } return type; } }
public class class_name { private String internalCategoryRootPath(String basePath, String categoryPath) { if (categoryPath.startsWith("/") && basePath.endsWith("/")) { // one slash too much return basePath + categoryPath.substring(1); } else if (!categoryPath.startsWith("/") && !basePath.endsWith("/")) { // one slash too less return basePath + "/" + categoryPath; } else { return basePath + categoryPath; } } }
public class class_name { private String internalCategoryRootPath(String basePath, String categoryPath) { if (categoryPath.startsWith("/") && basePath.endsWith("/")) { // one slash too much return basePath + categoryPath.substring(1); // depends on control dependency: [if], data = [none] } else if (!categoryPath.startsWith("/") && !basePath.endsWith("/")) { // one slash too less return basePath + "/" + categoryPath; // depends on control dependency: [if], data = [none] } else { return basePath + categoryPath; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Environment of(@NonNull String location) { if (location.startsWith(PREFIX_CLASSPATH)) { location = location.substring(PREFIX_CLASSPATH.length()); return loadClasspath(location); } else if (location.startsWith(PREFIX_FILE)) { location = location.substring(PREFIX_FILE.length()); return of(new File(location)); } else if (location.startsWith(PREFIX_URL)) { location = location.substring(PREFIX_URL.length()); try { return of(new URL(location)); } catch (MalformedURLException e) { log.error("", e); return null; } } else { return loadClasspath(location); } } }
public class class_name { public static Environment of(@NonNull String location) { if (location.startsWith(PREFIX_CLASSPATH)) { location = location.substring(PREFIX_CLASSPATH.length()); // depends on control dependency: [if], data = [none] return loadClasspath(location); // depends on control dependency: [if], data = [none] } else if (location.startsWith(PREFIX_FILE)) { location = location.substring(PREFIX_FILE.length()); // depends on control dependency: [if], data = [none] return of(new File(location)); // depends on control dependency: [if], data = [none] } else if (location.startsWith(PREFIX_URL)) { location = location.substring(PREFIX_URL.length()); // depends on control dependency: [if], data = [none] try { return of(new URL(location)); // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { log.error("", e); return null; } // depends on control dependency: [catch], data = [none] } else { return loadClasspath(location); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setCurrentIndex(long curr) { try { if (curr < 0 || curr > count) { throw new RuntimeException(curr + " is not in the range 0 to " + count); } seek(getHeaderSize() + curr * getEntryLength()); } catch (IOException e) { throw new RuntimeException(e); } } }
public class class_name { public void setCurrentIndex(long curr) { try { if (curr < 0 || curr > count) { throw new RuntimeException(curr + " is not in the range 0 to " + count); } seek(getHeaderSize() + curr * getEntryLength()); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private String transformContent(String content) { try { List<CmsJsonPart> parts = CmsJsonPart.parseJsonParts(content); JSONArray keys = new JSONArray(); JSONObject output = new JSONObject(); for (CmsJsonPart part : parts) { if (output.has(part.getKey())) { LOG.warn("Duplicate key for JSON parts: " + part.getKey()); } keys.put(part.getKey()); output.put(part.getKey(), part.getValue()); } output.put(KEY_PARTS, keys); return output.toString(); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return content; } } }
public class class_name { private String transformContent(String content) { try { List<CmsJsonPart> parts = CmsJsonPart.parseJsonParts(content); JSONArray keys = new JSONArray(); JSONObject output = new JSONObject(); for (CmsJsonPart part : parts) { if (output.has(part.getKey())) { LOG.warn("Duplicate key for JSON parts: " + part.getKey()); // depends on control dependency: [if], data = [none] } keys.put(part.getKey()); // depends on control dependency: [for], data = [part] output.put(part.getKey(), part.getValue()); // depends on control dependency: [for], data = [part] } output.put(KEY_PARTS, keys); // depends on control dependency: [try], data = [none] return output.toString(); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return content; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private int coordIndex(GridRecord record) { double val = record.getLevel1(); double val2 = record.getLevel2(); if (usesBounds && (val > val2)) { val = record.getLevel2(); val2 = record.getLevel1(); } for (int i = 0; i < levels.size(); i++) { LevelCoord lc = (LevelCoord) levels.get(i); if (usesBounds) { if (ucar.nc2.util.Misc.nearlyEquals(lc.value1, val) && ucar.nc2.util.Misc.nearlyEquals(lc.value2, val2)) { return i; } } else { if (ucar.nc2.util.Misc.nearlyEquals(lc.value1, val)) { return i; } } } return -1; } }
public class class_name { private int coordIndex(GridRecord record) { double val = record.getLevel1(); double val2 = record.getLevel2(); if (usesBounds && (val > val2)) { val = record.getLevel2(); // depends on control dependency: [if], data = [none] val2 = record.getLevel1(); // depends on control dependency: [if], data = [none] } for (int i = 0; i < levels.size(); i++) { LevelCoord lc = (LevelCoord) levels.get(i); if (usesBounds) { if (ucar.nc2.util.Misc.nearlyEquals(lc.value1, val) && ucar.nc2.util.Misc.nearlyEquals(lc.value2, val2)) { return i; // depends on control dependency: [if], data = [none] } } else { if (ucar.nc2.util.Misc.nearlyEquals(lc.value1, val)) { return i; // depends on control dependency: [if], data = [none] } } } return -1; } }
public class class_name { public static String toSql(String name, String in) { if (in.indexOf('\\') != -1) { // has one or more escapes, un-escape and translate StringBuffer out = new StringBuffer(); out.append('\''); boolean needLike = false; boolean needEscape = false; boolean lastWasEscape = false; for (int i = 0; i < in.length(); i++) { char c = in.charAt(i); if (!lastWasEscape && c == '\\') { lastWasEscape = true; } else { char nextChar = '!'; boolean useNextChar = false; if (!lastWasEscape) { if (c == '?') { out.append('_'); needLike = true; } else if (c == '*') { out.append('%'); needLike = true; } else { nextChar = c; useNextChar = true; } } else { nextChar = c; useNextChar = true; } if (useNextChar) { if (nextChar == '\"') { out.append("\\\""); needEscape = true; } else if (nextChar == '\'') { out.append("\\\'"); needEscape = true; } else if (nextChar == '%') { out.append("\\%"); needEscape = true; } else if (nextChar == '_') { out.append("\\_"); needEscape = true; } else { out.append(nextChar); } } lastWasEscape = false; } } out.append('\''); if (needLike) { out.insert(0, " LIKE "); } else { out.insert(0, " = "); } out.insert(0, name); if (needEscape) { out.insert(0, ' '); } return out.toString(); } else { // no escapes, just translate if needed StringBuffer out = new StringBuffer(); out.append('\''); boolean needLike = false; boolean needEscape = false; for (int i = 0; i < in.length(); i++) { char c = in.charAt(i); if (c == '?') { out.append('_'); needLike = true; } else if (c == '*') { out.append('%'); needLike = true; } else if (c == '\"') { out.append("\\\""); needEscape = true; } else if (c == '\'') { out.append("\\\'"); needEscape = true; } else if (c == '%') { out.append("\\%"); needEscape = true; } else if (c == '_') { out.append("\\_"); needEscape = true; } else { out.append(c); } } out.append('\''); if (needLike) { out.insert(0, " LIKE "); } else { out.insert(0, " = "); } out.insert(0, name); if (needEscape) { out.insert(0, ' '); } return out.toString(); } } }
public class class_name { public static String toSql(String name, String in) { if (in.indexOf('\\') != -1) { // has one or more escapes, un-escape and translate StringBuffer out = new StringBuffer(); out.append('\''); // depends on control dependency: [if], data = [none] boolean needLike = false; boolean needEscape = false; boolean lastWasEscape = false; for (int i = 0; i < in.length(); i++) { char c = in.charAt(i); if (!lastWasEscape && c == '\\') { lastWasEscape = true; // depends on control dependency: [if], data = [none] } else { char nextChar = '!'; boolean useNextChar = false; if (!lastWasEscape) { if (c == '?') { out.append('_'); // depends on control dependency: [if], data = [none] needLike = true; // depends on control dependency: [if], data = [none] } else if (c == '*') { out.append('%'); // depends on control dependency: [if], data = [none] needLike = true; // depends on control dependency: [if], data = [none] } else { nextChar = c; // depends on control dependency: [if], data = [none] useNextChar = true; // depends on control dependency: [if], data = [none] } } else { nextChar = c; // depends on control dependency: [if], data = [none] useNextChar = true; // depends on control dependency: [if], data = [none] } if (useNextChar) { if (nextChar == '\"') { out.append("\\\""); // depends on control dependency: [if], data = [none] needEscape = true; // depends on control dependency: [if], data = [none] } else if (nextChar == '\'') { out.append("\\\'"); // depends on control dependency: [if], data = [none] needEscape = true; // depends on control dependency: [if], data = [none] } else if (nextChar == '%') { out.append("\\%"); // depends on control dependency: [if], data = [none] needEscape = true; // depends on control dependency: [if], data = [none] } else if (nextChar == '_') { out.append("\\_"); // depends on control dependency: [if], data = [none] needEscape = true; // depends on control dependency: [if], data = [none] } else { out.append(nextChar); // depends on control dependency: [if], data = [(nextChar] } } lastWasEscape = false; // depends on control dependency: [if], data = [none] } } out.append('\''); // depends on control dependency: [if], data = [none] if (needLike) { out.insert(0, " LIKE "); // depends on control dependency: [if], data = [none] } else { out.insert(0, " = "); // depends on control dependency: [if], data = [none] } out.insert(0, name); // depends on control dependency: [if], data = [none] if (needEscape) { out.insert(0, ' '); // depends on control dependency: [if], data = [none] } return out.toString(); // depends on control dependency: [if], data = [none] } else { // no escapes, just translate if needed StringBuffer out = new StringBuffer(); out.append('\''); // depends on control dependency: [if], data = [none] boolean needLike = false; boolean needEscape = false; for (int i = 0; i < in.length(); i++) { char c = in.charAt(i); if (c == '?') { out.append('_'); // depends on control dependency: [if], data = [none] needLike = true; // depends on control dependency: [if], data = [none] } else if (c == '*') { out.append('%'); // depends on control dependency: [if], data = [none] needLike = true; // depends on control dependency: [if], data = [none] } else if (c == '\"') { out.append("\\\""); // depends on control dependency: [if], data = [none] needEscape = true; // depends on control dependency: [if], data = [none] } else if (c == '\'') { out.append("\\\'"); // depends on control dependency: [if], data = [none] needEscape = true; // depends on control dependency: [if], data = [none] } else if (c == '%') { out.append("\\%"); // depends on control dependency: [if], data = [none] needEscape = true; // depends on control dependency: [if], data = [none] } else if (c == '_') { out.append("\\_"); // depends on control dependency: [if], data = [none] needEscape = true; // depends on control dependency: [if], data = [none] } else { out.append(c); // depends on control dependency: [if], data = [(c] } } out.append('\''); // depends on control dependency: [if], data = [none] if (needLike) { out.insert(0, " LIKE "); // depends on control dependency: [if], data = [none] } else { out.insert(0, " = "); // depends on control dependency: [if], data = [none] } out.insert(0, name); // depends on control dependency: [if], data = [none] if (needEscape) { out.insert(0, ' '); // depends on control dependency: [if], data = [none] } return out.toString(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public EClass getGFLT() { if (gfltEClass == null) { gfltEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(449); } return gfltEClass; } }
public class class_name { public EClass getGFLT() { if (gfltEClass == null) { gfltEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(449); // depends on control dependency: [if], data = [none] } return gfltEClass; } }
public class class_name { public DescribeRemediationConfigurationsRequest withConfigRuleNames(String... configRuleNames) { if (this.configRuleNames == null) { setConfigRuleNames(new com.amazonaws.internal.SdkInternalList<String>(configRuleNames.length)); } for (String ele : configRuleNames) { this.configRuleNames.add(ele); } return this; } }
public class class_name { public DescribeRemediationConfigurationsRequest withConfigRuleNames(String... configRuleNames) { if (this.configRuleNames == null) { setConfigRuleNames(new com.amazonaws.internal.SdkInternalList<String>(configRuleNames.length)); // depends on control dependency: [if], data = [none] } for (String ele : configRuleNames) { this.configRuleNames.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public static void resourceToFile(String resourceName, File dest, Class src) { InputStream is = null; OutputStream os = null; try { is = src.getClassLoader().getResourceAsStream(resourceName); if (is == null) { throw new RuntimeException("Could not load resource: " + resourceName); } dest.getParentFile().mkdirs(); os = new FileOutputStream(dest); IOUtils.copy(is, os); } catch (Exception e) { throw new RuntimeException("Error copying resource '" + resourceName + "' to file '" + dest.getPath() + "': "+ e, e); } finally { IOUtils.closeQuietly(is); IOUtils.closeQuietly(os); } } }
public class class_name { public static void resourceToFile(String resourceName, File dest, Class src) { InputStream is = null; OutputStream os = null; try { is = src.getClassLoader().getResourceAsStream(resourceName); // depends on control dependency: [try], data = [none] if (is == null) { throw new RuntimeException("Could not load resource: " + resourceName); } dest.getParentFile().mkdirs(); // depends on control dependency: [try], data = [none] os = new FileOutputStream(dest); // depends on control dependency: [try], data = [none] IOUtils.copy(is, os); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException("Error copying resource '" + resourceName + "' to file '" + dest.getPath() + "': "+ e, e); } // depends on control dependency: [catch], data = [none] finally { IOUtils.closeQuietly(is); IOUtils.closeQuietly(os); } } }
public class class_name { public java.util.List<RebootRequest> getRebootWorkspaceRequests() { if (rebootWorkspaceRequests == null) { rebootWorkspaceRequests = new com.amazonaws.internal.SdkInternalList<RebootRequest>(); } return rebootWorkspaceRequests; } }
public class class_name { public java.util.List<RebootRequest> getRebootWorkspaceRequests() { if (rebootWorkspaceRequests == null) { rebootWorkspaceRequests = new com.amazonaws.internal.SdkInternalList<RebootRequest>(); // depends on control dependency: [if], data = [none] } return rebootWorkspaceRequests; } }
public class class_name { private void initObjectTypes(Properties info) throws SQLException { // Add in the types that come packaged with the driver. // These can be overridden later if desired. addDataType("box", org.postgresql.geometric.PGbox.class); addDataType("circle", org.postgresql.geometric.PGcircle.class); addDataType("line", org.postgresql.geometric.PGline.class); addDataType("lseg", org.postgresql.geometric.PGlseg.class); addDataType("path", org.postgresql.geometric.PGpath.class); addDataType("point", org.postgresql.geometric.PGpoint.class); addDataType("polygon", org.postgresql.geometric.PGpolygon.class); addDataType("money", org.postgresql.util.PGmoney.class); addDataType("interval", org.postgresql.util.PGInterval.class); Enumeration<?> e = info.propertyNames(); while (e.hasMoreElements()) { String propertyName = (String) e.nextElement(); if (propertyName.startsWith("datatype.")) { String typeName = propertyName.substring(9); String className = info.getProperty(propertyName); Class<?> klass; try { klass = Class.forName(className); } catch (ClassNotFoundException cnfe) { throw new PSQLException( GT.tr("Unable to load the class {0} responsible for the datatype {1}", className, typeName), PSQLState.SYSTEM_ERROR, cnfe); } addDataType(typeName, klass.asSubclass(PGobject.class)); } } } }
public class class_name { private void initObjectTypes(Properties info) throws SQLException { // Add in the types that come packaged with the driver. // These can be overridden later if desired. addDataType("box", org.postgresql.geometric.PGbox.class); addDataType("circle", org.postgresql.geometric.PGcircle.class); addDataType("line", org.postgresql.geometric.PGline.class); addDataType("lseg", org.postgresql.geometric.PGlseg.class); addDataType("path", org.postgresql.geometric.PGpath.class); addDataType("point", org.postgresql.geometric.PGpoint.class); addDataType("polygon", org.postgresql.geometric.PGpolygon.class); addDataType("money", org.postgresql.util.PGmoney.class); addDataType("interval", org.postgresql.util.PGInterval.class); Enumeration<?> e = info.propertyNames(); while (e.hasMoreElements()) { String propertyName = (String) e.nextElement(); if (propertyName.startsWith("datatype.")) { String typeName = propertyName.substring(9); String className = info.getProperty(propertyName); Class<?> klass; try { klass = Class.forName(className); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException cnfe) { throw new PSQLException( GT.tr("Unable to load the class {0} responsible for the datatype {1}", className, typeName), PSQLState.SYSTEM_ERROR, cnfe); } // depends on control dependency: [catch], data = [none] addDataType(typeName, klass.asSubclass(PGobject.class)); } } } }
public class class_name { @Override public void notifyHangupListeners(Integer cause, String causeText) { this._isLive = false; if (this.hangupListener != null) { this.hangupListener.channelHangup(this, cause, causeText); } else { logger.warn("Hangup listener is null"); } } }
public class class_name { @Override public void notifyHangupListeners(Integer cause, String causeText) { this._isLive = false; if (this.hangupListener != null) { this.hangupListener.channelHangup(this, cause, causeText); // depends on control dependency: [if], data = [none] } else { logger.warn("Hangup listener is null"); // depends on control dependency: [if], data = [none] } } }
public class class_name { public com.google.protobuf.ByteString getUfsFingerprintBytes() { java.lang.Object ref = ufsFingerprint_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); ufsFingerprint_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } }
public class class_name { public com.google.protobuf.ByteString getUfsFingerprintBytes() { java.lang.Object ref = ufsFingerprint_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); ufsFingerprint_ = 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 PartnerLogData container(FailureScopeController failureScopeController) { if (tc.isEntryEnabled()) Tr.entry(tc, "container", failureScopeController); final PartnerLogData pld = new XARecoveryData(failureScopeController, this); // // Now try to serialize the wrapper // byte[] serializedLogData = serialize(); final String[] classpathArray = _xaResFactoryClasspath; if (serializedLogData == null) { // Output a message now, we will reject future enlists later Tr.warning(tc, "WTRN0039_SERIALIZE_FAILED"); // Create an exceptin to log but dont throw it final Exception e = new NotSerializableException("XAResource recovery information failed serialization"); Tr.audit(tc, "WTRN0045_CANNOT_RECOVER_RESOURCE", new Object[]{_xaResInfo, e}); } else { // Deserialize the wrapper and check it equals the original wrapper // if it does not, then raise an error as we have a problem with the implementation // of the resource manager XAResourceInfo - this can cause us problems and // multiple partner log entries both on distributed and 390. try { final XARecoveryWrapper wrapper2 = deserialize(serializedLogData); if (wrapper2 != null) { wrapper2.setXAResourceFactoryClasspath(classpathArray); wrapper2.setPriority(_xaPriority); } if (!isSameAs(wrapper2)) { Tr.error(tc, "WTRN0040_OBJECT_DESERIALIZE_FAILED", null); Tr.audit(tc, "WTRN0045_CANNOT_RECOVER_RESOURCE", new Object[]{_xaResInfo, null}); serializedLogData = null; if (tc.isDebugEnabled()) Tr.debug(tc, "XAResourceInfo fails equality test"); } } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.Transaction.JTA.XARecoveryWrapper.container", "193"); Tr.error(tc, "WTRN0040_OBJECT_DESERIALIZE_FAILED", e); Tr.audit(tc, "WTRN0045_CANNOT_RECOVER_RESOURCE", new Object[]{_xaResInfo, e}); if (tc.isDebugEnabled()) Tr.debug(tc, "XAResourceInfo fails deserialization test", e); serializedLogData = null; } } if (serializedLogData != null) { // With the wrapper successfully serialized we must now prepend the // xaResInfoClasspath data (if any) delimiting it with byte 0. byte[] combinedData = null; if (classpathArray != null) { if (tc.isEventEnabled()) Tr.event(tc, "XAResourceInfo classpath data found. Adding to log data"); final StringBuffer classpathString = new StringBuffer(); if (tc.isDebugEnabled()) Tr.event(tc, "Creating String from array elements."); for (int i = 0; i < classpathArray.length; i++) { if (tc.isDebugEnabled()) Tr.debug(tc, "Element [" + i + "] = " + classpathArray[i]); classpathString.append(classpathArray[i]); classpathString.append(File.pathSeparator); } if (tc.isDebugEnabled()) Tr.debug(tc, "ResourceInfo classpath", classpathString.toString()); final byte[] classpathData = classpathString.toString().getBytes(); combinedData = new byte[classpathData.length + 1 + serializedLogData.length]; System.arraycopy(classpathData, 0, combinedData, 0, classpathData.length); // Delimit the classpath data combinedData[classpathData.length] = 0; System.arraycopy(serializedLogData, 0, combinedData, classpathData.length + 1, serializedLogData.length); } else { combinedData = new byte[1 + serializedLogData.length]; combinedData[0] = 0; System.arraycopy(serializedLogData, 0, combinedData, 1, serializedLogData.length); } pld.setSerializedLogData(combinedData); } if (tc.isEntryEnabled()) Tr.exit(tc, "container", pld); return pld; } }
public class class_name { public PartnerLogData container(FailureScopeController failureScopeController) { if (tc.isEntryEnabled()) Tr.entry(tc, "container", failureScopeController); final PartnerLogData pld = new XARecoveryData(failureScopeController, this); // // Now try to serialize the wrapper // byte[] serializedLogData = serialize(); final String[] classpathArray = _xaResFactoryClasspath; if (serializedLogData == null) { // Output a message now, we will reject future enlists later Tr.warning(tc, "WTRN0039_SERIALIZE_FAILED"); // depends on control dependency: [if], data = [none] // Create an exceptin to log but dont throw it final Exception e = new NotSerializableException("XAResource recovery information failed serialization"); Tr.audit(tc, "WTRN0045_CANNOT_RECOVER_RESOURCE", new Object[]{_xaResInfo, e}); // depends on control dependency: [if], data = [none] } else { // Deserialize the wrapper and check it equals the original wrapper // if it does not, then raise an error as we have a problem with the implementation // of the resource manager XAResourceInfo - this can cause us problems and // multiple partner log entries both on distributed and 390. try { final XARecoveryWrapper wrapper2 = deserialize(serializedLogData); if (wrapper2 != null) { wrapper2.setXAResourceFactoryClasspath(classpathArray); // depends on control dependency: [if], data = [none] wrapper2.setPriority(_xaPriority); // depends on control dependency: [if], data = [none] } if (!isSameAs(wrapper2)) { Tr.error(tc, "WTRN0040_OBJECT_DESERIALIZE_FAILED", null); // depends on control dependency: [if], data = [none] Tr.audit(tc, "WTRN0045_CANNOT_RECOVER_RESOURCE", new Object[]{_xaResInfo, null}); // depends on control dependency: [if], data = [none] serializedLogData = null; // depends on control dependency: [if], data = [none] if (tc.isDebugEnabled()) Tr.debug(tc, "XAResourceInfo fails equality test"); } } catch (Exception e) { FFDCFilter.processException(e, "com.ibm.ws.Transaction.JTA.XARecoveryWrapper.container", "193"); Tr.error(tc, "WTRN0040_OBJECT_DESERIALIZE_FAILED", e); Tr.audit(tc, "WTRN0045_CANNOT_RECOVER_RESOURCE", new Object[]{_xaResInfo, e}); if (tc.isDebugEnabled()) Tr.debug(tc, "XAResourceInfo fails deserialization test", e); serializedLogData = null; } // depends on control dependency: [catch], data = [none] } if (serializedLogData != null) { // With the wrapper successfully serialized we must now prepend the // xaResInfoClasspath data (if any) delimiting it with byte 0. byte[] combinedData = null; if (classpathArray != null) { if (tc.isEventEnabled()) Tr.event(tc, "XAResourceInfo classpath data found. Adding to log data"); final StringBuffer classpathString = new StringBuffer(); if (tc.isDebugEnabled()) Tr.event(tc, "Creating String from array elements."); for (int i = 0; i < classpathArray.length; i++) { if (tc.isDebugEnabled()) Tr.debug(tc, "Element [" + i + "] = " + classpathArray[i]); classpathString.append(classpathArray[i]); // depends on control dependency: [for], data = [i] classpathString.append(File.pathSeparator); // depends on control dependency: [for], data = [none] } if (tc.isDebugEnabled()) Tr.debug(tc, "ResourceInfo classpath", classpathString.toString()); final byte[] classpathData = classpathString.toString().getBytes(); combinedData = new byte[classpathData.length + 1 + serializedLogData.length]; // depends on control dependency: [if], data = [none] System.arraycopy(classpathData, 0, combinedData, 0, classpathData.length); // depends on control dependency: [if], data = [none] // Delimit the classpath data combinedData[classpathData.length] = 0; // depends on control dependency: [if], data = [none] System.arraycopy(serializedLogData, 0, combinedData, classpathData.length + 1, serializedLogData.length); // depends on control dependency: [if], data = [none] } else { combinedData = new byte[1 + serializedLogData.length]; // depends on control dependency: [if], data = [none] combinedData[0] = 0; // depends on control dependency: [if], data = [none] System.arraycopy(serializedLogData, 0, combinedData, 1, serializedLogData.length); // depends on control dependency: [if], data = [none] } pld.setSerializedLogData(combinedData); // depends on control dependency: [if], data = [none] } if (tc.isEntryEnabled()) Tr.exit(tc, "container", pld); return pld; } }
public class class_name { protected void handleUnmappedAttribute(final Map<String, List<Object>> attributesToRelease, final String attributeName, final Object attributeValue) { LOGGER.debug("Found attribute [{}] that is not defined in pattern definitions", attributeName); if (excludeUnmappedAttributes) { LOGGER.debug("Excluding attribute [{}] given unmatched attributes are to be excluded", attributeName); } else { LOGGER.debug("Added unmatched attribute [{}] with value(s) [{}]", attributeName, attributeValue); attributesToRelease.put(attributeName, CollectionUtils.toCollection(attributeValue, ArrayList.class)); } } }
public class class_name { protected void handleUnmappedAttribute(final Map<String, List<Object>> attributesToRelease, final String attributeName, final Object attributeValue) { LOGGER.debug("Found attribute [{}] that is not defined in pattern definitions", attributeName); if (excludeUnmappedAttributes) { LOGGER.debug("Excluding attribute [{}] given unmatched attributes are to be excluded", attributeName); // depends on control dependency: [if], data = [none] } else { LOGGER.debug("Added unmatched attribute [{}] with value(s) [{}]", attributeName, attributeValue); // depends on control dependency: [if], data = [none] attributesToRelease.put(attributeName, CollectionUtils.toCollection(attributeValue, ArrayList.class)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public <T> void setState(HttpConnectionInterceptor interceptor, String stateName, T stateObjectToStore) { Map<String, Object> state = interceptorStates.get(interceptor); if (state == null) { interceptorStates.put(interceptor, (state = new ConcurrentHashMap<String, Object>())); } state.put(stateName, stateObjectToStore); } }
public class class_name { public <T> void setState(HttpConnectionInterceptor interceptor, String stateName, T stateObjectToStore) { Map<String, Object> state = interceptorStates.get(interceptor); if (state == null) { interceptorStates.put(interceptor, (state = new ConcurrentHashMap<String, Object>())); // depends on control dependency: [if], data = [(state] } state.put(stateName, stateObjectToStore); } }
public class class_name { public Optional<List<String>> getOptionalStringList(final String param) { if (isPresent(param)) { return Optional.of(getStringList(param)); } return Optional.absent(); } }
public class class_name { public Optional<List<String>> getOptionalStringList(final String param) { if (isPresent(param)) { return Optional.of(getStringList(param)); // depends on control dependency: [if], data = [none] } return Optional.absent(); } }
public class class_name { private void scanAnnotation(List<AuthzHandler> authzArray, List<Annotation> annotations) { if (null == annotations || 0 == annotations.size()) { return; } for (Annotation a : annotations) { if (a instanceof RequiresRoles) { authzArray.set(0, new RoleAuthzHandler(a)); } else if (a instanceof RequiresPermissions) { authzArray.set(1, new PermissionAuthzHandler(a)); } else if (a instanceof RequiresAuthentication) { authzArray.set(2, AuthenticatedAuthzHandler.me()); } else if (a instanceof RequiresUser) { authzArray.set(3, UserAuthzHandler.me()); } else if (a instanceof RequiresGuest) { authzArray.set(4, GuestAuthzHandler.me()); } } } }
public class class_name { private void scanAnnotation(List<AuthzHandler> authzArray, List<Annotation> annotations) { if (null == annotations || 0 == annotations.size()) { return; // depends on control dependency: [if], data = [none] } for (Annotation a : annotations) { if (a instanceof RequiresRoles) { authzArray.set(0, new RoleAuthzHandler(a)); // depends on control dependency: [if], data = [none] } else if (a instanceof RequiresPermissions) { authzArray.set(1, new PermissionAuthzHandler(a)); // depends on control dependency: [if], data = [none] } else if (a instanceof RequiresAuthentication) { authzArray.set(2, AuthenticatedAuthzHandler.me()); // depends on control dependency: [if], data = [none] } else if (a instanceof RequiresUser) { authzArray.set(3, UserAuthzHandler.me()); // depends on control dependency: [if], data = [none] } else if (a instanceof RequiresGuest) { authzArray.set(4, GuestAuthzHandler.me()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void copyFrom(XNElement other) { content = other.content; userObject = other.userObject; for (Map.Entry<XAttributeName, String> me : other.attributes.entrySet()) { XAttributeName an = new XAttributeName(me.getKey().name, me.getKey().namespace, me.getKey().prefix); attributes.put(an, me.getValue()); } for (XNElement c : children) { XNElement c0 = c.copy(); c0.parent = this; children.add(c0); } } }
public class class_name { public void copyFrom(XNElement other) { content = other.content; userObject = other.userObject; for (Map.Entry<XAttributeName, String> me : other.attributes.entrySet()) { XAttributeName an = new XAttributeName(me.getKey().name, me.getKey().namespace, me.getKey().prefix); attributes.put(an, me.getValue()); // depends on control dependency: [for], data = [me] } for (XNElement c : children) { XNElement c0 = c.copy(); c0.parent = this; // depends on control dependency: [for], data = [c] children.add(c0); // depends on control dependency: [for], data = [c] } } }
public class class_name { private ResponseEntity<String> makeRestCall(String instanceUrl, String suffix) { ResponseEntity<String> response = null; try { response = restOperations.exchange(joinUrl(instanceUrl, artifactorySettings.getEndpoint(), suffix), HttpMethod.GET, new HttpEntity<>(createHeaders(instanceUrl)), String.class); } catch (RestClientException re) { LOGGER.error("Error with REST url: " + joinUrl(instanceUrl, artifactorySettings.getEndpoint(), suffix)); LOGGER.error(re.getMessage()); } return response; } }
public class class_name { private ResponseEntity<String> makeRestCall(String instanceUrl, String suffix) { ResponseEntity<String> response = null; try { response = restOperations.exchange(joinUrl(instanceUrl, artifactorySettings.getEndpoint(), suffix), HttpMethod.GET, new HttpEntity<>(createHeaders(instanceUrl)), String.class); // depends on control dependency: [try], data = [none] } catch (RestClientException re) { LOGGER.error("Error with REST url: " + joinUrl(instanceUrl, artifactorySettings.getEndpoint(), suffix)); LOGGER.error(re.getMessage()); } // depends on control dependency: [catch], data = [none] return response; } }
public class class_name { public void marshall(UpdatePresetRequest updatePresetRequest, ProtocolMarshaller protocolMarshaller) { if (updatePresetRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updatePresetRequest.getCategory(), CATEGORY_BINDING); protocolMarshaller.marshall(updatePresetRequest.getDescription(), DESCRIPTION_BINDING); protocolMarshaller.marshall(updatePresetRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(updatePresetRequest.getSettings(), SETTINGS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdatePresetRequest updatePresetRequest, ProtocolMarshaller protocolMarshaller) { if (updatePresetRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updatePresetRequest.getCategory(), CATEGORY_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updatePresetRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updatePresetRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updatePresetRequest.getSettings(), SETTINGS_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 { @Nonnull public IMicroDocument getAsDocument (@Nonnull @Nonempty final String sFullContextPath) { final String sNamespaceURL = CXMLSitemap.XML_NAMESPACE_0_9; final IMicroDocument ret = new MicroDocument (); final IMicroElement eSitemapindex = ret.appendElement (sNamespaceURL, ELEMENT_SITEMAPINDEX); int nIndex = 0; for (final XMLSitemapURLSet aURLSet : m_aURLSets) { final IMicroElement eSitemap = eSitemapindex.appendElement (sNamespaceURL, ELEMENT_SITEMAP); // The location of the sub-sitemaps must be prefixed with the full server // and context path eSitemap.appendElement (sNamespaceURL, ELEMENT_LOC) .appendText (sFullContextPath + "/" + getSitemapFilename (nIndex)); final LocalDateTime aLastModification = aURLSet.getLastModificationDateTime (); if (aLastModification != null) { eSitemap.appendElement (sNamespaceURL, ELEMENT_LASTMOD) .appendText (PDTWebDateHelper.getAsStringXSD (aLastModification)); } ++nIndex; } return ret; } }
public class class_name { @Nonnull public IMicroDocument getAsDocument (@Nonnull @Nonempty final String sFullContextPath) { final String sNamespaceURL = CXMLSitemap.XML_NAMESPACE_0_9; final IMicroDocument ret = new MicroDocument (); final IMicroElement eSitemapindex = ret.appendElement (sNamespaceURL, ELEMENT_SITEMAPINDEX); int nIndex = 0; for (final XMLSitemapURLSet aURLSet : m_aURLSets) { final IMicroElement eSitemap = eSitemapindex.appendElement (sNamespaceURL, ELEMENT_SITEMAP); // The location of the sub-sitemaps must be prefixed with the full server // and context path eSitemap.appendElement (sNamespaceURL, ELEMENT_LOC) .appendText (sFullContextPath + "/" + getSitemapFilename (nIndex)); // depends on control dependency: [for], data = [none] final LocalDateTime aLastModification = aURLSet.getLastModificationDateTime (); if (aLastModification != null) { eSitemap.appendElement (sNamespaceURL, ELEMENT_LASTMOD) .appendText (PDTWebDateHelper.getAsStringXSD (aLastModification)); // depends on control dependency: [if], data = [none] } ++nIndex; // depends on control dependency: [for], data = [none] } return ret; } }
public class class_name { public static void closeResultSet(ResultSet rs){ if (rs != null) { try { rs.close(); } catch (Exception e) { log.warn("Exception when closing database result set.", e); } } } }
public class class_name { public static void closeResultSet(ResultSet rs){ if (rs != null) { try { rs.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { log.warn("Exception when closing database result set.", e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { private void buildFilterMenus() { buildFilterSubMenu(firstNameFilterMenu, FIRST_NAME); if (firstNameFilterMenu.getChildCount() == 0) { firstNameFilterMenu.setVisible(false); } buildFilterSubMenu(lastNameFilterMenu, LAST_NAME); if (lastNameFilterMenu.getChildCount() == 0) { lastNameFilterMenu.setVisible(false); } buildFilterSubMenu(dobFilterMenu, DOB); if (dobFilterMenu.getChildCount() == 0) { dobFilterMenu.setVisible(false); } } }
public class class_name { private void buildFilterMenus() { buildFilterSubMenu(firstNameFilterMenu, FIRST_NAME); if (firstNameFilterMenu.getChildCount() == 0) { firstNameFilterMenu.setVisible(false); // depends on control dependency: [if], data = [none] } buildFilterSubMenu(lastNameFilterMenu, LAST_NAME); if (lastNameFilterMenu.getChildCount() == 0) { lastNameFilterMenu.setVisible(false); // depends on control dependency: [if], data = [none] } buildFilterSubMenu(dobFilterMenu, DOB); if (dobFilterMenu.getChildCount() == 0) { dobFilterMenu.setVisible(false); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String dumpString(byte[] frame, int offset, int length, boolean ascii) { if ((frame == null)|| (length == 0)) return null; // Main formatting is performed in buf. asciibuf is used to hold the // ascii translation. asciibuf is appended to buf before a new line is started StringBuffer buf = new StringBuffer(); StringBuffer asciibuf = new StringBuffer(); buf.append("Length=").append(length); for (int i = 0; i < length; i++) { if (i%32 == 0) { if (ascii) { buf.append(asciibuf); asciibuf.setLength(0); asciibuf.append("\n").append(pad(0)).append(" "); } buf.append("\n").append(pad(offset+i)).append(offset+i).append(": "); } else if (i%16 == 0) { buf.append(" "); if (ascii) asciibuf.append(" "); } else if (i%4 == 0) { buf.append(" "); if (ascii) asciibuf.append(" "); } buf.append(digits[(frame[offset+i] >>> 4) & 0x0f]); buf.append(digits[frame[offset+i] & 0x0f]); if (ascii) { if (frame[offset+i]>=0x20 && ((frame[offset+i] & 0x80) == 0)) { asciibuf.append(' ').append((char)frame[offset+i]); } else { asciibuf.append(" ."); } } } if (ascii) buf.append(asciibuf); return buf.toString(); } }
public class class_name { public static String dumpString(byte[] frame, int offset, int length, boolean ascii) { if ((frame == null)|| (length == 0)) return null; // Main formatting is performed in buf. asciibuf is used to hold the // ascii translation. asciibuf is appended to buf before a new line is started StringBuffer buf = new StringBuffer(); StringBuffer asciibuf = new StringBuffer(); buf.append("Length=").append(length); for (int i = 0; i < length; i++) { if (i%32 == 0) { if (ascii) { buf.append(asciibuf); // depends on control dependency: [if], data = [none] asciibuf.setLength(0); // depends on control dependency: [if], data = [none] asciibuf.append("\n").append(pad(0)).append(" "); // depends on control dependency: [if], data = [none] } buf.append("\n").append(pad(offset+i)).append(offset+i).append(": "); // depends on control dependency: [if], data = [none] } else if (i%16 == 0) { buf.append(" "); // depends on control dependency: [if], data = [none] if (ascii) asciibuf.append(" "); } else if (i%4 == 0) { buf.append(" "); // depends on control dependency: [if], data = [none] if (ascii) asciibuf.append(" "); } buf.append(digits[(frame[offset+i] >>> 4) & 0x0f]); // depends on control dependency: [for], data = [i] buf.append(digits[frame[offset+i] & 0x0f]); // depends on control dependency: [for], data = [i] if (ascii) { if (frame[offset+i]>=0x20 && ((frame[offset+i] & 0x80) == 0)) { asciibuf.append(' ').append((char)frame[offset+i]); // depends on control dependency: [if], data = [none] } else { asciibuf.append(" ."); // depends on control dependency: [if], data = [none] } } } if (ascii) buf.append(asciibuf); return buf.toString(); } }
public class class_name { public static void decodeIncommingData(IoBuffer in, IoSession session) { log.trace("Decoding: {}", in); // get decoder state DecoderState decoderState = (DecoderState) session.getAttribute(DECODER_STATE_KEY); if (decoderState.fin == Byte.MIN_VALUE) { byte frameInfo = in.get(); // get FIN (1 bit) //log.debug("frameInfo: {}", Integer.toBinaryString((frameInfo & 0xFF) + 256)); decoderState.fin = (byte) ((frameInfo >>> 7) & 1); log.trace("FIN: {}", decoderState.fin); // the next 3 bits are for RSV1-3 (not used here at the moment) // get the opcode (4 bits) decoderState.opCode = (byte) (frameInfo & 0x0f); log.trace("Opcode: {}", decoderState.opCode); // opcodes 3-7 and b-f are reserved for non-control frames } if (decoderState.mask == Byte.MIN_VALUE) { byte frameInfo2 = in.get(); // get mask bit (1 bit) decoderState.mask = (byte) ((frameInfo2 >>> 7) & 1); log.trace("Mask: {}", decoderState.mask); // get payload length (7, 7+16, 7+64 bits) decoderState.frameLen = (frameInfo2 & (byte) 0x7F); log.trace("Payload length: {}", decoderState.frameLen); if (decoderState.frameLen == 126) { decoderState.frameLen = in.getUnsignedShort(); log.trace("Payload length updated: {}", decoderState.frameLen); } else if (decoderState.frameLen == 127) { long extendedLen = in.getLong(); if (extendedLen >= Integer.MAX_VALUE) { log.error("Data frame is too large for this implementation. Length: {}", extendedLen); } else { decoderState.frameLen = (int) extendedLen; } log.trace("Payload length updated: {}", decoderState.frameLen); } } // ensure enough bytes left to fill payload, if masked add 4 additional bytes if (decoderState.frameLen + (decoderState.mask == 1 ? 4 : 0) > in.remaining()) { log.info("Not enough data available to decode, socket may be closed/closing"); } else { // if the data is masked (xor'd) if (decoderState.mask == 1) { // get the mask key byte maskKey[] = new byte[4]; for (int i = 0; i < 4; i++) { maskKey[i] = in.get(); } /* now un-mask frameLen bytes as per Section 5.3 RFC 6455 Octet i of the transformed data ("transformed-octet-i") is the XOR of octet i of the original data ("original-octet-i") with octet at index i modulo 4 of the masking key ("masking-key-octet-j"): j = i MOD 4 transformed-octet-i = original-octet-i XOR masking-key-octet-j */ decoderState.payload = new byte[decoderState.frameLen]; for (int i = 0; i < decoderState.frameLen; i++) { byte maskedByte = in.get(); decoderState.payload[i] = (byte) (maskedByte ^ maskKey[i % 4]); } } else { decoderState.payload = new byte[decoderState.frameLen]; in.get(decoderState.payload); } // if FIN == 0 we have fragments if (decoderState.fin == 0) { // store the fragment and continue IoBuffer fragments = (IoBuffer) session.getAttribute(DECODED_MESSAGE_FRAGMENTS_KEY); if (fragments == null) { fragments = IoBuffer.allocate(decoderState.frameLen); fragments.setAutoExpand(true); session.setAttribute(DECODED_MESSAGE_FRAGMENTS_KEY, fragments); // store message type since following type may be a continuation MessageType messageType = MessageType.CLOSE; switch (decoderState.opCode) { case 0: // continuation messageType = MessageType.CONTINUATION; break; case 1: // text messageType = MessageType.TEXT; break; case 2: // binary messageType = MessageType.BINARY; break; case 9: // ping messageType = MessageType.PING; break; case 0xa: // pong messageType = MessageType.PONG; break; } session.setAttribute(DECODED_MESSAGE_TYPE_KEY, messageType); } fragments.put(decoderState.payload); // remove decoder state session.removeAttribute(DECODER_STATE_KEY); } else { // create a message WSMessage message = new WSMessage(); // check for previously set type from the first fragment (if we have fragments) MessageType messageType = (MessageType) session.getAttribute(DECODED_MESSAGE_TYPE_KEY); if (messageType == null) { switch (decoderState.opCode) { case 0: // continuation messageType = MessageType.CONTINUATION; break; case 1: // text messageType = MessageType.TEXT; break; case 2: // binary messageType = MessageType.BINARY; break; case 9: // ping messageType = MessageType.PING; break; case 0xa: // pong messageType = MessageType.PONG; break; case 8: // close messageType = MessageType.CLOSE; // handler or listener should close upon receipt break; default: // TODO throw ex? log.info("Unhandled opcode: {}", decoderState.opCode); } } // set message type message.setMessageType(messageType); // check for fragments and piece them together, otherwise just send the single completed frame IoBuffer fragments = (IoBuffer) session.removeAttribute(DECODED_MESSAGE_FRAGMENTS_KEY); if (fragments != null) { fragments.put(decoderState.payload); fragments.flip(); message.setPayload(fragments); } else { // add the payload message.addPayload(decoderState.payload); } // set the message on the session session.setAttribute(DECODED_MESSAGE_KEY, message); // remove decoder state session.removeAttribute(DECODER_STATE_KEY); // remove type session.removeAttribute(DECODED_MESSAGE_TYPE_KEY); } } } }
public class class_name { public static void decodeIncommingData(IoBuffer in, IoSession session) { log.trace("Decoding: {}", in); // get decoder state DecoderState decoderState = (DecoderState) session.getAttribute(DECODER_STATE_KEY); if (decoderState.fin == Byte.MIN_VALUE) { byte frameInfo = in.get(); // get FIN (1 bit) //log.debug("frameInfo: {}", Integer.toBinaryString((frameInfo & 0xFF) + 256)); decoderState.fin = (byte) ((frameInfo >>> 7) & 1); // depends on control dependency: [if], data = [none] log.trace("FIN: {}", decoderState.fin); // depends on control dependency: [if], data = [none] // the next 3 bits are for RSV1-3 (not used here at the moment) // get the opcode (4 bits) decoderState.opCode = (byte) (frameInfo & 0x0f); // depends on control dependency: [if], data = [none] log.trace("Opcode: {}", decoderState.opCode); // depends on control dependency: [if], data = [none] // opcodes 3-7 and b-f are reserved for non-control frames } if (decoderState.mask == Byte.MIN_VALUE) { byte frameInfo2 = in.get(); // get mask bit (1 bit) decoderState.mask = (byte) ((frameInfo2 >>> 7) & 1); // depends on control dependency: [if], data = [none] log.trace("Mask: {}", decoderState.mask); // depends on control dependency: [if], data = [none] // get payload length (7, 7+16, 7+64 bits) decoderState.frameLen = (frameInfo2 & (byte) 0x7F); // depends on control dependency: [if], data = [none] log.trace("Payload length: {}", decoderState.frameLen); // depends on control dependency: [if], data = [none] if (decoderState.frameLen == 126) { decoderState.frameLen = in.getUnsignedShort(); // depends on control dependency: [if], data = [none] log.trace("Payload length updated: {}", decoderState.frameLen); // depends on control dependency: [if], data = [none] } else if (decoderState.frameLen == 127) { long extendedLen = in.getLong(); if (extendedLen >= Integer.MAX_VALUE) { log.error("Data frame is too large for this implementation. Length: {}", extendedLen); // depends on control dependency: [if], data = [none] } else { decoderState.frameLen = (int) extendedLen; // depends on control dependency: [if], data = [none] } log.trace("Payload length updated: {}", decoderState.frameLen); // depends on control dependency: [if], data = [none] } } // ensure enough bytes left to fill payload, if masked add 4 additional bytes if (decoderState.frameLen + (decoderState.mask == 1 ? 4 : 0) > in.remaining()) { log.info("Not enough data available to decode, socket may be closed/closing"); // depends on control dependency: [if], data = [none] } else { // if the data is masked (xor'd) if (decoderState.mask == 1) { // get the mask key byte maskKey[] = new byte[4]; for (int i = 0; i < 4; i++) { maskKey[i] = in.get(); // depends on control dependency: [for], data = [i] } /* now un-mask frameLen bytes as per Section 5.3 RFC 6455 Octet i of the transformed data ("transformed-octet-i") is the XOR of octet i of the original data ("original-octet-i") with octet at index i modulo 4 of the masking key ("masking-key-octet-j"): j = i MOD 4 transformed-octet-i = original-octet-i XOR masking-key-octet-j */ decoderState.payload = new byte[decoderState.frameLen]; // depends on control dependency: [if], data = [none] for (int i = 0; i < decoderState.frameLen; i++) { byte maskedByte = in.get(); decoderState.payload[i] = (byte) (maskedByte ^ maskKey[i % 4]); // depends on control dependency: [for], data = [i] } } else { decoderState.payload = new byte[decoderState.frameLen]; // depends on control dependency: [if], data = [none] in.get(decoderState.payload); // depends on control dependency: [if], data = [none] } // if FIN == 0 we have fragments if (decoderState.fin == 0) { // store the fragment and continue IoBuffer fragments = (IoBuffer) session.getAttribute(DECODED_MESSAGE_FRAGMENTS_KEY); if (fragments == null) { fragments = IoBuffer.allocate(decoderState.frameLen); // depends on control dependency: [if], data = [none] fragments.setAutoExpand(true); // depends on control dependency: [if], data = [none] session.setAttribute(DECODED_MESSAGE_FRAGMENTS_KEY, fragments); // depends on control dependency: [if], data = [none] // store message type since following type may be a continuation MessageType messageType = MessageType.CLOSE; switch (decoderState.opCode) { case 0: // continuation messageType = MessageType.CONTINUATION; break; case 1: // text messageType = MessageType.TEXT; break; case 2: // binary messageType = MessageType.BINARY; break; case 9: // ping messageType = MessageType.PING; break; case 0xa: // pong messageType = MessageType.PONG; break; } session.setAttribute(DECODED_MESSAGE_TYPE_KEY, messageType); // depends on control dependency: [if], data = [none] } fragments.put(decoderState.payload); // depends on control dependency: [if], data = [none] // remove decoder state session.removeAttribute(DECODER_STATE_KEY); // depends on control dependency: [if], data = [none] } else { // create a message WSMessage message = new WSMessage(); // check for previously set type from the first fragment (if we have fragments) MessageType messageType = (MessageType) session.getAttribute(DECODED_MESSAGE_TYPE_KEY); if (messageType == null) { switch (decoderState.opCode) { case 0: // continuation messageType = MessageType.CONTINUATION; break; case 1: // text messageType = MessageType.TEXT; break; case 2: // binary messageType = MessageType.BINARY; break; case 9: // ping messageType = MessageType.PING; break; case 0xa: // pong messageType = MessageType.PONG; break; case 8: // close messageType = MessageType.CLOSE; // handler or listener should close upon receipt break; default: // TODO throw ex? log.info("Unhandled opcode: {}", decoderState.opCode); } } // set message type message.setMessageType(messageType); // depends on control dependency: [if], data = [none] // check for fragments and piece them together, otherwise just send the single completed frame IoBuffer fragments = (IoBuffer) session.removeAttribute(DECODED_MESSAGE_FRAGMENTS_KEY); if (fragments != null) { fragments.put(decoderState.payload); // depends on control dependency: [if], data = [none] fragments.flip(); // depends on control dependency: [if], data = [none] message.setPayload(fragments); // depends on control dependency: [if], data = [(fragments] } else { // add the payload message.addPayload(decoderState.payload); // depends on control dependency: [if], data = [none] } // set the message on the session session.setAttribute(DECODED_MESSAGE_KEY, message); // depends on control dependency: [if], data = [none] // remove decoder state session.removeAttribute(DECODER_STATE_KEY); // depends on control dependency: [if], data = [none] // remove type session.removeAttribute(DECODED_MESSAGE_TYPE_KEY); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private boolean isValid(final String fileType) { boolean result = false; if (fileType != null && fileType.length() > 1) { // the shortest I can think of would be something like ".h" if (fileType.startsWith(".")) { // assume it's a file extension result = true; } else if (fileType.length() > 2 && fileType.indexOf('/') > 0) { // some imaginary mimetype like "a/*" would be at least 3 characters result = true; } } return result; } }
public class class_name { private boolean isValid(final String fileType) { boolean result = false; if (fileType != null && fileType.length() > 1) { // the shortest I can think of would be something like ".h" if (fileType.startsWith(".")) { // assume it's a file extension result = true; // depends on control dependency: [if], data = [none] } else if (fileType.length() > 2 && fileType.indexOf('/') > 0) { // some imaginary mimetype like "a/*" would be at least 3 characters result = true; // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { private Ref scope(String idStr) { if (!limited && idStr.equals("var")) { String name = identifier(false); if (name != null) { cfml.removeSpace(); return new Variable(new lucee.runtime.interpreter.ref.var.Scope(ScopeSupport.SCOPE_VAR), name, limited); } } int scope = limited ? Scope.SCOPE_UNDEFINED : VariableInterpreter.scopeString2Int(pc != null && pc.ignoreScopes(), idStr); if (scope == Scope.SCOPE_UNDEFINED) { return new Variable(new lucee.runtime.interpreter.ref.var.Scope(Scope.SCOPE_UNDEFINED), idStr, limited); } return new lucee.runtime.interpreter.ref.var.Scope(scope); } }
public class class_name { private Ref scope(String idStr) { if (!limited && idStr.equals("var")) { String name = identifier(false); if (name != null) { cfml.removeSpace(); // depends on control dependency: [if], data = [none] return new Variable(new lucee.runtime.interpreter.ref.var.Scope(ScopeSupport.SCOPE_VAR), name, limited); // depends on control dependency: [if], data = [none] } } int scope = limited ? Scope.SCOPE_UNDEFINED : VariableInterpreter.scopeString2Int(pc != null && pc.ignoreScopes(), idStr); if (scope == Scope.SCOPE_UNDEFINED) { return new Variable(new lucee.runtime.interpreter.ref.var.Scope(Scope.SCOPE_UNDEFINED), idStr, limited); // depends on control dependency: [if], data = [Scope.SCOPE_UNDEFINED)] } return new lucee.runtime.interpreter.ref.var.Scope(scope); } }
public class class_name { public InvalidRequestException withMutuallyExclusiveParameters(String... mutuallyExclusiveParameters) { if (this.mutuallyExclusiveParameters == null) { setMutuallyExclusiveParameters(new java.util.ArrayList<String>(mutuallyExclusiveParameters.length)); } for (String ele : mutuallyExclusiveParameters) { this.mutuallyExclusiveParameters.add(ele); } return this; } }
public class class_name { public InvalidRequestException withMutuallyExclusiveParameters(String... mutuallyExclusiveParameters) { if (this.mutuallyExclusiveParameters == null) { setMutuallyExclusiveParameters(new java.util.ArrayList<String>(mutuallyExclusiveParameters.length)); // depends on control dependency: [if], data = [none] } for (String ele : mutuallyExclusiveParameters) { this.mutuallyExclusiveParameters.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private void handleJmxRefreshables(List<MBeanWrapper> mbeanWrappers, AttributeNodeForPojo rootNode) { for (MBeanWrapper mbeanWrapper : mbeanWrappers) { Eventloop eventloop = mbeanWrapper.getEventloop(); List<JmxRefreshable> currentRefreshables = rootNode.getAllRefreshables(mbeanWrapper.getMBean()); if (!eventloopToJmxRefreshables.containsKey(eventloop)) { eventloopToJmxRefreshables.put(eventloop, currentRefreshables); eventloop.execute(createRefreshTask(eventloop, null, 0)); } else { List<JmxRefreshable> previousRefreshables = eventloopToJmxRefreshables.get(eventloop); List<JmxRefreshable> allRefreshables = new ArrayList<>(previousRefreshables); allRefreshables.addAll(currentRefreshables); eventloopToJmxRefreshables.put(eventloop, allRefreshables); } refreshableStatsCounts.put(eventloop, eventloopToJmxRefreshables.get(eventloop).size()); } } }
public class class_name { private void handleJmxRefreshables(List<MBeanWrapper> mbeanWrappers, AttributeNodeForPojo rootNode) { for (MBeanWrapper mbeanWrapper : mbeanWrappers) { Eventloop eventloop = mbeanWrapper.getEventloop(); List<JmxRefreshable> currentRefreshables = rootNode.getAllRefreshables(mbeanWrapper.getMBean()); if (!eventloopToJmxRefreshables.containsKey(eventloop)) { eventloopToJmxRefreshables.put(eventloop, currentRefreshables); // depends on control dependency: [if], data = [none] eventloop.execute(createRefreshTask(eventloop, null, 0)); // depends on control dependency: [if], data = [none] } else { List<JmxRefreshable> previousRefreshables = eventloopToJmxRefreshables.get(eventloop); List<JmxRefreshable> allRefreshables = new ArrayList<>(previousRefreshables); allRefreshables.addAll(currentRefreshables); // depends on control dependency: [if], data = [none] eventloopToJmxRefreshables.put(eventloop, allRefreshables); // depends on control dependency: [if], data = [none] } refreshableStatsCounts.put(eventloop, eventloopToJmxRefreshables.get(eventloop).size()); // depends on control dependency: [for], data = [none] } } }
public class class_name { static public JSONObject recreateDocumentFromDocAndReserved(JSONObject doc, JSONObject reserved) throws Exception { JSONObject result = JSONSupport.copyObject( doc ); // Re-insert attributes that start with '_' if( null != reserved ) { Iterator<?> it = reserved.keys(); while( it.hasNext() ){ Object keyObj = it.next(); if( keyObj instanceof String ){ String key = (String)keyObj; Object value = reserved.opt(key); result.put("_"+key, value); } } } return result; } }
public class class_name { static public JSONObject recreateDocumentFromDocAndReserved(JSONObject doc, JSONObject reserved) throws Exception { JSONObject result = JSONSupport.copyObject( doc ); // Re-insert attributes that start with '_' if( null != reserved ) { Iterator<?> it = reserved.keys(); while( it.hasNext() ){ Object keyObj = it.next(); if( keyObj instanceof String ){ String key = (String)keyObj; Object value = reserved.opt(key); result.put("_"+key, value); // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { private void uncacheResource(CmsResource resource) { if (resource == null) { return; } if ((m_serializationPolicyPath != null) && resource.getRootPath().equals(m_serializationPolicyPath)) { m_serPolicyOffline = null; } } }
public class class_name { private void uncacheResource(CmsResource resource) { if (resource == null) { return; // depends on control dependency: [if], data = [none] } if ((m_serializationPolicyPath != null) && resource.getRootPath().equals(m_serializationPolicyPath)) { m_serPolicyOffline = null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private static String resolveSibling(String fromPath, String toPath) { // If the destination is an absolute path, nothing to do. if (toPath.startsWith("/")) { return toPath; } List<String> fromPathParts = new ArrayList<>(Arrays.asList(fromPath.split("/"))); List<String> toPathParts = new ArrayList<>(Arrays.asList(toPath.split("/"))); if (!fromPathParts.isEmpty()) { fromPathParts.remove(fromPathParts.size() - 1); } while (!fromPathParts.isEmpty() && !toPathParts.isEmpty()) { if (toPathParts.get(0).equals(".")) { toPathParts.remove(0); } else if (toPathParts.get(0).equals("..")) { toPathParts.remove(0); fromPathParts.remove(fromPathParts.size() - 1); } else { break; } } fromPathParts.addAll(toPathParts); return String.join("/", fromPathParts); } }
public class class_name { private static String resolveSibling(String fromPath, String toPath) { // If the destination is an absolute path, nothing to do. if (toPath.startsWith("/")) { return toPath; // depends on control dependency: [if], data = [none] } List<String> fromPathParts = new ArrayList<>(Arrays.asList(fromPath.split("/"))); List<String> toPathParts = new ArrayList<>(Arrays.asList(toPath.split("/"))); if (!fromPathParts.isEmpty()) { fromPathParts.remove(fromPathParts.size() - 1); // depends on control dependency: [if], data = [none] } while (!fromPathParts.isEmpty() && !toPathParts.isEmpty()) { if (toPathParts.get(0).equals(".")) { toPathParts.remove(0); // depends on control dependency: [if], data = [none] } else if (toPathParts.get(0).equals("..")) { toPathParts.remove(0); // depends on control dependency: [if], data = [none] fromPathParts.remove(fromPathParts.size() - 1); // depends on control dependency: [if], data = [none] } else { break; } } fromPathParts.addAll(toPathParts); return String.join("/", fromPathParts); } }
public class class_name { public static List<Boolean> asList(boolean... backingArray) { if (backingArray.length == 0) { return Collections.emptyList(); } return new BooleanArrayAsList(backingArray); } }
public class class_name { public static List<Boolean> asList(boolean... backingArray) { if (backingArray.length == 0) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } return new BooleanArrayAsList(backingArray); } }
public class class_name { public static ActivityChooserModel get(Context context, String historyFileName) { synchronized (sRegistryLock) { ActivityChooserModel dataModel = sDataModelRegistry.get(historyFileName); if (dataModel == null) { dataModel = new ActivityChooserModel(context, historyFileName); sDataModelRegistry.put(historyFileName, dataModel); } return dataModel; } } }
public class class_name { public static ActivityChooserModel get(Context context, String historyFileName) { synchronized (sRegistryLock) { ActivityChooserModel dataModel = sDataModelRegistry.get(historyFileName); if (dataModel == null) { dataModel = new ActivityChooserModel(context, historyFileName); // depends on control dependency: [if], data = [none] sDataModelRegistry.put(historyFileName, dataModel); // depends on control dependency: [if], data = [none] } return dataModel; } } }
public class class_name { private boolean tryProcessOnOtherMembers(Operation operation, String serviceName, long timeoutNanos) { final OperationService operationService = nodeEngine.getOperationService(); final Collection<Member> targets = nodeEngine.getClusterService().getMembers(DATA_MEMBER_SELECTOR); final Member localMember = nodeEngine.getLocalMember(); for (Member target : targets) { if (target.equals(localMember)) { continue; } long start = System.nanoTime(); try { logger.fine("Replicating " + serviceName + " to " + target); InternalCompletableFuture<Object> future = operationService.createInvocationBuilder(null, operation, target.getAddress()) .setTryCount(1) .invoke(); future.get(timeoutNanos, TimeUnit.NANOSECONDS); return true; } catch (Exception e) { logger.fine("Failed replication of " + serviceName + " for target " + target, e); } timeoutNanos -= (System.nanoTime() - start); if (timeoutNanos < 0) { break; } } return false; } }
public class class_name { private boolean tryProcessOnOtherMembers(Operation operation, String serviceName, long timeoutNanos) { final OperationService operationService = nodeEngine.getOperationService(); final Collection<Member> targets = nodeEngine.getClusterService().getMembers(DATA_MEMBER_SELECTOR); final Member localMember = nodeEngine.getLocalMember(); for (Member target : targets) { if (target.equals(localMember)) { continue; } long start = System.nanoTime(); try { logger.fine("Replicating " + serviceName + " to " + target); // depends on control dependency: [try], data = [none] InternalCompletableFuture<Object> future = operationService.createInvocationBuilder(null, operation, target.getAddress()) .setTryCount(1) .invoke(); future.get(timeoutNanos, TimeUnit.NANOSECONDS); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (Exception e) { logger.fine("Failed replication of " + serviceName + " for target " + target, e); } // depends on control dependency: [catch], data = [none] timeoutNanos -= (System.nanoTime() - start); // depends on control dependency: [for], data = [none] if (timeoutNanos < 0) { break; } } return false; } }
public class class_name { private List<BitcoinScriptWitnessItem> readListOfBitcoinScriptWitnessFromTable(ListObjectInspector loi, Object listOfScriptWitnessItemObject) { int listLength=loi.getListLength(listOfScriptWitnessItemObject); List<BitcoinScriptWitnessItem> result = new ArrayList<>(listLength); StructObjectInspector listOfScriptwitnessItemElementObjectInspector = (StructObjectInspector)loi.getListElementObjectInspector(); for (int i=0;i<listLength;i++) { Object currentlistofscriptwitnessitemObject = loi.getListElement(listOfScriptWitnessItemObject,i); StructField stackitemcounterSF = listOfScriptwitnessItemElementObjectInspector.getStructFieldRef("stackitemcounter"); StructField scriptwitnesslistSF = listOfScriptwitnessItemElementObjectInspector.getStructFieldRef("scriptwitnesslist"); boolean scriptwitnessitemNull = (stackitemcounterSF==null) || (scriptwitnesslistSF==null) ; if (scriptwitnessitemNull) { LOG.warn("Invalid BitcoinScriptWitnessItem detected at position "+i); return new ArrayList<>(); } byte[] stackItemCounter = wboi.getPrimitiveJavaObject(listOfScriptwitnessItemElementObjectInspector.getStructFieldData(currentlistofscriptwitnessitemObject,stackitemcounterSF)); Object listofscriptwitnessObject = soi.getStructFieldData(currentlistofscriptwitnessitemObject,scriptwitnesslistSF); ListObjectInspector loiScriptWitness=(ListObjectInspector)scriptwitnesslistSF.getFieldObjectInspector(); StructObjectInspector listOfScriptwitnessElementObjectInspector = (StructObjectInspector)loiScriptWitness.getListElementObjectInspector(); int listWitnessLength = loiScriptWitness.getListLength(listofscriptwitnessObject); List<BitcoinScriptWitness> currentScriptWitnessList = new ArrayList<>(listWitnessLength); for (int j=0;j<listWitnessLength;j++) { Object currentlistofscriptwitnessObject = loi.getListElement(listofscriptwitnessObject,j); StructField witnessscriptlengthSF = listOfScriptwitnessElementObjectInspector.getStructFieldRef("witnessscriptlength"); StructField witnessscriptSF = listOfScriptwitnessElementObjectInspector.getStructFieldRef("witnessscript"); boolean scriptwitnessNull = (witnessscriptlengthSF==null) || (witnessscriptSF==null); if (scriptwitnessNull) { LOG.warn("Invalid BitcoinScriptWitness detected at position "+j+ "for BitcoinScriptWitnessItem "+i); return new ArrayList<>(); } byte[] scriptWitnessLength = wboi.getPrimitiveJavaObject(listOfScriptwitnessElementObjectInspector.getStructFieldData(currentlistofscriptwitnessObject,witnessscriptlengthSF)); byte[] scriptWitness = wboi.getPrimitiveJavaObject(listOfScriptwitnessElementObjectInspector.getStructFieldData(currentlistofscriptwitnessObject,witnessscriptSF)); currentScriptWitnessList.add(new BitcoinScriptWitness(scriptWitnessLength,scriptWitness)); } BitcoinScriptWitnessItem currentBitcoinScriptWitnessItem = new BitcoinScriptWitnessItem(stackItemCounter,currentScriptWitnessList); result.add(currentBitcoinScriptWitnessItem); } return result; } }
public class class_name { private List<BitcoinScriptWitnessItem> readListOfBitcoinScriptWitnessFromTable(ListObjectInspector loi, Object listOfScriptWitnessItemObject) { int listLength=loi.getListLength(listOfScriptWitnessItemObject); List<BitcoinScriptWitnessItem> result = new ArrayList<>(listLength); StructObjectInspector listOfScriptwitnessItemElementObjectInspector = (StructObjectInspector)loi.getListElementObjectInspector(); for (int i=0;i<listLength;i++) { Object currentlistofscriptwitnessitemObject = loi.getListElement(listOfScriptWitnessItemObject,i); StructField stackitemcounterSF = listOfScriptwitnessItemElementObjectInspector.getStructFieldRef("stackitemcounter"); StructField scriptwitnesslistSF = listOfScriptwitnessItemElementObjectInspector.getStructFieldRef("scriptwitnesslist"); boolean scriptwitnessitemNull = (stackitemcounterSF==null) || (scriptwitnesslistSF==null) ; if (scriptwitnessitemNull) { LOG.warn("Invalid BitcoinScriptWitnessItem detected at position "+i); // depends on control dependency: [if], data = [none] return new ArrayList<>(); // depends on control dependency: [if], data = [none] } byte[] stackItemCounter = wboi.getPrimitiveJavaObject(listOfScriptwitnessItemElementObjectInspector.getStructFieldData(currentlistofscriptwitnessitemObject,stackitemcounterSF)); Object listofscriptwitnessObject = soi.getStructFieldData(currentlistofscriptwitnessitemObject,scriptwitnesslistSF); ListObjectInspector loiScriptWitness=(ListObjectInspector)scriptwitnesslistSF.getFieldObjectInspector(); StructObjectInspector listOfScriptwitnessElementObjectInspector = (StructObjectInspector)loiScriptWitness.getListElementObjectInspector(); int listWitnessLength = loiScriptWitness.getListLength(listofscriptwitnessObject); List<BitcoinScriptWitness> currentScriptWitnessList = new ArrayList<>(listWitnessLength); for (int j=0;j<listWitnessLength;j++) { Object currentlistofscriptwitnessObject = loi.getListElement(listofscriptwitnessObject,j); StructField witnessscriptlengthSF = listOfScriptwitnessElementObjectInspector.getStructFieldRef("witnessscriptlength"); StructField witnessscriptSF = listOfScriptwitnessElementObjectInspector.getStructFieldRef("witnessscript"); boolean scriptwitnessNull = (witnessscriptlengthSF==null) || (witnessscriptSF==null); if (scriptwitnessNull) { LOG.warn("Invalid BitcoinScriptWitness detected at position "+j+ "for BitcoinScriptWitnessItem "+i); // depends on control dependency: [if], data = [none] return new ArrayList<>(); // depends on control dependency: [if], data = [none] } byte[] scriptWitnessLength = wboi.getPrimitiveJavaObject(listOfScriptwitnessElementObjectInspector.getStructFieldData(currentlistofscriptwitnessObject,witnessscriptlengthSF)); byte[] scriptWitness = wboi.getPrimitiveJavaObject(listOfScriptwitnessElementObjectInspector.getStructFieldData(currentlistofscriptwitnessObject,witnessscriptSF)); currentScriptWitnessList.add(new BitcoinScriptWitness(scriptWitnessLength,scriptWitness)); // depends on control dependency: [for], data = [none] } BitcoinScriptWitnessItem currentBitcoinScriptWitnessItem = new BitcoinScriptWitnessItem(stackItemCounter,currentScriptWitnessList); result.add(currentBitcoinScriptWitnessItem); // depends on control dependency: [for], data = [none] } return result; } }