Skip to content

In HtmlElementUtils.newInstance added optional parameter "outerObject". - #136

Open
Kin-k wants to merge 23 commits into
yandex-qatools:masterfrom
Kin-k:master
Open

In HtmlElementUtils.newInstance added optional parameter "outerObject".#136
Kin-k wants to merge 23 commits into
yandex-qatools:masterfrom
Kin-k:master

Conversation

@Kin-k

@Kin-k Kin-k commented Nov 27, 2016

Copy link
Copy Markdown

Без этого возникает проблема с вложенными inner-классами HtmlElement-ов.

outerClass.newInstance() - создаёт новый объект outer-класса, для которого запускается популейт, который опять выполняет newInstance для поля, являющегося объектом класса inner-класса.
В котором опять outerClass.newInstance(). В результате вечная рекурсия.

ham1 and others added 20 commits June 6, 2016 11:47
…ement

TypifiedElement implement WebElement
Also a few formatting and wording tweaks.
…-issue-in-table

Fix performance issue in table
@Kin-k Kin-k changed the title HtmlElementUtils: remove final In HtmlElementUtils.newInstance added optional parameter "outerObject". Nov 27, 2016
if (clazz.isMemberClass() && !Modifier.isStatic(clazz.getModifiers())) {
Class outerClass = clazz.getDeclaringClass();
Object outerObject = outerClass.newInstance();
public static <T> T newInstance(Object outerObject, Class<T> clazz, Object... args)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

MAJOR Refactor this method to throw at most one checked exception instead of: java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException rule

if (isHtmlElement(field))
return decorateHtmlElement(loader, outerObject, field);
}
catch (ClassCastException ignore) {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

MAJOR Either remove or fill this block of code. rule
CRITICAL Either log or rethrow this exception. rule

@qatools-ci

Copy link
Copy Markdown
Member

SonarQube analysis reported 3 issues:

  • CRITICAL 1 critical
  • MAJOR 2 major

Watch the comments in this conversation to review them.

@eroshenkoam
eroshenkoam force-pushed the master branch 2 times, most recently from 58b45bf to 1c8583b Compare March 12, 2018 12:35
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.

7 participants