我想在一个CSS文件中添加一个CSS文件并在每个CSS选择器之前添加另一个选择器.
从:
p{margin:0 0 10px;}
.lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px;}
Run Code Online (Sandbox Code Playgroud)
我想要:
.mySelector p{margin:0 0 10px;}
.mySelector .lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px;}
Run Code Online (Sandbox Code Playgroud)
但是我的CSS文件非常复杂(事实上它是bootstrap css文件)所以正则表达式应该匹配所有的CSS选择器.
现在我有这个正则表达式:
([^\r\n,{};]+)(,|{)
Run Code Online (Sandbox Code Playgroud)
你可以在http://regexr.com?328ps看到结果 但是你可以看到有很多不匹配的比赛
例如:
text-shadow:0 -1px 0 rgba(0,
Run Code Online (Sandbox Code Playgroud)
匹配积极,但不应该
有人有解决方案吗?
谢谢
有人可以解释我为什么我的JUnit测试失败:
意外异常,预期<java.lang.NullPointerException>但是<java.lang.IllegalArgumentException>
package com;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.validation.constraints.NotNull;
import org.junit.Test;
public class AnnotationTest {
private void nonnullMethod(@Nonnull String arg) {
Objects.requireNonNull(arg);
}
@Test(expected = NullPointerException.class)
public void nonnullMethodTest() {
nonnullMethod(null);
}
private void notNullMethod(@NotNull String arg) {
Objects.requireNonNull(arg);
}
@Test(expected = NullPointerException.class)
public void notNullMethodTest() {
notNullMethod(null);
}
}
Run Code Online (Sandbox Code Playgroud)
这里是StackTrace:
java.lang.Exception: Unexpected exception, expected<java.lang.NullPointerException> but was<java.lang.IllegalArgumentException>
at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:28)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at …Run Code Online (Sandbox Code Playgroud) 我有一个使用Resteasy 3.1.4.Final的相当基本的Java8应用程序,已部署在App Engine标准环境中。
但是当我将Resteasy升级到3.5.0.Final时;
来自org.jboss.resteasy.core.ResourceMethodInvoker.isSseResourceMethod(ResourceMethodInvoker.java:162)的servlet java.lang.NoSuchFieldError:SERVER_SENT_EVENTS_TYPE的未捕获异常.org.jboss.resteasy.core.ResourceMethodInvoker。(ResourceMethodInvoker。 org.jboss.resteasy.core.ResourceMethodRegistry.register(ResourceMethodRegistry.java:272)上的.jboss.resteasy.core.ResourceMethodRegistry.processMethod(ResourceMethodRegistry.java:345)在org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry .java:223),位于org.jboss.resteasy的org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:195),位于org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:181)。核心。org.org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java.496)上org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:77)上的ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:158) org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:86)上的.jboss.resteasy.spi.ResteasyDeployment.startInternal(ResteasyDeployment.java:279)在org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)上的.init(ServletContainerDispatcher.java:119)org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:643) ),网址为org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:422)在org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:892)在org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349)在org.eclipse.jetty.webapp.WebAppContext org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1368)的.startWebapp(WebAppContext.java:1406)org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778) org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:522)上的org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262)在org.eclipse.jetty.util.component.AbstractLifeCycle上。在com.google.com上从com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.createHandler(AppVersionHandlerMap.java:244)开始(AbstractLifeCycle.java:68)。com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:97)上的apphosting.runtime.jetty9.AppVersionHandlerMap.getHandler(AppVersionHandlerMap.java:182)在com.google.apphosting.runtime.JavaRuntime $ RequestRunnable上。 com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.dispatchRequest(JavaRuntime.java:642)上的com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.run(JavaRuntime.java:612)上的dispatchServletRequest(JavaRuntime.java:680)在com.google.apphosting.runtime.ThreadGroupPool $ PoolEntry.run(ThreadGroupPool.java:274)在com.google.apphosting.runtime.ThreadGroupPool $ PoolEntry.run(ThreadGroupPool.java:274)在com.google.apphosting.runtime.JavaRuntime $ NullSandboxRequestRunnable.run(JavaRuntime.java (线程.java:745)182),com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:97),com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.dispatchServletRequest(JavaRuntime.java:680),com.google.apphosting com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.run(JavaRuntime.java:612)上的.runtime.JavaRuntime $ RequestRunnable.dispatchRequest(JavaRuntime.java:642),com.google.apphosting.runtime.JavaRuntime $ NullSandboxRequestRunnable.run (javaRuntime.java:806)在com.google.apphosting.runtime.ThreadGroupPool $ PoolEntry.run(ThreadGroupPool.java:274)在java.lang.Thread.run(Thread.java:745)182),com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:97),com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.dispatchServletRequest(JavaRuntime.java:680),com.google.apphosting com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.run(JavaRuntime.java:612)上的.runtime.JavaRuntime $ RequestRunnable.dispatchRequest(JavaRuntime.java:642),com.google.apphosting.runtime.JavaRuntime $ NullSandboxRequestRunnable.run (javaRuntime.java:806)在com.google.apphosting.runtime.ThreadGroupPool $ PoolEntry.run(ThreadGroupPool.java:274)在java.lang.Thread.run(Thread.java:745)com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.dispatchRequest(JavaRuntime.java:642)上的JavaRuntime $ RequestRunnable.dispatchServletRequest(JavaRuntime.java:680)com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.run(JavaRuntime。 java:612),位于com.google.apphosting.runtime.JavaRuntime $ NullSandboxRequestRunnable.run(JavaRuntime.java:806),位于com.google.apphosting.runtime.ThreadGroupPool $ PoolEntry.run(ThreadGroupPool.java:274), .Thread.run(Thread.java:745)com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.dispatchRequest(JavaRuntime.java:642)上的JavaRuntime $ RequestRunnable.dispatchServletRequest(JavaRuntime.java:680)com.google.apphosting.runtime.JavaRuntime $ RequestRunnable.run(JavaRuntime。 java:612),位于com.google.apphosting.runtime.JavaRuntime $ NullSandboxRequestRunnable.run(JavaRuntime.java:806),位于com.google.apphosting.runtime.ThreadGroupPool $ …
我正在尝试使用Objectify v4在App Engine中获取实体,但它不起作用.
我的@Entity:
@Entity
public class Translation {
@Id
private Long id;
private String text;
public String getText() {
return text;
}
public Long getId() {
return id;
}
public void setText(String text) {
this.text = text;
}
}
Run Code Online (Sandbox Code Playgroud)
不说的请求:
Translation translation =ObjectifyService.ofy().load().type(Translation.class).id(301L).get(); // translation is null
Run Code Online (Sandbox Code Playgroud)
但如果我这样做:
Translation translation = ObjectifyService.ofy().load().type(Translation.class).first().get(); // translation is not null
Run Code Online (Sandbox Code Playgroud)
然后:
System.out.println(translation.getId()); // translation id equal 301
Run Code Online (Sandbox Code Playgroud)
所以id的fetch似乎不起作用.问题出在哪儿?