小编use*_*567的帖子

当我使用"hg push"时如何解决"废弃的交易"?

我们使用sourceforge项目.当我们试图推动时,然后mercurial abort:

$ hg push

pushing to ssh://<user>@hg.code.sf.net/p/loremipsum/code
searching for changes
remote: abort: abandoned transaction found - run hg recover!
abort: unexpected response: empty string
Run Code Online (Sandbox Code Playgroud)

当我们尝试恢复时,这不起作用:

$ hg recover
no interrupted transaction available
Run Code Online (Sandbox Code Playgroud)

该项目的其他程序员也有同样的问题.我们迷路了.

mercurial sourceforge

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

Guice注入空指针

我们尝试用Guice重构一个项目.我们的想法是将所有语言界面绑定到一个像法语波兰语这样的混合对象.

我们有一个绑定模块:

public class StandardModule extends AbstractModule {

    @Override
    protected void configure() {

       bind(Language.class).to(Polish.class);

    }
 }
Run Code Online (Sandbox Code Playgroud)

以及使用此注入对象的classe(AboutDialog.java):

@Inject Language language;

public AboutDialog(JFrame parent) {
    super(parent, "", true);
    this.language=language;
    this.setTitle(language.getLanguageInUse().getString("AboutDialog.title"));
    this.parent = parent;
    try {
        jbInit();
    } catch (Exception e) {
        e.printStackTrace();
    }
    pack();
}
Run Code Online (Sandbox Code Playgroud)

我们有结果:

java.lang.NullPointerException at net.sf.jmoney.gui.AboutDialog.<init>(AboutDialog.java:67)
Run Code Online (Sandbox Code Playgroud)

第67行是:

this.setTitle(language.getLanguageInUse().getString("AboutDialog.title"));
Run Code Online (Sandbox Code Playgroud)

我们的界面是:

public interface Language {

    public ResourceBundle getLanguageInUse();
}
Run Code Online (Sandbox Code Playgroud)

波兰语课程是:

public class Polish implements Language {

    private ResourceBundle languageInUse;

    public Polish() {
        languageInUse = …
Run Code Online (Sandbox Code Playgroud)

java guice code-injection nullpointerexception

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

昂首阔步的springfox-Bean验证JSR 303无法识别

我按照本教程https://springframework.guru/spring-boot-restful-api-documentation-with-swagger-2/生成了庞大的文档。它正在工作,但是当我尝试在bean中添加一些验证时,我在文档中找不到这些信息:

@ApiOperation(value = "Creates a product",
        notes="Populates a product instance bla bla")
@RequestMapping(value = "/add", method = RequestMethod.POST, produces = "application/json")
public ResponseEntity saveProduct(  @Valid @RequestBody Product product){
    productService.saveProduct(product);
    return new ResponseEntity("Product saved successfully", HttpStatus.OK);
}
Run Code Online (Sandbox Code Playgroud)

我的实体带有验证注释:

@Entity
public class Product {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
   // @ApiModelProperty(notes = "The database generated product ID")
    private Integer id;
    @Version
   // @ApiModelProperty(notes = "The auto-generated version of the product")
    @NotNull
    private Integer version;
   // @ApiModelProperty(notes = "The application-specific product ID" …
Run Code Online (Sandbox Code Playgroud)

spring swagger springfox

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

如何在Play 2.2中使用ebean框架和scala创建模型实例

我想用scala和fremework Play 2.2来实例化Ebean项目的模型对象.我面临ID自动生成和类参数/抽象的问题:

   @Entity 
    class Task(@Required val label:String) extends Model{
      @Id 
      val id: Long
    }

object Task {
  var find: Model.Finder[Long, Task] = new Model.Finder[Long, Task](classOf[Long], classOf[Task])

  def all(): List[Task] = find.all.asScala.toList

  def create(label: String) {
   val task =  new Task(label)
   task.save
  }

  def delete(id: Long) {
    find.ref(id).delete
  }
}
Run Code Online (Sandbox Code Playgroud)

错误:"类任务需要是抽象的,因为没有定义值id".有什么想法可以避免这个问题?

orm scala playframework ebean

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