我正在为Jenkins建立一个声明性管道.在我的post
部分中,我slackSend
用来通知我的团队构建已损坏.我想包括失败原因.这是可用的env
还是currentBuild
其他的?我没有在文档中看到任何内容,但似乎是一个常见的用例
我已经看过一些关于使用的帖子,currentBuild.rawBuild.getLog(10)
并且有效,但它只是填充了太多的信息.我需要对实际异常进行归零
由于某种原因,我无法获得字符串数值转换为整数我运行的错误:
Exception in thread "main" java.lang.NumberFormatException: For input string: "6327818260"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:495)
at java.lang.Integer.parseInt(Integer.java:527)
at MyDirectory.getsize(MyDirectory.java:18)
at a19010.main(a19010.java:79)
Run Code Online (Sandbox Code Playgroud)
Java结果:1
如果我的输入字符串是"6327818260",为什么它不能成为整数?我的代码是
public String getsize()
{
int intSize = Integer.parseInt(mySize);
int count = 0;
String dataType = "";
while (intSize > 1000)
{
intSize = intSize / 1000;
count++;
}
switch (count)
{
case 0:
dataType = "Bytes";
break;
case 1:
dataType = "KB";
break;
case 2:
dataType = "MB";
break;
case 3:
dataType = "GB";
break;
case 4:
dataType …
Run Code Online (Sandbox Code Playgroud) 假装我有一张cupcake_rating
桌子:
id | cupcake | delicious_rating
--------------------------------------------
1 | Strawberry | Super Delicious
2 | Strawberry | Mouth Heaven
3 | Blueberry | Godly
4 | Blueberry | Super Delicious
Run Code Online (Sandbox Code Playgroud)
我想找到所有具有'Super Delicious'和'Mouth Heaven'评级的纸杯蛋糕.我觉得使用一个group by
条款很容易实现,也许是一个having
.
我刚在想:
select distinct(cupcake)
from cupcake_rating
group by cupcake
having delicious_rating in ('Super Delicious', 'Mouth Heaven')
Run Code Online (Sandbox Code Playgroud)
我知道我不能有两个单独的AND语句.我能够通过以下方式实现我的目标:
select distinct(cupcake)
from cupcake_rating
where cupcake in ( select cupcake
from cupcake_rating
where delicious_rating = 'Super Delicious' )
and cupcake in ( select cupcake …
Run Code Online (Sandbox Code Playgroud)