Treating {@code bb} as an ELF file, extract all the DT_NEEDED entries from its dynamic section.

@param fc FileChannel referring to ELF file
@return Array of strings, one for each DT_NEEDED entry, in file order
339039
public static String[] extract_DT_NEEDED(FileChannel fc)
      throws IOException {

    //
    // All constants below are fixed by the ELF specification and are the offsets of fields within
    // the elf.h data structures.
    //

    ByteBuffer bb = ByteBuffer.allocate(8 /* largest read unit */);

    // Read ELF header.

    bb.order(ByteOrder.LITTLE_ENDIAN);
    if (getu32(fc, bb, Elf32_Ehdr.e_ident) != ELF_MAGIC) {
      throw new ElfError("file is not ELF");
    }

    boolean is32 = (getu8(fc, bb, Elf32_Ehdr.e_ident + 0x4) == 1);
    if (getu8(fc, bb, Elf32_Ehdr.e_ident + 0x5) == 2) {
      bb.order(ByteOrder.BIG_ENDIAN);
    }

    // Offsets above are identical in 32- and 64-bit cases.

    // Find the offset of the dynamic linking information.

    long e_phoff = is32
        ? getu32(fc, bb, Elf32_Ehdr.e_phoff)
        :  get64(fc, bb, Elf64_Ehdr.e_phoff);

    long e_phnum = is32
        ? getu16(fc, bb, Elf32_Ehdr.e_phnum)
        : getu16(fc, bb, Elf64_Ehdr.e_phnum);

    int e_phentsize = is32
        ? getu16(fc, bb, Elf32_Ehdr.e_phentsize)
        : getu16(fc, bb, Elf64_Ehdr.e_phentsize);

    if (e_phnum == PN_XNUM) { // Overflowed into section[0].sh_info

      long e_shoff = is32
          ? getu32(fc, bb, Elf32_Ehdr.e_shoff)
          : get64(fc, bb, Elf64_Ehdr.e_shoff);

      long sh_info = is32
          ? getu32(fc, bb, e_shoff + Elf32_Shdr.sh_info)
          : getu32(fc, bb, e_shoff + Elf64_Shdr.sh_info);

      e_phnum = sh_info;
    }

    long dynStart = 0;
    long phdr = e_phoff;

    for (long i = 0; i < e_phnum; ++i) {
      long p_type = is32
          ? getu32(fc, bb, phdr + Elf32_Phdr.p_type)
          : getu32(fc, bb, phdr + Elf64_Phdr.p_type);

      if (p_type == PT_DYNAMIC) {
        long p_offset = is32
            ? getu32(fc, bb, phdr + Elf32_Phdr.p_offset)
            : get64(fc, bb, phdr + Elf64_Phdr.p_offset);

        dynStart = p_offset;
        break;
      }

      phdr += e_phentsize;
    }

    if (dynStart == 0) {
      throw new ElfError("ELF file does not contain dynamic linking information");
    }

    // Walk the items in the dynamic section, counting the DT_NEEDED entries.  Also remember where
    // the string table for those entries lives.  That table is a pointer, which we translate to an
    // offset below.

    long d_tag;
    int nr_DT_NEEDED = 0;
    long dyn = dynStart;
    long ptr_DT_STRTAB = 0;

    do {
      d_tag = is32
          ? getu32(fc, bb, dyn + Elf32_Dyn.d_tag)
          : get64(fc, bb, dyn + Elf64_Dyn.d_tag);

      if (d_tag == DT_NEEDED) {
        if (nr_DT_NEEDED == Integer.MAX_VALUE) {
          throw new ElfError("malformed DT_NEEDED section");
        }

        nr_DT_NEEDED += 1;
      } else if (d_tag == DT_STRTAB) {
        ptr_DT_STRTAB = is32
            ? getu32(fc, bb, dyn + Elf32_Dyn.d_un)
            : get64(fc, bb, dyn + Elf64_Dyn.d_un);
      }

      dyn += is32 ? 8 : 16;
    } while (d_tag != DT_NULL);

    if (ptr_DT_STRTAB == 0) {
      throw new ElfError("Dynamic section string-table not found");
    }

    // Translate the runtime string table pointer we found above to a file offset.

    long off_DT_STRTAB = 0;
    phdr = e_phoff;

    for (int i = 0; i < e_phnum; ++i) {
      long p_type = is32
          ? getu32(fc, bb, phdr + Elf32_Phdr.p_type)
          : getu32(fc, bb, phdr + Elf64_Phdr.p_type);

      if (p_type == PT_LOAD) {
        long p_vaddr = is32
            ? getu32(fc, bb, phdr + Elf32_Phdr.p_vaddr)
            : get64(fc, bb, phdr + Elf64_Phdr.p_vaddr);

        long p_memsz = is32
            ? getu32(fc, bb, phdr + Elf32_Phdr.p_memsz)
            : get64(fc, bb, phdr + Elf64_Phdr.p_memsz);

        if (p_vaddr <= ptr_DT_STRTAB && ptr_DT_STRTAB < p_vaddr + p_memsz) {
          long p_offset = is32
              ? getu32(fc, bb, phdr + Elf32_Phdr.p_offset)
              : get64(fc, bb, phdr + Elf64_Phdr.p_offset);

          off_DT_STRTAB = p_offset + (ptr_DT_STRTAB - p_vaddr);
          break;
        }
      }

      phdr += e_phentsize;
    }

    if (off_DT_STRTAB == 0) {
      throw new ElfError("did not find file offset of DT_STRTAB table");
    }

    String[] needed = new String[nr_DT_NEEDED];

    nr_DT_NEEDED = 0;
    dyn = dynStart;

    do {
      d_tag = is32
          ? getu32(fc, bb, dyn + Elf32_Dyn.d_tag)
          : get64(fc, bb, dyn + Elf64_Dyn.d_tag);

      if (d_tag == DT_NEEDED) {
        long d_val = is32
            ? getu32(fc, bb, dyn + Elf32_Dyn.d_un)
            : get64(fc, bb, dyn + Elf64_Dyn.d_un);

        needed[nr_DT_NEEDED] = getSz(fc, bb, off_DT_STRTAB + d_val);
        if (nr_DT_NEEDED == Integer.MAX_VALUE) {
          throw new ElfError("malformed DT_NEEDED section");
        }

        nr_DT_NEEDED += 1;
      }

      dyn += is32 ? 8 : 16;
    } while (d_tag != DT_NULL);

    if (nr_DT_NEEDED != needed.length) {
      throw new ElfError("malformed DT_NEEDED section");
    }

    return needed;
  }
525192
@Override
    public synchronized ChannelData[] getRunningChannels() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "getRunningChannels");
        }

        // Note, runtime has child data objects so duplicates may be found.
        List<ChannelData> list = new ArrayList<ChannelData>();
        for (ChannelContainer channel : this.channelRunningMap.values()) {
            list.add(channel.getChannelData().getParent());
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "getRunningChannels");
        }
        return list.toArray(new ChannelData[list.size()]);
    }
521368
public Set<String> getBundleCodes(Locale locale,String...basenames){
		List<String> validBaseNames = getValidBasenames(basenames);
		
		Set<String> codes = new HashSet<>();
		for(String basename: validBaseNames){
			List<Pair<String, Resource>> filenamesAndResources = calculateAllFilenames(basename,locale);
			for (Pair<String, Resource> filenameAndResource : filenamesAndResources) {
				if(filenameAndResource.getbValue() != null) {
					PropertiesHolder propHolder = getProperties(filenameAndResource.getaValue(), filenameAndResource.getbValue());
					codes.addAll(propHolder.getProperties().stringPropertyNames());					
				}
			}
		}
		return codes;
	}
548884
public static File[] getFilesListByExtention( String folderPath, final String ext ) {
        File[] files = new File(folderPath).listFiles(new FilenameFilter(){
            public boolean accept( File dir, String name ) {
                return name.endsWith(ext);
            }
        });
        return files;
    }
