[Jsxe-cvs] SF.net SVN: jsxe: [1231] branches/jsxe2/src/net/sourceforge/jsxe
Status: Inactive
Brought to you by:
ian_lewis
From: <ian...@us...> - 2006-09-02 19:21:12
|
Revision: 1231 http://svn.sourceforge.net/jsxe/?rev=1231&view=rev Author: ian_lewis Date: 2006-09-02 12:20:52 -0700 (Sat, 02 Sep 2006) Log Message: ----------- Resolved compile problems dom2 and io packages now compile Modified Paths: -------------- branches/jsxe2/src/net/sourceforge/jsxe/BufferHistory.java branches/jsxe2/src/net/sourceforge/jsxe/JARClassLoader.java branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java Modified: branches/jsxe2/src/net/sourceforge/jsxe/BufferHistory.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/BufferHistory.java 2006-09-02 17:49:07 UTC (rev 1230) +++ branches/jsxe2/src/net/sourceforge/jsxe/BufferHistory.java 2006-09-02 19:20:52 UTC (rev 1231) @@ -474,6 +474,7 @@ static { m_excludeKeys = new ArrayList(); m_excludeKeys.add(DocumentBuffer.LINE_SEPARATOR); + m_excludeKeys.add("xmldocument.dirty"); } //}}} Modified: branches/jsxe2/src/net/sourceforge/jsxe/JARClassLoader.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/JARClassLoader.java 2006-09-02 17:49:07 UTC (rev 1230) +++ branches/jsxe2/src/net/sourceforge/jsxe/JARClassLoader.java 2006-09-02 19:20:52 UTC (rev 1231) @@ -99,43 +99,46 @@ */ protected Class findClass(String name) throws ClassNotFoundException { - String classFileName = name.replace('.','/').concat(".class"); - Iterator jarItr = m_jarFiles.values().iterator(); + synchronized(this) { - while (jarItr.hasNext()) { - try { - - JarFile zipFile = (JarFile)jarItr.next(); - ZipEntry entry = zipFile.getEntry(classFileName); - - if (entry != null) { + String classFileName = name.replace('.','/').concat(".class"); + Iterator jarItr = m_jarFiles.values().iterator(); + + while (jarItr.hasNext()) { + try { - InputStream in = zipFile.getInputStream(entry); + JarFile zipFile = (JarFile)jarItr.next(); + ZipEntry entry = zipFile.getEntry(classFileName); - boolean fail = false; - int len = (int)entry.getSize(); - byte[] data = new byte[len]; - int success = 0; - int offset = 0; - - while(success < len && !fail) { - len -= success; - offset += success; + if (entry != null) { - success = in.read(data,offset,len); - if(success == -1) { - fail = true; + InputStream in = zipFile.getInputStream(entry); + + boolean fail = false; + int len = (int)entry.getSize(); + byte[] data = new byte[len]; + int success = 0; + int offset = 0; + + while(success < len && !fail) { + len -= success; + offset += success; + + success = in.read(data,offset,len); + if(success == -1) { + fail = true; + } } + Class c = defineClass(name,data,0,data.length); + return c; } - Class c = defineClass(name,data,0,data.length); - return c; + + } catch(IOException io) { + //failed, try the next jar } - - } catch(IOException io) { - //failed, try the next jar } + throw new ClassNotFoundException(name); } - throw new ClassNotFoundException(name); }//}}} Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-09-02 17:49:07 UTC (rev 1230) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom2/ls/XMLDocumentIORequest.java 2006-09-02 19:20:52 UTC (rev 1231) @@ -222,7 +222,7 @@ } read(autodetect(in),length,false); - buffer.setNewFile(false); + // buffer.setNewFile(false); } catch(CharConversionException ch) { Log.log(Log.ERROR,this,ch); @@ -622,7 +622,7 @@ String savePath; boolean twoStageSave = (vfs.getCapabilities() & VFS.RENAME_CAP) != 0 - && jsXe.getBooleanProperty("twoStageSave"); + && jsXe.getBooleanProperty("twoStageSave", false); if(twoStageSave) savePath = vfs.getTwoStageSaveName(path); else @@ -727,8 +727,7 @@ { //buffer.readLock(); - if(!buffer.isDirty()) - { + if(!buffer.getBooleanProperty("xmldocument.dirty", false)) { // buffer has been saved while we // were waiting. return; @@ -820,9 +819,9 @@ //{{{ write() private void write(XMLDocument buffer, OutputStream out) throws IOException { - String newLine = getProperty(XMLDocument.LINE_SEPARATOR); + String newLine = buffer.getProperty(XMLDocument.LINE_SEPARATOR); - String encoding = getProperty(XMLDocument.ENCODING); + String encoding = buffer.getProperty(XMLDocument.ENCODING); if (encoding.equals(MiscUtilities.UTF_8_Y)) { // not supported by Java... out.write(UTF8_MAGIC_1); Modified: branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java 2006-09-02 17:49:07 UTC (rev 1230) +++ branches/jsxe2/src/net/sourceforge/jsxe/io/VFSManager.java 2006-09-02 19:20:52 UTC (rev 1231) @@ -29,6 +29,7 @@ //{{{ jsXe classes import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.JARClassLoader; import net.sourceforge.jsxe.EditBus; import net.sourceforge.jsxe.gui.Messages; import net.sourceforge.jsxe.gui.ErrorListDialog; @@ -78,7 +79,7 @@ /** * The service type. See {@link org.gjt.sp.jedit.ServiceManager}. */ - public static final String SERVICE = "net.sourceforge.jsxe.io.VFS"; + // public static final String SERVICE = "net.sourceforge.jsxe.io.VFS"; //{{{ init() method /** @@ -86,12 +87,13 @@ */ public static void init() { int count = jsXe.getIntegerProperty("ioThreadCount", 4); - ioThreadPool = new WorkThreadPool("jsXe I/O",count); - JARClassLoader classLoader = new JARClassLoader(); + ioThreadPool = new WorkThreadPool("jsXe I/O", count); + // JARClassLoader classLoader = new JARClassLoader(); + JARClassLoader classLoader = jsXe.getPluginLoader(); for (int i = 0; i < ioThreadPool.getThreadCount(); i++) { - ioThreadPool.getThread(i).setContextClassLoader( - classLoader); + ioThreadPool.getThread(i).setContextClassLoader(classLoader); } + } //}}} //{{{ start() method @@ -120,39 +122,26 @@ return urlVFS; } //}}} - //{{{ getVFSByName() method - /** - * @deprecated Use <code>getVFSForProtocol()</code> instead. - */ - public static VFS getVFSByName(String name) - { - // in new api, protocol always equals name - VFS vfs = (VFS)ServiceManager.getService(SERVICE,name); - if(vfs == null) - return (VFS)vfsHash.get(name); - else - return vfs; - } //}}} - //{{{ getVFSForProtocol() method /** * Returns the VFS for the specified protocol. * @param protocol The protocol */ - public static VFS getVFSForProtocol(String protocol) - { - if(protocol.equals("file")) + public static VFS getVFSForProtocol(String protocol) { + if (protocol.equals("file")) return fileVFS; - else - { - VFS vfs = (VFS)ServiceManager.getService(SERVICE,protocol); - if(vfs == null) - vfs = (VFS)protocolHash.get(protocol); + else { + // VFS vfs = (VFS)ServiceManager.getService(SERVICE,protocol); + // if (vfs == null) { + // vfs = (VFS)protocolHash.get(protocol); + // } + VFS vfs = (VFS)protocolHash.get(protocol); - if(vfs != null) + if (vfs != null) { return vfs; - else + } else { return urlVFS; + } } } //}}} @@ -170,12 +159,7 @@ } //}}} //{{{ registerVFS() method - /** - * @deprecated Write a <code>services.xml</code> file instead; - * see {@link org.gjt.sp.jedit.ServiceManager}. - */ - public static void registerVFS(String protocol, VFS vfs) - { + public static void registerVFS(String protocol, VFS vfs) { Log.log(Log.DEBUG,VFSManager.class,"Registered " + vfs.getName() + " filesystem for " + protocol + " protocol"); @@ -183,37 +167,24 @@ protocolHash.put(protocol,vfs); } //}}} - //{{{ getFilesystems() method - /** - * @deprecated Use <code>getVFSs()</code> instead. - */ - public static Enumeration getFilesystems() - { - return vfsHash.elements(); - } //}}} - //{{{ getVFSs() method /** * Returns a list of all registered filesystems. */ - public static String[] getVFSs() - { - // the sooner ppl move to the new api, the less we'll need - // crap like this + public static String[] getVFSs() { List returnValue = new LinkedList(); - String[] newAPI = ServiceManager.getServiceNames(SERVICE); - if(newAPI != null) - { - for(int i = 0; i < newAPI.length; i++) - { - returnValue.add(newAPI[i]); - } - } + // String[] newAPI = ServiceManager.getServiceNames(SERVICE); + // if(newAPI != null) + // { + // for(int i = 0; i < newAPI.length; i++) + // { + // returnValue.add(newAPI[i]); + // } + // } Enumeration oldAPI = vfsHash.keys(); while(oldAPI.hasMoreElements()) returnValue.add(oldAPI.nextElement()); - return (String[])returnValue.toArray(new String[ - returnValue.size()]); + return (String[])returnValue.toArray(new String[returnValue.size()]); } //}}} //}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |