Skip to Content
0
Former Member
Dec 11, 2009 at 02:19 PM

NullPointerException while using KM

12 Views

Hi Seniors,

We are trying to retrieve and change some data from KM text files.

We have two separate views for this. Both the views are just the same, except that TextEdit field is read-only in one view, while it can be edited in other view.

The view, in which TextEdit field is not read-only happily retrieves and allows us to change the KM text file data.

Problem arises with the second view, which has this TextEdit field as read-only. Inside wdDoInit() method, we call following method.

public void getProcessUpdates( )

{

//@@begin getProcessUpdates()

wdContext.currentContextElement().setProcessUpdate(null);

try {

IWDClientUser wdClientUser = WDClientUser.getCurrentUser();

com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();

com.sapportals.portal.security.usermanagement.IUser ep5User =

WPUMFactory.getUserFactory().getEP5User(sapUser);

ResourceContext resourseContext = new ResourceContext(ep5User);

String path = "someTextFilePath";

RID rid = RID.getRID(path);

IResourceFactory factory = ResourceFactory.getInstance();

IResource resource = factory.getResource(rid,resourseContext);

if (resource != null) {

String text = "";

BufferedReader in = new BufferedReader(new InputStreamReader(resource.getContent().getInputStream()));

while ((text = in.readLine()) != null) {

wdContext.currentContextElement().setProcessUpdate(text);

}

in.close();

}

} catch (Exception e) {

// TODO Auto-generated catch block

wdComponentAPI.getMessageManager().reportException("Exception in method getProcessUpdates()"+e,true);

wdComponentAPI.getMessageManager().reportException("Exception Cause in method getProcessUpdates()"+e.getCause(),true);

wdComponentAPI.getMessageManager().reportException("Exception Message in method getProcessUpdates()"+e.getMessage(),true);

}

}

We get NullPointerException for RID.getRID(path) method.

Can you please help us why this is happening?