@@ -151,10 +151,13 @@ public static String getFqan(GSSCredential gss) throws CredentialException {
151151 }
152152
153153 public static Credential load () {
154- return load (CoGProperties . getDefault (). getProxyFile () );
154+ return load (null );
155155 }
156156
157157 public static Credential load (String location ) {
158+ if (StringUtils .isBlank (location )) {
159+ location = CoGProperties .getDefault ().getProxyFile ();
160+ }
158161 String mdFilePath = location + "." + METADATA_FILE_EXTENSION ;
159162 File mdFile = new File (mdFilePath );
160163 if ( ! mdFile .exists () || ! mdFile .canRead () ) {
@@ -165,7 +168,8 @@ public static Credential load(String location) {
165168 return loadFromMetaDataFile (mdFilePath );
166169 }
167170
168- public static Credential loadFromConfig (Map <PROPERTY , Object > config ) {
171+ public static Credential loadFromConfig (Map <PROPERTY , Object > config ,
172+ boolean neverLoadFromMyproxy ) {
169173
170174 myLogger .debug ("Loading credential from config map..." );
171175
@@ -196,6 +200,11 @@ public static Credential loadFromConfig(Map<PROPERTY, Object> config) {
196200 + " not supported." );
197201 }
198202
203+ if (neverLoadFromMyproxy ) {
204+ c .getCredential ();
205+ return c ;
206+ }
207+
199208 if (StringUtils .isNotBlank (localPath )
200209 && new File (localPath ).exists ()) {
201210 c .setSaved (true );
@@ -218,10 +227,12 @@ && new File(localPath).exists()) {
218227 }
219228 }
220229
230+
221231 return c ;
222232 } catch (CredentialException ce ) {
223233 throw ce ;
224234 } catch (Exception e ) {
235+ e .printStackTrace ();
225236 throw new CredentialException ("Can't create credential: "
226237 + e .getLocalizedMessage (), e );
227238 }
@@ -320,19 +331,21 @@ public static Credential loadFromMetaDataFile(String metadataFile) {
320331
321332 }
322333
323- Credential c = loadFromConfig (config );
334+ Credential c = loadFromConfig (config , false );
324335
325336 for (String fqan : childs .keySet ()) {
326337 myLogger .debug ("Adding existing and uploaded childs to credential..." );
327338 Map <PROPERTY , Object > childConf = childs .get (fqan );
328339 childConf .put (PROPERTY .LoginType , LoginType .MYPROXY );
329- Credential child = loadFromConfig (childConf );
340+ Credential child = loadFromConfig (childConf , false );
330341 c .addVomsCredential (child );
331342 }
332343
333344 return c ;
334345 } catch (Exception e ) {
335- throw new CredentialException ("Can't create credential from metadata file: " +metadataFile );
346+ throw new CredentialException (
347+ "Can't create credential from metadata file "
348+ + metadataFile + ": " + e .getLocalizedMessage ());
336349 }
337350
338351 }
@@ -1107,6 +1120,8 @@ private void saveCredentialMetadata() {
11071120 }
11081121 prop .put (p .toString (), new String ((char []) pw ));
11091122 break ;
1123+ case Password :
1124+ break ;
11101125 default :
11111126 prop .put (p .toString (), properties .get (p ).toString ());
11121127 }
0 commit comments