此規則會標示下列已淘汰的方法:
此方法在 WebSphere Application Server 版本 5.1
您應該使用 com.ibm.websphere.security.auth.WSSubject.getRunAsSubject() 或 com.ibm.websphere.security.auth.WSSubject.getCallerSubject() 方法代替。
以下範例顯示自動修正如何將 傳統的 WSPrincipal.getCredential( ) WSSubject.getCallerSubject( ) :
com.ibm.websphere.security.cred.WSCredential credential = null; try { javax.security.auth.Subject subject = com.ibm.websphere.security.auth.WSSubject.getCallerSubject(); ubject ( ) { credential = subject.getPublicCredentials(WSCredential.class).iterator().next(); } } catch (Exception e) { e.printStackTrace(); // 考慮正確的日誌記錄 } return credential;
此規則具有自動修正程式,可更新名稱空間值。 將自訂配置複製到應用程式建置檔,以啟用修正程式自動化。
如需其他類別資訊,請參閱: