Actions
Bug #5608
closedUserProxyObject NPE
Start date:
12/03/2013
Due date:
% Done:
0%
Estimated time:
Description
The following code throws null pointer exception:
import java.io.*; import java.util.Scanner; import org.gridforum.jgss.*; import org.ietf.jgss.GSSCredential; import org.ogf.saga.context.*; import org.ogf.saga.namespace.*; import org.ogf.saga.session.*; import org.ogf.saga.url.*; import fr.in2p3.jsaga.adaptor.security.VOMSContext; public class InMemoryVOMS { public static void main(String[] args) throws Exception { URL url = URLFactory.createURL("srm://se.hpc.iit.bme.hu/dpm/hpc.iit.bme.hu/home/hungrid"); Session session = SessionFactory.createSession(false); Context ctx = ContextFactory.createContext("VOMS"); ctx.setAttribute(Context.SERVER,"voms://grid11.kfki.hu:15000"); ctx.setAttribute(Context.USERVO,"hungrid"); ctx.setAttribute(Context.USERPROXY, contentOf("x509up_voms")); ctx.setAttribute(Context.CERTREPOSITORY, ".globus/certificates"); ctx.setAttribute(VOMSContext.VOMSDIR, ".globus/vomsdir"); ctx.setVectorAttribute("BaseUrlIncludes", new String[] {"srm://se.hpc.iit.bme.hu"}); // with the above works, but now we replace proxy with in-memory proxy... [https://forge.in2p3.fr/boards/11/topics/458?r=465] String proxy = ctx.getAttribute(Context.USERPROXY); ctx.removeAttribute(Context.USERPROXY); ExtendedGSSManager manager = (ExtendedGSSManager) ExtendedGSSManager.getInstance(); GSSCredential cred = manager.createCredential( proxy.getBytes(), ExtendedGSSCredential.IMPEXP_OPAQUE, GSSCredential.DEFAULT_LIFETIME, null, // use default mechanism: GSI GSSCredential.INITIATE_AND_ACCEPT); ctx.setAttribute("UserProxyObject", fr.in2p3.jsaga.adaptor.security.impl.InMemoryProxySecurityCredential.toBase64(cred)); session.addContext(ctx); NSDirectory dir = NSFactory.createNSDirectory(session, url); for (URL dirEntry: dir.list()) System.out.println(dirEntry.getPath()); dir.close(); } private static String contentOf(String fileName) throws FileNotFoundException { Scanner scanner = new Scanner(new File(fileName)); scanner.useDelimiter("\\Z"); StringBuilder sb = new StringBuilder(); while (scanner.hasNext()) sb.append(scanner.next()); return sb.toString(); } }
The stack trace:
12:49:42,546 WARN [SagaFactoryImpl:81] Failed to load engine properties, using defaults [.\etc\jsaga-config.properties (The system cannot find the path specified)] Exception in thread "main" NoSuccess: java.lang.NullPointerException at fr.in2p3.jsaga.adaptor.security.VOMSSecurityAdaptor.createSecurityCredential(VOMSSecurityAdaptor.java:208) at fr.in2p3.jsaga.impl.context.ContextImpl.createCredential(ContextImpl.java:282) at fr.in2p3.jsaga.impl.session.SessionImpl.addContext(SessionImpl.java:63) at InMemoryVOMS.main(InMemoryVOMS.java:34) Caused by: java.lang.NullPointerException at java.io.File.<init>(File.java:222) at fr.in2p3.jsaga.adaptor.security.VOMSSecurityCredential.<init>(VOMSSecurityCredential.java:47) at fr.in2p3.jsaga.adaptor.security.VOMSSecurityAdaptor.createSecurityAdaptor(VOMSSecurityAdaptor.java:246) at fr.in2p3.jsaga.adaptor.security.VOMSSecurityAdaptor.createSecurityCredential(VOMSSecurityAdaptor.java:176) ... 3 more
Updated by Schwarz Lionel over 11 years ago
- Category changed from engine to gLite adaptors
- Status changed from New to Resolved
fixed in the voms-clients branch (will be merged in 0.9.17)
Actions