java.util.Hashtable Java Examples

The following examples show how to use java.util.Hashtable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PropertyChangeSupport.java    From openjdk-8 with GNU General Public License v2.0 7 votes vote down vote up
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
    this.map = new PropertyChangeListenerMap();

    ObjectInputStream.GetField fields = s.readFields();

    @SuppressWarnings("unchecked")
    Hashtable<String, PropertyChangeSupport> children = (Hashtable<String, PropertyChangeSupport>) fields.get("children", null);
    this.source = fields.get("source", null);
    fields.get("propertyChangeSupportSerializedDataVersion", 2);

    Object listenerOrNull;
    while (null != (listenerOrNull = s.readObject())) {
        this.map.add(null, (PropertyChangeListener)listenerOrNull);
    }
    if (children != null) {
        for (Entry<String, PropertyChangeSupport> entry : children.entrySet()) {
            for (PropertyChangeListener listener : entry.getValue().getPropertyChangeListeners()) {
                this.map.add(entry.getKey(), listener);
            }
        }
    }
}
 
Example #2
Source File: SnmpRequestHandler.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Full constructor
 */
public SnmpRequestHandler(SnmpAdaptorServer server, int id,
                          DatagramSocket s, DatagramPacket p,
                          SnmpMibTree tree, Vector<SnmpMibAgent> m,
                          InetAddressAcl a,
                          SnmpPduFactory factory,
                          SnmpUserDataFactory dataFactory,
                          MBeanServer f, ObjectName n)
{
    super(server, id, f, n);

    // Need a reference on SnmpAdaptorServer for getNext & getBulk,
    // in case of oid equality (mib overlapping).
    //
    adaptor = server;
    socket = s;
    packet = p;
    root= tree;
    mibs = new Vector<>(m);
    subs= new Hashtable<>(mibs.size());
    ipacl = a;
    pduFactory = factory ;
    userDataFactory = dataFactory ;
    //thread.start();
}
 
Example #3
Source File: PartialCompositeDirContext.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public DirContext createSubcontext(Name name, Attributes attrs)
        throws NamingException {
    PartialCompositeDirContext ctx = this;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);
    DirContext answer;
    Name nm = name;

    try {
        answer = ctx.p_createSubcontext(nm, attrs, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCDirContext(cont);
            answer = ctx.p_createSubcontext(nm, attrs, cont);
        }
    } catch (CannotProceedException e) {
        DirContext cctx = DirectoryManager.getContinuationDirContext(e);
        answer = cctx.createSubcontext(e.getRemainingName(), attrs);
    }
    return answer;
}
 
Example #4
Source File: rmiURLContextFactory.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static Object getUsingURLs(String[] urls, Hashtable<?,?> env)
        throws NamingException
{
    if (urls.length == 0) {
        throw (new ConfigurationException(
                "rmiURLContextFactory: empty URL array"));
    }
    rmiURLContext urlCtx = new rmiURLContext(env);
    try {
        NamingException ne = null;
        for (int i = 0; i < urls.length; i++) {
            try {
                return urlCtx.lookup(urls[i]);
            } catch (NamingException e) {
                ne = e;
            }
        }
        throw ne;
    } finally {
        urlCtx.close();
    }
}
 
Example #5
Source File: SignatureFileVerifier.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * process the signature block file. Goes through the .SF file
 * and adds code signers for each section where the .SF section
 * hash was verified against the Manifest section.
 *
 *
 */
public void process(Hashtable<String, CodeSigner[]> signers,
        List<Object> manifestDigests)
    throws IOException, SignatureException, NoSuchAlgorithmException,
        JarException, CertificateException
{
    // calls Signature.getInstance() and MessageDigest.getInstance()
    // need to use local providers here, see Providers class
    Object obj = null;
    try {
        obj = Providers.startJarVerification();
        processImpl(signers, manifestDigests);
    } finally {
        Providers.stopJarVerification(obj);
    }

}
 
Example #6
Source File: IDLGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write an IDL interface definition for a Java implementation class
 * @param t The current ImplementationType
 * @param p The output stream.
 */
