/** Prepares the class for cleanup. */
  public void finalize() {

    if (setTable != null) {
      setTable.clear();
    }

    setTable = null;
    matrix = null;
    investigators = null;
    invest = null;

    if (VOIs != null) {
      VOIs.clear();
    }

    VOIs = null;

    if (surfaces != null) {
      surfaces.clear();
    }

    surfaces = null;

    // if (thumbnail != null) {
    //
    // }
    super.finalize();
  }
  public int doTObj(int depth, CM_SRC cm_src, TObj tobj, long parent_object_id) {
    /*		if(System.getenv("CPSERVER") == null) {
    	return RETURN_CONTINUE;
    }*/
    if (depth == 0) {

      filestr = cm_src.getSNAME();
      fileext = "c"; // default .c
      int idx = filestr.indexOf('.');
      if (idx > 0) {
        filestr = filestr.substring(0, idx);
        fileext = cm_src.getSNAME().substring(idx + 1, cm_src.getSNAME().length());
      }
      log.debug("filestr ", filestr);
      log.debug("fileext ", fileext);

      mainflag = false;
      if (hfunname == null) hfunname = new Hashtable();
      else hfunname.clear();

      submainflag = false;
      if (hsubmainname == null) hsubmainname = new Hashtable();
      else hsubmainname.clear();

      if (hStaticfun == null) hStaticfun = new Hashtable();
      else hStaticfun.clear();

      CheckObjList(cm_src, tobj);
      CheckDPDList(tobj);
    }
    return RETURN_CONTINUE;
  }
 //
 // PRIVATE METHODS
 //
 private void init() {
   live();
   result.clear();
   H.clear();
   s = null;
   a = null;
 }
  synchronized Hashtable getProperties() {
    if ((props == null) && (text != null)) {
      Hashtable props = new Hashtable();
      int off = 0;
      while (off < text.length) {
        // length of the next key value pair
        int len = text[off++] & 0xFF;
        if ((len == 0) || (off + len > text.length)) {
          props.clear();
          break;
        }
        // look for the '='
        int i = 0;
        for (; (i < len) && (text[off + i] != '='); i++) {;
        }

        // get the property name
        String name = readUTF(text, off, i);
        if (name == null) {
          props.clear();
          break;
        }
        if (i == len) {
          props.put(name, NO_VALUE);
        } else {
          byte value[] = new byte[len - ++i];
          System.arraycopy(text, off + i, value, 0, len - i);
          props.put(name, value);
          off += len;
        }
      }
      this.props = props;
    }
    return props;
  }
    /**
     * Construct a connection to the specified url. A cache of
     * HTTPConnections is used to maximize the reuse of these across
     * multiple HttpURLConnections.
     *
     * <BR>The default method is "GET".
     *
     * @param url the url of the request
     * @exception ProtocolNotSuppException if the protocol is not supported
     */
    public HttpURLConnection(URL url)
	    throws ProtocolNotSuppException, IOException
    {
	super(url);

	// first read proxy properties and set
        try
        {
            String hosts = System.getProperty("http.nonProxyHosts", "");
	    if (!hosts.equalsIgnoreCase(non_proxy_hosts))
	    {
		connections.clear();
		non_proxy_hosts = hosts;
		String[] list = Util.splitProperty(hosts);
		for (int idx=0; idx<list.length; idx++)
		    HTTPConnection.dontProxyFor(list[idx]);
	    }
        }
        catch (ParseException pe)
	    { throw new IOException(pe.toString()); }
        catch (SecurityException se)
            { }

	try
	{
	    String host = System.getProperty("http.proxyHost", "");
	    int port = Integer.getInteger("http.proxyPort", -1).intValue();
	    if (!host.equalsIgnoreCase(proxy_host)  ||  port != proxy_port)
	    {
		connections.clear();
		proxy_host = host;
		proxy_port = port;
		HTTPConnection.setProxyServer(host, port);
	    }
	}
	catch (SecurityException se)
	    { }

	// now setup stuff
	con           = getConnection(url);
	method        = "GET";
	method_set    = false;
	resource      = url.getFile();
	headers       = default_headers;
	do_redir      = getFollowRedirects();
	output_stream = null;

	urlString     = url.toString();
    }
  // MB: 7th April 2005 - NOT USED ANYMORE. LEFT FOR A WHILE IN CASE NEED TO RETURN IT.
  private void loadAccessDatabases() {

    htDatabases.clear();

    BufferedReader reader = null;
    try {
      reader = new BufferedReader(new FileReader(file));
    } catch (FileNotFoundException e) {
      return;
    }

    try {
      while (reader.ready()) {
        String line = reader.readLine();
        if (line == null) {
          break;
        }
        if (line.startsWith("DB")) {
          String dbinfo = line.substring(line.indexOf((int) '=') + 1);

          int index = dbinfo.lastIndexOf((int) '\\');
          String odbcname = dbinfo.substring(index + 1, dbinfo.indexOf((int) ','));
          String display = (dbinfo.substring(line.indexOf((int) ',') - 1)).trim();

          htDatabases.put(display, odbcname);
        }
      }
      reader.close();
    } catch (IOException e) {
    }
  }
