在我的应用程序中,我通过PMD运行我的代码.它向我显示了这条消息:
- 避免使用printStackTrace(); 请使用记录器调用.
那是什么意思?
在shell中我有一个要求,其中我必须阅读JSON响应,其格式如下:
{ "Messages": [ { "Body": "172.16.1.42|/home/480/1234/5-12-2013/1234.toSort", "ReceiptHandle": "uUk89DYFzt1VAHtMW2iz0VSiDcGHY+H6WtTgcTSgBiFbpFUg5lythf+wQdWluzCoBziie8BiS2GFQVoRjQQfOx3R5jUASxDz7SmoCI5bNPJkWqU8ola+OYBIYNuCP1fYweKl1BOFUF+o2g7xLSIEkrdvLDAhYvHzfPb4QNgOSuN1JGG1GcZehvW3Q/9jq3vjYVIFz3Ho7blCUuWYhGFrpsBn5HWoRYE5VF5Bxc/zO6dPT0n4wRAd3hUEqF3WWeTMlWyTJp1KoMyX7Z8IXH4hKURGjdBQ0PwlSDF2cBYkBUA=", "MD5OfBody": "53e90dc3fa8afa3452c671080569642e", "MessageId": "e93e9238-f9f8-4bf4-bf5b-9a0cae8a0ebc" } ] }
Run Code Online (Sandbox Code Playgroud)
在这里,我只关注"Body"属性值.我做了一些不成功的尝试,如:
jsawk -a 'return this.Body'
Run Code Online (Sandbox Code Playgroud)
要么
awk -v k="Body" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}
Run Code Online (Sandbox Code Playgroud)
但这还不够.谁能帮我这个?
我有一个稳定的产品,使用角1.2.23.最近,我决定转向棱角1.4.3.在与所有依赖项的几个兼容性问题之后,我的应用程序工作正常,但所有单元测试用例都已经开始失败.投资后我意识到,如果我升级所有依赖项的版本但保持角度在先前版本即1.2.23, testcases工作正常.有角度1.4.3,由于某种原因,单元测试中的依赖注入失败.
以下是bower.json中更新的依赖项列表.
"dependencies": {
"angular-cookies": "1.4.3",
"bootstrap": "3.0.3",
"angular-ui-router": "0.2.15",
"angular-gettext": "2.1.0",
"angular": "1.4.3",
"angular-ui-utils": "3.0.0",
"restangular": "1.4.0",
"angular-route": "1.4.3",
"momentjs": "2.10.6",
"angular-i18n": "1.4.3"
}
Run Code Online (Sandbox Code Playgroud)
以下是测试文件 -
describe("Module: x.xyz", function () {
describe("Factory: xyz", function () {
var service;
beforeEach(function () {
module('x.xyz');
inject(function ($injector) {
service = $injector.get("xyz");
});
});
describe("Testing service(): ", function () {
describe('Testing getXYZDescription(): ', function () {
it('should return the description for the xyz event name passed if it is available', function () …Run Code Online (Sandbox Code Playgroud) 以下是assembly.xml的内容
Run Code Online (Sandbox Code Playgroud)<assembly> <id>jar-with-dependencies</id> <formats> <format>jar</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <dependencySets> <dependencySet> <unpack>true</unpack> <unpackOptions> <excludes> <exclude>META-INF/**</exclude> <exclude>META-INF/**</exclude> </excludes> </unpackOptions> <includes> <include>com.alibaba:dubbo</include> <include>commons-codec:commons-codec</include> <include>org.apache.httpcomponents:httpclient</include> <include>org.apache.httpcomponents:httpcore</include> <include>org.apache.commons:commons-csv</include> </includes> </dependencySet> </dependencySets>
我已经将以下依赖项添加到pom.xml-
Run Code Online (Sandbox Code Playgroud)<!-- Dubbo --> <dependency> <groupId>com.alibaba</groupId> <artifactId>dubbo</artifactId> <version>2.5.9</version> <scope>provided</scope> </dependency> <build> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>prod-jar</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <descriptors> <descriptor>assembly.xml</descriptor> </descriptors> </configuration> </execution> <execution> <id>jar-for-testcase</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <descriptors> <descriptor>assembly_test.xml</descriptor> </descriptors> </configuration> </execution> <execution> <id>pkg</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptors> <descriptor>pkg_assembly.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin> …
我有一个要求,我必须从couchbase桶中删除一个条目.我使用我传递密钥的Java应用程序中的CouchbaseCient的delete方法.但在一个特殊情况下,我没有完整的关键名称,而是它的一部分.所以我认为会有一个方法需要一个匹配器,但我找不到一个.以下是存储在存储桶中的实际密钥
123_xyz_havefun
Run Code Online (Sandbox Code Playgroud)
我拥有的关键部分是xyz.我不确定是否可以这样做.谁能帮忙.