DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37390>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37390

           Summary: [jci] implement removeResourceStore
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Sandbox
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


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;
    }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to