小编Nis*_*ara的帖子

jacoco代码覆盖率报告生成器显示错误:"包中的类"代码覆盖率报告'与执行数据不匹配"

我正在使用jacoco:report标签生成jacoco报告.我收到的错误如下:

[jacoco:report] Classes in bundle 'Code Coverage Report' do no match with execution data. For report generation the same class files must be used as at runtime.
[jacoco:report] Execution data for class xxxxx does not match.
[jacoco:report] Execution data for class yyyyy does not match.
Run Code Online (Sandbox Code Playgroud)

蚂蚁报告目标如下:

<target name="report">
                <jacoco:report>
                        <executiondata>
                                <file file="${jacocoexec.dir}/${jacocoexec.filename}"/>
                        </executiondata>
                        <!-- the class files and optional source files ... -->
                        <structure name="Code Coverage Report">
                                <classfiles>
                                        <fileset file="./jar/abc.jar"/>
                                </classfiles>
                                <sourcefiles>
                                      <fileset dir="./code/src"/>
                                </sourcefiles>
                        </structure>
                        <!-- to produce reports …
Run Code Online (Sandbox Code Playgroud)

java ant jacoco

17
推荐指数
2
解决办法
2万
查看次数

免费命令中有什么可用的v/s可用内存?

我在linux主机上发出的free命令的输出如下:

free
              total        used        free      shared  buff/cache   available
Mem:      263846320    47746620     3290072     1140808   212809628   214382420
Swap:             0           0           0
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚这个可用部分指定的内容.尽管总内存很高并且使用的内存仅为18.09%,但可用内存的显示非常少,即大约1.24%.

free -h
              total        used        free      shared  buff/cache   available
Mem:           251G         45G        3.1G        1.1G        202G        204G
Swap:            0B          0B          0B
Run Code Online (Sandbox Code Playgroud)

这是否意味着我无法启动更多应用程序,因为可用内存非常少.使用的内存仅为18%.所以不应该释放82%而不是1.24%,因为命令显示在上面.

我很迷惑.有人可以帮忙吗?

unix linux memory heap-memory free-command

17
推荐指数
1
解决办法
2万
查看次数

在电报中,我想要要点、编号和缩进,但它不起作用

我需要在电报中格式化我的文本。我尝试使用 Markdown 语言来表达以下文本:

* Item
* Item
Run Code Online (Sandbox Code Playgroud)

它按原样打印文本。它应该打印子弹。

我正在关注此链接: https: //wordpress.com/support/markdown-quick-reference/

markdown telegram telegram-bot

14
推荐指数
2
解决办法
2万
查看次数

无法在具有python http服务器的浏览器中查看文件

我正在使用命令为远程计算机上的文件夹创建python httpserver:

python -m SimpleHTTPServer 9999
Run Code Online (Sandbox Code Playgroud)

但是我无法使用此功能在浏览器中查看文件。单击链接后,文件即被下载。有没有一种方法可以创建服务器,以便我只能在浏览器中查看文件。

python browser httpserver

5
推荐指数
2
解决办法
2130
查看次数

在JSP页面中显示XML内容

以下是我正在使用的jsp页面的主体:

<body>
    <%


     String schema=(String)request.getAttribute("schema");
    if(schema!=null)
    {


    **out.println(schema);**
    }
    else
    out.println("no schema found");

    %>
    </body>
Run Code Online (Sandbox Code Playgroud)

“ out.println();” 在浏览器中未显示xml内容。

shcmea的内容是:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://edd.att.com/cnmeddservice" targetNamespace="http://edd.att.com/cnmeddservice" elementFormDefault="qualified">
    <xsd:include schemaLocation="EDD_DataTypes.xsd"/>
    <xsd:include schemaLocation="EDD_Internal_DataTypes.xsd"/>
    <xsd:element name="RET_MAIL">
        <xsd:annotation>
            <xsd:documentation>Represents the eddbdsbatch request for RET_MAIL</xsd:documentation>
        </xsd:annotation>
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="AccountNumber">
                    <xsd:simpleType>
                        <xsd:restriction base="xsd:string">
                            <xsd:maxLength value="15"/>
                        </xsd:restriction>
                    </xsd:simpleType>
                </xsd:element>
                <xsd:element name="cType">
                    <xsd:simpleType>
                        <xsd:restriction base="CtypeType">
                            <xsd:enumeration value="RET_MAIL"/>
                        </xsd:restriction>
                    </xsd:simpleType>
                </xsd:element>
                <xsd:element name="RequestId">
                    <xsd:simpleType>
                        <xsd:restriction base="xsd:integer">
                            <xsd:pattern value="[0-9]{1,9}"/>
                        </xsd:restriction>
                    </xsd:simpleType>
                </xsd:element>
                <xsd:element name="BillingId" minOccurs="0">
                    <xsd:simpleType>
                        <xsd:restriction base="xsd:string">
                            <xsd:maxLength …
Run Code Online (Sandbox Code Playgroud)

xml jsp

3
推荐指数
1
解决办法
8846
查看次数

Java:Scanner读取整数,但不在while/for循环中使用它

我正在学习的那本书使用另一个库来阅读输入,所以它无法帮助我....

我看不出我的错误在哪里.算法:

  1. 读取n的值
  2. 将i的值设置为3
  3. 按照步骤

重复

While i < 2*n

       i+1

       Write 1/(2*i+1) to the console.
Run Code Online (Sandbox Code Playgroud)

我的代码:

import java.util.Scanner;

public class Aufgabe420 {
public static void main (String[] args) {
int i, n; 

    System.out.println("Please enter a number!");
    Scanner sc = new Scanner(System.in);
    n = sc.nextInt();
    System.out.println("n ="+n);
    System.out.println("The while-loop starts!");
    i = 3;
    while (i < 2*n){
        i += 1;
        System.out.println(1/(2*i+1));
    }

        System.out.println("now with for-loop");    

    for (i = 3; i < (2*n); i+=1) {
        System.out.println(1/(2*i+1));
    }


    }
}
Run Code Online (Sandbox Code Playgroud)

但尝试一下,结果是:请输入一个数字!五

n …

java algorithm java.util.scanner

3
推荐指数
1
解决办法
97
查看次数

Java中的toArray与stream.toArray有什么性能差异

我需要将ID列表转换为ID数组。我可以通过多种方式来做到这一点,但不确定应该使用哪种方式。

说,

1. ids.stream().toArray(Id[]::new)
2. ids.toArray(new Id[ids.length])
Run Code Online (Sandbox Code Playgroud)

哪一个效率更高?为什么?

java arrays list java-8 java-stream

3
推荐指数
1
解决办法
210
查看次数

在JUnit中使用TestSuite时@Rule注释不起作用

我有3个测试类如下:

package com.junittest.testcases;

Test3类:

import junit.framework.TestCase;

import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
import annotations.DataSetRule;
import annotations.DataSets;
import com.junittest.test.MyClass;

public class Test3 extends TestCase{
    MyClass m = new MyClass();
    String group = "user";

    @Rule
    public TestRule dataSetRule = new DataSetRule();

    @Test
    public void test5() {
        System.out.println("In Test 5");
        //assertEquals(5, m.add(2,3));
    }

    @Test
    public void test6() throws Exception {
        org.junit.Assume.assumeTrue(group.equals("user"));
        System.out.println("In Test 6");
        //assertEquals(-2, m.sub(2,3));
    }

    @DataSets({"dataset","dataset1"})
    @Test
    public void test7() {
        System.out.println("In Test 7");
    }

    @Ignore
    @Test
    public void …
Run Code Online (Sandbox Code Playgroud)

java junit

2
推荐指数
1
解决办法
1967
查看次数

是如何决定谓词“和”方法在java中拥有消费者而不是生产者的?

我正在浏览 java 8 中引入的 Predicate 类,它是函数式接口。Predicate 类中有一个方法和方法,用于将多个谓词组合成一个。

default Predicate<T> and(Predicate<? super T> other) {
    Objects.requireNonNull(other);
    return (t) -> test(t) && other.test(t);
}
Run Code Online (Sandbox Code Playgroud)

我已经阅读了 Java 中 PECS 的概念,但仍然无法理解为什么在 Predicate 的情况下我们使用? super T. Java 程序员如何决定它将成为消费者而不是生产者。

我的意思是为什么不允许出现编译错误的行:

public class PredicateExample {
    public static void main(String[] args) {
        Predicate<Number> pred = n -> n.intValue() > 2;
        Predicate<Integer> predInt = n -> n > 3;
        //Compile error
        //pred.and(predInt);

        Predicate<Object> predObj = o -> Integer.parseInt(o.toString()) > 4;
        pred.and(predObj); //Valid statement

        Number n = new …
Run Code Online (Sandbox Code Playgroud)

java lambda functional-programming java-8 pecs

2
推荐指数
1
解决办法
98
查看次数

无法在struts2框架中加载验证xml文件

我正在尝试对我的动作类Employee1进行验证.我使用了Employee1-validation.xml文件.我得到这样的例外:

18:19:56,795 ERROR AnnotationActionValidatorManager:38 - Caught exception while loading file com/struts2examples/Employee1-validation.xml
Connection refused: connect - [unknown location]
    at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:119)
    at com.opensymphony.xwork2.validator.DefaultValidatorFileParser.parseActionValidatorConfigs(DefaultValidatorFileParser.java:82)
    at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.loadFile(AnnotationActionValidatorManager.java:394)
    at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildClassValidatorConfigs(AnnotationActionValidatorManager.java:279)
    at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorConfigs(AnnotationActionValidatorManager.java:371)
    at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:99)
    at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:141)
    at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:133)
    at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.validate(AnnotationActionValidatorManager.java:128)
    at com.opensymphony.xwork2.validator.ValidationInterceptor.doBeforeInvocation(ValidationInterceptor.java:222)
    at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
    at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
    at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    at …
Run Code Online (Sandbox Code Playgroud)

java xml struts2

1
推荐指数
1
解决办法
6849
查看次数

将我的hibernate类连接到mysql时出现异常

我在运行Hibernate代码时遇到异常.我对休眠很新.请让我知道我错过了什么.

Nov 13, 2013 5:53:41 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}
Nov 13, 2013 5:53:41 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.2.7.Final}
Nov 13, 2013 5:53:41 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Nov 13, 2013 5:53:41 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Nov 13, 2013 5:53:41 PM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
Nov 13, 2013 5:53:41 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
Nov 13, 2013 …
Run Code Online (Sandbox Code Playgroud)

java hibernate

0
推荐指数
1
解决办法
2万
查看次数

在python中迭代列表时出现无效的语法错误

我是 Python 的新手。我正在尝试在 python 中迭代一个列表并以这种方式打印元素:

for i in list
    print i
Run Code Online (Sandbox Code Playgroud)

但我收到这样的错误:

for i in list
                    ^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)

我有一个类似的代码,它工作正常:

list_unique = []
for i in list:
    if i not in list_unique:
        list_unique.append(i)
Run Code Online (Sandbox Code Playgroud)

我无法理解其中的区别。有人可以帮忙吗?

python loops list

0
推荐指数
1
解决办法
1203
查看次数