Add missing annotation to task property

Add missing annotation to task property

+review REVIEW-5932

--- subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/internal/FindBugsReportsInternal.java
+++ subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/internal/FindBugsReportsInternal.java
@@ -19,9 +19,11 @@
 import org.gradle.api.plugins.quality.FindBugsReports;
 import org.gradle.api.reporting.SingleFileReport;
 import org.gradle.api.tasks.Input;
+import org.gradle.api.tasks.Internal;
 import org.gradle.api.tasks.Optional;

 public interface FindBugsReportsInternal extends FindBugsReports {
+    @Internal
     SingleFileReport getFirstEnabled();

     @Input

<|original_code|>
/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.api.plugins.quality.internal;

import org.gradle.api.plugins.quality.FindBugsReports;
import org.gradle.api.reporting.SingleFileReport;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;

public interface FindBugsReportsInternal extends FindBugsReports {
    SingleFileReport getFirstEnabled();

    @Input
    @Optional
    Boolean getWithMessagesFlag();
}

<|edits_diff|>
--- subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/internal/FindBugsReportsInternal.java
+++ subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/internal/FindBugsReportsInternal.java
@@ -19,6 +19,7 @@
 import org.gradle.api.plugins.quality.FindBugsReports;
 import org.gradle.api.reporting.SingleFileReport;
 import org.gradle.api.tasks.Input;
+import org.gradle.api.tasks.Internal;
 import org.gradle.api.tasks.Optional;

 public interface FindBugsReportsInternal extends FindBugsReports {
<|current_version|>
/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.api.plugins.quality.internal;

import org.gradle.api.plugins.quality.FindBugsReports;
import org.gradle.api.reporting.SingleFileReport;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Optional;

public interface FindBugsReportsInternal extends FindBugsReports {
    SingleFileReport getFirstEnabled();

    @Input
    @Optional
    Boolean getWithMessagesFlag();
}

<|next_version|>
/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.api.plugins.quality.internal;

import org.gradle.api.plugins.quality.FindBugsReports;
import org.gradle.api.reporting.SingleFileReport;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Optional;

public interface FindBugsReportsInternal extends FindBugsReports {
    @Internal
    SingleFileReport getFirstEnabled();

    @Input
    @Optional
    Boolean getWithMessagesFlag();
}


Use Linker instead of LazyLinker

SGenJavaValidatorTest: Use Linker instead of LazyLinker

--- test-plugins/org.yakindu.sct.generator.genmodel.test/src/org/yakindu/sct/generator/genmodel/test/util/SGenTestRuntimeModule.java
+++ test-plugins/org.yakindu.sct.generator.genmodel.test/src/org/yakindu/sct/generator/genmodel/test/util/SGenTestRuntimeModule.java
@@ -11,6 +11,8 @@
 package org.yakindu.sct.generator.genmodel.test.util;

 import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
+import org.eclipse.xtext.linking.ILinker;
+import org.eclipse.xtext.linking.impl.Linker;
 import org.eclipse.xtext.scoping.IScopeProvider;
 import org.yakindu.sct.generator.genmodel.SGenRuntimeModule;
 import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;
@@ -30,4 +32,9 @@
 	public Class<? extends IEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
 		return SGenUserHelpDocumentationProvider.class;
 	}
+
+	@Override
+	public Class<? extends ILinker> bindILinker() {
+		return Linker.class;
+	}
 }

<|original_code|>
/**
 * Copyright (c) 2012 committers of YAKINDU and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * 	committers of YAKINDU - initial API and implementation
 *
 */
package org.yakindu.sct.generator.genmodel.test.util;

import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.yakindu.sct.generator.genmodel.SGenRuntimeModule;
import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;

/**
 *
 * @author andreas muelder - Initial contribution and API
 *
 */
public class SGenTestRuntimeModule extends SGenRuntimeModule {

	@Override
	public Class<? extends IScopeProvider> bindIScopeProvider() {
		return SGenTestScopeProvider.class;
	}

	public Class<? extends IEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
		return SGenUserHelpDocumentationProvider.class;
	}
}

<|edits_diff|>
--- test-plugins/org.yakindu.sct.generator.genmodel.test/src/org/yakindu/sct/generator/genmodel/test/util/SGenTestRuntimeModule.java
+++ test-plugins/org.yakindu.sct.generator.genmodel.test/src/org/yakindu/sct/generator/genmodel/test/util/SGenTestRuntimeModule.java
@@ -11,6 +11,8 @@
 package org.yakindu.sct.generator.genmodel.test.util;

 import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
+import org.eclipse.xtext.linking.ILinker;
+import org.eclipse.xtext.linking.impl.Linker;
 import org.eclipse.xtext.scoping.IScopeProvider;
 import org.yakindu.sct.generator.genmodel.SGenRuntimeModule;
 import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;
<|current_version|>
/**
 * Copyright (c) 2012 committers of YAKINDU and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * 	committers of YAKINDU - initial API and implementation
 *
 */
package org.yakindu.sct.generator.genmodel.test.util;

import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.linking.ILinker;
import org.eclipse.xtext.linking.impl.Linker;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.yakindu.sct.generator.genmodel.SGenRuntimeModule;
import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;

/**
 *
 * @author andreas muelder - Initial contribution and API
 *
 */
public class SGenTestRuntimeModule extends SGenRuntimeModule {

	@Override
	public Class<? extends IScopeProvider> bindIScopeProvider() {
		return SGenTestScopeProvider.class;
	}

	public Class<? extends IEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
		return SGenUserHelpDocumentationProvider.class;
	}
}

<|next_version|>
/**
 * Copyright (c) 2012 committers of YAKINDU and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * 	committers of YAKINDU - initial API and implementation
 *
 */
package org.yakindu.sct.generator.genmodel.test.util;

import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.linking.ILinker;
import org.eclipse.xtext.linking.impl.Linker;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.yakindu.sct.generator.genmodel.SGenRuntimeModule;
import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;

/**
 *
 * @author andreas muelder - Initial contribution and API
 *
 */
public class SGenTestRuntimeModule extends SGenRuntimeModule {

	@Override
	public Class<? extends IScopeProvider> bindIScopeProvider() {
		return SGenTestScopeProvider.class;
	}

	public Class<? extends IEObjectDocumentationProvider> bindIEObjectDocumentationProvider() {
		return SGenUserHelpDocumentationProvider.class;
	}

	@Override
	public Class<? extends ILinker> bindILinker() {
		return Linker.class;
	}
}


Adjust progress monitoring in downloading

--- src/main/java/com/github/blindpirate/gogradle/util/logging/ProgressMonitorInputStream.java
+++ src/main/java/com/github/blindpirate/gogradle/util/logging/ProgressMonitorInputStream.java
@@ -15,6 +15,7 @@
     private InputStream delegate;
     private ProgressLogger logger;
     private int totalBytes;
