草庐IT

this_call

全部标签

java - 无法在 Java : "pathLenConstraint violated - this cert must be the last cert in the certification path" 中对 SSL 站点进行身份验证

我正在尝试使用Java代码从安全(即SSL)网页中读取内容。我正在尝试同时使用URLConnection(java.net)和Apache的HTTPClient。在这两种情况下,当我发出请求时,我都会收到此异常:javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIXpathvalidationfailed:java.security.cert.CertPathValidatorException:basicconstraintscheckfailed:pathLenConstr

java - 如何解决 Hibernate 异常 "IllegalArgumentException occurred while calling setter"的原因?

当我的程序尝试按名称从数据库中加载用户时,Hibernate抛出的偶尔异常IllegalArgumentExceptionoccurredwhilecallingsetter如何解决?我是否错误地将表User中的列USER_RV映射到类Integer而不是BigDecimal或其他一些整数类型?请注意,同一应用程序将其他表中的NUMBER列映射到Integer对象,但Hibernate在用行填充对象时不会抛出此异常来自那些表。另外请注意,该程序为仅用户缓存启用RMI缓存复制。此异常可能与缓存复制有关吗?是Ehcache还是Hibernate的bug?Causedby:org.sprin

java - "Thread.currentThread().getName"和 "this.getName"有什么区别?

这是代码:importjava.util.concurrent.ExecutorService;importjava.util.concurrent.Executors;importjava.util.concurrent.ThreadFactory;classUnCatchExceptionThreadextendsThread{publicUnCatchExceptionThread(Stringname){this.setName(name);}@Overridepublicvoidrun(){System.out.println("Threadnameis:"+this.get

java - 在 java 构造期间将 `this` 作为参数传递

在java中构造对象时,可以将this作为参数传递给方法吗?想到这样做让我感到不安,但我不确定这是否肯定是错误的。以下面的假设为例:publicfinalclassA{privatefinalBb;privatefinalListwords;publicA(Bb){this.b=b;words=newArrayList();for(inti=0;igetWords(){returnwords;}}publicclassB{//returnsaStringchosenbytheuserbasedonthecurrentstateofApublicStringgetNextStringFr

java - 使用 'this' 作为不良编码习惯的显式构造函数调用?

一位教授告诉我,使用this显式调用构造函数是“糟糕的编码实践”,并因此受到处罚。但是,我无法在任何java样式指南中找到任何我已经以某种方式查看过关于它的评论的内容。最重要的是,它似乎是在我见过的相当多的编码示例中完成的。我希望得到一些关于这是否是糟糕的编码实践以及原因的意见。我所指的例子:publicclassSomeClass{privateinta;privateintb;publicSomeClass(){this(0);}publicSomeClass(inta){this(a,0);}publicSomeClass(inta,intb){this.a=a;this.b=b

java - Spring 安全 : Custom UserDetailsService not being called (using Auth0 authentication)

我是Spring框架的新手,所以对于我理解中的任何漏洞,我提前表示歉意。我正在使用Auth0来保护我的API,它运行良好。我的设置和配置与suggestedsetup相同在Auth0文档中://SecurityConfig.java@Configuration@EnableWebSecurity(debug=true)publicclassSecurityConfigextendsWebSecurityConfigurerAdapter{//auth0configvarshere@Overrideprotectedvoidconfigure(HttpSecurityhttp){JwtW

java - 匿名内部类在访问其原语等时是否总是捕获对 "this"(外部)对象的引用?

如果我有[编辑:添加了“Inner”的类型定义]interfaceInner{publicvoidexecute();}classOuter{intouterInt;publicvoidhello(){Innerinner=newInner(){publicvoidexecute(){outerInt=5;}}//laterinner.execute();}}调用inner.execute()会将那个特定Outer对象的outerInt变量设置为5,无论从何处调用,只要Inner对象存在?或者它只会更改outerInt变量的副本而不影响原始Outer对象?

java - 在 "this"或 Java 中的私有(private)对象上同步?

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:Avoidsynchronized(this)inJava?这两段代码有什么区别?各有什么优缺点?1)publicclassExample{privateintvalue=0;publicintgetNextValue(){synchronized(this){returnvalue++;}}}2)publicclassExample{privatefinalObjectlock=newObject();privateintvalue=0;publicintgetNextValue(){synchronize

java - SpEL 中的#root 和#this

在Spring3SpEL中,引入了#this和#root。Thevariable#rootisalwaysdefinedandreferstotherootcontextobject.Although#thismayvaryascomponentsofanexpressionareevaluated,#rootalwaysreferstotheroot.我看了文档,还是不明白#root是什么意思(没有例子)。有人可以给我举个例子吗? 最佳答案 假设我们有以下代码片段,它用几个素数填充一个列表,并将其定义为SpEL上下文中的一个变量:

java.lang.VerifyError : (class: ea/Individual, method: <init> signature: (I)V) 构造函数必须调用 super() 或 this()

我在这个类中没有发现任何错误,但Netbeans在那个类中不断显示红色符号。类是/**Tochangethistemplate,chooseTools|Templates*andopenthetemplateintheeditor.*/packageea;/****@authorriyad*/importjava.util.Random;importjava.util.BitSet;publicclassIndividual{BitSetvariable;doublex;doublefitness;doublesharedFitness;finalintSIZE;Randomgener