rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
int MIN = 0; int MAX = 0; int PREF = 0; int[] min = new int[cols.length]; int[] max = new int[cols.length]; int[] pref = new int[cols.length]; for (int i = 0; i < cols.length; ++i) | int average = spill / cols.length; for (int i = 0; i < cols.length; i++) | private void distributeSpill(TableColumn[] cols, int spill) { int MIN = 0; int MAX = 0; int PREF = 0; int[] min = new int[cols.length]; int[] max = new int[cols.length]; int[] pref = new int[cols.length]; for (int i = 0; i < cols.length; ++i) { pref[i] = cols[i].getPreferredWidth(); min[i] = cols[i].getMinWidth(); max[i] = cols[i].getMaxWidth(); PREF += pref[i]; MIN += min[i]; MAX += max[i]; } for (int i = 0; i < cols.length; ++i) { int adj = 0; if (spill > 0) adj = (spill * (pref[i] - min[i])) / (PREF - MIN); else adj = (spill * (max[i] - pref[i])) / (MAX - PREF); cols[i].setWidth(pref[i] + adj); } } |
pref[i] = cols[i].getPreferredWidth(); min[i] = cols[i].getMinWidth(); max[i] = cols[i].getMaxWidth(); PREF += pref[i]; MIN += min[i]; MAX += max[i]; } for (int i = 0; i < cols.length; ++i) { int adj = 0; if (spill > 0) adj = (spill * (pref[i] - min[i])) / (PREF - MIN); else adj = (spill * (max[i] - pref[i])) / (MAX - PREF); cols[i].setWidth(pref[i] + adj); | cols[i].setWidth(cols[i].getWidth() + average); | private void distributeSpill(TableColumn[] cols, int spill) { int MIN = 0; int MAX = 0; int PREF = 0; int[] min = new int[cols.length]; int[] max = new int[cols.length]; int[] pref = new int[cols.length]; for (int i = 0; i < cols.length; ++i) { pref[i] = cols[i].getPreferredWidth(); min[i] = cols[i].getMinWidth(); max[i] = cols[i].getMaxWidth(); PREF += pref[i]; MIN += min[i]; MAX += max[i]; } for (int i = 0; i < cols.length; ++i) { int adj = 0; if (spill > 0) adj = (spill * (pref[i] - min[i])) / (PREF - MIN); else adj = (spill * (max[i] - pref[i])) / (MAX - PREF); cols[i].setWidth(pref[i] + adj); } } |
int spill = prefSum - getWidth(); | int spill = getWidth() - prefSum; | public void doLayout() { TableColumn resizingColumn = null; int ncols = getColumnCount(); if (ncols < 1) return; int[] pref = new int[ncols]; int prefSum = 0; int rCol = -1; if (tableHeader != null) resizingColumn = tableHeader.getResizingColumn(); for (int i = 0; i < ncols; ++i) { TableColumn col = columnModel.getColumn(i); int p = col.getWidth(); pref[i] = p; prefSum += p; if (resizingColumn == col) rCol = i; } int spill = prefSum - getWidth(); if (resizingColumn != null) { TableColumn col; TableColumn [] cols; switch (getAutoResizeMode()) { case AUTO_RESIZE_LAST_COLUMN: col = columnModel.getColumn(ncols-1); col.setWidth(col.getPreferredWidth() + spill); break; case AUTO_RESIZE_NEXT_COLUMN: col = columnModel.getColumn(ncols-1); col.setWidth(col.getPreferredWidth() + spill); break; case AUTO_RESIZE_ALL_COLUMNS: cols = new TableColumn[ncols]; for (int i = 0; i < ncols; ++i) cols[i] = columnModel.getColumn(i); distributeSpill(cols, spill); break; case AUTO_RESIZE_SUBSEQUENT_COLUMNS: cols = new TableColumn[ncols]; for (int i = rCol; i < ncols; ++i) cols[i] = columnModel.getColumn(i); distributeSpill(cols, spill); break; case AUTO_RESIZE_OFF: default: } } else { TableColumn [] cols = new TableColumn[ncols]; for (int i = 0; i < ncols; ++i) cols[i] = columnModel.getColumn(i); distributeSpill(cols, spill); } } |
Unsafe.die(); | public static Throwable systemException(int nr, int address) throws PragmaUninterruptible { //Unsafe.getCurrentProcessor().getArchitecture().getStackReader().debugStackTrace(); String hexAddress = NumberUtils.hex(address, 8); switch (nr) { case EX_NULLPOINTER: return new NullPointerException("NPE at address " + hexAddress); case EX_PAGEFAULT: return new InternalError("Page fault at " + hexAddress); case EX_INDEXOUTOFBOUNDS: return new ArrayIndexOutOfBoundsException("Out of bounds at index " + address); case EX_DIV0: return new ArithmeticException("Division by zero at address " + hexAddress); case EX_ABSTRACTMETHOD: return new AbstractMethodError("Abstract method at " + hexAddress); case EX_STACKOVERFLOW: return new StackOverflowError(); case EX_CLASSCAST: return new ClassCastException(); default: return new UnknownError("Unknown system-exception at " + hexAddress); } } |
|
if (view == null) { String name = element.getName(); if (name.equals(AbstractDocument.ContentElementName)) view = new LabelView(element); else if (name.equals(AbstractDocument.ParagraphElementName)) view = new ParagraphView(element); else if (name.equals(AbstractDocument.SectionElementName)) view = new BoxView(element, View.Y_AXIS); else if (name.equals(StyleConstants.ComponentElementName)) view = new ComponentView(element); else if (name.equals(StyleConstants.IconElementName)) view = new IconView(element); } | public View create(Element element) { View view = null; Object attr = element.getAttributes().getAttribute( StyleConstants.NameAttribute); if (attr instanceof HTML.Tag) { HTML.Tag tag = (HTML.Tag) attr; if (tag.equals(HTML.Tag.IMPLIED) || tag.equals(HTML.Tag.P) || tag.equals(HTML.Tag.H1) || tag.equals(HTML.Tag.H2) || tag.equals(HTML.Tag.H3) || tag.equals(HTML.Tag.H4) || tag.equals(HTML.Tag.H5) || tag.equals(HTML.Tag.H6) || tag.equals(HTML.Tag.DT)) view = new ParagraphView(element); else if (tag.equals(HTML.Tag.LI) || tag.equals(HTML.Tag.DL) || tag.equals(HTML.Tag.DD) || tag.equals(HTML.Tag.BODY) || tag.equals(HTML.Tag.HTML) || tag.equals(HTML.Tag.CENTER) || tag.equals(HTML.Tag.DIV) || tag.equals(HTML.Tag.BLOCKQUOTE) || tag.equals(HTML.Tag.PRE)) view = new BlockView(element, View.Y_AXIS); // FIXME: Uncomment when the views have been implemented else if (tag.equals(HTML.Tag.CONTENT)) view = new InlineView(element); /* else if (tag.equals(HTML.Tag.MENU) || tag.equals(HTML.Tag.DIR) || tag.equals(HTML.Tag.UL) || tag.equals(HTML.Tag.OL)) view = new ListView(element); else if (tag.equals(HTML.Tag.IMG)) view = new ImageView(element); else if (tag.equals(HTML.Tag.HR)) view = new HRuleView(element); else if (tag.equals(HTML.Tag.BR)) view = new BRView(element); else if (tag.equals(HTML.Tag.TABLE)) view = new TableView(element); else if (tag.equals(HTML.Tag.INPUT) || tag.equals(HTML.Tag.SELECT) || tag.equals(HTML.Tag.TEXTAREA)) view = new FormView(element); else if (tag.equals(HTML.Tag.OBJECT)) view = new ObjectView(element); else if (tag.equals(HTML.Tag.FRAMESET)) view = new FrameSetView(element); else if (tag.equals(HTML.Tag.FRAME)) view = new FrameView(element); */ } if (view == null) { String name = element.getName(); if (name.equals(AbstractDocument.ContentElementName)) view = new LabelView(element); else if (name.equals(AbstractDocument.ParagraphElementName)) view = new ParagraphView(element); else if (name.equals(AbstractDocument.SectionElementName)) view = new BoxView(element, View.Y_AXIS); else if (name.equals(StyleConstants.ComponentElementName)) view = new ComponentView(element); else if (name.equals(StyleConstants.IconElementName)) view = new IconView(element); } return view; } |
|
bad.minor = Minor.Any; | public static InconsistentTypeCode extract(Any any) { try { EmptyExceptionHolder h = (EmptyExceptionHolder) any.extract_Streamable(); return (InconsistentTypeCode) h.value; } catch (ClassCastException cex) { BAD_OPERATION bad = new BAD_OPERATION("InconsistentTypeCode expected"); bad.initCause(cex); throw bad; } } |
|
ndx = new Random ().nextInt (256); | while (ndx < 1 || ndx > 255) ndx = (byte) nextByte(); | static final KDF getInstance(final byte[] K) { int ndx = -1; final byte[] keyMaterial; if (K != null) { keyMaterial = K; ndx = 0; } else { keyMaterial = new byte[AES_BLOCK_SIZE]; ndx = new Random ().nextInt (256); // XXX does this need to be secure? } return new KDF(keyMaterial, ndx); } |
if (! componentToLayer.containsKey (c)) throw new IllegalArgumentException (); return ((Integer) componentToLayer.get(c)).intValue(); | Component myComp = c; while(! componentToLayer.containsKey(myComp)) { myComp = myComp.getParent(); if (myComp == null) break; } if (myComp == null) throw new IllegalArgumentException ("component is not in this JLayeredPane"); Integer layerObj = (Integer) componentToLayer.get(myComp); return layerObj.intValue(); | public int getLayer(Component c) { if (! componentToLayer.containsKey (c)) throw new IllegalArgumentException (); return ((Integer) componentToLayer.get(c)).intValue(); } |
return new ChangeHandler(); | return new ChangeHandler((JMenu) c, this); | protected ChangeListener createChangeListener(JComponent c) { return new ChangeHandler(); } |
me.yield(); | public void run () { boolean keepTrucking = true; while (keepTrucking) { try { bk = (Stream5250)dsq.get(); } catch (InterruptedException ie) { System.out.println(" vt thread interrupted and stopping "); keepTrucking = false; continue; } // lets play nicely with the others on the playground me.yield(); pthread.yield(); invited = false; screen52.setCursorOff();// System.out.println("operation code: " + bk.getOpCode()); if (bk == null) continue; switch (bk.getOpCode()) { case 00:// System.out.println("No operation"); break; case 1:// System.out.println("Invite Operation"); parseIncoming(); screen52.setKeyboardLocked(false); cursorOn = true; setInvited(); break; case 2:// System.out.println("Output Only"); parseIncoming();// System.out.println(screen52.dirty); screen52.updateDirty(); // invited = true; break; case 3:// System.out.println("Put/Get Operation"); parseIncoming();// inviteIt =true; setInvited(); break; case 4:// System.out.println("Save Screen Operation"); parseIncoming(); break; case 5:// System.out.println("Restore Screen Operation"); parseIncoming(); break; case 6:// System.out.println("Read Immediate"); sendAidKey(0); break; case 7:// System.out.println("Reserved"); break; case 8:// System.out.println("Read Screen Operation"); try { readScreen(); } catch (IOException ex) { } break; case 9:// System.out.println("Reserved"); break; case 10:// System.out.println("Cancel Invite Operation"); cancelInvite(); break; case 11:// System.out.println("Turn on message light"); screen52.setMessageLightOn(); screen52.setCursorOn(); break; case 12:// System.out.println("Turn off Message light"); screen52.setMessageLightOff(); screen52.setCursorOn(); break; default: break; } if (screen52.isUsingGuiInterface()) screen52.drawFields();// if (screen52.screen[0][1].getChar() == '#' &&// screen52.screen[0][2].getChar() == '!')// execCmd();// else { if (screen52.isHotSpots()) { screen52.checkHotSpots(); } try { screen52.updateDirty(); } catch (Exception exd ) { System.out.println(" tnvt.run: " + exd.getMessage()); } if (cursorOn && !screen52.isKeyboardLocked()) { screen52.setCursorOn(); cursorOn = false; } // lets play nicely with the others on the playground me.yield(); pthread.yield(); } } |
|
updateChildren(ec, ev, vf); | { if (! updateChildren(ec, ev, vf)) ec = null; } | public void changedUpdate(DocumentEvent ev, Shape shape, ViewFactory vf) { Element el = getElement(); DocumentEvent.ElementChange ec = ev.getChange(el); if (ec != null) updateChildren(ec, ev, vf); forwardUpdate(ec, ev, shape, vf); updateLayout(ec, ev, shape); } |
} | public void changedUpdate(DocumentEvent ev, Shape shape, ViewFactory vf) { Element el = getElement(); DocumentEvent.ElementChange ec = ev.getChange(el); if (ec != null) updateChildren(ec, ev, vf); forwardUpdate(ec, ev, shape, vf); updateLayout(ec, ev, shape); } |
|
int endOffset = startOffset + ev.getLength(); | protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent ev, Shape shape, ViewFactory vf) { int count = getViewCount(); if (count > 0) { int startOffset = ev.getOffset(); int endOffset = startOffset + ev.getLength(); int startIndex = getViewIndex(startOffset, Position.Bias.Backward); int endIndex = getViewIndex(endOffset, Position.Bias.Forward); int index = -1; int addLength = -1; if (ec != null) { index = ec.getIndex(); addLength = ec.getChildrenAdded().length; } if (startIndex >= 0 && endIndex >= 0) { for (int i = startIndex; i <= endIndex; i++) { // Skip newly added child views. if (index >= 0 && i >= index && i < (index+addLength)) continue; View child = getView(i); forwardUpdateToView(child, ev, shape, vf); } } } } |
|
int endIndex = getViewIndex(endOffset, Position.Bias.Forward); int index = -1; int addLength = -1; if (ec != null) | if (startIndex == -1 && ev.getType() == DocumentEvent.EventType.REMOVE && startOffset >= getEndOffset()) | protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent ev, Shape shape, ViewFactory vf) { int count = getViewCount(); if (count > 0) { int startOffset = ev.getOffset(); int endOffset = startOffset + ev.getLength(); int startIndex = getViewIndex(startOffset, Position.Bias.Backward); int endIndex = getViewIndex(endOffset, Position.Bias.Forward); int index = -1; int addLength = -1; if (ec != null) { index = ec.getIndex(); addLength = ec.getChildrenAdded().length; } if (startIndex >= 0 && endIndex >= 0) { for (int i = startIndex; i <= endIndex; i++) { // Skip newly added child views. if (index >= 0 && i >= index && i < (index+addLength)) continue; View child = getView(i); forwardUpdateToView(child, ev, shape, vf); } } } } |
index = ec.getIndex(); addLength = ec.getChildrenAdded().length; | startIndex = getViewCount() - 1; | protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent ev, Shape shape, ViewFactory vf) { int count = getViewCount(); if (count > 0) { int startOffset = ev.getOffset(); int endOffset = startOffset + ev.getLength(); int startIndex = getViewIndex(startOffset, Position.Bias.Backward); int endIndex = getViewIndex(endOffset, Position.Bias.Forward); int index = -1; int addLength = -1; if (ec != null) { index = ec.getIndex(); addLength = ec.getChildrenAdded().length; } if (startIndex >= 0 && endIndex >= 0) { for (int i = startIndex; i <= endIndex; i++) { // Skip newly added child views. if (index >= 0 && i >= index && i < (index+addLength)) continue; View child = getView(i); forwardUpdateToView(child, ev, shape, vf); } } } } |
if (startIndex >= 0 && endIndex >= 0) | if (startIndex >= 0) | protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent ev, Shape shape, ViewFactory vf) { int count = getViewCount(); if (count > 0) { int startOffset = ev.getOffset(); int endOffset = startOffset + ev.getLength(); int startIndex = getViewIndex(startOffset, Position.Bias.Backward); int endIndex = getViewIndex(endOffset, Position.Bias.Forward); int index = -1; int addLength = -1; if (ec != null) { index = ec.getIndex(); addLength = ec.getChildrenAdded().length; } if (startIndex >= 0 && endIndex >= 0) { for (int i = startIndex; i <= endIndex; i++) { // Skip newly added child views. if (index >= 0 && i >= index && i < (index+addLength)) continue; View child = getView(i); forwardUpdateToView(child, ev, shape, vf); } } } } |
if (index >= 0 && i >= index && i < (index+addLength)) continue; | if (! (i >= startAdded && i <= endAdded)) { | protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent ev, Shape shape, ViewFactory vf) { int count = getViewCount(); if (count > 0) { int startOffset = ev.getOffset(); int endOffset = startOffset + ev.getLength(); int startIndex = getViewIndex(startOffset, Position.Bias.Backward); int endIndex = getViewIndex(endOffset, Position.Bias.Forward); int index = -1; int addLength = -1; if (ec != null) { index = ec.getIndex(); addLength = ec.getChildrenAdded().length; } if (startIndex >= 0 && endIndex >= 0) { for (int i = startIndex; i <= endIndex; i++) { // Skip newly added child views. if (index >= 0 && i >= index && i < (index+addLength)) continue; View child = getView(i); forwardUpdateToView(child, ev, shape, vf); } } } } |
forwardUpdateToView(child, ev, shape, vf); | if (child != null) { Shape childAlloc = getChildAllocation(i, shape); forwardUpdateToView(child, ev, childAlloc, vf); } | protected void forwardUpdate(DocumentEvent.ElementChange ec, DocumentEvent ev, Shape shape, ViewFactory vf) { int count = getViewCount(); if (count > 0) { int startOffset = ev.getOffset(); int endOffset = startOffset + ev.getLength(); int startIndex = getViewIndex(startOffset, Position.Bias.Backward); int endIndex = getViewIndex(endOffset, Position.Bias.Forward); int index = -1; int addLength = -1; if (ec != null) { index = ec.getIndex(); addLength = ec.getChildrenAdded().length; } if (startIndex >= 0 && endIndex >= 0) { for (int i = startIndex; i <= endIndex; i++) { // Skip newly added child views. if (index >= 0 && i >= index && i < (index+addLength)) continue; View child = getView(i); forwardUpdateToView(child, ev, shape, vf); } } } } |
updateChildren(ec, ev, vf); | { if (! updateChildren(ec, ev, vf)) ec = null; } | public void removeUpdate(DocumentEvent ev, Shape shape, ViewFactory vf) { Element el = getElement(); DocumentEvent.ElementChange ec = ev.getChange(el); if (ec != null) updateChildren(ec, ev, vf); forwardUpdate(ec, ev, shape, vf); updateLayout(ec, ev, shape); } |
return java.lang.reflect.Array.getInt(longDataArray.get(longIndex), shortIndex); | return java.lang.reflect.Array.getInt(longDataArray.get(longIndex+1), shortIndex); | public int getIntData (Locator locator) throws NoDataException { int longIndex = getLongArrayIndex(locator); int shortIndex = getShortArrayIndex(locator); try { if (java.lang.reflect.Array.getByte(longDataArray.get(longIndex), shortIndex) !=1) throw new NoDataException(); //the location we try to access contains noDataValue return java.lang.reflect.Array.getInt(longDataArray.get(longIndex), shortIndex); } catch (Exception e) { //the location we try to access is not allocated, //i.e., no data in the cell throw new NoDataException(); } } |
return java.lang.reflect.Array.getLong(longDataArray.get(longIndex), shortIndex); | return java.lang.reflect.Array.getLong(longDataArray.get(longIndex+1), shortIndex); | public long getLongData (Locator locator) throws NoDataException { int longIndex = getLongArrayIndex(locator); int shortIndex = getShortArrayIndex(locator); try { if (java.lang.reflect.Array.getByte(longDataArray.get(longIndex), shortIndex) !=1) throw new NoDataException(); //the location we try to access contains noDataValue return java.lang.reflect.Array.getLong(longDataArray.get(longIndex), shortIndex); } catch (Exception e) { //the location we try to access is not allocated, //i.e., no data in the cell throw new NoDataException(); } } |
return java.lang.reflect.Array.getShort(longDataArray.get(longIndex), shortIndex); | return java.lang.reflect.Array.getShort(longDataArray.get(longIndex+1), shortIndex); | public short getShortData (Locator locator) throws NoDataException { int longIndex = getLongArrayIndex(locator); int shortIndex = getShortArrayIndex(locator); try { if (java.lang.reflect.Array.getByte(longDataArray.get(longIndex), shortIndex) !=1) throw new NoDataException(); //the location we try to access contains noDataValue return java.lang.reflect.Array.getShort(longDataArray.get(longIndex), shortIndex); } catch (Exception e) { //the location we try to access is not allocated, //i.e., no data in the cell throw new NoDataException(); } } |
if (isShowing ()) { | protected void addImpl(Component comp, Object constraints, int index) { synchronized (getTreeLock ()) { if (index > ncomponents || (index < 0 && index != -1) || comp instanceof Window || (comp instanceof Container && ((Container) comp).isAncestorOf(this))) throw new IllegalArgumentException(); // Reparent component, and make sure component is instantiated if // we are. if (comp.parent != null) comp.parent.remove(comp); comp.parent = this; if (peer != null) { if (comp.isLightweight ()) { enableEvents (comp.eventMask); if (!isLightweight ()) enableEvents (AWTEvent.PAINT_EVENT_MASK); } } invalidate(); if (component == null) component = new Component[4]; // FIXME, better initial size? // This isn't the most efficient implementation. We could do less // copying when growing the array. It probably doesn't matter. if (ncomponents >= component.length) { int nl = component.length * 2; Component[] c = new Component[nl]; System.arraycopy(component, 0, c, 0, ncomponents); component = c; } if (index == -1) component[ncomponents++] = comp; else { System.arraycopy(component, index, component, index + 1, ncomponents - index); component[index] = comp; ++ncomponents; } // Notify the layout manager. if (layoutMgr != null) { if (layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; lm2.addLayoutComponent(comp, constraints); } else if (constraints instanceof String) layoutMgr.addLayoutComponent((String) constraints, comp); else layoutMgr.addLayoutComponent(null, comp); } // Post event to notify of adding the container. ContainerEvent ce = new ContainerEvent(this, ContainerEvent.COMPONENT_ADDED, comp); getToolkit().getSystemEventQueue().postEvent(ce); } } |
|
} | protected void addImpl(Component comp, Object constraints, int index) { synchronized (getTreeLock ()) { if (index > ncomponents || (index < 0 && index != -1) || comp instanceof Window || (comp instanceof Container && ((Container) comp).isAncestorOf(this))) throw new IllegalArgumentException(); // Reparent component, and make sure component is instantiated if // we are. if (comp.parent != null) comp.parent.remove(comp); comp.parent = this; if (peer != null) { if (comp.isLightweight ()) { enableEvents (comp.eventMask); if (!isLightweight ()) enableEvents (AWTEvent.PAINT_EVENT_MASK); } } invalidate(); if (component == null) component = new Component[4]; // FIXME, better initial size? // This isn't the most efficient implementation. We could do less // copying when growing the array. It probably doesn't matter. if (ncomponents >= component.length) { int nl = component.length * 2; Component[] c = new Component[nl]; System.arraycopy(component, 0, c, 0, ncomponents); component = c; } if (index == -1) component[ncomponents++] = comp; else { System.arraycopy(component, index, component, index + 1, ncomponents - index); component[index] = comp; ++ncomponents; } // Notify the layout manager. if (layoutMgr != null) { if (layoutMgr instanceof LayoutManager2) { LayoutManager2 lm2 = (LayoutManager2) layoutMgr; lm2.addLayoutComponent(comp, constraints); } else if (constraints instanceof String) layoutMgr.addLayoutComponent((String) constraints, comp); else layoutMgr.addLayoutComponent(null, comp); } // Post event to notify of adding the container. ContainerEvent ce = new ContainerEvent(this, ContainerEvent.COMPONENT_ADDED, comp); getToolkit().getSystemEventQueue().postEvent(ce); } } |
|
if (isShowing ()) { | public void remove(int index) { synchronized (getTreeLock ()) { Component r = component[index]; r.removeNotify(); System.arraycopy(component, index + 1, component, index, ncomponents - index - 1); component[--ncomponents] = null; invalidate(); if (layoutMgr != null) layoutMgr.removeLayoutComponent(r); r.parent = null; // Post event to notify of adding the container. ContainerEvent ce = new ContainerEvent(this, ContainerEvent.COMPONENT_REMOVED, r); getToolkit().getSystemEventQueue().postEvent(ce); } } |
|
} | public void remove(int index) { synchronized (getTreeLock ()) { Component r = component[index]; r.removeNotify(); System.arraycopy(component, index + 1, component, index, ncomponents - index - 1); component[--ncomponents] = null; invalidate(); if (layoutMgr != null) layoutMgr.removeLayoutComponent(r); r.parent = null; // Post event to notify of adding the container. ContainerEvent ce = new ContainerEvent(this, ContainerEvent.COMPONENT_REMOVED, r); getToolkit().getSystemEventQueue().postEvent(ce); } } |
|
jComponent.getContentPane().setLayout(new SwingFrameLayout(this)); | jComponent.getContentPane().setLayout(new SwingContainerLayout(this)); | public SwingFramePeer(SwingToolkit toolkit, JDesktopPane desktopPane, Frame awtFrame) { super(toolkit, awtFrame, new SwingFrame(awtFrame)); jComponent.initialize(this); SwingToolkit.copyAwtProperties(awtFrame, this.jComponent); jComponent.getContentPane().setLayout(new SwingFrameLayout(this)); jComponent.setLocation(awtFrame.getLocation()); jComponent.setSize(awtFrame.getSize()); setResizable(awtFrame.isResizable()); jComponent.setIconifiable(true); jComponent.setMaximizable(true); jComponent.setClosable(true); try { jComponent.setIcon(awtFrame.getState() == Frame.ICONIFIED); } catch (PropertyVetoException x) { } setState(awtFrame.getState()); jComponent.setTitle(awtFrame.getTitle()); //frame.setIconImage(awtFrame.getIconImage()); setMenuBar(awtFrame.getMenuBar()); desktopPane.add(jComponent); desktopPane.setSelectedFrame(jComponent); jComponent.toFront(); desktopPane.doLayout(); } |
lock.notify(); | lock.notifyAll(); | public void clear() { synchronized (lock) { vector.clear(); lock.notify(); } } |
while (isEmpty()) | while (isEmpty()) { | public Object get() throws InterruptedException { synchronized (lock) { // wait until there is something to read while (isEmpty()) lock.wait(); /** * @todo here is the throttling code to look at * * just something here to try. OK it works but we need to be a little * more intelligent with the throttling. */ if (vector.size() >= 20) { vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0);// System.out.println(vector.size()); } // we have the lock and state we're seeking return vector.remove(0); } } |
} | public Object get() throws InterruptedException { synchronized (lock) { // wait until there is something to read while (isEmpty()) lock.wait(); /** * @todo here is the throttling code to look at * * just something here to try. OK it works but we need to be a little * more intelligent with the throttling. */ if (vector.size() >= 20) { vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0); vector.remove(0);// System.out.println(vector.size()); } // we have the lock and state we're seeking return vector.remove(0); } } |
|
lock.notify(); | lock.notifyAll(); | public void put(Object o) { synchronized (lock) { vector.addElement(o);// if (vector.size() > 5)// System.out.println(vector.size()); // tell waiting threads to wake up lock.notify(); } } |
void visitParameter(Parameter p); | public void visitParameter(Parameter p); | void visitParameter(Parameter p); |
String visitValue(String s, boolean last, int tokenType); | public String visitValue(String s, boolean last, int tokenType); | String visitValue(String s, boolean last, int tokenType); |
this.param = p; String s = p.getName(); if( !Parameter.ANONYMOUS.equals(s) ) { line += "-" + s + " "; } } | this.param = p; if (!p.isAnonymous()) { line += "-" + p.getName() + " "; } } | public void visitParameter(Parameter p) { this.param = p; String s = p.getName(); if( !Parameter.ANONYMOUS.equals(s) ) { line += "-" + s + " "; } } |
private void clearArguments() { for (int i = 0; i < params.length; i++) if (params[i].hasArgument()) params[i].getArgument().clear(); } | final void clearArguments() { for (int i = 0; i < params.length; i++) if (params[ i].hasArgument()) params[ i].getArgument().clear(); } | private void clearArguments() { for (int i = 0; i < params.length; i++) if (params[i].hasArgument()) params[i].getArgument().clear(); } |
CompletionVisitor visitor = new CompletionVisitor(); try { visitCommandLine(partial, visitor); } catch(SyntaxError ex) { throw new CompletionException(ex.getMessage()); } return visitor.getCompletedLine(); } | CompletionVisitor visitor = new CompletionVisitor(); try { visitCommandLine(partial, visitor); } catch (SyntaxErrorException ex) { throw new CompletionException(ex.getMessage()); } return visitor.getCompletedLine(); } | public String complete(CommandLine partial) throws CompletionException { CompletionVisitor visitor = new CompletionVisitor(); try { visitCommandLine(partial, visitor); } catch(SyntaxError ex) { throw new CompletionException(ex.getMessage()); } return visitor.getCompletedLine(); } |
synchronized ParsedArguments parse(String[] args) throws SyntaxError { if (params.length == 0) { if( args.length == 0 ) return new ParsedArguments(new HashMap()); throw new SyntaxError("Syntax takes no parameter"); } | synchronized ParsedArguments parse(String[] args) throws SyntaxErrorException { if (params.length == 0) { if (args.length == 0) { return new ParsedArguments(new HashMap()); } throw new SyntaxErrorException("Syntax takes no parameter"); } | synchronized ParsedArguments parse(String[] args) throws SyntaxError { if (params.length == 0) { if( args.length == 0 ) return new ParsedArguments(new HashMap()); throw new SyntaxError("Syntax takes no parameter"); } CommandLine cmdLine = new CommandLine(args); ParseVisitor visitor = new ParseVisitor(); visitCommandLine(cmdLine, visitor); ParsedArguments result = new ParsedArguments(visitor.getArgumentMap()); // check if all mandatory parameters are set for( int i = 0; i < params.length; i++ ) if( !params[i].isOptional() && !params[i].isSet(result) ) throw new SyntaxError("Mandatory parameter " + params[i].getName() + " not set"); return result; } |
CommandLine cmdLine = new CommandLine(args); ParseVisitor visitor = new ParseVisitor(); visitCommandLine(cmdLine, visitor); ParsedArguments result = new ParsedArguments(visitor.getArgumentMap()); | final CommandLine cmdLine = new CommandLine(args); final ParseVisitor visitor = new ParseVisitor(); visitCommandLine(cmdLine, visitor); final ParsedArguments result = new ParsedArguments(visitor .getArgumentMap()); | synchronized ParsedArguments parse(String[] args) throws SyntaxError { if (params.length == 0) { if( args.length == 0 ) return new ParsedArguments(new HashMap()); throw new SyntaxError("Syntax takes no parameter"); } CommandLine cmdLine = new CommandLine(args); ParseVisitor visitor = new ParseVisitor(); visitCommandLine(cmdLine, visitor); ParsedArguments result = new ParsedArguments(visitor.getArgumentMap()); // check if all mandatory parameters are set for( int i = 0; i < params.length; i++ ) if( !params[i].isOptional() && !params[i].isSet(result) ) throw new SyntaxError("Mandatory parameter " + params[i].getName() + " not set"); return result; } |
for( int i = 0; i < params.length; i++ ) if( !params[i].isOptional() && !params[i].isSet(result) ) throw new SyntaxError("Mandatory parameter " + params[i].getName() + " not set"); return result; } | for (int i = 0; i < params.length; i++) { final Parameter p = params[ i]; if (!p.isOptional()) { if (!p.isSet(result)) { throw new SyntaxErrorException( "Mandatory parameter " + p.getName() + " not set"); } } } return result; } | synchronized ParsedArguments parse(String[] args) throws SyntaxError { if (params.length == 0) { if( args.length == 0 ) return new ParsedArguments(new HashMap()); throw new SyntaxError("Syntax takes no parameter"); } CommandLine cmdLine = new CommandLine(args); ParseVisitor visitor = new ParseVisitor(); visitCommandLine(cmdLine, visitor); ParsedArguments result = new ParsedArguments(visitor.getArgumentMap()); // check if all mandatory parameters are set for( int i = 0; i < params.length; i++ ) if( !params[i].isOptional() && !params[i].isSet(result) ) throw new SyntaxError("Mandatory parameter " + params[i].getName() + " not set"); return result; } |
private synchronized void visitCommandLine(CommandLine cmdLine, CommandLineVisitor visitor) { clearArguments(); Parameter param = null; do { String s = ""; if( cmdLine.hasNext() ) s = cmdLine.next(); | private synchronized void visitCommandLine(CommandLine cmdLine, CommandLineVisitor visitor) throws SyntaxErrorException { clearArguments(); Parameter param = null; final AnonymousIterator anonIterator = new AnonymousIterator(); do { String s = ""; if (cmdLine.hasNext()) s = cmdLine.next(); | private synchronized void visitCommandLine(CommandLine cmdLine, CommandLineVisitor visitor) { clearArguments(); Parameter param = null; do { String s = ""; if( cmdLine.hasNext() ) s = cmdLine.next(); // TODO: it didn't handle correctly the parameters starting with "-" /*if (s.startsWith("-") && (cmdLine.getTokenType() == CommandLine.LITERAL)) { // we got a named parameter here if (param != null) // last param takes an argument, but it's not given throw new SyntaxError("Unexpected Parameter " + s); param = getParameter(s.substring(1)); if (param == null) throw new SyntaxError("Unknown Parameter \"" + s + "\""); visitor.visitParameter(param); } else { // we got an argument */ if (param == null) {// must be an argument for an anonymous parameter param = getAnonymousParameter(); if (param == null) {// but...there are no more of them throw new SyntaxError("Unexpected argument \"" + s + "\""); } else { visitor.visitParameter(param); } //} // no check if there is an argument, as else we would have exited before (Parameter satisfied) Argument arg = param.getArgument(); String value = visitor.visitValue(s, !cmdLine.hasNext(), cmdLine.getTokenType()); if( value != null ) arg.setValue(value); } if (param.isSatisfied()) param = null; } while (cmdLine.hasNext()); } |
/*if (s.startsWith("-") && (cmdLine.getTokenType() == CommandLine.LITERAL)) { if (param != null) throw new SyntaxError("Unexpected Parameter " + s); | private synchronized void visitCommandLine(CommandLine cmdLine, CommandLineVisitor visitor) { clearArguments(); Parameter param = null; do { String s = ""; if( cmdLine.hasNext() ) s = cmdLine.next(); // TODO: it didn't handle correctly the parameters starting with "-" /*if (s.startsWith("-") && (cmdLine.getTokenType() == CommandLine.LITERAL)) { // we got a named parameter here if (param != null) // last param takes an argument, but it's not given throw new SyntaxError("Unexpected Parameter " + s); param = getParameter(s.substring(1)); if (param == null) throw new SyntaxError("Unknown Parameter \"" + s + "\""); visitor.visitParameter(param); } else { // we got an argument */ if (param == null) {// must be an argument for an anonymous parameter param = getAnonymousParameter(); if (param == null) {// but...there are no more of them throw new SyntaxError("Unexpected argument \"" + s + "\""); } else { visitor.visitParameter(param); } //} // no check if there is an argument, as else we would have exited before (Parameter satisfied) Argument arg = param.getArgument(); String value = visitor.visitValue(s, !cmdLine.hasNext(), cmdLine.getTokenType()); if( value != null ) arg.setValue(value); } if (param.isSatisfied()) param = null; } while (cmdLine.hasNext()); } |
|
param = getParameter(s.substring(1)); if (param == null) throw new SyntaxError("Unknown Parameter \"" + s + "\""); visitor.visitParameter(param); } else { if (param == null) { param = getAnonymousParameter(); if (param == null) { throw new SyntaxError("Unexpected argument \"" + s + "\""); } else { visitor.visitParameter(param); } | if (param == null) { if (anonIterator.hasNext()) { param = (Parameter) anonIterator.next(); visitor.visitParameter(param); } else { throw new SyntaxErrorException("Unexpected argument \"" + s + "\""); } | private synchronized void visitCommandLine(CommandLine cmdLine, CommandLineVisitor visitor) { clearArguments(); Parameter param = null; do { String s = ""; if( cmdLine.hasNext() ) s = cmdLine.next(); // TODO: it didn't handle correctly the parameters starting with "-" /*if (s.startsWith("-") && (cmdLine.getTokenType() == CommandLine.LITERAL)) { // we got a named parameter here if (param != null) // last param takes an argument, but it's not given throw new SyntaxError("Unexpected Parameter " + s); param = getParameter(s.substring(1)); if (param == null) throw new SyntaxError("Unknown Parameter \"" + s + "\""); visitor.visitParameter(param); } else { // we got an argument */ if (param == null) {// must be an argument for an anonymous parameter param = getAnonymousParameter(); if (param == null) {// but...there are no more of them throw new SyntaxError("Unexpected argument \"" + s + "\""); } else { visitor.visitParameter(param); } //} // no check if there is an argument, as else we would have exited before (Parameter satisfied) Argument arg = param.getArgument(); String value = visitor.visitValue(s, !cmdLine.hasNext(), cmdLine.getTokenType()); if( value != null ) arg.setValue(value); } if (param.isSatisfied()) param = null; } while (cmdLine.hasNext()); } |
Argument arg = param.getArgument(); String value = visitor.visitValue(s, !cmdLine.hasNext(), cmdLine.getTokenType()); if( value != null ) arg.setValue(value); } if (param.isSatisfied()) param = null; } while (cmdLine.hasNext()); } | final boolean last = !cmdLine.hasNext(); Argument arg = param.getArgument(); String value = visitor.visitValue(s, last, cmdLine.getTokenType()); if (value != null) { if (visitor.isValueValid(arg, value, last)) { arg.setValue(value); } else { throw new SyntaxErrorException("Invalid value for argument"); } } } if (param.isSatisfied()) param = null; } while (cmdLine.hasNext()); } | private synchronized void visitCommandLine(CommandLine cmdLine, CommandLineVisitor visitor) { clearArguments(); Parameter param = null; do { String s = ""; if( cmdLine.hasNext() ) s = cmdLine.next(); // TODO: it didn't handle correctly the parameters starting with "-" /*if (s.startsWith("-") && (cmdLine.getTokenType() == CommandLine.LITERAL)) { // we got a named parameter here if (param != null) // last param takes an argument, but it's not given throw new SyntaxError("Unexpected Parameter " + s); param = getParameter(s.substring(1)); if (param == null) throw new SyntaxError("Unknown Parameter \"" + s + "\""); visitor.visitParameter(param); } else { // we got an argument */ if (param == null) {// must be an argument for an anonymous parameter param = getAnonymousParameter(); if (param == null) {// but...there are no more of them throw new SyntaxError("Unexpected argument \"" + s + "\""); } else { visitor.visitParameter(param); } //} // no check if there is an argument, as else we would have exited before (Parameter satisfied) Argument arg = param.getArgument(); String value = visitor.visitValue(s, !cmdLine.hasNext(), cmdLine.getTokenType()); if( value != null ) arg.setValue(value); } if (param.isSatisfied()) param = null; } while (cmdLine.hasNext()); } |
try { helper.getVmClass(child); } catch (NullPointerException ex) { Unsafe.debug("\nObject type "); Unsafe.debug(vmClass.getName()); Unsafe.debug("\nChild addr "); Unsafe.debug(helper.addressOf32(child)); Unsafe.debug("\nField offset "); Unsafe.debug(offset); Unsafe.debug("\nC.IsObject? "); Unsafe.debug(heapManager.isObject(helper.addressOf(child)) ? "Yes" : "No"); Unsafe.debug("\nO.IsObject? "); Unsafe.debug(heapManager.isObject(helper.addressOf(object)) ? "Yes" : "No"); Unsafe.debug('\n'); helper.die("NPE in processChild; probably corrupted heap"); } | private void markObject(Object object, VmNormalClass vmClass) { final int[] referenceOffsets = vmClass.getReferenceOffsets(); final int cnt = referenceOffsets.length; final int size = vmClass.getObjectSize(); for (int i = 0; i < cnt; i++) { int offset = referenceOffsets[ i]; if ((offset < 0) || (offset >= size)) { Unsafe.debug("reference offset out of range!"); Unsafe.debug(vmClass.getName()); helper.die("Class internal error"); } else { final Object child = helper.getObject(object, offset); if (child != null) { processChild(child); } } } } |
|
stack.push(child); | try { helper.getVmClass(child); stack.push(child); } catch (NullPointerException ex) { Unsafe.debug("\nObject address "); Unsafe.debug(helper.addressOf32(child)); Unsafe.debug("\nObject TIB "); Unsafe.debug(helper.addressOf32(helper.getTib(child))); helper.die("NPE in processChild; probably corrupted heap"); } | private void processChild(Object child) { final int gcColor = helper.getObjectColor(child); if (gcColor <= GC_WHITE) { // Yellow or White helper.atomicChangeObjectColor(child, gcColor, GC_GREY); stack.push(child); } } |
try { helper.getVmClass(object); } catch (NullPointerException ex) { Unsafe.debug("\nObject address "); Unsafe.debug(helper.addressOf32(object)); Unsafe.debug("\nObject TIB "); Unsafe.debug(helper.addressOf32(helper.getTib(object))); helper.die("NPE in processChild; probably corrupted heap"); } | public boolean visit(Object object) { // Be very paranoia for now /* * if (!heapManager.isObject(helper.addressOf(object))) { * Unsafe.debug("visit got non-object"); * Unsafe.debug(helper.addressToLong(helper.addressOf(object))); * Unsafe.getCurrentProcessor().getArchitecture().getStackReader() * .debugStackTrace(); helper.die("Internal error"); return false; */ //testObject(object, Unsafe.getVmClass(object)); // Check the current color first, since a stackoverflow of // the mark stack results in another iteration of visits. final int gcColor = helper.getObjectColor(object); if (gcColor == GC_BLACK) { return true; } else if (rootSet || (gcColor == GC_GREY)) { switch (gcColor) { case GC_WHITE: case GC_YELLOW: { final boolean ok; ok = helper.atomicChangeObjectColor(object, gcColor, GC_GREY); if (!ok) { Unsafe.debug("Could not change object color. "); } } break; case GC_GREY: break; default: { Unsafe.debug("color"); Unsafe.debug(gcColor); helper.die("Unknown GC color on object"); } } stack.push(object); mark(); } final boolean rc = (!stack.isOverflow()); return rc; } |
|
if (result == null) { throw new IllegalStateException("Null object found on GCStack"); } | public Object pop() { if (stackPtr == 0) { return null; } else { stackPtr--; Object result = stack[stackPtr]; stack[stackPtr] = null; return result; } } |
|
public void changedUpdate(DocumentEvent ev, Shape a, ViewFactory fv) | public void changedUpdate(DocumentEvent ev, Shape a, ViewFactory vf) | public void changedUpdate(DocumentEvent ev, Shape a, ViewFactory fv) { setPropertiesFromAttributes(); } |
layoutChanged(X_AXIS); layoutChanged(Y_AXIS); super.changedUpdate(ev, a, vf); | public void changedUpdate(DocumentEvent ev, Shape a, ViewFactory fv) { setPropertiesFromAttributes(); } |
|
align = super.getAlignment(axis); | align = 0.5F; | public float getAlignment(int axis) { float align; if (axis == X_AXIS) align = super.getAlignment(axis); else if (getViewCount() > 0) { float prefHeight = getPreferredSpan(Y_AXIS); float firstRowHeight = getView(0).getPreferredSpan(Y_AXIS); align = (firstRowHeight / 2.F) / prefHeight; } else align = 0.0F; return align; } |
align = 0.0F; | align = 0.5F; | public float getAlignment(int axis) { float align; if (axis == X_AXIS) align = super.getAlignment(axis); else if (getViewCount() > 0) { float prefHeight = getPreferredSpan(Y_AXIS); float firstRowHeight = getView(0).getPreferredSpan(Y_AXIS); align = (firstRowHeight / 2.F) / prefHeight; } else align = 0.0F; return align; } |
throw new IllegalArgumentException("classname: " + e.getMessage()); | IllegalArgumentException iae; iae = new IllegalArgumentException("mimeString: " + mimeString + " classLoader: " + classLoader); iae.initCause(e); throw iae; | private static Class getRepresentationClassFromMime(String mimeString, ClassLoader classLoader) { String classname = getParameter("class", mimeString); if (classname != null) { try { return tryToLoadClass(classname, classLoader); } catch(Exception e) { throw new IllegalArgumentException("classname: " + e.getMessage()); } } else return java.io.InputStream.class; } |
return(Class.forName(className)); | return Class.forName(className); | protected static final Class tryToLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException { try { return(Class.forName(className)); } catch(Exception e) { ; } // Commented out for Java 1.1 /* try { return(className.getClass().getClassLoader().findClass(className)); } catch(Exception e) { ; } try { return(ClassLoader.getSystemClassLoader().findClass(className)); } catch(Exception e) { ; } */ // FIXME: What is the context class loader? /* try { } catch(Exception e) { ; } */ if (classLoader != null) return(classLoader.loadClass(className)); else throw new ClassNotFoundException(className); } |
catch(Exception e) { ; } /* | catch(ClassNotFoundException cnfe) { } | protected static final Class tryToLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException { try { return(Class.forName(className)); } catch(Exception e) { ; } // Commented out for Java 1.1 /* try { return(className.getClass().getClassLoader().findClass(className)); } catch(Exception e) { ; } try { return(ClassLoader.getSystemClassLoader().findClass(className)); } catch(Exception e) { ; } */ // FIXME: What is the context class loader? /* try { } catch(Exception e) { ; } */ if (classLoader != null) return(classLoader.loadClass(className)); else throw new ClassNotFoundException(className); } |
return(className.getClass().getClassLoader().findClass(className)); | ClassLoader loader = ClassLoader.getSystemClassLoader(); return Class.forName(className, true, loader); } catch(ClassNotFoundException cnfe) { | protected static final Class tryToLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException { try { return(Class.forName(className)); } catch(Exception e) { ; } // Commented out for Java 1.1 /* try { return(className.getClass().getClassLoader().findClass(className)); } catch(Exception e) { ; } try { return(ClassLoader.getSystemClassLoader().findClass(className)); } catch(Exception e) { ; } */ // FIXME: What is the context class loader? /* try { } catch(Exception e) { ; } */ if (classLoader != null) return(classLoader.loadClass(className)); else throw new ClassNotFoundException(className); } |
catch(Exception e) { ; } | protected static final Class tryToLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException { try { return(Class.forName(className)); } catch(Exception e) { ; } // Commented out for Java 1.1 /* try { return(className.getClass().getClassLoader().findClass(className)); } catch(Exception e) { ; } try { return(ClassLoader.getSystemClassLoader().findClass(className)); } catch(Exception e) { ; } */ // FIXME: What is the context class loader? /* try { } catch(Exception e) { ; } */ if (classLoader != null) return(classLoader.loadClass(className)); else throw new ClassNotFoundException(className); } |
|
return(ClassLoader.getSystemClassLoader().findClass(className)); | ClassLoader loader = Thread.currentThread().getContextClassLoader(); return Class.forName(className, true, loader); } catch(ClassNotFoundException cnfe) { | protected static final Class tryToLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException { try { return(Class.forName(className)); } catch(Exception e) { ; } // Commented out for Java 1.1 /* try { return(className.getClass().getClassLoader().findClass(className)); } catch(Exception e) { ; } try { return(ClassLoader.getSystemClassLoader().findClass(className)); } catch(Exception e) { ; } */ // FIXME: What is the context class loader? /* try { } catch(Exception e) { ; } */ if (classLoader != null) return(classLoader.loadClass(className)); else throw new ClassNotFoundException(className); } |
catch(Exception e) { ; } */ | protected static final Class tryToLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException { try { return(Class.forName(className)); } catch(Exception e) { ; } // Commented out for Java 1.1 /* try { return(className.getClass().getClassLoader().findClass(className)); } catch(Exception e) { ; } try { return(ClassLoader.getSystemClassLoader().findClass(className)); } catch(Exception e) { ; } */ // FIXME: What is the context class loader? /* try { } catch(Exception e) { ; } */ if (classLoader != null) return(classLoader.loadClass(className)); else throw new ClassNotFoundException(className); } |
|
return(classLoader.loadClass(className)); else | return Class.forName(className, true, classLoader); | protected static final Class tryToLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException { try { return(Class.forName(className)); } catch(Exception e) { ; } // Commented out for Java 1.1 /* try { return(className.getClass().getClassLoader().findClass(className)); } catch(Exception e) { ; } try { return(ClassLoader.getSystemClassLoader().findClass(className)); } catch(Exception e) { ; } */ // FIXME: What is the context class loader? /* try { } catch(Exception e) { ; } */ if (classLoader != null) return(classLoader.loadClass(className)); else throw new ClassNotFoundException(className); } |
FSDriverUtils.getIDEDeviceFactory(); | IDEDriverUtils.getIDEDeviceFactory(); | public void init(TestConfig config, MockObjectTestCase testCase) throws NameAlreadyBoundException, NamingException, IllegalArgumentException, DriverException, ResourceNotFreeException { IDEDiskDriver driver = new IDEDiskDriver(); // set the current testCase for our factory MockIDEDeviceFactory factory = (MockIDEDeviceFactory) FSDriverUtils.getIDEDeviceFactory(); factory.setTestCase(testCase); // create stub resource manager MockObjectFactory.createResourceManager(testCase); // create stub IDE device Device parent = createParentDevice(DEVICE_SIZE); IDEDevice device = MockObjectFactory.createIDEDevice(parent, testCase, true, SLOW_DEVICE_SIZE); init(null, driver, device); } |
Class cls = Class.forName(toolkit_name); | ClassLoader cl = Thread.currentThread().getContextClassLoader(); Class cls = cl.loadClass(toolkit_name); | public static Toolkit getDefaultToolkit() { if (toolkit != null) return toolkit; String toolkit_name = System.getProperty("awt.toolkit", default_toolkit_name); try { Class cls = Class.forName(toolkit_name); Object obj = cls.newInstance(); if (!(obj instanceof Toolkit)) throw new AWTError(toolkit_name + " is not a subclass of " + "java.awt.Toolkit"); toolkit = (Toolkit) obj; return toolkit; } catch (ThreadDeath death) { throw death; } catch (Throwable t) { AWTError e = new AWTError("Cannot load AWT toolkit: " + toolkit_name); throw (AWTError) e.initCause(t); } } |
System.out.println("args IS -------------'" + args); | synchronized void newSession(String sel,String[] args) { Properties sesProps = new Properties(); String propFileName = null; String session = args[0]; // Start loading properties sesProps.put(SESSION_HOST,session); if (isSpecified("-e",args)) sesProps.put(SESSION_TN_ENHANCED,"1"); if (isSpecified("-p",args)) { sesProps.put(SESSION_HOST_PORT,getParm("-p",args)); } if (isSpecified("-f",args)) propFileName = getParm("-f",args); if (isSpecified("-cp",args)) sesProps.put(SESSION_CODE_PAGE ,getParm("-cp",args)); if (isSpecified("-gui",args)) sesProps.put(SESSION_USE_GUI,"1"); if (isSpecified("-132",args)) sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_27X132_STR); else sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_24X80_STR); // are we to use a socks proxy if (isSpecified("-usp",args)) { // socks proxy host argument if (isSpecified("-sph",args)) { sesProps.put(SESSION_PROXY_HOST ,getParm("-sph",args)); } // socks proxy port argument if (isSpecified("-spp",args)) sesProps.put(SESSION_PROXY_PORT ,getParm("-spp",args)); } // are we to use a ssl and if we are what type if (isSpecified("-sslType",args)) { sesProps.put(SSL_TYPE,getParm("-sslType",args)); } System.out.println("args IS -------------'" + args); // check if device name is specified if (isSpecified("-dn=hostname",args)){ String dnParam; // use IP address as device name try{ dnParam = InetAddress.getLocalHost().getHostName(); } catch(UnknownHostException uhe){ dnParam = "UNKNOWN_HOST"; } System.out.println("DNNAME IS -------------'" + dnParam); sesProps.put(SESSION_DEVICE_NAME ,dnParam); } else if (isSpecified("-dn",args)){ System.out.println("Got param" + getParm("-dn",args)); sesProps.put(SESSION_DEVICE_NAME ,getParm("-dn",args)); } Session s = manager.openSession(sesProps,propFileName,sel); if (!frame1.isVisible()) { splash.updateProgress(++step); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { if (isSpecified("-noembed",args)) { splash.updateProgress(++step); newView(); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } if (isSpecified("-t",args)) frame1.addSessionView(sel,s); else frame1.addSessionView(session,s); s.connect(); } |
|
System.out.println("DNNAME IS -------------'" + dnParam); | synchronized void newSession(String sel,String[] args) { Properties sesProps = new Properties(); String propFileName = null; String session = args[0]; // Start loading properties sesProps.put(SESSION_HOST,session); if (isSpecified("-e",args)) sesProps.put(SESSION_TN_ENHANCED,"1"); if (isSpecified("-p",args)) { sesProps.put(SESSION_HOST_PORT,getParm("-p",args)); } if (isSpecified("-f",args)) propFileName = getParm("-f",args); if (isSpecified("-cp",args)) sesProps.put(SESSION_CODE_PAGE ,getParm("-cp",args)); if (isSpecified("-gui",args)) sesProps.put(SESSION_USE_GUI,"1"); if (isSpecified("-132",args)) sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_27X132_STR); else sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_24X80_STR); // are we to use a socks proxy if (isSpecified("-usp",args)) { // socks proxy host argument if (isSpecified("-sph",args)) { sesProps.put(SESSION_PROXY_HOST ,getParm("-sph",args)); } // socks proxy port argument if (isSpecified("-spp",args)) sesProps.put(SESSION_PROXY_PORT ,getParm("-spp",args)); } // are we to use a ssl and if we are what type if (isSpecified("-sslType",args)) { sesProps.put(SSL_TYPE,getParm("-sslType",args)); } System.out.println("args IS -------------'" + args); // check if device name is specified if (isSpecified("-dn=hostname",args)){ String dnParam; // use IP address as device name try{ dnParam = InetAddress.getLocalHost().getHostName(); } catch(UnknownHostException uhe){ dnParam = "UNKNOWN_HOST"; } System.out.println("DNNAME IS -------------'" + dnParam); sesProps.put(SESSION_DEVICE_NAME ,dnParam); } else if (isSpecified("-dn",args)){ System.out.println("Got param" + getParm("-dn",args)); sesProps.put(SESSION_DEVICE_NAME ,getParm("-dn",args)); } Session s = manager.openSession(sesProps,propFileName,sel); if (!frame1.isVisible()) { splash.updateProgress(++step); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { if (isSpecified("-noembed",args)) { splash.updateProgress(++step); newView(); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } if (isSpecified("-t",args)) frame1.addSessionView(sel,s); else frame1.addSessionView(session,s); s.connect(); } |
|
System.out.println("Got param" + getParm("-dn",args)); | synchronized void newSession(String sel,String[] args) { Properties sesProps = new Properties(); String propFileName = null; String session = args[0]; // Start loading properties sesProps.put(SESSION_HOST,session); if (isSpecified("-e",args)) sesProps.put(SESSION_TN_ENHANCED,"1"); if (isSpecified("-p",args)) { sesProps.put(SESSION_HOST_PORT,getParm("-p",args)); } if (isSpecified("-f",args)) propFileName = getParm("-f",args); if (isSpecified("-cp",args)) sesProps.put(SESSION_CODE_PAGE ,getParm("-cp",args)); if (isSpecified("-gui",args)) sesProps.put(SESSION_USE_GUI,"1"); if (isSpecified("-132",args)) sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_27X132_STR); else sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_24X80_STR); // are we to use a socks proxy if (isSpecified("-usp",args)) { // socks proxy host argument if (isSpecified("-sph",args)) { sesProps.put(SESSION_PROXY_HOST ,getParm("-sph",args)); } // socks proxy port argument if (isSpecified("-spp",args)) sesProps.put(SESSION_PROXY_PORT ,getParm("-spp",args)); } // are we to use a ssl and if we are what type if (isSpecified("-sslType",args)) { sesProps.put(SSL_TYPE,getParm("-sslType",args)); } System.out.println("args IS -------------'" + args); // check if device name is specified if (isSpecified("-dn=hostname",args)){ String dnParam; // use IP address as device name try{ dnParam = InetAddress.getLocalHost().getHostName(); } catch(UnknownHostException uhe){ dnParam = "UNKNOWN_HOST"; } System.out.println("DNNAME IS -------------'" + dnParam); sesProps.put(SESSION_DEVICE_NAME ,dnParam); } else if (isSpecified("-dn",args)){ System.out.println("Got param" + getParm("-dn",args)); sesProps.put(SESSION_DEVICE_NAME ,getParm("-dn",args)); } Session s = manager.openSession(sesProps,propFileName,sel); if (!frame1.isVisible()) { splash.updateProgress(++step); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } else { if (isSpecified("-noembed",args)) { splash.updateProgress(++step); newView(); frame1.setVisible(true); splash.setVisible(false); frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } if (isSpecified("-t",args)) frame1.addSessionView(sel,s); else frame1.addSessionView(session,s); s.connect(); } |
|
else if (tag.equals(HTML.Tag.TABLE)) view = new TableView(element); | public View create(Element element) { View view = null; Object attr = element.getAttributes().getAttribute(StyleConstants.NameAttribute); if (attr instanceof HTML.Tag) { HTML.Tag tag = (HTML.Tag) attr; if (tag.equals(HTML.Tag.IMPLIED) || tag.equals(HTML.Tag.P) || tag.equals(HTML.Tag.H1) || tag.equals(HTML.Tag.H2) || tag.equals(HTML.Tag.H3) || tag.equals(HTML.Tag.H4) || tag.equals(HTML.Tag.H5) || tag.equals(HTML.Tag.H6) || tag.equals(HTML.Tag.DT)) view = new ParagraphView(element); else if (tag.equals(HTML.Tag.LI) || tag.equals(HTML.Tag.DL) || tag.equals(HTML.Tag.DD) || tag.equals(HTML.Tag.BODY) || tag.equals(HTML.Tag.HTML) || tag.equals(HTML.Tag.CENTER) || tag.equals(HTML.Tag.DIV) || tag.equals(HTML.Tag.BLOCKQUOTE) || tag.equals(HTML.Tag.PRE)) view = new BlockView(element, View.Y_AXIS); // FIXME: Uncomment when the views have been implemented else if (tag.equals(HTML.Tag.CONTENT)) view = new InlineView(element); else if (tag == HTML.Tag.HEAD) view = new NullView(element); /* else if (tag.equals(HTML.Tag.MENU) || tag.equals(HTML.Tag.DIR) || tag.equals(HTML.Tag.UL) || tag.equals(HTML.Tag.OL)) view = new ListView(element); else if (tag.equals(HTML.Tag.IMG)) view = new ImageView(element); else if (tag.equals(HTML.Tag.HR)) view = new HRuleView(element); else if (tag.equals(HTML.Tag.BR)) view = new BRView(element); else if (tag.equals(HTML.Tag.TABLE)) view = new TableView(element); else if (tag.equals(HTML.Tag.INPUT) || tag.equals(HTML.Tag.SELECT) || tag.equals(HTML.Tag.TEXTAREA)) view = new FormView(element); else if (tag.equals(HTML.Tag.OBJECT)) view = new ObjectView(element); else if (tag.equals(HTML.Tag.FRAMESET)) view = new FrameSetView(element); else if (tag.equals(HTML.Tag.FRAME)) view = new FrameView(element); */ } return view; } |
|
if (view == null) { System.err.println("missing tag->view mapping for: " + element); view = new NullView(element); } | public View create(Element element) { View view = null; Object attr = element.getAttributes().getAttribute(StyleConstants.NameAttribute); if (attr instanceof HTML.Tag) { HTML.Tag tag = (HTML.Tag) attr; if (tag.equals(HTML.Tag.IMPLIED) || tag.equals(HTML.Tag.P) || tag.equals(HTML.Tag.H1) || tag.equals(HTML.Tag.H2) || tag.equals(HTML.Tag.H3) || tag.equals(HTML.Tag.H4) || tag.equals(HTML.Tag.H5) || tag.equals(HTML.Tag.H6) || tag.equals(HTML.Tag.DT)) view = new ParagraphView(element); else if (tag.equals(HTML.Tag.LI) || tag.equals(HTML.Tag.DL) || tag.equals(HTML.Tag.DD) || tag.equals(HTML.Tag.BODY) || tag.equals(HTML.Tag.HTML) || tag.equals(HTML.Tag.CENTER) || tag.equals(HTML.Tag.DIV) || tag.equals(HTML.Tag.BLOCKQUOTE) || tag.equals(HTML.Tag.PRE)) view = new BlockView(element, View.Y_AXIS); // FIXME: Uncomment when the views have been implemented else if (tag.equals(HTML.Tag.CONTENT)) view = new InlineView(element); else if (tag == HTML.Tag.HEAD) view = new NullView(element); /* else if (tag.equals(HTML.Tag.MENU) || tag.equals(HTML.Tag.DIR) || tag.equals(HTML.Tag.UL) || tag.equals(HTML.Tag.OL)) view = new ListView(element); else if (tag.equals(HTML.Tag.IMG)) view = new ImageView(element); else if (tag.equals(HTML.Tag.HR)) view = new HRuleView(element); else if (tag.equals(HTML.Tag.BR)) view = new BRView(element); else if (tag.equals(HTML.Tag.TABLE)) view = new TableView(element); else if (tag.equals(HTML.Tag.INPUT) || tag.equals(HTML.Tag.SELECT) || tag.equals(HTML.Tag.TEXTAREA)) view = new FormView(element); else if (tag.equals(HTML.Tag.OBJECT)) view = new ObjectView(element); else if (tag.equals(HTML.Tag.FRAMESET)) view = new FrameSetView(element); else if (tag.equals(HTML.Tag.FRAME)) view = new FrameView(element); */ } return view; } |
|
if (editorPane != null) | public void read(Reader in, Document doc, int pos) throws IOException, BadLocationException { if (doc instanceof HTMLDocument) { Parser parser = getParser(); if (pos < 0 || pos > doc.getLength()) throw new BadLocationException("Bad location", pos); if (parser == null) throw new IOException("Parser is null."); HTMLDocument hd = ((HTMLDocument) doc); hd.setBase(editorPane.getPage()); ParserCallback pc = hd.getReader(pos); // FIXME: What should ignoreCharSet be set to? // parser.parse inserts html into the buffer parser.parse(in, pc, false); pc.flush(); } else // read in DefaultEditorKit is called. // the string is inserted in the document as usual. super.read(in, doc, pos); } |
|
validateFileCache(); | public BasicDirectoryModel(JFileChooser filechooser) { this.filechooser = filechooser; filechooser.addPropertyChangeListener(this); listingMode = filechooser.getFileSelectionMode(); contents = new Vector(); } |
|
Vector tmp = new Vector(); for (int i = 0; i < directories; i++) tmp.add(contents.get(i)); return tmp; | synchronized (contents) { Vector dirs = directories; if (dirs == null) { getFiles(); dirs = directories; } return dirs; } | public Vector getDirectories() { Vector tmp = new Vector(); for (int i = 0; i < directories; i++) tmp.add(contents.get(i)); return tmp; } |
if (listingMode == JFileChooser.FILES_ONLY) return contents.get(directories + index); else | public Object getElementAt(int index) { if (index > getSize() - 1) return null; if (listingMode == JFileChooser.FILES_ONLY) return contents.get(directories + index); else return contents.elementAt(index); } |
|
Vector tmp = new Vector(); for (int i = directories; i < getSize(); i++) tmp.add(contents.get(i)); return tmp; | synchronized (contents) { Vector f = files; if (f == null) { f = new Vector(); Vector d = new Vector(); for (Iterator i = contents.iterator(); i.hasNext();) { File file = (File) i.next(); if (filechooser.isTraversable(file)) d.add(file); else f.add(file); } files = f; directories = d; } return f; } | public Vector getFiles() { Vector tmp = new Vector(); for (int i = directories; i < getSize(); i++) tmp.add(contents.get(i)); return tmp; } |
if (listingMode == JFileChooser.DIRECTORIES_ONLY) return directories; else if (listingMode == JFileChooser.FILES_ONLY) return contents.size() - directories; | public int getSize() { if (listingMode == JFileChooser.DIRECTORIES_ONLY) return directories; else if (listingMode == JFileChooser.FILES_ONLY) return contents.size() - directories; return contents.size(); } |
|
if (listingMode == JFileChooser.FILES_ONLY) return contents.indexOf(o) - directories; | public int indexOf(Object o) { if (listingMode == JFileChooser.FILES_ONLY) return contents.indexOf(o) - directories; return contents.indexOf(o); } |
|
if (e.getPropertyName().equals(JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY)) listingMode = filechooser.getFileSelectionMode(); | String property = e.getPropertyName(); if (property.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY) || property.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY) || property.equals(JFileChooser.FILE_HIDING_CHANGED_PROPERTY) || property.equals(JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY) || property.equals(JFileChooser.FILE_VIEW_CHANGED_PROPERTY) ) { validateFileCache(); } | public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals(JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY)) listingMode = filechooser.getFileSelectionMode(); } |
return false; | return oldFile.renameTo( newFile ); | public boolean renameFile(File oldFile, File newFile) { // FIXME: implement return false; } |
Enumeration e = Collections.enumeration(v); Vector tmp = new Vector(); for (; e.hasMoreElements();) tmp.add(e.nextElement()); contents = tmp; | protected void sort(Vector v) { Collections.sort(v, comparator); Enumeration e = Collections.enumeration(v); Vector tmp = new Vector(); for (; e.hasMoreElements();) tmp.add(e.nextElement()); contents = tmp; } |
|
contents.clear(); directories = 0; FileSystemView fsv = filechooser.getFileSystemView(); File[] list = fsv.getFiles(filechooser.getCurrentDirectory(), filechooser.isFileHidingEnabled()); if (list == null) return; for (int i = 0; i < list.length; i++) | File dir = filechooser.getCurrentDirectory(); if (dir != null) | public void validateFileCache() { contents.clear(); directories = 0; FileSystemView fsv = filechooser.getFileSystemView(); File[] list = fsv.getFiles(filechooser.getCurrentDirectory(), filechooser.isFileHidingEnabled()); if (list == null) return; for (int i = 0; i < list.length; i++) { if (list[i] == null) continue; if (filechooser.accept(list[i])) { contents.add(list[i]); if (filechooser.isTraversable(list[i])) directories++; } } sort(contents); filechooser.revalidate(); filechooser.repaint(); } |
if (list[i] == null) continue; if (filechooser.accept(list[i])) | if (loadThread != null) | public void validateFileCache() { contents.clear(); directories = 0; FileSystemView fsv = filechooser.getFileSystemView(); File[] list = fsv.getFiles(filechooser.getCurrentDirectory(), filechooser.isFileHidingEnabled()); if (list == null) return; for (int i = 0; i < list.length; i++) { if (list[i] == null) continue; if (filechooser.accept(list[i])) { contents.add(list[i]); if (filechooser.isTraversable(list[i])) directories++; } } sort(contents); filechooser.revalidate(); filechooser.repaint(); } |
contents.add(list[i]); if (filechooser.isTraversable(list[i])) directories++; | loadThread.interrupt(); loadThread.cancelPending(); | public void validateFileCache() { contents.clear(); directories = 0; FileSystemView fsv = filechooser.getFileSystemView(); File[] list = fsv.getFiles(filechooser.getCurrentDirectory(), filechooser.isFileHidingEnabled()); if (list == null) return; for (int i = 0; i < list.length; i++) { if (list[i] == null) continue; if (filechooser.accept(list[i])) { contents.add(list[i]); if (filechooser.isTraversable(list[i])) directories++; } } sort(contents); filechooser.revalidate(); filechooser.repaint(); } |
sort(contents); filechooser.revalidate(); filechooser.repaint(); | public void validateFileCache() { contents.clear(); directories = 0; FileSystemView fsv = filechooser.getFileSystemView(); File[] list = fsv.getFiles(filechooser.getCurrentDirectory(), filechooser.isFileHidingEnabled()); if (list == null) return; for (int i = 0; i < list.length; i++) { if (list[i] == null) continue; if (filechooser.accept(list[i])) { contents.add(list[i]); if (filechooser.isTraversable(list[i])) directories++; } } sort(contents); filechooser.revalidate(); filechooser.repaint(); } |
|
new SecureRandom ().nextBytes(cIV); | getDefaultPRNG().nextBytes(cIV); | private String createO(final String aol) throws AuthenticationException { if (DEBUG && debuglevel > 8) debug(TRACE, "==> createO(\"" + aol + "\")"); boolean replaydetectionAvailable = false; boolean integrityAvailable = false; boolean confidentialityAvailable = false; String option, mandatory = SRPRegistry.DEFAULT_MANDATORY; int i; String mdName = SRPRegistry.SRP_DEFAULT_DIGEST_NAME; final StringTokenizer st = new StringTokenizer(aol, ","); while (st.hasMoreTokens()) { option = st.nextToken(); if (option.startsWith(SRPRegistry.OPTION_SRP_DIGEST + "=")) { option = option.substring(option.indexOf('=') + 1); if (DEBUG && debuglevel > 6) debug(TRACE, "mda: <" + option + ">"); for (i = 0; i < SRPRegistry.INTEGRITY_ALGORITHMS.length; i++) { if (SRPRegistry.SRP_ALGORITHMS[i].equals(option)) { mdName = option; break; } } } else if (option.equals(SRPRegistry.OPTION_REPLAY_DETECTION)) { replaydetectionAvailable = true; } else if (option.startsWith(SRPRegistry.OPTION_INTEGRITY + "=")) { option = option.substring(option.indexOf('=') + 1); if (DEBUG && debuglevel > 6) debug(TRACE, "ialg: <" + option + ">"); for (i = 0; i < SRPRegistry.INTEGRITY_ALGORITHMS.length; i++) { if (SRPRegistry.INTEGRITY_ALGORITHMS[i].equals(option)) { chosenIntegrityAlgorithm = option; integrityAvailable = true; break; } } } else if (option.startsWith(SRPRegistry.OPTION_CONFIDENTIALITY + "=")) { option = option.substring(option.indexOf('=') + 1); if (DEBUG && debuglevel > 6) debug(TRACE, "calg: <" + option + ">"); for (i = 0; i < SRPRegistry.CONFIDENTIALITY_ALGORITHMS.length; i++) { if (SRPRegistry.CONFIDENTIALITY_ALGORITHMS[i].equals(option)) { chosenConfidentialityAlgorithm = option; confidentialityAvailable = true; break; } } } else if (option.startsWith(SRPRegistry.OPTION_MANDATORY + "=")) { mandatory = option.substring(option.indexOf('=') + 1); } else if (option.startsWith(SRPRegistry.OPTION_MAX_BUFFER_SIZE + "=")) { final String maxBufferSize = option.substring(option.indexOf('=') + 1); try { rawSendSize = Integer.parseInt(maxBufferSize); if (rawSendSize > Registry.SASL_BUFFER_MAX_LIMIT || rawSendSize < 1) { throw new AuthenticationException( "Illegal value for 'maxbuffersize' option"); } } catch (NumberFormatException x) { throw new AuthenticationException( SRPRegistry.OPTION_MAX_BUFFER_SIZE + "=" + String.valueOf(maxBufferSize), x); } } } replayDetection = replaydetectionAvailable && Boolean.valueOf( (String) properties.get(SRPRegistry.SRP_REPLAY_DETECTION)).booleanValue(); boolean integrity = integrityAvailable && Boolean.valueOf( (String) properties.get(SRPRegistry.SRP_INTEGRITY_PROTECTION)).booleanValue(); boolean confidentiality = confidentialityAvailable && Boolean.valueOf( (String) properties.get(SRPRegistry.SRP_CONFIDENTIALITY)).booleanValue(); // make sure we do the right thing if (SRPRegistry.OPTION_REPLAY_DETECTION.equals(mandatory)) { replayDetection = true; integrity = true; } else if (SRPRegistry.OPTION_INTEGRITY.equals(mandatory)) { integrity = true; } else if (SRPRegistry.OPTION_CONFIDENTIALITY.equals(mandatory)) { confidentiality = true; } if (replayDetection) { if (chosenIntegrityAlgorithm == null) { throw new AuthenticationException( "Replay detection is required but no " + "integrity protection algorithm was chosen"); } } if (integrity) { if (chosenIntegrityAlgorithm == null) { throw new AuthenticationException( "Integrity protection is required but no " + "algorithm was chosen"); } } if (confidentiality) { if (chosenConfidentialityAlgorithm == null) { throw new AuthenticationException( "Confidentiality protection is required " + "but no algorithm was chosen"); } } // 1. check if we'll be using confidentiality; if not set IV to 0-byte if (chosenConfidentialityAlgorithm == null) { cIV = new byte[0]; } else { // 2. get the block size of the cipher final IBlockCipher cipher = CipherFactory.getInstance(chosenConfidentialityAlgorithm); if (cipher == null) { throw new AuthenticationException("createO()", new NoSuchAlgorithmException()); } final int blockSize = cipher.defaultBlockSize(); // 3. generate random iv cIV = new byte[blockSize]; new SecureRandom ().nextBytes(cIV); } srp = SRP.instance(mdName); // Now create the options list specifying which of the available options // we have chosen. // For now we just select the defaults. Later we need to add support for // properties (perhaps in a file) where a user can specify the list of // algorithms they would prefer to use. final StringBuffer sb = new StringBuffer(); sb.append(SRPRegistry.OPTION_SRP_DIGEST).append("=").append(mdName).append( ","); if (replayDetection) { sb.append(SRPRegistry.OPTION_REPLAY_DETECTION).append(","); } if (integrity) { sb.append(SRPRegistry.OPTION_INTEGRITY).append("=").append( chosenIntegrityAlgorithm).append( ","); } if (confidentiality) { sb.append(SRPRegistry.OPTION_CONFIDENTIALITY).append("=").append( chosenConfidentialityAlgorithm).append( ","); } final String result = sb.append(SRPRegistry.OPTION_MAX_BUFFER_SIZE).append( "=").append( Registry.SASL_BUFFER_MAX_LIMIT).toString(); if (DEBUG && debuglevel > 8) debug(TRACE, "<== createO() --> " + result); return result; } |
cn = new SecureRandom ().generateSeed (16); | cn = new byte[16]; getDefaultPRNG().nextBytes(cn); | private byte[] sendIdentities() throws SaslException { if (DEBUG && debuglevel > 8) debug(TRACE, "==> sendIdentities()"); // If necessary, prompt the client for the username and password getUsernameAndPassword(); if (DEBUG && debuglevel > 6) debug(TRACE, "Password: \"" + new String(password.getPassword()) + "\""); if (DEBUG && debuglevel > 6) debug(TRACE, "Encoding U (username): \"" + U + "\""); if (DEBUG && debuglevel > 6) debug(TRACE, "Encoding I (userid): \"" + authorizationID + "\""); // if session re-use generate new 16-byte nonce if (sid.length != 0) { cn = new SecureRandom ().generateSeed (16); } else { cn = new byte[0]; } final OutputBuffer frameOut = new OutputBuffer(); try { frameOut.setText(U); frameOut.setText(authorizationID); frameOut.setEOS(sid); // session ID to re-use frameOut.setOS(cn); // client nonce frameOut.setEOS(channelBinding); } catch (IOException x) { if (x instanceof SaslException) { throw (SaslException) x; } throw new AuthenticationException("sendIdentities()", x); } final byte[] result = frameOut.encode(); if (DEBUG && debuglevel > 8) debug(TRACE, "<== sendIdentities()"); if (DEBUG && debuglevel > 2) debug(INFO, "C: " + Util.dumpString(result)); if (DEBUG && debuglevel > 2) debug(INFO, " U = " + U); if (DEBUG && debuglevel > 2) debug(INFO, " I = " + authorizationID); if (DEBUG && debuglevel > 2) debug(INFO, "sid = " + new String(sid)); if (DEBUG && debuglevel > 2) debug(INFO, " cn = " + Util.dumpString(cn)); if (DEBUG && debuglevel > 2) debug(INFO, "cCB = " + Util.dumpString(channelBinding)); return result; } |
invalidate(); RepaintManager.currentManager(this).addInvalidComponent(this); | if (! EventQueue.isDispatchThread()) SwingUtilities.invokeLater(new Runnable() { public void run() { revalidate(); } }); else { invalidate(); RepaintManager.currentManager(this).addInvalidComponent(this); } | public void revalidate() { invalidate(); RepaintManager.currentManager(this).addInvalidComponent(this); } |
Container parent = getParent(); if (parent != null) parent.repaint(getX(), getY(), getWidth(), getHeight()); revalidate(); | public void setVisible(boolean v) { super.setVisible(v); } |
|
public abstract FileLock lock(long position, long size, boolean shared) throws IOException; | public final FileLock lock() throws IOException { return lock(0, Long.MAX_VALUE, false); } | public abstract FileLock lock(long position, long size, boolean shared) throws IOException; |
public abstract int read(ByteBuffer dst) throws IOException; | public abstract long read(ByteBuffer[] dsts, int offset, int length) throws IOException; | public abstract int read(ByteBuffer dst) throws IOException; |
public abstract FileLock tryLock(long position, long size, boolean shared) throws IOException; | public final FileLock tryLock() throws IOException { return tryLock(0, Long.MAX_VALUE, false); } | public abstract FileLock tryLock(long position, long size, boolean shared) throws IOException; |
public abstract int write(ByteBuffer src) throws IOException; | public final long write(ByteBuffer[] srcs) throws IOException { long result = 0; for (int i = 0; i < srcs.length; i++) result += write(srcs[i]); return result; } | public abstract int write(ByteBuffer src) throws IOException; |
buf.append(Thread.currentThread().hashCode()); buf.append('@'); | HTTPConnection getConnection(String host, int port, boolean secure) throws IOException { HTTPConnection connection; if (keepAlive) { StringBuffer buf = new StringBuffer(secure ? "https://" : "http://"); buf.append(host); buf.append(':'); buf.append(port); String key = buf.toString(); synchronized (connectionPool) { connection = (HTTPConnection) connectionPool.get(key); if (connection == null) { connection = new HTTPConnection(host, port, secure); // Good housekeeping if (connectionPool.size() == maxConnections) { // maxConnections must always be >= 1 Object lru = connectionPool.keySet().iterator().next(); connectionPool.remove(lru); } connectionPool.put(key, connection); } } } else { connection = new HTTPConnection(host, port, secure); } return connection; } |
|
getContentPane().add(interfacePanel,BorderLayout.NORTH); | void jbInit() throws Exception { // make it non resizable setResizable(true); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // create some reusable borders and layouts Border etchedBorder = BorderFactory.createEtchedBorder(); BorderLayout borderLayout = new BorderLayout(); // get an instance of our table model ctm = new ConfigureTableModel(); // create a table using our custom table model sessions = new JTable(ctm); // Add enter as default key for connect with this session KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0); sessions.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { doActionConnect(); } },enter,JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); sessions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); sessions.setPreferredScrollableViewportSize(new Dimension(500,200)); sessions.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(sessions); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); //Setup our selection model listener rowSM = sessions.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); if (lsm.isSelectionEmpty()) { //no rows are selected editButton.setEnabled(false); removeButton.setEnabled(false); connectButton.setEnabled(false); } else { int selectedRow = lsm.getMinSelectionIndex(); //selectedRow is selected editButton.setEnabled(true); removeButton.setEnabled(true); connectButton.setEnabled(true); } } }); //Setup panels configOptions.setLayout(borderLayout); sessionPanel.setLayout(borderLayout); configOptions.add(sessionPanel, BorderLayout.CENTER); sessionOpts.add(scrollPane, BorderLayout.CENTER); sessionPanel.add(sessionOpts, BorderLayout.NORTH); sessionPanel.add(sessionOptPanel, BorderLayout.SOUTH); sessionPanel.setBorder(BorderFactory.createRaisedBevelBorder()); // add the option buttons addOptButton(LangTool.getString("ss.optAdd"),"ADD",sessionOptPanel); removeButton = addOptButton(LangTool.getString("ss.optDelete"), "REMOVE", sessionOptPanel, false); editButton = addOptButton(LangTool.getString("ss.optEdit"), "EDIT", sessionOptPanel, false); connectButton = addOptButton(LangTool.getString("ss.optConnect"),"CONNECT",options,false); addOptButton(LangTool.getString("ss.optCancel"),"DONE",options); // add the panels to our dialog getContentPane().add(sessionPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // pack it and center it on the screen pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); // set default selection value as the first row if (sessions.getRowCount() > 0) { sessions.getSelectionModel().setSelectionInterval(0,0); } // now show the world what we and they can do this.setVisible(true); } |
|
if (e.getPropertyName().equals(JTabbedPane.TAB_LAYOUT_POLICY_CHANGED_PROPERTY)) | if (e.getPropertyName().equals("tabLayoutPolicy")) | public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals(JTabbedPane.TAB_LAYOUT_POLICY_CHANGED_PROPERTY)) { layoutManager = createLayoutManager(); tabPane.setLayout(layoutManager); } else if (e.getPropertyName().equals(JTabbedPane.TAB_PLACEMENT_CHANGED_PROPERTY) && tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) { incrButton = createIncreaseButton(); decrButton = createDecreaseButton(); } tabPane.layout(); tabPane.repaint(); } |
else if (e.getPropertyName().equals(JTabbedPane.TAB_PLACEMENT_CHANGED_PROPERTY) | else if (e.getPropertyName().equals("tabPlacement") | public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals(JTabbedPane.TAB_LAYOUT_POLICY_CHANGED_PROPERTY)) { layoutManager = createLayoutManager(); tabPane.setLayout(layoutManager); } else if (e.getPropertyName().equals(JTabbedPane.TAB_PLACEMENT_CHANGED_PROPERTY) && tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) { incrButton = createIncreaseButton(); decrButton = createDecreaseButton(); } tabPane.layout(); tabPane.repaint(); } |
public LayoutManager createLayoutManager() | protected LayoutManager createLayoutManager() | public LayoutManager createLayoutManager() { if (tabPane.getTabLayoutPolicy() == JTabbedPane.WRAP_TAB_LAYOUT) return new TabbedPaneLayout(); else { incrButton = createIncreaseButton(); decrButton = createDecreaseButton(); viewport = new ScrollingViewport(); viewport.setLayout(null); panel = new ScrollingPanel(); viewport.setView(panel); tabPane.add(incrButton); tabPane.add(decrButton); tabPane.add(viewport); currentScrollLocation = 0; decrButton.setEnabled(false); panel.addMouseListener(mouseListener); incrButton.addMouseListener(mouseListener); decrButton.addMouseListener(mouseListener); viewport.setBackground(Color.LIGHT_GRAY); return new TabbedPaneScrollLayout(); } } |
public void addAccessibleSelection(int value0) throws NotImplementedException | public void addAccessibleSelection(int index) | public void addAccessibleSelection(int value0) throws NotImplementedException { // TODO: Implement this properly. } |
setSelectedIndex(index); | public void addAccessibleSelection(int value0) throws NotImplementedException { // TODO: Implement this properly. } |
|
setSelectedIndex(-1); | public void clearAccessibleSelection() throws NotImplementedException { // TODO: Implement this properly. } |
|
public boolean doAccessibleAction(int value0) throws NotImplementedException | public boolean doAccessibleAction(int actionIndex) | public boolean doAccessibleAction(int value0) throws NotImplementedException { return false; } |
return false; | boolean actionPerformed = false; if (actionIndex == 0) { setPopupVisible(! isPopupVisible()); actionPerformed = true; } return actionPerformed; | public boolean doAccessibleAction(int value0) throws NotImplementedException { return false; } |
throws NotImplementedException | public AccessibleAction getAccessibleAction() throws NotImplementedException { return null; } |
|
return null; | return this; | public AccessibleAction getAccessibleAction() throws NotImplementedException { return null; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.