jaxp/src/com/sun/org/apache/xerces/internal/util/URI.java

Print this page

        

*** 20,29 **** --- 20,30 ---- package com.sun.org.apache.xerces.internal.util; import java.io.IOException; import java.io.Serializable; + import java.util.Objects; /********************************************************************** * A class to represent a Uniform Resource Identifier (URI). This class * is designed to handle the parsing of URIs and provide access to * the various components (scheme, host, port, userinfo, path, query
*** 1210,1220 **** * scheme and the first colon). See RFC 2396 Section 5.2 for spec. * * @return the scheme-specific part for this URI */ public String getSchemeSpecificPart() { ! StringBuffer schemespec = new StringBuffer(); if (m_host != null || m_regAuthority != null) { schemespec.append("//"); // Server based authority. --- 1211,1221 ---- * scheme and the first colon). See RFC 2396 Section 5.2 for spec. * * @return the scheme-specific part for this URI */ public String getSchemeSpecificPart() { ! final StringBuilder schemespec = new StringBuilder(); if (m_host != null || m_regAuthority != null) { schemespec.append("//"); // Server based authority.
*** 1295,1305 **** * Get the authority for this URI. * * @return the authority */ public String getAuthority() { ! StringBuffer authority = new StringBuffer(); if (m_host != null || m_regAuthority != null) { authority.append("//"); // Server based authority. if (m_host != null) { --- 1296,1306 ---- * Get the authority for this URI. * * @return the authority */ public String getAuthority() { ! final StringBuilder authority = new StringBuilder(); if (m_host != null || m_regAuthority != null) { authority.append("//"); // Server based authority. if (m_host != null) {
*** 1338,1348 **** * @return the path for this URI possibly including the query string * and fragment */ public String getPath(boolean p_includeQueryString, boolean p_includeFragment) { ! StringBuffer pathString = new StringBuffer(m_path); if (p_includeQueryString && m_queryString != null) { pathString.append('?'); pathString.append(m_queryString); } --- 1339,1349 ---- * @return the path for this URI possibly including the query string * and fragment */ public String getPath(boolean p_includeQueryString, boolean p_includeFragment) { ! final StringBuilder pathString = new StringBuilder(m_path); if (p_includeQueryString && m_queryString != null) { pathString.append('?'); pathString.append(m_queryString); }
*** 1681,1690 **** --- 1682,1692 ---- * @param p_test the Object to test for equality. * * @return true if p_test is a URI with all values equal to this * URI, false otherwise */ + @Override public boolean equals(Object p_test) { if (p_test instanceof URI) { URI testURI = (URI) p_test; if (((m_scheme == null && testURI.m_scheme == null) || (m_scheme != null && testURI.m_scheme != null &&
*** 1709,1725 **** } } return false; } /** * Get the URI as a string specification. See RFC 2396 Section 5.2. * * @return the URI string specification */ public String toString() { ! StringBuffer uriSpecString = new StringBuffer(); if (m_scheme != null) { uriSpecString.append(m_scheme); uriSpecString.append(':'); } --- 1711,1741 ---- } } return false; } + @Override + public int hashCode() { + int hash = 5; + hash = 47 * hash + Objects.hashCode(this.m_scheme); + hash = 47 * hash + Objects.hashCode(this.m_userinfo); + hash = 47 * hash + Objects.hashCode(this.m_host); + hash = 47 * hash + this.m_port; + hash = 47 * hash + Objects.hashCode(this.m_path); + hash = 47 * hash + Objects.hashCode(this.m_queryString); + hash = 47 * hash + Objects.hashCode(this.m_fragment); + return hash; + } + /** * Get the URI as a string specification. See RFC 2396 Section 5.2. * * @return the URI string specification */ + @Override public String toString() { ! final StringBuilder uriSpecString = new StringBuilder(); if (m_scheme != null) { uriSpecString.append(m_scheme); uriSpecString.append(':'); }