Exemple #7
0
  public void initialize() {
    try {
      if (appContext == null) {
        appContext = new ClassPathXmlApplicationContext(DLRConstants.appContextPath);
      }

      schema = getSchema();
      schema = schema + ".";

      jdbcTemplate = (JdbcTemplate) appContext.getBean("jdbcTemplate");

      // Use connection to run query because it is faster and use less
      // memory than JdbcTemplate.queryForList()
      con1 = jdbcTemplate.getDataSource().getConnection();

      ht.clear();
      ht.put("01", "JR.  ");
      ht.put("02", "SR.  ");
      ht.put("03", "II   ");
      ht.put("04", "III  ");
      ht.put("05", "IV   ");
      ht.put("06", "V    ");
      ht.put("07", "VI   ");
      ht.put("08", "VII  ");
      ht.put("09", "VIII ");
      ht.put("10", "IX   ");
    } catch (Exception e) {
      logger.error("Exception during initialize()", e);
      System.out.println(e);
      rc = false;
    }
  }
Exemple #8
0
  private void cleanUp() {
    try {
      if (rs1 != null) {
        rs1.close();
        rs1 = null;
      }

      if (stmt1 != null) {
        stmt1.close();
        stmt1 = null;
      }

      if (rs2 != null) {
        rs2.close();
        rs2 = null;
      }

      if (stmt2 != null) {
        stmt2.close();
        stmt2 = null;
      }

      if (con1 != null) {
        con1.close();
        con1 = null;
      }

      ht.clear();
      ht = null;
    } catch (Exception e) {
    }
  }
  private void getRequiredProducts() {
    CrashReporter.leaveBreadcrumb("Trip_Stock_Load: getRequiredProducts");

    // Create the Hashtable if it does not already exist
    if (requiredProducts == null) {
      requiredProducts = new Hashtable<String, Integer>();
    }

    // Empty it
    requiredProducts.clear();

    if (Active.trip != null) {
      // Get all undelivered orders in the trip
      for (dbTripOrder order : Active.trip.getUndelivered()) {
        // Get all the order lines in each order
        for (dbTripOrderLine orderLine : order.getTripOrderLines()) {
          if (orderLine.Product == null || orderLine.Product.MobileOil == 3) {
            continue;
          }

          String productName = orderLine.Product.Desc;
          int orderQuantity = orderLine.OrderedQty;

          if (!requiredProducts.containsKey(productName)) {
            requiredProducts.put(productName, 0);
          }

          requiredProducts.put(productName, requiredProducts.get(productName) + orderQuantity);
        }
      }
    }
  }
