Skip to Content
0
Former Member
Jan 18, 2006 at 10:27 AM

Not able to copy .xml files from one folder to another programatically

23 Views

Hi,

I am facing problem in copying .xml extension files from one folder to other.. But the same code works for .properties extensions..

This is my code and this is the error code

thanks

		RID rid = null ;
		try
		{
			  IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
			  ResourceContext context = new ResourceContext(user);
			  //  rid = RID.getRID("/documents/ContentPath.properties");
			  rid = RID.getRID("/documents/a.xml");
			  System.err.println(" ---------- strDestCollectionPath Original File RId --" + rid.toString() );
			  IResourceFactory resourceFactory = ResourceFactory.getInstance();
			  System.err.println(" ------- -2 -------3");
			  IResource origResource = resourceFactory.getResource(rid, context);
			  System.err.println(" ------- -1 ----3-strDestCollectionPath --" );
			  rid = null;
			  rid = RID.getRID("/documents/cvs/cvsFn/Adm/tm");
			  System.err.println(" ------- 0 --3-----");
		  
			  ICollection tempcol = (ICollection) resourceFactory.getResource( rid, context );
		  	  if( tempcol != null )
			  {
					//  tempcol.createResource( "ContentPath.properties" , null , null);
					tempcol.createResource( "a.xml" , null , null);
     				String  strDestCollectionPath =  tempcol.getRID().toString();
					// rid = RID.getRID( strDestCollectionPath  + "/" + "ContentPath.properties");
					rid = RID.getRID( strDestCollectionPath  + "/" + "a.xml");
					IResource destResource = resourceFactory.getResource(rid, context);
					com.sapportals.wcm.repository.ICopyParameter icpParam = new CopyParameter(true, true, true, true);
					System.err.println(" ---------- strDestCollectionPath dest RId --" + rid.toString() );
					System.err.println(" destResource.getRID() -- " + destResource.getRID().toString() ) ; 
					IResource copied = origResource.copy( destResource.getRID(), icpParam);
					System.err.println(" ------- 8 -------"); 
				  }
				  else
				  {
					System.err.println(" ------- 11 --tempcol is NULL----");
				  }
		

			  }
			  catch(ResourceException ex)
			  {
				  ex.printStackTrace();
			  }
	
			  catch( UserManagementException ex )
			  {
				  ex.printStackTrace();
			  }

// Error Stack

#1.5#000D601747FC00520000001E00001A0400040A9F45456E77#1137579085064#com.sap.portal.ivs.semantic.iViewService#sap.com/irj#com.sap.portal.ivs.semantic.iViewService#pkiran#1031####c8324880880a11dabb92000d601747fc#SAPEngine_Application_Thread[impl:3]_32##0#0#Error#1#/System/Server#Java###Failed to get application IPropertyContentProvider: #1#pcd:com.sap.portal.system/applications/Layouts/components/R1Col1R2Col4# #1.5#000D601747FC00570000004600001A0400040A9F4699C40B#1137579107377#System.err#sap.com/irj#System.err#pkiran#1031####d42c6260880a11daa17e000d601747fc#SAPEngine_Application_Thread[impl:3]_22##0#0#Error##Plain### -


strDestCollectionPath Original File RId --/documents/a.xml# #1.5#000D601747FC00570000004700001A0400040A9F4699C4E3#1137579107377#System.err# sap.com/irj#System.err#pkiran#1031####d42c6260880a11daa17e000d601747fc#SAPEngine_Application_Thread[impl:3]_22##0#0#Error##Plain### -
-2 -
3# #1.5#000D601747FC00570000004800001A0400040A9F4699D3D4#1137579107377#System.err# sap.com/irj#System.err#pkiran#1031####d42c6260880a11daa17e000d601747fc#SAPEngine_Application_Thread[impl:3]_22##0#0#Error##Plain### -
-1 -
3-strDestCollectionPath --# #1.5#000D601747FC00570000004900001A0400040A9F4699D486#1137579107377#System.err# sap.com/irj#System.err#pkiran#1031####d42c6260880a11daa17e000d601747fc#SAPEngine_Application_Thread[impl:3]_22##0#0#Error##Plain### -
0 3 ---# #1.5#000D601747FC00570000005100001A0400040A9F469B6AFF#1137579107486#System.err# sap.com/irj#System.err#pkiran#1031####d42c6260880a11daa17e000d601747fc#SAPEngine_Application_Thread[impl:3]_22##0#0#Error##Plain### -
strDestCollectionPath dest RId --/documents/cvs/cvsFn/Adm/tm/a.xml# #1.5#000D601747FC00570000005200001A0400040A9F469B6BA5#1137579107486#System.err# sap.com/irj#System.err#pkiran#1031####d42c6260880a11daa17e000d601747fc#SAPEngine_Application_Thread[impl:3]_22##0#0#Error##Plain### destResource.getRID() -- /documents/cvs/cvsFn/Adm/tm/a.xml# #1.5#000D601747FC00570000005400001A0400040A9F469B788B#1137579107486#com.sap.portal.portal# sap.com/irj#com.sap.portal.portal#pkiran#1031####d42c6260880a11daa17e000d601747fc#SAPEngine_Application_Thread[impl:3]_22##0#0#Error#1#/System/Server#Java###Exception ID:03:41_18/01/06_0014_5335150 [EXCEPTION] #1#com.sapportals.portal.prt.component.PortalComponentException: Error in service call of Portal Component

Component : pcd:portal_content/PKWF/pkIviewFolder/ivcrProspct

Component class : com.cvs.dynCrProspects

User : pkiran

at com.sapportals.portal.prt.core.PortalRequestManager.handlePortalComponentException(PortalRequestManager.java:969)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:343)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)

at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)

at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)

at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)

at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:232)

at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:153)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Caused by: com.sapportals.portal.prt.component.PortalComponentException: Exception during PageProcessorComponent.doContent()

at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:139)

at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)

at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)

... 29 more

Caused by: java.lang.reflect.InvocationTargetException

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:324)

at com.sapportals.htmlb.page.DynPage.doProcessCurrentEvent(DynPage.java:172)

at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:115)

at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)

... 32 more

Caused by: java.lang.NullPointerException

at com.cvs.dynCrProspects$dynCrProspectsDynPage.CreatePrspctPublicFolder(dynCrProspects.java:236)

at com.cvs.dynCrProspects$dynCrProspectsDynPage.onCreateKMPrspct(dynCrProspects.java:117)

... 39 more

#

Is there anything I am missing

Please help me out

thanks

pk