Skip to content

Find bugs#8

Merged
ekrylovich merged 7 commits intodevelopfrom
find_bugs
Apr 5, 2018
Merged

Find bugs#8
ekrylovich merged 7 commits intodevelopfrom
find_bugs

Conversation

@ekrylovich
Copy link
Copy Markdown
Contributor

No description provided.

@@ -132,8 +130,8 @@ public void setVolumeMappings(List<VolumeMapping> volumeMappings) {

@Override
public boolean equals(Object e) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps it's preferable to write like this:
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Element element = (Element) o;
return Objects.equal(elementId, element.elementId);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check it

Copy link
Copy Markdown
Contributor Author

@ekrylovich ekrylovich Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Josh Bloch favors my approach:

The reason that I favor the instanceof approach is that when you use the getClass approach, you have the restriction that objects are only equal to other objects of the same class, the same run time type. If you extend a class and add a couple of innocuous methods to it, then check to see whether some object of the subclass is equal to an object of the super class, even if the objects are equal in all important aspects, you will get the surprising answer that they aren't equal. In fact, this violates a strict interpretation of the Liskov substitution principle, and can lead to very surprising behavior. In Java, it's particularly important because most of the collections (HashTable, etc.) are based on the equals method. If you put a member of the super class in a hash table as the key and then look it up using a subclass instance, you won't find it, because they are not equal.

@@ -49,4 +49,10 @@ public boolean equals(Object other) {
return this.outside.equals(o.outside) && this.inside.equals(o.inside);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same deal with 'equals' here

}

@Override
public boolean equals(Object other) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

}
params = params.trim() + "\"}";
byte[] postData = params.trim().getBytes(StandardCharsets.UTF_8);
params = new StringBuilder(params.toString().trim() + "\"}");
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

append

throw new Exception(" Id not found ");
if (jsonObject.getString("id").equals(null) || jsonObject.getString("id").trim().equals(""))
if (!jsonObject.containsKey("id") ||
jsonObject.getString("id").equals("null") ||
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"null " in forward

@ekrylovich ekrylovich merged commit 750e3f9 into develop Apr 5, 2018
@ilaryionava ilaryionava deleted the find_bugs branch April 27, 2018 13:37
emirhandurmus added a commit to Datasance/iofog-agent that referenced this pull request Mar 24, 2026
min dockerApiVersion version adjusted to be compatible with  embedded…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants