rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
public AssertionError(Object msg) | public AssertionError() | public AssertionError(Object msg) { super("" + msg); if (msg instanceof Throwable) initCause((Throwable) msg); } |
super("" + msg); if (msg instanceof Throwable) initCause((Throwable) msg); | public AssertionError(Object msg) { super("" + msg); if (msg instanceof Throwable) initCause((Throwable) msg); } |
|
bad.minor = Minor.Any; | public static NameComponent extract(Any a) { try { return ((NameComponentHolder) a.extract_Streamable()).value; } catch (ClassCastException ex) { BAD_OPERATION bad = new BAD_OPERATION("Name component expected"); bad.initCause(ex); throw bad; } } |
|
int y = rect.y; | int y = rect.y + metrics.getAscent(); | public void paint(Graphics g, Shape s) { // Ensure metrics are up-to-date. updateMetrics(); JTextComponent textComponent = (JTextComponent) getContainer(); selectedColor = textComponent.getSelectedTextColor(); unselectedColor = textComponent.getForeground(); disabledColor = textComponent.getDisabledTextColor(); Rectangle rect = s.getBounds(); // FIXME: Text may be scrolled. Document document = textComponent.getDocument(); Element root = document.getDefaultRootElement(); int y = rect.y; for (int i = 0; i < root.getElementCount(); i++) { drawLine(i, g, rect.x, y); y += metrics.getHeight(); } } |
public Word sub (Word w2) { | public Word sub (int w2) { | public Word sub (Word w2) { return null; } |
toXMLWriter(outputWriter, "", false, null, null); | basicXMLWriter(outputWriter, "", false, null, null); | public String toXMLString () { // hurm. Cant figure out how to use BufferedWriter here. fooey. Writer outputWriter = (Writer) new StringWriter(); try { toXMLWriter(outputWriter, "", false, null, null); } catch (java.io.IOException e) { // weird. Out of memorY? Log.errorln("Cant got IOException for toXMLWriter() method within toXMLString()."); Log.printStackTrace(e); } return outputWriter.toString(); } |
public ShortSeqHolder(short[] initial_value) | public ShortSeqHolder() | public ShortSeqHolder(short[] initial_value) { value = initial_value; typecode.setLength(value.length); } |
value = initial_value; typecode.setLength(value.length); | public ShortSeqHolder(short[] initial_value) { value = initial_value; typecode.setLength(value.length); } |
|
public JNodeBufferedImage(int w, int h, int type) { super(w, h, type); | public JNodeBufferedImage(ColorModel colormodel, WritableRaster writableraster, boolean premultiplied, Hashtable properties) { super(colormodel, writableraster, premultiplied, properties); | public JNodeBufferedImage(int w, int h, int type) { super(w, h, type); } |
public String getValue(Name name) | public String getValue(String name) | public String getValue(Name name) { return (String) get(name); } |
return (String) get(name); | return (String) get(new Name(name)); | public String getValue(Name name) { return (String) get(name); } |
EditorKit e = null; String className = (String) registerMap.get(type); if (className != null) | EditorKit e = (EditorKit) editorKits.get(type); if (e == null) | public static EditorKit createEditorKitForContentType(String type) { // TODO: Have to handle the case where a ClassLoader was specified // when the EditorKit was registered EditorKit e = null; String className = (String) registerMap.get(type); if (className != null) { try { e = (EditorKit) Class.forName(className).newInstance(); } catch (Exception e2) { // TODO: Not sure what to do here. } } return e; } |
e = (EditorKit) Class.forName(className).newInstance(); | e = (EditorKit) loader.loadClass(className).newInstance(); | public static EditorKit createEditorKitForContentType(String type) { // TODO: Have to handle the case where a ClassLoader was specified // when the EditorKit was registered EditorKit e = null; String className = (String) registerMap.get(type); if (className != null) { try { e = (EditorKit) Class.forName(className).newInstance(); } catch (Exception e2) { // TODO: Not sure what to do here. } } return e; } |
} if (e != null) editorKits.put(type, e); | public static EditorKit createEditorKitForContentType(String type) { // TODO: Have to handle the case where a ClassLoader was specified // when the EditorKit was registered EditorKit e = null; String className = (String) registerMap.get(type); if (className != null) { try { e = (EditorKit) Class.forName(className).newInstance(); } catch (Exception e2) { // TODO: Not sure what to do here. } } return e; } |
|
return (String) registerMap.get(type); | EditorKitMapping m = (EditorKitMapping) registerMap.get(type); String kitName = m != null ? m.className : null; return kitName; | public static String getEditorKitClassNameForContentType(String type) { return (String) registerMap.get(type); } |
e = new PlainEditorKit(); | e = createDefaultEditorKit(); | public EditorKit getEditorKitForContentType(String type) { // First check if an EditorKit has been explicitly set. EditorKit e = (EditorKit) editorMap.get(type); // Then check to see if we can create one. if (e == null) e = createEditorKitForContentType(type); // Otherwise default to PlainEditorKit. if (e == null) e = new PlainEditorKit(); return e; } |
return page; | return loader != null ? loader.page : null; | public URL getPage() { return page; } |
if (getScrollableTracksViewportWidth()) pref.width = getUI().getMinimumSize(this).width; if (getScrollableTracksViewportHeight()) pref.height = getUI().getMinimumSize(this).height; | Container parent = getParent(); if (parent instanceof JViewport) { JViewport vp = (JViewport) getParent(); TextUI ui = getUI(); Dimension min = null; if (! getScrollableTracksViewportWidth()) { min = ui.getMinimumSize(this); int vpWidth = vp.getWidth(); if (vpWidth != 0 && vpWidth < min.width) pref.width = min.width; } if (! getScrollableTracksViewportHeight()) { if (min == null) min = ui.getMinimumSize(this); int vpHeight = vp.getHeight(); if (vpHeight != 0 && vpHeight < min.height) pref.height = min.height; } } | public Dimension getPreferredSize() { Dimension pref = super.getPreferredSize(); if (getScrollableTracksViewportWidth()) pref.width = getUI().getMinimumSize(this).width; if (getScrollableTracksViewportHeight()) pref.height = getUI().getMinimumSize(this).height; return pref; } |
&& parent.getHeight() >= getUI().getMinimumSize(this).height && parent.getHeight() <= getUI().getMaximumSize(this).height; | && height >= ui.getMinimumSize(this).height && height <= ui.getMaximumSize(this).height; | public boolean getScrollableTracksViewportHeight() { // Tests show that this returns true when the parent is a JViewport // and has a height > minimum UI height. Container parent = getParent(); return parent instanceof JViewport && parent.getHeight() >= getUI().getMinimumSize(this).height && parent.getHeight() <= getUI().getMaximumSize(this).height; } |
return page.openStream(); | URLConnection conn = page.openConnection(); String type = conn.getContentType(); if (type != null) setContentType(type); InputStream stream = conn.getInputStream(); return new BufferedInputStream(stream); | protected InputStream getStream(URL page) throws IOException { return page.openStream(); } |
registerMap = new HashMap(); registerEditorKitForContentType("application/rtf", "javax.swing.text.rtf.RTFEditorKit"); registerEditorKitForContentType("text/plain", "javax.swing.JEditorPane$PlainEditorKit"); registerEditorKitForContentType("text/html", "javax.swing.text.html.HTMLEditorKit"); registerEditorKitForContentType("text/rtf", "javax.swing.text.rtf.RTFEditorKit"); | void init() { editorMap = new HashMap(); registerMap = new HashMap(); registerEditorKitForContentType("application/rtf", "javax.swing.text.rtf.RTFEditorKit"); registerEditorKitForContentType("text/plain", "javax.swing.JEditorPane$PlainEditorKit"); registerEditorKitForContentType("text/html", "javax.swing.text.html.HTMLEditorKit"); registerEditorKitForContentType("text/rtf", "javax.swing.text.rtf.RTFEditorKit"); } |
|
Document doc = (Document) desc; | HTMLDocument doc = (HTMLDocument) desc; setDocument(doc); | public void read(InputStream in, Object desc) throws IOException { EditorKit kit = getEditorKit(); if (kit instanceof HTMLEditorKit && desc instanceof HTMLDocument) { Document doc = (Document) desc; try { kit.read(in, doc, 0); } catch (BadLocationException ex) { assert false : "BadLocationException must not be thrown here."; } } else { Reader inRead = new InputStreamReader(in); super.read(inRead, desc); } } |
kit.read(in, doc, 0); | InputStreamReader reader = new InputStreamReader(in); kit.read(reader, doc, 0); | public void read(InputStream in, Object desc) throws IOException { EditorKit kit = getEditorKit(); if (kit instanceof HTMLEditorKit && desc instanceof HTMLDocument) { Document doc = (Document) desc; try { kit.read(in, doc, 0); } catch (BadLocationException ex) { assert false : "BadLocationException must not be thrown here."; } } else { Reader inRead = new InputStreamReader(in); super.read(inRead, desc); } } |
registerMap.put(type, classname); | registerEditorKitForContentType(type, classname, Thread.currentThread().getContextClassLoader()); | public static void registerEditorKitForContentType(String type, String classname) { registerMap.put(type, classname); } |
int paramIndex = type.indexOf(';'); if (paramIndex > -1) { type = type.substring(0, paramIndex).trim(); } | public final void setContentType(String type) { if (editorKit != null && editorKit.getContentType().equals(type)) return; EditorKit kit = getEditorKitForContentType(type); if (kit != null) setEditorKit(kit); } |
|
pool.request(reg); | assertCondition(pool.request(reg), "Request of register failed: ", reg); | static final void requestRegister(EmitterContext eContext, X86Register reg) { final X86RegisterPool pool = eContext.getGPRPool(); if (!pool.isFree(reg)) { final Item i = (Item) pool.getOwner(reg); i.spill(eContext, reg); assertCondition(pool.isFree(reg), "register is not free after spill"); } pool.request(reg); } |
public IllegalModeException(String s) { super(s); | public IllegalModeException() { super(); | public IllegalModeException(String s) { super(s); } |
checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); | DerUtil.checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); | public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); if (! (derVersion.getValue() instanceof BigInteger)) throw new InvalidParameterException("Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(DSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue derParams = der.read(); checkIsConstructed(derParams, "Wrong DSS Parameters field"); DERValue val = der.read(); checkIsBigInteger(val, "Wrong P field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong Q field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong G field"); g = (BigInteger) val.getValue(); val = der.read(); byte[] xBytes = (byte[]) val.getValue(); x = new BigInteger(1, xBytes); } catch (IOException e) { InvalidParameterException y = new InvalidParameterException(); y.initCause(e); throw y; } return new DSSPrivateKey(Registry.PKCS8_ENCODING_ID, p, q, g, x); } |
checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); | DerUtil.checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); | public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); if (! (derVersion.getValue() instanceof BigInteger)) throw new InvalidParameterException("Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(DSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue derParams = der.read(); checkIsConstructed(derParams, "Wrong DSS Parameters field"); DERValue val = der.read(); checkIsBigInteger(val, "Wrong P field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong Q field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong G field"); g = (BigInteger) val.getValue(); val = der.read(); byte[] xBytes = (byte[]) val.getValue(); x = new BigInteger(1, xBytes); } catch (IOException e) { InvalidParameterException y = new InvalidParameterException(); y.initCause(e); throw y; } return new DSSPrivateKey(Registry.PKCS8_ENCODING_ID, p, q, g, x); } |
checkIsConstructed(derParams, "Wrong DSS Parameters field"); | DerUtil.checkIsConstructed(derParams, "Wrong DSS Parameters field"); | public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); if (! (derVersion.getValue() instanceof BigInteger)) throw new InvalidParameterException("Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(DSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue derParams = der.read(); checkIsConstructed(derParams, "Wrong DSS Parameters field"); DERValue val = der.read(); checkIsBigInteger(val, "Wrong P field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong Q field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong G field"); g = (BigInteger) val.getValue(); val = der.read(); byte[] xBytes = (byte[]) val.getValue(); x = new BigInteger(1, xBytes); } catch (IOException e) { InvalidParameterException y = new InvalidParameterException(); y.initCause(e); throw y; } return new DSSPrivateKey(Registry.PKCS8_ENCODING_ID, p, q, g, x); } |
checkIsBigInteger(val, "Wrong P field"); | DerUtil.checkIsBigInteger(val, "Wrong P field"); | public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); if (! (derVersion.getValue() instanceof BigInteger)) throw new InvalidParameterException("Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(DSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue derParams = der.read(); checkIsConstructed(derParams, "Wrong DSS Parameters field"); DERValue val = der.read(); checkIsBigInteger(val, "Wrong P field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong Q field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong G field"); g = (BigInteger) val.getValue(); val = der.read(); byte[] xBytes = (byte[]) val.getValue(); x = new BigInteger(1, xBytes); } catch (IOException e) { InvalidParameterException y = new InvalidParameterException(); y.initCause(e); throw y; } return new DSSPrivateKey(Registry.PKCS8_ENCODING_ID, p, q, g, x); } |
checkIsBigInteger(val, "Wrong Q field"); | DerUtil.checkIsBigInteger(val, "Wrong Q field"); | public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); if (! (derVersion.getValue() instanceof BigInteger)) throw new InvalidParameterException("Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(DSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue derParams = der.read(); checkIsConstructed(derParams, "Wrong DSS Parameters field"); DERValue val = der.read(); checkIsBigInteger(val, "Wrong P field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong Q field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong G field"); g = (BigInteger) val.getValue(); val = der.read(); byte[] xBytes = (byte[]) val.getValue(); x = new BigInteger(1, xBytes); } catch (IOException e) { InvalidParameterException y = new InvalidParameterException(); y.initCause(e); throw y; } return new DSSPrivateKey(Registry.PKCS8_ENCODING_ID, p, q, g, x); } |
checkIsBigInteger(val, "Wrong G field"); | DerUtil.checkIsBigInteger(val, "Wrong G field"); | public PrivateKey decodePrivateKey(byte[] input) { if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); BigInteger version, p, q, g, x; DERReader der = new DERReader(input); try { DERValue derPKI = der.read(); checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field"); DERValue derVersion = der.read(); if (! (derVersion.getValue() instanceof BigInteger)) throw new InvalidParameterException("Wrong Version field"); version = (BigInteger) derVersion.getValue(); if (version.compareTo(BigInteger.ZERO) != 0) throw new InvalidParameterException("Unexpected Version: " + version); DERValue derAlgoritmID = der.read(); checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field"); DERValue derOID = der.read(); OID algOID = (OID) derOID.getValue(); if (! algOID.equals(DSA_ALG_OID)) throw new InvalidParameterException("Unexpected OID: " + algOID); DERValue derParams = der.read(); checkIsConstructed(derParams, "Wrong DSS Parameters field"); DERValue val = der.read(); checkIsBigInteger(val, "Wrong P field"); p = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong Q field"); q = (BigInteger) val.getValue(); val = der.read(); checkIsBigInteger(val, "Wrong G field"); g = (BigInteger) val.getValue(); val = der.read(); byte[] xBytes = (byte[]) val.getValue(); x = new BigInteger(1, xBytes); } catch (IOException e) { InvalidParameterException y = new InvalidParameterException(); y.initCause(e); throw y; } return new DSSPrivateKey(Registry.PKCS8_ENCODING_ID, p, q, g, x); } |
public int compareTo(BigInteger val) | private static int compareTo(BigInteger x, BigInteger y) | public int compareTo(BigInteger val) { return compareTo(this, val); } |
return compareTo(this, val); | if (x.words == null && y.words == null) return x.ival < y.ival ? -1 : x.ival > y.ival ? 1 : 0; boolean x_negative = x.isNegative(); boolean y_negative = y.isNegative(); if (x_negative != y_negative) return x_negative ? -1 : 1; int x_len = x.words == null ? 1 : x.ival; int y_len = y.words == null ? 1 : y.ival; if (x_len != y_len) return (x_len > y_len) != x_negative ? 1 : -1; return MPN.cmp(x.words, y.words, x_len); | public int compareTo(BigInteger val) { return compareTo(this, val); } |
public BigInteger(int signum, byte[] magnitude) | private BigInteger() | public BigInteger(int signum, byte[] magnitude) { if (magnitude == null || signum > 1 || signum < -1) throw new NumberFormatException(); if (signum == 0) { int i; for (i = magnitude.length - 1; i >= 0 && magnitude[i] == 0; --i) ; if (i >= 0) throw new NumberFormatException(); return; } // Magnitude is always positive, so don't ever pass a sign of -1. words = byteArrayToIntArray(magnitude, 0); BigInteger result = make(words, words.length); this.ival = result.ival; this.words = result.words; if (signum < 0) setNegative(); } |
if (magnitude == null || signum > 1 || signum < -1) throw new NumberFormatException(); if (signum == 0) { int i; for (i = magnitude.length - 1; i >= 0 && magnitude[i] == 0; --i) ; if (i >= 0) throw new NumberFormatException(); return; } words = byteArrayToIntArray(magnitude, 0); BigInteger result = make(words, words.length); this.ival = result.ival; this.words = result.words; if (signum < 0) setNegative(); | public BigInteger(int signum, byte[] magnitude) { if (magnitude == null || signum > 1 || signum < -1) throw new NumberFormatException(); if (signum == 0) { int i; for (i = magnitude.length - 1; i >= 0 && magnitude[i] == 0; --i) ; if (i >= 0) throw new NumberFormatException(); return; } // Magnitude is always positive, so don't ever pass a sign of -1. words = byteArrayToIntArray(magnitude, 0); BigInteger result = make(words, words.length); this.ival = result.ival; this.words = result.words; if (signum < 0) setNegative(); } |
|
public DERValue(int tag, Object value) | public DERValue(int tag, int length, Object value, byte[] encoded) | public DERValue(int tag, Object value) { this(tag, 0, value, null); } |
this(tag, 0, value, null); | tagClass = tag & 0xC0; this.tag = tag & 0x1F; constructed = (tag & CONSTRUCTED) == CONSTRUCTED; this.length = length; this.value = value; if (encoded != null) this.encoded = (byte[]) encoded.clone(); | public DERValue(int tag, Object value) { this(tag, 0, value, null); } |
if (DER.CONSTRUCTED_VALUE.equals (object.getValue ())) { out.write (object.getEncoded ()); return object.getLength (); } | public static int write(OutputStream out, DERValue object) throws IOException { out.write(object.getExternalTag()); Object value = object.getValue(); if (value == null) { writeLength(out, 0); return 0; } if (value instanceof Boolean) return writeBoolean(out, (Boolean) value); else if (value instanceof BigInteger) return writeInteger(out, (BigInteger) value); else if (value instanceof Date) return writeDate(out, object.getExternalTag(), (Date) value); else if (value instanceof String) return writeString(out, object.getExternalTag(), (String) value); else if (value instanceof List) return writeSequence(out, (List) value); else if (value instanceof Set) return writeSet(out, (Set) value); else if (value instanceof BitString) return writeBitString(out, (BitString) value); else if (value instanceof OID) return writeOID(out, (OID) value); else if (value instanceof byte[]) { writeLength(out, ((byte[]) value).length); out.write((byte[]) value); return ((byte[]) value).length; } else if (value instanceof DERValue) { ByteArrayOutputStream bout = new ByteArrayOutputStream(); write(bout, (DERValue) value); byte[] buf = bout.toByteArray(); writeLength(out, buf.length); out.write(buf); return buf.length; } else throw new DEREncodingException("cannot encode " + value.getClass().getName()); } |
|
public LongLongSeqHolder(long[] initial_value) | public LongLongSeqHolder() | public LongLongSeqHolder(long[] initial_value) { value = initial_value; typecode.setLength(value.length); } |
value = initial_value; typecode.setLength(value.length); | public LongLongSeqHolder(long[] initial_value) { value = initial_value; typecode.setLength(value.length); } |
|
try { FileOutputStream out = new FileOutputStream(fileName); props.store(out,"------ Defaults --------"); } catch (FileNotFoundException fnfe) {} catch (IOException ioe) {} | changes.saveSessionProps(); | private void saveProps() { DefaultMutableTreeNode root = (DefaultMutableTreeNode)tree.getModel().getRoot(); Enumeration e = root.children(); Object child; while (e.hasMoreElements()) { child = e.nextElement(); Object obj = ((DefaultMutableTreeNode)child).getUserObject(); if (obj instanceof AttributesPanel) { ((AttributesPanel)obj).save(); } } try { FileOutputStream out = new FileOutputStream(fileName); props.store(out,"------ Defaults --------"); } catch (FileNotFoundException fnfe) {} catch (IOException ioe) {} } |
public DefaultMutableTreeNode(Object userObject) | public DefaultMutableTreeNode() | public DefaultMutableTreeNode(Object userObject) { this(userObject, true); } |
this(userObject, true); | this(null, true); | public DefaultMutableTreeNode(Object userObject) { this(userObject, true); } |
public _PolicyStub(Delegate delegate) | public _PolicyStub() | public _PolicyStub(Delegate delegate) { _set_delegate(delegate); } |
_set_delegate(delegate); | public _PolicyStub(Delegate delegate) { _set_delegate(delegate); } |
|
throw new MARSHAL(); | MARSHAL m = new MARSHAL("Inappropriate"); m.minor = Minor.Inappropriate; throw m; | public static ServantActivator read(InputStream input) { throw new MARSHAL(); } |
throw new MARSHAL(); | MARSHAL m = new MARSHAL("Inappropriate"); m.minor = Minor.Inappropriate; throw m; | public static void write(OutputStream output, ServantActivator value) { throw new MARSHAL(); } |
public abstract void insert_Object(org.omg.CORBA.Object x); | public abstract void insert_Object(org.omg.CORBA.Object x, TypeCode typecode); | public abstract void insert_Object(org.omg.CORBA.Object x); |
public ObjID(int num) { objNum = (long)num; space = new UID((short)0); } | public ObjID() { synchronized (lock) { objNum = next++; } space = new UID(); } | public ObjID(int num) { objNum = (long)num; space = new UID((short)0);} |
public UnicastServerRef(ObjID id, int port, RMIServerSocketFactory ssf) { super(id); manager = UnicastConnectionManager.getInstance(port, ssf); | UnicastServerRef() { | public UnicastServerRef(ObjID id, int port, RMIServerSocketFactory ssf) { super(id); manager = UnicastConnectionManager.getInstance(port, ssf);} |
stub = (RemoteStub)getHelperClass(cls, "_Stub"); | Class expCls; try { expCls = findStubSkelClass(cls); } catch (Exception ex) { throw new RemoteException("can not find stubs for class: " + cls, ex); } stub = (RemoteStub)getHelperClass(expCls, "_Stub"); | public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); stub = (RemoteStub)getHelperClass(cls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(cls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);} |
skel = (Skeleton)getHelperClass(cls, "_Skel"); | skel = (Skeleton)getHelperClass(expCls, "_Skel"); | public RemoteStub exportObject(Remote obj) throws RemoteException { if (myself == null) { myself = obj; // Save it to server manager, to let client calls in the same VM to issue // local call manager.serverobj = obj; // Find and install the stub Class cls = obj.getClass(); stub = (RemoteStub)getHelperClass(cls, "_Stub"); if (stub == null) { throw new RemoteException("failed to export: " + cls); } // Find and install the skeleton (if there is one) skel = (Skeleton)getHelperClass(cls, "_Skel"); // Build hash of methods which may be called. buildMethodHash(obj.getClass(), true); // Export it. UnicastServer.exportObject(this); } return (stub);} |
throw new MARSHAL("IOException while writing message header"); | MARSHAL m = new MARSHAL("IOException while writing message header"); m.minor = Minor.Header; m.initCause(ex); throw m; | public void write(java.io.OutputStream out) { try { out.write(major & 0xFF); out.write(minor & 0xFF); } catch (IOException ex) { throw new MARSHAL("IOException while writing message header"); } } |
m.minor = Minor.Encapsulation; | public static void write(OutputStream output, TaggedComponent value) { output.write_long(value.tag); output.write_long(value.component_data.length); try { output.write(value.component_data); } catch (IOException e) { MARSHAL m = new MARSHAL(); m.initCause(e); throw m; } } |
|
throw new MARSHAL("IOException while reading message header"); | MARSHAL m = new MARSHAL("IOException while reading message header"); m.initCause(ex); m.minor = Minor.Header; throw m; | public static Version read_version(java.io.InputStream in) { try { int major = in.read() & 0xFF; int minor = in.read() & 0xFF; return new Version(major, minor); } catch (IOException ex) { throw new MARSHAL("IOException while reading message header"); } } |
m.minor = Minor.Encapsulation; | public static TaggedComponent read(InputStream input) { TaggedComponent value = new TaggedComponent(); value.tag = input.read_long(); value.component_data = new byte[input.read_long()]; try { input.read(value.component_data); } catch (IOException e) { MARSHAL m = new MARSHAL(); m.initCause(e); throw m; } return value; } |
|
int hash = (negativeSuffix.hashCode() ^ negativePrefix.hashCode() ^positivePrefix.hashCode() ^ positiveSuffix.hashCode()); return hash; | return toPattern().hashCode(); | public int hashCode () { int hash = (negativeSuffix.hashCode() ^ negativePrefix.hashCode() ^positivePrefix.hashCode() ^ positiveSuffix.hashCode()); // FIXME. return hash; } |
public String[] split(String regex) | public String[] split(String regex, int limit) | public String[] split(String regex) { return Pattern.compile(regex).split(this, 0); } |
return Pattern.compile(regex).split(this, 0); | return Pattern.compile(regex).split(this, limit); | public String[] split(String regex) { return Pattern.compile(regex).split(this, 0); } |
protected VmImplementedInterface(VmType vmClass) { if (vmClass == null) { throw new IllegalArgumentException("vmClass cannot be null"); | protected VmImplementedInterface(String className) { if (className == null) { throw new IllegalArgumentException("className cannot be null"); | protected VmImplementedInterface(VmType vmClass) { if (vmClass == null) { throw new IllegalArgumentException("vmClass cannot be null"); } if (vmClass instanceof VmInterfaceClass) { this.className = vmClass.getName(); this.resolvedClass = (VmInterfaceClass)vmClass; } else { throw new IllegalArgumentException("vmClass must be an interface class"); } } |
if (vmClass instanceof VmInterfaceClass) { this.className = vmClass.getName(); this.resolvedClass = (VmInterfaceClass)vmClass; } else { throw new IllegalArgumentException("vmClass must be an interface class"); } | this.className = className; this.resolvedClass = null; | protected VmImplementedInterface(VmType vmClass) { if (vmClass == null) { throw new IllegalArgumentException("vmClass cannot be null"); } if (vmClass instanceof VmInterfaceClass) { this.className = vmClass.getName(); this.resolvedClass = (VmInterfaceClass)vmClass; } else { throw new IllegalArgumentException("vmClass must be an interface class"); } } |
addNotify() { | public void addNotify() { | addNotify(){ if (getPeer() == null) setPeer((MenuComponentPeer)getToolkit().createMenuBar(this)); Enumeration e = menus.elements(); while (e.hasMoreElements()) { Menu mi = (Menu)e.nextElement(); mi.addNotify(); } if (helpMenu != null) { helpMenu.addNotify(); ((MenuBarPeer) peer).addHelpMenu(helpMenu); }} |
setPeer((MenuComponentPeer)getToolkit().createMenuBar(this)); | setPeer(getToolkit().createMenuBar(this)); | addNotify(){ if (getPeer() == null) setPeer((MenuComponentPeer)getToolkit().createMenuBar(this)); Enumeration e = menus.elements(); while (e.hasMoreElements()) { Menu mi = (Menu)e.nextElement(); mi.addNotify(); } if (helpMenu != null) { helpMenu.addNotify(); ((MenuBarPeer) peer).addHelpMenu(helpMenu); }} |
String param = super.paramString(); | protected String paramString() { String param = super.paramString(); if (layoutMgr != null) param = param + ",layout=" + layoutMgr.getClass().getName(); return param; } |
|
param = param + ",layout=" + layoutMgr.getClass().getName(); | return super.paramString(); | protected String paramString() { String param = super.paramString(); if (layoutMgr != null) param = param + ",layout=" + layoutMgr.getClass().getName(); return param; } |
return param; | StringBuffer sb = new StringBuffer(); sb.append(super.paramString()); sb.append(",layout="); sb.append(layoutMgr.getClass().getName()); return sb.toString(); | protected String paramString() { String param = super.paramString(); if (layoutMgr != null) param = param + ",layout=" + layoutMgr.getClass().getName(); return param; } |
remove(MenuComponent menu) { int index = menus.indexOf(menu); if (index == -1) return; | public synchronized void remove(int index) { Menu m = (Menu) menus.get(index); menus.remove(index); m.removeNotify(); m.parent = null; | remove(MenuComponent menu){ int index = menus.indexOf(menu); if (index == -1) return; remove(index);} |
remove(index); } | if (peer != null) { MenuBarPeer mp = (MenuBarPeer) peer; mp.delMenu(index); } } | remove(MenuComponent menu){ int index = menus.indexOf(menu); if (index == -1) return; remove(index);} |
removeNotify() { | public void removeNotify() { | removeNotify(){ Enumeration e = menus.elements(); while (e.hasMoreElements()) { Menu mi = (Menu) e.nextElement(); mi.removeNotify(); } super.removeNotify();} |
throw new MARSHAL("Not applicable"); | MARSHAL m = new MARSHAL("Inappropriate"); m.minor = Minor.Inappropriate; throw m; | public static POA read(InputStream input) { throw new MARSHAL("Not applicable"); } |
throw new MARSHAL("Not applicable"); | MARSHAL m = new MARSHAL("Inappropriate"); m.minor = Minor.Inappropriate; throw m; | public static void write(OutputStream output, POA value) { throw new MARSHAL("Not applicable"); } |
return new BorderUIResource.CompoundBorderUIResource(outer, inner); | buttonBorder = new BorderUIResource.CompoundBorderUIResource (outer, inner); } return buttonBorder; | public static Border getButtonBorder() { Border outer = new MetalButtonBorder(); Border inner = getMarginBorder(); return new BorderUIResource.CompoundBorderUIResource(outer, inner); } |
if (sharedMarginBorder == null) sharedMarginBorder = new BasicBorders.MarginBorder(); return sharedMarginBorder; | if (marginBorder == null) marginBorder = new BasicBorders.MarginBorder(); return marginBorder; | static Border getMarginBorder() // intentionally not public { /* Swing is not designed to be thread-safe, so there is no * need to synchronize the access to the global variable. */ if (sharedMarginBorder == null) sharedMarginBorder = new BasicBorders.MarginBorder(); return sharedMarginBorder; } |
public JarFile(File file) throws FileNotFoundException, IOException | public JarFile(String fileName) throws FileNotFoundException, IOException | public JarFile(File file) throws FileNotFoundException, IOException { this(file, true); } |
this(file, true); | this(fileName, true); | public JarFile(File file) throws FileNotFoundException, IOException { this(file, true); } |
else { | public void connect() { String proxyPort = "1080"; // default socks proxy port boolean enhanced = false; boolean support132 = false; int port = 23; // default telnet port enhanced = sesProps.containsKey(SESSION_TN_ENHANCED); if (sesProps.containsKey(SESSION_SCREEN_SIZE)) if (((String)sesProps.getProperty(SESSION_SCREEN_SIZE)).equals(SCREEN_SIZE_27X132_STR)) support132 = true; final tnvt vt = new tnvt(screen,enhanced,support132); setVT(vt); vt.setController(this); if (sesProps.containsKey(SESSION_PROXY_PORT)) proxyPort = (String)sesProps.getProperty(SESSION_PROXY_PORT); if (sesProps.containsKey(SESSION_PROXY_HOST)) vt.setProxy((String)sesProps.getProperty(SESSION_PROXY_HOST), proxyPort); if (sesProps.containsKey(org.tn5250j.transport.SSLConstants.SSL_TYPE)) { sslType = (String)sesProps.getProperty(org.tn5250j.transport.SSLConstants.SSL_TYPE); } else { // set default to none sslType = org.tn5250j.transport.SSLConstants.SSL_TYPE_NONE; } vt.setSSLType(sslType); if (sesProps.containsKey(SESSION_CODE_PAGE)) vt.setCodePage((String)sesProps.getProperty(SESSION_CODE_PAGE)); if (sesProps.containsKey(SESSION_DEVICE_NAME)) vt.setDeviceName((String)sesProps.getProperty(SESSION_DEVICE_NAME)); if (sesProps.containsKey(SESSION_HOST_PORT)) { port = Integer.parseInt((String)sesProps.getProperty(SESSION_HOST_PORT)); } else { // set to default 23 of telnet port = 23; } final String ses = (String)sesProps.getProperty(SESSION_HOST); final int portp = port; // lets set this puppy up to connect within its own thread Runnable connectIt = new Runnable() { public void run() { vt.connect(ses,portp); } }; // now lets set it to connect within its own daemon thread // this seems to work better and is more responsive than using // swingutilities's invokelater Thread ct = new Thread(connectIt); ct.setDaemon(true); ct.start(); addSessionListener(this); } |
|
sslType = org.tn5250j.transport.SSLConstants.SSL_TYPE_NONE; } | public void connect() { String proxyPort = "1080"; // default socks proxy port boolean enhanced = false; boolean support132 = false; int port = 23; // default telnet port enhanced = sesProps.containsKey(SESSION_TN_ENHANCED); if (sesProps.containsKey(SESSION_SCREEN_SIZE)) if (((String)sesProps.getProperty(SESSION_SCREEN_SIZE)).equals(SCREEN_SIZE_27X132_STR)) support132 = true; final tnvt vt = new tnvt(screen,enhanced,support132); setVT(vt); vt.setController(this); if (sesProps.containsKey(SESSION_PROXY_PORT)) proxyPort = (String)sesProps.getProperty(SESSION_PROXY_PORT); if (sesProps.containsKey(SESSION_PROXY_HOST)) vt.setProxy((String)sesProps.getProperty(SESSION_PROXY_HOST), proxyPort); if (sesProps.containsKey(org.tn5250j.transport.SSLConstants.SSL_TYPE)) { sslType = (String)sesProps.getProperty(org.tn5250j.transport.SSLConstants.SSL_TYPE); } else { // set default to none sslType = org.tn5250j.transport.SSLConstants.SSL_TYPE_NONE; } vt.setSSLType(sslType); if (sesProps.containsKey(SESSION_CODE_PAGE)) vt.setCodePage((String)sesProps.getProperty(SESSION_CODE_PAGE)); if (sesProps.containsKey(SESSION_DEVICE_NAME)) vt.setDeviceName((String)sesProps.getProperty(SESSION_DEVICE_NAME)); if (sesProps.containsKey(SESSION_HOST_PORT)) { port = Integer.parseInt((String)sesProps.getProperty(SESSION_HOST_PORT)); } else { // set to default 23 of telnet port = 23; } final String ses = (String)sesProps.getProperty(SESSION_HOST); final int portp = port; // lets set this puppy up to connect within its own thread Runnable connectIt = new Runnable() { public void run() { vt.connect(ses,portp); } }; // now lets set it to connect within its own daemon thread // this seems to work better and is more responsive than using // swingutilities's invokelater Thread ct = new Thread(connectIt); ct.setDaemon(true); ct.start(); addSessionListener(this); } |
|
vt.isOnSignoffScreen(); | private void closeSession() { Object[] message = new Object[1]; message[0] = LangTool.getString("cs.message"); String[] options = {LangTool.getString("cs.optThis"), LangTool.getString("cs.optAll"), LangTool.getString("cs.optCancel")}; int result = JOptionPane.showOptionDialog( this.getParent(), // the parent that the dialog blocks message, // the dialog message array LangTool.getString("cs.title"), // the title of the dialog window JOptionPane.DEFAULT_OPTION, // option type JOptionPane.QUESTION_MESSAGE, // message type null, // optional icon, use null to use the default icon options, // options string array, will be made into buttons// options[0] // option that should be made into a default button ); if (result == 0) { closeMe(); } if (result == 1) { me.closingDown((Session)this); } } |
|
createShortCutItems(kbMenu); | private void doPopup (MouseEvent me) { JMenuItem menuItem; Action action; popup = new JPopupMenu(); final Gui5250 g = this; JMenuItem mi; final int pos = screen.getRowColFromPoint(me.getX(),me.getY()) - (screen.getCols()-1); if (!rubberband.isAreaSelected() && screen.isInField(pos,false) ) { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyField(pos); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(false); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); popup.addSeparator(); } else { action = new AbstractAction(LangTool.getString("popup.copy")) { public void actionPerformed(ActionEvent e) { screen.copyMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_COPY)); action = new AbstractAction(LangTool.getString("popup.paste")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(false); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PASTE)); action = new AbstractAction(LangTool.getString("popup.pasteSpecial")) { public void actionPerformed(ActionEvent e) { screen.pasteMe(true); getFocusForMe(); } }; popup.add(action); Rectangle workR = new Rectangle(); if (rubberband.isAreaSelected()) { rubberband.getBoundingArea(workR); // get the width and height int ePos = screen.getRowColFromPoint(workR.width , workR.height ); popup.addSeparator(); menuItem = new JMenuItem(LangTool.getString("popup.selectedColumns") + " " + screen.getCol(ePos)); menuItem.setArmed(false); popup.add(menuItem); menuItem = new JMenuItem(LangTool.getString("popup.selectedRows") + " " + screen.getRow(ePos)); menuItem.setArmed(false); popup.add(menuItem); JMenu sumMenu = new JMenu(LangTool.getString("popup.calc")); popup.add(sumMenu); action = new AbstractAction(LangTool.getString("popup.calcGroupCD")) { public void actionPerformed(ActionEvent e) { sumArea(true); } }; sumMenu.add(action); action = new AbstractAction(LangTool.getString("popup.calcGroupDC")) { public void actionPerformed(ActionEvent e) { sumArea(false); } }; sumMenu.add(action); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.printScreen")) { public void actionPerformed(ActionEvent e) { screen.printMe(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_PRINT_SCREEN)); popup.addSeparator(); JMenu kbMenu = new JMenu(LangTool.getString("popup.keyboard")); popup.add(kbMenu); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); } }; kbMenu.add(action); kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[attn]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[attn]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ATTN)); action = new AbstractAction(LangTool.getString("key.[reset]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[reset]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_RESET)); action = new AbstractAction(LangTool.getString("key.[sysreq]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[sysreq]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_SYSREQ)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } kbMenu.addSeparator(); action = new AbstractAction(LangTool.getString("key.[dupfield]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[dupfield]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_DUP_FIELD)); action = new AbstractAction(LangTool.getString("key.[help]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[help]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_HELP)); action = new AbstractAction(LangTool.getString("key.[eraseeof]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[eraseeof]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_ERASE_EOF)); action = new AbstractAction(LangTool.getString("key.[field+]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field+]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_PLUS)); action = new AbstractAction(LangTool.getString("key.[field-]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[field-]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_FIELD_MINUS)); action = new AbstractAction(LangTool.getString("key.[newline]")) { public void actionPerformed(ActionEvent e) { screen.sendKeys("[newline]"); } }; kbMenu.add(createMenuItem(action,MNEMONIC_NEW_LINE)); action = new AbstractAction(LangTool.getString("popup.hostPrint")) { public void actionPerformed(ActionEvent e) { vt.hostPrint(1); } }; kbMenu.add(createMenuItem(action,MNEMONIC_PRINT)); if (screen.isMessageWait()) { action = new AbstractAction(LangTool.getString("popup.displayMessages")) { public void actionPerformed(ActionEvent e) { vt.systemRequest('4'); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_MESSAGES)); } popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.hexMap")) { public void actionPerformed(ActionEvent e) { showHexMap(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.mapKeys")) { public void actionPerformed(ActionEvent e) { mapMeKeys(); getFocusForMe(); } }; popup.add(createMenuItem(action,"")); action = new AbstractAction(LangTool.getString("popup.settings")) { public void actionPerformed(ActionEvent e) { doAttributes(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_DISP_ATTRIBUTES)); popup.addSeparator(); JMenu macMenu = new JMenu(LangTool.getString("popup.macros")); if (recording) { action = new AbstractAction(LangTool.getString("popup.stop")) { public void actionPerformed(ActionEvent e) { stopRecordingMe(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.record")) { public void actionPerformed(ActionEvent e) { startRecordingMe(); getFocusForMe(); } }; } macMenu.add(action); if (macros.isMacrosExist()) { macMenu.addSeparator(); String[] macrosList = macros.getMacroList(); for (int x = 0; x < macrosList.length; x++) { action = new AbstractAction(macrosList[x]) { public void actionPerformed(ActionEvent e) { executeMeMacro(e); } }; macMenu.add(action); } } popup.add(macMenu); popup.addSeparator(); action = new AbstractAction(LangTool.getString("popup.xtfrFile")) { public void actionPerformed(ActionEvent e) { doMeTransfer(); getFocusForMe(); } }; popup.add(createMenuItem(action,MNEMONIC_FILE_TRANSFER)); JMenu sendMenu = new JMenu(LangTool.getString("popup.send")); popup.add(sendMenu); action = new AbstractAction(LangTool.getString("popup.email")) { public void actionPerformed(ActionEvent e) { sendScreenEMail(); getFocusForMe(); } }; sendMenu.add(createMenuItem(action,MNEMONIC_E_MAIL)); action = new AbstractAction(LangTool.getString("popup.file")) { public void actionPerformed(ActionEvent e) { sendMeToFile(); } }; sendMenu.add(action); popup.addSeparator(); } action = new AbstractAction(LangTool.getString("popup.connections")) { public void actionPerformed(ActionEvent e) { doConnections(); } }; popup.add(createMenuItem(action,MNEMONIC_OPEN_NEW)); popup.addSeparator(); if (vt.isConnected()) { action = new AbstractAction(LangTool.getString("popup.disconnect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } else { action = new AbstractAction(LangTool.getString("popup.connect")) { public void actionPerformed(ActionEvent e) { changeConnection(); getFocusForMe(); } }; } popup.add(createMenuItem(action,MNEMONIC_TOGGLE_CONNECTION)); action = new AbstractAction(LangTool.getString("popup.close")) { public void actionPerformed(ActionEvent e) { closeSession(); } }; popup.add(createMenuItem(action,MNEMONIC_CLOSE)); popup.show(me.getComponent(), me.getX(),me.getY()); } |
|
jumpn = keyMap.isKeyStrokeDefined("[jumpnext]"); jumpp = keyMap.isKeyStrokeDefined("[jumpprev]"); | private void jbInit() throws Exception { this.setLayout(borderLayout1);// this.setOpaque(false); setDoubleBuffered(true); s.setOpaque(false); s.setDoubleBuffered(true); loadProps(); screen = new Screen5250(this,defaultProps); this.addComponentListener(this); if (!defaultProps.containsKey("width") || !defaultProps.containsKey("height")) // set the initialize size this.setSize(screen.getPreferredSize()); else { this.setSize(Integer.parseInt((String)defaultProps.get("width")), Integer.parseInt((String)defaultProps.get("height")) ); } addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { /** @todo check for popup trigger on linux * */// if (e.isPopupTrigger()) { // using SwingUtilities because popuptrigger does not work on linux if (SwingUtilities.isRightMouseButton(e)) { doPopup(e); } } public void mouseReleased(MouseEvent e) {// System.out.println("Mouse Released"); } public void mouseClicked(MouseEvent e) {// if (e.getClickCount() == 2) {//// screen.sendKeys("[enter]");// }// else { screen.moveCursor(e); repaint(); getFocusForMe();// } } }); addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { processVTKeyTyped(e); } public void keyPressed(KeyEvent ke) { processVTKeyPressed(ke); } public void keyReleased(KeyEvent e) { processVTKeyReleased(e); } }); keyMap = new KeyMapper(); keyMap.init(); jumpn = keyMap.isKeyStrokeDefined("[jumpnext]"); jumpp = keyMap.isKeyStrokeDefined("[jumpprev]"); keyMap.addKeyChangeListener(this); /** * this is taken out right now look at the method for description */ initKeyBindings(); macros = new Macronizer(); macros.init(); keyPad.addActionListener(this); if (getStringProperty("keypad").equals("Yes")) keyPad.setVisible(true); else keyPad.setVisible(false); // Warning do not change the the order of the adding of keypad and // the screen. This will cause resizing problems because it will // resize the screen first and during the resize we need to calculate // the bouding area based on the height of the keyPad. // See resizeMe() and getDrawingBounds() this.add(keyPad,BorderLayout.SOUTH); this.add(s,BorderLayout.CENTER); setRubberBand(new TNRubberBand(this)); this.requestFocus(); jumpEvent = new SessionJumpEvent(this); } |
|
if (peer != null) | if (peer != null && !isLightweight()) | public void requestFocus () { if (isDisplayable () && isShowing () && isFocusable ()) { synchronized (getTreeLock ()) { // Find this Component's top-level ancestor. Container parent = getParent (); while (parent != null && !(parent instanceof Window)) parent = parent.getParent (); Window toplevel = (Window) parent; if (toplevel.isFocusableWindow ()) { if (peer != null) // This call will cause a FOCUS_GAINED event to be // posted to the system event queue if the native // windowing system grants the focus request. peer.requestFocus (); else { // Either our peer hasn't been created yet or we're a // lightweight component. In either case we want to // post a FOCUS_GAINED event. EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue (); eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED)); } } else pendingFocusRequest = new FocusEvent(this, FocusEvent.FOCUS_GAINED); } } } |
eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED)); | synchronized (eq) { KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); Component currentFocusOwner = manager.getGlobalPermanentFocusOwner (); if (currentFocusOwner != null) { eq.postEvent (new FocusEvent(currentFocusOwner, FocusEvent.FOCUS_LOST, false, this)); eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, false, currentFocusOwner)); } else eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED, false)); } | public void requestFocus () { if (isDisplayable () && isShowing () && isFocusable ()) { synchronized (getTreeLock ()) { // Find this Component's top-level ancestor. Container parent = getParent (); while (parent != null && !(parent instanceof Window)) parent = parent.getParent (); Window toplevel = (Window) parent; if (toplevel.isFocusableWindow ()) { if (peer != null) // This call will cause a FOCUS_GAINED event to be // posted to the system event queue if the native // windowing system grants the focus request. peer.requestFocus (); else { // Either our peer hasn't been created yet or we're a // lightweight component. In either case we want to // post a FOCUS_GAINED event. EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue (); eq.postEvent (new FocusEvent(this, FocusEvent.FOCUS_GAINED)); } } else pendingFocusRequest = new FocusEvent(this, FocusEvent.FOCUS_GAINED); } } } |
public void setLayer(Component c, int layer, int position) | public void setLayer(Component c, int layer) | public void setLayer(Component c, int layer, int position) { remove(c); add(c, getObjectForLayer (layer)); setPosition(c, position); revalidate(); repaint(); } |
remove(c); add(c, getObjectForLayer (layer)); setPosition(c, position); revalidate(); repaint(); | componentToLayer.put (c, getObjectForLayer (layer)); | public void setLayer(Component c, int layer, int position) { remove(c); add(c, getObjectForLayer (layer)); setPosition(c, position); revalidate(); repaint(); } |
else if (location.length() > 0) { if (location.charAt(0) == '/') { file = location; } else { int lsi = file.lastIndexOf('/'); file = (lsi == -1) ? "/" : file.substring(0, lsi + 1); file += location; } retry = true; } | public void connect() throws IOException { if (connected) { return; } String protocol = url.getProtocol(); boolean secure = "https".equals(protocol); String host = url.getHost(); int port = url.getPort(); if (port < 0) { port = secure ? HTTPConnection.HTTPS_PORT : HTTPConnection.HTTP_PORT; } String file = url.getFile(); String username = url.getUserInfo(); String password = null; if (username != null) { int ci = username.indexOf(':'); if (ci != -1) { password = username.substring(ci + 1); username = username.substring(0, ci); } } final Credentials creds = (username == null) ? null : new Credentials (username, password); boolean retry; do { retry = false; if (connection == null) { connection = getConnection(host, port, secure); if (secure) { SSLSocketFactory factory = getSSLSocketFactory(); HostnameVerifier verifier = getHostnameVerifier(); if (factory != null) { connection.setSSLSocketFactory(factory); } connection.addHandshakeCompletedListener(this); // TODO verifier } } if (proxyHostname != null) { if (proxyPort < 0) { proxyPort = secure ? HTTPConnection.HTTPS_PORT : HTTPConnection.HTTP_PORT; } connection.setProxy(proxyHostname, proxyPort); } request = connection.newRequest(method, file); if (!keepAlive) { request.setHeader("Connection", "close"); } if (agent != null) { request.setHeader("User-Agent", agent); } request.getHeaders().putAll(requestHeaders); if (requestSink != null) { byte[] content = requestSink.toByteArray(); RequestBodyWriter writer = new ByteArrayRequestBodyWriter(content); request.setRequestBodyWriter(writer); } ByteArrayResponseBodyReader reader = new ByteArrayResponseBodyReader(); request.setResponseBodyReader(reader); if (creds != null) { request.setAuthenticator(new Authenticator() { public Credentials getCredentials(String realm, int attempts) { return (attempts < 2) ? creds : null; } }); } response = request.dispatch(); if (response.getCodeClass() == 3 && getInstanceFollowRedirects()) { // Follow redirect String location = response.getHeader("Location"); String connectionUri = connection.getURI(); int start = connectionUri.length(); if (location.startsWith(connectionUri) && location.charAt(start) == '/') { file = location.substring(start); retry = true; } else if (location.startsWith("http:")) { connection.close(); connection = null; secure = false; start = 7; int end = location.indexOf('/', start); host = location.substring(start, end); int ci = host.lastIndexOf(':'); if (ci != -1) { port = Integer.parseInt(host.substring (ci + 1)); host = host.substring(0, ci); } else { port = HTTPConnection.HTTP_PORT; } file = location.substring(end); retry = true; } else if (location.startsWith("https:")) { connection.close(); connection = null; secure = true; start = 8; int end = location.indexOf('/', start); host = location.substring(start, end); int ci = host.lastIndexOf(':'); if (ci != -1) { port = Integer.parseInt(host.substring (ci + 1)); host = host.substring(0, ci); } else { port = HTTPConnection.HTTPS_PORT; } file = location.substring(end); retry = true; } // Otherwise this is not an HTTP redirect, can't follow } else { responseSink = new ByteArrayInputStream(reader.toByteArray ()); } } while (retry); connected = true; } |
|
if (response.getCode() == 404) { errorSink = responseSink; throw new FileNotFoundException(url.toString()); } | public void connect() throws IOException { if (connected) { return; } String protocol = url.getProtocol(); boolean secure = "https".equals(protocol); String host = url.getHost(); int port = url.getPort(); if (port < 0) { port = secure ? HTTPConnection.HTTPS_PORT : HTTPConnection.HTTP_PORT; } String file = url.getFile(); String username = url.getUserInfo(); String password = null; if (username != null) { int ci = username.indexOf(':'); if (ci != -1) { password = username.substring(ci + 1); username = username.substring(0, ci); } } final Credentials creds = (username == null) ? null : new Credentials (username, password); boolean retry; do { retry = false; if (connection == null) { connection = getConnection(host, port, secure); if (secure) { SSLSocketFactory factory = getSSLSocketFactory(); HostnameVerifier verifier = getHostnameVerifier(); if (factory != null) { connection.setSSLSocketFactory(factory); } connection.addHandshakeCompletedListener(this); // TODO verifier } } if (proxyHostname != null) { if (proxyPort < 0) { proxyPort = secure ? HTTPConnection.HTTPS_PORT : HTTPConnection.HTTP_PORT; } connection.setProxy(proxyHostname, proxyPort); } request = connection.newRequest(method, file); if (!keepAlive) { request.setHeader("Connection", "close"); } if (agent != null) { request.setHeader("User-Agent", agent); } request.getHeaders().putAll(requestHeaders); if (requestSink != null) { byte[] content = requestSink.toByteArray(); RequestBodyWriter writer = new ByteArrayRequestBodyWriter(content); request.setRequestBodyWriter(writer); } ByteArrayResponseBodyReader reader = new ByteArrayResponseBodyReader(); request.setResponseBodyReader(reader); if (creds != null) { request.setAuthenticator(new Authenticator() { public Credentials getCredentials(String realm, int attempts) { return (attempts < 2) ? creds : null; } }); } response = request.dispatch(); if (response.getCodeClass() == 3 && getInstanceFollowRedirects()) { // Follow redirect String location = response.getHeader("Location"); String connectionUri = connection.getURI(); int start = connectionUri.length(); if (location.startsWith(connectionUri) && location.charAt(start) == '/') { file = location.substring(start); retry = true; } else if (location.startsWith("http:")) { connection.close(); connection = null; secure = false; start = 7; int end = location.indexOf('/', start); host = location.substring(start, end); int ci = host.lastIndexOf(':'); if (ci != -1) { port = Integer.parseInt(host.substring (ci + 1)); host = host.substring(0, ci); } else { port = HTTPConnection.HTTP_PORT; } file = location.substring(end); retry = true; } else if (location.startsWith("https:")) { connection.close(); connection = null; secure = true; start = 8; int end = location.indexOf('/', start); host = location.substring(start, end); int ci = host.lastIndexOf(':'); if (ci != -1) { port = Integer.parseInt(host.substring (ci + 1)); host = host.substring(0, ci); } else { port = HTTPConnection.HTTPS_PORT; } file = location.substring(end); retry = true; } // Otherwise this is not an HTTP redirect, can't follow } else { responseSink = new ByteArrayInputStream(reader.toByteArray ()); } } while (retry); connected = true; } |
|
hostnameVerifier = defaultVerifier; factory = defaultFactory; | protected HttpsURLConnection(URL url) throws IOException { super(url); hostnameVerifier = defaultVerifier; factory = defaultFactory; } |
|
if (factory == null) { factory = getDefaultSSLSocketFactory(); } | public SSLSocketFactory getSSLSocketFactory() { return factory; } |
|
if (hostnameVerifier == null) { hostnameVerifier = getDefaultHostnameVerifier(); } | public HostnameVerifier getHostnameVerifier() { return hostnameVerifier; } |
|
public HTTPConnection(String hostname, int port, boolean secure) | public HTTPConnection(String hostname) | public HTTPConnection(String hostname, int port, boolean secure) { this(hostname, port, secure, 0, 0); } |
this(hostname, port, secure, 0, 0); | this(hostname, HTTP_PORT, false, 0, 0); | public HTTPConnection(String hostname, int port, boolean secure) { this(hostname, port, secure, 0, 0); } |
public String toUpperCase() | public String toUpperCase(Locale loc) | public String toUpperCase() { return toUpperCase(Locale.getDefault()); } |
return toUpperCase(Locale.getDefault()); | boolean turkish = "tr".equals(loc.getLanguage()); int expand = 0; boolean unchanged = true; int i = count; int x = i + offset; while (--i >= 0) { char ch = value[--x]; expand += upperCaseExpansion(ch); unchanged = (unchanged && expand == 0 && ! (turkish && ch == '\u0069') && ch == Character.toUpperCase(ch)); } if (unchanged) return this; i = count; if (expand == 0) { char[] newStr = (char[]) value.clone(); while (--i >= 0) { char ch = value[x]; newStr[x++] = (turkish && ch == '\u0069') ? '\u0130' : Character.toUpperCase(ch); } return new String(newStr, offset, count, true); } char[] newStr = new char[count + expand]; int j = 0; while (--i >= 0) { char ch = value[x++]; if (turkish && ch == '\u0069') { newStr[j++] = '\u0130'; continue; } expand = upperCaseExpansion(ch); if (expand > 0) { int index = upperCaseIndex(ch); while (expand-- >= 0) newStr[j++] = upperExpand[index++]; } else newStr[j++] = Character.toUpperCase(ch); } return new String(newStr, 0, newStr.length, true); | public String toUpperCase() { return toUpperCase(Locale.getDefault()); } |
catch (ThreadDeath death) { throw death; } | 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 (Throwable t) { AWTError e = new AWTError("Cannot load AWT toolkit: " + toolkit_name); throw (AWTError) e.initCause(t); } } |
|
m.startNewSession(); for (int x = 1; x < os400_sessions.size(); x++ ) { | for (int x = 0; x < os400_sessions.size(); x++ ) { | static public void main(String[] args) { if (isSpecified("-MDI",args)) { useMDIFrames = true; } if (!isSpecified("-nc",args)) { if (!checkBootStrapper(args)) { // if we did not find a running instance and the -d options is // specified start up the bootstrap deamon to allow checking // for running instances if (isSpecified("-d",args)) { strapper = new BootStrapper(); strapper.start(); } } else { System.exit(0); } } My5250 m = new My5250(); if (strapper != null) strapper.addBootListener(m); if (args.length > 0) { if (isSpecified("-width",args) || isSpecified("-height",args)) { int width = m.frame1.getWidth(); int height = m.frame1.getHeight(); if (isSpecified("-width",args)) { width = Integer.parseInt(My5250.getParm("-width",args)); } if (isSpecified("-height",args)) { height = Integer.parseInt(My5250.getParm("-height",args)); } m.frame1.setSize(width,height); m.frame1.centerFrame(); } /** * @todo this crap needs to be rewritten it is a mess */ if (args[0].startsWith("-")) { // check if a session parameter is specified on the command line if (isSpecified("-s",args)) { String sd = getParm("-s",args); if (sessions.containsKey(sd)) { sessions.setProperty("emul.default",sd); } else { args = null; } } // check if a locale parameter is specified on the command line if (isSpecified("-L",args)) { Locale.setDefault(parseLocal(getParm("-L",args))); } LangTool.init(); if (isSpecified("-s",args)) m.sessionArgs = args; else m.sessionArgs = null;// } } else { LangTool.init(); m.sessionArgs = args; } } else { LangTool.init(); m.sessionArgs = null; } if (m.sessionArgs == null && sessions.containsKey("emul.view") && sessions.containsKey("emul.startLastView")) { String[] sargs = new String[NUM_PARMS]; parseArgs(sessions.getProperty("emul.view"), sargs); m.sessionArgs = sargs; } if (m.sessionArgs != null) { // BEGIN // 2001/09/19 natural computing MR Vector os400_sessions = new Vector(); Vector session_params = new Vector(); for (int x = 0; x < m.sessionArgs.length; x++) { if (m.sessionArgs[x] != null) { if (m.sessionArgs[x].equals("-s")) { x++; if (m.sessionArgs[x] != null && sessions.containsKey(m.sessionArgs[x])) { os400_sessions.addElement(m.sessionArgs[x]); }else{ x--; session_params.addElement(m.sessionArgs[x]); } }else{ session_params.addElement(m.sessionArgs[x]); } } } for (int x = 0; x < session_params.size(); x++) m.sessionArgs[x] = session_params.elementAt(x).toString(); m.startNewSession(); for (int x = 1; x < os400_sessions.size(); x++ ) { String sel = os400_sessions.elementAt(x).toString(); if (!m.frame1.isVisible()) { m.splash.updateProgress(++m.step); m.splash.setVisible(false); m.frame1.setVisible(true); m.frame1.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } m.sessionArgs = new String[NUM_PARMS]; m.parseArgs(sessions.getProperty(sel),m.sessionArgs); m.newSession(sel,m.sessionArgs); } // 2001/09/19 natural computing MR // END } else { m.startNewSession(); } } |
try { wait(); } catch(InterruptedException ie) { System.out.println(" updateProgress " + ie.getMessage() ); } | public synchronized void updateProgress(int prog) { progress = prog; repaint(); // wait for it to be painted to ensure progress is updated // continuously// try {// wait();// }// catch(InterruptedException ie) {// System.out.println(" updateProgress " + ie.getMessage() );// } } |
|
public Socket(String host, int port) throws UnknownHostException, IOException | public Socket() | public Socket(String host, int port) throws UnknownHostException, IOException { this(InetAddress.getByName(host), port, null, 0, true); } |
this(InetAddress.getByName(host), port, null, 0, true); | if (factory != null) impl = factory.createSocketImpl(); else impl = new PlainSocketImpl(); | public Socket(String host, int port) throws UnknownHostException, IOException { this(InetAddress.getByName(host), port, null, 0, true); } |