Skip to content

Commit 657e23a

Browse files
committed
o Changed the scope of org.jvnet.hudson:xstream to test cause it is used only during the tests. o I needed to remove a toString method from View class which uses the XStream classes which does not make sense from my point of view.
1 parent ff80197 commit 657e23a

2 files changed

Lines changed: 42 additions & 30 deletions

File tree

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
<groupId>org.jvnet.hudson</groupId>
108108
<artifactId>xstream</artifactId>
109109
<version>${xstream.version}</version>
110+
<scope>test</scope>
110111
</dependency>
111112

112113
<dependency>
Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package com.offbytwo.jenkins.model;
22

3-
import com.thoughtworks.xstream.XStream;
4-
import com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver;
5-
63
public class View extends MainView {
74

85
private String name = "";
@@ -37,34 +34,48 @@ public void setUrl(String url) {
3734
this.url = url;
3835
}
3936

40-
@Override
41-
public String toString() {
42-
XStream xstream = new XStream(new JsonHierarchicalStreamDriver());
43-
return xstream.toXML(this);
44-
}
45-
4637
@Override
47-
public boolean equals(Object o) {
48-
if (this == o) return true;
49-
if (o == null || getClass() != o.getClass()) return false;
50-
51-
View view = (View) o;
52-
53-
if (description != null ? !description.equals(view.description) : view.description != null)
54-
return false;
55-
if (name != null ? !name.equals(view.name) : view.name != null)
56-
return false;
57-
if (url != null ? !url.equals(view.url) : view.url != null)
58-
return false;
59-
60-
return true;
61-
}
38+
public boolean equals( Object obj )
39+
{
40+
if ( this == obj )
41+
return true;
42+
if ( obj == null )
43+
return false;
44+
if ( getClass() != obj.getClass() )
45+
return false;
46+
View other = (View) obj;
47+
if ( description == null )
48+
{
49+
if ( other.description != null )
50+
return false;
51+
}
52+
else if ( !description.equals( other.description ) )
53+
return false;
54+
if ( name == null )
55+
{
56+
if ( other.name != null )
57+
return false;
58+
}
59+
else if ( !name.equals( other.name ) )
60+
return false;
61+
if ( url == null )
62+
{
63+
if ( other.url != null )
64+
return false;
65+
}
66+
else if ( !url.equals( other.url ) )
67+
return false;
68+
return true;
69+
}
6270

6371
@Override
64-
public int hashCode() {
65-
int result = name != null ? name.hashCode() : 0;
66-
result = 31 * result + (description != null ? description.hashCode() : 0);
67-
result = 31 * result + (url != null ? url.hashCode() : 0);
68-
return result;
69-
}
72+
public int hashCode()
73+
{
74+
final int prime = 31;
75+
int result = 1;
76+
result = prime * result + ( ( description == null ) ? 0 : description.hashCode() );
77+
result = prime * result + ( ( name == null ) ? 0 : name.hashCode() );
78+
result = prime * result + ( ( url == null ) ? 0 : url.hashCode() );
79+
return result;
80+
}
7081
}

0 commit comments

Comments
 (0)