protected void writeImplementation(
                                   ImplementationType t,
                                   IndentingWriter p )
    throws IOException {
    Hashtable inhHash = new Hashtable();
    Hashtable refHash = new Hashtable();
    getInterfaces( t,inhHash );                            //collect interfaces

    writeBanner( t,0,!isException,p );
    writeInheritedIncludes( inhHash,p );
    writeIfndef( t,0,!isException,!isForward,p );
    writeIncOrb( p );
    writeModule1( t,p );
    p.pln();p.pI();
    p.p( "interface " + t.getIDLName() );
    writeInherits( inhHash,!forValuetype,p );

    p.pln( " {" );
    p.pln( "};" );

    p.pO();p.pln();
    writeModule2( t,p );
    writeEpilog( t,refHash,p );
}
 
Example #7
Source File: PartialCompositeDirContext.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public NamingEnumeration<SearchResult>
    search(Name name,
           String filter,
           SearchControls cons)
    throws NamingException
{

    PartialCompositeDirContext ctx = this;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);
    NamingEnumeration<SearchResult> answer;
    Name nm = name;

    try {
        answer = ctx.p_search(nm, filter, cons, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCDirContext(cont);
            answer = ctx.p_search(nm, filter, cons, cont);
        }
    } catch (CannotProceedException e) {
        DirContext cctx = DirectoryManager.getContinuationDirContext(e);
        answer = cctx.search(e.getRemainingName(), filter, cons);
    }
    return answer;
}
 
Example #8
Source File: CardLayout.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes serializable fields to stream.
 */
private void writeObject(ObjectOutputStream s)
    throws IOException
{
    Hashtable<String, Component> tab = new Hashtable<>();
    int ncomponents = vector.size();
    for (int i = 0; i < ncomponents; i++) {
        Card card = (Card)vector.get(i);
        tab.put(card.name, card.comp);
    }

    ObjectOutputStream.PutField f = s.putFields();
    f.put("hgap", hgap);
    f.put("vgap", vgap);
    f.put("vector", vector);
    f.put("currentCard", currentCard);
    f.put("tab", tab);
    s.writeFields();
}
 
Example #9
Source File: ldapURLContextFactory.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
static ResolveResult getUsingURLIgnoreRootDN(String url, Hashtable<?,?> env)
        throws NamingException {
    LdapURL ldapUrl = new LdapURL(url);
    DirContext ctx = new LdapCtx("", ldapUrl.getHost(), ldapUrl.getPort(),
        env, ldapUrl.useSsl());
    String dn = (ldapUrl.getDN() != null ? ldapUrl.getDN() : "");

    // Represent DN as empty or single-component composite name.
    CompositeName remaining = new CompositeName();
    if (!"".equals(dn)) {
        // if nonempty, add component
        remaining.add(dn);
    }

    return new ResolveResult(ctx, remaining);
}
 
Example #10
Source File: NamingManager.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static Context getURLContext(
        String scheme, Hashtable<?,?> environment)
        throws NamingException {
    return new DnsContext("", null, new Hashtable<String,String>()) {
        public Attributes getAttributes(String name, String[] attrIds)
                throws NamingException {
            return new BasicAttributes() {
                public Attribute get(String attrID) {
                    BasicAttribute ba  = new BasicAttribute(attrID);
                    ba.add("1 1 99 b.com.");
                    ba.add("0 0 88 a.com.");    // 2nd has higher priority
                    return ba;
                }
            };
        }
    };
}
 
Example #11
Source File: LdapProtocol.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public final void connect( String username, String password ) throws KettleException {
  Hashtable<String, String> env = new Hashtable<String, String>();
  setupEnvironment( env, username, password );
  try {
    /* Establish LDAP association */
    doConnect( username, password );

    if ( log.isBasic() ) {
      log.logBasic( BaseMessages.getString( PKG, "LDAPInput.Log.ConnectedToServer", hostname, Const.NVL(
        username, "" ) ) );
    }
    if ( log.isDetailed() ) {
      log.logDetailed( BaseMessages.getString( PKG, "LDAPInput.ClassUsed.Message", ctx.getClass().getName() ) );
    }

  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString( PKG, "LDAPinput.Exception.ErrorConnecting", e
      .getMessage() ), e );
  }
}
 