+    private boolean completed;

     public ProgressMonitorInputStream(String url, InputStream delegate) {
         this.delegate = delegate;
@@ -29,8 +30,12 @@
     @Override
     public int read() throws IOException {
         int bytes = delegate.read();
+        if (completed) {
+            return bytes;
+        }
         if (bytes == -1) {
             logger.completed();
+            completed = true;
         } else {
             totalBytes += bytes;
             logger.progress(byteCountToDisplaySize(totalBytes) + " downloaded");

<|original_code|>
package com.github.blindpirate.gogradle.util.logging;

import com.github.blindpirate.gogradle.GogradleGlobal;
import org.gradle.internal.logging.progress.ProgressLogger;
import org.gradle.internal.logging.progress.ProgressLoggerFactory;
import org.gradle.internal.service.ServiceRegistry;

import java.io.IOException;
import java.io.InputStream;

import static com.github.blindpirate.gogradle.util.IOUtils.byteCountToDisplaySize;

public class ProgressMonitorInputStream extends InputStream {
    private InputStream delegate;
    private ProgressLogger logger;
    private int totalBytes;

    public ProgressMonitorInputStream(String url, InputStream delegate) {
        this.delegate = delegate;
        ProgressLoggerFactory progressLoggerFactory =
                GogradleGlobal.getInstance(ServiceRegistry.class).get(ProgressLoggerFactory.class);
        logger = progressLoggerFactory.newOperation(this.getClass());

        String description = "Start downloading from " + url;
        logger.start(description, description);
    }

    @Override
    public int read() throws IOException {
        int bytes = delegate.read();
        if (bytes == -1) {
            logger.completed();
        } else {
            totalBytes += bytes;
            logger.progress(byteCountToDisplaySize(totalBytes) + " downloaded");
        }
        return bytes;
    }
}

<|edits_diff|>
--- src/main/java/com/github/blindpirate/gogradle/util/logging/ProgressMonitorInputStream.java
+++ src/main/java/com/github/blindpirate/gogradle/util/logging/ProgressMonitorInputStream.java
@@ -15,6 +15,7 @@
     private InputStream delegate;
     private ProgressLogger logger;
     private int totalBytes;
+    private boolean completed;

     public ProgressMonitorInputStream(String url, InputStream delegate) {
         this.delegate = delegate;
@@ -29,6 +30,9 @@
     @Override
     public int read() throws IOException {
         int bytes = delegate.read();
+        if (completed) {
+            return bytes;
+        }
         if (bytes == -1) {
             logger.completed();
         } else {
<|current_version|>
package com.github.blindpirate.gogradle.util.logging;

import com.github.blindpirate.gogradle.GogradleGlobal;
import org.gradle.internal.logging.progress.ProgressLogger;
import org.gradle.internal.logging.progress.ProgressLoggerFactory;
import org.gradle.internal.service.ServiceRegistry;

import java.io.IOException;
import java.io.InputStream;

import static com.github.blindpirate.gogradle.util.IOUtils.byteCountToDisplaySize;

public class ProgressMonitorInputStream extends InputStream {
    private InputStream delegate;
    private ProgressLogger logger;
    private int totalBytes;
    private boolean completed;

    public ProgressMonitorInputStream(String url, InputStream delegate) {
        this.delegate = delegate;
        ProgressLoggerFactory progressLoggerFactory =
                GogradleGlobal.getInstance(ServiceRegistry.class).get(ProgressLoggerFactory.class);
        logger = progressLoggerFactory.newOperation(this.getClass());

        String description = "Start downloading from " + url;
        logger.start(description, description);
    }

    @Override
    public int read() throws IOException {
        int bytes = delegate.read();
        if (completed) {
            return bytes;
        }
        if (bytes == -1) {
            logger.completed();
        } else {
            totalBytes += bytes;
            logger.progress(byteCountToDisplaySize(totalBytes) + " downloaded");
        }
        return bytes;
    }
}

<|next_version|>
package com.github.blindpirate.gogradle.util.logging;

import com.github.blindpirate.gogradle.GogradleGlobal;
import org.gradle.internal.logging.progress.ProgressLogger;
import org.gradle.internal.logging.progress.ProgressLoggerFactory;
import org.gradle.internal.service.ServiceRegistry;

import java.io.IOException;
import java.io.InputStream;

import static com.github.blindpirate.gogradle.util.IOUtils.byteCountToDisplaySize;

public class ProgressMonitorInputStream extends InputStream {
    private InputStream delegate;
    private ProgressLogger logger;
    private int totalBytes;
    private boolean completed;

    public ProgressMonitorInputStream(String url, InputStream delegate) {
        this.delegate = delegate;
        ProgressLoggerFactory progressLoggerFactory =
                GogradleGlobal.getInstance(ServiceRegistry.class).get(ProgressLoggerFactory.class);
        logger = progressLoggerFactory.newOperation(this.getClass());

        String description = "Start downloading from " + url;
        logger.start(description, description);
    }

    @Override
    public int read() throws IOException {
        int bytes = delegate.read();
        if (completed) {
            return bytes;
        }
        if (bytes == -1) {
            logger.completed();
            completed = true;
        } else {
            totalBytes += bytes;
            logger.progress(byteCountToDisplaySize(totalBytes) + " downloaded");
        }
        return bytes;
    }
}


Create generic repository stub: - how solve problem with entity

--- src/main/java/com/github/solairerove/woodstock/repository/GenericRepository.java
+++ src/main/java/com/github/solairerove/woodstock/repository/GenericRepository.java
@@ -1,8 +1,15 @@
 package com.github.solairerove.woodstock.repository;

 import com.github.solairerove.woodstock.domain.base.BaseEntity;
+import org.springframework.data.neo4j.annotation.Query;
 import org.springframework.data.neo4j.repository.GraphRepository;
+import org.springframework.data.repository.query.Param;

 public interface GenericRepository<T extends BaseEntity> extends GraphRepository<T> {

+    @Query("MATCH (task:Task)<-[:HAS_IN]-(tickets) WHERE id(task)={id1} RETURN tickets")
+    Iterable<T> getTicketsThatHasInTaskFromId(@Param("id") Long id1);
+
+    @Query("MATCH (task:Task)<-[:HAS_IN]-(ticket) WHERE id(task)={id1} AND id(ticket)={id2} RETURN ticket")
+    T getTicketThatHasInTaskFromId(@Param("id1") Long id1, @Param("id2") Long id2);
 }

<|original_code|>
package com.github.solairerove.woodstock.repository;

import com.github.solairerove.woodstock.domain.base.BaseEntity;
import org.springframework.data.neo4j.repository.GraphRepository;

public interface GenericRepository<T extends BaseEntity> extends GraphRepository<T> {

}

<|edits_diff|>
--- src/main/java/com/github/solairerove/woodstock/repository/GenericRepository.java
+++ src/main/java/com/github/solairerove/woodstock/repository/GenericRepository.java
@@ -1,7 +1,9 @@
 package com.github.solairerove.woodstock.repository;

 import com.github.solairerove.woodstock.domain.base.BaseEntity;
+import org.springframework.data.neo4j.annotation.Query;
 import org.springframework.data.neo4j.repository.GraphRepository;
+import org.springframework.data.repository.query.Param;

 public interface GenericRepository<T extends BaseEntity> extends GraphRepository<T> {

<|current_version|>
package com.github.solairerove.woodstock.repository;

import com.github.solairerove.woodstock.domain.base.BaseEntity;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.GraphRepository;
import org.springframework.data.repository.query.Param;

public interface GenericRepository<T extends BaseEntity> extends GraphRepository<T> {

}

<|next_version|>
package com.github.solairerove.woodstock.repository;

import com.github.solairerove.woodstock.domain.base.BaseEntity;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.GraphRepository;
import org.springframework.data.repository.query.Param;

public interface GenericRepository<T extends BaseEntity> extends GraphRepository<T> {

    @Query("MATCH (task:Task)<-[:HAS_IN]-(tickets) WHERE id(task)={id1} RETURN tickets")
    Iterable<T> getTicketsThatHasInTaskFromId(@Param("id") Long id1);

    @Query("MATCH (task:Task)<-[:HAS_IN]-(ticket) WHERE id(task)={id1} AND id(ticket)={id2} RETURN ticket")
    T getTicketThatHasInTaskFromId(@Param("id1") Long id1, @Param("id2") Long id2);
}


Fix NPE if no results are found

Fix NPE if no results are found

--- src/org/pikater/core/ontology/subtrees/metadata/Metadatas.java
+++ src/org/pikater/core/ontology/subtrees/metadata/Metadatas.java
@@ -1,5 +1,6 @@
 package org.pikater.core.ontology.subtrees.metadata;

+import java.util.ArrayList;
 import java.util.List;

 import jade.content.Concept;
@@ -12,6 +13,10 @@
 	private static final long serialVersionUID = -7879865268316684239L;

 	private List<Metadata> metadatas;
+
+	public Metadatas(){
+		this.metadatas=new ArrayList<Metadata>();
+	}

 	public List<Metadata> getMetadatas() {
 		return metadatas;

<|original_code|>
package org.pikater.core.ontology.subtrees.metadata;

import java.util.List;

import jade.content.Concept;

public class Metadatas implements Concept {

	/**
	 *
	 */
	private static final long serialVersionUID = -7879865268316684239L;

	private List<Metadata> metadatas;

	public List<Metadata> getMetadatas() {
		return metadatas;
	}

	public void setMetadatas(List<Metadata> metadatas) {
		this.metadatas = metadatas;
	}

}

<|edits_diff|>
--- src/org/pikater/core/ontology/subtrees/metadata/Metadatas.java
+++ src/org/pikater/core/ontology/subtrees/metadata/Metadatas.java
@@ -1,5 +1,6 @@
 package org.pikater.core.ontology.subtrees.metadata;

+import java.util.ArrayList;
 import java.util.List;

 import jade.content.Concept;
<|current_version|>
package org.pikater.core.ontology.subtrees.metadata;

import java.util.ArrayList;
import java.util.List;

import jade.content.Concept;

public class Metadatas implements Concept {

	/**
	 *
	 */
	private static final long serialVersionUID = -7879865268316684239L;

	private List<Metadata> metadatas;

	public List<Metadata> getMetadatas() {
		return metadatas;
	}

	public void setMetadatas(List<Metadata> metadatas) {
		this.metadatas = metadatas;
	}

}

<|next_version|>
package org.pikater.core.ontology.subtrees.metadata;

import java.util.ArrayList;
import java.util.List;

import jade.content.Concept;

public class Metadatas implements Concept {

	/**
	 *
	 */
	private static final long serialVersionUID = -7879865268316684239L;

	private List<Metadata> metadatas;

	public Metadatas(){
		this.metadatas=new ArrayList<Metadata>();
	}

	public List<Metadata> getMetadatas() {
		return metadatas;
	}

	public void setMetadatas(List<Metadata> metadatas) {
		this.metadatas = metadatas;
	}

}


Mark new role as unstable API

[misc] Mark new role as unstable API

--- components/xwiki-translation-manager/src/main/java/org/phenotips/translation/TranslationManager.java
+++ components/xwiki-translation-manager/src/main/java/org/phenotips/translation/TranslationManager.java
@@ -18,10 +18,12 @@
 package org.phenotips.translation;

 import org.xwiki.component.annotation.Role;
+import org.xwiki.stability.Unstable;

 /**
  * @version $Id$
  */
+@Unstable("New API introduced in 1.2")
 @Role
 public interface TranslationManager
 {

<|original_code|>
/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/
 */
package org.phenotips.translation;

import org.xwiki.component.annotation.Role;

/**
 * @version $Id$
 */
@Role
public interface TranslationManager
{
    /**
     * Get the translation corresponding to the given key, using the current locale.
     *
     * @param key the identifier of the message to retrieve
     * @param parameters optional parameters to be used in the translation
     * @return the message in the current locale, as plain text (all markup is stripped)
     */
    String translate(String key, Object... parameters);
}

<|edits_diff|>
--- components/xwiki-translation-manager/src/main/java/org/phenotips/translation/TranslationManager.java
+++ components/xwiki-translation-manager/src/main/java/org/phenotips/translation/TranslationManager.java
@@ -18,6 +18,7 @@
 package org.phenotips.translation;

 import org.xwiki.component.annotation.Role;
+import org.xwiki.stability.Unstable;

 /**
  * @version $Id$
<|current_version|>
/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/
 */
package org.phenotips.translation;

import org.xwiki.component.annotation.Role;
import org.xwiki.stability.Unstable;

/**
 * @version $Id$
 */
@Role
public interface TranslationManager
{
    /**
     * Get the translation corresponding to the given key, using the current locale.
     *
     * @param key the identifier of the message to retrieve
     * @param parameters optional parameters to be used in the translation
     * @return the message in the current locale, as plain text (all markup is stripped)
     */
    String translate(String key, Object... parameters);
}

<|next_version|>
/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses/
 */
package org.phenotips.translation;

import org.xwiki.component.annotation.Role;
import org.xwiki.stability.Unstable;

/**
 * @version $Id$
 */
@Unstable("New API introduced in 1.2")
@Role
public interface TranslationManager
{
    /**
     * Get the translation corresponding to the given key, using the current locale.
     *
     * @param key the identifier of the message to retrieve
     * @param parameters optional parameters to be used in the translation
     * @return the message in the current locale, as plain text (all markup is stripped)
     */
    String translate(String key, Object... parameters);
}


Add javadoc to text object operators

Add javadoc to text object operators

--- model-implementation/src/main/java/org/verapdf/model/impl/pb/operator/textobject/PBOpTextObject.java
+++ model-implementation/src/main/java/org/verapdf/model/impl/pb/operator/textobject/PBOpTextObject.java
@@ -7,10 +7,13 @@
 import java.util.List;

 /**
+ * Base class for pdf text operators (BT and ET)
+ *
  * @author Timur Kamalov
  */
 public class PBOpTextObject extends PBOperator implements OpTextObject {

+	/** Type name for {@code PBOpTextObject} */
     public static final String OP_TEXT_OBJECT_TYPE = "OpTextObject";

     public PBOpTextObject(List<COSBase> arguments) {

<|original_code|>
package org.verapdf.model.impl.pb.operator.textobject;

import org.apache.pdfbox.cos.COSBase;
import org.verapdf.model.impl.pb.operator.base.PBOperator;
import org.verapdf.model.operator.OpTextObject;

import java.util.List;

/**
 * @author Timur Kamalov
 */
public class PBOpTextObject extends PBOperator implements OpTextObject {

    public static final String OP_TEXT_OBJECT_TYPE = "OpTextObject";

    public PBOpTextObject(List<COSBase> arguments) {
        super(arguments, OP_TEXT_OBJECT_TYPE);
    }

}

<|edits_diff|>
--- model-implementation/src/main/java/org/verapdf/model/impl/pb/operator/textobject/PBOpTextObject.java
+++ model-implementation/src/main/java/org/verapdf/model/impl/pb/operator/textobject/PBOpTextObject.java
@@ -7,6 +7,8 @@
 import java.util.List;

 /**
+ * Base class for pdf text operators (BT and ET)
+ *
  * @author Timur Kamalov
  */
 public class PBOpTextObject extends PBOperator implements OpTextObject {
<|current_version|>
package org.verapdf.model.impl.pb.operator.textobject;

import org.apache.pdfbox.cos.COSBase;
import org.verapdf.model.impl.pb.operator.base.PBOperator;
import org.verapdf.model.operator.OpTextObject;

import java.util.List;

/**
 * Base class for pdf text operators (BT and ET)
 *
 * @author Timur Kamalov
 */
public class PBOpTextObject extends PBOperator implements OpTextObject {

    public static final String OP_TEXT_OBJECT_TYPE = "OpTextObject";

    public PBOpTextObject(List<COSBase> arguments) {
        super(arguments, OP_TEXT_OBJECT_TYPE);
    }

}

<|next_version|>
package org.verapdf.model.impl.pb.operator.textobject;

import org.apache.pdfbox.cos.COSBase;
import org.verapdf.model.impl.pb.operator.base.PBOperator;
import org.verapdf.model.operator.OpTextObject;

import java.util.List;

/**
 * Base class for pdf text operators (BT and ET)
 *
 * @author Timur Kamalov
 */
public class PBOpTextObject extends PBOperator implements OpTextObject {

	/** Type name for {@code PBOpTextObject} */
    public static final String OP_TEXT_OBJECT_TYPE = "OpTextObject";

    public PBOpTextObject(List<COSBase> arguments) {
        super(arguments, OP_TEXT_OBJECT_TYPE);
    }

}


Include the dates when a component is available. This is because we now aren't agregaring components.

--- api/src/main/java/uk/ac/ox/oucs/vle/CourseComponent.java
+++ api/src/main/java/uk/ac/ox/oucs/vle/CourseComponent.java
@@ -1,4 +1,6 @@
 package uk.ac.ox.oucs.vle;
+
+import java.util.Date;

 public interface CourseComponent {

@@ -16,6 +18,10 @@

 	public String getLocation();

+	public Date getOpens();
+
+	public Date getCloses();
+
 	/**
 	 * The ID of the component set that this component belongs to.
 	 * This is used when there are multiple copies of a component running at once to discover

<|original_code|>
package uk.ac.ox.oucs.vle;

public interface CourseComponent {

	public String getId();

	public String getTitle();

	public int getPlaces();

	public int getSize();

	public String getPresenter();

	public String getPresenterEmail();

	public String getLocation();

	/**
	 * The ID of the component set that this component belongs to.
	 * This is used when there are multiple copies of a component running at once to discover
	 * which ones the user can select from.
	 * @return
	 */
	public String getComponentSet();
}

<|edits_diff|>
--- api/src/main/java/uk/ac/ox/oucs/vle/CourseComponent.java
+++ api/src/main/java/uk/ac/ox/oucs/vle/CourseComponent.java
@@ -1,4 +1,6 @@
 package uk.ac.ox.oucs.vle;
+
+import java.util.Date;

 public interface CourseComponent {

<|current_version|>
package uk.ac.ox.oucs.vle;

import java.util.Date;

public interface CourseComponent {

	public String getId();

	public String getTitle();

	public int getPlaces();

	public int getSize();

	public String getPresenter();

	public String getPresenterEmail();

	public String getLocation();

	/**
	 * The ID of the component set that this component belongs to.
	 * This is used when there are multiple copies of a component running at once to discover
	 * which ones the user can select from.
	 * @return
	 */
	public String getComponentSet();
}

<|next_version|>
package uk.ac.ox.oucs.vle;

import java.util.Date;

public interface CourseComponent {

	public String getId();

	public String getTitle();

	public int getPlaces();

	public int getSize();

	public String getPresenter();

	public String getPresenterEmail();

	public String getLocation();

	public Date getOpens();

	public Date getCloses();

	/**
	 * The ID of the component set that this component belongs to.
	 * This is used when there are multiple copies of a component running at once to discover
	 * which ones the user can select from.
	 * @return
	 */
	public String getComponentSet();
}


Improve diagnostics for testLoadContexts failures

--- plugin/test/com/microsoft/alm/plugin/idea/common/ui/common/mocks/MockServerContextLookupPageModel.java
+++ plugin/test/com/microsoft/alm/plugin/idea/common/ui/common/mocks/MockServerContextLookupPageModel.java
@@ -6,6 +6,8 @@
 import com.microsoft.alm.plugin.context.ServerContext;
 import com.microsoft.alm.plugin.idea.common.ui.common.ModelValidationInfo;
 import com.microsoft.alm.plugin.idea.common.ui.common.ServerContextLookupPageModel;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import sun.security.util.Debug;

 import java.util.ArrayList;
 import java.util.List;
@@ -42,6 +44,8 @@

     @Override
     public void clearContexts() {
+        // Disgnostics for ServerContextLookupListenerTest::testLoadContexts
+        Debug.println("MockServerContextLookupPageModel::clearContexts", ExceptionUtils.getStackTrace(new Throwable()));
         contexts.clear();
     }
 }

<|original_code|>
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root.

package com.microsoft.alm.plugin.idea.common.ui.common.mocks;

import com.microsoft.alm.plugin.context.ServerContext;
import com.microsoft.alm.plugin.idea.common.ui.common.ModelValidationInfo;
import com.microsoft.alm.plugin.idea.common.ui.common.ServerContextLookupPageModel;

import java.util.ArrayList;
import java.util.List;

public class MockServerContextLookupPageModel implements ServerContextLookupPageModel {
    public boolean loading;
    public List<ModelValidationInfo> errors = new ArrayList<ModelValidationInfo>();
    public List<ServerContext> contexts = new ArrayList<ServerContext>();

    @Override
    public void setLoading(boolean loading) {
        this.loading = loading;
    }

    @Override
    public boolean isLoading() {
        return false;
    }

    @Override
    public void addError(ModelValidationInfo validationInfo) {
        errors.add(validationInfo);
    }

    @Override
    public void clearErrors() {
        errors.clear();
    }

    @Override
    public void appendContexts(List<ServerContext> serverContexts) {
        contexts.addAll(serverContexts);
    }

    @Override
    public void clearContexts() {
        contexts.clear();
    }
}

<|edits_diff|>
--- plugin/test/com/microsoft/alm/plugin/idea/common/ui/common/mocks/MockServerContextLookupPageModel.java
+++ plugin/test/com/microsoft/alm/plugin/idea/common/ui/common/mocks/MockServerContextLookupPageModel.java
@@ -6,6 +6,8 @@
 import com.microsoft.alm.plugin.context.ServerContext;
 import com.microsoft.alm.plugin.idea.common.ui.common.ModelValidationInfo;
 import com.microsoft.alm.plugin.idea.common.ui.common.ServerContextLookupPageModel;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import sun.security.util.Debug;

 import java.util.ArrayList;
 import java.util.List;
<|current_version|>
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root.

package com.microsoft.alm.plugin.idea.common.ui.common.mocks;

import com.microsoft.alm.plugin.context.ServerContext;
import com.microsoft.alm.plugin.idea.common.ui.common.ModelValidationInfo;
import com.microsoft.alm.plugin.idea.common.ui.common.ServerContextLookupPageModel;
import org.apache.commons.lang3.exception.ExceptionUtils;
import sun.security.util.Debug;

import java.util.ArrayList;
import java.util.List;

public class MockServerContextLookupPageModel implements ServerContextLookupPageModel {
    public boolean loading;
    public List<ModelValidationInfo> errors = new ArrayList<ModelValidationInfo>();
    public List<ServerContext> contexts = new ArrayList<ServerContext>();

    @Override
    public void setLoading(boolean loading) {
        this.loading = loading;
    }

    @Override
    public boolean isLoading() {
        return false;
    }

    @Override
    public void addError(ModelValidationInfo validationInfo) {
        errors.add(validationInfo);
    }

    @Override
    public void clearErrors() {
        errors.clear();
    }

    @Override
    public void appendContexts(List<ServerContext> serverContexts) {
        contexts.addAll(serverContexts);
    }

    @Override
    public void clearContexts() {
        contexts.clear();
    }
}

<|next_version|>
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root.

package com.microsoft.alm.plugin.idea.common.ui.common.mocks;

import com.microsoft.alm.plugin.context.ServerContext;
import com.microsoft.alm.plugin.idea.common.ui.common.ModelValidationInfo;
import com.microsoft.alm.plugin.idea.common.ui.common.ServerContextLookupPageModel;
import org.apache.commons.lang3.exception.ExceptionUtils;
import sun.security.util.Debug;

import java.util.ArrayList;
import java.util.List;

public class MockServerContextLookupPageModel implements ServerContextLookupPageModel {
    public boolean loading;
    public List<ModelValidationInfo> errors = new ArrayList<ModelValidationInfo>();
    public List<ServerContext> contexts = new ArrayList<ServerContext>();

    @Override
    public void setLoading(boolean loading) {
        this.loading = loading;
    }

    @Override
    public boolean isLoading() {
        return false;
    }

    @Override
    public void addError(ModelValidationInfo validationInfo) {
        errors.add(validationInfo);
    }

    @Override
    public void clearErrors() {
        errors.clear();
    }

    @Override
    public void appendContexts(List<ServerContext> serverContexts) {
        contexts.addAll(serverContexts);
    }

    @Override
    public void clearContexts() {
        // Disgnostics for ServerContextLookupListenerTest::testLoadContexts
        Debug.println("MockServerContextLookupPageModel::clearContexts", ExceptionUtils.getStackTrace(new Throwable()));
        contexts.clear();
    }
}


Add user’s commands to chat

Add user’s commands to chat

--- src/main/java/seedu/task/logic/LogicManager.java
+++ src/main/java/seedu/task/logic/LogicManager.java
@@ -10,6 +10,7 @@
 import seedu.task.logic.commands.exceptions.CommandException;
 import seedu.task.logic.parser.Parser;
 import seedu.task.model.Model;
+import seedu.task.model.task.Chat;
 import seedu.task.model.task.ChatList;
 import seedu.task.model.task.ReadOnlyTask;
 import seedu.task.storage.Storage;
@@ -31,6 +32,8 @@
     @Override
     public CommandResult execute(String commandText) throws CommandException {
         logger.info("----------------[USER COMMAND][" + commandText + "]");
+        ChatList chatList = getChatList();
+        chatList.add(new Chat(commandText));
         Command command = parser.parseCommand(commandText);
         command.setData(model);
         return command.execute();

<|original_code|>
package seedu.task.logic;

import java.util.logging.Logger;

import javafx.collections.ObservableList;
import seedu.task.commons.core.ComponentManager;
import seedu.task.commons.core.LogsCenter;
import seedu.task.logic.commands.Command;
import seedu.task.logic.commands.CommandResult;
import seedu.task.logic.commands.exceptions.CommandException;
import seedu.task.logic.parser.Parser;
import seedu.task.model.Model;
import seedu.task.model.task.ChatList;
import seedu.task.model.task.ReadOnlyTask;
import seedu.task.storage.Storage;

/**
 * The main LogicManager of the app.
 */
public class LogicManager extends ComponentManager implements Logic {
    private final Logger logger = LogsCenter.getLogger(LogicManager.class);

    private final Model model;
    private final Parser parser;

    public LogicManager(Model model, Storage storage) {
        this.model = model;
        this.parser = new Parser();
    }

    @Override
    public CommandResult execute(String commandText) throws CommandException {
        logger.info("----------------[USER COMMAND][" + commandText + "]");
        Command command = parser.parseCommand(commandText);
        command.setData(model);
        return command.execute();
    }

    @Override
    public ObservableList<ReadOnlyTask> getFilteredTaskList() {
        return model.getFilteredTaskList();
    }

    @Override
    public ChatList getChatList() {
        // TODO Auto-generated method stub
        return model.getChatList();
    }
}

<|edits_diff|>
--- src/main/java/seedu/task/logic/LogicManager.java
+++ src/main/java/seedu/task/logic/LogicManager.java
@@ -10,6 +10,7 @@
 import seedu.task.logic.commands.exceptions.CommandException;
 import seedu.task.logic.parser.Parser;
 import seedu.task.model.Model;
+import seedu.task.model.task.Chat;
 import seedu.task.model.task.ChatList;
 import seedu.task.model.task.ReadOnlyTask;
 import seedu.task.storage.Storage;
<|current_version|>
package seedu.task.logic;

import java.util.logging.Logger;

import javafx.collections.ObservableList;
import seedu.task.commons.core.ComponentManager;
import seedu.task.commons.core.LogsCenter;
import seedu.task.logic.commands.Command;
import seedu.task.logic.commands.CommandResult;
import seedu.task.logic.commands.exceptions.CommandException;
import seedu.task.logic.parser.Parser;
import seedu.task.model.Model;
import seedu.task.model.task.Chat;
import seedu.task.model.task.ChatList;
import seedu.task.model.task.ReadOnlyTask;
import seedu.task.storage.Storage;

/**
 * The main LogicManager of the app.
 */
public class LogicManager extends ComponentManager implements Logic {
    private final Logger logger = LogsCenter.getLogger(LogicManager.class);

    private final Model model;
    private final Parser parser;

    public LogicManager(Model model, Storage storage) {
        this.model = model;
        this.parser = new Parser();
    }

    @Override
    public CommandResult execute(String commandText) throws CommandException {
        logger.info("----------------[USER COMMAND][" + commandText + "]");
        Command command = parser.parseCommand(commandText);
        command.setData(model);
        return command.execute();
    }

    @Override
    public ObservableList<ReadOnlyTask> getFilteredTaskList() {
        return model.getFilteredTaskList();
    }

    @Override
    public ChatList getChatList() {
        // TODO Auto-generated method stub
        return model.getChatList();
    }
}

<|next_version|>
package seedu.task.logic;

import java.util.logging.Logger;

import javafx.collections.ObservableList;
import seedu.task.commons.core.ComponentManager;
import seedu.task.commons.core.LogsCenter;
import seedu.task.logic.commands.Command;
import seedu.task.logic.commands.CommandResult;
import seedu.task.logic.commands.exceptions.CommandException;
import seedu.task.logic.parser.Parser;
import seedu.task.model.Model;
import seedu.task.model.task.Chat;
import seedu.task.model.task.ChatList;
import seedu.task.model.task.ReadOnlyTask;
import seedu.task.storage.Storage;

/**
 * The main LogicManager of the app.
 */
public class LogicManager extends ComponentManager implements Logic {
    private final Logger logger = LogsCenter.getLogger(LogicManager.class);

    private final Model model;
    private final Parser parser;

    public LogicManager(Model model, Storage storage) {
        this.model = model;
        this.parser = new Parser();
    }

    @Override
    public CommandResult execute(String commandText) throws CommandException {
        logger.info("----------------[USER COMMAND][" + commandText + "]");
        ChatList chatList = getChatList();
        chatList.add(new Chat(commandText));
        Command command = parser.parseCommand(commandText);
        command.setData(model);
        return command.execute();
    }

    @Override
    public ObservableList<ReadOnlyTask> getFilteredTaskList() {
        return model.getFilteredTaskList();
    }

    @Override
    public ChatList getChatList() {
        // TODO Auto-generated method stub
        return model.getChatList();
    }
}


Add expandable extension factory to application

--- app/src/main/java/com/mikepenz/fastadapter/app/CustomApplication.java
+++ app/src/main/java/com/mikepenz/fastadapter/app/CustomApplication.java
@@ -1,5 +1,6 @@
 package com.mikepenz.fastadapter.app;

+import com.mikepenz.fastadapter.expandable.ExpandableExtensionFactory;
 import com.mikepenz.fastadapter.extensions.ExtensionsFactories;
 import com.mikepenz.fastadapter.select.SelectExtensionFactory;

@@ -21,5 +22,6 @@
         Realm.setDefaultConfiguration(config);

         ExtensionsFactories.INSTANCE.register(new SelectExtensionFactory());
+        ExtensionsFactories.INSTANCE.register(new ExpandableExtensionFactory());
     }
 }

<|original_code|>
package com.mikepenz.fastadapter.app;

import com.mikepenz.fastadapter.extensions.ExtensionsFactories;
import com.mikepenz.fastadapter.select.SelectExtensionFactory;

import androidx.multidex.MultiDexApplication;
import io.realm.Realm;
import io.realm.RealmConfiguration;

/**
 * Created by mikepenz on 04.07.16.
 */

public class CustomApplication extends MultiDexApplication {
    @Override
    public void onCreate() {
        super.onCreate();
        // The Realm file will be located in Context.getFilesDir() with name "default.realm"
        Realm.init(this);
        RealmConfiguration config = new RealmConfiguration.Builder().build();
        Realm.setDefaultConfiguration(config);

        ExtensionsFactories.INSTANCE.register(new SelectExtensionFactory());
    }
}

<|edits_diff|>
--- app/src/main/java/com/mikepenz/fastadapter/app/CustomApplication.java
+++ app/src/main/java/com/mikepenz/fastadapter/app/CustomApplication.java
@@ -1,5 +1,6 @@
 package com.mikepenz.fastadapter.app;

+import com.mikepenz.fastadapter.expandable.ExpandableExtensionFactory;
 import com.mikepenz.fastadapter.extensions.ExtensionsFactories;
 import com.mikepenz.fastadapter.select.SelectExtensionFactory;

<|current_version|>
package com.mikepenz.fastadapter.app;

import com.mikepenz.fastadapter.expandable.ExpandableExtensionFactory;
import com.mikepenz.fastadapter.extensions.ExtensionsFactories;
import com.mikepenz.fastadapter.select.SelectExtensionFactory;

import androidx.multidex.MultiDexApplication;
import io.realm.Realm;
import io.realm.RealmConfiguration;

/**
 * Created by mikepenz on 04.07.16.
 */

public class CustomApplication extends MultiDexApplication {
    @Override
    public void onCreate() {
        super.onCreate();
        // The Realm file will be located in Context.getFilesDir() with name "default.realm"
        Realm.init(this);
        RealmConfiguration config = new RealmConfiguration.Builder().build();
        Realm.setDefaultConfiguration(config);

        ExtensionsFactories.INSTANCE.register(new SelectExtensionFactory());
    }
}

<|next_version|>
package com.mikepenz.fastadapter.app;

import com.mikepenz.fastadapter.expandable.ExpandableExtensionFactory;
import com.mikepenz.fastadapter.extensions.ExtensionsFactories;
import com.mikepenz.fastadapter.select.SelectExtensionFactory;

import androidx.multidex.MultiDexApplication;
import io.realm.Realm;
import io.realm.RealmConfiguration;

/**
 * Created by mikepenz on 04.07.16.
 */

public class CustomApplication extends MultiDexApplication {
    @Override
    public void onCreate() {
        super.onCreate();
        // The Realm file will be located in Context.getFilesDir() with name "default.realm"
        Realm.init(this);
        RealmConfiguration config = new RealmConfiguration.Builder().build();
        Realm.setDefaultConfiguration(config);

        ExtensionsFactories.INSTANCE.register(new SelectExtensionFactory());
        ExtensionsFactories.INSTANCE.register(new ExpandableExtensionFactory());
    }
}


Resolve XXE vulnerability in XML validation

--- manage-server/src/main/java/manage/validations/XMLFormatValidator.java
+++ manage-server/src/main/java/manage/validations/XMLFormatValidator.java
@@ -3,6 +3,7 @@
 import org.everit.json.schema.FormatValidator;
 import org.xml.sax.SAXException;

+import javax.xml.XMLConstants;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import java.io.ByteArrayInputStream;
@@ -11,12 +12,16 @@

 public class XMLFormatValidator implements FormatValidator {

+    private static final String FEATURE_DISABLE_DOCTYPE = "http://apache.org/xml/features/disallow-doctype-decl";
+
     @Override
     public Optional<String> validate(String subject) {
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         factory.setValidating(false);
         factory.setNamespaceAware(true);
         try {
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+            factory.setFeature(FEATURE_DISABLE_DOCTYPE, true);
             factory.newDocumentBuilder().parse(new ByteArrayInputStream(subject.getBytes()));
         } catch (ParserConfigurationException | SAXException | IOException e) {
             return Optional.of(e.toString());

<|original_code|>
package manage.validations;

import org.everit.json.schema.FormatValidator;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Optional;

public class XMLFormatValidator implements FormatValidator {

    @Override
    public Optional<String> validate(String subject) {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false);
        factory.setNamespaceAware(true);
        try {
            factory.newDocumentBuilder().parse(new ByteArrayInputStream(subject.getBytes()));
        } catch (ParserConfigurationException | SAXException | IOException e) {
            return Optional.of(e.toString());
        }
        return Optional.empty();
    }

    @Override
    public String formatName() {
        return "xml";
    }

}

<|edits_diff|>
--- manage-server/src/main/java/manage/validations/XMLFormatValidator.java
+++ manage-server/src/main/java/manage/validations/XMLFormatValidator.java
@@ -3,6 +3,7 @@
 import org.everit.json.schema.FormatValidator;
 import org.xml.sax.SAXException;

+import javax.xml.XMLConstants;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import java.io.ByteArrayInputStream;
@@ -10,6 +11,8 @@
 import java.util.Optional;

 public class XMLFormatValidator implements FormatValidator {
+
+    private static final String FEATURE_DISABLE_DOCTYPE = "http://apache.org/xml/features/disallow-doctype-decl";

     @Override
     public Optional<String> validate(String subject) {
<|current_version|>
package manage.validations;

import org.everit.json.schema.FormatValidator;
import org.xml.sax.SAXException;

import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Optional;

public class XMLFormatValidator implements FormatValidator {

    private static final String FEATURE_DISABLE_DOCTYPE = "http://apache.org/xml/features/disallow-doctype-decl";

    @Override
    public Optional<String> validate(String subject) {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false);
        factory.setNamespaceAware(true);
        try {
            factory.newDocumentBuilder().parse(new ByteArrayInputStream(subject.getBytes()));
        } catch (ParserConfigurationException | SAXException | IOException e) {
            return Optional.of(e.toString());
        }
        return Optional.empty();
    }

    @Override
    public String formatName() {
        return "xml";
    }

}

<|next_version|>
package manage.validations;

import org.everit.json.schema.FormatValidator;
import org.xml.sax.SAXException;

import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Optional;

public class XMLFormatValidator implements FormatValidator {

    private static final String FEATURE_DISABLE_DOCTYPE = "http://apache.org/xml/features/disallow-doctype-decl";

    @Override
    public Optional<String> validate(String subject) {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false);
        factory.setNamespaceAware(true);
        try {
            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
            factory.setFeature(FEATURE_DISABLE_DOCTYPE, true);
            factory.newDocumentBuilder().parse(new ByteArrayInputStream(subject.getBytes()));
        } catch (ParserConfigurationException | SAXException | IOException e) {
            return Optional.of(e.toString());
        }
        return Optional.empty();
    }

    @Override
    public String formatName() {
        return "xml";
    }

}


Check signed jar on testmod

Check signed jar on testmod

--- src/test/java/info/u_team/u_team_test/TestMod.java
+++ src/test/java/info/u_team/u_team_test/TestMod.java
@@ -1,5 +1,6 @@
 package info.u_team.u_team_test;

+import info.u_team.u_team_core.util.verify.JarSignVerifier;
 import net.minecraftforge.fml.common.Mod;

 @Mod(TestMod.MODID)
@@ -8,6 +9,7 @@
 	public static final String MODID = "uteamtest";

 	public TestMod() {
+		JarSignVerifier.checkSigned(MODID);
 		System.out.println("--------------------------------------- LOADING TEST MOD ---------------------------------------");
 	}
 }

<|original_code|>
package info.u_team.u_team_test;

import net.minecraftforge.fml.common.Mod;

@Mod(TestMod.MODID)
public class TestMod {

	public static final String MODID = "uteamtest";

	public TestMod() {
		System.out.println("--------------------------------------- LOADING TEST MOD ---------------------------------------");
	}
}

<|edits_diff|>
--- src/test/java/info/u_team/u_team_test/TestMod.java
+++ src/test/java/info/u_team/u_team_test/TestMod.java
@@ -1,5 +1,6 @@
 package info.u_team.u_team_test;

+import info.u_team.u_team_core.util.verify.JarSignVerifier;
 import net.minecraftforge.fml.common.Mod;

 @Mod(TestMod.MODID)
<|current_version|>
package info.u_team.u_team_test;

import info.u_team.u_team_core.util.verify.JarSignVerifier;
import net.minecraftforge.fml.common.Mod;

@Mod(TestMod.MODID)
public class TestMod {

	public static final String MODID = "uteamtest";

	public TestMod() {
		System.out.println("--------------------------------------- LOADING TEST MOD ---------------------------------------");
	}
}

<|next_version|>
package info.u_team.u_team_test;

import info.u_team.u_team_core.util.verify.JarSignVerifier;
import net.minecraftforge.fml.common.Mod;

@Mod(TestMod.MODID)
public class TestMod {

	public static final String MODID = "uteamtest";

	public TestMod() {
		JarSignVerifier.checkSigned(MODID);
		System.out.println("--------------------------------------- LOADING TEST MOD ---------------------------------------");
	}
}


[HOPS-808] Fix performance degradation due to safemode and enable namenode resource monitoring

--- src/main/java/io/hops/DalStorageFactory.java
+++ src/main/java/io/hops/DalStorageFactory.java
@@ -15,6 +15,7 @@
  */
 package io.hops;

+import io.hops.exception.StorageException;
 import io.hops.exception.StorageInitializtionException;
 import io.hops.metadata.common.EntityDataAccess;

@@ -28,4 +29,7 @@
   public StorageConnector getConnector();

   public EntityDataAccess getDataAccess(Class type);
+
+  public boolean hasResources(double threshold) throws StorageException;
+
 }

<|original_code|>
/*
 * Copyright (C) 2015 hops.io.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.hops;

import io.hops.exception.StorageInitializtionException;
import io.hops.metadata.common.EntityDataAccess;

import java.util.Properties;

public interface DalStorageFactory {

  public void setConfiguration(Properties conf)
      throws StorageInitializtionException;

  public StorageConnector getConnector();

  public EntityDataAccess getDataAccess(Class type);
}

<|edits_diff|>
--- src/main/java/io/hops/DalStorageFactory.java
+++ src/main/java/io/hops/DalStorageFactory.java
@@ -15,6 +15,7 @@
  */
 package io.hops;

+import io.hops.exception.StorageException;
 import io.hops.exception.StorageInitializtionException;
 import io.hops.metadata.common.EntityDataAccess;

<|current_version|>
/*
 * Copyright (C) 2015 hops.io.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.hops;

import io.hops.exception.StorageException;
import io.hops.exception.StorageInitializtionException;
import io.hops.metadata.common.EntityDataAccess;

import java.util.Properties;

public interface DalStorageFactory {

  public void setConfiguration(Properties conf)
      throws StorageInitializtionException;

  public StorageConnector getConnector();

  public EntityDataAccess getDataAccess(Class type);
}

<|next_version|>
/*
 * Copyright (C) 2015 hops.io.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.hops;

import io.hops.exception.StorageException;
import io.hops.exception.StorageInitializtionException;
import io.hops.metadata.common.EntityDataAccess;

import java.util.Properties;

public interface DalStorageFactory {

  public void setConfiguration(Properties conf)
      throws StorageInitializtionException;

  public StorageConnector getConnector();

  public EntityDataAccess getDataAccess(Class type);

  public boolean hasResources(double threshold) throws StorageException;

}


Set Date when persisting Transaction

Set Date when persisting Transaction

--- OpERP/src/main/java/devopsdistilled/operp/server/data/service/account/impl/TransactionServiceImpl.java
+++ OpERP/src/main/java/devopsdistilled/operp/server/data/service/account/impl/TransactionServiceImpl.java
@@ -1,4 +1,6 @@
 package devopsdistilled.operp.server.data.service.account.impl;
+
+import java.util.Date;

 import org.springframework.data.jpa.repository.JpaRepository;

@@ -15,4 +17,9 @@
 		return null;
 	}

+	@Override
+	public <S extends T> S save(S transaction) {
+		transaction.setTransactionDate(new Date());
+		return super.save(transaction);
+	}
 }

<|original_code|>
package devopsdistilled.operp.server.data.service.account.impl;

import org.springframework.data.jpa.repository.JpaRepository;

import devopsdistilled.operp.server.data.entity.account.Transaction;
import devopsdistilled.operp.server.data.service.impl.AbstractEntityService;

public abstract class TransactionServiceImpl<T extends Transaction<?>, TR extends JpaRepository<T, Long>>
		extends AbstractEntityService<T, Long, TR> {

	private static final long serialVersionUID = -4898201898165854461L;

	@Override
	protected T findByEntityName(String entityName) {
		return null;
	}

}

<|edits_diff|>
--- OpERP/src/main/java/devopsdistilled/operp/server/data/service/account/impl/TransactionServiceImpl.java
+++ OpERP/src/main/java/devopsdistilled/operp/server/data/service/account/impl/TransactionServiceImpl.java
@@ -1,4 +1,6 @@
 package devopsdistilled.operp.server.data.service.account.impl;
+
+import java.util.Date;

 import org.springframework.data.jpa.repository.JpaRepository;

<|current_version|>
package devopsdistilled.operp.server.data.service.account.impl;

import java.util.Date;

import org.springframework.data.jpa.repository.JpaRepository;

import devopsdistilled.operp.server.data.entity.account.Transaction;
import devopsdistilled.operp.server.data.service.impl.AbstractEntityService;

public abstract class TransactionServiceImpl<T extends Transaction<?>, TR extends JpaRepository<T, Long>>
		extends AbstractEntityService<T, Long, TR> {

	private static final long serialVersionUID = -4898201898165854461L;

	@Override
	protected T findByEntityName(String entityName) {
		return null;
	}

}

<|next_version|>
package devopsdistilled.operp.server.data.service.account.impl;

import java.util.Date;

import org.springframework.data.jpa.repository.JpaRepository;

import devopsdistilled.operp.server.data.entity.account.Transaction;
import devopsdistilled.operp.server.data.service.impl.AbstractEntityService;

public abstract class TransactionServiceImpl<T extends Transaction<?>, TR extends JpaRepository<T, Long>>
		extends AbstractEntityService<T, Long, TR> {

	private static final long serialVersionUID = -4898201898165854461L;

	@Override
	protected T findByEntityName(String entityName) {
		return null;
	}

	@Override
	public <S extends T> S save(S transaction) {
		transaction.setTransactionDate(new Date());
		return super.save(transaction);
	}
}


Add conditionnalOn to EndpointObfuscator ensure it won't be avaiable in non-web context

--- src/main/java/org/araymond/joal/web/config/EndpointObfuscatorConfiguration.java
+++ src/main/java/org/araymond/joal/web/config/EndpointObfuscatorConfiguration.java
@@ -1,6 +1,7 @@
 package org.araymond.joal.web.config;

 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
 import org.springframework.boot.web.servlet.ServletRegistrationBean;
 import org.springframework.context.annotation.Bean;
@@ -10,6 +11,7 @@
 /**
  * Created by raymo on 25/07/2017.
  */
+@ConditionalOnProperty(name = "spring.main.web-environment", havingValue = "true")
 @Configuration
 public class EndpointObfuscatorConfiguration {

<|original_code|>
package org.araymond.joal.web.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;

/**
 * Created by raymo on 25/07/2017.
 */
@Configuration
public class EndpointObfuscatorConfiguration {

    private final String pathPrefix;

    public EndpointObfuscatorConfiguration(@Value("${joal.ui.path.prefix}")final String pathPrefix) {
        this.pathPrefix = pathPrefix;
    }

    @Bean
    public DispatcherServlet dispatcherServlet() {
        return new DispatcherServlet();
    }

    @Bean
    public ServletRegistrationBean dispatcherServletRegistration() {
        final ServletRegistrationBean registration = new ServletRegistrationBean(
                dispatcherServlet(),
                "/" + this.pathPrefix + "/*"
        );
        registration.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
        return registration;
    }
}

<|edits_diff|>
--- src/main/java/org/araymond/joal/web/config/EndpointObfuscatorConfiguration.java
+++ src/main/java/org/araymond/joal/web/config/EndpointObfuscatorConfiguration.java
@@ -1,6 +1,7 @@
 package org.araymond.joal.web.config;

 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
 import org.springframework.boot.web.servlet.ServletRegistrationBean;
 import org.springframework.context.annotation.Bean;
<|current_version|>
package org.araymond.joal.web.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;

/**
 * Created by raymo on 25/07/2017.
 */
@Configuration
public class EndpointObfuscatorConfiguration {

    private final String pathPrefix;

    public EndpointObfuscatorConfiguration(@Value("${joal.ui.path.prefix}")final String pathPrefix) {
        this.pathPrefix = pathPrefix;
    }

    @Bean
    public DispatcherServlet dispatcherServlet() {
        return new DispatcherServlet();
    }

    @Bean
    public ServletRegistrationBean dispatcherServletRegistration() {
        final ServletRegistrationBean registration = new ServletRegistrationBean(
                dispatcherServlet(),
                "/" + this.pathPrefix + "/*"
        );
        registration.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
        return registration;
    }
}

<|next_version|>
package org.araymond.joal.web.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;

/**
 * Created by raymo on 25/07/2017.
 */
@ConditionalOnProperty(name = "spring.main.web-environment", havingValue = "true")
@Configuration
public class EndpointObfuscatorConfiguration {

    private final String pathPrefix;

    public EndpointObfuscatorConfiguration(@Value("${joal.ui.path.prefix}")final String pathPrefix) {
        this.pathPrefix = pathPrefix;
    }

    @Bean
    public DispatcherServlet dispatcherServlet() {
        return new DispatcherServlet();
    }

    @Bean
    public ServletRegistrationBean dispatcherServletRegistration() {
        final ServletRegistrationBean registration = new ServletRegistrationBean(
                dispatcherServlet(),
                "/" + this.pathPrefix + "/*"
        );
        registration.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
        return registration;
    }
}


Add validation to logout request

Add validation to logout request

--- WahrDiscordApi/src/main/java/co/phoenixlab/discord/api/request/LogoutRequest.java
+++ WahrDiscordApi/src/main/java/co/phoenixlab/discord/api/request/LogoutRequest.java
@@ -15,12 +15,14 @@
 import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
+import org.hibernate.validator.constraints.NotEmpty;

 @Getter
 @NoArgsConstructor
 @AllArgsConstructor
 public class LogoutRequest {

+    @NotEmpty
     private String token;

 }

<|original_code|>
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 Vincent Zhang/PhoenixLAB
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package co.phoenixlab.discord.api.request;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class LogoutRequest {

    private String token;

}

<|edits_diff|>
--- WahrDiscordApi/src/main/java/co/phoenixlab/discord/api/request/LogoutRequest.java
+++ WahrDiscordApi/src/main/java/co/phoenixlab/discord/api/request/LogoutRequest.java
@@ -15,6 +15,7 @@
 import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
+import org.hibernate.validator.constraints.NotEmpty;

 @Getter
 @NoArgsConstructor
<|current_version|>
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 Vincent Zhang/PhoenixLAB
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package co.phoenixlab.discord.api.request;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.NotEmpty;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class LogoutRequest {

    private String token;

}

<|next_version|>
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 Vincent Zhang/PhoenixLAB
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

package co.phoenixlab.discord.api.request;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.NotEmpty;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class LogoutRequest {

    @NotEmpty
    private String token;

}


Add condition to webMvcMetricsFilter bean

Co-authored-by: Marco Geweke <8bae85dbfa00ce59d1b81e4121747343f331087b@otto.de>

--- edison-core/src/main/java/de/otto/edison/metricsconfiguration/WebMvcMetricsFilterWorkaroundForBugInSpringBoot2_7_0.java
+++ edison-core/src/main/java/de/otto/edison/metricsconfiguration/WebMvcMetricsFilterWorkaroundForBugInSpringBoot2_7_0.java
@@ -4,6 +4,7 @@
 import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties;
 import org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter;
 import org.springframework.boot.actuate.metrics.web.servlet.WebMvcTagsProvider;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.boot.web.servlet.FilterRegistrationBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.core.Ordered;
@@ -11,10 +12,12 @@

 import javax.servlet.DispatcherType;

+/* TODO: Remove this when Spring Boot 2.7.1 is there */
 @Component
 public class WebMvcMetricsFilterWorkaroundForBugInSpringBoot2_7_0 {

     @Bean
+    @ConditionalOnMissingBean
     public FilterRegistrationBean<WebMvcMetricsFilter> webMvcMetricsFilter(MetricsProperties properties,
                                                                            MeterRegistry registry, WebMvcTagsProvider tagsProvider) {
         MetricsProperties.Web.Server.ServerRequest request = properties.getWeb().getServer().getRequest();

<|original_code|>
package de.otto.edison.metricsconfiguration;

import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties;
import org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter;
import org.springframework.boot.actuate.metrics.web.servlet.WebMvcTagsProvider;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

import javax.servlet.DispatcherType;

@Component
public class WebMvcMetricsFilterWorkaroundForBugInSpringBoot2_7_0 {

    @Bean
    public FilterRegistrationBean<WebMvcMetricsFilter> webMvcMetricsFilter(MetricsProperties properties,
                                                                           MeterRegistry registry, WebMvcTagsProvider tagsProvider) {
        MetricsProperties.Web.Server.ServerRequest request = properties.getWeb().getServer().getRequest();
        WebMvcMetricsFilter filter = new WebMvcMetricsFilter(registry, tagsProvider, request.getMetricName(),
                request.getAutotime());
        FilterRegistrationBean<WebMvcMetricsFilter> registration = new FilterRegistrationBean<>(filter);
        registration.setOrder(Ordered.HIGHEST_PRECEDENCE + 1);
        registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC);
        return registration;
    }

}

<|edits_diff|>
--- edison-core/src/main/java/de/otto/edison/metricsconfiguration/WebMvcMetricsFilterWorkaroundForBugInSpringBoot2_7_0.java
+++ edison-core/src/main/java/de/otto/edison/metricsconfiguration/WebMvcMetricsFilterWorkaroundForBugInSpringBoot2_7_0.java
@@ -4,6 +4,7 @@
 import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties;
 import org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter;
 import org.springframework.boot.actuate.metrics.web.servlet.WebMvcTagsProvider;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
 import org.springframework.boot.web.servlet.FilterRegistrationBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.core.Ordered;
@@ -11,6 +12,7 @@

 import javax.servlet.DispatcherType;

+/* TODO: Remove this when Spring Boot 2.7.1 is there */
 @Component
 public class WebMvcMetricsFilterWorkaroundForBugInSpringBoot2_7_0 {

<|current_version|>
package de.otto.edison.metricsconfiguration;

import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties;
import org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter;
import org.springframework.boot.actuate.metrics.web.servlet.WebMvcTagsProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

import javax.servlet.DispatcherType;

/* TODO: Remove this when Spring Boot 2.7.1 is there */
@Component
public class WebMvcMetricsFilterWorkaroundForBugInSpringBoot2_7_0 {

    @Bean
    public FilterRegistrationBean<WebMvcMetricsFilter> webMvcMetricsFilter(MetricsProperties properties,
                                                                           MeterRegistry registry, WebMvcTagsProvider tagsProvider) {
        MetricsProperties.Web.Server.ServerRequest request = properties.getWeb().getServer().getRequest();
        WebMvcMetricsFilter filter = new WebMvcMetricsFilter(registry, tagsProvider, request.getMetricName(),
                request.getAutotime());
        FilterRegistrationBean<WebMvcMetricsFilter> registration = new FilterRegistrationBean<>(filter);
        registration.setOrder(Ordered.HIGHEST_PRECEDENCE + 1);
        registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC);
        return registration;
    }

}

<|next_version|>
package de.otto.edison.metricsconfiguration;

import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties;
import org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter;
import org.springframework.boot.actuate.metrics.web.servlet.WebMvcTagsProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

import javax.servlet.DispatcherType;

/* TODO: Remove this when Spring Boot 2.7.1 is there */
@Component
public class WebMvcMetricsFilterWorkaroundForBugInSpringBoot2_7_0 {

    @Bean
    @ConditionalOnMissingBean
    public FilterRegistrationBean<WebMvcMetricsFilter> webMvcMetricsFilter(MetricsProperties properties,
                                                                           MeterRegistry registry, WebMvcTagsProvider tagsProvider) {
        MetricsProperties.Web.Server.ServerRequest request = properties.getWeb().getServer().getRequest();
        WebMvcMetricsFilter filter = new WebMvcMetricsFilter(registry, tagsProvider, request.getMetricName(),
                request.getAutotime());
        FilterRegistrationBean<WebMvcMetricsFilter> registration = new FilterRegistrationBean<>(filter);
        registration.setOrder(Ordered.HIGHEST_PRECEDENCE + 1);
        registration.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.ASYNC);
        return registration;
    }

}


Add bytebuffer overload to native library.

--- src/java/nanomsg/NativeLibrary.java
+++ src/java/nanomsg/NativeLibrary.java
@@ -1,4 +1,6 @@
 package nanomsg;
+
+import java.nio.ByteBuffer;

 import com.sun.jna.Native;
 import com.sun.jna.Pointer;
@@ -12,6 +14,7 @@
   public static native int nn_bind (int s, String addr);
   public static native int nn_connect (int s, String addr);
   public static native int nn_send (int s, byte[] buff, int len, int flags);
+  public static native int nn_send (int s, ByteBuffer buff, int len, int flags);
   public static native int nn_recv (int s, PointerByReference buff, int len, int flags);
   public static native int nn_setsockopt (int s, int level, int option, Pointer optval, int optvallen);
   public static native int nn_getsockopt (int s, int level, int option, Pointer optval, Pointer optvallen);

<|original_code|>
package nanomsg;

import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.PointerByReference;
import com.sun.jna.ptr.IntByReference;

public class NativeLibrary {
  public static native int nn_socket (int domain, int protocol);
  public static native int nn_close (int s);
  public static native int nn_bind (int s, String addr);
  public static native int nn_connect (int s, String addr);
  public static native int nn_send (int s, byte[] buff, int len, int flags);
  public static native int nn_recv (int s, PointerByReference buff, int len, int flags);
  public static native int nn_setsockopt (int s, int level, int option, Pointer optval, int optvallen);
  public static native int nn_getsockopt (int s, int level, int option, Pointer optval, Pointer optvallen);
  public static native int nn_freemsg (Pointer msg);
  public static native int nn_errno ();
  public static native int nn_device (int s1, int s2);
  public static native void nn_term();

  public static native String nn_strerror (int errnum);
  public static native Pointer nn_symbol (int i, IntByReference value);

  static {
    Native.register("nanomsg");
  }
}

<|edits_diff|>
--- src/java/nanomsg/NativeLibrary.java
+++ src/java/nanomsg/NativeLibrary.java
@@ -1,4 +1,6 @@
 package nanomsg;
+
+import java.nio.ByteBuffer;

 import com.sun.jna.Native;
 import com.sun.jna.Pointer;
<|current_version|>
package nanomsg;

import java.nio.ByteBuffer;

import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.PointerByReference;
import com.sun.jna.ptr.IntByReference;

public class NativeLibrary {
  public static native int nn_socket (int domain, int protocol);
  public static native int nn_close (int s);
  public static native int nn_bind (int s, String addr);
  public static native int nn_connect (int s, String addr);
  public static native int nn_send (int s, byte[] buff, int len, int flags);
  public static native int nn_recv (int s, PointerByReference buff, int len, int flags);
  public static native int nn_setsockopt (int s, int level, int option, Pointer optval, int optvallen);
  public static native int nn_getsockopt (int s, int level, int option, Pointer optval, Pointer optvallen);
  public static native int nn_freemsg (Pointer msg);
  public static native int nn_errno ();
  public static native int nn_device (int s1, int s2);
  public static native void nn_term();

  public static native String nn_strerror (int errnum);
  public static native Pointer nn_symbol (int i, IntByReference value);

  static {
    Native.register("nanomsg");
  }
}

<|next_version|>
package nanomsg;

import java.nio.ByteBuffer;

import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.PointerByReference;
import com.sun.jna.ptr.IntByReference;

public class NativeLibrary {
  public static native int nn_socket (int domain, int protocol);
  public static native int nn_close (int s);
  public static native int nn_bind (int s, String addr);
  public static native int nn_connect (int s, String addr);
  public static native int nn_send (int s, byte[] buff, int len, int flags);
  public static native int nn_send (int s, ByteBuffer buff, int len, int flags);
  public static native int nn_recv (int s, PointerByReference buff, int len, int flags);
  public static native int nn_setsockopt (int s, int level, int option, Pointer optval, int optvallen);
  public static native int nn_getsockopt (int s, int level, int option, Pointer optval, Pointer optvallen);
  public static native int nn_freemsg (Pointer msg);
  public static native int nn_errno ();
  public static native int nn_device (int s1, int s2);
  public static native void nn_term();

  public static native String nn_strerror (int errnum);
  public static native Pointer nn_symbol (int i, IntByReference value);

  static {
    Native.register("nanomsg");
  }
}


Add new method newBufferedWriter with a CharsetEncoder

--- src/main/java/stexfires/io/BaseRecordFile.java
+++ src/main/java/stexfires/io/BaseRecordFile.java
@@ -5,7 +5,9 @@
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
 import java.nio.file.Files;
 import java.nio.file.OpenOption;
 import java.nio.file.Path;
@@ -43,6 +45,10 @@
         return Files.newBufferedWriter(path, charset, options);
     }

+    protected BufferedWriter newBufferedWriter(CharsetEncoder charsetEncoder, OpenOption... options) throws IOException {
+        return new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(path, options), charsetEncoder));
+    }
+
     protected BufferedReader newBufferedReader(Charset charset) throws IOException {
         return Files.newBufferedReader(path, charset);
     }

<|original_code|>
package stexfires.io;

import stexfires.core.Record;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.util.Objects;

/**
 * @author Mathias Kalb
 * @since 0.1
 */
public class BaseRecordFile<W extends Record, R extends W> implements ReadableRecordFile<R>, WritableRecordFile<W> {

    protected final Path path;

    public BaseRecordFile(final Path path) {
        Objects.requireNonNull(path);
        this.path = path;
    }

    @Override
    public final Path getPath() {
        return path;
    }

    @Override
    public ReadableRecordProducer<R> openProducer() throws IOException {
        throw new UnsupportedOperationException();
    }

    @Override
    public WritableRecordConsumer<W> openConsumer() throws IOException {
        throw new UnsupportedOperationException();
    }

    protected BufferedWriter newBufferedWriter(Charset charset, OpenOption... options) throws IOException {
        return Files.newBufferedWriter(path, charset, options);
    }

    protected BufferedReader newBufferedReader(Charset charset) throws IOException {
        return Files.newBufferedReader(path, charset);
    }

}

<|edits_diff|>
--- src/main/java/stexfires/io/BaseRecordFile.java
+++ src/main/java/stexfires/io/BaseRecordFile.java
@@ -5,7 +5,9 @@
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
 import java.nio.file.Files;
 import java.nio.file.OpenOption;
 import java.nio.file.Path;
<|current_version|>
package stexfires.io;

import stexfires.core.Record;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.util.Objects;

/**
 * @author Mathias Kalb
 * @since 0.1
 */
public class BaseRecordFile<W extends Record, R extends W> implements ReadableRecordFile<R>, WritableRecordFile<W> {

    protected final Path path;

    public BaseRecordFile(final Path path) {
        Objects.requireNonNull(path);
        this.path = path;
    }

    @Override
    public final Path getPath() {
        return path;
    }

    @Override
    public ReadableRecordProducer<R> openProducer() throws IOException {
        throw new UnsupportedOperationException();
    }

    @Override
    public WritableRecordConsumer<W> openConsumer() throws IOException {
        throw new UnsupportedOperationException();
    }

    protected BufferedWriter newBufferedWriter(Charset charset, OpenOption... options) throws IOException {
        return Files.newBufferedWriter(path, charset, options);
    }

    protected BufferedReader newBufferedReader(Charset charset) throws IOException {
        return Files.newBufferedReader(path, charset);
    }

}

<|next_version|>
package stexfires.io;

import stexfires.core.Record;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.util.Objects;

/**
 * @author Mathias Kalb
 * @since 0.1
 */
public class BaseRecordFile<W extends Record, R extends W> implements ReadableRecordFile<R>, WritableRecordFile<W> {

    protected final Path path;

    public BaseRecordFile(final Path path) {
        Objects.requireNonNull(path);
        this.path = path;
    }

    @Override
    public final Path getPath() {
        return path;
    }

    @Override
    public ReadableRecordProducer<R> openProducer() throws IOException {
        throw new UnsupportedOperationException();
    }

    @Override
    public WritableRecordConsumer<W> openConsumer() throws IOException {
        throw new UnsupportedOperationException();
    }

    protected BufferedWriter newBufferedWriter(Charset charset, OpenOption... options) throws IOException {
        return Files.newBufferedWriter(path, charset, options);
    }

    protected BufferedWriter newBufferedWriter(CharsetEncoder charsetEncoder, OpenOption... options) throws IOException {
        return new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(path, options), charsetEncoder));
    }

    protected BufferedReader newBufferedReader(Charset charset) throws IOException {
        return Files.newBufferedReader(path, charset);
    }

}


Mark it Windows only before Linux implement ready.

--- src/test/java/io/github/hcoona/utils/NamedMutexTest.java
+++ src/test/java/io/github/hcoona/utils/NamedMutexTest.java
@@ -1,6 +1,9 @@
 package io.github.hcoona.utils;

+import com.sun.jna.Platform;
 import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.BeforeClass;
 import org.junit.Test;

 import java.util.concurrent.ExecutorService;
@@ -9,6 +12,11 @@
 import java.util.concurrent.TimeUnit;

 public class NamedMutexTest {
+
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    Assume.assumeTrue(Platform.isWindows());
+  }

   @Test
   public void testCannotWaitOne() throws Exception {

<|original_code|>
package io.github.hcoona.utils;

import org.junit.Assert;
import org.junit.Test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

public class NamedMutexTest {

  @Test
  public void testCannotWaitOne() throws Exception {
    final String name = "test_named-mutex_cannot-wait-one";
    try (NamedMutex ignored = NamedMutex.newInstance(true, name)) {
      ExecutorService executor = Executors.newSingleThreadExecutor();

      Future<Boolean> waitOneFuture = executor.submit(() -> {
        try (NamedMutex mutex2 = NamedMutex.newInstance(true, name)) {
          return mutex2.waitOne(500, TimeUnit.MILLISECONDS);
        }
      });

      Assert.assertFalse(waitOneFuture.get());
    }
  }

  @Test
  public void testCanWaitOne() throws Exception {
    final String name = "test_named-mutex_can-wait-one";
    try (NamedMutex mutex_owned = NamedMutex.newInstance(true, name)) {
      mutex_owned.release();
      ExecutorService executor = Executors.newSingleThreadExecutor();

      Future<Boolean> waitOneFuture = executor.submit(() -> {
        try (NamedMutex mutex2 = NamedMutex.newInstance(true, name)) {
          return mutex2.waitOne(5, TimeUnit.SECONDS);
        }
      });

      Assert.assertTrue(waitOneFuture.get());
    }
  }

}

<|edits_diff|>
--- src/test/java/io/github/hcoona/utils/NamedMutexTest.java
+++ src/test/java/io/github/hcoona/utils/NamedMutexTest.java
@@ -1,6 +1,9 @@
 package io.github.hcoona.utils;

+import com.sun.jna.Platform;
 import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.BeforeClass;
 import org.junit.Test;

 import java.util.concurrent.ExecutorService;
<|current_version|>
package io.github.hcoona.utils;

import com.sun.jna.Platform;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

public class NamedMutexTest {

  @Test
  public void testCannotWaitOne() throws Exception {
    final String name = "test_named-mutex_cannot-wait-one";
    try (NamedMutex ignored = NamedMutex.newInstance(true, name)) {
      ExecutorService executor = Executors.newSingleThreadExecutor();

      Future<Boolean> waitOneFuture = executor.submit(() -> {
        try (NamedMutex mutex2 = NamedMutex.newInstance(true, name)) {
          return mutex2.waitOne(500, TimeUnit.MILLISECONDS);
        }
      });

      Assert.assertFalse(waitOneFuture.get());
    }
  }

  @Test
  public void testCanWaitOne() throws Exception {
    final String name = "test_named-mutex_can-wait-one";
    try (NamedMutex mutex_owned = NamedMutex.newInstance(true, name)) {
      mutex_owned.release();
      ExecutorService executor = Executors.newSingleThreadExecutor();

      Future<Boolean> waitOneFuture = executor.submit(() -> {
        try (NamedMutex mutex2 = NamedMutex.newInstance(true, name)) {
          return mutex2.waitOne(5, TimeUnit.SECONDS);
        }
      });

      Assert.assertTrue(waitOneFuture.get());
    }
  }

}

<|next_version|>
package io.github.hcoona.utils;

import com.sun.jna.Platform;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

public class NamedMutexTest {

  @BeforeClass
  public static void beforeClass() throws Exception {
    Assume.assumeTrue(Platform.isWindows());
  }

  @Test
  public void testCannotWaitOne() throws Exception {
    final String name = "test_named-mutex_cannot-wait-one";
    try (NamedMutex ignored = NamedMutex.newInstance(true, name)) {
      ExecutorService executor = Executors.newSingleThreadExecutor();

      Future<Boolean> waitOneFuture = executor.submit(() -> {
        try (NamedMutex mutex2 = NamedMutex.newInstance(true, name)) {
          return mutex2.waitOne(500, TimeUnit.MILLISECONDS);
        }
      });

      Assert.assertFalse(waitOneFuture.get());
    }
  }

  @Test
  public void testCanWaitOne() throws Exception {
    final String name = "test_named-mutex_can-wait-one";
    try (NamedMutex mutex_owned = NamedMutex.newInstance(true, name)) {
      mutex_owned.release();
      ExecutorService executor = Executors.newSingleThreadExecutor();

      Future<Boolean> waitOneFuture = executor.submit(() -> {
        try (NamedMutex mutex2 = NamedMutex.newInstance(true, name)) {
          return mutex2.waitOne(5, TimeUnit.SECONDS);
        }
      });

      Assert.assertTrue(waitOneFuture.get());
    }
  }

}


Add register page and pre-load js functions to API

--- src/main/java/com/decker/essentiallib/API/PageAPI.java
+++ src/main/java/com/decker/essentiallib/API/PageAPI.java
@@ -1,5 +1,15 @@
 package com.decker.essentiallib.API;

+import com.decker.essentiallib.Page;
+import com.decker.essentiallib.PageTitleIcon;
+import com.decker.essentiallib.Reactor;
+
 public class PageAPI {
+    public static void reigsterPage(String title, String url, PageTitleIcon icon) {
+	Reactor.getReactor().addSidelistItem(title, new Page(title, url, icon));
+    }

+    public static void addPreloadJavascript(String url) {
+	Reactor.getReactor().addPreloadJavaScript(url);
+    }
 }

<|original_code|>
package com.decker.essentiallib.API;

public class PageAPI {

}

<|edits_diff|>
--- src/main/java/com/decker/essentiallib/API/PageAPI.java
+++ src/main/java/com/decker/essentiallib/API/PageAPI.java
@@ -1,5 +1,12 @@
 package com.decker.essentiallib.API;

+import com.decker.essentiallib.Page;
+import com.decker.essentiallib.PageTitleIcon;
+import com.decker.essentiallib.Reactor;
+
 public class PageAPI {
+    public static void reigsterPage(String title, String url, PageTitleIcon icon) {
+	Reactor.getReactor().addSidelistItem(title, new Page(title, url, icon));
+    }

 }
<|current_version|>
package com.decker.essentiallib.API;

import com.decker.essentiallib.Page;
import com.decker.essentiallib.PageTitleIcon;
import com.decker.essentiallib.Reactor;

public class PageAPI {
    public static void reigsterPage(String title, String url, PageTitleIcon icon) {
	Reactor.getReactor().addSidelistItem(title, new Page(title, url, icon));
    }

}

<|next_version|>
package com.decker.essentiallib.API;

import com.decker.essentiallib.Page;
import com.decker.essentiallib.PageTitleIcon;
import com.decker.essentiallib.Reactor;

public class PageAPI {
    public static void reigsterPage(String title, String url, PageTitleIcon icon) {
	Reactor.getReactor().addSidelistItem(title, new Page(title, url, icon));
    }

    public static void addPreloadJavascript(String url) {
	Reactor.getReactor().addPreloadJavaScript(url);
    }
}