Exemple #10
0
  static void loadAttrs(
      DBAdapter db,
      Hashtable /*Ptr< int, Hashtable<String,int>* >&*/ mapAttrs,
      String strDBAttr,
      Hashtable mapSrcNames)
      throws DBException {
    mapAttrs.clear();
    String strSql = "SELECT source_id,";
    strSql += strDBAttr + ",name from sources";

    IDBResult res = db.executeSQL(strSql);
    for (; !res.isEnd(); res.next()) {
      Integer nSrcID = new Integer(res.getIntByIdx(0));
      String strAttribs = res.getStringByIdx(1);
      if (strAttribs.length() == 0) continue;

      Tokenizer oTokenizer = new Tokenizer(strAttribs, ",");

      Hashtable /*<String,int>*/ mapAttr = new Hashtable /*<String,int>*/();
      String strAttr = "";
      while (oTokenizer.hasMoreTokens()) {
        String tok = oTokenizer.nextToken();
        if (tok.length() == 0) continue;

        if (strAttr.length() > 0) {
          mapAttr.put(strAttr, new Integer(Integer.parseInt(tok)));
          strAttr = "";
        } else strAttr = tok;
      }

      mapAttrs.put(nSrcID, mapAttr);
      if (mapSrcNames != null) mapSrcNames.put(res.getStringByIdx(2).toUpperCase(), nSrcID);
    }
  }
 /**
  * Closes this context. This method releases this context's resources immediately, instead of
  * waiting for them to be released automatically by the garbage collector. This method is
  * idempotent: invoking it on a context that has already been closed has no effect. Invoking any
  * other method on a closed context is not allowed, and results in undefined behaviour.
  *
  * @exception NamingException if a naming exception is encountered
  */
 @Override
 public void close() throws NamingException {
   if (!checkWritable()) {
     return;
   }
   env.clear();
 }
  /** Shut down all connections and clean up. */
  public void shutDown() {
    // inform all associated streams
    synchronized (connectionTable) {
      // return if multiplexer already officially dead
      if (!alive) return;
      alive = false;

      Enumeration<MultiplexConnectionInfo> enum_ = connectionTable.elements();
      while (enum_.hasMoreElements()) {
        MultiplexConnectionInfo info = enum_.nextElement();
        info.in.disconnect();
        info.out.disconnect();
      }
      connectionTable.clear();
      numConnections = 0;
    }

    // close underlying connection, if possible (and not already done)
    try {
      in.close();
    } catch (IOException e) {
    }
    try {
      out.close();
    } catch (IOException e) {
    }
  }
Exemple #13
0
  private void setNSDeclAsAttr(Attributes atts) {
    Enumeration keys = nsMap.keys();
    if (keys.hasMoreElements()) {
      if (!(atts instanceof AttributesImpl)) {
        atts = new AttributesImpl(atts);
      }
      while (keys.hasMoreElements()) {
        String prefix = (String) keys.nextElement();
        String uri = (String) nsMap.get(prefix);
        if ("".equals(prefix)) {
          int index = atts.getIndex("xmlns");
          if (index == -1) {

            ((AttributesImpl) atts).addAttribute("", "", "xmlns", "CDATA", uri);
          } else {
            ((AttributesImpl) atts).setAttribute(index, "", "", "xmlns", "CDATA", uri);
          }
        } else {
          int index = atts.getIndex("xmlns:" + prefix);
          if (index == -1) {
            ((AttributesImpl) atts).addAttribute("", "", "xmlns:" + prefix, "CDATA", uri);
          } else {
            ((AttributesImpl) atts).setAttribute(index, "", "", "xmlns:" + prefix, "CDATA", uri);
          }
        }
      }
      nsMap.clear();
    }
  }
 /** Stops listening for server broadcasts */
 public static void stopListening() {
   if (broadcastReceiverThread != null) {
     broadcastReceiverThread.kill();
     serverListUpdaterThread.kill();
     servers.clear();
   }
 }
Exemple #15
0
 void cleanObjectNotifications() {
   synchronized (m_mxObjectNotify) {
     m_strSingleObjectSrcName = "";
     m_strSingleObjectID = "";
     m_hashSrcIDAndObject.clear();
   }
 }