Example #12
Source File: JmsInitialContextFactoryTest.java    From qpid-jms with Apache License 2.0 6 votes vote down vote up
@Test
public void testConnectionFactoryBindingWithInvalidFactorySpecificProperty() throws Exception {
    String factoryName = "myNewFactory";
    String uri = "amqp://example.com:1234";

    String propertyPrefix = JmsInitialContextFactory.CONNECTION_FACTORY_PROPERTY_KEY_PREFIX;

    Hashtable<Object, Object> env = new Hashtable<Object, Object>();
    env.put(JmsInitialContextFactory.CONNECTION_FACTORY_KEY_PREFIX + factoryName, uri);
    env.put(propertyPrefix + factoryName + "." + "invalidProperty", "value");

    try {
        createInitialContext(env);
        fail("Should have thrown exception");
    } catch (NamingException ne) {
        // Expected
        assertTrue("Should have had a cause", ne.getCause() != null);
    }
}
 
Example #13
Source File: WhileStatement.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check a while statement
 */
Vset check(Environment env, Context ctx, Vset vset, Hashtable exp) {
    checkLabel(env, ctx);
    CheckContext newctx = new CheckContext(ctx, this);
    // remember what was unassigned on entry
    Vset vsEntry = vset.copy();
    // check the condition.  Determine which variables have values if
    // it returns true or false.
    ConditionVars cvars =
          cond.checkCondition(env, newctx, reach(env, vset), exp);
    cond = convert(env, newctx, Type.tBoolean, cond);
    // check the body, given that the condition returned true.
    vset = body.check(env, newctx, cvars.vsTrue, exp);
    vset = vset.join(newctx.vsContinue);
    // make sure the back-branch fits the entry of the loop
    ctx.checkBackBranch(env, this, vsEntry, vset);
    // Exit the while loop by testing false or getting a break statement
    vset = newctx.vsBreak.join(cvars.vsFalse);
    return ctx.removeAdditionalVars(vset);
}
 
Example #14
Source File: ReadWriteProfileTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static void getProfileTags(byte [] data, Hashtable tags) {
    ByteBuffer byteBuf = ByteBuffer.wrap(data);
    IntBuffer intBuf = byteBuf.asIntBuffer();
    int tagCount = intBuf.get(TAG_COUNT_OFFSET);
    intBuf.position(TAG_ELEM_OFFSET);
    for (int i = 0; i < tagCount; i++) {
        int tagSig = intBuf.get();
        int tagDataOff = intBuf.get();
        int tagSize = intBuf.get();

        byte [] tagData = new byte[tagSize];
        byteBuf.position(tagDataOff);
        byteBuf.get(tagData);
        tags.put(tagSig, tagData);
    }
}
 
Example #15
Source File: MonitorServlet.java    From yawl with GNU Lesser General Public License v3.0 6 votes vote down vote up
/** Read settings from web.xml and use them to initialise the service */
public void init() {
    try {
        ServletContext context = getServletContext();

        // load the urls of the required interfaces
        Map<String, String> urlMap = new Hashtable<String, String>();
        String engineGateway = context.getInitParameter("EngineGateway");
        if (engineGateway != null) urlMap.put("engineGateway", engineGateway);
        String engineLogGateway = context.getInitParameter("EngineLogGateway");
        if (engineGateway != null) urlMap.put("engineLogGateway", engineLogGateway);
        String resourceGateway = context.getInitParameter("ResourceGateway");
        if (engineGateway != null) urlMap.put("resourceGateway", resourceGateway);
        String resourceLogGateway = context.getInitParameter("ResourceLogGateway");
        if (resourceLogGateway != null) urlMap.put("resourceLogGateway", resourceLogGateway);

        MonitorClient.getInstance().initInterfaces(urlMap); 
    }
    catch (Exception e) {
        LogManager.getLogger(this.getClass()).error("Monitor Service Initialisation Exception", e);
    }
}
 
Example #16
Source File: ShowResponseTest.java    From sdl_java_suite with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
   * Tests a valid JSON construction of this RPC message.
   */
  public void testJsonConstructor () {
  	JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
  	assertNotNull(Test.NOT_NULL, commandJson);
  	
try {
	Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
	ShowResponse cmd = new ShowResponse(hash);
	
	JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
	assertNotNull(Test.NOT_NULL, body);
	
	// Test everything in the json body.
	assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
	assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
} catch (JSONException e) {
	e.printStackTrace();
}    	
  }
 
Example #17
Source File: PartialCompositeContext.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Context createSubcontext(Name name) throws NamingException {
    PartialCompositeContext ctx = this;
    Name nm = name;
    Context answer;
    Hashtable<?,?> env = p_getEnvironment();
    Continuation cont = new Continuation(name, env);

    try {
        answer = ctx.p_createSubcontext(nm, cont);
        while (cont.isContinue()) {
            nm = cont.getRemainingName();
            ctx = getPCContext(cont);
            answer = ctx.p_createSubcontext(nm, cont);
        }
    } catch (CannotProceedException e) {
        Context cctx = NamingManager.getContinuationContext(e);
        answer = cctx.createSubcontext(e.getRemainingName());
    }
    return answer;
}
 
Example #18
Source File: StringTool.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static void dumpHashtable(final Log log, final Hashtable table){
	Set<String> keys = table.keySet();
	log.log("Dump Hashtable\n", Log.INFOS);
	for (String key : keys) {
		log.log(key + ": " + table.get(key).toString(), Log.INFOS);
	}
	log.log("End dump\n", Log.INFOS);
}
 
Example #19
Source File: ChoiceOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns information about component.
 */
@Override
public Hashtable<String, Object> getDump() {
    Hashtable<String, Object> result = super.getDump();
    if (((Choice) getSource()).getSelectedItem() != null) {
        result.put(SELECTED_ITEM_DPROP, ((Choice) getSource()).getSelectedItem());
    }
    String[] items = new String[((Choice) getSource()).getItemCount()];
    for (int i = 0; i < ((Choice) getSource()).getItemCount(); i++) {
        items[i] = ((Choice) getSource()).getItem(i);
    }
    addToDump(result, ITEM_PREFIX_DPROP, items);
    return result;
}
 
Example #20
Source File: MethodGen24.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023> Write the methodEntry for a valuetype factory method into
 *          the Value Helper class. Contents from email from Simon,
 *          4/25/99.
 **/
protected void helperFactoryMethod (Hashtable symbolTable, MethodEntry m, SymtabEntry t, PrintWriter stream)
{
  this.symbolTable = symbolTable;
  this.m = m;
  this.stream = stream;
  String initializerName = m.name ();
  String typeName = Util.javaName (t);
  String factoryName = typeName + "ValueFactory";

  // Step 1. Print factory method decl up to parms.
  stream.print  ("  public static " + typeName + " " + initializerName +
          " (org.omg.CORBA.ORB $orb");
  if (!m.parameters ().isEmpty ())
    stream.print (", "); // <d62794>

  // Step 2. Print the declaration parameter list.
  writeParmList (m, true, stream);

  // Step 3. Print the body of the factory method
  stream.println (")");
  stream.println ("  {");
  stream.println ("    try {");
  stream.println ("      " + factoryName + " $factory = (" + factoryName + ")");
  stream.println ("          ((org.omg.CORBA_2_3.ORB) $orb).lookup_value_factory(id());");
  stream.print   ("      return $factory." + initializerName + " (");
  writeParmList (m, false, stream);
  stream.println (");");
  stream.println ("    } catch (ClassCastException $ex) {");
  stream.println ("      throw new org.omg.CORBA.BAD_PARAM ();");
  stream.println ("    }");
  stream.println ("  }");
  stream.println ();
}
 
Example #21
Source File: TransSplitter.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void verifySlavePartitioningConfiguration( TransMeta slave, StepMeta stepMeta,
  ClusterSchema clusterSchema, SlaveServer slaveServer ) {
  Map<StepMeta, String> stepPartitionFlag = slaveStepPartitionFlag.get( slave );
  if ( stepPartitionFlag == null ) {
    stepPartitionFlag = new Hashtable<StepMeta, String>();
    slaveStepPartitionFlag.put( slave, stepPartitionFlag );
  }
  if ( stepPartitionFlag.get( stepMeta ) != null ) {
    return; // already done;
  }

  StepPartitioningMeta partitioningMeta = stepMeta.getStepPartitioningMeta();
  if ( partitioningMeta != null
    && partitioningMeta.getMethodType() != StepPartitioningMeta.PARTITIONING_METHOD_NONE
    && partitioningMeta.getPartitionSchema() != null ) {
    // Find the schemaPartitions map to use
    Map<PartitionSchema, List<String>> schemaPartitionsMap = slaveServerPartitionsMap.get( slaveServer );
    if ( schemaPartitionsMap != null ) {
      PartitionSchema partitionSchema = partitioningMeta.getPartitionSchema();
      List<String> partitionsList = schemaPartitionsMap.get( partitionSchema );
      if ( partitionsList != null ) {
        // We found a list of partitions, now let's create a new partition schema with this data.
        String targetSchemaName = createSlavePartitionSchemaName( partitionSchema.getName() );
        PartitionSchema targetSchema = slave.findPartitionSchema( targetSchemaName );
        if ( targetSchema == null ) {
          targetSchema = new PartitionSchema( targetSchemaName, partitionsList );
          slave.getPartitionSchemas().add( targetSchema ); // add it to the slave if it doesn't exist.
        }
      }
    }
  }

  stepPartitionFlag.put( stepMeta, "Y" ); // is done.
}
 
Example #22
Source File: ResourceManager.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void mergeTables(Hashtable<? super String, Object> props1,
                                Hashtable<? super String, Object> props2) {
    for (Object key : props2.keySet()) {
        String prop = (String)key;
        Object val1 = props1.get(prop);
        if (val1 == null) {
            props1.put(prop, props2.get(prop));
        } else if (isListProperty(prop)) {
            String val2 = (String)props2.get(prop);
            props1.put(prop, ((String)val1) + ":" + val2);
        }
    }
}
 
Example #23
Source File: APIVersion.java    From apidiff with MIT License 5 votes vote down vote up
public void parse(String str, File source, final Boolean ignoreTreeDiff) throws IOException {
		
		if(this.mapModifications.size() > 0 && !this.isFileModification(source,ignoreTreeDiff)){
			return;
		}
		ASTParser parser = ASTParser.newParser(AST.JLS8);
		parser.setSource(str.toCharArray());
		parser.setKind(ASTParser.K_COMPILATION_UNIT);
		String[] classpath = java.lang.System.getProperty("java.class.path").split(";");
		String[] sources = { source.getParentFile().getAbsolutePath() };

		Hashtable<String, String> options = JavaCore.getOptions();
		options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8);
		options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8);
		options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8);
		parser.setUnitName(source.getAbsolutePath());

		parser.setCompilerOptions(options);
//		parser.setEnvironment(null, sources, new String[] { "UTF-8" },	true);
		parser.setResolveBindings(true);
		parser.setBindingsRecovery(true);

//		parser.setEnvironment(classpath, sources, new String[] { "UTF-8" },	true);
//		CompilationUnit compilationUnit = null;
		try {
			parser.setEnvironment(null, null, null,	true);
			CompilationUnit compilationUnit = (CompilationUnit) parser.createAST(null);
			TypeDeclarationVisitor visitorType = new TypeDeclarationVisitor();
			EnumDeclarationVisitor visitorEnum = new EnumDeclarationVisitor();
			
			compilationUnit.accept(visitorType);
			compilationUnit.accept(visitorEnum);
			
			this.configureAcessiblesAndNonAccessibleTypes(visitorType);
			this.configureAcessiblesAndNonAccessibleEnums(visitorEnum);
		} catch (Exception e) {
			this.logger.error("Erro ao criar AST sem source", e);
		}

	}
 
