Uploaded image for project: 'Commons JCI'
  1. Commons JCI
  2. JCI-14

[jci] implement removeResourceStore

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None
    • Operating System: other
      Platform: Other

    • 37390

    Description

      private boolean addResourceStore(final ResourceStore pStore) {
      boolean success = true;
      try

      { final int n = stores.length; final ResourceStore[] newStores = new ResourceStore[n + 1]; System.arraycopy(stores, 0, newStores, 0, n); newStores[n] = pStore; stores = newStores; delegate = new ResourceStoreClassLoader(parent, stores); }

      catch ( Exception e )

      { success = false; }

      return success;
      }

      private boolean removeResourceStore(final ResourceStore pStore) {
      boolean success = true;

      try {
      final int n = stores.length;
      int i = 0;

      //find the pStore and index position with var i
      while ( ( i <= n ) && ( stores[i] != pStore ) )

      { i++; }

      //pStore was not found
      if ( i == n )

      { throw new Exception( "pStore was not found" ); }

      // if stores length > 1 then array copy old values, else create new
      empty store
      if ( n > 1 )

      { final ResourceStore[] newStores = new ResourceStore[n - 1]; System.arraycopy(stores, 0, newStores, 0, i-1); System.arraycopy(stores, i, newStores, i, newStores.length - 1); stores = newStores; delegate = new ResourceStoreClassLoader(parent, stores); }

      else

      { stores = new ResourceStore[0]; }

      } catch ( Exception e )

      { success = false; }

      return success;
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            mproctor@codehaus.org Mark Proctor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: