bugged
stringlengths
6
599k
fixed
stringlengths
6
40.8M
__index_level_0__
int64
0
3.24M
public void endDraggingFrame(JComponent component) { if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE) { setBoundsForFrame((JInternalFrame) component, dragCache.x, dragCache.y, dragCache.width, dragCache.height); pane = null; dragCache = null; } component.repaint(); } // endDraggingFrame()
public void endDraggingFrame(JComponent component) { if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE) { setBoundsForFrame((JInternalFrame) component, dragCache.x, dragCache.y, dragCache.width, dragCache.height); pane = null; dragCache = null; } component.repaint(); } // endDraggingFrame()
14,261
public void endResizingFrame(JComponent component) { if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE) { setBoundsForFrame((JInternalFrame) component, dragCache.x, dragCache.y, dragCache.width, dragCache.height); pane = null; dragCache = null; } component.repaint(); } // endResizingFrame()
public void endResizingFrame(JComponent component) { if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE) { setBoundsForFrame((JInternalFrame) component, dragCache.x, dragCache.y, dragCache.width, dragCache.height); pane = null; dragCache = null; } component.repaint(); } // endResizingFrame()
14,262
protected Rectangle getBoundsForIconOf(JInternalFrame frame) { // IconRects has no order to it. // The icon _must_ be placed in the first free slot (working from // the bottom left corner) // The icon also must not be placed where another icon is placed // (regardless whether that frame is an icon currently or not) JDesktopPane desktopPane = frame.getDesktopPane(); Rectangle paneBounds = desktopPane.getBounds(); Insets insets = desktopPane.getInsets(); Dimension pref = frame.getDesktopIcon().getPreferredSize(); if (desktopPane == null) return frame.getDesktopIcon().getBounds(); Component[] frames = desktopPane.getComponents(); int count = 0; for (int i = 0, j = 0; i < frames.length; i++) if (frames[i] instanceof JDesktopIcon || frames[i] instanceof JInternalFrame && ((JInternalFrame) frames[i]).getWasIcon() && frames[i] != frame) count++; iconRects = new Rectangle[count]; for (int i = 0, j = 0; i < frames.length; i++) if (frames[i] instanceof JDesktopIcon) iconRects[--count] = frames[i].getBounds(); else if (frames[i] instanceof JInternalFrame && ((JInternalFrame) frames[i]).getWasIcon() && frames[i] != frame) iconRects[--count] = ((JInternalFrame) frames[i]).getDesktopIcon() .getBounds(); int startingX = insets.left; int startingY = paneBounds.height - insets.bottom - pref.height; Rectangle ideal = new Rectangle(startingX, startingY, pref.width, pref.height); boolean clear = true; while (iconRects.length > 0) { clear = true; for (int i = 0; i < iconRects.length; i++) { if (iconRects[i] != null && iconRects[i].intersects(ideal)) { clear = false; break; } } if (clear) return ideal; startingX += pref.width; if (startingX + pref.width > paneBounds.width - insets.right) { startingX = insets.left; startingY -= pref.height; } ideal.setBounds(startingX, startingY, pref.width, pref.height); } return ideal; } // getBoundsForIconOf()
protected Rectangle getBoundsForIconOf(JInternalFrame frame) { // IconRects has no order to it. // The icon _must_ be placed in the first free slot (working from // the bottom left corner) // The icon also must not be placed where another icon is placed // (regardless whether that frame is an icon currently or not) JDesktopPane desktopPane = frame.getDesktopPane(); Rectangle paneBounds = desktopPane.getBounds(); Insets insets = desktopPane.getInsets(); Dimension pref = frame.getDesktopIcon().getPreferredSize(); if (desktopPane == null) return frame.getDesktopIcon().getBounds(); Component[] frames = desktopPane.getComponents(); int count = 0; for (int i = 0, j = 0; i < frames.length; i++) if (frames[i] instanceof JDesktopIcon || frames[i] instanceof JInternalFrame && ((JInternalFrame) frames[i]).getWasIcon() && frames[i] != frame) count++; iconRects = new Rectangle[count]; for (int i = 0, j = 0; i < frames.length; i++) if (frames[i] instanceof JDesktopIcon) iconRects[--count] = frames[i].getBounds(); else if (frames[i] instanceof JInternalFrame && ((JInternalFrame) frames[i]).getWasIcon() && frames[i] != frame) iconRects[--count] = ((JInternalFrame) frames[i]).getDesktopIcon() .getBounds(); int startingX = insets.left; int startingY = paneBounds.height - insets.bottom - pref.height; Rectangle ideal = new Rectangle(startingX, startingY, pref.width, pref.height); boolean clear = true; while (iconRects.length > 0) { clear = true; for (int i = 0; i < iconRects.length; i++) { if (iconRects[i] != null && iconRects[i].intersects(ideal)) { clear = false; break; } } if (clear) return ideal; startingX += pref.width; if (startingX + pref.width > paneBounds.width - insets.right) { startingX = insets.left; startingY -= pref.height; } ideal.setBounds(startingX, startingY, pref.width, pref.height); } return ideal; } // getBoundsForIconOf()
14,263
protected Rectangle getPreviousBounds(JInternalFrame frame) { return frame.getNormalBounds(); } // getPreviousBounds()
protected Rectangle getPreviousBounds(JInternalFrame frame) { return frame.getNormalBounds(); } // getPreviousBounds()
14,264
public void iconifyFrame(JInternalFrame frame) { JDesktopPane p = frame.getDesktopPane(); JDesktopIcon icon = frame.getDesktopIcon(); if (p != null && p.getSelectedFrame() == frame) p.setSelectedFrame(null); else { try { frame.setSelected(false); } catch (PropertyVetoException e) { } } Container c = frame.getParent(); if (! wasIcon(frame)) { Rectangle r = getBoundsForIconOf(frame); icon.setBounds(r); setWasIcon(frame, true); } if (c != null) { if (icon != null) { c.add(icon); icon.setVisible(true); } c.remove(frame); } } // iconifyFrame()
public void iconifyFrame(JInternalFrame frame) { JDesktopPane p = frame.getDesktopPane(); JDesktopIcon icon = frame.getDesktopIcon(); if (p != null && p.getSelectedFrame() == frame) p.setSelectedFrame(null); else { try { frame.setSelected(false); } catch (PropertyVetoException e) { } } Container c = frame.getParent(); if (! wasIcon(frame)) { Rectangle r = getBoundsForIconOf(frame); icon.setBounds(r); setWasIcon(frame, Boolean.TRUE); } if (c != null) { if (icon != null) { c.add(icon); icon.setVisible(true); } c.remove(frame); } } // iconifyFrame()
14,265
public void iconifyFrame(JInternalFrame frame) { JDesktopPane p = frame.getDesktopPane(); JDesktopIcon icon = frame.getDesktopIcon(); if (p != null && p.getSelectedFrame() == frame) p.setSelectedFrame(null); else { try { frame.setSelected(false); } catch (PropertyVetoException e) { } } Container c = frame.getParent(); if (! wasIcon(frame)) { Rectangle r = getBoundsForIconOf(frame); icon.setBounds(r); setWasIcon(frame, true); } if (c != null) { if (icon != null) { c.add(icon); icon.setVisible(true); } c.remove(frame); } } // iconifyFrame()
public void iconifyFrame(JInternalFrame frame) { JDesktopPane p = frame.getDesktopPane(); JDesktopIcon icon = frame.getDesktopIcon(); if (p != null && p.getSelectedFrame() == frame) p.setSelectedFrame(null); else { try { frame.setSelected(false); } catch (PropertyVetoException e) { } } Container c = frame.getParent(); if (! wasIcon(frame)) { Rectangle r = getBoundsForIconOf(frame); icon.setBounds(r); setWasIcon(frame, true); } if (c != null) { if (icon != null) { c.add(icon); icon.setVisible(true); } c.remove(frame); } } // iconifyFrame()
14,266
public void maximizeFrame(JInternalFrame frame) { // Can't maximize from iconified state. // It can only return to maximized state, but that would fall under // deiconify. if (frame.isIcon()) return; frame.setNormalBounds(frame.getBounds()); Container p = frame.getParent(); if (p != null) { Rectangle pBounds = p.getBounds(); Insets insets = p.getInsets(); pBounds.width -= insets.left + insets.right; pBounds.height -= insets.top + insets.bottom; setBoundsForFrame(frame, 0, 0, pBounds.width, pBounds.height); } if (p instanceof JDesktopPane) ((JDesktopPane) p).setSelectedFrame(frame); else { try { frame.setSelected(true); } catch (PropertyVetoException e) { // Do nothing. } } } // maximizeFrame()
public void maximizeFrame(JInternalFrame frame) { // Can't maximize from iconified state. // It can only return to maximized state, but that would fall under // deiconify. if (frame.isIcon()) return; frame.setNormalBounds(frame.getBounds()); Container p = frame.getParent(); if (p != null) { Rectangle pBounds = p.getBounds(); Insets insets = p.getInsets(); pBounds.width -= insets.left + insets.right; pBounds.height -= insets.top + insets.bottom; setBoundsForFrame(frame, 0, 0, pBounds.width, pBounds.height); } if (p instanceof JDesktopPane) ((JDesktopPane) p).setSelectedFrame(frame); else { try { frame.setSelected(true); } catch (PropertyVetoException e) { // Do nothing. } } } // maximizeFrame()
14,267
public void minimizeFrame(JInternalFrame frame) { Rectangle normalBounds = frame.getNormalBounds(); JDesktopPane p = frame.getDesktopPane(); if (p != null) p.setSelectedFrame(frame); else { try { frame.setSelected(true); } catch (PropertyVetoException e) { // Do nothing. } } setBoundsForFrame(frame, normalBounds.x, normalBounds.y, normalBounds.width, normalBounds.height); } // minimizeFrame()
public void minimizeFrame(JInternalFrame frame) { Rectangle normalBounds = frame.getNormalBounds(); JDesktopPane p = frame.getDesktopPane(); if (p != null) p.setSelectedFrame(frame); else { try { frame.setSelected(true); } catch (PropertyVetoException e) { // Do nothing. } } setBoundsForFrame(frame, normalBounds.x, normalBounds.y, normalBounds.width, normalBounds.height); } // minimizeFrame()
14,268
public void openFrame(JInternalFrame frame) { Container c = frame.getParent(); if (c == null) c = frame.getDesktopIcon().getParent(); if (c == null) return; c.remove(frame.getDesktopIcon()); c.add(frame); frame.setVisible(true); } // openFrame()
public void openFrame(JInternalFrame frame) { Container c = frame.getParent(); if (c == null) c = frame.getDesktopIcon().getParent(); if (c == null) return; c.remove(frame.getDesktopIcon()); c.add(frame); frame.setVisible(true); } // openFrame()
14,269
protected void removeIconFor(JInternalFrame frame) { JDesktopIcon icon = frame.getDesktopIcon(); Container c = icon.getParent(); if (c != null && icon != null) c.remove(icon); } // removeIconFor()
protected void removeIconFor(JInternalFrame frame) { JDesktopIcon icon = frame.getDesktopIcon(); Container c = icon.getParent(); if (c != null && icon != null) c.remove(icon); } // removeIconFor()
14,270
public void resizeFrame(JComponent component, int newX, int newY, int newWidth, int newHeight) { dragCache.setBounds(newX, newY, newWidth, newHeight); if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE) { // FIXME: Do outline drag painting. } else setBoundsForFrame(component, dragCache.x, dragCache.y, dragCache.width, dragCache.height); } // resizeFrame()
public void resizeFrame(JComponent component, int newX, int newY, int newWidth, int newHeight) { dragCache.setBounds(newX, newY, newWidth, newHeight); if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE) { // FIXME: Do outline drag painting. } else setBoundsForFrame(component, dragCache.x, dragCache.y, dragCache.width, dragCache.height); } // resizeFrame()
14,271
public void setBoundsForFrame(JComponent component, int newX, int newY, int newWidth, int newHeight) { component.setBounds(newX, newY, newWidth, newHeight); component.revalidate(); // If not null, I'd rather repaint the parent if (component.getParent() != null) component.getParent().repaint(); else component.repaint(); } // setBoundsForFrame()
public void setBoundsForFrame(JComponent component, int newX, int newY, int newWidth, int newHeight) { component.setBounds(newX, newY, newWidth, newHeight); component.revalidate(); // If not null, I'd rather repaint the parent if (component.getParent() != null) component.getParent().repaint(); else component.repaint(); } // setBoundsForFrame()
14,272
protected void setPreviousBounds(JInternalFrame frame, Rectangle rect) { frame.setNormalBounds(rect); } // setPreviousBounds()
protected void setPreviousBounds(JInternalFrame frame, Rectangle rect) { frame.setNormalBounds(rect); } // setPreviousBounds()
14,273
protected void setWasIcon(JInternalFrame frame, boolean value) { frame.setWasIcon(value, WAS_ICON_ONCE_PROPERTY); } // setWasIcon()
protected void setWasIcon(JInternalFrame frame, Boolean value) { frame.setWasIcon(value, WAS_ICON_ONCE_PROPERTY); } // setWasIcon()
14,274
protected void setWasIcon(JInternalFrame frame, boolean value) { frame.setWasIcon(value, WAS_ICON_ONCE_PROPERTY); } // setWasIcon()
protected void setWasIcon(JInternalFrame frame, boolean value) { frame.setWasIcon(value, WAS_ICON_ONCE_PROPERTY); } // setWasIcon()
14,275
protected boolean wasIcon(JInternalFrame frame) { return frame.getWasIcon(); } // wasIcon()
protected boolean wasIcon(JInternalFrame frame) { return frame.getWasIcon(); } // wasIcon()
14,276
public PluginDescriptorModel(XMLElement e) throws PluginException { this(null, null, e); }
public PluginDescriptorModel(XMLElement e) throws PluginException { this(null, null, e); }
14,277
public ClassLoader getPluginClassLoader() { if (classLoader == null) { if (system) { classLoader = ClassLoader.getSystemClassLoader(); } else { if (jarFile == null) { throw new RuntimeException("Cannot create classloader without a jarfile"); } final int reqMax = requires.length; final PluginClassLoader[] preLoaders = new PluginClassLoader[reqMax]; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); final PluginDescriptor reqDescr = registry.getPluginDescriptor(reqId); final ClassLoader cl = reqDescr.getPluginClassLoader(); if (cl instanceof PluginClassLoader) { preLoaders[i] = (PluginClassLoader) cl; } } final PrivilegedAction a = new PrivilegedAction() { public Object run() { return new PluginClassLoader(PluginDescriptorModel.this, jarFile, preLoaders); } }; classLoader = (PluginClassLoader)AccessController.doPrivileged(a); //new PluginClassLoader(jarFile, preLoaders); } } return classLoader; }
public ClassLoader getPluginClassLoader() { if (classLoader == null) { if (system) { classLoader = ClassLoader.getSystemClassLoader(); } else { if (jarFile == null) { throw new RuntimeException("Cannot create classloader without a jarfile"); } final int reqMax = requires.length; final PluginClassLoader[] preLoaders = new PluginClassLoader[reqMax]; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); final PluginDescriptor reqDescr = registry.getPluginDescriptor(reqId); final ClassLoader cl = reqDescr.getPluginClassLoader(); if (cl instanceof PluginClassLoader) { preLoaders[i] = (PluginClassLoader) cl; } } final PrivilegedAction a = new PrivilegedAction() { public Object run() { return new PluginClassLoader(PluginDescriptorModel.this, jarFile, preLoaders); } }; classLoader = (PluginClassLoader)AccessController.doPrivileged(a); //new PluginClassLoader(jarFile, preLoaders); } } return classLoader; }
14,278
public Object run() { return new PluginClassLoader(PluginDescriptorModel.this, jarFile, preLoaders); }
public Object run() { return new PluginClassLoader(PluginDescriptorModel.this, jarFile, preLoaders); }
14,279
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(); } if (runtime != null) { runtime.resolve(); } resolved = true; } }
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(); } if (runtime != null) { runtime.resolve(); } resolved = true; } }
14,280
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(); } if (runtime != null) { runtime.resolve(); } resolved = true; } }
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(); } if (runtime != null) { runtime.resolve(); } resolved = true; } }
14,281
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(); } if (runtime != null) { runtime.resolve(); } resolved = true; } }
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(); } if (runtime != null) { runtime.resolve(); } resolved = true; } }
14,282
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(); } if (runtime != null) { runtime.resolve(); } resolved = true; } }
public final void resolve() throws PluginException { if (!resolved) { for (int i = 0; i < extensions.length; i++) { extensions[i].resolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].resolve(); } for (int i = 0; i < requires.length; i++) { requires[i].resolve(); } if (runtime != null) { runtime.resolve(); } resolved = true; } }
14,283
final void startPlugin() throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
final void startPlugin() throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
14,284
final void startPlugin() throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
final void startPlugin() throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
14,285
final void startPlugin() throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
final void startPlugin() throws PluginException { if (started) { return; } synchronized (this) { if (started || starting) { return; } starting = true; //BootLog.info("Resolve on plugin " + getId()); try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; } }); } catch (PrivilegedActionException ex) { BootLog.error("Error starting plugin", ex); try { Thread.sleep(10000); } catch (InterruptedException ex1) { // Ignore } } finally { started = true; } } }
14,286
public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; }
public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; }
14,287
public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; }
public Object run() throws PluginException { resolve(); final int reqMax = requires.length; for (int i = 0; i < reqMax; i++) { final String reqId = requires[i].getPluginId(); //BootLog.info("Start dependency " + reqId); final PluginDescriptorModel reqDescr = (PluginDescriptorModel)registry.getPluginDescriptor(reqId); reqDescr.startPlugin(); } //BootLog.info("Start myself " + getId()); getPlugin().start(); return null; }
14,288
protected void unresolve() throws PluginException { if (resolved) { if (runtime != null) { runtime.unresolve(); } for (int i = 0; i < requires.length; i++) { requires[i].unresolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].unresolve(); } for (int i = 0; i < extensions.length; i++) { extensions[i].unresolve(); } resolved = false; } }
protected void unresolve() throws PluginException { if (resolved) { if (runtime != null) { runtime.unresolve(); } for (int i = 0; i < requires.length; i++) { requires[i].unresolve(); } for (int i = 0; i < extensionPoints.length; i++) { extensionPoints[i].unresolve(); } for (int i = 0; i < extensions.length; i++) { extensions[i].unresolve(); } resolved = false; } }
14,289
public void startSystemPlugins() throws PluginException { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(START_SYSTEM_PLUGINS_PERM); } // Resolve all plugins ((PluginRegistryModel) registry).resolveDescriptors(); // Set the context classloader Thread.currentThread().setContextClassLoader( registry.getPluginsClassLoader()); // Start the plugins final String cmdLine = (String)AccessController.doPrivileged(new GetPropertyAction("jnode.cmdline", "")); final boolean debug = (cmdLine.indexOf("debug") > 0); final List descrList = createPluginDescriptorList(); // 2 loops, first start all system plugins, // then start all auto-start plugins for (int type = 0; type < 2; type++) { for (Iterator i = descrList.iterator(); i.hasNext();) { final PluginDescriptor descr = (PluginDescriptor) i.next(); try { final boolean start; if (type == 0) { start = descr.isSystemPlugin(); } else { start = (!descr.isSystemPlugin()) && descr.isAutoStart(); } if (start) { if (debug) { Thread.sleep(250); } startSinglePlugin(descr.getPlugin()); } } catch (Throwable ex) { BootLog.error("Cannot start " + descr.getId(), ex); if (debug) { try { Thread.sleep(5000); } catch (InterruptedException ex1) { // Ignore } } } } } // Wait a while until all plugins have finished their startup process if (!isStartPluginsFinished()) { BootLog.info("Waiting for plugins to finished their startprocess"); final long start = System.currentTimeMillis(); long now = start; int loop = 0; while (!isStartPluginsFinished() && (now - start < START_TIMEOUT)) { try { if (++loop == 10) { System.out.print('.'); loop = 0; } Thread.sleep(100); } catch (InterruptedException ex) { // Ignore } now = System.currentTimeMillis(); } System.out.println(); if (now >= START_TIMEOUT) { // List all non-finished plugins listUnfinishedPlugins(); } } }
public void startSystemPlugins(List descriptors) throws PluginException { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(START_SYSTEM_PLUGINS_PERM); } // Resolve all plugins ((PluginRegistryModel) registry).resolveDescriptors(); // Set the context classloader Thread.currentThread().setContextClassLoader( registry.getPluginsClassLoader()); // Start the plugins final String cmdLine = (String)AccessController.doPrivileged(new GetPropertyAction("jnode.cmdline", "")); final boolean debug = (cmdLine.indexOf("debug") > 0); final List descrList = createPluginDescriptorList(); // 2 loops, first start all system plugins, // then start all auto-start plugins for (int type = 0; type < 2; type++) { for (Iterator i = descrList.iterator(); i.hasNext();) { final PluginDescriptor descr = (PluginDescriptor) i.next(); try { final boolean start; if (type == 0) { start = descr.isSystemPlugin(); } else { start = (!descr.isSystemPlugin()) && descr.isAutoStart(); } if (start) { if (debug) { Thread.sleep(250); } startSinglePlugin(descr.getPlugin()); } } catch (Throwable ex) { BootLog.error("Cannot start " + descr.getId(), ex); if (debug) { try { Thread.sleep(5000); } catch (InterruptedException ex1) { // Ignore } } } } } // Wait a while until all plugins have finished their startup process if (!isStartPluginsFinished()) { BootLog.info("Waiting for plugins to finished their startprocess"); final long start = System.currentTimeMillis(); long now = start; int loop = 0; while (!isStartPluginsFinished() && (now - start < START_TIMEOUT)) { try { if (++loop == 10) { System.out.print('.'); loop = 0; } Thread.sleep(100); } catch (InterruptedException ex) { // Ignore } now = System.currentTimeMillis(); } System.out.println(); if (now >= START_TIMEOUT) { // List all non-finished plugins listUnfinishedPlugins(); } } }
14,290
private final void emmitMOV() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: X86Register r1 = X86Register.getRegister(((Register) args[0]).name); X86Register r2 = X86Register.getRegister(((Register) args[1]).name); if (r1 instanceof GPR && r2 instanceof GPR) { stream.writeMOV(operandSize, (GPR) r1, (GPR) r2); } else if (r1 instanceof CRX && r2 instanceof GPR) { stream.writeMOV((CRX) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof CRX) { stream.writeMOV((GPR) r1, (CRX) r2); } else if (r1 instanceof SR && r2 instanceof GPR) { stream.writeMOV((SR) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof SR) { stream.writeMOV((GPR) r1, (SR) r2); } else { throw new IllegalArgumentException("Invalid register usage: mov " + r1 + "," + r2); } break; case RC_ADDR: stream.writeMOV_Const(getReg(0), getInt(1)); break; case RE_ADDR: Address ind = getAddress(1); stream.writeMOV(operandSize, getReg(0), getRegister(ind.getImg()), ind.disp); break; case ER_ADDR: ind = getAddress(0); stream.writeMOV(operandSize, getRegister(ind.getImg()), ind.disp, getReg(1)); break; case EC_ADDR: ind = getAddress(0); stream.writeMOV_Const(operandSize, getRegister(ind.getImg()), ind.disp, getInt(1)); break; default: reportAddressingError(MOV_ISN, addr); } }
private final void emmitMOV() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: X86Register r1 = X86Register.getRegister(((Register) args[0]).name); X86Register r2 = X86Register.getRegister(((Register) args[1]).name); if (r1 instanceof GPR && r2 instanceof GPR) { int s1 = r1.getSize(); int s2 = r2.getSize(); if(s1 != s2){ throw new IllegalArgumentException("Incompatible register pair: " + r1 + "," + r2); } stream.writeMOV(s1, (GPR) r1, (GPR) r2); } else if (r1 instanceof CRX && r2 instanceof GPR) { stream.writeMOV((CRX) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof CRX) { stream.writeMOV((GPR) r1, (CRX) r2); } else if (r1 instanceof SR && r2 instanceof GPR) { stream.writeMOV((SR) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof SR) { stream.writeMOV((GPR) r1, (SR) r2); } else { throw new IllegalArgumentException("Invalid register usage: mov " + r1 + "," + r2); } break; case RC_ADDR: stream.writeMOV_Const(getReg(0), getInt(1)); break; case RE_ADDR: Address ind = getAddress(1); stream.writeMOV(operandSize, getReg(0), getRegister(ind.getImg()), ind.disp); break; case ER_ADDR: ind = getAddress(0); stream.writeMOV(operandSize, getRegister(ind.getImg()), ind.disp, getReg(1)); break; case EC_ADDR: ind = getAddress(0); stream.writeMOV_Const(operandSize, getRegister(ind.getImg()), ind.disp, getInt(1)); break; default: reportAddressingError(MOV_ISN, addr); } }
14,298
private final void emmitMOV() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: X86Register r1 = X86Register.getRegister(((Register) args[0]).name); X86Register r2 = X86Register.getRegister(((Register) args[1]).name); if (r1 instanceof GPR && r2 instanceof GPR) { stream.writeMOV(operandSize, (GPR) r1, (GPR) r2); } else if (r1 instanceof CRX && r2 instanceof GPR) { stream.writeMOV((CRX) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof CRX) { stream.writeMOV((GPR) r1, (CRX) r2); } else if (r1 instanceof SR && r2 instanceof GPR) { stream.writeMOV((SR) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof SR) { stream.writeMOV((GPR) r1, (SR) r2); } else { throw new IllegalArgumentException("Invalid register usage: mov " + r1 + "," + r2); } break; case RC_ADDR: stream.writeMOV_Const(getReg(0), getInt(1)); break; case RE_ADDR: Address ind = getAddress(1); stream.writeMOV(operandSize, getReg(0), getRegister(ind.getImg()), ind.disp); break; case ER_ADDR: ind = getAddress(0); stream.writeMOV(operandSize, getRegister(ind.getImg()), ind.disp, getReg(1)); break; case EC_ADDR: ind = getAddress(0); stream.writeMOV_Const(operandSize, getRegister(ind.getImg()), ind.disp, getInt(1)); break; default: reportAddressingError(MOV_ISN, addr); } }
private final void emmitMOV() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: X86Register r1 = X86Register.getRegister(((Register) args[0]).name); X86Register r2 = X86Register.getRegister(((Register) args[1]).name); if (r1 instanceof GPR && r2 instanceof GPR) { stream.writeMOV(operandSize, (GPR) r1, (GPR) r2); } else if (r1 instanceof CRX && r2 instanceof GPR) { stream.writeMOV((CRX) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof CRX) { stream.writeMOV((GPR) r1, (CRX) r2); } else if (r1 instanceof SR && r2 instanceof GPR) { stream.writeMOV((SR) r1, (GPR) r2); } else if (r1 instanceof GPR && r2 instanceof SR) { stream.writeMOV((GPR) r1, (SR) r2); } else { throw new IllegalArgumentException("Invalid register usage: mov " + r1 + "," + r2); } break; case RC_ADDR: stream.writeMOV_Const(getReg(0), getInt(1)); break; case RE_ADDR: Address ind = getAddress(1); stream.writeMOV(r.getSize(), r, getRegister(ind.getImg()), ind.disp); break; case RA_ADDR: stream.writeMOV(getReg(0), getAddress(1).disp); break; case ER_ADDR: ind = getAddress(0); stream.writeMOV(operandSize, getRegister(ind.getImg()), ind.disp, getReg(1)); break; case EC_ADDR: ind = getAddress(0); stream.writeMOV_Const(operandSize, getRegister(ind.getImg()), ind.disp, getInt(1)); break; default: reportAddressingError(MOV_ISN, addr); } }
14,299
private final void emmitXCHG() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: stream.writeXCHG(getReg(0), getReg(1)); break; case ER_ADDR: Address ind = getAddress(0); stream.writeXCHG(getRegister(ind.getImg()), ind.disp, getReg(1)); break; default: reportAddressingError(XCHG_ISN, addr); } }
private final void emmitXCHG() { int addr = getAddressingMode(2); switch (addr) { case RR_ADDR: stream.writeXCHG(getReg(0), getReg(1)); break; case ER_ADDR: ind = getAddress(0); stream.writeXCHG(getRegister(ind.getImg()), ind.disp, getReg(1)); break; default: reportAddressingError(XCHG_ISN, addr); } }
14,304
private int getAddressingMode(int maxArgs) { int ret = N_ADDR; if (maxArgs > 3) { throw new Error("Invalid number of arguments: " + maxArgs); } for (int i = 0; i < maxArgs; i++) { try { if (operands == null) break; Object o = operands.get(i); if (o == null) break; if (o instanceof Integer) { ret |= CON_ARG << DISP * i; } else if (o instanceof Register) { ret |= REG_ARG << DISP * i; } else if (o instanceof Address) { Address ind = (Address) o; if (ind.reg != null && ind.sreg != null) { ret |= SCL_ARG << DISP * i; } else if (ind.reg != null && ind.sreg == null) { ret |= REL_ARG << DISP * i; } else if (ind.reg == null && ind.sreg != null) { ret |= ZSC_ARG << DISP * i; } else if (ind.reg == null && ind.sreg == null) { ret |= ABS_ARG << DISP * i; } else { throw new IllegalArgumentException("Unknown indirect: " + ind); } } else { throw new IllegalArgumentException("Unknown operand: " + o + " " + o.getClass().getName()); } args[i] = o; } catch (IndexOutOfBoundsException x) { break; } } return ret; }
private int getAddressingMode(int maxArgs) { int ret = N_ADDR; if (maxArgs > 3) { throw new Error("Invalid number of arguments: " + maxArgs); } for (int i = 0; i < maxArgs; i++) { try { if (operands == null) break; Object o = operands.get(i); if (o == null) break; if (o instanceof Integer) { ret |= CON_ARG << DISP * i; } else if (o instanceof Register) { ret |= REG_ARG << DISP * i; } else if (o instanceof Address) { Address ind = (Address) o; if (ind.segment){ ret |= SEG_ARG << DISP * i; } else if (ind.reg != null && ind.sreg != null) { ret |= SCL_ARG << DISP * i; } else if (ind.reg != null && ind.sreg == null) { ret |= REL_ARG << DISP * i; } else if (ind.reg == null && ind.sreg != null) { ret |= ZSC_ARG << DISP * i; } else if (ind.reg == null && ind.sreg == null) { ret |= ABS_ARG << DISP * i; } else { throw new IllegalArgumentException("Unknown indirect: " + ind); } } else { throw new IllegalArgumentException("Unknown operand: " + o + " " + o.getClass().getName()); } args[i] = o; } catch (IndexOutOfBoundsException x) { break; } } return ret; }
14,306
public Error(String s) { super(s); }
public Error() { super(s); }
14,307
public Error(String s) { super(s); }
public Error(String s) { }
14,308
public IllegalArgumentException(String s) { super(s); }
public IllegalArgumentException(String s) { super(s); }
14,309
public static ActionListener add(ActionListener a, ActionListener b) { return (ActionListener) addInternal(a, b); }
public static ComponentListener add(ComponentListener a, ComponentListener b) { return (ActionListener) addInternal(a, b); }
14,310
public static ActionListener add(ActionListener a, ActionListener b) { return (ActionListener) addInternal(a, b); }
public static ActionListener add(ActionListener a, ActionListener b) { return (ComponentListener) addInternal(a, b); }
14,311
public static ActionListener remove(ActionListener l, ActionListener oldl) { return (ActionListener) removeInternal(l, oldl); }
protected EventListener remove(EventListener oldl) { return (ActionListener) removeInternal(l, oldl); }
14,312
public static ActionListener remove(ActionListener l, ActionListener oldl) { return (ActionListener) removeInternal(l, oldl); }
public static ActionListener remove(ActionListener l, ActionListener oldl) { if (a == oldl) return b; if (b == oldl) return a; if (a instanceof AWTEventMulticaster) { EventListener newa = ((AWTEventMulticaster) a).remove(oldl); if (newa != a) return new AWTEventMulticaster(newa, b); } if (b instanceof AWTEventMulticaster) { EventListener newb = ((AWTEventMulticaster) b).remove(oldl); if (newb != b) return new AWTEventMulticaster(a, newb); } return this; }
14,313
public Rectangle(int x, int y, int width, int height) { this.x = x; this.y = y; this.width = width; this.height = height; }
public Rectangle() { this.x = x; this.y = y; this.width = width; this.height = height; }
14,314
public Rectangle(int x, int y, int width, int height) { this.x = x; this.y = y; this.width = width; this.height = height; }
public Rectangle(int x, int y, int width, int height) { this.x = x; this.y = y; this.width = width; this.height = height; }
14,315
public abstract byte get ();
public abstract byte get ();
14,316
public abstract int get (int index);
public abstract int get (int index);
14,317
public abstract char get (int index);
public abstract char get (int index);
14,318
public abstract short get (int index);
public abstract short get (int index);
14,319
public static NumberFormat getInstance (Locale loc) { // For now always return a number instance. return getNumberInstance (loc); }
public static final NumberFormat getInstance () { // For now always return a number instance. return getNumberInstance (loc); }
14,320
public static NumberFormat getInstance (Locale loc) { // For now always return a number instance. return getNumberInstance (loc); }
public static NumberFormat getInstance (Locale loc) { // For now always return a number instance. return getInstance (Locale.getDefault()); }
14,321
public static NumberFormat getCurrencyInstance (Locale loc) { return computeInstance (loc, "currencyFormat", "$#,##0.00;($#,##0.00)"); }
public static final NumberFormat getCurrencyInstance () { return computeInstance (loc, "currencyFormat", "$#,##0.00;($#,##0.00)"); }
14,322
public static NumberFormat getCurrencyInstance (Locale loc) { return computeInstance (loc, "currencyFormat", "$#,##0.00;($#,##0.00)"); }
public static NumberFormat getCurrencyInstance (Locale loc) { return getCurrencyInstance (Locale.getDefault()); }
14,323
public static NumberFormat getPercentInstance (Locale loc) { return computeInstance (loc, "percentFormat", "#,##0%"); }
public static final NumberFormat getPercentInstance () { return computeInstance (loc, "percentFormat", "#,##0%"); }
14,324
public static NumberFormat getPercentInstance (Locale loc) { return computeInstance (loc, "percentFormat", "#,##0%"); }
public static NumberFormat getPercentInstance (Locale loc) { return getPercentInstance (Locale.getDefault()); }
14,325
public static NumberFormat getNumberInstance (Locale loc) { return computeInstance (loc, "numberFormat", "#,##0.###"); }
public static final NumberFormat getNumberInstance () { return computeInstance (loc, "numberFormat", "#,##0.###"); }
14,326
public static NumberFormat getNumberInstance (Locale loc) { return computeInstance (loc, "numberFormat", "#,##0.###"); }
public static NumberFormat getNumberInstance (Locale loc) { return getNumberInstance (Locale.getDefault()); }
14,327
public static final DateFormat getTimeInstance (int style, Locale loc) { return computeInstance (style, loc, false, true); }
public static final DateFormat getTimeInstance () { return computeInstance (style, loc, false, true); }
14,328
public static final DateFormat getTimeInstance (int style, Locale loc) { return computeInstance (style, loc, false, true); }
public static final DateFormat getTimeInstance (int style, Locale loc) { return getTimeInstance (DEFAULT, Locale.getDefault()); }
14,329
public static final DateFormat getDateInstance (int style, Locale loc) { return computeInstance (style, loc, true, false); }
public static final DateFormat getDateInstance () { return computeInstance (style, loc, true, false); }
14,330
public static final DateFormat getDateInstance (int style, Locale loc) { return computeInstance (style, loc, true, false); }
public static final DateFormat getDateInstance (int style, Locale loc) { return getDateInstance (DEFAULT, Locale.getDefault()); }
14,331
public void applyPattern(String pattern) { tokens = new Vector(); compileFormat(pattern); this.pattern = pattern; }
public void applyPattern(String pattern) { tokens = new ArrayList(); compileFormat(pattern); this.pattern = pattern; }
14,332
public FieldPosition (int field_id) { this.field_id = field_id; }
public FieldPosition (Format.Field field) { this.field_id = field_id; }
14,333
public FieldPosition (int field_id) { this.field_id = field_id; }
public FieldPosition (int field_id) { this(field, -1); }
14,334
public abstract StringBuffer format (Object obj, StringBuffer sb, FieldPosition pos) throws IllegalArgumentException;
public abstract StringBuffer format (Object obj, StringBuffer sb, FieldPosition pos) throws IllegalArgumentException;
14,335
public synchronized StringBuffer append(String str) { if (str == null) str = "null"; int len = str.count; ensureCapacity_unsynchronized(count + len); str.getChars(0, len, value, count); count += len; return this; }
public StringBuffer append(Object obj) { if (str == null) str = "null"; int len = str.count; ensureCapacity_unsynchronized(count + len); str.getChars(0, len, value, count); count += len; return this; }
14,336
public synchronized StringBuffer append(String str) { if (str == null) str = "null"; int len = str.count; ensureCapacity_unsynchronized(count + len); str.getChars(0, len, value, count); count += len; return this; }
public synchronized StringBuffer append(String str) { if (str == null) str = "null"; int len = str.count; ensureCapacity_unsynchronized(count + len); str.getChars(0, len, value, count); count += len; return this; }
14,337
public void append (String text) { append (text, null); }
public void append (AttributedCharacterIterator iterator) { append (text, null); }
14,338
public void append (String text) { append (text, null); }
public void append (String text) { char c = iterator.first(); Vector more_ranges = new Vector(); Vector more_attributes = new Vector(); do { formattedString = formattedString + String.valueOf (c); more_attributes.add (iterator.getAttributes()); more_ranges.add (new Integer (formattedString.length())); c = iterator.next(); } while (c != DONE); HashMap[] new_attributes = new HashMap[attributes.length + more_attributes.size()]; int[] new_ranges = new int[ranges.length + more_ranges.size()]; System.arraycopy (attributes, 0, new_attributes, 0, attributes.length); System.arraycopy (more_attributes.toArray(), 0, new_attributes, attributes.length, more_attributes.size()); System.arraycopy (ranges, 0, new_ranges, 0, ranges.length); Object[] new_ranges_array = more_ranges.toArray(); for (int i = 0; i < more_ranges.size();i++) new_ranges[i+ranges.length] = ((Integer) new_ranges_array[i]).intValue(); attributes = new_attributes; ranges = new_ranges; }
14,339
public abstract Object parseObject (String str, ParsePosition pos);
public abstract Object parseObject (String str, ParsePosition pos);
14,340
public abstract int getBeginIndex ();
public abstract int getBeginIndex ();
14,341
public abstract int getEndIndex ();
public abstract int getEndIndex ();
14,342
getAllAttributeKeys();
getAllAttributeKeys();
14,343
public abstract char setIndex (int index) throws IllegalArgumentException;
public abstract char setIndex (int index) throws IllegalArgumentException;
14,344
public ArrayList() { this(DEFAULT_CAPACITY); }
public ArrayList(int capacity) { this(DEFAULT_CAPACITY); }
14,345
public ArrayList() { this(DEFAULT_CAPACITY); }
public ArrayList() { if (capacity < 0) throw new IllegalArgumentException(); data = (E[]) new Object[capacity]; }
14,346
getRunLimit(AttributedCharacterIterator.Attribute attrib);
getRunLimit(AttributedCharacterIterator.Attribute attrib);
14,347
getRunStart(AttributedCharacterIterator.Attribute attrib);
getRunStart(AttributedCharacterIterator.Attribute attrib);
14,348
public abstract int getIndex ();
public abstract int getIndex ();
14,349
getAttribute(AttributedCharacterIterator.Attribute attrib);
getAttribute(AttributedCharacterIterator.Attribute attrib);
14,350
public abstract char next ();
public abstract char next ();
14,351
public <T> T[] toArray(T[] a) { if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; System.arraycopy(data, 0, a, 0, size); return a; }
public Object[] toArray() { if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; System.arraycopy(data, 0, a, 0, size); return a; }
14,352
public <T> T[] toArray(T[] a) { if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; System.arraycopy(data, 0, a, 0, size); return a; }
public <T> T[] toArray(T[] a) { if (a.length < size) a = (T[]) Array.newInstance(a.getClass().getComponentType(), size); else if (a.length > size) a[size] = null; System.arraycopy(data, 0, a, 0, size); return a; }
14,353
public boolean canWrite() { // First do a SecurityCheck before doing anything else. checkWrite(); // Test for existence. This is required by the spec if (! VMFile.exists(path)) return false; if (VMFile.isDirectory(path)) return VMFile.canWriteDirectory(this); else return VMFile.canWrite(path); }
public boolean canWrite() { // First do a SecurityCheck before doing anything else. checkWrite(); // Test for existence. This is required by the spec if (! VMFile.exists(path)) return false; if (VMFile.isDirectory(path)) return VMFile.canWriteDirectory(this); else return VMFile.canWrite(path); }
14,354
private void checkRead() { // Check the SecurityManager SecurityManager s = System.getSecurityManager(); if (s != null) s.checkRead(path); }
private void checkRead() { // Check the SecurityManager SecurityManager s = System.getSecurityManager(); if (s != null) s.checkRead(path); }
14,355
private void checkWrite() { // Check the SecurityManager SecurityManager s = System.getSecurityManager(); if (s != null) s.checkWrite(path); }
private void checkWrite() { // Check the SecurityManager SecurityManager s = System.getSecurityManager(); if (s != null) s.checkWrite(path); }
14,356
public static File createTempFile(String prefix, String suffix) throws IOException { return createTempFile(prefix, suffix, null); }
public static synchronized File createTempFile(String prefix, String suffix, File directory) throws IOException { return createTempFile(prefix, suffix, null); }
14,357
public static File createTempFile(String prefix, String suffix) throws IOException { return createTempFile(prefix, suffix, null); }
public static File createTempFile(String prefix, String suffix) throws IOException { if (directory == null) { String dirname = System.getProperty("java.io.tmpdir"); if (dirname == null) throw new IOException("Cannot determine system temporary directory"); directory = new File(dirname); if (! VMFile.exists(directory.path)) throw new IOException("System temporary directory " + directory.getName() + " does not exist."); if (! VMFile.isDirectory(directory.path)) throw new IOException("System temporary directory " + directory.getName() + " is not really a directory."); } if (prefix.length() < 3) throw new IllegalArgumentException("Prefix too short: " + prefix); if (suffix == null) suffix = ".tmp"; File file; if (!VMFile.IS_DOS_8_3) { do { long now = System.currentTimeMillis(); if (now > last_tmp) { last_tmp = now; n_created = 0; } else n_created++; String name = Long.toHexString(now); if (n_created > 0) name += '_'+Integer.toHexString(n_created); String filename = prefix + name + suffix; file = new File(directory, filename); } while (VMFile.exists(file.path)); } else { if (prefix.length() >= 8) throw new IllegalArgumentException("Prefix too long: " + prefix + "(valid length 3..7)"); long mask = 0x000000ffffFFFFL >> (prefix.length() * 4); do { int n = (int) (System.currentTimeMillis() & mask); String filename = prefix + java.lang.Integer.toHexString(n) + suffix; file = new File(directory, filename); } while (VMFile.exists(file.path)); } SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkWrite(file.getAbsolutePath()); VMFile.create(file.getAbsolutePath()); return file; }
14,358
public synchronized boolean delete() { SecurityManager s = System.getSecurityManager(); if (s != null) s.checkDelete(path); return VMFile.delete(path); }
public synchronized boolean delete() { SecurityManager s = System.getSecurityManager(); if (s != null) s.checkDelete(path); return VMFile.delete(path); }
14,359
public synchronized boolean delete() { SecurityManager s = System.getSecurityManager(); if (s != null) s.checkDelete(path); return VMFile.delete(path); }
public synchronized boolean delete() { SecurityManager s = System.getSecurityManager(); if (s != null) s.checkDelete(path); return VMFile.delete(path); }
14,360
public boolean equals(Object obj) { if (! (obj instanceof File)) return false; File other = (File) obj; if (VMFile.IS_CASE_SENSITIVE) return path.equals(other.path); else return path.equalsIgnoreCase(other.path); }
public boolean equals(Object obj) { if (! (obj instanceof File)) return false; File other = (File) obj; if (VMFile.IS_CASE_SENSITIVE) return path.equals(other.path); else return path.equalsIgnoreCase(other.path); }
14,361
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; }
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; }
14,362
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; }
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; }
14,363
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; }
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; }
14,364
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; }
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; }
14,365
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; }
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; }
14,366
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else return System.getProperty ("user.dir") + separatorChar + path; }
public String getAbsolutePath() { if (isAbsolute()) return path; else if (separatorChar == '\\' && path.length() > 0 && path.charAt (0) == '\\') { // On Windows, even if the path starts with a '\\' it is not // really absolute until we prefix the drive specifier from // the current working directory to it. return System.getProperty ("user.dir").substring (0, 2) + path; } else if (separatorChar == '\\' && path.length() > 1 && path.charAt (1) == ':' && ((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z'))) { // On Windows, a process has a current working directory for // each drive and a path like "G:foo\bar" would mean the // absolute path "G:\wombat\foo\bar" if "\wombat" is the // working directory on the G drive. String drvDir = null; try { drvDir = new File (path.substring (0, 2)).getCanonicalPath(); } catch (IOException e) { drvDir = path.substring (0, 2) + "\\"; } // Note: this would return "C:\\." for the path "C:.", if "\" // is the working folder on the C drive, but this is // consistent with what Sun's JRE 1.4.1.01 actually returns! if (path.length() > 2) return drvDir + '\\' + path.substring (2, path.length()); else return drvDir; } else { String currentDir = System.getProperty("user.dir"); if (currentDir.endsWith(separator)) return currentDir + path; else return currentDir + separator + path; } }
14,367
public String getParent() { String prefix = null; int nameSeqIndex = 0; // The "prefix", if present, is the leading "/" on UNIX and // either the drive specifier (e.g. "C:") or the leading "\\" // of a UNC network path on Windows. if (separatorChar == '/' && path.charAt (0) == '/') { prefix = "/"; nameSeqIndex = 1; } else if (separatorChar == '\\' && path.length() > 1) { if ((path.charAt (0) == '\\' && path.charAt (1) == '\\') || (((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z')) && path.charAt (1) == ':')) { prefix = path.substring (0, 2); nameSeqIndex = 2; } } // According to the JDK docs, the returned parent path is the // portion of the name sequence before the last separator // character, if found, prefixed by the prefix, otherwise null. if (nameSeqIndex < path.length()) { String nameSeq = path.substring (nameSeqIndex, path.length()); int last = nameSeq.lastIndexOf (separatorChar); if (last == -1) return prefix; else if (last == (nameSeq.length() - 1)) // Note: The path would not have a trailing separator // except for cases like "C:\" on Windows (see // normalizePath( )), where Sun's JRE 1.4 returns null. return null; else if (last == 0) last++; if (prefix != null) return prefix + nameSeq.substring (0, last); else return nameSeq.substring (0, last); } else // Sun's JRE 1.4 returns null if the prefix is the only // component of the path - so "/" gives null on UNIX and // "C:", "\\", etc. return null on Windows. return null; }
public String getParent() { String prefix = null; int nameSeqIndex = 0; // The "prefix", if present, is the leading "/" on UNIX and // either the drive specifier (e.g. "C:") or the leading "\\" // of a UNC network path on Windows. if (separatorChar == '/' && path.charAt (0) == '/') { prefix = "/"; nameSeqIndex = 1; } else if (separatorChar == '\\' && path.length() > 1) { if ((path.charAt (0) == '\\' && path.charAt (1) == '\\') || (((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z')) && path.charAt (1) == ':')) { prefix = path.substring (0, 2); nameSeqIndex = 2; } } // According to the JDK docs, the returned parent path is the // portion of the name sequence before the last separator // character, if found, prefixed by the prefix, otherwise null. if (nameSeqIndex < path.length()) { String nameSeq = path.substring (nameSeqIndex, path.length()); int last = nameSeq.lastIndexOf (separatorChar); if (last == -1) return prefix; else if (last == (nameSeq.length() - 1)) // Note: The path would not have a trailing separator // except for cases like "C:\" on Windows (see // normalizePath( )), where Sun's JRE 1.4 returns null. return null; else if (last == 0) last++; if (prefix != null) return prefix + nameSeq.substring (0, last); else return nameSeq.substring (0, last); } else // Sun's JRE 1.4 returns null if the prefix is the only // component of the path - so "/" gives null on UNIX and // "C:", "\\", etc. return null on Windows. return null; }
14,368
public String getParent() { String prefix = null; int nameSeqIndex = 0; // The "prefix", if present, is the leading "/" on UNIX and // either the drive specifier (e.g. "C:") or the leading "\\" // of a UNC network path on Windows. if (separatorChar == '/' && path.charAt (0) == '/') { prefix = "/"; nameSeqIndex = 1; } else if (separatorChar == '\\' && path.length() > 1) { if ((path.charAt (0) == '\\' && path.charAt (1) == '\\') || (((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z')) && path.charAt (1) == ':')) { prefix = path.substring (0, 2); nameSeqIndex = 2; } } // According to the JDK docs, the returned parent path is the // portion of the name sequence before the last separator // character, if found, prefixed by the prefix, otherwise null. if (nameSeqIndex < path.length()) { String nameSeq = path.substring (nameSeqIndex, path.length()); int last = nameSeq.lastIndexOf (separatorChar); if (last == -1) return prefix; else if (last == (nameSeq.length() - 1)) // Note: The path would not have a trailing separator // except for cases like "C:\" on Windows (see // normalizePath( )), where Sun's JRE 1.4 returns null. return null; else if (last == 0) last++; if (prefix != null) return prefix + nameSeq.substring (0, last); else return nameSeq.substring (0, last); } else // Sun's JRE 1.4 returns null if the prefix is the only // component of the path - so "/" gives null on UNIX and // "C:", "\\", etc. return null on Windows. return null; }
public String getParent() { String prefix = null; int nameSeqIndex = 0; // The "prefix", if present, is the leading "/" on UNIX and // either the drive specifier (e.g. "C:") or the leading "\\" // of a UNC network path on Windows. if (separatorChar == '/' && path.charAt (0) == '/') { prefix = "/"; nameSeqIndex = 1; } else if (separatorChar == '\\' && path.length() > 1) { if ((path.charAt (0) == '\\' && path.charAt (1) == '\\') || (((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z')) && path.charAt (1) == ':')) { prefix = path.substring (0, 2); nameSeqIndex = 2; } } // According to the JDK docs, the returned parent path is the // portion of the name sequence before the last separator // character, if found, prefixed by the prefix, otherwise null. if (nameSeqIndex < path.length()) { String nameSeq = path.substring (nameSeqIndex, path.length()); int last = nameSeq.lastIndexOf (separatorChar); if (last == -1) return prefix; else if (last == (nameSeq.length() - 1)) // Note: The path would not have a trailing separator // except for cases like "C:\" on Windows (see // normalizePath( )), where Sun's JRE 1.4 returns null. return null; else if (last == 0) last++; if (prefix != null) return prefix + nameSeq.substring (0, last); else return nameSeq.substring (0, last); } else // Sun's JRE 1.4 returns null if the prefix is the only // component of the path - so "/" gives null on UNIX and // "C:", "\\", etc. return null on Windows. return null; }
14,369
public String getParent() { String prefix = null; int nameSeqIndex = 0; // The "prefix", if present, is the leading "/" on UNIX and // either the drive specifier (e.g. "C:") or the leading "\\" // of a UNC network path on Windows. if (separatorChar == '/' && path.charAt (0) == '/') { prefix = "/"; nameSeqIndex = 1; } else if (separatorChar == '\\' && path.length() > 1) { if ((path.charAt (0) == '\\' && path.charAt (1) == '\\') || (((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z')) && path.charAt (1) == ':')) { prefix = path.substring (0, 2); nameSeqIndex = 2; } } // According to the JDK docs, the returned parent path is the // portion of the name sequence before the last separator // character, if found, prefixed by the prefix, otherwise null. if (nameSeqIndex < path.length()) { String nameSeq = path.substring (nameSeqIndex, path.length()); int last = nameSeq.lastIndexOf (separatorChar); if (last == -1) return prefix; else if (last == (nameSeq.length() - 1)) // Note: The path would not have a trailing separator // except for cases like "C:\" on Windows (see // normalizePath( )), where Sun's JRE 1.4 returns null. return null; else if (last == 0) last++; if (prefix != null) return prefix + nameSeq.substring (0, last); else return nameSeq.substring (0, last); } else // Sun's JRE 1.4 returns null if the prefix is the only // component of the path - so "/" gives null on UNIX and // "C:", "\\", etc. return null on Windows. return null; }
public String getParent() { String prefix = null; int nameSeqIndex = 0; // The "prefix", if present, is the leading "/" on UNIX and // either the drive specifier (e.g. "C:") or the leading "\\" // of a UNC network path on Windows. if (separatorChar == '/' && path.charAt (0) == '/') { prefix = "/"; nameSeqIndex = 1; } else if (separatorChar == '\\' && path.length() > 1) { if ((path.charAt (0) == '\\' && path.charAt (1) == '\\') || (((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z')) && path.charAt (1) == ':')) { prefix = path.substring (0, 2); nameSeqIndex = 2; } } // According to the JDK docs, the returned parent path is the // portion of the name sequence before the last separator // character, if found, prefixed by the prefix, otherwise null. if (nameSeqIndex < path.length()) { String nameSeq = path.substring (nameSeqIndex, path.length()); int last = nameSeq.lastIndexOf (separatorChar); if (last == -1) return prefix; else if (last == (nameSeq.length() - 1)) // Note: The path would not have a trailing separator // except for cases like "C:\" on Windows (see // normalizePath( )), where Sun's JRE 1.4 returns null. return null; else if (last == 0) last++; if (prefix != null) return prefix + nameSeq.substring (0, last); else return nameSeq.substring (0, last); } else // Sun's JRE 1.4 returns null if the prefix is the only // component of the path - so "/" gives null on UNIX and // "C:", "\\", etc. return null on Windows. return null; }
14,370
public String getParent() { String prefix = null; int nameSeqIndex = 0; // The "prefix", if present, is the leading "/" on UNIX and // either the drive specifier (e.g. "C:") or the leading "\\" // of a UNC network path on Windows. if (separatorChar == '/' && path.charAt (0) == '/') { prefix = "/"; nameSeqIndex = 1; } else if (separatorChar == '\\' && path.length() > 1) { if ((path.charAt (0) == '\\' && path.charAt (1) == '\\') || (((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z')) && path.charAt (1) == ':')) { prefix = path.substring (0, 2); nameSeqIndex = 2; } } // According to the JDK docs, the returned parent path is the // portion of the name sequence before the last separator // character, if found, prefixed by the prefix, otherwise null. if (nameSeqIndex < path.length()) { String nameSeq = path.substring (nameSeqIndex, path.length()); int last = nameSeq.lastIndexOf (separatorChar); if (last == -1) return prefix; else if (last == (nameSeq.length() - 1)) // Note: The path would not have a trailing separator // except for cases like "C:\" on Windows (see // normalizePath( )), where Sun's JRE 1.4 returns null. return null; else if (last == 0) last++; if (prefix != null) return prefix + nameSeq.substring (0, last); else return nameSeq.substring (0, last); } else // Sun's JRE 1.4 returns null if the prefix is the only // component of the path - so "/" gives null on UNIX and // "C:", "\\", etc. return null on Windows. return null; }
public String getParent() { String prefix = null; int nameSeqIndex = 0; // The "prefix", if present, is the leading "/" on UNIX and // either the drive specifier (e.g. "C:") or the leading "\\" // of a UNC network path on Windows. if (separatorChar == '/' && path.charAt (0) == '/') { prefix = "/"; nameSeqIndex = 1; } else if (separatorChar == '\\' && path.length() > 1) { if ((path.charAt (0) == '\\' && path.charAt (1) == '\\') || (((path.charAt (0) >= 'a' && path.charAt (0) <= 'z') || (path.charAt (0) >= 'A' && path.charAt (0) <= 'Z')) && path.charAt (1) == ':')) { prefix = path.substring (0, 2); nameSeqIndex = 2; } } // According to the JDK docs, the returned parent path is the // portion of the name sequence before the last separator // character, if found, prefixed by the prefix, otherwise null. if (nameSeqIndex < path.length()) { String nameSeq = path.substring (nameSeqIndex, path.length()); int last = nameSeq.lastIndexOf (separatorChar); if (last == -1) return prefix; else if (last == (nameSeq.length() - 1)) // Note: The path would not have a trailing separator // except for cases like "C:\" on Windows (see // normalizePath( )), where Sun's JRE 1.4 returns null. return null; else if (last == 0) last++; if (prefix != null) return prefix + nameSeq.substring (0, last); else return nameSeq.substring (0, last); } else // Sun's JRE 1.4 returns null if the prefix is the only // component of the path - so "/" gives null on UNIX and // "C:", "\\", etc. return null on Windows. return null; }
14,371
public boolean isAbsolute() { if (separatorChar == '\\') return path.startsWith(dupSeparator) || (path.length() > 2 && ((path.charAt(0) >= 'a' && path.charAt(0) <= 'z') || (path.charAt(0) >= 'A' && path.charAt(0) <= 'Z')) && path.charAt(1) == ':' && path.charAt(2) == '\\'); else return path.startsWith(separator); }
public boolean isAbsolute() { if (separatorChar == '\\') return path.startsWith(dupSeparator) || (path.length() > 2 && ((path.charAt(0) >= 'a' && path.charAt(0) <= 'z') || (path.charAt(0) >= 'A' && path.charAt(0) <= 'Z')) && path.charAt(1) == ':' && path.charAt(2) == '\\'); else return path.startsWith(separator); }
14,372