Exemple #16
0
  void Save() throws RemoveException, FinderException, CreateException {
    // System.out.println ("PropertySet::Save");
    for (Entry<String, T> e : original.entrySet()) {
      if (!current.containsKey(e.getKey())) {
        // System.out.println ("PropertySet::Save Delete "+e.getValue());
        DeleteEntry(e.getValue());
      }
    }
    for (Entry<String, T> e : current.entrySet()) {
      String key = e.getKey();
      if (original.containsKey(key)) {
        // Property o = original.get(key);
        // Property c = e.getValue();

        // System.out.println ("PropertySet::Save original "+o.getName()+"->"+o.getValue());
        // System.out.println ("PropertySet::Save current "+c.getName()+"->"+c.getValue());

        SetEntry(e.getValue());
      } else {
        // System.out.println ("PropertySet::Save insert "+e.getValue());
        InsertEntry(e.getValue());
      }
    }
    original.clear();
    original.putAll(current);
  }
  @SuppressWarnings("all")
  // CHECKSTYLE:OFF
  private static Object changeContextWritable(ServletContext servletContext, Object lock)
      throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, NamingException {
    // cette méthode ne peut pas être utilisée avec un simple JdbcDriver
    assert servletContext != null;
    final String serverInfo = servletContext.getServerInfo();
    if ((serverInfo.contains("Tomcat")
            || serverInfo.contains("vFabric")
            || serverInfo.contains("SpringSource tc Runtime"))
        && System.getProperty("jonas.name") == null) {
      // on n'exécute cela que si c'est tomcat
      // et si ce n'est pas tomcat dans jonas
      final Field field =
          Class.forName("org.apache.naming.ContextAccessController")
              .getDeclaredField("readOnlyContexts");
      setFieldAccessible(field);
      @SuppressWarnings("unchecked")
      final Hashtable<String, Object> readOnlyContexts =
          (Hashtable<String, Object>) field.get(null);
      // la clé dans cette Hashtable est normalement
      // "/Catalina/" + hostName + Parameters.getContextPath(servletContext) ;
      // hostName vaut en général "localhost" (ou autre selon le Host dans server.xml)
      // et contextPath vaut "/myapp" par exemple ;
      // la valeur est un securityToken
      if (lock == null) {
        // on utilise clear et non remove au cas où le host ne soit pas localhost dans server.xml
        // (cf issue 105)
        final Hashtable<String, Object> clone = new Hashtable<String, Object>(readOnlyContexts);
        readOnlyContexts.clear();
        return clone;
      }
      // on remet le contexte not writable comme avant
      @SuppressWarnings("unchecked")
      final Hashtable<String, Object> myLock = (Hashtable<String, Object>) lock;
      readOnlyContexts.putAll(myLock);

      return null;
    } else if (serverInfo.contains("jetty")) {
      // on n'exécute cela que si c'est jetty
      final Context jdbcContext = (Context) new InitialContext().lookup("java:comp");
      final Field field = getAccessibleField(jdbcContext, "_env");
      @SuppressWarnings("unchecked")
      final Hashtable<Object, Object> env = (Hashtable<Object, Object>) field.get(jdbcContext);
      if (lock == null) {
        // on rend le contexte writable
        Object result = env.remove("org.mortbay.jndi.lock");
        if (result == null) {
          result = env.remove("org.eclipse.jndi.lock");
        }
        return result;
      }
      // on remet le contexte not writable comme avant
      env.put("org.mortbay.jndi.lock", lock);
      env.put("org.eclipse.jndi.lock", lock);

      return null;
    }
    return null;
  }
