bugged
stringlengths
6
599k
fixed
stringlengths
6
40.8M
__index_level_0__
int64
0
3.24M
public TableColumn getColumn(int columnIndex);
public TableColumn getColumn(int columnIndex);
15,517
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column);
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column);
15,518
public int getTotalColumnWidth();
public int getTotalColumnWidth();
15,519
public SocketException(String message) { super(message); }
public SocketException() { super(message); }
15,520
public SocketException(String message) { super(message); }
public SocketException(String message) { }
15,521
ClassLoader getCallingClassLoader() { Class[] stack = getClassContext(); /* for (int i = 0; i < stack.length; i++) { if (stack[i] != Security.class && stack[i] != ResourceBundle.class) return stack[i].getClassLoader(); } return null; */ return stack[3].getClassLoader(); }
ClassLoadergetCallingClassLoader(){Class[]stack=getClassContext();/*for(inti=0;i<stack.length;i++) { if(stack[i]!=Security.class&&stack[i]!=ResourceBundle.class) returnstack[i].getClassLoader(); }returnnull;*/returnstack[3].getClassLoader();}
15,522
ClassLoader getCallingClassLoader() { Class[] stack = getClassContext(); /* for (int i = 0; i < stack.length; i++) { if (stack[i] != Security.class && stack[i] != ResourceBundle.class) return stack[i].getClassLoader(); } return null; */ return stack[3].getClassLoader(); }
ClassLoader getCallingClassLoader() { Class[] stack = getClassContext(); for (int i = 0; i < stack.length; i++) { if (stack[i] != Security.class && stack[i] != ResourceBundle.class) return stack[i].getClassLoader(); } return null; */ return stack[3].getClassLoader(); }
15,523
ClassLoader getCallingClassLoader() { Class[] stack = getClassContext(); /* for (int i = 0; i < stack.length; i++) { if (stack[i] != Security.class && stack[i] != ResourceBundle.class) return stack[i].getClassLoader(); } return null; */ return stack[3].getClassLoader(); }
ClassLoader getCallingClassLoader() { Class[] stack = getClassContext(); /* for (int i = 0; i < stack.length; i++) { if (stack[i] != Security.class && stack[i] != ResourceBundle.class) return stack[i].getClassLoader(); } return null; */ return stack[3].getClassLoader(); }
15,524
private static final ResourceBundle tryBundle(String localizedName, Locale locale, ClassLoader classloader, ResourceBundle bundle, HashMap cache) { // First look into the cache. if (cache.containsKey(localizedName)) { Reference ref = (Reference) cache.get(localizedName); // If REF is null, that means that we added a `null' value to // the hash map. That means we failed to find the bundle // previously, and we cached that fact. The JDK does this, so // it must be ok. if (ref == null) return null; else { ResourceBundle rb = (ResourceBundle) ref.get(); if (rb != null) { // RB should already have the right parent, except if // something very strange happened. return rb; } // If RB is null, then we previously found it but it was // collected. So we try again. } } // foundBundle holds exact matches for the localizedName resource // bundle, which may later be cached. ResourceBundle foundBundle = null; try { Class rbClass; if (classloader == null) rbClass = Class.forName(localizedName); else rbClass = classloader.loadClass(localizedName); foundBundle = (ResourceBundle) rbClass.newInstance(); foundBundle.parent = bundle; foundBundle.locale = locale; } catch (Exception ex) { // ignore them all foundBundle = null; } if (foundBundle == null) { try { InputStream is; final String resourceName = localizedName.replace('.', '/') + ".properties"; if (classloader == null) is = ClassLoader.getSystemResourceAsStream(resourceName); else is = classloader.getResourceAsStream(resourceName); if (is != null) { foundBundle = new PropertyResourceBundle(is); foundBundle.parent = bundle; foundBundle.locale = locale; } } catch (IOException ex) { } } // Put the result into the hash table. If we didn't find anything // here, we record our parent bundle. If we record `null' that means // nothing, not even the base, was found. if (foundBundle == null) foundBundle = bundle; if (foundBundle == null) cache.put(localizedName, null); else cache.put(localizedName, new SoftReference(foundBundle)); return foundBundle; }
private static final ResourceBundle tryBundle(String localizedName, Locale locale, ClassLoader classloader, ResourceBundle bundle, HashMap cache) { // First look into the cache. if (cache.containsKey(localizedName)) { Reference ref = (Reference) cache.get(localizedName); // If REF is null, that means that we added a `null' value to // the hash map. That means we failed to find the bundle // previously, and we cached that fact. The JDK does this, so // it must be ok. if (ref == null) return null; else { ResourceBundle rb = (ResourceBundle) ref.get(); if (rb != null) { // RB should already have the right parent, except if // something very strange happened. return rb; } // If RB is null, then we previously found it but it was // collected. So we try again. } } // foundBundle holds exact matches for the localizedName resource // bundle, which may later be cached. ResourceBundle foundBundle = null; try { Class rbClass; if (classloader == null) rbClass = Class.forName(localizedName); else rbClass = classloader.loadClass(localizedName); foundBundle = (ResourceBundle) rbClass.newInstance(); foundBundle.parent = bundle; foundBundle.locale = locale; } catch (Exception ex) { // ignore them all foundBundle = null; } if (foundBundle == null) { try { InputStream is; final String resourceName = localizedName.replace('.', '/') + ".properties"; if (classloader == null) is = ClassLoader.getSystemResourceAsStream(resourceName); else is = classloader.getResourceAsStream(resourceName); if (is != null) { foundBundle = new PropertyResourceBundle(is); foundBundle.parent = bundle; foundBundle.locale = locale; } } catch (IOException ex) { } } // Put the result into the hash table. If we didn't find anything // here, we record our parent bundle. If we record `null' that means // nothing, not even the base, was found. if (foundBundle == null) foundBundle = bundle; if (foundBundle == null) cache.put(localizedName, null); else cache.put(localizedName, new SoftReference(foundBundle)); return foundBundle; }
15,526
private static final ResourceBundle tryBundle(String localizedName, Locale locale, ClassLoader classloader, ResourceBundle bundle, HashMap cache) { // First look into the cache. if (cache.containsKey(localizedName)) { Reference ref = (Reference) cache.get(localizedName); // If REF is null, that means that we added a `null' value to // the hash map. That means we failed to find the bundle // previously, and we cached that fact. The JDK does this, so // it must be ok. if (ref == null) return null; else { ResourceBundle rb = (ResourceBundle) ref.get(); if (rb != null) { // RB should already have the right parent, except if // something very strange happened. return rb; } // If RB is null, then we previously found it but it was // collected. So we try again. } } // foundBundle holds exact matches for the localizedName resource // bundle, which may later be cached. ResourceBundle foundBundle = null; try { Class rbClass; if (classloader == null) rbClass = Class.forName(localizedName); else rbClass = classloader.loadClass(localizedName); foundBundle = (ResourceBundle) rbClass.newInstance(); foundBundle.parent = bundle; foundBundle.locale = locale; } catch (Exception ex) { // ignore them all foundBundle = null; } if (foundBundle == null) { try { InputStream is; final String resourceName = localizedName.replace('.', '/') + ".properties"; if (classloader == null) is = ClassLoader.getSystemResourceAsStream(resourceName); else is = classloader.getResourceAsStream(resourceName); if (is != null) { foundBundle = new PropertyResourceBundle(is); foundBundle.parent = bundle; foundBundle.locale = locale; } } catch (IOException ex) { } } // Put the result into the hash table. If we didn't find anything // here, we record our parent bundle. If we record `null' that means // nothing, not even the base, was found. if (foundBundle == null) foundBundle = bundle; if (foundBundle == null) cache.put(localizedName, null); else cache.put(localizedName, new SoftReference(foundBundle)); return foundBundle; }
private static final ResourceBundle tryBundle(String localizedName, Locale locale, ClassLoader classloader, ResourceBundle bundle, HashMap cache) { // First look into the cache. if (cache.containsKey(localizedName)) { Reference ref = (Reference) cache.get(localizedName); // If REF is null, that means that we added a `null' value to // the hash map. That means we failed to find the bundle // previously, and we cached that fact. The JDK does this, so // it must be ok. if (ref == null) return null; else { ResourceBundle rb = (ResourceBundle) ref.get(); if (rb != null) { // RB should already have the right parent, except if // something very strange happened. return rb; } // If RB is null, then we previously found it but it was // collected. So we try again. } } // foundBundle holds exact matches for the localizedName resource // bundle, which may later be cached. ResourceBundle foundBundle = null; try { Class rbClass; if (classloader == null) rbClass = Class.forName(localizedName); else rbClass = classloader.loadClass(localizedName); foundBundle = (ResourceBundle) rbClass.newInstance(); foundBundle.parent = bundle; foundBundle.locale = locale; } catch (Exception ex) { // ignore them all foundBundle = null; } if (foundBundle == null) { try { InputStream is; final String resourceName = localizedName.replace('.', '/') + ".properties"; if (classloader == null) is = ClassLoader.getSystemResourceAsStream(resourceName); else is = classloader.getResourceAsStream(resourceName); if (is != null) { foundBundle = new PropertyResourceBundle(is); foundBundle.parent = bundle; foundBundle.locale = locale; } } catch (IOException ex) { } } // Put the result into the hash table. If we didn't find anything // here, we record our parent bundle. If we record `null' that means // nothing, not even the base, was found. if (foundBundle == null) foundBundle = bundle; if (foundBundle == null) cache.put(localizedName, null); else cache.put(localizedName, new SoftReference(foundBundle)); return foundBundle; }
15,527
private static final ResourceBundle tryLocalBundle(String baseName, Locale locale, ClassLoader classloader, ResourceBundle bundle, HashMap cache) { final String language = locale.getLanguage(); final String country = locale.getCountry(); final String variant = locale.getVariant(); StringBuffer sb = new StringBuffer(60); sb.append(baseName); sb.append('_'); if (language.length() > 0) { sb.append(language); bundle = tryBundle(sb.toString(), new Locale(language), classloader, bundle, cache); } // If LANGUAGE was empty, we still need to try the other // components, and the `_' is required. sb.append('_'); if (country.length() > 0) { sb.append(country); bundle = tryBundle(sb.toString(), new Locale(language, country), classloader, bundle, cache); } sb.append('_'); if (variant.length() > 0) { sb.append(variant); bundle = tryBundle(sb.toString(), locale, classloader, bundle, cache); } return bundle; }
private static final ResourceBundle tryLocalBundle(String baseName, Locale locale, ClassLoader classloader, ResourceBundle bundle, HashMap cache) { final String language = locale.getLanguage(); final String country = locale.getCountry(); final String variant = locale.getVariant(); StringBuffer sb = new StringBuffer(60); sb.append(baseName); sb.append('_'); if (language.length() > 0) { sb.append(language); bundle = tryBundle(sb.toString(), new Locale(language), classloader, bundle, cache); } // If LANGUAGE was empty, we still need to try the other // components, and the `_' is required. sb.append('_'); if (country.length() > 0) { sb.append(country); bundle = tryBundle(sb.toString(), new Locale(language, country), classloader, bundle, cache); } sb.append('_'); if (variant.length() > 0) { sb.append(variant); bundle = tryBundle(sb.toString(), locale, classloader, bundle, cache); } return bundle; }
15,528
public Locale(String language) { this(language, "", ""); }
public Locale(String language, String country, String variant) { this(language, "", ""); }
15,529
public Locale(String language) { this(language, "", ""); }
public Locale(String language) { if (defaultLocale != null) { language = convertLanguage(language).intern(); country = country.toUpperCase().intern(); variant = variant.intern(); } this.language = language; this.country = country; this.variant = variant; hashcode = language.hashCode() ^ country.hashCode() ^ variant.hashCode(); }
15,530
public JCheckBox() { this(null, null); }
public JCheckBox() { this(null, null); }
15,531
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { return null; }
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value!=null) super.setText(value.toString()); return this; }
15,532
public void setSelected(boolean b) { getModel().setSelected(b); }
public void setSelected(boolean b) { getModel().setSelected(b); }
15,533
public void setIcon(Icon icon) { this.icon = icon; if (icon != null) { // XXX FIXME - icons do not know their parent // icon.setParent(this); } revalidate(); repaint(); }
public void setIcon(Icon icon) { this.icon = icon; if (icon != null) { // XXX FIXME - icons do not know their parent // icon.setParent(this); } revalidate(); repaint(); }
15,534
public DefaultTableModel(int numRows, int numColumns) { // Variables int columnIndex; Vector defaultNames; // Create Column Names defaultNames = new Vector(); for (columnIndex = 0; columnIndex < numColumns; columnIndex++) { defaultNames.addElement(super.getColumnName(columnIndex)); } // for // Setup Data// setDataVector(defaultNames, numRows); } // DefaultTableModel()
public DefaultTableModel(int numRows, int numColumns) { // Variables int columnIndex; Vector defaultNames; // Create Column Names defaultNames = new Vector(); for (columnIndex = 0; columnIndex < numColumns; columnIndex++) { defaultNames.addElement(super.getColumnName(columnIndex)); } // for // Setup Data// setDataVector(defaultNames, numRows); } // DefaultTableModel()
15,535
public ListSelectionModel getSelectionModel();
public ListSelectionModel getSelectionModel();
15,536
public String getColumnName(int columnIndex);
public String getColumnName(int columnIndex);
15,537
public void addColumn(TableColumn column);
public void addColumn(TableColumn column);
15,538
public int getColumnCount();
public int getColumnCount();
15,539
public TableColumn(int modelIndex) { this(modelIndex, 75, null, null); } // TableColumn()
public TableColumn(int modelIndex) { this(modelIndex, 75, null, null); } // TableColumn()
15,540
public void removeColumn(TableColumn column);
public void removeColumn(TableColumn column);
15,541
public Class getColumnClass(int columnIndex);
public Class getColumnClass(int columnIndex);
15,542
public int getColumnMargin();
public int getColumnMargin();
15,543
public int getColumnIndex(Object columnIdentifier);
public int getColumnIndex(Object columnIdentifier);
15,544
public boolean getColumnSelectionAllowed();
public boolean getColumnSelectionAllowed();
15,545
public int getRowCount();
public int getRowCount();
15,547
public Object getValueAt(int rowIndex, int columnIndex);
public Object getValueAt(int rowIndex, int columnIndex);
15,548
public void addColumnModelListener(TableColumnModelListener listener);
public void addColumnModelListener(TableColumnModelListener listener);
15,549
public boolean isCellEditable(int rowIndex, int columnIndex);
public boolean isCellEditable(int rowIndex, int columnIndex);
15,550
public void moveColumn(int columnIndex, int newIndex);
public void moveColumn(int columnIndex, int newIndex);
15,551
public void addCellEditorListener(CellEditorListener listener);
public void addCellEditorListener(CellEditorListener listener);
15,552
public void removeColumnModelListener(TableColumnModelListener listener);
public void removeColumnModelListener(TableColumnModelListener listener);
15,553
public void setColumnSelectionAllowed(boolean value);
public void setColumnSelectionAllowed(boolean value);
15,554
public void setColumnMargin(int margin);
public void setColumnMargin(int margin);
15,555
public void removeTableModelListener(TableModelListener listener);
public void removeTableModelListener(TableModelListener listener);
15,556
public void addTableModelListener(TableModelListener listener);
public void addTableModelListener(TableModelListener listener);
15,557
public void setValueAt(Object aValue, int rowIndex, int columnIndex);
public void setValueAt(Object aValue, int rowIndex, int columnIndex);
15,558
public MultipleComponentProfileHolder(TaggedComponent[] initialValue) { value = initialValue; }
public MultipleComponentProfileHolder() { value = initialValue; }
15,559
public MultipleComponentProfileHolder(TaggedComponent[] initialValue) { value = initialValue; }
public MultipleComponentProfileHolder(TaggedComponent[] initialValue) { }
15,560
public String getText() { return text; }
public String getText() { return text; }
15,562
public void setValue(Object v) { val = v; }
public void setValue(Object v) { val = v; }
15,563
Box(int a) { setLayout(new BoxLayout(this, a)); }
Box(int a) { setLayout(new BoxLayout(this, a)); }
15,564
public static Border createEmptyBorder( int top, int left, int bottom, int right) { /* Creates an empty border that takes up no space but which does no drawing, specifying the width of the top, left, bottom, and right sides. Parameters: top - an int specifying the width of the top in pixelsleft - an int specifying the width of the left side in pixelsbottom - an int specifying the width of the right side in pixelsright - an int specifying the width of the bottom in pixelsReturns: the Border object createCompoundBorder */ return null; }
public static Border createEmptyBorder( int top, int left, int bottom, int right) { /* Creates an empty border that takes up no space but which does no drawing, specifying the width of the top, left, bottom, and right sides. Parameters: top - an int specifying the width of the top in pixelsleft - an int specifying the width of the left side in pixelsbottom - an int specifying the width of the right side in pixelsright - an int specifying the width of the bottom in pixelsReturns: the Border object createCompoundBorder */ return null; }
15,565
public JComboBox(Object[] value0) { // TODO } // JComboBox()
public JComboBox(Object[] value0) { // TODO } // JComboBox()
15,566
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"); if (location != null) { 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; } else if (location.length() > 0) { // Malformed absolute URI, treat as file part of URI if (location.charAt(0) == '/') { // Absolute path file = location; } else { // Relative path int lsi = file.lastIndexOf('/'); file = (lsi == -1) ? "/" : file.substring(0, lsi + 1); file += location; } retry = true; } } } else { responseSink = new ByteArrayInputStream(reader.toByteArray ()); if (response.getCode() == 404) { errorSink = responseSink; throw new FileNotFoundException(url.toString()); } } } while (retry); connected = 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"); if (location != null) { 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; } else if (location.length() > 0) { // Malformed absolute URI, treat as file part of URI if (location.charAt(0) == '/') { // Absolute path file = location; } else { // Relative path int lsi = file.lastIndexOf('/'); file = (lsi == -1) ? "/" : file.substring(0, lsi + 1); file += location; } retry = true; } } } else { responseSink = new ByteArrayInputStream(reader.toByteArray ()); if (response.getCode() == 404) { errorSink = responseSink; throw new FileNotFoundException(url.toString()); } } } while (retry); connected = true; }
15,567
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"); if (location != null) { 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; } else if (location.length() > 0) { // Malformed absolute URI, treat as file part of URI if (location.charAt(0) == '/') { // Absolute path file = location; } else { // Relative path int lsi = file.lastIndexOf('/'); file = (lsi == -1) ? "/" : file.substring(0, lsi + 1); file += location; } retry = true; } } } else { responseSink = new ByteArrayInputStream(reader.toByteArray ()); if (response.getCode() == 404) { errorSink = responseSink; throw new FileNotFoundException(url.toString()); } } } while (retry); connected = 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"); if (location != null) { 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; } else if (location.length() > 0) { // Malformed absolute URI, treat as file part of URI if (location.charAt(0) == '/') { // Absolute path file = location; } else { // Relative path int lsi = file.lastIndexOf('/'); file = (lsi == -1) ? "/" : file.substring(0, lsi + 1); file += location; } retry = true; } } } else { responseSink = response.getBody(); if (response.getCode() == 404) { errorSink = responseSink; throw new FileNotFoundException(url.toString()); } } } while (retry); connected = true; }
15,568
HTTPConnection getConnection(String host, int port, boolean secure) throws IOException { HTTPConnection connection; if (keepAlive) { StringBuffer buf = new StringBuffer(secure ? "https://" : "http://"); buf.append(Thread.currentThread().hashCode()); buf.append('@'); 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; }
HTTPConnection getConnection(String host, int port, boolean secure) throws IOException { HTTPConnection connection; if (keepAlive) { StringBuffer buf = new StringBuffer(secure ? "https://" : "http://"); buf.append(Thread.currentThread().hashCode()); buf.append('@'); 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; }
15,569
HTTPConnection getConnection(String host, int port, boolean secure) throws IOException { HTTPConnection connection; if (keepAlive) { StringBuffer buf = new StringBuffer(secure ? "https://" : "http://"); buf.append(Thread.currentThread().hashCode()); buf.append('@'); 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; }
HTTPConnection getConnection(String host, int port, boolean secure) throws IOException { HTTPConnection connection; if (keepAlive) { StringBuffer buf = new StringBuffer(secure ? "https://" : "http://"); buf.append(Thread.currentThread().hashCode()); buf.append('@'); buf.append(host); buf.append(':'); buf.append(port); String key = buf.toString(); synchronized (connectionPool) { connection = (HTTPConnection) connectionPool.remove(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; }
15,570
HTTPConnection getConnection(String host, int port, boolean secure) throws IOException { HTTPConnection connection; if (keepAlive) { StringBuffer buf = new StringBuffer(secure ? "https://" : "http://"); buf.append(Thread.currentThread().hashCode()); buf.append('@'); 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; }
HTTPConnection getConnection(String host, int port, boolean secure) throws IOException { HTTPConnection connection; if (keepAlive) { StringBuffer buf = new StringBuffer(secure ? "https://" : "http://"); buf.append(Thread.currentThread().hashCode()); buf.append('@'); 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; }
15,571
public Map getHeaderFields() { if (!connected) { try { connect(); } catch (IOException e) { return null; } } Map headers = response.getHeaders(); Map ret = new LinkedHashMap(); ret.put("", Collections.singletonList(getStatusLine(response))); for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String key = (String) entry.getKey(); String value = (String) entry.getValue(); ret.put(key, Collections.singletonList(value)); } return ret; }
public Map getHeaderFields() { if (!connected) { try { connect(); } catch (IOException e) { return null; } } Map headers = response.getHeaders(); Map ret = new LinkedHashMap(); ret.put("", Collections.singletonList(getStatusLine(response))); for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String key = (String) entry.getKey(); String value = (String) entry.getValue(); ret.put(key, Collections.singletonList(value)); } return ret; }
15,572
public Map getHeaderFields() { if (!connected) { try { connect(); } catch (IOException e) { return null; } } Map headers = response.getHeaders(); Map ret = new LinkedHashMap(); ret.put("", Collections.singletonList(getStatusLine(response))); for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String key = (String) entry.getKey(); String value = (String) entry.getValue(); ret.put(key, Collections.singletonList(value)); } return ret; }
public Map getHeaderFields() { if (!connected) { try { connect(); } catch (IOException e) { return null; } } Map headers = response.getHeaders(); Map ret = new LinkedHashMap(); ret.put("", Collections.singletonList(getStatusLine(response))); for (Iterator i = headers.entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry) i.next(); String key = (String) entry.getKey(); String value = (String) entry.getValue(); ret.put(key, Collections.singletonList(value)); } return Collections.unmodifiableMap(ret); }
15,573
public int getCodeClass() { return codeClass; }
public int getCodeClass() { return code / 100; }
15,574
public HTTPConnection(String hostname, int port, boolean secure) { this(hostname, port, secure, 0, 0); }
public HTTPConnection(String hostname) { this(hostname, port, secure, 0, 0); }
15,575
public HTTPConnection(String hostname, int port, boolean secure) { this(hostname, port, secure, 0, 0); }
public HTTPConnection(String hostname, int port, boolean secure) { this(hostname, HTTP_PORT, false, 0, 0); }
15,576
public void clearSelection();
public void clearSelection();
15,577
public int write(ByteBuffer src) throws IOException;
public int write(ByteBuffer src) throws IOException;
15,578
public Component getComponent();
public Component getComponent();
15,579
public void setValue(Object value, boolean selected);
public void setValue(Object value, boolean selected);
15,580
public MouseHandler(Device fbDevice, Dimension screenSize) { HardwareCursorAPI hwCursor = null; Device pointerDevice = null; PointerAPI pointerAPI = null; try { hwCursor = (HardwareCursorAPI) fbDevice.getAPI(HardwareCursorAPI.class); } catch (ApiNotFoundException ex) { log.info("No hardware-cursor found on device " + fbDevice.getId()); } if (hwCursor != null) { try { final Collection pointers = DeviceUtils.getDevicesByAPI(PointerAPI.class); if (!pointers.isEmpty()) { pointerDevice = (Device) pointers.iterator().next(); pointerAPI = (PointerAPI) pointerDevice.getAPI(PointerAPI.class); } } catch (ApiNotFoundException ex) { log.error("Strange...", ex); } } this.hwCursor = hwCursor; this.pointerAPI = pointerAPI; this.screenSize = screenSize; if (pointerAPI != null) { log.info("Using PointerDevice " + pointerDevice.getId()); hwCursor.setCursorImage(JNodeCursors.ARROW); hwCursor.setCursorVisible(true); hwCursor.setCursorPosition(x, y); pointerAPI.addPointerListener(this); } }
public MouseHandler(Device fbDevice, Dimension screenSize) { HardwareCursorAPI hwCursor = null; Device pointerDevice = null; PointerAPI pointerAPI = null; try { hwCursor = (HardwareCursorAPI) fbDevice.getAPI(HardwareCursorAPI.class); } catch (ApiNotFoundException ex) { log.info("No hardware-cursor found on device " + fbDevice.getId()); } if (hwCursor != null) { try { final Collection pointers = DeviceUtils.getDevicesByAPI(PointerAPI.class); if (!pointers.isEmpty()) { pointerDevice = (Device) pointers.iterator().next(); pointerAPI = (PointerAPI) pointerDevice.getAPI(PointerAPI.class); } } catch (ApiNotFoundException ex) { log.error("Strange...", ex); } } this.hwCursor = hwCursor; this.pointerAPI = pointerAPI; this.screenSize = screenSize; if (pointerAPI != null) { log.debug("Using PointerDevice " + pointerDevice.getId()); hwCursor.setCursorImage(JNodeCursors.ARROW); hwCursor.setCursorVisible(true); hwCursor.setCursorPosition(x, y); pointerAPI.addPointerListener(this); } }
15,581
public BufferedImage createCompatibleImage(int w, int h) { return createCompatibleImage(w, h, Transparency.OPAQUE); }
public BufferedImage createCompatibleImage(int w, int h) { return createCompatibleImage(w, h, Transparency.OPAQUE); }
15,582
public abstract Image createImage(byte[] data, int offset, int len);
public abstract Image createImage(byte[] data, int offset, int len);
15,583
public CodeSource(URL location, Certificate[] certs) { this.location = location; if (certs != null) this.certs = new HashSet(Arrays.asList(certs)); }
public CodeSource(URL location, Certificate[] certs) { this.location = location; if (certs != null) this.certs = new HashSet(Arrays.asList(certs)); }
15,584
public CodeSource(URL location, Certificate[] certs) { this.location = location; if (certs != null) this.certs = new HashSet(Arrays.asList(certs)); }
public CodeSource(URL location, Certificate[] certs) { this.location = location; if (certs != null) this.certs = new HashSet(Arrays.asList(certs)); }
15,585
public boolean equals(Object obj) { if (!(obj instanceof CodeSource)) return false; CodeSource cs = (CodeSource) obj; return (certs == null ? cs.certs == null : certs.equals(cs.certs)) && (location == null ? cs.location == null : location .equals(cs.location)); }
public boolean equals(Object obj) { if (!(obj instanceof CodeSource)) return false; CodeSource cs = (CodeSource) obj; return (certs == null ? cs.certs == null : certs.equals(cs.certs)) && (location == null ? cs.location == null : location .equals(cs.location)); }
15,586
public boolean equals(Object obj) { if (!(obj instanceof CodeSource)) return false; CodeSource cs = (CodeSource) obj; return (certs == null ? cs.certs == null : certs.equals(cs.certs)) && (location == null ? cs.location == null : location .equals(cs.location)); }
public boolean equals(Object obj) { if (!(obj instanceof CodeSource)) return false; CodeSource cs = (CodeSource) obj; return (certs == null ? cs.certs == null : certs.equals(cs.certs)) && (location == null ? cs.location == null : location .equals(cs.location)); }
15,587
public final Certificate[] getCertificates() { if (certs == null) return null; Certificate[] c = new Certificate[ certs.size()]; certs.toArray(c); return c; }
public final Certificate[] getCertificates() { if (certs == null) return null; Certificate[] c = new Certificate[ certs.size()]; certs.toArray(c); return c; }
15,588
public final URL getLocation() { return location; }
public final URL getLocation() { return location; }
15,589
public int hashCode() { return (location == null ? 0 : location.hashCode()) ^ (certs == null ? 0 : certs.hashCode()); }
public int hashCode() { return (location == null ? 0 : location.hashCode()) ^ (certs == null ? 0 : certs.hashCode()); }
15,590
public boolean implies(CodeSource cs) { if (cs == null) return false; // First check the certificate list. if (certs != null && (cs.certs == null || !certs.containsAll(cs.certs))) { return false; } // Next check the location. if (location == null) { return true; } if (cs.location == null) { return false; } if (!location.getProtocol().equals(cs.location.getProtocol())) { return false; } final int ourPort = location.getPort(); if ((ourPort != -1) && (ourPort != cs.location.getPort())) { return false; } final String ourRef = location.getRef(); if ((ourRef != null) && !ourRef.equals(cs.location.getRef())) { return false; } final String ourHost = location.getHost(); if (ourHost != null) { final String their_host = cs.location.getHost(); if (their_host == null) { return false; } final SocketPermission our_sockperm = new SocketPermission(ourHost, "accept"); final SocketPermission their_sockperm = new SocketPermission( their_host, "accept"); if (!our_sockperm.implies(their_sockperm)) { return false; } } String our_file = location.getFile(); if (our_file != null) { if (!our_file.endsWith("/")) { our_file += "/"; } final String their_file = cs.location.getFile(); if (their_file == null || !their_file.startsWith(our_file)) return false; } return true; }
public boolean implies(CodeSource cs) { if (cs == null) return false; // First check the certificate list. if (certs != null && (cs.certs == null || !certs.containsAll(cs.certs))) { return false; } // Next check the location. if (location == null) { return true; } if (cs.location == null) { return false; } if (!location.getProtocol().equals(cs.location.getProtocol())) { return false; } final int ourPort = location.getPort(); if ((ourPort != -1) && (ourPort != cs.location.getPort())) { return false; } final String ourRef = location.getRef(); if ((ourRef != null) && !ourRef.equals(cs.location.getRef())) { return false; } final String ourHost = location.getHost(); if (ourHost != null) { final String their_host = cs.location.getHost(); if (their_host == null) { return false; } final SocketPermission our_sockperm = new SocketPermission(ourHost, "accept"); final SocketPermission their_sockperm = new SocketPermission( their_host, "accept"); if (!our_sockperm.implies(their_sockperm)) { return false; } } String our_file = location.getFile(); if (our_file != null) { if (!our_file.endsWith("/")) { our_file += "/"; } final String their_file = cs.location.getFile(); if (their_file == null || !their_file.startsWith(our_file)) return false; } return true; }
15,591
public boolean implies(CodeSource cs) { if (cs == null) return false; // First check the certificate list. if (certs != null && (cs.certs == null || !certs.containsAll(cs.certs))) { return false; } // Next check the location. if (location == null) { return true; } if (cs.location == null) { return false; } if (!location.getProtocol().equals(cs.location.getProtocol())) { return false; } final int ourPort = location.getPort(); if ((ourPort != -1) && (ourPort != cs.location.getPort())) { return false; } final String ourRef = location.getRef(); if ((ourRef != null) && !ourRef.equals(cs.location.getRef())) { return false; } final String ourHost = location.getHost(); if (ourHost != null) { final String their_host = cs.location.getHost(); if (their_host == null) { return false; } final SocketPermission our_sockperm = new SocketPermission(ourHost, "accept"); final SocketPermission their_sockperm = new SocketPermission( their_host, "accept"); if (!our_sockperm.implies(their_sockperm)) { return false; } } String our_file = location.getFile(); if (our_file != null) { if (!our_file.endsWith("/")) { our_file += "/"; } final String their_file = cs.location.getFile(); if (their_file == null || !their_file.startsWith(our_file)) return false; } return true; }
public boolean implies(CodeSource cs) { if (cs == null) return false; // First check the certificate list. if (certs != null && (cs.certs == null || ! certs.containsAll(cs.certs))) return false; // Next check the location. if (location == null) { return true; } if (cs.location == null) { return false; } if (!location.getProtocol().equals(cs.location.getProtocol())) { return false; } final int ourPort = location.getPort(); if ((ourPort != -1) && (ourPort != cs.location.getPort())) { return false; } final String ourRef = location.getRef(); if ((ourRef != null) && !ourRef.equals(cs.location.getRef())) { return false; } final String ourHost = location.getHost(); if (ourHost != null) { final String their_host = cs.location.getHost(); if (their_host == null) { return false; } final SocketPermission our_sockperm = new SocketPermission(ourHost, "accept"); final SocketPermission their_sockperm = new SocketPermission( their_host, "accept"); if (!our_sockperm.implies(their_sockperm)) { return false; } } String our_file = location.getFile(); if (our_file != null) { if (!our_file.endsWith("/")) { our_file += "/"; } final String their_file = cs.location.getFile(); if (their_file == null || !their_file.startsWith(our_file)) return false; } return true; }
15,592
public boolean implies(CodeSource cs) { if (cs == null) return false; // First check the certificate list. if (certs != null && (cs.certs == null || !certs.containsAll(cs.certs))) { return false; } // Next check the location. if (location == null) { return true; } if (cs.location == null) { return false; } if (!location.getProtocol().equals(cs.location.getProtocol())) { return false; } final int ourPort = location.getPort(); if ((ourPort != -1) && (ourPort != cs.location.getPort())) { return false; } final String ourRef = location.getRef(); if ((ourRef != null) && !ourRef.equals(cs.location.getRef())) { return false; } final String ourHost = location.getHost(); if (ourHost != null) { final String their_host = cs.location.getHost(); if (their_host == null) { return false; } final SocketPermission our_sockperm = new SocketPermission(ourHost, "accept"); final SocketPermission their_sockperm = new SocketPermission( their_host, "accept"); if (!our_sockperm.implies(their_sockperm)) { return false; } } String our_file = location.getFile(); if (our_file != null) { if (!our_file.endsWith("/")) { our_file += "/"; } final String their_file = cs.location.getFile(); if (their_file == null || !their_file.startsWith(our_file)) return false; } return true; }
public boolean implies(CodeSource cs) { if (cs == null) return false; // First check the certificate list. if (certs != null && (cs.certs == null || !certs.containsAll(cs.certs))) { return false; } // Next check the location. if (location == null) { return true; } if (cs.location == null) { return false; } if (!location.getProtocol().equals(cs.location.getProtocol())) { return false; } final int ourPort = location.getPort(); if ((ourPort != -1) && (ourPort != cs.location.getPort())) { return false; } final String ourRef = location.getRef(); if ((ourRef != null) && !ourRef.equals(cs.location.getRef())) { return false; } final String ourHost = location.getHost(); if (ourHost != null) { final String their_host = cs.location.getHost(); if (their_host == null) { return false; } final SocketPermission our_sockperm = new SocketPermission(ourHost, "accept"); final SocketPermission their_sockperm = new SocketPermission( their_host, "accept"); if (!our_sockperm.implies(their_sockperm)) { return false; } } String our_file = location.getFile(); if (our_file != null) { if (!our_file.endsWith("/")) { our_file += "/"; } final String their_file = cs.location.getFile(); if (their_file == null || !their_file.startsWith(our_file)) return false; } return true; }
15,593
public boolean implies(CodeSource cs) { if (cs == null) return false; // First check the certificate list. if (certs != null && (cs.certs == null || !certs.containsAll(cs.certs))) { return false; } // Next check the location. if (location == null) { return true; } if (cs.location == null) { return false; } if (!location.getProtocol().equals(cs.location.getProtocol())) { return false; } final int ourPort = location.getPort(); if ((ourPort != -1) && (ourPort != cs.location.getPort())) { return false; } final String ourRef = location.getRef(); if ((ourRef != null) && !ourRef.equals(cs.location.getRef())) { return false; } final String ourHost = location.getHost(); if (ourHost != null) { final String their_host = cs.location.getHost(); if (their_host == null) { return false; } final SocketPermission our_sockperm = new SocketPermission(ourHost, "accept"); final SocketPermission their_sockperm = new SocketPermission( their_host, "accept"); if (!our_sockperm.implies(their_sockperm)) { return false; } } String our_file = location.getFile(); if (our_file != null) { if (!our_file.endsWith("/")) { our_file += "/"; } final String their_file = cs.location.getFile(); if (their_file == null || !their_file.startsWith(our_file)) return false; } return true; }
public boolean implies(CodeSource cs) { if (cs == null) return false; // First check the certificate list. if (certs != null && (cs.certs == null || !certs.containsAll(cs.certs))) { return false; } // Next check the location. if (location == null) { return true; } if (cs.location == null) { return false; } if (!location.getProtocol().equals(cs.location.getProtocol())) { return false; } final int ourPort = location.getPort(); if ((ourPort != -1) && (ourPort != cs.location.getPort())) { return false; } final String ourRef = location.getRef(); if ((ourRef != null) && !ourRef.equals(cs.location.getRef())) { return false; } final String ourHost = location.getHost(); if (ourHost != null) { final String their_host = cs.location.getHost(); if (their_host == null) { return false; } final SocketPermission our_sockperm = new SocketPermission(ourHost, "accept"); final SocketPermission their_sockperm = new SocketPermission( their_host, "accept"); if (!our_sockperm.implies(their_sockperm)) { return false; } } String our_file = location.getFile(); if (our_file != null) { if (!our_file.endsWith("/")) { our_file += "/"; } final String their_file = cs.location.getFile(); if (their_file == null || !their_file.startsWith(our_file)) return false; } return true; }
15,594
public boolean implies(CodeSource cs) { if (cs == null) return false; // First check the certificate list. if (certs != null && (cs.certs == null || !certs.containsAll(cs.certs))) { return false; } // Next check the location. if (location == null) { return true; } if (cs.location == null) { return false; } if (!location.getProtocol().equals(cs.location.getProtocol())) { return false; } final int ourPort = location.getPort(); if ((ourPort != -1) && (ourPort != cs.location.getPort())) { return false; } final String ourRef = location.getRef(); if ((ourRef != null) && !ourRef.equals(cs.location.getRef())) { return false; } final String ourHost = location.getHost(); if (ourHost != null) { final String their_host = cs.location.getHost(); if (their_host == null) { return false; } final SocketPermission our_sockperm = new SocketPermission(ourHost, "accept"); final SocketPermission their_sockperm = new SocketPermission( their_host, "accept"); if (!our_sockperm.implies(their_sockperm)) { return false; } } String our_file = location.getFile(); if (our_file != null) { if (!our_file.endsWith("/")) { our_file += "/"; } final String their_file = cs.location.getFile(); if (their_file == null || !their_file.startsWith(our_file)) return false; } return true; }
public boolean implies(CodeSource cs) { if (cs == null) return false; // First check the certificate list. if (certs != null && (cs.certs == null || !certs.containsAll(cs.certs))) { return false; } // Next check the location. if (location == null) { return true; } if (cs.location == null) { return false; } if (!location.getProtocol().equals(cs.location.getProtocol())) { return false; } final int ourPort = location.getPort(); if ((ourPort != -1) && (ourPort != cs.location.getPort())) { return false; } final String ourRef = location.getRef(); if ((ourRef != null) && !ourRef.equals(cs.location.getRef())) { return false; } final String ourHost = location.getHost(); if (ourHost != null) { final String their_host = cs.location.getHost(); if (their_host == null) { return false; } final SocketPermission our_sockperm = new SocketPermission(ourHost, "accept"); final SocketPermission their_sockperm = new SocketPermission( their_host, "accept"); if (!our_sockperm.implies(their_sockperm)) { return false; } } String our_file = location.getFile(); if (our_file != null) { if (!our_file.endsWith("/")) { our_file += "/"; } final String their_file = cs.location.getFile(); if (their_file == null || !their_file.startsWith(our_file)) return false; } return true; }
15,595
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[ bytes]; for (int i = 0; i < bytes; i++) encoded[ i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[ bytes]; for (int i = 0; i < bytes; i++) encoded[ i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
15,596
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[ bytes]; for (int i = 0; i < bytes; i++) encoded[ i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[ bytes]; for (int i = 0; i < bytes; i++) encoded[ i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
15,597
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[ bytes]; for (int i = 0; i < bytes; i++) encoded[ i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[bytes]; for (int i = 0; i < bytes; i++) encoded[ i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
15,598
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[ bytes]; for (int i = 0; i < bytes; i++) encoded[ i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[ bytes]; for (int i = 0; i < bytes; i++) encoded[i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
15,599
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[ bytes]; for (int i = 0; i < bytes; i++) encoded[ i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[ bytes]; for (int i = 0; i < bytes; i++) encoded[ i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
15,600
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[ bytes]; for (int i = 0; i < bytes; i++) encoded[ i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); int count = s.readInt(); certs = new HashSet(); while (--count >= 0) { String type = (String) s.readObject(); int bytes = s.readInt(); byte[] encoded = new byte[ bytes]; for (int i = 0; i < bytes; i++) encoded[ i] = s.readByte(); ByteArrayInputStream stream = new ByteArrayInputStream(encoded); try { CertificateFactory factory = CertificateFactory .getInstance(type); certs.add(factory.generateCertificate(stream)); } catch (CertificateException e) { // XXX Should we ignore this certificate? } } }
15,601
public String toString() { StringBuffer sb = new StringBuffer("(").append(location); if (certs == null || certs.isEmpty()) sb.append(" <no certificates>"); else { Iterator iter = certs.iterator(); for (int i = certs.size(); --i >= 0;) sb.append(' ').append(iter.next()); } return sb.append(")").toString(); }
public String toString() { StringBuffer sb = new StringBuffer("(").append(location); if (certs == null || certs.isEmpty()) sb.append(" <no certificates>"); else { Iterator iter = certs.iterator(); for (int i = certs.size(); --i >= 0;) sb.append(' ').append(iter.next()); } return sb.append(")").toString(); }
15,602
public String toString() { StringBuffer sb = new StringBuffer("(").append(location); if (certs == null || certs.isEmpty()) sb.append(" <no certificates>"); else { Iterator iter = certs.iterator(); for (int i = certs.size(); --i >= 0;) sb.append(' ').append(iter.next()); } return sb.append(")").toString(); }
public String toString() { StringBuffer sb = new StringBuffer("(").append(location); if (certs == null || certs.isEmpty()) sb.append(" <no certificates>"); else { Iterator iter = certs.iterator(); for (int i = certs.size(); --i >= 0;) sb.append(' ').append(iter.next()); } return sb.append(")").toString(); }
15,603
public String toString() { StringBuffer sb = new StringBuffer("(").append(location); if (certs == null || certs.isEmpty()) sb.append(" <no certificates>"); else { Iterator iter = certs.iterator(); for (int i = certs.size(); --i >= 0;) sb.append(' ').append(iter.next()); } return sb.append(")").toString(); }
public String toString() { StringBuffer sb = new StringBuffer("(").append(location); if (certs == null || certs.isEmpty()) sb.append(" <no certificates>"); else { Iterator iter = certs.iterator(); for (int i = certs.size(); --i >= 0; ) sb.append(' ').append(iter.next()); } return sb.append(")").toString(); }
15,604
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
15,605
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
15,606
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
15,607
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
15,608
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
15,609
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
15,610
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[ i]); } } } }
private void writeObject(ObjectOutputStream s) throws IOException { s.defaultWriteObject(); if (certs == null) s.writeInt(0); else { int count = certs.size(); s.writeInt(count); Iterator iter = certs.iterator(); while (--count >= 0) { Certificate c = (Certificate) iter.next(); s.writeObject(c.getType()); byte[] encoded; try { encoded = c.getEncoded(); } catch (CertificateEncodingException e) { // XXX Should we ignore this certificate? encoded = null; } if (encoded == null) s.writeInt(0); else { s.writeInt(encoded.length); for (int i = 0; i < encoded.length; i++) s.writeByte(encoded[i]); } } } }
15,611
public boolean equals(Object obj) { if (obj == null || !(obj instanceof URL)) return false; URL uObj = (URL) obj; return handler.equals(this, uObj); }
public boolean equals(Object obj) { if (obj == null || !(obj instanceof URL)) return false; URL uObj = (URL) obj; return handler.equals(this, uObj); }
15,612
public boolean equals(Object obj) { if (obj == null || !(obj instanceof URL)) return false; URL uObj = (URL) obj; return handler.equals(this, uObj); }
public boolean equals(Object obj) { if (obj == null || !(obj instanceof URL)) return false; URL uObj = (URL) obj; return handler.equals(this, uObj); }
15,613
public int hashCode() { if (hashCode != 0) return hashCode; // Use cached value if available. else return handler.hashCode(this); }
public int hashCode() { if (hashCode != 0) return hashCode; // Use cached value if available. else return handler.hashCode(this); }
15,614
public int hashCode() { if (hashCode != 0) return hashCode; // Use cached value if available. else return handler.hashCode(this); }
public int hashCode() { if (hashCode != 0) return hashCode; // Use cached value if available. else return ph.hashCode(this); }
15,615
public String getRef() { return ref; }
public String getRef() { return ref; }
15,616
public boolean implies(Permission perm) { SocketPermission p; // First make sure we are the right object type if (perm instanceof SocketPermission) p = (SocketPermission) perm; else return false; // Next check the actions String ourlist = getActions(); String theirlist = p.getActions(); if (! ourlist.startsWith(theirlist)) return false; // Now check ports int ourfirstport = 0; // Now check ports int ourlastport = 0; // Now check ports int theirfirstport = 0; // Now check ports int theirlastport = 0; // Get ours if (hostport.indexOf(":") == -1) { ourfirstport = 0; ourlastport = 65535; } else { // FIXME: Needs bulletproofing. // This will dump if hostport if all sorts of bad data was passed to // the constructor String range = hostport.substring(hostport.indexOf(":") + 1); if (range.startsWith("-")) ourfirstport = 0; else if (range.indexOf("-") == -1) ourfirstport = Integer.parseInt(range); else ourfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) ourlastport = 65535; else if (range.indexOf("-") == -1) ourlastport = Integer.parseInt(range); else ourlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Get theirs if (p.hostport.indexOf(":") == -1) { theirfirstport = 0; ourlastport = 65535; } else { // This will dump if hostport if all sorts of bad data was passed to // the constructor// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Wrong usage of hostport and not p.hostport in call to indexOf String range = p.hostport.substring(p.hostport.indexOf(":") + 1);// @classpath-bugfix-end if (range.startsWith("-")) theirfirstport = 0; else if (range.indexOf("-") == -1) theirfirstport = Integer.parseInt(range); else theirfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) theirlastport = 65535; else if (range.indexOf("-") == -1) theirlastport = Integer.parseInt(range); else theirlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Now check them if ((theirfirstport < ourfirstport) || (theirlastport > ourlastport)) return false; // Finally we can check the hosts String ourhost; // Finally we can check the hosts String theirhost; // Get ours if (hostport.indexOf(":") == -1) ourhost = hostport; else ourhost = hostport.substring(0, hostport.indexOf(":")); // Get theirs if (p.hostport.indexOf(":") == -1) theirhost = p.hostport; else theirhost = p.hostport.substring(0, p.hostport.indexOf(":")); // Are they equal? if (ourhost.equals(theirhost)) return true; // Try the canonical names String ourcanonical = null; // Try the canonical names String theircanonical = null; try { ourcanonical = InetAddress.getByName(ourhost).getHostName(); theircanonical = InetAddress.getByName(theirhost).getHostName(); } catch (UnknownHostException e) { // Who didn't resolve? Just assume current address is canonical enough // Is this ok to do? if (ourcanonical == null) ourcanonical = ourhost; if (theircanonical == null) theircanonical = theirhost; } if (ourcanonical.equals(theircanonical)) return true; // Well, last chance. Try for a wildcard if (ourhost.indexOf("*.") != -1) { String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1)); if (theircanonical.endsWith(wild_domain)) return true; }// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Missed wildcard as host address if (ourhost.equals("*")) return true;// @classpath-bugfix-end // Didn't make it return false; }
public boolean implies(Permission perm) { SocketPermission p; // First make sure we are the right object type if (perm instanceof SocketPermission) p = (SocketPermission) perm; else return false; // Next check the actions String ourlist = getActions(); String theirlist = p.getActions(); if (! ourlist.startsWith(theirlist)) return false; // Now check ports int ourfirstport = 0; // Now check ports int ourlastport = 0; // Now check ports int theirfirstport = 0; // Now check ports int theirlastport = 0; // Get ours if (hostport.indexOf(":") == -1) { ourfirstport = 0; ourlastport = 65535; } else { // FIXME: Needs bulletproofing. // This will dump if hostport if all sorts of bad data was passed to // the constructor String range = hostport.substring(hostport.indexOf(":") + 1); if (range.startsWith("-")) ourfirstport = 0; else if (range.indexOf("-") == -1) ourfirstport = Integer.parseInt(range); else ourfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) ourlastport = 65535; else if (range.indexOf("-") == -1) ourlastport = Integer.parseInt(range); else ourlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Get theirs if (p.hostport.indexOf(":") == -1) { theirfirstport = 0; ourlastport = 65535; } else { // This will dump if hostport if all sorts of bad data was passed to // the constructor// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Wrong usage of hostport and not p.hostport in call to indexOf String range = p.hostport.substring(p.hostport.indexOf(":") + 1);// @classpath-bugfix-end if (range.startsWith("-")) theirfirstport = 0; else if (range.indexOf("-") == -1) theirfirstport = Integer.parseInt(range); else theirfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) theirlastport = 65535; else if (range.indexOf("-") == -1) theirlastport = Integer.parseInt(range); else theirlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Now check them if ((theirfirstport < ourfirstport) || (theirlastport > ourlastport)) return false; // Finally we can check the hosts String ourhost; // Finally we can check the hosts String theirhost; // Get ours if (hostport.indexOf(":") == -1) ourhost = hostport; else ourhost = hostport.substring(0, hostport.indexOf(":")); // Get theirs if (p.hostport.indexOf(":") == -1) theirhost = p.hostport; else theirhost = p.hostport.substring(0, p.hostport.indexOf(":")); // Are they equal? if (ourhost.equals(theirhost)) return true; // Try the canonical names String ourcanonical = null; // Try the canonical names String theircanonical = null; try { ourcanonical = InetAddress.getByName(ourhost).getHostName(); theircanonical = InetAddress.getByName(theirhost).getHostName(); } catch (UnknownHostException e) { // Who didn't resolve? Just assume current address is canonical enough // Is this ok to do? if (ourcanonical == null) ourcanonical = ourhost; if (theircanonical == null) theircanonical = theirhost; } if (ourcanonical.equals(theircanonical)) return true; // Well, last chance. Try for a wildcard if (ourhost.indexOf("*.") != -1) { String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1)); if (theircanonical.endsWith(wild_domain)) return true; }// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Missed wildcard as host address if (ourhost.equals("*")) return true;// @classpath-bugfix-end // Didn't make it return false; }
15,617
public boolean implies(Permission perm) { SocketPermission p; // First make sure we are the right object type if (perm instanceof SocketPermission) p = (SocketPermission) perm; else return false; // Next check the actions String ourlist = getActions(); String theirlist = p.getActions(); if (! ourlist.startsWith(theirlist)) return false; // Now check ports int ourfirstport = 0; // Now check ports int ourlastport = 0; // Now check ports int theirfirstport = 0; // Now check ports int theirlastport = 0; // Get ours if (hostport.indexOf(":") == -1) { ourfirstport = 0; ourlastport = 65535; } else { // FIXME: Needs bulletproofing. // This will dump if hostport if all sorts of bad data was passed to // the constructor String range = hostport.substring(hostport.indexOf(":") + 1); if (range.startsWith("-")) ourfirstport = 0; else if (range.indexOf("-") == -1) ourfirstport = Integer.parseInt(range); else ourfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) ourlastport = 65535; else if (range.indexOf("-") == -1) ourlastport = Integer.parseInt(range); else ourlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Get theirs if (p.hostport.indexOf(":") == -1) { theirfirstport = 0; ourlastport = 65535; } else { // This will dump if hostport if all sorts of bad data was passed to // the constructor// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Wrong usage of hostport and not p.hostport in call to indexOf String range = p.hostport.substring(p.hostport.indexOf(":") + 1);// @classpath-bugfix-end if (range.startsWith("-")) theirfirstport = 0; else if (range.indexOf("-") == -1) theirfirstport = Integer.parseInt(range); else theirfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) theirlastport = 65535; else if (range.indexOf("-") == -1) theirlastport = Integer.parseInt(range); else theirlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Now check them if ((theirfirstport < ourfirstport) || (theirlastport > ourlastport)) return false; // Finally we can check the hosts String ourhost; // Finally we can check the hosts String theirhost; // Get ours if (hostport.indexOf(":") == -1) ourhost = hostport; else ourhost = hostport.substring(0, hostport.indexOf(":")); // Get theirs if (p.hostport.indexOf(":") == -1) theirhost = p.hostport; else theirhost = p.hostport.substring(0, p.hostport.indexOf(":")); // Are they equal? if (ourhost.equals(theirhost)) return true; // Try the canonical names String ourcanonical = null; // Try the canonical names String theircanonical = null; try { ourcanonical = InetAddress.getByName(ourhost).getHostName(); theircanonical = InetAddress.getByName(theirhost).getHostName(); } catch (UnknownHostException e) { // Who didn't resolve? Just assume current address is canonical enough // Is this ok to do? if (ourcanonical == null) ourcanonical = ourhost; if (theircanonical == null) theircanonical = theirhost; } if (ourcanonical.equals(theircanonical)) return true; // Well, last chance. Try for a wildcard if (ourhost.indexOf("*.") != -1) { String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1)); if (theircanonical.endsWith(wild_domain)) return true; }// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Missed wildcard as host address if (ourhost.equals("*")) return true;// @classpath-bugfix-end // Didn't make it return false; }
public boolean implies(Permission perm) { SocketPermission p; // First make sure we are the right object type if (perm instanceof SocketPermission) p = (SocketPermission) perm; else return false; // Next check the actions String ourlist = getActions(); String theirlist = p.getActions(); if (! ourlist.startsWith(theirlist)) return false; // Now check ports int ourfirstport = 0; // Now check ports int ourlastport = 0; // Now check ports int theirfirstport = 0; // Now check ports int theirlastport = 0; // Get ours if (hostport.indexOf(":") == -1) { ourfirstport = 0; ourlastport = 65535; } else { // FIXME: Needs bulletproofing. // This will dump if hostport if all sorts of bad data was passed to // the constructor String range = hostport.substring(hostport.indexOf(":") + 1); if (range.startsWith("-")) ourfirstport = 0; else if (range.indexOf("-") == -1) ourfirstport = Integer.parseInt(range); else ourfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) ourlastport = 65535; else if (range.indexOf("-") == -1) ourlastport = Integer.parseInt(range); else ourlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Get theirs if (p.hostport.indexOf(":") == -1) { theirfirstport = 0; ourlastport = 65535; } else { // This will dump if hostport if all sorts of bad data was passed to // the constructor// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Wrong usage of hostport and not p.hostport in call to indexOf String range = p.hostport.substring(p.hostport.indexOf(":") + 1);// @classpath-bugfix-end if (range.startsWith("-")) theirfirstport = 0; else if (range.indexOf("-") == -1) theirfirstport = Integer.parseInt(range); else theirfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) theirlastport = 65535; else if (range.indexOf("-") == -1) theirlastport = Integer.parseInt(range); else theirlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Now check them if ((theirfirstport < ourfirstport) || (theirlastport > ourlastport)) return false; // Finally we can check the hosts String ourhost; // Finally we can check the hosts String theirhost; // Get ours if (hostport.indexOf(":") == -1) ourhost = hostport; else ourhost = hostport.substring(0, hostport.indexOf(":")); // Get theirs if (p.hostport.indexOf(":") == -1) theirhost = p.hostport; else theirhost = p.hostport.substring(0, p.hostport.indexOf(":")); // Are they equal? if (ourhost.equals(theirhost)) return true; // Try the canonical names String ourcanonical = null; // Try the canonical names String theircanonical = null; try { ourcanonical = InetAddress.getByName(ourhost).getHostName(); theircanonical = InetAddress.getByName(theirhost).getHostName(); } catch (UnknownHostException e) { // Who didn't resolve? Just assume current address is canonical enough // Is this ok to do? if (ourcanonical == null) ourcanonical = ourhost; if (theircanonical == null) theircanonical = theirhost; } if (ourcanonical.equals(theircanonical)) return true; // Well, last chance. Try for a wildcard if (ourhost.indexOf("*.") != -1) { String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1)); if (theircanonical.endsWith(wild_domain)) return true; }// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Missed wildcard as host address if (ourhost.equals("*")) return true;// @classpath-bugfix-end // Didn't make it return false; }
15,618
public boolean implies(Permission perm) { SocketPermission p; // First make sure we are the right object type if (perm instanceof SocketPermission) p = (SocketPermission) perm; else return false; // Next check the actions String ourlist = getActions(); String theirlist = p.getActions(); if (! ourlist.startsWith(theirlist)) return false; // Now check ports int ourfirstport = 0; // Now check ports int ourlastport = 0; // Now check ports int theirfirstport = 0; // Now check ports int theirlastport = 0; // Get ours if (hostport.indexOf(":") == -1) { ourfirstport = 0; ourlastport = 65535; } else { // FIXME: Needs bulletproofing. // This will dump if hostport if all sorts of bad data was passed to // the constructor String range = hostport.substring(hostport.indexOf(":") + 1); if (range.startsWith("-")) ourfirstport = 0; else if (range.indexOf("-") == -1) ourfirstport = Integer.parseInt(range); else ourfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) ourlastport = 65535; else if (range.indexOf("-") == -1) ourlastport = Integer.parseInt(range); else ourlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Get theirs if (p.hostport.indexOf(":") == -1) { theirfirstport = 0; ourlastport = 65535; } else { // This will dump if hostport if all sorts of bad data was passed to // the constructor// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Wrong usage of hostport and not p.hostport in call to indexOf String range = p.hostport.substring(p.hostport.indexOf(":") + 1);// @classpath-bugfix-end if (range.startsWith("-")) theirfirstport = 0; else if (range.indexOf("-") == -1) theirfirstport = Integer.parseInt(range); else theirfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) theirlastport = 65535; else if (range.indexOf("-") == -1) theirlastport = Integer.parseInt(range); else theirlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Now check them if ((theirfirstport < ourfirstport) || (theirlastport > ourlastport)) return false; // Finally we can check the hosts String ourhost; // Finally we can check the hosts String theirhost; // Get ours if (hostport.indexOf(":") == -1) ourhost = hostport; else ourhost = hostport.substring(0, hostport.indexOf(":")); // Get theirs if (p.hostport.indexOf(":") == -1) theirhost = p.hostport; else theirhost = p.hostport.substring(0, p.hostport.indexOf(":")); // Are they equal? if (ourhost.equals(theirhost)) return true; // Try the canonical names String ourcanonical = null; // Try the canonical names String theircanonical = null; try { ourcanonical = InetAddress.getByName(ourhost).getHostName(); theircanonical = InetAddress.getByName(theirhost).getHostName(); } catch (UnknownHostException e) { // Who didn't resolve? Just assume current address is canonical enough // Is this ok to do? if (ourcanonical == null) ourcanonical = ourhost; if (theircanonical == null) theircanonical = theirhost; } if (ourcanonical.equals(theircanonical)) return true; // Well, last chance. Try for a wildcard if (ourhost.indexOf("*.") != -1) { String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1)); if (theircanonical.endsWith(wild_domain)) return true; }// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Missed wildcard as host address if (ourhost.equals("*")) return true;// @classpath-bugfix-end // Didn't make it return false; }
public boolean implies(Permission perm) { SocketPermission p; // First make sure we are the right object type if (perm instanceof SocketPermission) p = (SocketPermission) perm; else return false; // Next check the actions String ourlist = getActions(); String theirlist = p.getActions(); if (! ourlist.startsWith(theirlist)) return false; // Now check ports int ourfirstport = 0; // Now check ports int ourlastport = 0; // Now check ports int theirfirstport = 0; // Now check ports int theirlastport = 0; // Get ours if (hostport.indexOf(":") == -1) { ourfirstport = 0; ourlastport = 65535; } else { // FIXME: Needs bulletproofing. // This will dump if hostport if all sorts of bad data was passed to // the constructor String range = hostport.substring(hostport.indexOf(":") + 1); if (range.startsWith("-")) ourfirstport = 0; else if (range.indexOf("-") == -1) ourfirstport = Integer.parseInt(range); else ourfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) ourlastport = 65535; else if (range.indexOf("-") == -1) ourlastport = Integer.parseInt(range); else ourlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Get theirs if (p.hostport.indexOf(":") == -1) { theirfirstport = 0; ourlastport = 65535; } else { // This will dump if hostport if all sorts of bad data was passed to // the constructor// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Wrong usage of hostport and not p.hostport in call to indexOf String range = p.hostport.substring(p.hostport.indexOf(":") + 1);// @classpath-bugfix-end if (range.startsWith("-")) theirfirstport = 0; else if (range.indexOf("-") == -1) theirfirstport = Integer.parseInt(range); else theirfirstport = Integer.parseInt(range.substring(0, range.indexOf("-"))); if (range.endsWith("-")) theirlastport = 65535; else if (range.indexOf("-") == -1) theirlastport = Integer.parseInt(range); else theirlastport = Integer.parseInt(range.substring(range.indexOf("-") + 1, range.length())); } // Now check them if ((theirfirstport < ourfirstport) || (theirlastport > ourlastport)) return false; // Finally we can check the hosts String ourhost; // Finally we can check the hosts String theirhost; // Get ours if (hostport.indexOf(":") == -1) ourhost = hostport; else ourhost = hostport.substring(0, hostport.indexOf(":")); // Get theirs if (p.hostport.indexOf(":") == -1) theirhost = p.hostport; else theirhost = p.hostport.substring(0, p.hostport.indexOf(":")); // Are they equal? if (ourhost.equals(theirhost)) return true; // Try the canonical names String ourcanonical = null; // Try the canonical names String theircanonical = null; try { ourcanonical = InetAddress.getByName(ourhost).getHostName(); theircanonical = InetAddress.getByName(theirhost).getHostName(); } catch (UnknownHostException e) { // Who didn't resolve? Just assume current address is canonical enough // Is this ok to do? if (ourcanonical == null) ourcanonical = ourhost; if (theircanonical == null) theircanonical = theirhost; } if (ourcanonical.equals(theircanonical)) return true; // Well, last chance. Try for a wildcard if (ourhost.indexOf("*.") != -1) { String wild_domain = ourhost.substring(ourhost.indexOf("*" + 1)); if (theircanonical.endsWith(wild_domain)) return true; }// @classpath-bugfix 18/10/2005 Martin Husted Hartvig (hagar@jnode.org) :// Missed wildcard as host address if (ourhost.equals("*")) return true;// @classpath-bugfix-end // Didn't make it return false; }
15,619