1151028
@Override
  public final FctBnEntitiesProcessors<RS>
    lazyGetFctBnEntitiesProcessors() throws Exception {
    String beanName = getFctBnEntitiesProcessorsName();
    @SuppressWarnings("unchecked")
    FctBnEntitiesProcessors<RS> fctBnEntitiesProcessors =
      (FctBnEntitiesProcessors<RS>)
        this.factoryAppBeans.getBeansMap().get(beanName);
    if (fctBnEntitiesProcessors == null) {
      fctBnEntitiesProcessors = new FctBnEntitiesProcessors<RS>();
      fctBnEntitiesProcessors.setSrvOrm(this.factoryAppBeans.lazyGetSrvOrm());
      fctBnEntitiesProcessors
        .setMngUvdSettings(this.factoryAppBeans.lazyGetMngUvdSettings());
      fctBnEntitiesProcessors
        .setEntitiesFactoriesFatory(lazyGetFctBcFctSimpleEntities());
      fctBnEntitiesProcessors.setFillersFieldsFactory(
        this.factoryAppBeans.lazyGetFctFillersObjectFields());
      fctBnEntitiesProcessors.setUtlProperties(
        this.factoryAppBeans.lazyGetUtlProperties());
      fctBnEntitiesProcessors.setSrvDate(this.factoryAppBeans.lazyGetSrvDate());
      fctBnEntitiesProcessors.setFieldConverterNamesHolder(
        this.factoryAppBeans.lazyGetHldFieldsCnvTfsNames());
      fctBnEntitiesProcessors.setConvertersFieldsFatory(
        this.factoryAppBeans.lazyGetFctConvertersToFromString());
      fctBnEntitiesProcessors.setGettersRapiHolder(
        this.factoryAppBeans.lazyGetHolderRapiGetters());
      fctBnEntitiesProcessors.setSettersRapiHolder(
        this.factoryAppBeans.lazyGetHolderRapiSetters());
      fctBnEntitiesProcessors
        .setUploadDirectory(this.factoryAppBeans.getUploadDirectory());
      fctBnEntitiesProcessors
        .setWebAppPath(this.factoryAppBeans.getWebAppPath());
      fctBnEntitiesProcessors
        .setEmailSender(this.factoryAppBeans.lazyGetMailSender());
      this.factoryAppBeans.getBeansMap().put(beanName, fctBnEntitiesProcessors);
    }
    return fctBnEntitiesProcessors;
  }
510397
protected Map<MarshallerType, AbstractType> getDefaultMarshallers(CfDef cfDef) throws IOException
    {
        Map<MarshallerType, AbstractType> marshallers = new EnumMap<MarshallerType, AbstractType>(MarshallerType.class);
        AbstractType comparator;
        AbstractType subcomparator;
        AbstractType default_validator;
        AbstractType key_validator;

        comparator = parseType(cfDef.getComparator_type());
        subcomparator = parseType(cfDef.getSubcomparator_type());
        default_validator = parseType(cfDef.getDefault_validation_class());
        key_validator = parseType(cfDef.getKey_validation_class());

        marshallers.put(MarshallerType.COMPARATOR, comparator);
        marshallers.put(MarshallerType.DEFAULT_VALIDATOR, default_validator);
        marshallers.put(MarshallerType.KEY_VALIDATOR, key_validator);
        marshallers.put(MarshallerType.SUBCOMPARATOR, subcomparator);
        return marshallers;
    }
809497
public final FctBcCnvEntityToColumnsValues
    lazyGetFctBcCnvEntityToColumnsValues() throws Exception {
    String beanName = getFctBcCnvEntityToColumnsValuesName();
    FctBcCnvEntityToColumnsValues fctBcCnvEntityToColumnsValues =
      (FctBcCnvEntityToColumnsValues) this.beansMap.get(beanName);
    if (fctBcCnvEntityToColumnsValues == null) {
      fctBcCnvEntityToColumnsValues = new FctBcCnvEntityToColumnsValues();
      fctBcCnvEntityToColumnsValues.setLogger(lazyGetLogger());
      fctBcCnvEntityToColumnsValues
        .setFieldsConvertersFatory(lazyGetFctBnCnvIbnToColumnValues());
      fctBcCnvEntityToColumnsValues
        .setFieldsConvertersNamesHolder(lazyGetHldCnvToColumnsValuesNames());
      fctBcCnvEntityToColumnsValues
        .setFieldsRapiHolder(lazyGetHolderRapiFields());
      fctBcCnvEntityToColumnsValues
        .setGettersRapiHolder(lazyGetHolderRapiGetters());
      this.beansMap.put(beanName, fctBcCnvEntityToColumnsValues);
      lazyGetLogger().info(null, AFactoryAppBeans.class, beanName
        + " has been created.");
    }
    return fctBcCnvEntityToColumnsValues;
  }