Exemple #18
0
  /**
   * Loads the keystore from the Keychain.
   *
   * @param stream Ignored - here for API compatibility.
   * @param password Ignored - if user needs to unlock keychain Security framework will post any
   *     dialogs.
   * @exception IOException if there is an I/O or format problem with the keystore data
   * @exception NoSuchAlgorithmException if the algorithm used to check the integrity of the
   *     keystore cannot be found
   * @exception CertificateException if any of the certificates in the keystore could not be loaded
   */
  public void engineLoad(InputStream stream, char[] password)
      throws IOException, NoSuchAlgorithmException, CertificateException {
    permissionCheck();

    // Release any stray keychain references before clearing out the entries.
    synchronized (entries) {
      for (Enumeration<String> e = entries.keys(); e.hasMoreElements(); ) {
        String alias = e.nextElement();
        Object entry = entries.get(alias);
        if (entry instanceof TrustedCertEntry) {
          if (((TrustedCertEntry) entry).certRef != 0) {
            _releaseKeychainItemRef(((TrustedCertEntry) entry).certRef);
          }
        } else {
          KeyEntry keyEntry = (KeyEntry) entry;

          if (keyEntry.chain != null) {
            for (int i = 0; i < keyEntry.chain.length; i++) {
              if (keyEntry.chainRefs[i] != 0) {
                _releaseKeychainItemRef(keyEntry.chainRefs[i]);
              }
            }

            if (keyEntry.keyRef != 0) {
              _releaseKeychainItemRef(keyEntry.keyRef);
            }
          }
        }
      }

      entries.clear();
      _scanKeychain();
    }
  }
  @Override
  public void dispose() {
    getSite().getPage().removePartListener(fPartListener);

    Enumeration<IMemoryViewPane> enumeration = fViewPanes.elements();
    while (enumeration.hasMoreElements()) {
      Object element = enumeration.nextElement();
      if (element instanceof IMemoryViewPane) {
        ((IMemoryViewPane) element).dispose();
      }
    }

    fViewPaneControls.clear();

    IViewSite viewSite = getViewSite();
    String secondaryId = viewSite.getSecondaryId();
    if (secondaryId != null) MemoryViewIdRegistry.deregisterView(secondaryId);

    fSyncService.shutdown();

    if (fAddHandler != null) fAddHandler.dispose();

    if (fToggleMonitorsHandler != null) fToggleMonitorsHandler.dispose();

    if (fNextMemoryBlockHandler != null) fNextMemoryBlockHandler.dispose();

    super.dispose();
  }
 public void onCreate(int width, int height) {
   super.onCreate(width, height);
   if (planes == null) {
     planes = new Hashtable<Integer, STGPlane>(100);
   } else {
     planes.clear();
   }
   if (stgObjects != null) {
     stgObjects.dispose();
     stgObjects = null;
   }
   this.stgObjects = new STGObjects(this, 0);
   if (width > height) {
     this.scrollDelay = new LTimer(50);
   } else {
     this.scrollDelay = new LTimer(40);
   }
   this.dot_size = height / 10;
   this.count = 0;
   if (dot != null) {
     dot = null;
   }
   this.dot = new int[dot_size];
   for (int i = 0; i < dot_size; ++i) {
     this.dot[i] = (int) (MathUtils.random() * width);
   }
 }
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (Tools.isPortrait(this)) {
      if (keyCode == KeyEvent.KEYCODE_MENU) {

        if (!sp.get("menu_open", false)) {

          if (pop != null && pop.isShowing()) {
            hideMenu();

            madapter.notifyDataSetChanged();
          } else {
            showMenu();

            madapter.notifyDataSetChanged();
            // for (DCMyViewGroupHuiZhiBaoGao p : this.items) {
            // p.setCheck("2");
            // }

          }
        }

      } else if (keyCode == KeyEvent.KEYCODE_BACK) {

        if (pop != null && pop.isShowing()) {
          hideMenu();
          selitem.clear();
          madapter.notifyDataSetChanged();
          return true;
        }
      }
    }

    return super.onKeyDown(keyCode, event);
  }
 public void clear() {
   Hashtable<String, Object> ht = tlm.get();
   if (ht != null) {
     ht.clear();
   }
   tlm.remove();
 }
 private void disposeBuilders() {
   final Collection<HierarchyTreeBuilder> builders =
       new ArrayList<HierarchyTreeBuilder>(myBuilders.values());
   for (final HierarchyTreeBuilder builder : builders) {
     Disposer.dispose(builder);
   }
   myBuilders.clear();
 }
  /** Close API */
  public void close() {
    // Clear list of sessions
    sipSessions.clear();

    if (logger.isActivated()) {
      logger.info("Multimedia session service API is closed");
    }
  }
  /** Close API */
  public void close() {
    // Clear list of sessions
    videoSharingSessions.clear();

    if (logger.isActivated()) {
      logger.info("Video sharing service API is closed");
    }
  }
  void reset() {

    sqlMap.clear();
    csidMap.clear();
    validationMap.clear();

    next_cs_id = 0;
  }
Exemple #27
0
  /** Clears all the events. */
  public static final void clear() {

    if (!_isEnabled) {
      return;
    }

    _events.clear();
  }
 /**
  * Verificar si existen filtros adicionales que no se encuentren en el TO.
  *
  * @param opcion int - si viene en 0 NO se realizara la verificacion
  * @param request HttpServletRequest - Objeto de tipo HttpServletRequest que actua soble la pagina
  *     JSP invocadora
  * @return Hashtable - Objeto con los posibles parametros adicionales.
  */
 public Hashtable<String, Object> filtrosAdicionales(int opcion, HttpServletRequest request) {
   Hashtable<String, Object> hParam = new Hashtable<String, Object>();
   hParam.clear();
   if (opcion > 0) {
     // Colocar aqui instruccion de Adicion de Parametros adicionales.....
   }
   return hParam;
 }
Exemple #29
0
  /** Close API */
  public void close() {
    // Clear list of sessions
    gshSessions.clear();

    if (logger.isActivated()) {
      logger.info("Geoloc sharing service API is closed");
    }
  }
 /** Removes all elements from the iterator-list. */
 public void removeAll() {
   if (!readonly) {
     synchronized (this) {
       data.removeAllElements();
       hash.clear();
     }
   }
 }