Example #24
Source File: Config.java    From knopflerfish.org with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
void register()
{
  if (reg != null) {
    return;
  }

  final Dictionary<String, Object> props = new Hashtable<String, Object>();
  props.put("service.pid", PID);

  reg = Activator.bc.registerService(ManagedService.class, this, props);

}
 
Example #25
Source File: Session.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Session constructor
 * 
 * @param connNum		connection number
 * @param clientSocket	communications socket for this session
 * @param traceDirectory	location for trace files
 * @param traceOn		whether to start tracing this connection
 *
 * @exception throws IOException
 */
Session (NetworkServerControlImpl nsctrl, int connNum, Socket clientSocket, String traceDirectory,
		boolean traceOn) throws Exception
{
       this.nsctrl = nsctrl;
	this.connNum = connNum;
	this.clientSocket = clientSocket;
	this.traceOn = traceOn;
	if (traceOn)
		dssTrace = new DssTrace(); 
	dbtable = new Hashtable();
	initialize(traceDirectory);
}
 
Example #26
Source File: MimeTypeParameterList.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
* @return a clone of this object
*/

public Object clone() {
    MimeTypeParameterList newObj = null;
    try {
        newObj = (MimeTypeParameterList)super.clone();
    } catch (CloneNotSupportedException cannotHappen) {
    }
    newObj.parameters = (Hashtable)parameters.clone();
    return newObj;
}
 
Example #27
Source File: UIManager.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds the given theme properties on top of the existing properties without
 * clearing the existing theme first
 *
 * @param themeProps the properties of the given theme
 */
public void addThemeProps(Hashtable themeProps) {
    if (accessible) {
        buildTheme(themeProps);
        styles.clear();
        selectedStyles.clear();
        imageCache.clear();
        current.refreshTheme(false);
    }
}
 
Example #28
Source File: HashtableTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * java.util.Hashtable#equals(java.lang.Object)
 */
public void test_equalsLjava_lang_Object() {
    // Test for method boolean java.util.Hashtable.equals(java.lang.Object)
    Hashtable h = hashtableClone(ht10);
    assertTrue("Returned false for equal tables", ht10.equals(h));
    assertTrue("Returned true for unequal tables", !ht10.equals(htfull));
}
 
Example #29
Source File: DecodeThread.java    From react-native-smart-barcode with MIT License 5 votes vote down vote up
DecodeThread(CaptureView captureView,
               Vector<BarcodeFormat> decodeFormats,
               String characterSet,
               ResultPointCallback resultPointCallback) {
//    Log.i("Test", "DecodeThread create");
    this.captureView = captureView;
    handlerInitLatch = new CountDownLatch(1);//从1开始到计数

    hints = new Hashtable<DecodeHintType, Object>(3);

//    // The prefs can't change while the thread is running, so pick them up once here.
//    if (decodeFormats == null || decodeFormats.isEmpty()) {
//      SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
//      decodeFormats = new Vector<BarcodeFormat>();
//      if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_1D, true)) {
//        decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
//      }
//      if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_QR, true)) {
//        decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
//      }
//      if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_DATA_MATRIX, true)) {
//        decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
//      }
//    }
    if (decodeFormats == null || decodeFormats.isEmpty()) {
    	 decodeFormats = new Vector<BarcodeFormat>();
    	 decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
    	 decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
    	 decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
    	 
    }
    
    hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

    if (characterSet != null) {
      hints.put(DecodeHintType.CHARACTER_SET, characterSet);
    }

    hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
  }
 
Example #30
Source File: CryptoPermissions.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void writeObject(ObjectOutputStream s) throws IOException {
    Hashtable<String,PermissionCollection> permTable =
            new Hashtable<>(perms);
    ObjectOutputStream.PutField fields = s.putFields();
    fields.put("perms", permTable);
    s.writeFields();
}