Hi All,
I have customized the Webtop 6.5 to cater to my needs of sending and recieving files through web services. As a result i obtain zip files from a web service of mine. The zip file contain documents ( for example .txt or .doc files). I have my code that saves documents from web services inside the repository (inside the cabinets which are chosen by the user).
But now i have this requirement to unzip the files which i recieve and save it inside the CMS.
public void createFile(byte [] fileReta,String path) throws Exception { System.out.println (" Step 1"); String filenametoberetrieved = FreewayDashboard.filenamos ; System.out.println (" Step 2"); filenametoberetrieved.trim();System.out.println (" Step 3 ::" + filenametoberetrieved.trim()); createSessionManager();System.out.println (" Step 4"); mySession = m_sessionManager.getSession(rname); System.out.println (" Step 5 ::" + mySession); document = (IDfDocument) mySession.newObject("dm_document"); System.out.println (" Step 6 ::" + document.toString()); //document.setObjectName(filenametoberetrieved); System.out.println (" Step 7"); //document.setContentType("zip"); System.out.println (" Step 8"); ByteArrayInputStream baistream =new ByteArrayInputStream(fileReta); System.out.println (" Step 9"); ZipInputStream zistream =new ZipInputStream(baistream); System.out.println (" Step 10"); ZipEntry entry;System.out.println (" Step 11"); while ((entry = zistream.getNextEntry()) != null) { System.out.println("Unzipping: " + entry.getName()); int size; byte[] buffer = new byte[2048]; System.out.println (" Now inside inner while"); ByteArrayOutputStream bos =new ByteArrayOutputStream(buffer.length); while ((size = zistream.read(buffer, 0, buffer.length)) != -1) { System.out.println (" Step 12 :: inside inner while"); bos.write(buffer, 0, size);}System.out.println (" Step 13 "); document.setObjectName(entry.getName()); document.setContentType("crtext"); document.setContent(bos); System.out.println (" Step 14 "); // document.save(); System.out.println (" Step 15 "); document.link(path); System.out.println (" Step 16 "); document.save(); System.out.println (" Step 17 "); //bos.flush(); //bos.close(); }System.out.println (" Step 18::prior to close "); zistream.close();System.out.println (" Step 19::after close "); }
The above given code extracts the zip files into the location of my desire (path).
But the scenario i am facing is this:
1) If the zip file has 3 text files in it, only the middle file gets extracted into the desired location .
2) For the remaining files i get the below seen exception
Step 1
Step 2
Step 3 ::July30TestProject.zip
Step 4
Step 5 ::com.documentum.fc.client.impl.session.StrongSessionHandle@dd422e
Step 6 ::com.documentum.fc.client.DfDocument___PROXY@241a0d
Step 7
Step 8
Step 9
Step 10
Step 11
Unzipping: MyTest2.txt
Now inside inner while
Step 12 :: inside inner while
Step 13
Step 14
Step 15
Step 16
Step 17
Unzipping: MyTest1.txt
Now inside inner while
Step 12 :: inside inner while
Step 13
Step 14
Step 15
DfSysObjectException:: THREAD: http-8080-4; MSG: [DM_SYSOBJECT_E_ALREADY_LINKED]error: "Sysobject named 'MyTest1.txt' is already linked to /DestTest folder"; ERRORCODE: 100; NEXT: null
at com.documentum.fc.client.DfSysObjectException.newAlreadyLinkedException(DfSysObjectException.java:110)
at com.documentum.fc.client.DfSysObject.doLink(DfSysObject.java:1193)
at com.documentum.fc.client.DfSysObject.link(DfSysObject.java:1175)
at com.documentum.fc.client.DfDocument___PROXY.link(DfDocument___PROXY.java)
at com.documentum.custom.library.DummyComponent.createFile(DummyComponent.java:1112)
at com.documentum.custom.library.DummyComponent.functionForRetrieveFile(DummyComponent.java:1047)
at com.documentum.custom.library.TestFreeway.onClickCollectFreeway(TestFreeway.java:113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.documentum.web.form.FormProcessor.invokeMethod(FormProcessor.java:1633)
at com.documentum.web.form.FormProcessor.invokeMethod(FormProcessor.java:1487)
at com.documentum.web.form.FormProcessor.fireActionEvent(FormProcessor.java:1303)
at com.documentum.web.form.RecallOperation.execute(RecallOperation.java:101)
at com.documentum.web.form.FormProcessor.processAction(FormProcessor.java:113)
at com.documentum.web.form.FormAction.processAction(FormAction.java:107)
at com.documentum.web.env.WDKController.doStartRequest(WDKController.java:191)
at com.documentum.web.env.WDKController.processRequest(WDKController.java:92)
at com.documentum.web.env.WDKController.doFilter(WDKController.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
There seems to be an error called "[DM_SYSOBJECT_E_ALREADY_LINKED]error".
Could any one please help me with this error to analyse a solution.
Thanks & Regards
Vishnu S