1301331
private static List<String> loadFactories(Map<String, String[]> factories) {
        final boolean bTrace = TraceComponent.isAnyTracingEnabled();
        final ChannelFramework cf = ChannelFrameworkFactory.getChannelFramework();
        List<String> createdFactories = new ArrayList<String>(factories.size());

        String key, value;
        for (Entry<String, String[]> entry : factories.entrySet()) {
            Class<?> factoryType = cf.lookupFactory(entry.getKey());
            if (null == factoryType) {
                if (bTrace && tc.isEventEnabled()) {
                    Tr.event(tc, "Delay; missing factory type " + entry.getKey());
                }
                delayedConfig.put(FACTORY_PREFIX + entry.getKey(), entry.getValue());
                createdFactories.add(entry.getKey());
                continue;
            }
            String[] props = entry.getValue();
            for (int i = 0; i < props.length; i++) {
                key = extractKey(props[i]);
                value = extractValue(props[i]);
                if (null != key && null != value) {
                    try {
                        cf.updateChannelFactoryProperty(factoryType, key, value);
                    } catch (ChannelFactoryException e) {
                        FFDCFilter.processException(e, "ChannelUtils.loadFactories",
                                                    "update", new Object[] { entry, cf });
                        if (bTrace && tc.isEventEnabled()) {
                            Tr.event(tc, "Unable to update factory prop; "
                                         + factoryType + " " + key + "=" + value);
                        }
                    }
                }
            }
            try {
                // Note: this is a find or create api, not just "get"
                cf.getChannelFactory(factoryType);
                createdFactories.add(entry.getKey());
            } catch (ChannelFactoryException e) {
                // ignore it
            }
        } // end-factories

        return createdFactories;
    }
439888
private List<String> getFedoraTables() {
        try {
            InputStream in =
                    getClass().getClassLoader()
                            .getResourceAsStream(DBSPEC_LOCATION);
            List<TableSpec> specs = TableSpec.getTableSpecs(in);
            ArrayList<String> names = new ArrayList<String>();
            for (TableSpec spec: specs) {
                names.add(spec.getName().toUpperCase());
            }
            return names;
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("Unexpected error reading dbspec file",
                                       e);
        }
    }
211718
public final <T extends Freezable> T get(Class<T> fc) {
    T pojo = getFreezable();
    assert fc.isAssignableFrom(pojo.getClass());
    return pojo;
  }
903014
@Override
    public int capacity() {
        if (isFCEnabled()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "FileChannel capacity: " + this.fcSize);
            }
            return this.fcSize;
        }
        return super.capacity();
    }
627084
public List<Long> searchBigFile(File f, byte[] searchBytes) {
		return searchBigFile(f, searchBytes, null);
	}
1131543
def dbus_readBytesTwoFDs(self, fd1, fd2, byte_count):
        
        result = bytearray()
        for fd in (fd1, fd2):
            f = os.fdopen(fd, 'rb')
            result.extend(f.read(byte_count))
            f.close()
        return result
885001
public void appendToFsb(org.apache.xml.utils.FastStringBuffer fsb)
  {
    XString xstring = (XString)xstr();
    xstring.appendToFsb(fsb);
  }
257368
public Expression string(Factory f, SourceCode cfml) throws TemplateException {
	cfml.removeSpace();
	char quoter = cfml.getCurrentLower();
	if (quoter != '"' && quoter != '\'') return null;
	StringBuffer str = new StringBuffer();
	boolean insideSpecial = false;

	Position line = cfml.getPosition();
	while (cfml.hasNext()) {
	    cfml.next();
	    // check special
	    if (cfml.isCurrent(specialChar)) {
		insideSpecial = !insideSpecial;
		str.append(specialChar);

	    }
	    // check quoter
	    else if (!insideSpecial && cfml.isCurrent(quoter)) {
		// Ecaped sharp
		if (cfml.isNext(quoter)) {
		    cfml.next();
		    str.append(quoter);
		}
		// finsish
		else {
		    break;
		}
	    }
	    // all other character
	    else {
		str.append(cfml.getCurrent());
	    }
	}

	if (!cfml.forwardIfCurrent(quoter)) throw new TemplateException(cfml, "Invalid Syntax Closing [" + quoter + "] not found");

	LitString rtn = f.createLitString(str.toString(), line, cfml.getPosition());
	cfml.removeSpace();
	return rtn;
    }
1094477
public FileChannel getChannel() {
        synchronized (this) {
            if (channel == null) {
                channel = NioUtils.newFileChannel(this, fd, O_RDONLY);
            }
            return channel;
        }
    }
696703
public String getDfsPath () throws SmbException {
        try {
            String path = this.treeConnection.ensureDFSResolved(this.fileLocator).getDfsPath();
            if ( path != null && isDirectory() ) {
                path += '/';
            }
            return path;
        }
        catch ( CIFSException e ) {
            throw SmbException.wrap(e);
        }
    }