jaxp/src/com/sun/org/apache/xml/internal/utils/URI.java
Print this page
*** 25,34 ****
--- 25,35 ----
import java.io.IOException;
import java.io.Serializable;
import com.sun.org.apache.xml.internal.res.XMLErrorResources;
import com.sun.org.apache.xml.internal.res.XMLMessages;
+ 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
*** 881,891 ****
* @return the scheme-specific part for this URI
*/
public String getSchemeSpecificPart()
{
! StringBuffer schemespec = new StringBuffer();
if (m_userinfo != null || m_host != null || m_port != -1)
{
schemespec.append("//");
}
--- 882,892 ----
* @return the scheme-specific part for this URI
*/
public String getSchemeSpecificPart()
{
! final StringBuilder schemespec = new StringBuilder();
if (m_userinfo != null || m_host != null || m_port != -1)
{
schemespec.append("//");
}
*** 973,983 ****
*/
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);
--- 974,984 ----
*/
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);
*** 1339,1348 ****
--- 1340,1350 ----
* @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)
{
*** 1361,1379 ****
}
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(':');
--- 1363,1395 ----
}
return false;
}
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 59 * hash + Objects.hashCode(this.m_scheme);
+ hash = 59 * hash + Objects.hashCode(this.m_userinfo);
+ hash = 59 * hash + Objects.hashCode(this.m_host);
+ hash = 59 * hash + this.m_port;
+ hash = 59 * hash + Objects.hashCode(this.m_path);
+ hash = 59 * hash + Objects.hashCode(this.m_queryString);
+ hash = 59 * 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(':');