閱讀325 返回首頁    go 技術社區[雲棲]


解決掉Eclipse插件之WebLogic Plugin 2.0.0的BUG

解決掉Eclipse插件之WebLogic Plugin 2.0.0的BUG

https://iamin.blogdriver.com/iamin/1176540.html

Eclipse插件之WebLogic Plugin 2.0.0操作說明及BUG請見:
https://iamin.blogdriver.com/iamin/1174442.html
https://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=124&threadID=34319

這裏重點說明BUG的解決:)
1、WebLogic Plugin 2.0.0的配置文件保存在
%ECLIPSE_HOME%/workspace/.metadata/.plugins/com.bea.weblogic.eclipse/目錄下
dialog_settings.xml是保存配置對話框的大小之類的文件
servers.xml是保存服務器配置信息的文件

2、解壓出weblogic-eclipse.jar裏的所有文件

3、反編譯com/bea/weblogic/eclipse/utils/XMLUtil.class得到XMLUtil.java
在裏麵增加兩個函數
 /**
  * 將 source 進行 BASE64 編碼
  *
  * @param source
  * @return
  */
 public static String buildBASE64(String source)
 {
  if(source == null)
  {
   return null;
  }
  return (new sun.misc.BASE64Encoder()).encode(source.getBytes());
 }

 /**
  * 將 BASE64 編碼的字符串 base65code 進行解碼
  *
  * @param base65code
  * @return
  */
 public static String getFromBASE64(String base65code)
 {
  if(base65code == null)
  {
   return null;
  }
  BASE64Decoder base64decoder = new BASE64Decoder();
  try
  {
   byte[] b = base64decoder.decodeBuffer(base65code);
   return new String(b);
  }
  catch(Exception e)
  {
   e.printStackTrace();
   return null;
  }
 }

4、在public IServerInstall[] loadServers(File serversFile)函數裏修改
cServerInstall.setUsername(CryptoUtil.getDefault().decrypt(new String(Base64Util.base64ToByteArray(getNodeValue(cElement))),id));

cServerInstall.setUsername(getFromBASE64(getNodeValue(cElement)));

修改
cServerInstall.setPassword(CryptoUtil.getDefault().decrypt(new String(Base64Util.base64ToByteArray(getNodeValue(cElement))),id));

cServerInstall.setPassword(getFromBASE64(getNodeValue(cElement)));

5、在public void saveServers(IServerInstall servers[],File serversFile)函數裏修改
org.w3c.dom.Text usernameText = doc.createTextNode(Base64Util.byteArrayToBase64(CryptoUtil.getDefault().encrypt(cServer.getUsername(),cServer.getId()).getBytes()));

org.w3c.dom.Text usernameText = doc.createTextNode(buildBASE64(cServer.getUsername()));

修改
org.w3c.dom.Text passwordText = doc.createTextNode(Base64Util.byteArrayToBase64(CryptoUtil.getDefault().encrypt(cServer.getPassword(),cServer.getId()).getBytes()));

org.w3c.dom.Text passwordText = doc.createTextNode(buildBASE64(cServer.getPassword()));

6、編譯這個XMLUtil.java得到XMLUtil.class,把XMLUtil.class打回weblogic-eclipse.jar包裏

7、關閉Eclipse

8、把weblogic-eclipse.jar覆蓋掉原來插件目錄裏的文件

9、重新啟動Eclipse

10、Enjoy...五一節快樂!!!赫赫(^_^)

BTW:沒有去研究它裏麵的本身的加密為什麼錯誤:(,因為我也想過五一節,而且現在還沒有吃飯:(

最後更新:2017-04-02 00:00:27

  上一篇:go 關於java中servlet中的路徑的幾個函數的例子
  下一篇:go 最優化的ms sql server分頁sql語句