package info.tregmine.database.db;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import info.tregmine.database.IItemDAO;
import info.tregmine.database.DAOException;

public class DBItemDAO implements IItemDAO
{
    private Connection conn;

    public DBItemDAO(Connection conn)
    {
        this.conn = conn;
    }

    @Override
    public int getItemValue(int itemId) throws DAOException
    {
        String sql = "SELECT * FROM item WHERE item_id = ?";

        try (PreparedStatement stmt = conn.prepareStatement(sql)) {
            stmt.setInt(1, itemId);
            stmt.execute();

            try (ResultSet rs = stmt.getResultSet()) {
                if (!rs.next()) {
                    return 0;
                }

                return rs.getInt("item_value");
            }
        } catch (SQLException e) {
            throw new DAOException(sql, e);
        }
    }
}

package info.tregmine.database.db;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import info.tregmine.database.IItemDAO;
import info.tregmine.database.DAOException;

public class DBItemDAO implements IItemDAO
{
    private Connection conn;

    public DBItemDAO(Connection conn)
    {
        this.conn = conn;
    }

    @Override
    public int getItemValue(int itemId, byte itemData) throws DAOException
    {
        String sql = "SELECT * FROM item WHERE item_id = ? AND item_data = ?";

        try (PreparedStatement stmt = conn.prepareStatement(sql)) {
            stmt.setInt(1, itemId);
            stmt.setByte(2, itemData);
            stmt.execute();

            try (ResultSet rs = stmt.getResultSet()) {
                if (!rs.next()) {
                    return 0;
                }

                return rs.getInt("item_value");
            }
        } catch (SQLException e) {
            throw new DAOException(sql, e);
        }
    }
}

Add support for item data

Add support for item data


/*
 * Copyright 1999-2005 The Apache Software Foundation.
 *
 * 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.
 */

/* $Id$ */

package org.apache.fop.area;

/**
 * The normal-flow-reference-area class.
 * Each span-reference-area contains one or more of these objects
 * See fo:region-body definition in the XSL Rec for more information.
 */
public class NormalFlow extends BlockParent {
    /**
     * Constructor.
     * @param ipd of Normal flow object
     */
    public NormalFlow(int ipd) {
        addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
        setIPD(ipd);
    }
}

/*
 * Copyright 1999-2005 The Apache Software Foundation.
 *
 * 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.
 */

/* $Id$ */

package org.apache.fop.area;

/**
 * The normal-flow-reference-area class.
 * Each span-reference-area contains one or more of these objects
 * See fo:region-body definition in the XSL Rec for more information.
 */
public class NormalFlow extends BlockParent {
    /**
     * Constructor.
     * @param ipd of Normal flow object
     */
    public NormalFlow(int ipd) {
        addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
        setIPD(ipd);
    }

    /** @see org.apache.fop.area.BlockParent#addBlock(org.apache.fop.area.Block) */
    public void addBlock(Block block) {
        super.addBlock(block);
        bpd += block.getAllocBPD();
    }
}

Accumulate the BPD extent used by the normal flow's children.

git-svn-id: 102839466c3b40dd9c7e25c0a1a6d26afc40150a@202359 13f79535-47bb-0310-9956-ffa450edef68


package com.creatubbles.api.model.comment;

import android.support.annotation.NonNull;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.github.jasminb.jsonapi.annotations.Type;

/**
 * Created by Janek on 20.12.2017.
 */
public enum MentionType {

    USER("user"),
    GROUP("group"),
    CREATION("creation"),
    GALLERY("gallery"),
    PARTNER_APPLICATION("partner_application"),
    UNKNOWN("unknown");

    private String typeName;

    MentionType(String typeName) {
        this.typeName = typeName;
    }

    @JsonValue
    @NonNull
    public String getTypeName() {
        return typeName;
    }

    @JsonCreator
    public static MentionType fromName(String typeName) {
        for (MentionType mentionType : MentionType.values()) {
            if (mentionType.getTypeName().equals(typeName)) {
                return mentionType;
            }
        }
        return UNKNOWN;
    }
}

package com.creatubbles.api.model.comment;

import android.support.annotation.NonNull;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * Created by Janek on 20.12.2017.
 */
public enum MentionType {

    USER("user"),
    GROUP("group"),
    CREATION("creation"),
    GALLERY("gallery"),
    PARTNER_APPLICATION("partner_application"),
    HASHTAG("hashtag"),
    UNKNOWN("unknown");

    private String typeName;

    MentionType(String typeName) {
        this.typeName = typeName;
    }

    @JsonValue
    @NonNull
    public String getTypeName() {
        return typeName;
    }

    @JsonCreator
    public static MentionType fromName(String typeName) {
        for (MentionType mentionType : MentionType.values()) {
            if (mentionType.getTypeName().equals(typeName)) {
                return mentionType;
            }
        }
        return UNKNOWN;
    }
}

Add Hashtag mention type to comments

Add Hashtag mention type to comments


package com.cgi.eoss.ftep.api.projections;

import com.cgi.eoss.ftep.model.Group;
import org.springframework.data.rest.core.config.Projection;

/**
 *
Abbreviated representation of a User entity, for embedding in REST responses.

 */
@Projection(name = "shortGroup", types = {Group.class})
public interface ShortGroup extends EmbeddedId {
    String getName();
    ShortUser getOwner();
}

package com.cgi.eoss.ftep.api.projections;

import com.cgi.eoss.ftep.model.Group;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.rest.core.config.Projection;

/**
 *
Abbreviated representation of a User entity, for embedding in REST responses.

 */
@Projection(name = "shortGroup", types = {Group.class})
public interface ShortGroup extends EmbeddedId {
    String getName();
    String getDescription();
    ShortUser getOwner();
    @Value("#{target.members.size()}")
    Integer getSize();
}

Add Group description and size to excerpt projection

Change-Id: Ie5cebac22f4caff7324d01a0dd3fe5cd7b5a4bc7


package org.adaptlab.chpir.android.survey.QuestionFragments;

import org.adaptlab.chpir.android.survey.QuestionFragment;

import android.view.ViewGroup;
import android.widget.RatingBar;

public class RatingQuestionFragment extends QuestionFragment  {
    private final static int NUM_STARS = 5;
    private float mRating;
    private RatingBar mRatingBar;

    @Override
    protected void createQuestionComponent(ViewGroup questionComponent) {
        mRatingBar = new RatingBar(getActivity());
        mRatingBar.setNumStars(NUM_STARS);
        mRatingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
            @Override
            public void onRatingChanged(RatingBar ratingBar, float rating,
                    boolean fromUser) {
                mRating = rating;
                saveResponse();
            }
        });
        questionComponent.addView(mRatingBar);
    }

    @Override
    protected String serialize() {
        return String.valueOf(mRating);
    }

    @Override
    protected void deserialize(String responseText) {
        if (!responseText.equals("")) {
            mRating = Float.parseFloat(responseText);
            mRatingBar.setRating(mRating);
        }
    }
}

package org.adaptlab.chpir.android.survey.QuestionFragments;

import org.adaptlab.chpir.android.survey.QuestionFragment;

import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RatingBar;

public class RatingQuestionFragment extends QuestionFragment  {
    private final static int NUM_STARS = 5;
    private float mRating;
    private RatingBar mRatingBar;

    @Override
    protected void createQuestionComponent(ViewGroup questionComponent) {
        mRatingBar = new RatingBar(getActivity());
        mRatingBar.setNumStars(NUM_STARS);
        mRatingBar.setLayoutParams(new ViewGroup.LayoutParams(
                LinearLayout.LayoutParams.WRAP_CONTENT,
                LinearLayout.LayoutParams.WRAP_CONTENT));
        mRatingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
            @Override
            public void onRatingChanged(RatingBar ratingBar, float rating,
                    boolean fromUser) {
                mRating = rating;
                saveResponse();
            }
        });
        questionComponent.addView(mRatingBar);
    }

    @Override
    protected String serialize() {
        return String.valueOf(mRating);
    }

    @Override
    protected void deserialize(String responseText) {
        if (!responseText.equals("")) {
            mRating = Float.parseFloat(responseText);
            mRatingBar.setRating(mRating);
        }
    }
}

Fix unpredictable number of stars in rating question type bug


/**
 *
 * Copyright (c) 2006-2016, Speedment, Inc. All Rights Reserved.
 *
 * 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 com.speedment.runtime.internal.platform.component.impl;

import com.speedment.runtime.Speedment;
import com.speedment.runtime.internal.runtime.DefaultApplicationBuilder;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;

/**
 *
 * @author Emil Forslund
 */
public class CreateSpeedmentInstanceTest {

    @Test
    public void createSpeedmentInstance() {
        final Speedment speedment = new DefaultApplicationBuilder()
            .withCheckDatabaseConnectivity(false)
            .withValidateRuntimeConfig(false)
            .build();

        assertNotNull(speedment);
    }

}

Fix license header in file

Fix license header in file


package org.xcolab.client.activities.enums;

public enum ActivityCategory {
    MEMBER,
    DISCUSSION,
    PROPOSAL,
    CONTEST;
}

package org.xcolab.client.activities.enums;

import java.util.Arrays;

public enum ActivityCategory {

    MEMBER(ContestActivityType.values()),
    DISCUSSION(DiscussionActivityType.values()),
    PROPOSAL(ProposalActivityType.values()),
    CONTEST(ContestActivityType.values());

    private final ActivityType[] activityTypes;

    ActivityCategory(ActivityType[] activityTypes) {
        this.activityTypes = activityTypes;
    }

    public ActivityType getActivityType(String activityType) {
        return Arrays.stream(activityTypes)
                .filter(s -> s.name().equalsIgnoreCase(activityType))
                .findAny()
                .orElseThrow(() -> new IllegalArgumentException(
                        "No enum constant " + name() + "." + activityType));
    }
}

Add method to get type from category

[COLAB-2469] Add method to get type from category


package model;

import org.junit.Test;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Scanner;

import static org.junit.Assert.*;

/**
 * Created by Elliad on 2016-05-08.
 */
public class FileModelTest {
    @Test
    public void singletonTest() {
        assertNotNull(FileModel.getModel());
    }

    @Test
    public void fileReadTest() {
        ArrayList<String> testArraylist = new ArrayList<String>();
        testArraylist.add("asdf\n");
        testArraylist.add("asdf");
        assertTrue(FileModel.getModel().readFile("A.txt"));
        assertEquals(FileModel.getModel().getStringArrayList(),testArraylist);

    }

    @Test
    public void fileWriteTest() {
        assertTrue(FileModel.getModel().writeFile("AA.txt"));
        ArrayList<String> testArraylist = new ArrayList<String>();
        try(Scanner in = new Scanner(new FileReader("AA.txt")))
        {
            String tempString = "";
            while(in.hasNext()) {
                tempString = in.next(); //임시 텍스트에 개행을 제외한 한 줄을 불러온다
                if(in.hasNext()) tempString +="\n"; //다음 줄이 없을 때는 개행을 추가하지 않는다.
                testArraylist.add(tempString);
            }
        } catch (FileNotFoundException e) {

            e.printStackTrace();
        }
        assertEquals(FileModel.getModel().getStringArrayList(),testArraylist);

    }
}

package model;

import org.junit.Test;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Scanner;

import static org.junit.Assert.*;

/**
 * Created by Elliad on 2016-05-08.
 */
public class FileModelTest {
    @Test
    public void fileReadTest() {
        ArrayList<String> testArraylist = new ArrayList<String>();
        testArraylist.add("asdf\n");
        testArraylist.add("asdf");
        assertTrue(FileModel.getModel().readFile("A.txt"));
        assertEquals(FileModel.getModel().getStringArrayList(),testArraylist);

    }

    @Test
    public void fileWriteTest() {
        assertTrue(FileModel.getModel().writeFile("AA.txt"));
        ArrayList<String> testArraylist = new ArrayList<String>();
        try(Scanner in = new Scanner(new FileReader("AA.txt")))
        {
            String tempString = "";
            while(in.hasNext()) {
                tempString = in.next(); //임시 텍스트에 개행을 제외한 한 줄을 불러온다
                if(in.hasNext()) tempString +="\n"; //다음 줄이 없을 때는 개행을 추가하지 않는다.
                testArraylist.add(tempString);
            }
        } catch (FileNotFoundException e) {

            e.printStackTrace();
        }
        assertEquals(FileModel.getModel().getStringArrayList(),testArraylist);

    }
}

Remove Singletone Test of FileModel

Remove Singletone Test of FileModel


/*
 * 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.prestosql.parquet;

import com.google.common.collect.ImmutableList;
import io.prestosql.spi.type.Type;

import java.util.List;
import java.util.Optional;

import static java.util.Objects.requireNonNull;

public class GroupField
        extends Field
{
    private final ImmutableList<Optional<Field>> children;

    public GroupField(Type type, int repetitionLevel, int definitionLevel, boolean required, ImmutableList<Optional<Field>> children)
    {
        super(type, repetitionLevel, definitionLevel, required);
        this.children = requireNonNull(children, "children is required");
    }

    public List<Optional<Field>> getChildren()
    {
        return children;
    }
}

/*
 * 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.prestosql.parquet;

import com.google.common.collect.ImmutableList;
import io.prestosql.spi.type.Type;

import java.util.List;
import java.util.Optional;

import static java.util.Objects.requireNonNull;

public class GroupField
        extends Field
{
    private final List<Optional<Field>> children;

    public GroupField(Type type, int repetitionLevel, int definitionLevel, boolean required, List<Optional<Field>> children)
    {
        super(type, repetitionLevel, definitionLevel, required);
        this.children = ImmutableList.copyOf(requireNonNull(children, "children is null"));
    }

    public List<Optional<Field>> getChildren()
    {
        return children;
    }
}

Declare field as a List

Declare field as a List


package com.github.blindpirate.gogradle.build;

import com.github.blindpirate.gogradle.util.ExceptionHandler;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.concurrent.CountDownLatch;
import java.util.function.Consumer;
import java.util.function.Supplier;

import static com.github.blindpirate.gogradle.GogradleGlobal.DEFAULT_CHARSET;

public class SubprocessReader extends Thread {
    private Supplier<InputStream> is;
    private CountDownLatch latch;
    private Consumer<String> consumer;

    public SubprocessReader(Supplier<InputStream> is,
                            Consumer<String> consumer,
                            CountDownLatch latch) {
        this.is = is;
        this.latch = latch;
        this.consumer = consumer;
    }

    @Override
    public void run() {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(is.get(), DEFAULT_CHARSET))) {
            String line;
            try {
                while ((line = br.readLine()) != null) {
                    consumer.accept(line);
                }
            } catch (IOException e) {
                consumer.accept(ExceptionHandler.getStackTrace(e));
            }
        } catch (IOException e) {
            throw ExceptionHandler.uncheckException(e);
        } finally {
            latch.countDown();
        }
    }
}

package com.github.blindpirate.gogradle.build;

import com.github.blindpirate.gogradle.util.ExceptionHandler;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.concurrent.CountDownLatch;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Supplier;

import static com.github.blindpirate.gogradle.GogradleGlobal.DEFAULT_CHARSET;

public class SubprocessReader extends Thread {
    private Supplier<InputStream> is;
    private CountDownLatch latch;
    private Consumer<String> consumer;
    private Predicate<String> lineFilter = line -> true;

    public SubprocessReader(Supplier<InputStream> is,
                            Consumer<String> consumer,
                            CountDownLatch latch) {
        this.is = is;
        this.latch = latch;
        this.consumer = consumer;
    }

    public SubprocessReader(Supplier<InputStream> is,
                            Consumer<String> consumer,
                            CountDownLatch latch,
                            Predicate<String> lineFilter) {
        this.is = is;
        this.latch = latch;
        this.consumer = consumer;
        this.lineFilter = lineFilter;
    }

    @Override
    public void run() {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(is.get(), DEFAULT_CHARSET))) {
            String line;
            try {
                while ((line = br.readLine()) != null) {
                    if (lineFilter.test(line)) {
                        consumer.accept(line);
                    }
                }
            } catch (IOException e) {
                consumer.accept(ExceptionHandler.getStackTrace(e));
            }
        } catch (IOException e) {
            throw ExceptionHandler.uncheckException(e);
        } finally {
            latch.countDown();
        }
    }
}

Add line predicate to filter output lines


package org.springframework.security.config;

/**
 * Contains globally used default Bean IDs for beans created by the namespace support in Spring Security 2.
 * <p>
 * These are intended for internal use.
 *
 * @author Ben Alex
 * @author Luke Taylor
 */
public abstract class BeanIds {
    private static final String PREFIX = "org.springframework.security.";

    /** The "global" AuthenticationManager instance, registered by the <authentication-manager> element */
    public static final String AUTHENTICATION_MANAGER = PREFIX + "authenticationManager";

    /** External alias for FilterChainProxy bean, for use in web.xml files */
    public static final String SPRING_SECURITY_FILTER_CHAIN = "springSecurityFilterChain";

    public static final String CONTEXT_SOURCE_SETTING_POST_PROCESSOR = PREFIX + "contextSettingPostProcessor";

    public static final String USER_DETAILS_SERVICE = PREFIX + "userDetailsService";
    public static final String USER_DETAILS_SERVICE_FACTORY = PREFIX + "userDetailsServiceFactory";

    public static final String METHOD_ACCESS_MANAGER = PREFIX + "defaultMethodAccessManager";

    public static final String FILTER_CHAIN_PROXY = PREFIX + "filterChainProxy";
    public static final String FILTER_CHAINS = PREFIX + "filterChains";

    public static final String METHOD_SECURITY_METADATA_SOURCE_ADVISOR = PREFIX + "methodSecurityMetadataSourceAdvisor";
    public static final String EMBEDDED_APACHE_DS = PREFIX + "apacheDirectoryServerContainer";
    public static final String CONTEXT_SOURCE = PREFIX + "securityContextSource";

    public static final String DEBUG_FILTER = PREFIX + "debugFilter";
}

Fix javadoc to work with jdk 1.5

SEC-1996: Fix javadoc to work with jdk 1.5

The javadoc did not work with JDK 1.5 due to a JDK bug fixed in JDK 1.6.

This changed the javadoc that had a tag that started with <a and was not
closed to escape the < >. This resolves the issue with the JDK 1.5 javadoc
bug.


package com.formulasearchengine.mathosphere.mlp.contracts;

import com.formulasearchengine.mathosphere.mlp.cli.FlinkMlpCommandConfig;
import com.formulasearchengine.mathosphere.mlp.pojos.ParsedWikiDocument;
import com.formulasearchengine.mathosphere.mlp.pojos.RawWikiDocument;

import org.junit.Test;

import java.util.List;

public class RussianWikiPipelineTest {

  @Test
  public void fullPipeline() throws Exception {
    String wikiRuFile = "com/formulasearchengine/mathosphere/mlp/wikirusample.xml";

    TextAnnotatorMapper textAnnotator = ruTextAnnotator();

    List<RawWikiDocument> docs = readDocs(wikiRuFile);

    for (RawWikiDocument doc : docs) {
      ParsedWikiDocument parsedDoc = textAnnotator.map(doc);
      System.out.println(parsedDoc);
    }
  }

  private List<RawWikiDocument> readDocs(String wikiRuFile) throws Exception {
    return TextAnnotatorMapperTest.readWikiTextDocuments(wikiRuFile);
  }

  private static TextAnnotatorMapper ruTextAnnotator() throws Exception {
    String[] params = {"--language", "ru", "-pos", ""};
    FlinkMlpCommandConfig config = FlinkMlpCommandConfig.from(params);

    TextAnnotatorMapper textAnnotator = new TextAnnotatorMapper(config);
    textAnnotator.open(null);
    return textAnnotator;
  }
}

package com.formulasearchengine.mathosphere.mlp.contracts;

import com.formulasearchengine.mathosphere.mlp.cli.FlinkMlpCommandConfig;
import com.formulasearchengine.mathosphere.mlp.pojos.ParsedWikiDocument;
import com.formulasearchengine.mathosphere.mlp.pojos.RawWikiDocument;
import org.junit.Test;

import java.util.List;

public class RussianWikiPipelineTest {

    private static TextAnnotatorMapper ruTextAnnotator() throws Exception {
        String[] params = {"--language", "ru", "-pos", "", "-in", "fake-input", "-out", "fake-output"};
        FlinkMlpCommandConfig config = FlinkMlpCommandConfig.from(params);

        TextAnnotatorMapper textAnnotator = new TextAnnotatorMapper(config);
        textAnnotator.open(null);
        return textAnnotator;
    }

    @Test
    public void fullPipeline() throws Exception {
        String wikiRuFile = "com/formulasearchengine/mathosphere/mlp/wikirusample.xml";

        TextAnnotatorMapper textAnnotator = ruTextAnnotator();

        List<RawWikiDocument> docs = readDocs(wikiRuFile);

        for (RawWikiDocument doc : docs) {
            ParsedWikiDocument parsedDoc = textAnnotator.map(doc);
            System.out.println(parsedDoc);
        }
    }

    private List<RawWikiDocument> readDocs(String wikiRuFile) throws Exception {
        return TextAnnotatorMapperTest.readWikiTextDocuments(wikiRuFile);
    }
}

Repair more broken cli tests

Fix: Repair more broken cli tests


/*
 * Copyright 2007 Open Source Applications Foundation
 *
 * 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.unitedinternet.cosmo.util;

import java.util.Map;
import java.util.Map.Entry;

public class URLQuery {
    private Map<String, String[]> parameterMap;
    public URLQuery(Map<String, String[]> parameterMap){
        this.parameterMap = parameterMap;
    }

    public String toString(Map<String, String[]> overrideMap){
        StringBuffer s = new StringBuffer();
        s.append("?");
        for (Entry<String, String[]> entry: parameterMap.entrySet()){

            String key = entry.getKey();

            String[] values = overrideMap.containsKey(key)?
                    overrideMap.get(key) : parameterMap.get(key);

            for (String query: values){
                s.append(key);
                s.append("=");
                s.append(query);
                s.append("&");
            }

        }
        return s.substring(0, s.length()-1);
    }
}

/*
 * Copyright 2007 Open Source Applications Foundation
 *
 * 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.unitedinternet.cosmo.util;

import java.util.Map;
import java.util.Map.Entry;

public class URLQuery {
    private Map<String, String[]> parameterMap;
    public URLQuery(Map<String, String[]> parameterMap){
        this.parameterMap = parameterMap;
    }

    public String toString(Map<String, String[]> overrideMap){
        StringBuilder s = new StringBuilder();
        s.append("?");
        for (Entry<String, String[]> entry: parameterMap.entrySet()){

            String key = entry.getKey();

            String[] values = overrideMap.containsKey(key)?
                    overrideMap.get(key) : parameterMap.get(key);

            for (String query: values){
                s.append(key);
                s.append("=");
                s.append(query);
                s.append("&");
            }

        }
        return s.substring(0, s.length()-1);
    }
}

Use StringBuilder instead of StringBuffer.


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.apache.logging.log4j.core.config.plugins.util;

/**
 * Interface for doing automatic String conversion to a specific type.
 *
 * @param <T> the type this converter converts Strings into.
 */
public interface TypeConverter<T> {

    /**
     * Converts a String to a given type.
     *
     * @param s the String to convert.
     * @return the converted object.
     */
    T convert(String s);
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.apache.logging.log4j.core.config.plugins.util;

/**
 * Interface for doing automatic String conversion to a specific type.
 *
 * @param <T> the type this converter converts Strings into.
 */
public interface TypeConverter<T> {

    /**
     * Converts a String to a given type.
     *
     * @param s the String to convert. Cannot be {@code null}.
     * @return the converted object.
     */
    T convert(String s);
}

Add documentation requiring non-null values.

git-svn-id: de5ce936019686f47409c93bcc5e202a9739563b@1597362 13f79535-47bb-0310-9956-ffa450edef68


package nl.idgis.publisher.provider.database.messages;

import java.io.Serializable;

import nl.idgis.publisher.domain.service.Type;

public class DatabaseColumnInfo implements Serializable {

	private static final long serialVersionUID = 8052868017910750424L;

	private final String name;

	private final String typeName;

	public DatabaseColumnInfo(String name, String typeName) {
		this.name = name;
		this.typeName = typeName;
	}

	public String getName() {
		return name;
	}

	public String getTypeName() {
		return typeName;
	}

	public Type getType() {
		switch(typeName.toUpperCase()) {
			case "NUMBER":
				return Type.NUMERIC;
			case "DATE":
				return Type.DATE;
			case "VARCHAR2":
			case "NVARCHAR2":
			case "NCHAR":
			case "CHAR":
			case "CLOB":
				return Type.TEXT;
			case "SDO_GEOMETRY":
			case "ST_GEOMETRY":
				return Type.GEOMETRY;
		}

		return null;
	}

	@Override
	public String toString() {
		return "DatabaseColumnInfo [name=" + name + ", typeName=" + typeName + "]";
	}
}

package nl.idgis.publisher.provider.database.messages;

import java.io.Serializable;

import nl.idgis.publisher.domain.service.Type;

public class DatabaseColumnInfo implements Serializable {

	private static final long serialVersionUID = 8052868017910750424L;

	private final String name;

	private final String typeName;

	public DatabaseColumnInfo(String name, String typeName) {
		this.name = name;
		this.typeName = typeName;
	}

	public String getName() {
		return name;
	}

	public String getTypeName() {
		return typeName;
	}

	public Type getType() {
		switch(typeName.toUpperCase()) {
			case "NUMBER":
				return Type.NUMERIC;
			case "DATE":
				return Type.DATE;
			case "VARCHAR2":
			case "NVARCHAR2":
			case "NCHAR":
			case "CHAR":
			case "CLOB":
			case "NCLOB":
				return Type.TEXT;
			case "SDO_GEOMETRY":
			case "ST_GEOMETRY":
				return Type.GEOMETRY;
		}

		return null;
	}

	@Override
	public String toString() {
		return "DatabaseColumnInfo [name=" + name + ", typeName=" + typeName + "]";
	}
}

Add support for NCLOB sql type

Add support for NCLOB sql type


/**
 * Copyright 2009 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 net.javacrumbs.shedlock.test.support.jdbc;

import org.testcontainers.containers.OracleContainer;

public final class OracleServerConfig extends AbstractContainerBasedDbConfig<OracleContainer> {
    public OracleServerConfig() {
        super(new OracleContainer("oracleinanutshell/oracle-xe-11g"));
    }

    @Override
    public String getCreateTableStatement() {
        return "CREATE TABLE shedlock(name VARCHAR(64) NOT NULL, lock_until TIMESTAMP(3) NOT NULL, locked_at TIMESTAMP(3) NOT NULL, locked_by VARCHAR(255) NOT NULL, PRIMARY KEY (name))";
    }

    @Override
    public String nowExpression() {
        return "SYS_EXTRACT_UTC(SYSTIMESTAMP)";
    }

    @Override
    public String getR2dbcUrl() {
        return "r2dbc:oracle://localhost:" + container.getOraclePort() + "/" + container.getSid();
    }
}

/**
 * Copyright 2009 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 net.javacrumbs.shedlock.test.support.jdbc;

import org.testcontainers.containers.OracleContainer;

public final class OracleServerConfig extends AbstractContainerBasedDbConfig<OracleContainer> {
    public OracleServerConfig() {
        super(createContainer());
    }

    @Override
    public String getCreateTableStatement() {
        return "CREATE TABLE shedlock(name VARCHAR(64) NOT NULL, lock_until TIMESTAMP(3) NOT NULL, locked_at TIMESTAMP(3) NOT NULL, locked_by VARCHAR(255) NOT NULL, PRIMARY KEY (name))";
    }

    @Override
    public String nowExpression() {
        return "SYS_EXTRACT_UTC(SYSTIMESTAMP)";
    }

    @Override
    public String getR2dbcUrl() {
        return "r2dbc:oracle://localhost:" + container.getOraclePort() + "/" + container.getSid();
    }

    private static OracleContainer createContainer() {
        return new OracleContainer("gvenzl/oracle-xe")
            .withEnv("ORACLE_PASSWORD", "oracle");
    }
}

Use newer version of Oracle

Use newer version of Oracle


package ie.lero.evoting.scenario;

import junit.framework.TestCase;
import election.tally.BallotCounting;
import election.tally.Constituency;

public class CountContinuingCandidatesEventK extends TestCase {

 	public void testEvent() {
 	 BallotCounting ballotCounting = new BallotCounting();
   Constituency constituency = new Constituency();
   constituency.setNumberOfSeats(3,3);
   constituency.setNumberOfCandidates(4);
   ballotCounting.setup(constituency);
	 assertTrue (4 == ballotCounting.getContinuingCandidates());
	}
}

package ie.lero.evoting.scenario;

import junit.framework.TestCase;
import election.tally.BallotCounting;
import election.tally.Constituency;

public class CountContinuingCandidatesEventK extends TestCase {

 	public void testEvent() {
 	 final BallotCounting ballotCounting = new BallotCounting();
   final Constituency constituency = new Constituency();
   constituency.setNumberOfSeats(3,3);
   constituency.setNumberOfCandidates(4);
   ballotCounting.setup(constituency);
	 assertTrue (4 == ballotCounting.getContinuingCandidates());
	}
}

Use final variables for Ballot Counting and Constituency objects being tested.


package com.hamishrickerby.http_server;

/**
 * Created by rickerbh on 17/08/2016.
 */
public class ResponseFactory {
    String rootPath;

    public ResponseFactory(String rootPath) {
        this.rootPath = rootPath;
    }

    public Response makeResponse(Request request) {
        Response response = null;
        if (isFileResponse(request)) {
            FileContentsResponse fcr = new FileContentsResponse(request, rootPath);
            response = fcr;
        } else if (isDirectoryResponse(request)) {
            DirectoryListingResponse dlr = new DirectoryListingResponse(request, rootPath);
            response = dlr;
        } else {
            response = new FourOhFourResponse(request);
        }
        return response;
    }

    private boolean isFileResponse(Request request) {
        FileServer server = new FileServer(rootPath);
        return server.fileExists(request.getPath());
    }

    private boolean isDirectoryResponse(Request request) {
        FileDirectoryServer server = new FileDirectoryServer(rootPath);
        return server.directoryExists(request.getPath());
    }

}

package com.hamishrickerby.http_server;

/**
 * Created by rickerbh on 17/08/2016.
 */
public class ResponseFactory {
    String rootPath;

    public ResponseFactory(String rootPath) {
        this.rootPath = rootPath;
    }

    public Response makeResponse(Request request) {
        Response response;
        if (isFileResponse(request)) {
            response = new FileContentsResponse(request, rootPath);
        } else if (isDirectoryResponse(request)) {
            response = new DirectoryListingResponse(request, rootPath);
        } else {
            response = new FourOhFourResponse(request);
        }
        return response;
    }

    private boolean isFileResponse(Request request) {
        FileServer server = new FileServer(rootPath);
        return server.fileExists(request.getPath());
    }

    private boolean isDirectoryResponse(Request request) {
        FileDirectoryServer server = new FileDirectoryServer(rootPath);
        return server.directoryExists(request.getPath());
    }

}

Drop some unnecessary code from Response


package net.openhft.chronicle.bytes;

public interface ByteStringAppender<B extends ByteStringAppender<B>> extends StreamingDataOutput<B> {
    default B append(char ch) {
        BytesUtil.appendUTF(this, ch);
        return (B) this;
    }

    default B append(CharSequence cs) {
        return append(cs, 0, cs.length());
    }

    default B append(long value) {
        BytesUtil.append(this, value);
        return (B) this;
    }

    default B append(float f) {
        BytesUtil.append(this, f);
        return (B) this;
    }

    default B append(double d) {
        BytesUtil.append(this, d);
        return (B) this;
    }

    default B append(CharSequence cs, int start, int end) {
        BytesUtil.appendUTF(this, cs, start, end - start);
        return (B) this;
    }
}

package net.openhft.chronicle.bytes;

public interface ByteStringAppender<B extends ByteStringAppender<B>> extends StreamingDataOutput<B> {
    default B append(char ch) {
        BytesUtil.appendUTF(this, ch);
        return (B) this;
    }

    default B append(CharSequence cs) {
        return append(cs, 0, cs.length());
    }

    default B append(long value) {
        BytesUtil.append(this, value);
        return (B) this;
    }

    default B append(float f) {
        BytesUtil.append(this, f);
        return (B) this;
    }

    default B append(double d) {
        BytesUtil.append(this, d);
        return (B) this;
    }

    default B append(CharSequence cs, int start, int end) {
        BytesUtil.appendUTF(this, cs, start, end - start);
        return (B) this;
    }

    default B append(long value, int digits) {
        BytesUtil.append((RandomDataOutput) this, position(), value, digits);
        this.skip(digits);
        return (B) this;
    }

}

Add support for text based LongArrayTextReference


package com.arondor.common.reflection.parser.java;

import java.util.Arrays;
import java.util.List;

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

import com.arondor.common.reflection.api.catalog.AccessibleClassCatalog;
import com.arondor.common.reflection.catalog.SimpleAccessibleClassCatalog;

public class TestDirectoryAccessibleClassParser
{
    @Test
    public void testParseLibsFolder() throws ClassNotFoundException
    {
        AccessibleClassCatalog catalog = new SimpleAccessibleClassCatalog();
        DirectoryAccessibleClassProvider provider = new DirectoryAccessibleClassProvider();
        JavaAccessibleClassParser parser = new JavaAccessibleClassParser();
        parser.setTryInstantiateClassForDefaultValue(true);
        provider.setAccessibleClassParser(parser);

        List<String> packagePrefixes = Arrays.asList("org.junit");
        provider.setPackagePrefixes(packagePrefixes);
        List<String> directories = Arrays.asList("src/test/resources/libs");
        provider.setDirectories(directories);
        provider.provideClasses(catalog);

        Assert.assertNotNull(catalog.getAccessibleClass("org.junit.Test"));
        try
        {
            catalog.getAccessibleClass("org.apache.log4j.Logger");
            Assert.fail();
        }
        catch (ClassNotFoundException e)
        {

        }

    }
}

package com.arondor.common.reflection.parser.java;

import java.util.Arrays;
import java.util.List;

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

import com.arondor.common.reflection.api.catalog.AccessibleClassCatalog;
import com.arondor.common.reflection.catalog.SimpleAccessibleClassCatalog;

public class TestDirectoryAccessibleClassParser
{
    @Test
    public void testParseLibsFolder() throws ClassNotFoundException
    {
        AccessibleClassCatalog catalog = new SimpleAccessibleClassCatalog();
        DirectoryAccessibleClassProvider provider = new DirectoryAccessibleClassProvider();
        JavaAccessibleClassParser parser = new JavaAccessibleClassParser();
        parser.setTryInstantiateClassForDefaultValue(true);
        provider.setAccessibleClassParser(parser);

        List<String> packagePrefixes = Arrays.asList("org.junit");
        provider.setPackagePrefixes(packagePrefixes);
        List<String> directories = Arrays.asList("src/test/resources/libs");
        provider.setDirectories(directories);
        provider.provideClasses(catalog);

        Assert.assertNotNull(catalog.getAccessibleClass("org.junit.Test"));
        Assert.assertNull(catalog.getAccessibleClass("org.apache.log4j.Logger"));

    }
}

Fix unit test after exception removal

Fix unit test after exception removal


/**
 * Project RSA Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Feb 24, 2014.
 */

import java.io.IOException;
import java.io.OutputStream;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

/**
 * This class is resposnible for testing and representation data for RSA
 * encryption algorithm.
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class Main {

    /**
     * This logger is responsible for the registration of events.
     */
    static final Logger logger = LogManager.getLogger(Main.class.getName());

    /**
     * This method sets up configuration for loggers.
     */
    private static void loggerSetup() {
        // BasicConfigurator.configure();
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        loggerSetup();
        RSA rsa = new RSA(1024);

        try {
            OutputStream encryptedStream = IOOperations.encryptStream(
                    IOOperations.readFile("data.txt"), rsa, RSA.BLOCK_SIZE);
            logger.info(encryptedStream.toString());
            logger.info(IOOperations.decryptStream(encryptedStream, rsa,
                    RSA.BLOCK_SIZE));
        } catch (IOException e) {
            logger.debug(e);
            logger.error(e);
        }
    }

}

/**
 * Project RSA Algorithm.
 * Copyright Michał Szczygieł.
 * Created at Feb 24, 2014.
 */

import java.io.IOException;
import java.io.OutputStream;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

/**
 * This class is resposnible for testing and representation data for RSA
 * encryption algorithm.
 *
 * @author Michał Szczygieł <michal.szczygiel@wp.pl>
 *
 */
public class Main {

    /**
     * This logger is responsible for the registration of events.
     */
    static final Logger logger = LogManager.getLogger(Main.class.getName());

    /**
     * This method sets up configuration for loggers.
     */
    private static void loggerSetup() {
        // BasicConfigurator.configure();
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        if (args.length == 1) {
            loggerSetup();
            RSA rsa = new RSA(1024);

            try {
                OutputStream encryptedStream = IOOperations.encryptStream(
                        IOOperations.readFile(args[0]), rsa, RSA.BLOCK_SIZE);
                logger.info(encryptedStream.toString());
                logger.info(IOOperations.decryptStream(encryptedStream, rsa,
                        RSA.BLOCK_SIZE));
            } catch (IOException e) {
                logger.debug(e);
                logger.error(e);
            }
        } else {
            logger.warn("The application needs 1 argument as file to encrypt");
        }
    }

}

Add parameter to app as executable file

Add parameter to app as executable file


/*
 * Copyright 2014 Space Dynamics Laboratory - Utah State University Research Foundation.
 *
 * 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 edu.usu.sdl.openstorefront.service.message;

import org.codemonkey.simplejavamail.Email;

/**
 *
 * @author dshurtleff
 */
public class TestMessageGenerator
		extends BaseMessageGenerator
{

	public TestMessageGenerator(MessageContext messageContext)
	{
		super(messageContext);
	}

	@Override
	protected String getSubject()
	{
		return "Email Check";
	}

	@Override
	protected String generateMessageInternal(Email email)
	{
		StringBuilder message = new StringBuilder();
		message.append("This is a test message used to confirm that emails can be sent to you as intended.");
		return message.toString();
	}

	@Override
	protected String getUnsubscribe()
	{
		return "If you are not the intended user of this message.  Please delete this message. ";
	}

}

/*
 * Copyright 2014 Space Dynamics Laboratory - Utah State University Research Foundation.
 *
 * 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 edu.usu.sdl.openstorefront.service.message;

import org.codemonkey.simplejavamail.Email;

/**
 *
 * @author dshurtleff
 */
public class TestMessageGenerator
		extends BaseMessageGenerator
{

	public TestMessageGenerator(MessageContext messageContext)
	{
		super(messageContext);
	}

	@Override
	protected String getSubject()
	{
		return "Email Check";
	}

	@Override
	protected String generateMessageInternal(Email email)
	{
		StringBuilder message = new StringBuilder();
		message.append("This is a test message used to confirm that emails can be sent to you as intended.");
		return message.toString();
	}

	@Override
	protected String getUnsubscribe()
	{
		return "If you are not the intended user of this message, please delete this message. ";
	}

}

Correct grammar in e-mail test message

Correct grammar in e-mail test message


/**
 */
package org.example.activemq.orbweaver.cc;

import javax.ws.rs.ext.RuntimeDelegate;

import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;

/**
 * JAX-RS ControlCenter root resource
 */
public class ControlCenterServer {
    private static Server server;

    protected ControlCenterServer() throws Exception {
        ControlCenterApp application = new ControlCenterApp();
        RuntimeDelegate delegate = RuntimeDelegate.getInstance();

        JAXRSServerFactoryBean bean = delegate.createEndpoint(application, JAXRSServerFactoryBean.class);
        bean.setAddress("http://localhost:9000/services" + bean.getAddress());
        server = bean.create();
        server.start();
    }

    public static void main(String args[]) throws Exception {
        new ControlCenterServer();
        System.out.println("Server ready...");

        Thread.sleep(125 * 60 * 1000);
        System.out.println("Server exiting");
        server.stop();
        server.destroy();
        System.exit(0);
    }
}

/**
 */
package org.example.activemq.orbweaver.cc;

import java.util.HashMap;
import java.util.Map;

import javax.ws.rs.ext.RuntimeDelegate;

import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;

/**
 * JAX-RS ControlCenter root resource
 */
public class ControlCenterServer {
    private static Server server;

    protected ControlCenterServer() throws Exception {
        ControlCenterApp application = new ControlCenterApp();
        RuntimeDelegate delegate = RuntimeDelegate.getInstance();

        Map<Object, Object> mappings = new HashMap<Object, Object>();
        mappings.put("json", "application/json");
        mappings.put("xml", "application/xml");

        JAXRSServerFactoryBean bean = delegate.createEndpoint(application, JAXRSServerFactoryBean.class);
        bean.setAddress("http://localhost:9000/services" + bean.getAddress());
        bean.setExtensionMappings(mappings);
        server = bean.create();
        server.start();
    }

    public static void main(String args[]) throws Exception {
        new ControlCenterServer();
        System.out.println("Server ready...");

        Thread.sleep(125 * 60 * 1000);
        System.out.println("Server exiting");
        server.stop();
        server.destroy();
        System.exit(0);
    }
}

Add extension mappings to server.

Add extension mappings to server.


package org.ovirt.engine.core.bll.network.host;

import org.ovirt.engine.core.bll.Backend;
import org.ovirt.engine.core.bll.VdsCommand;
import org.ovirt.engine.core.common.AuditLogType;
import org.ovirt.engine.core.common.action.VdsActionParameters;
import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
import org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase;

@SuppressWarnings("serial")
public class CommitNetworkChangesCommand<T extends VdsActionParameters> extends VdsCommand<T> {
    public CommitNetworkChangesCommand(T param) {
        super(param);
    }

    @Override
    protected void executeCommand() {
        VDSReturnValue retVal = Backend
                .getInstance()
                .getResourceManager()
                .RunVdsCommand(VDSCommandType.SetSafeNetworkConfig,
                        new VdsIdVDSCommandParametersBase(getParameters().getVdsId()));

        getVds().setNetConfigDirty(false);
        getDbFacade().getVdsDynamicDao().update(getVds().getDynamicData());
        setSucceeded(retVal.getSucceeded());
    }

    @Override
    protected boolean canDoAction() {
        return true;
    }

    @Override
    public AuditLogType getAuditLogTypeValue() {
        return getSucceeded() ? AuditLogType.NETWORK_COMMINT_NETWORK_CHANGES
                : AuditLogType.NETWORK_COMMINT_NETWORK_CHANGES_FAILED;
    }
}

package org.ovirt.engine.core.bll.network.host;

import org.ovirt.engine.core.bll.VdsCommand;
import org.ovirt.engine.core.common.AuditLogType;
import org.ovirt.engine.core.common.action.VdsActionParameters;
import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
import org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase;

@SuppressWarnings("serial")
public class CommitNetworkChangesCommand<T extends VdsActionParameters> extends VdsCommand<T> {
    public CommitNetworkChangesCommand(T param) {
        super(param);
    }

    @Override
    protected void executeCommand() {
        VDSReturnValue retVal =
                runVdsCommand(VDSCommandType.SetSafeNetworkConfig,
                        new VdsIdVDSCommandParametersBase(getParameters().getVdsId()));

        getDbFacade().getVdsDynamicDao().updateNetConfigDirty(getParameters().getVdsId(), false);
        setSucceeded(retVal.getSucceeded());
    }

    @Override
    protected boolean canDoAction() {
        return true;
    }

    @Override
    public AuditLogType getAuditLogTypeValue() {
        return getSucceeded() ? AuditLogType.NETWORK_COMMINT_NETWORK_CHANGES
                : AuditLogType.NETWORK_COMMINT_NETWORK_CHANGES_FAILED;
    }
}

engine: Use proper method to mark net changes as saved

The patch reduces the need for updating the entire VdsDynamic
data by using a designated method for saving the dirty-network
indicator of the host.

Change-Id: Ib4c54214a275a1653c46bca7c95ff847975dd7d4
Signed-off-by: Moti Asayag <da1debb83a8e12b6e8822edf2c275f55cc51b720@redhat.com>


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.apache.camel.component.file.watch;

import java.io.IOException;
import java.nio.file.Path;

import io.methvin.watcher.hashing.FileHasher;
import io.methvin.watcher.hashing.HashCode;

/**
 * For unit test only!
 */
public class TestHasher implements FileHasher {
    @Override
    public HashCode hash(Path path) throws IOException {
        // Always return constant
        // This should cause every event is triggered only once (hashcode remains the same), so we can test this.
        // Never use this in production code
        return HashCode.fromLong(1L);
    }
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.apache.camel.component.file.watch;

import java.io.IOException;
import java.nio.file.Path;

import io.methvin.watcher.hashing.FileHash;
import io.methvin.watcher.hashing.FileHasher;

/**
 * For unit test only!
 */
public class TestHasher implements FileHasher {
    @Override
    public FileHash hash(Path path) throws IOException {
        // Always return constant
        // This should cause every event is triggered only once (hashcode remains the same), so we can test this.
        // Never use this in production code
        return FileHash.fromLong(1L);
    }
}

Camel-file-watch: Use FileHash because HashCode has been removed


package com.cldfire.xenforonotifier.util;

import java.awt.Image;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.TrayIcon.MessageType;

public class NotificationUtils {
    private static Image image = Toolkit.getDefaultToolkit().getImage(""); // TODO: Get this working
    private static TrayIcon trayIcon = new TrayIcon(image, "Spigot Notifier");

    public static void createNotification(String mainText, String message) { // TODO: Make sure this is thread-safe, use TrayNotification notifications for OS other than Windows
        if (SystemTray.isSupported()) {
            try {
                SystemTray.getSystemTray().add(trayIcon); // TODO: Prevent this from duplicating
            } catch (Exception e) {
                e.printStackTrace();
            }
            trayIcon.displayMessage(mainText, message, MessageType.NONE);
        }
    }

}

package com.cldfire.xenforonotifier.util;

import java.awt.Image;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.TrayIcon.MessageType;

public class NotificationUtils {
    private static Image image = Toolkit.getDefaultToolkit().getImage(""); // TODO: Get this working
    private static TrayIcon trayIcon = new TrayIcon(image, "XenForo Notifier");

    public static void createNotification(String mainText, String message) { // TODO: Make sure this is thread-safe, use TrayNotification notifications for OS other than Windows
        if (SystemTray.isSupported()) {
            if (!trayIconExists()) {
                try {
                    SystemTray.getSystemTray().add(trayIcon);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            trayIcon.displayMessage(mainText, message, MessageType.NONE);
        }
    }

    private static boolean trayIconExists() {
        for (TrayIcon _trayIcon : SystemTray.getSystemTray().getTrayIcons()) {
            if (trayIcon == _trayIcon) {
                return true;
            }
        }
        return false;
    }

}

Rename Spigot to XenForo and fix duplicating the TrayIcon


package io.github.lukehutch.fastclasspathscanner.classloaderhandler;

import io.github.lukehutch.fastclasspathscanner.classloaderhandler.ClassLoaderHandler;
import io.github.lukehutch.fastclasspathscanner.scanner.ClasspathFinder;
import io.github.lukehutch.fastclasspathscanner.utils.LogNode;
import io.github.lukehutch.fastclasspathscanner.utils.ReflectionUtils;

public class WebsphereTraditionalClassLoaderHandler implements ClassLoaderHandler {

    public boolean handle(ClassLoader classloader, ClasspathFinder classpathFinder, LogNode log) throws Exception {
        for (Class<?> c = classloader.getClass(); c != null; c = c.getSuperclass()) {
            if (!"com.ibm.ws.classloader.CompoundClassLoader".equals(c.getName())) {
                continue;
            }
            String classpath = (String) ReflectionUtils.invokeMethod(classloader, "getClassPath");
            return classpathFinder.addClasspathElements(classpath, classloader, log);
        }
        return false;
    }

}

/*
 * This file is part of FastClasspathScanner.
 *
 * Author: Sergey Bespalov
 *
 * Hosted at: https://github.com/lukehutch/fast-classpath-scanner
 *
 * --
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2017 Sergey Bespalov
 *
 * 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 io.github.lukehutch.fastclasspathscanner.classloaderhandler;

import io.github.lukehutch.fastclasspathscanner.scanner.ClasspathFinder;
import io.github.lukehutch.fastclasspathscanner.utils.LogNode;
import io.github.lukehutch.fastclasspathscanner.utils.ReflectionUtils;

public class WebsphereTraditionalClassLoaderHandler implements ClassLoaderHandler {

    @Override
    public boolean handle(final ClassLoader classloader, final ClasspathFinder classpathFinder, final LogNode log)
            throws Exception {
        for (Class<?> c = classloader.getClass(); c != null; c = c.getSuperclass()) {
            if (!"com.ibm.ws.classloader.CompoundClassLoader".equals(c.getName())) {
                continue;
            }
            final String classpath = (String) ReflectionUtils.invokeMethod(classloader, "getClassPath");
            return classpathFinder.addClasspathElements(classpath, classloader, log);
        }
        return false;
    }

}

Add copyright and license info

Add copyright and license info


package com.alexrnl.jbetaseries.request.episodes;

import com.alexrnl.jbetaseries.request.APIAddresses;
import com.alexrnl.jbetaseries.request.Request;
import com.alexrnl.jbetaseries.request.Verb;
import com.alexrnl.jbetaseries.request.parameters.Bulk;
import com.alexrnl.jbetaseries.request.parameters.Id;

/**
 * Request which allow to mark episodes as seen.

 * @author Alex
 */
public class EpisodeWatched extends Request {

	/**
	 * Constructor #.

	 * @param episodeId
	 *        the id of the episode to mark as seen.
	 * @param bulk
	 *        true if the previous episode (i.e. from previous seasons) should be also
	 *        marked as seen.
	 */
	public EpisodeWatched (final Integer episodeId, final boolean bulk) {
		super(Verb.POST, APIAddresses.EPISODES_WATCHED);
		addParameter(new Id(episodeId));
		if (bulk) {
			addParameter(new Bulk());
		}
	}
}

package com.alexrnl.jbetaseries.request.episodes;

import com.alexrnl.jbetaseries.request.APIAddresses;
import com.alexrnl.jbetaseries.request.Request;
import com.alexrnl.jbetaseries.request.Verb;
import com.alexrnl.jbetaseries.request.parameters.Bulk;
import com.alexrnl.jbetaseries.request.parameters.Id;

/**
 * Request which allow to mark episodes as seen.

 * @author Alex
 */
public class EpisodeWatched extends Request {

	/**
	 * Constructor #1.

	 * @param episodeId
	 *        the id of the episode to mark as seen.
	 * @param bulk
	 *        true if the previous episode (i.e. from previous seasons) should be also
	 *        marked as seen.
	 */
	public EpisodeWatched (final Integer episodeId, final boolean bulk) {
		super(Verb.POST, APIAddresses.EPISODES_WATCHED);
		addParameter(new Id(episodeId));
		if (bulk) {
			addParameter(new Bulk());
		}
	}

	/**
	 * Constructor #2.

	 * This will mark all previous episodes as seen.
	 * @param episodeId the id of the episode to mark as seen.
	 * @see #EpisodeWatched(Integer, boolean)
	 */
	public EpisodeWatched (final Integer episodeId) {
		this(episodeId, true);
	}

}

Add delegate constructor for the episodes/watched request


/*
 * Copyright 2016-2018 shardingsphere.io.
 * <p>
 * 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.
 * </p>
 */

package io.shardingsphere.proxy.transport.mysql.packet.command.statement.execute;

import io.shardingsphere.proxy.transport.mysql.constant.ColumnType;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Prepared statement parameter header.
 *
 * @author zhangyonglun
 */
@AllArgsConstructor
@Getter
public class PreparedStatementParameterHeader {

    private final ColumnType columnType;

    private final int unsignedFlag;

}

/*
 * Copyright 2016-2018 shardingsphere.io.
 * <p>
 * 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.
 * </p>
 */

package io.shardingsphere.proxy.transport.mysql.packet.command.statement.execute;

import io.shardingsphere.proxy.transport.mysql.constant.ColumnType;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.io.Serializable;

/**
 * Prepared statement parameter header.
 *
 * @author zhangyonglun
 */
@AllArgsConstructor
@Getter
public class PreparedStatementParameterHeader implements Serializable {

    private static final long serialVersionUID = -672589695838350689L;

    private final ColumnType columnType;

    private final int unsignedFlag;

}

Add Serializable interface for PrepareStatementParameterHeader.


/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.mail;

import javax.mail.internet.MimeMessage;

/**
 * Allows listening to Mail sending results.
 *
 * @version $Id$
 * @since 6.1M2
 */
public interface MailResultListener
{
    /**
     * Called when the mail is sent successfully.
     *
     * @param message the message sent
     */
    void onSuccess(MimeMessage message);

    /**
     * Called when the mail has failed to be sent.
     *
     * @param message the message that was tried to be sent
     * @param t the exception explaining why the message couldn't be sent
     */
    void onError(MimeMessage message, Throwable t);
}

/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.mail;

import javax.mail.internet.MimeMessage;

import org.xwiki.stability.Unstable;

/**
 * Allows listening to Mail sending results.
 *
 * @version $Id$
 * @since 6.1M2
 */
@Unstable
public interface MailResultListener
{
    /**
     * Called when the mail is sent successfully.
     *
     * @param message the message sent
     */
    void onSuccess(MimeMessage message);

    /**
     * Called when the mail has failed to be sent.
     *
     * @param message the message that was tried to be sent
     * @param t the exception explaining why the message couldn't be sent
     */
    void onError(MimeMessage message, Throwable t);
}

XWIKI-10405: Implement a new Platform Mail Sender API
* Add missing @Unstable annotation


package com.marcshilling.idletimer;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class IdleTimerPackage implements ReactPackage {
    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        return Arrays.<NativeModule>asList(
            new IdleTimerManager(reactContext)
        );
    }

    @Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }
}

package com.marcshilling.idletimer;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class IdleTimerPackage implements ReactPackage {

    @Override
    public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
        return Arrays.<NativeModule>asList(
            new IdleTimerManager(reactContext)
        );
    }

    // Deprecated in React Native 0.47.0
    // @Override
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Collections.emptyList();
    }
}

Remove deprecated override on createJSModules method


/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.component.logging;

import junit.framework.TestCase;

/**
 * Unit tests for {@link AbstractLogEnabled}.
 *
 * @version $Id$
 * @since 1.8RC3
 * @deprecated starting with 3.1M2 use {@link javax.inject.Inject} annotation to get injected a
 *             {@link org.xwiki.logging.Logger} instead.
 */
@Deprecated
public class LoggerTest extends TestCase
{
    public void testDefaultVoidLogger()
    {
        AbstractLogEnabled component = new AbstractLogEnabled() {};
        assertEquals(VoidLogger.class.getName(), component.getLogger().getClass().getName());
    }
}

/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.component.logging;

import junit.framework.TestCase;

/**
 * Unit tests for {@link AbstractLogEnabled}.
 *
 * @version $Id$
 * @since 1.8RC3
 * @deprecated starting with 3.1M2 use {@link javax.inject.Inject} annotation to get injected a SLF4J Logger instead
 */
@Deprecated
public class LoggerTest extends TestCase
{
    public void testDefaultVoidLogger()
    {
        AbstractLogEnabled component = new AbstractLogEnabled() {};
        assertEquals(VoidLogger.class.getName(), component.getLogger().getClass().getName());
    }
}

XCOMMONS-9: Move from Commons Logging/Log4J to SLF4J/Logback

** Fixed javadoc


package com.simpleplugin;

import com.intellij.openapi.fileTypes.*;
import org.jetbrains.annotations.NotNull;

public class SimpleFileTypeFactory extends FileTypeFactory {
  @Override
  public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
    fileTypeConsumer.consume(SimpleFileType.INSTANCE, "simple");
  }
}

package com.simpleplugin;

import com.intellij.openapi.fileTypes.*;
import org.jetbrains.annotations.NotNull;

public class SimpleFileTypeFactory extends FileTypeFactory {
  @Override
  public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
    fileTypeConsumer.consume(SimpleFileType.INSTANCE);
  }
}

Remove passing a file extension explicitly.

Hello!

In this code, the `SimpleFileType` instance passed as the first argument and the `"simple"` file extension as the second parameter.

As far as I can see in FileTypeManagerImpl:263:
```java
@Override
public void consume(@NotNull FileType fileType) {
  register(fileType, parse(fileType.getDefaultExtension()));
}
```
There is no need to declare it explicitly as it is taken by calling `SimpleFileType.#getDefaultExtension()` by default, so this parameter is redundant.

To make tutorial more simple, I suggest this removal: seeing the second parameter is a bit confusing when we're passing the same value, returned from `getDefaultExtension()`.
Since the tutorial shows the basics, not a flexibility of an API, the parameter can be removed.

Thanks!


package com.simperium.test;

import com.simperium.client.AuthException;
import com.simperium.client.AuthResponseListener;
import com.simperium.client.User;

public class MockAuthResponseListener implements AuthResponseListener {

    public boolean success = false, failure = false;

    public User user;
    public AuthException exception;

    @Override
    public void onSuccess(User user){
        success = true;
        this.user = user;
    }

    @Override
    public void onFailure(User user, AuthException exception){
        failure = true;
        this.user = user;
        this.exception = exception;
    }

}

package com.simperium.test;

import com.simperium.client.AuthException;
import com.simperium.client.AuthResponseListener;
import com.simperium.client.User;

public class MockAuthResponseListener implements AuthResponseListener {
    public AuthException exception;
    public User user;
    public boolean success = false, failure = false;

    @Override
    public void onSuccess(User user, String userId, String token){
        success = true;
        this.user = user;
    }

    @Override
    public void onFailure(User user, AuthException exception){
        failure = true;
        this.user = user;
        this.exception = exception;
    }
}

Add user id and token parameters to success method in mock auth response listener test


/*
 * Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.frontend.find.configuration;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public abstract class AbstractPersistentStateCondition implements Condition {

    private static final String DEFAULT_VALUE = "REDIS";

    private final PersistentStateConfig persistentStateConfig;

    protected AbstractPersistentStateCondition(final PersistentStateConfig persistentStateConfig) {
        this.persistentStateConfig = persistentStateConfig;
    }

    @Override
    public boolean matches(final ConditionContext context, final AnnotatedTypeMetadata metadata) {
        return getProperty(context) == persistentStateConfig;
    }

    private PersistentStateConfig getProperty(final ConditionContext context) {
        return PersistentStateConfig.valueOf(context.getEnvironment().getProperty("hp.find.persistentState", DEFAULT_VALUE));
    }

}

/*
 * Copyright 2014-2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.frontend.find.configuration;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public abstract class AbstractPersistentStateCondition implements Condition {

    private static final PersistentStateConfig DEFAULT_VALUE = PersistentStateConfig.REDIS;

    private final PersistentStateConfig persistentStateConfig;

    protected AbstractPersistentStateCondition(final PersistentStateConfig persistentStateConfig) {
        this.persistentStateConfig = persistentStateConfig;
    }

    @Override
    public boolean matches(final ConditionContext context, final AnnotatedTypeMetadata metadata) {
        return getProperty(context) == persistentStateConfig;
    }

    private PersistentStateConfig getProperty(final ConditionContext context) {
        return PersistentStateConfig.valueOf(context.getEnvironment().getProperty("hp.find.persistentState", DEFAULT_VALUE.name()));
    }

}

Use the enum constant as the default value


package org.opennms.netmgt.model;

public class OnmsMonitoringLocationDefinition {

    private String m_area;

    private String m_name;

    private String m_pollingPackageName;

    public String getArea() {
        return m_area;
    }

    public void setArea(String area) {
        m_area = area;
    }

    public String getName() {
        return m_name;
    }

    public void setName(String name) {
        m_name = name;
    }

    public String getPollingPackageName() {
        return m_pollingPackageName;
    }

    public void setPollingPackageName(String pollingPackageName) {
        m_pollingPackageName = pollingPackageName;
    }
}

package org.opennms.netmgt.model;

public class OnmsMonitoringLocationDefinition {

    private String m_area;

    private String m_name;

    private String m_pollingPackageName;

    public OnmsMonitoringLocationDefinition() {

    }

    public OnmsMonitoringLocationDefinition(String name, String pollingPackageName) {
        m_name = name;
        m_pollingPackageName = pollingPackageName;
    }

    public OnmsMonitoringLocationDefinition(String name, String pollingPackageName, String area) {
        m_name = name;
        m_pollingPackageName = pollingPackageName;
        m_area = area;
    }

    public String getArea() {
        return m_area;
    }

    public void setArea(String area) {
        m_area = area;
    }

    public String getName() {
        return m_name;
    }

    public void setName(String name) {
        m_name = name;
    }

    public String getPollingPackageName() {
        return m_pollingPackageName;
    }

    public void setPollingPackageName(String pollingPackageName) {
        m_pollingPackageName = pollingPackageName;
    }

    @Override
    public String toString() {
        return "OnmsMonitoringLocationDefinition@" + Integer.toHexString(hashCode()) + ": Name \"" + m_name + "\", polling package name \"" + m_pollingPackageName + "\", area \"" + m_area + "\"";
    }
}

Add constructors and toString method to make unit testing easier


/*
 * Copyright (c) 2015 Cisco Systems, Inc. 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
 */

package org.opendaylight.protocol.bgp.openconfig.impl.comparator;

import com.google.common.collect.ImmutableMap;
import org.opendaylight.protocol.bgp.openconfig.impl.spi.OpenConfigComparator;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
import org.opendaylight.yangtools.yang.binding.DataObject;

public final class OpenConfigComparatorFactory {

    private static final ImmutableMap<Class<?>, OpenConfigComparator<? extends DataObject>> COMPARATORS = ImmutableMap.<Class<?>, OpenConfigComparator<? extends DataObject>>builder()
            .put(Bgp.class, new GlobalComparator())
            .put(Neighbor.class, new NeighborComparator())
            .build();

    public static <T extends DataObject> OpenConfigComparator<T> getComparator(final Class<T> clazz) {
        return (OpenConfigComparator<T>) COMPARATORS.get(clazz);
    }

}

/*
 * Copyright (c) 2015 Cisco Systems, Inc. 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
 */

package org.opendaylight.protocol.bgp.openconfig.impl.comparator;

import com.google.common.collect.ImmutableMap;
import org.opendaylight.protocol.bgp.openconfig.impl.spi.OpenConfigComparator;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
import org.opendaylight.yangtools.yang.binding.DataObject;

public final class OpenConfigComparatorFactory {
    private OpenConfigComparatorFactory() {
        throw new UnsupportedOperationException();
    }

    private static final ImmutableMap<Class<?>, OpenConfigComparator<? extends DataObject>> COMPARATORS = ImmutableMap.<Class<?>, OpenConfigComparator<? extends DataObject>>builder()
            .put(Bgp.class, new GlobalComparator())
            .put(Neighbor.class, new NeighborComparator())
            .build();

    public static <T extends DataObject> OpenConfigComparator<T> getComparator(final Class<T> clazz) {
        return (OpenConfigComparator<T>) COMPARATORS.get(clazz);
    }

}

Add a private constructor to hide the implicit public one

Add a private constructor to hide the implicit public one on
OpenConfigComparatorFactory.

Change-Id: Id24e1b3bb8c59e0eaed71093acd4443e75ac50db
Signed-off-by: Claudio D. Gasparini <3480fb4575078d890be8aed0007cb1d8785aa579@cisco.com>


package io.github.achtern.AchternEngine.core.rendering.generator;

import io.github.achtern.AchternEngine.core.math.Vector2f;
import io.github.achtern.AchternEngine.core.rendering.Color;

import java.awt.*;
import java.awt.image.BufferedImage;

public class ImageGenerator {

    public static BufferedImage fromColor(Color color) {
        return fromColor(new Vector2f(1, 1), color);
    }

    public static BufferedImage fromColor(Vector2f dimensions, Color color) {
        BufferedImage image = new BufferedImage((int) dimensions.getX(), (int) dimensions.getY(), BufferedImage.TYPE_INT_RGB);

        Graphics2D g = image.createGraphics();

        g.setPaint(color.toAwt());
        g.fillRect(0, 0, (int) dimensions.getX(), (int) dimensions.getY());

        g.dispose();

        return image;
    }

}

package io.github.achtern.AchternEngine.core.rendering.generator;

import io.github.achtern.AchternEngine.core.math.Vector2f;
import io.github.achtern.AchternEngine.core.rendering.Color;
import io.github.achtern.AchternEngine.core.util.UBuffer;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.nio.ByteBuffer;

public class ImageGenerator {

    public static BufferedImage fromColor(Color color) {
        return fromColor(new Vector2f(1, 1), color);
    }

    public static BufferedImage fromColor(Vector2f dimensions, Color color) {
        BufferedImage image = new BufferedImage((int) dimensions.getX(), (int) dimensions.getY(), BufferedImage.TYPE_INT_RGB);

        Graphics2D g = image.createGraphics();

        g.setPaint(color.toAwt());
        g.fillRect(0, 0, (int) dimensions.getX(), (int) dimensions.getY());

        g.dispose();

        return image;
    }

    public static ByteBuffer bytesFromColor(Color color) {
        return bytesFromColor(new Vector2f(1, 1), color);
    }

    public static ByteBuffer bytesFromColor(Vector2f dimensions, Color color) {
        ByteBuffer buffer = UBuffer.createByteBuffer((int) (dimensions.getX() * dimensions.getY() * 4));

        for(int y = 0; y < dimensions.getY(); y++) {
            for(int x = 0; x < dimensions.getX(); x++) {

                int pixel = color.toInt();

                buffer.put((byte)((pixel) & 0xFF)); // R
                buffer.put((byte)((pixel >> 8) & 0xFF)); // G
                buffer.put((byte)((pixel >> 16) & 0xFF)); // B
                buffer.put((byte)((pixel >> 24) & 0xFF)); // Alpha

            }
        }

        buffer.flip();

        return buffer;
    }

}

Create ByteBuffers for Textures from Color


package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_1_9_r1__1_9_r2;

import java.io.IOException;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.legacyremapper.LegacyDataWatcherSerializer;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleSpawnNamed;
import protocolsupport.protocol.packet.middleimpl.PacketData;
import protocolsupport.protocol.typeremapper.watchedentity.WatchedDataRemapper;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class SpawnNamed extends MiddleSpawnNamed<RecyclableCollection<PacketData>> {

	@Override
	public RecyclableCollection<PacketData> toData(ProtocolVersion version) throws IOException {
		PacketData serializer = PacketData.create(ClientBoundPacket.PLAY_SPAWN_NAMED_ID, version);
		serializer.writeVarInt(playerEntityId);
		serializer.writeUUID(uuid);
		serializer.writeDouble(x);
		serializer.writeDouble(y);
		serializer.writeDouble(z);
		serializer.writeByte(yaw);
		serializer.writeByte(pitch);
		serializer.writeBytes(LegacyDataWatcherSerializer.encodeData(version, WatchedDataRemapper.transform(wplayer, metadata, version)));
		return RecyclableSingletonList.create(serializer);
	}

}

package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_1_9_r1__1_9_r2;

import java.io.IOException;

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleSpawnNamed;
import protocolsupport.protocol.packet.middleimpl.PacketData;
import protocolsupport.protocol.typeremapper.watchedentity.WatchedDataRemapper;
import protocolsupport.protocol.utils.datawatcher.DataWatcherDeserializer;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class SpawnNamed extends MiddleSpawnNamed<RecyclableCollection<PacketData>> {

	@Override
	public RecyclableCollection<PacketData> toData(ProtocolVersion version) throws IOException {
		PacketData serializer = PacketData.create(ClientBoundPacket.PLAY_SPAWN_NAMED_ID, version);
		serializer.writeVarInt(playerEntityId);
		serializer.writeUUID(uuid);
		serializer.writeDouble(x);
		serializer.writeDouble(y);
		serializer.writeDouble(z);
		serializer.writeByte(yaw);
		serializer.writeByte(pitch);
		serializer.writeBytes(DataWatcherDeserializer.encodeData(version, WatchedDataRemapper.transform(wplayer, metadata, version)));
		return RecyclableSingletonList.create(serializer);
	}

}

Use proper metadata serializer for spawn player


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */
/**
 * Log4j 2.0 adapter for Commons Logging.
 */
package org.apache.logging.log4j.jcl;

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */
/**
 * Log4j 2 adapter for Commons Logging.
 */
package org.apache.logging.log4j.jcl;

Rename Log4j 2.0 -> Log4j 2 in javadoc.

Rename Log4j 2.0 -> Log4j 2 in javadoc.


package com.alexstyl.specialdates.analytics;

import android.content.Context;
import android.os.Bundle;

import com.google.firebase.analytics.FirebaseAnalytics;
import com.novoda.notils.logger.simple.Log;

import java.util.Locale;

public class Firebase implements Analytics {

    private static final Bundle NO_DATA = null;

    private final FirebaseAnalytics firebaseAnalytics;

    private static Firebase INSTANCE;

    public static Firebase get(Context context) {
        if (INSTANCE == null) {
            INSTANCE = new Firebase(FirebaseAnalytics.getInstance(context));
        }
        return INSTANCE;
    }

    public Firebase(FirebaseAnalytics firebaseAnalytics) {
        this.firebaseAnalytics = firebaseAnalytics;
    }

    @Override
    public void trackAction(Action goToToday) {
        String actionName = goToToday.getName();
        firebaseAnalytics.logEvent(actionName, NO_DATA);
        Log.d("Tracking event:" + actionName);
    }

    @Override
    public void trackAction(ActionWithParameters action) {
        String formattedAction = format(action);
        firebaseAnalytics.logEvent(formattedAction, NO_DATA);
        Log.d("Tracking event:" + formattedAction);
    }

    @Override
    public void trackScreen(Screen screen) {
        firebaseAnalytics.logEvent("screen_view:" + screen.screenName(), NO_DATA);
        Log.d("Tracking screen_view:" + screen);
    }

    private String format(ActionWithParameters action) {
        return String.format(Locale.US, "%s:%s:%s", action.getName(), action.getLabel(), action.getValue());
    }
}

package com.alexstyl.specialdates.analytics;

import android.content.Context;
import android.os.Bundle;

import com.google.firebase.analytics.FirebaseAnalytics;
import com.novoda.notils.logger.simple.Log;

import java.util.Locale;

public class Firebase implements Analytics {

    private static final Bundle NO_DATA = null;

    private final FirebaseAnalytics firebaseAnalytics;

    private static Firebase INSTANCE;

    public static Firebase get(Context context) {
        if (INSTANCE == null) {
            INSTANCE = new Firebase(FirebaseAnalytics.getInstance(context));
        }
        return INSTANCE;
    }

    private Firebase(FirebaseAnalytics firebaseAnalytics) {
        this.firebaseAnalytics = firebaseAnalytics;
    }

    @Override
    public void trackAction(Action goToToday) {
        String actionName = goToToday.getName();
        firebaseAnalytics.logEvent(actionName, NO_DATA);
        Log.d("Tracking event:" + actionName);
    }

    @Override
    public void trackAction(ActionWithParameters action) {
        String formattedAction = format(action);
        firebaseAnalytics.logEvent(formattedAction, NO_DATA);
        Log.d("Tracking event:" + formattedAction);
    }

    @Override
    public void trackScreen(Screen screen) {
        firebaseAnalytics.logEvent("screen_view:" + screen.screenName(), NO_DATA);
        Log.d("Tracking screen_view:" + screen);
    }

    private String format(ActionWithParameters action) {
        return String.format(Locale.US, "%s:%s:%s", action.getName(), action.getLabel(), action.getValue());
    }
}

Reduce visibility of firebase analytics constructor


package org.gluu.jsf2.service;

import java.io.Serializable;

import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;

@Named
@ConversationScoped
public class ConversationService implements Serializable {

	private static final long serialVersionUID = -7432197667275722872L;

	@Inject
	private Conversation conversation;

	public void initConversation() {
		if (!FacesContext.getCurrentInstance().isPostback() && conversation.isTransient()) {
			conversation.begin();
		}
	}

	public void endConversation() {
		if (!conversation.isTransient()) {
			conversation.end();
		}
	}

}

package org.gluu.jsf2.service;

import java.io.Serializable;

import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;

@Named
@ConversationScoped
public class ConversationService implements Serializable {

	private static final long serialVersionUID = -7432197667275722872L;

	private static final long CONVERSATION_TIMEOUT = 30 * 60 * 60 * 1000L;

	@Inject
	private Conversation conversation;

	public void initConversation() {
		if (!FacesContext.getCurrentInstance().isPostback() && conversation.isTransient()) {
			conversation.begin();
			conversation.setTimeout(CONVERSATION_TIMEOUT);
		}
	}

	public void endConversation() {
		if (!conversation.isTransient()) {
			conversation.end();
		}
	}

}

Set default conversation time to 30 minutes