Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

return and while loop

Avatar of CalmSoul
CalmSoulFlag for United States of America asked on
Java
3 Comments1 Solution1243 ViewsLast Modified:
I have a function which returns a DSObject. One of my other function is calling this function and it gets all children under destination Object(destObj) and the associated title along with it. If the title matches the "desttitle" then i want to get the handle of existing collection   dObj = dssession.getObject(oldhandle); else i want to return dObj as destObj. Please advice  i think my return statements are not setup correctly
public DSObject findduplicateunderdestination (String destitle, DSObject srcObj, DSObject destObj) {
 
  DSObject dObj=destObj;
       try {
 
 
  DSObjectIterator Children = destObj.getDestinations(
                 DSLinkDesc.containment, 1, ss );
 
 
 
            Iterator sortedIter = sortListOfDSObjects( Children );
             int destsize= Children.size();
 
       while (sortedIter.hasNext()){
 
          System.out.println("Destination Size is:" + destsize);
 
         DSObject destObj1 = (DSObject) sortedIter.next();
 
String titlecompare= destObj1.getTitle();
DSHandle oldhandle = destObj1.getHandle();
if (destitle.equals(titlecompare)) {
 
 
 
  dObj = dssession.getObject(oldhandle);
System.out.println("dObj with duplicate is:" + dObj);
System.out.println("string to compare is :" + titlecompare);
System.out.println("string to compare is :" + destitle);
 
 return dObj;
   // doCreateCollection(srcObj,olddestObj);
 
}
     else {
      //   doCreateCollection(srcObj,destObj);
 
 dObj=destObj;
 System.out.println("dObj without duplicate is:" + dObj);
    return dObj;
 
     }
     
 
       }
     
 
       }
 
          catch ( DSInvalidLicenseException dse ) {
            System.out.println( "The DocuShare server does not have the require license." );
            System.exit( -1 );
        } catch ( DSAuthorizationException dse ) {
            System.out.println( "You do not have the proper permissions for this operation." );
           System.exit( -1 );
        } catch ( DSException dse ) {
            dse.printStackTrace();
            System.exit( -1 );
        }
// System.out.println("Destination Handle is third time :" + dObj);
 System.out.println("final dObj is:" + dObj);
 
   return dObj;
 
  
}
ASKER CERTIFIED SOLUTION
Avatar of Jim Cakalic
Jim CakalicFlag of United States of America imageSpecialized Architect (Java)

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answers