原文地址:https://www.baeldung.com/project-jigsaw-java-modularity

以下中文翻译为作者根据自己的理解+Google+YouDao作为参考翻译而得,存在偏颇之处请读者查看对应原文,自行理解。

1. Introduction

Project Jigsaw is an umbrella project with the new features aimed at two aspects:

Project Jigsaw 作为一个大项目包含以下两个方面的新特性:

  • the introduction of module system in the Java language
  • 在Java中引入模块系统
  • and its implementation in JDK source and Java runtime
  • 以及JDK源码和Java运行环境的具体实现

In this article, we’ll introduce you to the Jigsaw project and its features and finally wrap it up with a simple modular application.

本文中,我们将介绍Jigsaw及其一些特性,并且通过一个简单的模块化应用来入门。

阅读全文 »

<dependencies>
<!-- jdk9+ requires following dependencies to use jaxb -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
module-info.java
module module.name {

requires static transitive java.naming;
requires transitive com.sun.xml.bind;
requires java.annotation;

// 使用到JAXB相关的包暴露给jaxb
opens cn.xiaojianzheng.xxx to com.sun.xml.bind, com.sun.xml.bind.core, jakarta.xml.bind;

}

Source: https://stackoverflow.com/questions/45483699/cmd-exited-with-error-code-1

按 windows+r 打开注册表编辑器,然后键入 regedit,然后在搜索栏中按 enter 键粘贴下面的行

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\

如果您可以使用链接在图片中看到带下划线的标记很重要,请不要在该特定注册表的数据中插入任何其他值。

在这里,如果您提交了许多注册表值,则删除除默认值之外的所有注册表值,因为它们是命令提示符显示错误代码 1 的主要原因。 所以在删除所有这些之后。

编辑默认注册表值并在Data中插入cmd 并保存

你的问题解决了!! 如果不是,则清除默认注册表的数据。

背景

线上某任务出现报警,报错日志如下:

java.lang.NullPointerException: null
at java.util.HashMap.merge(HashMap.java:1225)
at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1380)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at com.xxx.web.controller.TaskController.getOmsAccidCloudCCUserIdMap(TaskController.java:648)
at com.xxx.web.controller.TaskController.executePushNewRegisterLead(TaskController.java:400)
at com.xxx.web.controller.TaskController.pushNewRegister(TaskController.java:145)

对应出错的代码:

omsAccidCloudCCUserIdMap = administratorList.stream()
.collect(Collectors.toMap(Administrator::getAccid,administrator
-> cloudccAccidUserIdMap.get(administrator.getCloudccAccid())));

已知administratorList不含有null元素,administratorListcloudccAccidUserIdMap都不为nullAdministrator::getAccid也不会返回null值。

阅读全文 »

!/bin/bash

function timediff() {
# time format:date +"%s.%N", such as 1502758855.907197692
start_time=$1
end_time=$2

start_s=${start_time%.*}
start_nanos=${start_time#*.}
end_s=${end_time%.*}
end_nanos=${end_time#*.}

# end_nanos > start_nanos?
# Another way, the time part may start with 0, which means
# it will be regarded as oct format, use "10#" to ensure
# calculateing with decimal
if [ "$end_nanos" -lt "$start_nanos" ];then
end_s=$(( 10#$end_s - 1 ))
end_nanos=$(( 10#$end_nanos + 10**9 ))
fi

# get timediff
time=$(( 10#$end_s - 10#$start_s )).`printf "%03d\n" $(( (10#$end_nanos - 10#$start_nanos)/10**6 ))`
echo $time
}

# 退出时清空屏幕
trap "clear;exit" 2
# 清空首屏
clear
# 隐藏光标
echo -e "\033[?25l"

diff=0
str=`date +'%Y / %m / %d %H : %M : %S'`
while true
do
figlet -w 120 -f big -c "${str}"

start=$(date +'%s.%N')
str=`date +'%Y . %m . %d - %H : %M : %S'`
echo -ne "$report"
echo -ne "\033[1;1H"
a=`timediff $start $end`
b=1
end=$(date +'%s.%N')

sleep `awk 'BEGIN{print "'$end'" - "'$start'"}'`
done