package org.realityforge.ssf;

import javax.annotation.Nonnull;

/**
 * A basic interface defining a session.
 */
public interface SessionInfo
{
  /**
   * @return an opaque ID representing session.
   */
  @Nonnull
  String getSessionID();

  /**
   * @return the username for session if available.
   */
  @Nonnull
  String getUsername();

  /**
   * @return the time at which session was created.
   */
  long getCreatedAt();

  /**
   * @return the time at which session was last accessed.
   */
  long getLastAccessedAt();
}

package org.realityforge.ssf;

import javax.annotation.Nonnull;

/**
 * A basic interface defining a session.
 */
public interface SessionInfo
{
  /**
   * @return an opaque ID representing session.
   */
  @Nonnull
  String getSessionID();

  /**
   * @return the username for session if available.
   */
  @Nonnull
  String getUsername();

  /**
   * @return the time at which session was created.
   */
  long getCreatedAt();

  /**
   * @return the time at which session was last accessed.
   */
  long getLastAccessedAt();

  /**
   * Update the access time to now.
   */
  void updateAccessTime();
}

Make updateAccessTime() part of the public interface for sessions


package rb;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

/**
 * Created by IntelliJ IDEA.
 * User: Gong Zeng
 * Date: 5/16/11
 * Time: 12:12 PM
 */
public class MemoryFile {
    String name;
    String content;

    public MemoryFile(String name, String diff) {
        this.name = name;
        this.content = diff;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public InputStream getInputStream() {
        return new ByteArrayInputStream(content.getBytes());
    }
}

package rb;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;

/**
 * Created by IntelliJ IDEA.
 * User: Gong Zeng
 * Date: 5/16/11
 * Time: 12:12 PM
 */
public class MemoryFile {
    String name;
    String content;

    public MemoryFile(String name, String diff) {
        this.name = name;
        this.content = diff;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public InputStream getInputStream() throws UnsupportedEncodingException {
        return new ByteArrayInputStream(content.getBytes("utf-8"));
    }
}

Set default encoding of diff file to utf-8 according of issue reported by @yqt: diff file gets wrong encoding


package gsg.server;

import gsg.infrastructure.Utils;
import gsg.server.logic.GameLoop;
import gsg.server.network.ConnectionLoop;

/**
 * @author zkejid@gmail.com
 *         Created: 13.07.15 22:55
 */
public class Server {
	public static void main(String[] args) {
		final ConnectionLoop connectionLoop = new ConnectionLoop(9189);
		final GameLoop gameLoop = new GameLoop();

		connectionLoop.setConnectionRegistrator(gameLoop);

		Utils.runLoop(connectionLoop);
		Utils.runLoopAndJoin(gameLoop);
	}

}

package gsg.server;

import gsg.client.Bot;
import gsg.infrastructure.Utils;
import gsg.server.logic.GameLoop;
import gsg.server.network.ConnectionLoop;

/**
 * @author zkejid@gmail.com
 *         Created: 13.07.15 22:55
 */
public class Server {
	public static void main(String[] args) {
		final ConnectionLoop connectionLoop = new ConnectionLoop(9189);
		final GameLoop gameLoop = new GameLoop();

		connectionLoop.setConnectionRegistrator(gameLoop);

		Utils.runLoop(connectionLoop);
		Utils.runLoop(gameLoop);

		Bot.main(args);
	}

}

Put a runner of bot into runner of server


/*
 * 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.commons.imaging.formats.psd.dataparsers;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

public class DataParserIndexedTest{

  @Test
  public void testFailsToCreateDataParserIndexedThrowsArrayIndexOutOfBoundsException() {
      final byte[] byteArray = new byte[24];
      try {
        new DataParserIndexed(byteArray);
        fail("Expecting exception: ArrayIndexOutOfBoundsException");
      } catch(final ArrayIndexOutOfBoundsException e) {
         assertEquals("256",e.getMessage());
         assertEquals(DataParserIndexed.class.getName(), e.getStackTrace()[0].getClassName());
      }
  }

}

/*
 * 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.commons.imaging.formats.psd.dataparsers;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class DataParserIndexedTest{

  @Test
  public void testFailsToCreateDataParserIndexedThrowsArrayIndexOutOfBoundsException() {
      final byte[] byteArray = new byte[24];
      try {
        new DataParserIndexed(byteArray);
        fail("Expecting exception: ArrayIndexOutOfBoundsException");
      } catch(final ArrayIndexOutOfBoundsException e) {
         assertTrue(e.getMessage().contains("256"));
         assertEquals(DataParserIndexed.class.getName(), e.getStackTrace()[0].getClassName());
      }
  }

}

javadoc: Update test to use contains (exception message changed post JVM 11)


package uk.ac.ebi.quickgo.index.annotation.coterms;

import uk.ac.ebi.quickgo.index.annotation.Annotation;

import com.google.common.base.Preconditions;
import java.util.function.Predicate;
import org.springframework.batch.item.ItemProcessor;

/**
 * @author Tony Wardell
 * Date: 06/09/2016
 * Time: 16:30
 * Created with IntelliJ IDEA.
 *
 * A version of ItemProcessor for adding details from an {@link uk.ac.ebi.quickgo.index.annotation.Annotation}
 * to a matrix of permutations where GOTerm A and GOTerm B both annotate the same Gene Product.
 *
 * Version of GPAFileToSummary from Beta
 */
public class Co_occurringGoTermsFromAnnotations implements ItemProcessor<Annotation, Annotation> {

    private final AnnotationCo_occurringTermsAggregator annotationCoOccurringTermsAggregator;
    private final Predicate<Annotation> toBeProcessed;

    public Co_occurringGoTermsFromAnnotations(AnnotationCo_occurringTermsAggregator annotationCoOccurringTermsAggregator,
            Predicate<Annotation> toBeProcessed) {
        Preconditions.checkArgument(annotationCoOccurringTermsAggregator != null);
        Preconditions.checkArgument(toBeProcessed != null);
        this.annotationCoOccurringTermsAggregator = annotationCoOccurringTermsAggregator;
        this.toBeProcessed = toBeProcessed;
    }

    @Override
    public Annotation process(Annotation annotation) throws Exception {

        if (toBeProcessed.test(annotation)) {
            annotationCoOccurringTermsAggregator.addRowToMatrix(annotation);
        }

        return annotation;
    }
}

package uk.ac.ebi.quickgo.index.annotation.coterms;

import uk.ac.ebi.quickgo.index.annotation.Annotation;

import com.google.common.base.Preconditions;
import java.util.function.Predicate;
import org.springframework.batch.item.ItemProcessor;

/**
 * @author Tony Wardell
 * Date: 06/09/2016
 * Time: 16:30
 * Created with IntelliJ IDEA.
 *
 * A version of ItemProcessor for adding details from an {@link uk.ac.ebi.quickgo.index.annotation.Annotation}
 * to a matrix of permutations where GOTerm A and GOTerm B both annotate the same Gene Product.
 *
 * Version of GPAFileToSummary from Beta
 */
public class Co_occurringGoTermsFromAnnotations implements ItemProcessor<Annotation, Annotation> {

    private final AnnotationCo_occurringTermsAggregator aggregator;
    private final Predicate<Annotation> toBeProcessed;

    public Co_occurringGoTermsFromAnnotations(AnnotationCo_occurringTermsAggregator aggregator,
            Predicate<Annotation> toBeProcessed) {
        Preconditions.checkArgument(aggregator != null);
        Preconditions.checkArgument(toBeProcessed != null);
        this.aggregator = aggregator;
        this.toBeProcessed = toBeProcessed;
    }

    @Override
    public Annotation process(Annotation annotation) throws Exception {
        if (toBeProcessed.test(annotation)) {
            aggregator.addRowToMatrix(annotation);
        }
        return annotation;
    }
}

Rename AnnotationCo_occurringTermsAggregator member variable to something more usable.


package com.github.kohanyirobert.mongoroid;

import org.junit.After;
import org.junit.Before;

public abstract class AbstractMongoConnectionSimpleSingleTest {

  protected MongoConnection connection;

  protected AbstractMongoConnectionSimpleSingleTest() {}

  // @do-not-check DesignForExtension
  @Before
  public void setUp() throws MongoException {
    connection = MongoConnections.builder()
        .config(MongoConfigs.builder()
            .poolSize(1)
            .build())
        .seed(MongoSeeds.builder()
            // @do-not-check MagicNumber
            .address(27018)
            .address(27019)
            .address(27020)
            .build())
        .build();
    connection.database("admin").login("admin", "admin");
    // there's a very vague issue with logins and sockets because as I've
    // noticed that if a communication goes through a socket which is
    // resolved as "127.0.0.1" mongodb grants read-write permission for every
    // database with an admin login, but not otherwise (not confirmed tho')
    connection.database("test").login("test", "test");
  }

  // @do-not-check DesignForExtension
  @After
  public void tearDown() throws MongoException {
    connection.database("test").collection("test").remove(MongoRemoves.get());
    connection.close();
  }
}

package com.github.kohanyirobert.mongoroid;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;

public abstract class AbstractMongoConnectionSimpleSingleTest {

  protected MongoConnection connection;

  protected AbstractMongoConnectionSimpleSingleTest() {}

  // @do-not-check DesignForExtension
  @Before
  public void setUp() throws MongoException {
    connection = MongoConnections.builder()
        .config(MongoConfigs.builder()
            .poolSize(1)
            .build())
        .seed(MongoSeeds.builder()
            // @do-not-check MagicNumber
            .address(27018)
            .address(27019)
            .address(27020)
            .build())
        .build();
    connection.database("admin").login("admin", "admin");
    // there's a very vague issue with logins and sockets because as I've
    // noticed that if a communication goes through a socket which is
    // resolved as "127.0.0.1" mongodb grants read-write permission for every
    // database with an admin login, but not otherwise (not confirmed tho')
    connection.database("test").login("test", "test");
  }

  // @do-not-check DesignForExtension
  @After
  public void tearDown() throws MongoException {
    connection.database("test").collection("test").remove(MongoRemoves.get());
    // this makes sure that after running tests the
    // collection is cleared before closing the connection
    Assert.assertEquals(0, connection.database("test").collection("test").count(MongoCounts.get()));
    connection.close();
  }
}

Update the abstract test class's tear down method.

Now it makes sure that after closing the connection the related collections
(used by other tests) are cleared out.


package net.silentchaos512.gems.lib;

import java.util.List;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.silentchaos512.gems.SilentGems;
import net.silentchaos512.lib.util.PlayerHelper;

public class Greetings {

  public static final String PREFIX = "misc.silentgems:alpha";

  public static void greetPlayer(EntityPlayer player) {

    // Reset the random object, because it seems to yield the same value each time. Huh?
    SilentGems.instance.random.setSeed(System.currentTimeMillis());

    List<String> list = SilentGems.instance.localizationHelper.getDescriptionLines(PREFIX);
    String msg = SilentGems.instance.localizationHelper.getLocalizedString(PREFIX + "Prefix") + " ";
    int index = SilentGems.instance.random.nextInt(list.size());
    // SilentGems.instance.logHelper.debug(list.size(), index);
    msg += list.get(index);
    PlayerHelper.addChatMessage(player, TextFormatting.RED + msg);

    // TODO: Remove this later.
    PlayerHelper.addChatMessage(player,
        "Yes, the numbers in the upper-left are my fault. I'm working on it.");
  }
}

package net.silentchaos512.gems.lib;

import java.util.List;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.silentchaos512.gems.SilentGems;
import net.silentchaos512.lib.util.PlayerHelper;

public class Greetings {

  public static final String PREFIX = "misc.silentgems:alpha";

  public static void greetPlayer(EntityPlayer player) {

    // Reset the random object, because it seems to yield the same value each time. Huh?
    SilentGems.instance.random.setSeed(System.currentTimeMillis());

    List<String> list = SilentGems.instance.localizationHelper.getDescriptionLines(PREFIX);
    if (list.size() > 0) {
      String msg = SilentGems.instance.localizationHelper.getLocalizedString(PREFIX + "Prefix")
          + " ";
      int index = SilentGems.instance.random.nextInt(list.size());
      // SilentGems.instance.logHelper.debug(list.size(), index);
      msg += list.get(index);
      PlayerHelper.addChatMessage(player, TextFormatting.RED + msg);
    }

    // TODO: Remove this later.
    PlayerHelper.addChatMessage(player,
        "[Silent's Gems] Yes, the numbers in the upper-left are my fault. I'm working on it.");
  }
}

Fix greetings kicking players from servers


/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.financial.aggregation;

import com.opengamma.core.position.Position;
import com.opengamma.core.security.Security;
import com.opengamma.financial.security.FinancialSecurity;
import com.opengamma.financial.security.FinancialSecurityVisitor;
import com.opengamma.financial.security.bond.BondSecurity;
import com.opengamma.financial.security.cash.CashSecurity;
import com.opengamma.financial.security.equity.EquitySecurity;
import com.opengamma.financial.security.fra.FRASecurity;
import com.opengamma.financial.security.future.FutureSecurity;
import com.opengamma.financial.security.option.OptionSecurity;
import com.opengamma.financial.security.swap.SwapSecurity;
import com.opengamma.util.money.Currency;

/**
 * Function to classify positions by Currency.
 *
 */
public class CurrencyAggregationFunction implements AggregationFunction<Currency> {
  private static final String NAME = "Currency";

  @Override
  public Currency classifyPosition(Position position) {
    Security security = position.getSecurity();
    if (security instanceof FinancialSecurity) {
      FinancialSecurity finSec = (FinancialSecurity) security;
      return finSec.accept(new FinancialSecurityVisitor<Currency>() {

        @Override
        public Currency visitBondSecurity(BondSecurity security) {
          return security.getCurrency();
        }

        @Override
        public Currency visitCashSecurity(CashSecurity security) {
          return null;
        }

        @Override
        public Currency visitEquitySecurity(EquitySecurity security) {
          return security.getCurrency();
        }

        @Override
        public Currency visitFRASecurity(FRASecurity security) {
          return null;
        }

        @Override
        public Currency visitFutureSecurity(FutureSecurity security) {
          return security.getCurrency();
        }

        @Override
        public Currency visitOptionSecurity(OptionSecurity security) {
          return security.getCurrency();
        }

        @Override
        public Currency visitSwapSecurity(SwapSecurity security) {
          return null;
        }

      });
    } else {
      return null;
    }
  }

  public String getName() {
    return NAME;
  }
}

/**
 * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
 *
 * Please see distribution for license.
 */
package com.opengamma.financial.aggregation;

import com.opengamma.core.position.Position;
import com.opengamma.financial.security.FinancialSecurityUtils;
import com.opengamma.util.money.Currency;

/**
 * Function to classify positions by Currency.
 *
 */
public class CurrencyAggregationFunction implements AggregationFunction<Currency> {
  private static final String NAME = "Currency";

  @Override
  public Currency classifyPosition(Position position) {
    return FinancialSecurityUtils.getCurrencyUnit(position.getSecurity());
  }

  public String getName() {
    return NAME;
  }
}

Use FinancialSecurityUtils instead of code duplication to to the currency lookup.


package org.verapdf.metadata.fixer.impl.fixer;

import org.verapdf.metadata.fixer.impl.MetadataFixerImpl;

/**
 * @author Evgeniy Muravitskiy
 */
public enum MetadataFixerEnum {

	BOX_INSTANCE(new PBoxMetadataFixerImpl());

	private final MetadataFixerImpl instance;

	MetadataFixerEnum(MetadataFixerImpl instance) {
		this.instance = instance;
	}

	public MetadataFixerImpl getInstance() {
		return this.instance;
	}
}

package org.verapdf.metadata.fixer.impl.fixer;

import org.verapdf.metadata.fixer.impl.MetadataFixerImpl;

/**
 * @author Evgeniy Muravitskiy
 */
public enum MetadataFixerEnum {

	BOX_INSTANCE(new PBoxMetadataFixerImpl());

	private final transient MetadataFixerImpl instance;

	MetadataFixerEnum(MetadataFixerImpl instance) {
		this.instance = instance;
	}

	public MetadataFixerImpl getInstance() {
		return this.instance;
	}
}

Add transient qualifier for enum

Add transient qualifier for enum


package com.palantir.atlasdb.keyvalue.rdbms;

import javax.sql.DataSource;

import org.postgresql.jdbc2.optional.PoolingDataSource;

import com.palantir.atlasdb.keyvalue.api.KeyValueService;
import com.palantir.atlasdb.keyvalue.impl.AbstractAtlasDbKeyValueServiceTest;

public class PostgresKeyValueServiceTest extends AbstractAtlasDbKeyValueServiceTest {

    private KeyValueService kvs;

    public static DataSource getTestPostgresDataSource() {
        PoolingDataSource pgDataSource = new PoolingDataSource();
        pgDataSource.setDatabaseName("test");
        pgDataSource.setUser("test");
        pgDataSource.setPassword("password");
        return pgDataSource;
    }

    @Override
    protected KeyValueService getKeyValueService() {
        if (kvs == null) {
            KeyValueService ret = new PostgresKeyValueService(getTestPostgresDataSource());
            ret.initializeFromFreshInstance();
            kvs = ret;
        }
        return kvs;
    }

}

package com.palantir.atlasdb.keyvalue.rdbms;

import javax.sql.DataSource;

import org.postgresql.jdbc2.optional.PoolingDataSource;

import com.palantir.atlasdb.keyvalue.api.KeyValueService;
import com.palantir.atlasdb.keyvalue.impl.AbstractAtlasDbKeyValueServiceTest;

public class PostgresKeyValueServiceTest extends AbstractAtlasDbKeyValueServiceTest {

    private KeyValueService kvs;

    public static DataSource getTestPostgresDataSource() {
        PoolingDataSource pgDataSource = new PoolingDataSource();
        pgDataSource.setDatabaseName("test");
        pgDataSource.setUser("test");
        pgDataSource.setPassword("password");
        return pgDataSource;
    }

    public static PostgresKeyValueService newTestInstance() {
        PostgresKeyValueService ret = new PostgresKeyValueService(getTestPostgresDataSource());
        ret.initializeFromFreshInstance();
        return ret;
    }

    @Override
    protected KeyValueService getKeyValueService() {
        if (kvs == null) {
            KeyValueService ret = new PostgresKeyValueService(getTestPostgresDataSource());
            ret.initializeFromFreshInstance();
            kvs = ret;
        }
        return kvs;
    }

}

Add convinience method for Postgres test instance.


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

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

import org.springframework.boot.ApplicationArguments;

/**
 * Various utility functions for a skipper shell.
 *
 * @author Janne Valkealahti
 *
 */
public abstract class ShellUtils {

	private final static List<String> helpArgs = Arrays.asList("-h", "-help", "--help", "help");

	/**
	 * Checks if given application arguments contains any usual help option.
	 *
	 * @param args the application arguments
	 * @return true if arguments contain common help option
	 */
	public static boolean hasHelpOption(ApplicationArguments args) {
		return !Collections.disjoint(helpArgs, args.getNonOptionArgs()) || !Collections.disjoint(helpArgs, args.getOptionNames());
	}
}

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

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

import org.springframework.boot.ApplicationArguments;

/**
 * Various utility functions for a skipper shell.
 *
 * @author Janne Valkealahti
 *
 */
public abstract class ShellUtils {

	private final static List<String> helpArgs = Arrays.asList("-h", "--h", "-help", "--help", "help", "h");

	/**
	 * Checks if given application arguments contains any usual help option.
	 *
	 * @param args the application arguments
	 * @return true if arguments contain common help option
	 */
	public static boolean hasHelpOption(ApplicationArguments args) {
		return !Collections.disjoint(helpArgs, args.getNonOptionArgs()) || !Collections.disjoint(helpArgs, args.getOptionNames());
	}
}

Add few more help options

Add few more help options


package ee.ut.cs.rum.workspaces.internal.ui.task.newtask.dialog;

import org.eclipse.swt.widgets.Shell;

import ee.ut.cs.rum.plugins.interfaces.factory.RumPluginConfiguration;

public class NewTaskDialogShell extends Shell {
	private static final long serialVersionUID = -4970825745896119968L;

	NewTaskDialog newTaskDialog;
	private RumPluginConfiguration rumPluginConfiguration;

	public NewTaskDialogShell(Shell parent, int style, NewTaskDialog newTaskDialog) {
		super(parent, style);

		this.newTaskDialog=newTaskDialog;
	}

	public RumPluginConfiguration getRumPluginConfiguration() {
		return rumPluginConfiguration;
	}

	public void setRumPluginConfiguration(RumPluginConfiguration rumPluginConfiguration) {
		this.rumPluginConfiguration = rumPluginConfiguration;
	}

	public NewTaskDialog getNewTaskDialog() {
		return newTaskDialog;
	}
}

package ee.ut.cs.rum.workspaces.internal.ui.task.newtask.dialog;

import org.eclipse.swt.widgets.Shell;

import ee.ut.cs.rum.plugins.interfaces.factory.RumPluginConfiguration;

public class NewTaskDialogShell extends Shell {
	private static final long serialVersionUID = -4970825745896119968L;

	NewTaskDialog newTaskDialog;
	private RumPluginConfiguration rumPluginConfiguration;

	public NewTaskDialogShell(Shell parent, int style, NewTaskDialog newTaskDialog) {
		super(parent, style);

		this.newTaskDialog=newTaskDialog;
	}

	public RumPluginConfiguration getRumPluginConfiguration() {
		return rumPluginConfiguration;
	}

	public void setRumPluginConfiguration(RumPluginConfiguration rumPluginConfiguration) {
		this.pack();
		this.rumPluginConfiguration = rumPluginConfiguration;
	}

	public NewTaskDialog getNewTaskDialog() {
		return newTaskDialog;
	}
}

Update new task dialog size after selecting a plugin


package am.app.mappingEngine.qualityEvaluation.metrics.ufl;

import java.util.List;

import am.app.mappingEngine.AbstractMatcher.alignType;
import am.app.mappingEngine.qualityEvaluation.AbstractQualityMetric;
import am.app.mappingEngine.similarityMatrix.SimilarityMatrix;
import static am.evaluation.disagreement.variance.VarianceComputation.computeVariance;

/**
 * Compute the disagreement between matching algorithms given their individual
 * similarity matrices. The constructor takes only one kind of matrix, either
 * the classes matrices or the properties matrices. You must instantiate a
 * separate object for each type of matrices.
 *
 * @author Cosmin Stroe
 *
 */
public class VarianceMatcherDisagreement extends AbstractQualityMetric {

	private SimilarityMatrix[] matrices;

	public VarianceMatcherDisagreement(List<SimilarityMatrix> matrices) {
		super();
		this.matrices = matrices.toArray(new SimilarityMatrix[0]);
	}

	/**
	 * @param type
	 *            This parameter is ignored.
	 */
	@Override
	public double getQuality(alignType type, int i, int j) {
		// create signature vector
		double[] signatureVector = new double[matrices.length];
		for(int k = 0; k < matrices.length; k++) {
			signatureVector[k] = matrices[k].getSimilarity(i, j);
		}

		// return the computed variance
		return computeVariance(signatureVector);
	}
}

package am.app.mappingEngine.qualityEvaluation.metrics.ufl;

import java.util.List;

import am.app.mappingEngine.AbstractMatcher.alignType;
import am.app.mappingEngine.qualityEvaluation.AbstractQualityMetric;
import am.app.mappingEngine.similarityMatrix.SimilarityMatrix;
import static am.evaluation.disagreement.variance.VarianceComputation.computeVariance;

/**
 * Compute the disagreement between matching algorithms given their individual
 * similarity matrices. The constructor takes only one kind of matrix, either
 * the classes matrices or the properties matrices. You must instantiate a
 * separate object for each type of matrices.
 *
 * @author Cosmin Stroe
 *
 */
public class VarianceMatcherDisagreement extends AbstractQualityMetric {

	private SimilarityMatrix[] matrices;

	public VarianceMatcherDisagreement(List<SimilarityMatrix> matrices) {
		super();
		this.matrices = matrices.toArray(new SimilarityMatrix[0]);
	}

	/**
	 * @param type
	 *            This parameter is ignored.
	 */
	@Override
	public double getQuality(alignType type, int i, int j) {
		// create signature vector
		double[] signatureVector = new double[matrices.length];
		for(int k = 0; k < matrices.length; k++) {
			signatureVector[k] = matrices[k].getSimilarity(i, j);
		}

		// return the computed variance
		// because variance of similarity values can be a maximum of 0.5, we
		// multiply by 2 to get a metric from 0 to 1.0
		return 2 * computeVariance(signatureVector);
	}
}

Normalize the variance to 1.0 (from 0.5)


package org.jvirtanen.parity.net.pmr;

import static org.jvirtanen.parity.net.pmr.PMR.*;

import java.io.IOException;
import java.nio.ByteBuffer;
import org.jvirtanen.nassau.MessageListener;

/**
 * A parser for inbound messages.
 */
public class PMRParser implements MessageListener {

    private Order order;
    private Trade trade;

    private PMRListener listener;

    public PMRParser(PMRListener listener) {
        this.order = new Order();
        this.trade = new Trade();

        this.listener = listener;
    }

    @Override
    public void message(ByteBuffer buffer) throws IOException {
        byte messageType = buffer.get();

        switch (messageType) {
        case MESSAGE_TYPE_ORDER:
            order(buffer);
            break;
        case MESSAGE_TYPE_TRADE:
            trade(buffer);
            break;
        default:
            throw new PMRException("Unknown message type: " + (char)messageType);
        }
    }

    private void order(ByteBuffer buffer) throws IOException {
        order.get(buffer);

        listener.order(order);
    }

    private void trade(ByteBuffer buffer) throws IOException {
        trade.get(buffer);

        listener.trade(trade);
    }

}

package org.jvirtanen.parity.net.pmr;

import static org.jvirtanen.parity.net.pmr.PMR.*;

import java.io.IOException;
import java.nio.ByteBuffer;
import org.jvirtanen.nassau.MessageListener;

/**
 * A parser for inbound messages.
 */
public class PMRParser implements MessageListener {

    private Order order;
    private Trade trade;

    private PMRListener listener;

    /**
     * Create a parser for inbound messages.
     *
     * @param listener the message listener
     */
    public PMRParser(PMRListener listener) {
        this.order = new Order();
        this.trade = new Trade();

        this.listener = listener;
    }

    @Override
    public void message(ByteBuffer buffer) throws IOException {
        byte messageType = buffer.get();

        switch (messageType) {
        case MESSAGE_TYPE_ORDER:
            order(buffer);
            break;
        case MESSAGE_TYPE_TRADE:
            trade(buffer);
            break;
        default:
            throw new PMRException("Unknown message type: " + (char)messageType);
        }
    }

    private void order(ByteBuffer buffer) throws IOException {
        order.get(buffer);

        listener.order(order);
    }

    private void trade(ByteBuffer buffer) throws IOException {
        trade.get(buffer);

        listener.trade(trade);
    }

}

Fix documentation for PMR parser in network protocols


/**
 *
 */
package de.uni_jena.iaa.linktype.atomic.editors.grapheditor.commands;

import org.eclipse.gef.commands.Command;

import de.hu_berlin.german.korpling.saltnpepper.salt.graph.LabelableElement;
import de.hu_berlin.german.korpling.saltnpepper.salt.saltCore.SAnnotation;

/**
 * @author Stephan Druskat
 *
 */
public class GraphEditorDeleteCommand extends Command {

	private LabelableElement model;

	@Override
	public void execute(){
		if (model instanceof SAnnotation) {
			SAnnotation annotation = (SAnnotation) model;
			annotation.getSAnnotatableElement().removeLabel(annotation.getSName());
		}
	}

	public void setModel(LabelableElement model) {
		this.model = model;
	}

}

/**
 *
 */
package de.uni_jena.iaa.linktype.atomic.editors.grapheditor.commands;

import org.eclipse.gef.commands.Command;

import de.hu_berlin.german.korpling.saltnpepper.salt.graph.LabelableElement;
import de.hu_berlin.german.korpling.saltnpepper.salt.saltCore.SAnnotation;

/**
 * @author Stephan Druskat
 *
 */
public class GraphEditorDeleteCommand extends Command {

	private LabelableElement model;

	@Override
	public void execute(){
		if (model instanceof SAnnotation) {
			SAnnotation annotation = (SAnnotation) model;
			if (annotation.getNamespace() != null) {
				annotation.getSAnnotatableElement().removeLabel(annotation.getNamespace(), annotation.getName());
			}
			else {
				annotation.getSAnnotatableElement().removeLabel(annotation.getSName());
			}
		}
	}

	public void setModel(LabelableElement model) {
		this.model = model;
	}

}

Fix delete command to delete regardless of whether an SAnnotation has a namespace or not


/*
 * DownloadClient Geodateninfrastruktur Bayern
 *
 * (c) 2016 GSt. GDI-BY (gdi.bayern.de)
 *
 * 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 de.bayern.gdi.gui;

import de.bayern.gdi.services.WFSMeta;

/**
 * Model class to display WFS features.
 */
public class FeatureModel implements ItemModel {

    private WFSMeta.Feature feature;

    /**
     * Contructor to wrap.
     */
    public FeatureModel(WFSMeta.Feature f) {
        this.feature = f;
    }

    public Object getItem() {
        return this.feature;
    }

    public String getDataset() {
        return feature.name;
    }

    @Override
    public String toString() {
        return this.feature.title;
    }
}

/*
 * DownloadClient Geodateninfrastruktur Bayern
 *
 * (c) 2016 GSt. GDI-BY (gdi.bayern.de)
 *
 * 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 de.bayern.gdi.gui;

import de.bayern.gdi.services.WFSMeta;

/**
 * Model class to display WFS features.
 */
public class FeatureModel implements ItemModel {

    private WFSMeta.Feature feature;

    /**
     * Contructor to wrap.
     */
    public FeatureModel(WFSMeta.Feature f) {
        this.feature = f;
    }

    public Object getItem() {
        return this.feature;
    }

    public String getDataset() {
        return feature.name;
    }

    @Override
    public String toString() {
        return this.feature.title != null && !this.feature.title.isEmpty()
            ? this.feature.title
            : this.feature.name;
    }
}

Use WFS feature name in UI if the title is empty.


package net.mcft.copy.betterstorage.item.tile;

import java.util.List;

import net.mcft.copy.betterstorage.tile.entity.TileEntityPresent;
import net.mcft.copy.betterstorage.utils.StackUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ItemPresent extends ItemCardboardBox {

	public ItemPresent(Block block) {
		super(block);
	}

	@Override
	public EnumRarity getRarity(ItemStack stack) { return EnumRarity.uncommon; }

	@Override
	public boolean showDurabilityBar(ItemStack stack) { return false; }

	@Override
	@SideOnly(Side.CLIENT)
	public int getColorFromItemStack(ItemStack stack, int renderPass) { return 0xFFFFFF; }

	@Override
	@SideOnly(Side.CLIENT)
	public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advancedTooltips) {
		String nameTag = StackUtils.get(stack, null, TileEntityPresent.TAG_NAMETAG);
		if (nameTag != null) list.add("for " + nameTag);
	}

}

package net.mcft.copy.betterstorage.item.tile;

import java.util.List;

import net.mcft.copy.betterstorage.tile.entity.TileEntityPresent;
import net.mcft.copy.betterstorage.utils.StackUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ItemPresent extends ItemCardboardBox {

	public ItemPresent(Block block) {
		super(block);
	}

	@Override
	public EnumRarity getRarity(ItemStack stack) { return EnumRarity.uncommon; }

	@Override
	public boolean showDurabilityBar(ItemStack stack) { return false; }

	@Override
	@SideOnly(Side.CLIENT)
	public int getColorFromItemStack(ItemStack stack, int renderPass) { return 0xFFFFFF; }

	@Override
	@SideOnly(Side.CLIENT)
	public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advancedTooltips) {
		String nameTag = StackUtils.get(stack, null, TileEntityPresent.TAG_NAMETAG);
		if (nameTag != null) list.add("for " + nameTag);
	}

	@Override
	public boolean canBeStoredInContainerItem(ItemStack item) { return true; }

}

Allow presents to be placed inside container items


package com.slugterra.packets;

import com.slugterra.entity.EntityMecha;

import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;

public class MechaAnimPacket implements IMessage {

	private String text;

	public MechaAnimPacket() { }

	public MechaAnimPacket(String text) {
		this.text = text;
	}

	@Override
	public void fromBytes(ByteBuf buf) {
		text = ByteBufUtils.readUTF8String(buf); // this class is very useful in general for writing more complex objects
	}

	@Override
	public void toBytes(ByteBuf buf) {
		ByteBufUtils.writeUTF8String(buf, text);
	}

	public static class Handler implements IMessageHandler<MechaAnimPacket, IMessage> {

		@Override
		public IMessage onMessage(MechaAnimPacket message, MessageContext ctx) {
			EntityPlayerMP player = ctx.getServerHandler().playerEntity;
			((EntityMecha)player.getRidingEntity()).senseJump();
			System.out.println(String.format("Received %s from %s", message.text, ctx.getServerHandler().playerEntity.getDisplayName()));
			return null; // no response in this case
		}
	}
}

package com.slugterra.packets;

import com.slugterra.entity.EntityMecha;

import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;

public class MechaAnimPacket implements IMessage {

	private String text;

	public MechaAnimPacket() { }

	public MechaAnimPacket(String text) {
		this.text = text;
	}

	@Override
	public void fromBytes(ByteBuf buf) {
		text = ByteBufUtils.readUTF8String(buf); // this class is very useful in general for writing more complex objects
	}

	@Override
	public void toBytes(ByteBuf buf) {
		ByteBufUtils.writeUTF8String(buf, text);
	}

	public static class Handler implements IMessageHandler<MechaAnimPacket, IMessage> {

		@Override
		public IMessage onMessage(MechaAnimPacket message, MessageContext ctx) {
			EntityPlayerMP player = ctx.getServerHandler().playerEntity;
			if (player.getRidingEntity() instanceof EntityMecha)
				((EntityMecha)player.getRidingEntity()).senseJump();
			return null; // no response in this case
		}
	}
}

Add safety check and remove debug message


package com.alexstyl.specialdates.date;

import android.content.res.Resources;

import com.alexstyl.specialdates.R;
import com.alexstyl.specialdates.contact.Contact;
import com.alexstyl.specialdates.events.peopleevents.EventType;

/**
 * A representation of an event, affiliated to a contact
 */
public final class ContactEvent {

    private final EventType eventType;
    private final Contact contact;
    private final Date date;

    public ContactEvent(EventType eventType, Date date, Contact contact) {
        this.eventType = eventType;
        this.date = date;
        this.contact = contact;
    }

    public String getLabel(Resources resources) {
        if (eventType == EventType.BIRTHDAY) {
            Date birthday = contact.getDateOfBirth();
            if (birthday.hasYear()) {
                int age = date.getYear() - birthday.getYear();
                if (age > 0) {
                    return resources.getString(R.string.turns_age, age);
                }
            }
        }
        return resources.getString(eventType.nameRes());
    }

    public Date getDate() {
        return date;
    }

    public EventType getType() {
        return eventType;
    }

    public int getYear() {
        return date.getYear();
    }

    public Contact getContact() {
        return contact;
    }
}

package com.alexstyl.specialdates.date;

import android.content.res.Resources;

import com.alexstyl.specialdates.R;
import com.alexstyl.specialdates.contact.Contact;
import com.alexstyl.specialdates.events.peopleevents.EventType;

/**
 * A representation of an event, affiliated to a contact
 */
public final class ContactEvent {

    private final EventType eventType;
    private final Contact contact;
    private final Date date;

    public ContactEvent(EventType eventType, Date date, Contact contact) {
        this.eventType = eventType;
        this.date = date;
        this.contact = contact;
    }

    public String getLabel(Resources resources) {
        if (eventType == EventType.BIRTHDAY) {
            if (date.hasYear()) {
                int age = Date.CURRENT_YEAR - date.getYear();
                if (age > 0) {
                    return resources.getString(R.string.turns_age, age);
                }
            }
        }
        return resources.getString(eventType.nameRes());
    }

    public Date getDate() {
        return date;
    }

    public EventType getType() {
        return eventType;
    }

    public int getYear() {
        return date.getYear();
    }

    public Contact getContact() {
        return contact;
    }
}

Use existing date to calculate

Use existing date to calculate


package org.jvirtanen.philadelphia;

/**
 * The protocol version.
 */
public enum FIXVersion {

    FIX_4_2("FIX.4.2"),
    FIX_4_3("FIX.4.3"),
    FIX_4_4("FIX.4.4");

    private String beginString;

    private FIXVersion(String beginString) {
        this.beginString = beginString;
    }

    /**
     * Get the BeginString(8).
     *
     * @return the BeginString(8)
     */
    public String getBeginString() {
        return beginString;
    }

}

package org.jvirtanen.philadelphia;

/**
 * The protocol version.
 */
public enum FIXVersion {

    FIX_4_2("FIX.4.2"),
    FIX_4_3("FIX.4.3"),
    FIX_4_4("FIX.4.4"),
    FIXT_1_1("FIXT.1.1");

    private String beginString;

    private FIXVersion(String beginString) {
        this.beginString = beginString;
    }

    /**
     * Get the BeginString(8).
     *
     * @return the BeginString(8)
     */
    public String getBeginString() {
        return beginString;
    }

}

Add constant for FIXT 1.1 to version enumeration


package controllers;

import models.CommentThread;
import models.enumeration.Operation;
import models.resource.Resource;
import play.db.ebean.Transactional;
import play.mvc.Controller;
import play.mvc.Result;
import utils.AccessControl;

import static models.enumeration.ResourceType.getValue;

public class CommentThreadApp extends Controller {

    @Transactional
    public static Result updateState(Long id, CommentThread.ThreadState state) {
        CommentThread thread = CommentThread.find.byId(id);

        if (thread == null) {
            return notFound();
        }

        if (!AccessControl.isAllowed(UserApp.currentUser(), thread.asResource(), Operation.REOPEN)) {
            return forbidden();
        }

        thread.state = state;
        thread.update();

        return ok();
    }

    public static Result open(Long id) {
        return updateState(id, CommentThread.ThreadState.OPEN);
    }

    public static Result close(Long id) {
        return updateState(id, CommentThread.ThreadState.CLOSED);
    }
}

package controllers;

import models.CommentThread;
import models.enumeration.Operation;
import play.db.ebean.Transactional;
import play.mvc.Controller;
import play.mvc.Result;
import utils.AccessControl;

import static models.CommentThread.ThreadState.CLOSED;
import static models.CommentThread.ThreadState.OPEN;

public class CommentThreadApp extends Controller {

    @Transactional
    public static Result updateState(Long id, CommentThread.ThreadState state) {
        CommentThread thread = CommentThread.find.byId(id);

        if (thread == null) {
            return notFound();
        }

        Operation operation;

        switch(state) {
            case OPEN:
                operation = Operation.REOPEN;
                break;
            case CLOSED:
                operation = Operation.CLOSE;
                break;
            default:
                throw new UnsupportedOperationException();
        }

        if (!AccessControl.isAllowed(UserApp.currentUser(), thread.asResource(), operation)) {
            return forbidden();
        }

        thread.state = state;
        thread.update();

        return ok();
    }

    public static Result open(Long id) {
        return updateState(id, OPEN);
    }

    public static Result close(Long id) {
        return updateState(id, CLOSED);
    }
}

Fix a possible access control bug

Review: Fix a possible access control bug

Currently it did not cause a bug but it will do if openning and closing
a thread requires different authority.


//
// $Id: MiCasaClient.java,v 1.1 2001/10/09 18:20:08 mdb Exp $

package com.threerings.micasa.server;

import com.threerings.cocktail.cher.net.BootstrapData;
import com.threerings.cocktail.cher.server.CherClient;

/**
 * Extends the cher client and provides bootstrap data specific to the
 * MiCasa services.
 */
public class MiCasaClient extends CherClient
{
    // documentation inherited
    protected BootstrapData createBootstrapData ()
    {
        return new BootstrapData();
    }

    // documentation inherited
    protected void populateBootstrapData (BootstrapData data)
    {
        super.populateBootstrapData(data);
    }
}

//
// $Id: MiCasaClient.java,v 1.2 2001/10/09 19:23:50 mdb Exp $

package com.threerings.micasa.server;

import com.threerings.cocktail.cher.net.BootstrapData;
import com.threerings.cocktail.party.server.PartyClient;

import com.threerings.micasa.data.MiCasaBootstrapData;

/**
 * Extends the cher client and provides bootstrap data specific to the
 * MiCasa services.
 */
public class MiCasaClient extends PartyClient
{
    // documentation inherited
    protected BootstrapData createBootstrapData ()
    {
        return new MiCasaBootstrapData();
    }

    // documentation inherited
    protected void populateBootstrapData (BootstrapData data)
    {
        super.populateBootstrapData(data);

        // let the client know their default lobby oid
        ((MiCasaBootstrapData)data).defLobbyOid =
            MiCasaServer.lobreg.getDefaultLobbyOid();
    }
}

Extend PartyClient, do the right thing with our BootstrapData.

git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@419 542714f4-19e9-0310-aa3c-eee0fc999fb1


package com.geeksville.apiproxy;

public class APIConstants {
    /**
     * The default world wide drone broker
     */
    public static final String DEFAULT_SERVER = "api.3dr.com";

    public static final String URL_BASE = "http://" + DEFAULT_SERVER;

    /**
     * If using a raw TCP link to the server, use this port number
     */
    public static final int DEFAULT_TCP_PORT = 5555;

    public static final String ZMQ_URL = "tcp://" + DEFAULT_SERVER + ":5556";

    public static final String TLOG_MIME_TYPE = "application/vnd.mavlink.tlog";
}

package com.geeksville.apiproxy;

public class APIConstants {
    /**
     * The default world wide drone broker
     */
    public static final String DEFAULT_SERVER = "api.3dr.com";

    public static final String URL_BASE = "https://" + DEFAULT_SERVER;

    /**
     * If using a raw TCP link to the server, use this port number
     */
    public static final int DEFAULT_TCP_PORT = 5555;

    public static final String ZMQ_URL = "tcp://" + DEFAULT_SERVER + ":5556";

    public static final String TLOG_MIME_TYPE = "application/vnd.mavlink.tlog";
}

Use TLS for api calls

Use TLS for api calls


package com.pengyifan.pubtator.io;

import com.google.common.base.Joiner;
import com.pengyifan.pubtator.PubTatorDocument;

import javax.xml.stream.XMLStreamException;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.util.List;

public class PubTatorIO {

  public static List<PubTatorDocument> readBioCFormat(Reader reader)
      throws XMLStreamException, IOException {
    return new BioCLoader().load(reader);
  }

  public static List<PubTatorDocument> readPubTatorFormat(Reader reader)
      throws IOException {
    return new PubTatorLoader().load(reader);
  }

  public static String toPubTatorString(List<PubTatorDocument> documentList) {
    return Joiner.on("\n\n").join(documentList);
  }

  public static void write(Writer writer, List<PubTatorDocument> documentList)
      throws IOException {
    writer.write(Joiner.on("\n\n").join(documentList));
    writer.flush();
    writer.close();
  }
}

package com.pengyifan.pubtator.io;

import com.google.common.base.Joiner;
import com.pengyifan.pubtator.PubTatorDocument;

import javax.xml.stream.XMLStreamException;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.util.List;

public class PubTatorIO {

  public static List<PubTatorDocument> readBioCFormat(Reader reader)
      throws XMLStreamException, IOException {
    return new BioCLoader().load(reader);
  }

  public static List<PubTatorDocument> readPubTatorFormat(Reader reader)
      throws IOException {
    return new PubTatorLoader().load(reader);
  }

  public static String toPubTatorString(List<PubTatorDocument> documentList) {
    return Joiner.on("\n\n").join(documentList);
  }

  public static void write(Writer writer, List<PubTatorDocument> documentList)
      throws IOException {
    writer.write(Joiner.on("\n\n").join(documentList));
    writer.flush();
  }
}

Revert "flush and close writer"

Revert "flush and close writer"

This reverts commit f3db49d08480fa1b5d3a493469c8990b04b0a524.


package com.bmc.truesight.plugins.activemq;

import java.util.Date;

public class PluginSimulator {

    public PluginSimulator() {

    }

    public void writeOutput() {
        Date d = new Date();
        String s = "_bevent:TITLE|m:MESSAGE|h:SOURCE|s:SENDER|t:info|tags:red,blue,green";
        System.out.println(s);
        System.out.println("FOO 1.0 BAR " + d.getTime());
        System.out.flush();
    }

    public void run() {
        while(true) {
            try {
                this.writeOutput();
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String args[]) {
        PluginSimulator sim = new PluginSimulator();
        sim.run();
    }
}

package com.bmc.truesight.plugins.activemq;

import java.util.Date;

public class PluginSimulator {

    public PluginSimulator() {

    }

    public void writeOutput() {
        Date d = new Date();
        String s = "_bevent:TITLE|m:MESSAGE|h:SOURCE|s:SENDER|t:info|tags:red,blue,green";
        System.out.println(s);
        System.out.println("FOO 1.0 BAR " + d.getTime());
        System.out.flush();
        System.err.print("An Error Occurred");
        System.err.flush();
    }

    public void run() {
        while(true) {
            try {
                this.writeOutput();
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String args[]) {
        PluginSimulator sim = new PluginSimulator();
        sim.run();
    }
}

Write an error to standard error

Write an error to standard error


package de.terrestris.shogun2.service;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import de.terrestris.shogun2.model.PersistentObject;

/**
 * This abstract service class provides basic CRUD functionality.
 *
 * @author Nils Bühner
 * @see AbstractDaoService
 *
 */
public abstract class AbstractCrudService<E extends PersistentObject> extends
		AbstractDaoService<E> {

	/**
	 *
	 * @param e
	 * @return
	 */
	@Transactional(readOnly = false)
	public E saveOrUpdate(E e) {
		dao.saveOrUpdate(e);
		return e;
	}

	/**
	 *
	 * @param id
	 * @return
	 */
	public E findById(Integer id) {
		return dao.findById(id);
	}

	/**
	 *
	 * @return
	 */
	public List<E> findAll() {
		return dao.findAll();
	}

	/**
	 *
	 * @param e
	 */
	@Transactional(readOnly = false)
	public void delete(E e) {
		dao.delete(e);
	}

}

package de.terrestris.shogun2.service;

import java.util.List;

import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;

import de.terrestris.shogun2.model.PersistentObject;

/**
 * This abstract service class provides basic CRUD functionality.
 *
 * @author Nils Bühner
 * @see AbstractDaoService
 *
 */
public abstract class AbstractCrudService<E extends PersistentObject> extends
		AbstractDaoService<E> {

	/**
	 *
	 * @param e
	 * @return
	 */
	@Transactional(readOnly = false)
	@PreAuthorize("isAuthenticated()")
	public E saveOrUpdate(E e) {
		dao.saveOrUpdate(e);
		return e;
	}

	/**
	 *
	 * @param id
	 * @return
	 */
	@PostAuthorize("hasPermission(returnObject, 'READ')")
	public E findById(Integer id) {
		return dao.findById(id);
	}

	/**
	 *
	 * @return
	 */
	@PostFilter("hasPermission(filterObject, 'READ')")
	public List<E> findAll() {
		return dao.findAll();
	}

	/**
	 *
	 * @param e
	 */
	@PreAuthorize("hasPermission(#e, 'DELETE')")
	@Transactional(readOnly = false)
	public void delete(E e) {
		dao.delete(e);
	}

}

Add basic security annotations to the CRUD service


package com.telerik.metadata.parsing;

import com.telerik.metadata.ClassRepo;
import com.telerik.metadata.desc.ClassDescriptor;
import com.telerik.metadata.desc.MethodDescriptor;

import java.util.HashSet;
import java.util.Set;

public final class ClassParser {

    private final ClassDescriptor clazz;

    private ClassParser(ClassDescriptor clazz) {
        this.clazz = clazz;
    }

    public static ClassParser forClassDescriptor(ClassDescriptor clazz) {
        return new ClassParser(clazz);
    }

    public Set<MethodDescriptor> getAllDefaultMethodsFromImplementedInterfaces() {
        return getAllDefaultMethodsFromImplementedInterfacesRecursively(clazz, new HashSet<MethodDescriptor>());
    }

    private HashSet<MethodDescriptor> getAllDefaultMethodsFromImplementedInterfacesRecursively(ClassDescriptor clazz, HashSet<MethodDescriptor> collectedDefaultMethods) {
        String[] implementedInterfacesNames = clazz.getInterfaceNames();

        for (String implementedInterfaceName : implementedInterfacesNames) {
            ClassDescriptor interfaceClass = ClassRepo.findClass(implementedInterfaceName);

            for (MethodDescriptor md : interfaceClass.getMethods()) {
                if (!md.isStatic() && !md.isAbstract()) {
                    collectedDefaultMethods.add(md);
                }
            }

            collectedDefaultMethods.addAll(getAllDefaultMethodsFromImplementedInterfacesRecursively(interfaceClass, new HashSet<MethodDescriptor>()));
        }

        return collectedDefaultMethods;
    }
}

package com.telerik.metadata.parsing;

import com.telerik.metadata.ClassRepo;
import com.telerik.metadata.desc.ClassDescriptor;
import com.telerik.metadata.desc.MethodDescriptor;

import java.util.HashSet;
import java.util.Set;

public final class ClassParser {

    private final ClassDescriptor clazz;

    private ClassParser(ClassDescriptor clazz) {
        this.clazz = clazz;
    }

    public static ClassParser forClassDescriptor(ClassDescriptor clazz) {
        return new ClassParser(clazz);
    }

    public Set<MethodDescriptor> getAllDefaultMethodsFromImplementedInterfaces() {
        return getAllDefaultMethodsFromImplementedInterfacesRecursively(clazz, new HashSet<MethodDescriptor>());
    }

    private HashSet<MethodDescriptor> getAllDefaultMethodsFromImplementedInterfacesRecursively(ClassDescriptor clazz, HashSet<MethodDescriptor> collectedDefaultMethods) {
        String[] implementedInterfacesNames = clazz.getInterfaceNames();

        for (String implementedInterfaceName : implementedInterfacesNames) {
            ClassDescriptor interfaceClass = ClassRepo.findClass(implementedInterfaceName);

            if (interfaceClass == null) {
                System.out.println(String.format("WARNING: Skipping interface %s implemented in %s as it cannot be resolved", implementedInterfaceName, clazz.getClassName()));
                continue;
            }

            for (MethodDescriptor md : interfaceClass.getMethods()) {
                if (!md.isStatic() && !md.isAbstract()) {
                    collectedDefaultMethods.add(md);
                }
            }

            collectedDefaultMethods.addAll(getAllDefaultMethodsFromImplementedInterfacesRecursively(interfaceClass, new HashSet<MethodDescriptor>()));
        }

        return collectedDefaultMethods;
    }
}

Improve handling of not found interfaces


package benchmarking;

import converters.JsonConverter;
import datamodel.PerformanceSelfMonitoring;
import mongo.MongoManager;

public class Monitoring {
    CpuMonitoring cpuMonitor = new CpuMonitoring();
    long startTime = -1, endTime = -1, totalTime = -1;
    private PerformanceSelfMonitoring perfSelf = new PerformanceSelfMonitoring();

    public void startMonitoring() {
        cpuMonitor.startMonitoring();
        startTime = System.currentTimeMillis();
    }

    public void stopMonitoring() {
        cpuMonitor.stopMonitoring();
        endTime = System.currentTimeMillis();
        totalTime = endTime - startTime;
    }

    public PerformanceSelfMonitoring getResults(long pid) {
        perfSelf.setCpuUsageResults(cpuMonitor.parseForPid(pid));
        perfSelf.setExecutionTime(totalTime);

        return perfSelf;
    }

    public void saveResultsInDb (long pid, MongoManager mm) {
        Thread writeRestuls = new Thread(new Runnable() {
            @Override
            public void run() {
                perfSelf.setCpuUsageResults(cpuMonitor.parseForPid(pid));
                perfSelf.setExecutionTime(totalTime);
                mm.pushJson(JsonConverter.objectToJsonString(perfSelf), "selfPerformance");            }
        });
        writeRestuls.start();
    }

}

package benchmarking;

import converters.JsonConverter;
import datamodel.PerformanceSelfMonitoring;
import mongo.MongoManager;

public class Monitoring {
    CpuMonitoring cpuMonitor = new CpuMonitoring();
    long startTime = -1, endTime = -1, totalTime = -1;

    public void startMonitoring() {
        cpuMonitor.startMonitoring();
        startTime = System.currentTimeMillis();
    }

    public void stopMonitoring() {
        cpuMonitor.stopMonitoring();
        endTime = System.currentTimeMillis();
        totalTime = endTime - startTime;
    }

    public PerformanceSelfMonitoring getResults(long pid) {
        PerformanceSelfMonitoring perfSelf = new PerformanceSelfMonitoring();
        perfSelf.setCpuUsageResults(cpuMonitor.parseForPid(pid));
        perfSelf.setExecutionTime(totalTime);

        return perfSelf;
    }

    public void saveResultsInDb (long pid, MongoManager mm) {
        Thread writeRestuls = new Thread(new Runnable() {
            @Override
            public void run() {
                PerformanceSelfMonitoring perfSelf = new PerformanceSelfMonitoring();
                perfSelf.setCpuUsageResults(cpuMonitor.parseForPid(pid));
                perfSelf.setExecutionTime(totalTime);
                mm.pushJson(JsonConverter.objectToJsonString(perfSelf), "selfPerformance");            }
        });
        writeRestuls.start();
    }

}

Resolve concurency on the same object.

Resolve concurency on the same object.


package ethanjones.modularworld.block;

import ethanjones.modularworld.core.data.DataGroup;
import ethanjones.modularworld.graphics.world.BlockTextureHandler;

public abstract class Block {
  protected BlockTextureHandler textureHandler;
  String mainMaterial;

  public Block(String mainMaterial) {
    this.mainMaterial = mainMaterial;
  }

  public void loadGraphics() {
    textureHandler = new BlockTextureHandler(mainMaterial);
  }

  public BlockTextureHandler getTextureHandler(DataGroup data) {
    return textureHandler;
  }

}

package ethanjones.modularworld.block;

import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.collision.BoundingBox;
import ethanjones.modularworld.core.data.DataGroup;
import ethanjones.modularworld.graphics.world.BlockTextureHandler;

public abstract class Block {
  private static BoundingBox fullBlockBoundingBox = new BoundingBox(new Vector3(0, 0, 0), new Vector3(1, 1, 1));

  protected BlockTextureHandler textureHandler;
  String mainMaterial;

  public Block(String mainMaterial) {
    this.mainMaterial = mainMaterial;
  }

  public void loadGraphics() {
    textureHandler = new BlockTextureHandler(mainMaterial);
  }

  public BlockTextureHandler getTextureHandler(DataGroup data) {
    return textureHandler;
  }

  public BoundingBox getBoundingBox() {
    return fullBlockBoundingBox;
  }

}

Add method to get bounding box

Add method to get bounding box


package de.czyrux.store.util;

import io.reactivex.ObservableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.internal.functions.Functions;
import io.reactivex.observers.DisposableObserver;
import io.reactivex.schedulers.Schedulers;

/**
 * Utility methods for RxJava 2
 */
public class RxUtil {

    private static final DisposableObserver EMPTY_OBSERVER = new DisposableObserver() {

        @Override
        public void onError(Throwable e) {
        }

        @Override
        public void onComplete() {

        }

        @Override
        public void onNext(Object o) {
        }
    };

    private RxUtil() {
    }

    @SuppressWarnings("unchecked")
    public static <T> DisposableObserver<T> emptyObserver() {
        return EMPTY_OBSERVER;
    }

    public static Consumer<? super Throwable> emptyConsumer() {
        return Functions.emptyConsumer();
    }

    public static <T> ObservableTransformer<T, T> applyStandardSchedulers() {
        return observable -> observable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}

package de.czyrux.store.util;

import io.reactivex.ObservableTransformer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import io.reactivex.internal.functions.Functions;
import io.reactivex.observers.DisposableObserver;
import io.reactivex.schedulers.Schedulers;

/**
 * Utility methods for RxJava 2
 */
public class RxUtil {

    private RxUtil() {
    }

    @SuppressWarnings("unchecked")
    public static <T> DisposableObserver<T> emptyObserver() {
        return new DisposableObserver() {

            @Override
            public void onError(Throwable e) {
            }

            @Override
            public void onComplete() {

            }

            @Override
            public void onNext(Object o) {
            }
        };
    }

    public static Consumer<? super Throwable> emptyConsumer() {
        return Functions.emptyConsumer();
    }

    public static <T> ObservableTransformer<T, T> applyStandardSchedulers() {
        return observable -> observable.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }
}

Create empty observer to avoid “disposable already set” exception


package jetbrains.buildServer.deployer.agent.ssh;

class SSHProcessAdapterOptions {
  private boolean myEnableSshAgentForwarding;
  private boolean myFailBuildOnExitCode;

  SSHProcessAdapterOptions(boolean myEnableSshAgentForwarding, boolean myFailBuildOnExitCode) {
    this.myEnableSshAgentForwarding = myEnableSshAgentForwarding;
    this.myFailBuildOnExitCode = myFailBuildOnExitCode;
  }

  boolean shouldFailBuildOnExitCode() {
    return myFailBuildOnExitCode;
  }

  boolean enableSshAgentForwarding() {
    return myEnableSshAgentForwarding;
  }
}

package jetbrains.buildServer.deployer.agent.ssh;

class SSHProcessAdapterOptions {
  private boolean myFailBuildOnExitCode;
  private boolean myEnableSshAgentForwarding;

  SSHProcessAdapterOptions(boolean myFailBuildOnExitCode, boolean myEnableSshAgentForwarding) {
    this.myFailBuildOnExitCode = myFailBuildOnExitCode;
    this.myEnableSshAgentForwarding = myEnableSshAgentForwarding;
  }

  boolean shouldFailBuildOnExitCode() {
    return myFailBuildOnExitCode;
  }

  boolean enableSshAgentForwarding() {
    return myEnableSshAgentForwarding;
  }
}

Fix order of parameters in SSH Process Adapter Options


//
// $Id$

package com.threerings.gwt.util;

import com.google.common.base.Function;

/**
 * A collection of general purpose functions.
 */
public class Functions
{
    /** Implements boolean not. */
    public static Function<Boolean, Boolean> NOT = new Function<Boolean, Boolean>() {
        public Boolean apply (Boolean value) {
            return !value;
        }
    };
}

//
// $Id$

package com.threerings.gwt.util;

import java.util.Map;

import com.google.common.base.Function;

/**
 * A collection of general purpose functions.
 */
public class Functions
{
    /** Implements boolean not. */
    public static Function<Boolean, Boolean> NOT = new Function<Boolean, Boolean>() {
        public Boolean apply (Boolean value) {
            return !value;
        }
    };

    /** Views the supplied map as a function from keys to values. */
    public static <K, V> Function<K, V> fromMap (final Map<K, V> map) {
        return new Function<K, V>() {
            public V apply (K key) {
                return map.get(key);
            }
        };
    }
}

Allow a map to be viewed as a (K => V).

Allow a map to be viewed as a (K => V).


package natlab;

import junit.framework.Test;
import junit.framework.TestSuite;

public class AllTests {

	public static Test suite() {
		TestSuite suite = new TestSuite();
		//$JUnit-BEGIN$
		suite.addTestSuite(NatlabScannerTests.class);
		suite.addTestSuite(NatlabParserPassTests.class);
		suite.addTestSuite(NatlabParserFailTests.class);
		//$JUnit-END$
		return suite;
	}

}

package natlab;

import junit.framework.Test;
import junit.framework.TestSuite;

public class AllTests {

	public static Test suite() {
		TestSuite suite = new TestSuite();
		//$JUnit-BEGIN$
		suite.addTestSuite(NatlabScannerTests.class);
		//TODO-AC: uncomment
//		suite.addTestSuite(NatlabParserPassTests.class);
//		suite.addTestSuite(NatlabParserFailTests.class);
		//$JUnit-END$
		return suite;
	}

}

Comment out parser tests until we have a parser.

git-svn-id: https://svn.sable.mcgill.ca/mclab/Project@80 89b902b4-d83f-0410-b942-89f7a419ffdb

Migrated from Sable/mclab@900a27853e885c7dc670c2949e1445bc351502a2


package net.kencochrane.raven.appengine.event.helper;

import com.google.apphosting.api.ApiProxy;
import net.kencochrane.raven.event.EventBuilder;
import net.kencochrane.raven.event.helper.EventBuilderHelper;

/**
 * EventBuildHelper defining Google App Engine specific properties (hostname).
 */
public class AppEngineEventBuilderHelper implements EventBuilderHelper {
    /**
     * Property used internally by GAE to define the hostname.
     *
     * @see GAE: App Identity Java API
     */
    private static final String CURRENT_VERSION_HOSTNAME_PROPERTY = "com.google.appengine.runtime.default_version_hostname";

    @Override
    public void helpBuildingEvent(EventBuilder eventBuilder) {
        ApiProxy.Environment env = ApiProxy.getCurrentEnvironment();
        // Set the hostname to the actual application hostname
        eventBuilder.setServerName((String) env.getAttributes().get(CURRENT_VERSION_HOSTNAME_PROPERTY));
    }
}

package net.kencochrane.raven.appengine.event.helper;

import com.google.appengine.api.utils.SystemProperty;
import com.google.apphosting.api.ApiProxy;
import net.kencochrane.raven.event.EventBuilder;
import net.kencochrane.raven.event.helper.EventBuilderHelper;

/**
 * EventBuildHelper defining Google App Engine specific properties (hostname).
 */
public class AppEngineEventBuilderHelper implements EventBuilderHelper {
    /**
     * Property used internally by GAE to define the hostname.
     *
     * @see GAE: App Identity Java API
     */
    private static final String CURRENT_VERSION_HOSTNAME_PROPERTY = "com.google.appengine.runtime.default_version_hostname";

    @Override
    public void helpBuildingEvent(EventBuilder eventBuilder) {
        ApiProxy.Environment env = ApiProxy.getCurrentEnvironment();
        // Set the hostname to the actual application hostname
        eventBuilder.setServerName((String) env.getAttributes().get(CURRENT_VERSION_HOSTNAME_PROPERTY));

        eventBuilder.addTag("GAE Application Version", SystemProperty.applicationVersion.get());
    }
}

Add the GAE application version to the tags


/*
 * (C) Copyright 2014 Kurento (http://kurento.org/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library 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.
 *
 */
package org.kurento.test.sanity;

import static org.kurento.commons.PropertiesManager.getProperty;

import org.junit.Test;

/**
 * Sanity test for kurento-js releases.
 *
 * @author Boni Garcia (bgarcia@gsyc.es)
 * @since 4.2.5
 */
public class KurentoJsReleaseTest extends KurentoJsBase {

	public KurentoJsReleaseTest() {

		kurentoUrl = getProperty("kurento.release.url", DEFAULT_KURENTO_JS_URL);
		log.debug("kurentoUrl = {}", kurentoUrl);
		if (!kurentoUrl.endsWith("/")) {
			kurentoUrl += "/";
		}
	}

	@Test
	public void kurentoJsReleaseTest() {
		doTest();
	}

}

/*
 * (C) Copyright 2014 Kurento (http://kurento.org/)
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library 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.
 *
 */
package org.kurento.test.sanity;

import static org.kurento.commons.PropertiesManager.getProperty;

import org.junit.Test;

/**
 * Sanity test for kurento-js releases.
 *
 * @author Boni Garcia (bgarcia@gsyc.es)
 * @since 4.2.5
 */
public class KurentoJsReleaseTest extends KurentoJsBase {

	public KurentoJsReleaseTest() {

		kurentoUrl = getProperty("bower.release.url", DEFAULT_KURENTO_JS_URL);
		log.debug("kurentoUrl = {}", kurentoUrl);
		if (!kurentoUrl.endsWith("/")) {
			kurentoUrl += "/";
		}
	}

	@Test
	public void kurentoJsReleaseTest() {
		doTest();
	}

}

Replace property kurento.release.url by bower.release.url

Change-Id: I05d204d870b09e32edcfed7a004dfcedbe6dd3c6


package uk.ac.ebi.quickgo.ontology.common.coterms;

import java.io.IOException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;

/**
 * Configuration class related to loading and using co-occurring terms information.
 * @author Tony Wardell
 * Date: 29/09/2016
 * Time: 11:50
 * Created with IntelliJ IDEA.
 */
@Configuration
public class CoTermRepoConfig {

    @Value("${coterm.source.manual}")
    private Resource manualResource;

    @Value("${coterm.source.all}")
    private Resource allResource;

    @Bean
    public CoTermRepository coTermRepository() {
        CoTermRepositorySimpleMap coTermRepository = new CoTermRepositorySimpleMap();
        CoTermRepositorySimpleMap.CoTermLoader coTermLoader =
                coTermRepository.new CoTermLoader(manualResource, allResource);
        try {
            coTermLoader.load();
        } catch (IOException e) {
            throw new RuntimeException("Failed to load co-occurring terms from manual source " +
                    (manualResource!=null?manualResource.getDescription():"unknown") + " or from all source " +
                    (allResource!=null?allResource.getDescription():"unknown"));
        }
        return coTermRepository;
    }
}

package uk.ac.ebi.quickgo.ontology.common.coterms;

import java.io.IOException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;

/**
 * Configuration class related to loading and using co-occurring terms information.
 * @author Tony Wardell
 * Date: 29/09/2016
 * Time: 11:50
 * Created with IntelliJ IDEA.
 */
@Configuration
public class CoTermRepoConfig {

    @Value("${coterm.source.manual}")
    private Resource manualResource;

    @Value("${coterm.source.all}")
    private Resource allResource;

    @Bean
    public CoTermRepository coTermRepository() {
        CoTermRepositorySimpleMap coTermRepository;
        try{
            coTermRepository = CoTermRepositorySimpleMap.createCoTermRepositorySimpleMap(manualResource, allResource);
        } catch (IOException e) {
            throw new RuntimeException("Failed to load co-occurring terms from manual source " +
                    (manualResource!=null?manualResource.getDescription():"unknown") + " or from all source " +
                    (allResource!=null?allResource.getDescription():"unknown"));
        }
        return coTermRepository;
    }
}

Replace constructors with static factory methods.


package sg.ncl.service.experiment.data.jpa;

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

import java.util.List;

/**
 * @author Christopher Zhong
 */
public interface ExperimentRepository extends JpaRepository<ExperimentEntity, Long> {

    List<ExperimentEntity> findByUserId(String userId);
    Long countByTeamId(String teamId);
}

package sg.ncl.service.experiment.data.jpa;

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

import java.util.List;

/**
 * @author Christopher Zhong
 */
public interface ExperimentRepository extends JpaRepository<ExperimentEntity, Long> {

    List<ExperimentEntity> findByUserId(String userId);
    Long countByName(String name);
}

Add method to search by experiment name

Add method to search by experiment name


package squeek.speedometer;

import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import squeek.speedometer.gui.screen.ScreenSpeedometerSettings;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;

public class SpeedometerKeyHandler
{
	private static final KeyBinding SETTINGS_KEY = new KeyBinding("squeedometer.key.settings", Keyboard.KEY_P, ModInfo.MODID);
	static
	{
		ClientRegistry.registerKeyBinding(SETTINGS_KEY);
	}

	@SubscribeEvent
	public void onKeyEvent(KeyInputEvent event)
	{
		if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == SETTINGS_KEY.getKeyCode())
		{
			Minecraft mc = Minecraft.getMinecraft();

			if (mc.currentScreen != null)
				return;

			mc.displayGuiScreen(new ScreenSpeedometerSettings());
		}
	}
}

package squeek.speedometer;

import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import squeek.speedometer.gui.screen.ScreenSpeedometerSettings;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;

public class SpeedometerKeyHandler
{
	private static final KeyBinding SETTINGS_KEY = new KeyBinding("squeedometer.key.settings", Keyboard.KEY_P, ModInfo.MODID);
	static
	{
		ClientRegistry.registerKeyBinding(SETTINGS_KEY);
	}

	@SubscribeEvent
	public void onKeyEvent(KeyInputEvent event)
	{
		if (SETTINGS_KEY.isPressed())
		{
			Minecraft mc = Minecraft.getMinecraft();

			if (mc.currentScreen != null)
				return;

			mc.displayGuiScreen(new ScreenSpeedometerSettings());
		}
	}
}

Backport: Fix special keys opening menu when key is unbound

(backport of daec4de7bf091f84a789c90d3956f5aa91486203 to affected branches)


package com.github.aureliano.evtbridge.core.config;

public enum OutputConfigTypes {

	ELASTIC_SEARCH,
	FILE_OUTPUT,
	STANDARD_OUTPUT,
	JDBC_OUTPUT;
}

package com.github.aureliano.evtbridge.core.config;

public enum OutputConfigTypes {

	ELASTIC_SEARCH,
	FILE,
	STANDARD_OUTPUT,
	JDBC_OUTPUT;
}

Rename attribute name from FILE_OUTPUT to FILE.


package com.jaiwo99.cards.service;

import com.jaiwo99.cards.deal.JiangDealStrategy;
import com.jaiwo99.cards.domain.Jiang;
import com.jaiwo99.cards.repository.CardDealRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liang - jaiwo99@gmail.com
 */
@Service
public class JiangDealServiceImpl implements JiangDealService {

    @Autowired
    private JiangDealStrategy jiangDealStrategy;

    @Autowired
    private CardDealRepository cardDealRepository;

    @Override
    public List<Jiang> choose() {
        return jiangDealStrategy.choose();
    }

    @Override
    public Jiang pick(String id) {
        return jiangDealStrategy.pick(id);
    }

    @Override
    public List<Jiang> listNew() {
        return jiangDealStrategy.listNew();
    }

    @Override
    public List<Jiang> listChosen() {
        return jiangDealStrategy.listChosen();
    }

    @Override
    public List<Jiang> listPicked() {
        return jiangDealStrategy.listPicked();
    }

    @Override
    public void reset() {
        jiangDealStrategy.reset();
    }
}

package com.jaiwo99.cards.service;

import com.jaiwo99.cards.deal.JiangDealStrategy;
import com.jaiwo99.cards.domain.Jiang;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liang - jaiwo99@gmail.com
 */
@Service
public class JiangDealServiceImpl implements JiangDealService {

    @Autowired
    private JiangDealStrategy jiangDealStrategy;

    @Override
    public List<Jiang> choose() {
        return jiangDealStrategy.choose();
    }

    @Override
    public Jiang pick(String id) {
        return jiangDealStrategy.pick(id);
    }

    @Override
    public List<Jiang> listNew() {
        return jiangDealStrategy.listNew();
    }

    @Override
    public List<Jiang> listChosen() {
        return jiangDealStrategy.listChosen();
    }

    @Override
    public List<Jiang> listPicked() {
        return jiangDealStrategy.listPicked();
    }

    @Override
    public void reset() {
        jiangDealStrategy.reset();
    }
}

Clean up: removed unused field

Clean up: removed unused field


package de.prob2.ui.consoles.groovy;

import java.io.IOException;

import com.google.inject.Inject;
import com.google.inject.Singleton;

import de.prob2.ui.prob2fx.CurrentStage;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Singleton
public final class GroovyConsoleStage extends Stage {
	private static final Logger logger = LoggerFactory.getLogger(GroovyConsoleStage.class);

	@FXML private GroovyConsole groovyConsole;

	private final GroovyInterpreter interpreter;

	@Inject
	private GroovyConsoleStage(FXMLLoader loader, CurrentStage currentStage, GroovyInterpreter interpreter) {
		try {
			loader.setLocation(getClass().getResource("groovy_console_stage.fxml"));
			loader.setRoot(this);
			loader.setController(this);
			loader.load();
		} catch (IOException e) {
			logger.error("loading fxml failed", e);
		}
		this.interpreter = interpreter;

		currentStage.register(this);
	}

	@FXML
	public void initialize() {
		groovyConsole.setInterpreter(interpreter);
		this.setOnCloseRequest(e -> groovyConsole.closeObjectStage());
	}
}

package de.prob2.ui.consoles.groovy;

import java.io.IOException;

import com.google.inject.Inject;
import com.google.inject.Singleton;

import de.prob2.ui.prob2fx.CurrentStage;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Singleton
public final class GroovyConsoleStage extends Stage {
	private static final Logger logger = LoggerFactory.getLogger(GroovyConsoleStage.class);

	@FXML private GroovyConsole groovyConsole;

	private final GroovyInterpreter interpreter;

	@Inject
	private GroovyConsoleStage(FXMLLoader loader, CurrentStage currentStage, GroovyInterpreter interpreter) {
		this.interpreter = interpreter;

		try {
			loader.setLocation(getClass().getResource("groovy_console_stage.fxml"));
			loader.setRoot(this);
			loader.setController(this);
			loader.load();
		} catch (IOException e) {
			logger.error("loading fxml failed", e);
		}

		currentStage.register(this);
	}

	@FXML
	public void initialize() {
		groovyConsole.setInterpreter(interpreter);
		this.setOnCloseRequest(e -> groovyConsole.closeObjectStage());
	}
}

Fix Groovy console interpreter not being set properly


package xyz.brassgoggledcoders.moarlibs;

import net.minecraft.creativetab.CreativeTabs;
import xyz.brassgoggledcoders.boilerplate.BoilerplateModBase;
import xyz.brassgoggledcoders.moarlibs.api.IMoarRegister;
import xyz.brassgoggledcoders.moarlibs.registries.BlockContainerRegistry;

public abstract class MoarLibModBase extends BoilerplateModBase
{
	public MoarLibModBase(String modid, String name, String version, CreativeTabs creativeTab)
	{
		super(modid, name, version, creativeTab);
	}

	@Override
	protected void afterModuleConstruct()
	{
		this.getMoarRegister().registerItems(BlockContainerRegistry.getAllBlockContainers());
		this.getMoarRegister().registerEntities();
	}

	public abstract IMoarRegister getMoarRegister();
}

package xyz.brassgoggledcoders.moarlibs;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import xyz.brassgoggledcoders.boilerplate.BoilerplateModBase;
import xyz.brassgoggledcoders.moarlibs.api.IMoarRegister;
import xyz.brassgoggledcoders.moarlibs.registries.BlockContainerRegistry;

public abstract class MoarLibModBase extends BoilerplateModBase
{
	public MoarLibModBase(String modid, String name, String version, CreativeTabs creativeTab)
	{
		super(modid, name, version, creativeTab);
	}

	@Override
	protected void afterModuleConstruct(FMLPreInitializationEvent event)
	{
		MoarLibs.INSTANCE.createHandlers(event);
		this.getMoarRegister().registerItems(BlockContainerRegistry.getAllBlockContainers());
		this.getMoarRegister().registerEntities();
	}

	public abstract IMoarRegister getMoarRegister();
}

Change MoarLibsModBase to force loading of ModuleHandler


package io.quarkus.flyway.devconsole;

import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT;

import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.devconsole.spi.DevConsoleRouteBuildItem;
import io.quarkus.devconsole.spi.DevConsoleRuntimeTemplateInfoBuildItem;
import io.quarkus.flyway.runtime.FlywayContainersSupplier;
import io.quarkus.flyway.runtime.devconsole.FlywayDevConsoleRecorder;

public class DevConsoleProcessor {

    @BuildStep(onlyIf = IsDevelopment.class)
    public DevConsoleRuntimeTemplateInfoBuildItem collectBeanInfo() {
        return new DevConsoleRuntimeTemplateInfoBuildItem("containers", new FlywayContainersSupplier());
    }

    @BuildStep
    @Record(value = RUNTIME_INIT, optional = true)
    DevConsoleRouteBuildItem invokeEndpoint(FlywayDevConsoleRecorder recorder) {
        return new DevConsoleRouteBuildItem("containers", "POST", recorder.handler());
    }
}

package io.quarkus.flyway.devconsole;

import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT;

import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.devconsole.spi.DevConsoleRouteBuildItem;
import io.quarkus.devconsole.spi.DevConsoleRuntimeTemplateInfoBuildItem;
import io.quarkus.flyway.runtime.FlywayContainersSupplier;
import io.quarkus.flyway.runtime.devconsole.FlywayDevConsoleRecorder;

public class DevConsoleProcessor {

    @BuildStep(onlyIf = IsDevelopment.class)
    public DevConsoleRuntimeTemplateInfoBuildItem collectBeanInfo() {
        return new DevConsoleRuntimeTemplateInfoBuildItem("containers", new FlywayContainersSupplier());
    }

    @BuildStep
    @Record(value = RUNTIME_INIT, optional = true)
    DevConsoleRouteBuildItem invokeEndpoint(FlywayDevConsoleRecorder recorder) {
        return new DevConsoleRouteBuildItem("datasources", "POST", recorder.handler());
    }
}

Fix Flyway dev console link

Fix Flyway dev console link


package hudson.plugins.scm_sync_configuration.util;

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import hudson.plugins.scm_sync_configuration.ScmSyncConfigurationPlugin;
import hudson.plugins.test.utils.scms.ScmUnderTest;

// Class will start current ScmSyncConfigurationPlugin instance
public class ScmSyncConfigurationPluginBaseTest extends
		ScmSyncConfigurationBaseTest {

	protected ScmSyncConfigurationPluginBaseTest(ScmUnderTest scmUnderTest) {
		super(scmUnderTest);
	}

	public void setup() throws Throwable {
		super.setup();

		// Let's start the plugin...
		ScmSyncConfigurationPlugin.getInstance().start();
	}

	public void teardown() throws Throwable {
		// Stopping current plugin
		ScmSyncConfigurationPlugin.getInstance().stop();

		super.teardown();
	}

	protected void assertStatusManagerIsOk() {
		assertThat(sscBusiness.getScmSyncConfigurationStatusManager().getLastFail(), nullValue());
		assertThat(sscBusiness.getScmSyncConfigurationStatusManager().getLastSuccess(), notNullValue());
	}

	protected void assertStatusManagerIsNull() {
		assertThat(sscBusiness.getScmSyncConfigurationStatusManager().getLastFail(), nullValue());
		assertThat(sscBusiness.getScmSyncConfigurationStatusManager().getLastSuccess(), nullValue());
	}

}

package hudson.plugins.scm_sync_configuration.util;

import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import hudson.plugins.scm_sync_configuration.ScmSyncConfigurationPlugin;
import hudson.plugins.test.utils.scms.ScmUnderTest;

// Class will start current ScmSyncConfigurationPlugin instance
public abstract class ScmSyncConfigurationPluginBaseTest extends
		ScmSyncConfigurationBaseTest {

	protected ScmSyncConfigurationPluginBaseTest(ScmUnderTest scmUnderTest) {
		super(scmUnderTest);
	}

	public void setup() throws Throwable {
		super.setup();

		// Let's start the plugin...
		ScmSyncConfigurationPlugin.getInstance().start();
	}

	public void teardown() throws Throwable {
		// Stopping current plugin
		ScmSyncConfigurationPlugin.getInstance().stop();

		super.teardown();
	}

	protected void assertStatusManagerIsOk() {
		assertThat(sscBusiness.getScmSyncConfigurationStatusManager().getLastFail(), nullValue());
		assertThat(sscBusiness.getScmSyncConfigurationStatusManager().getLastSuccess(), notNullValue());
	}

	protected void assertStatusManagerIsNull() {
		assertThat(sscBusiness.getScmSyncConfigurationStatusManager().getLastFail(), nullValue());
		assertThat(sscBusiness.getScmSyncConfigurationStatusManager().getLastSuccess(), nullValue());
	}

}

Make class abstract so it is not run by test runner

Only subclasses of ScmSyncConfigurationPluginBaseTest should
be run by the test runner.


/*
 * Copyright (c) 2014 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.controller.protocol_plugins.stub.internal;

import org.opendaylight.controller.sal.core.ConstructionException;
import org.opendaylight.controller.sal.utils.INodeFactory;
import org.opendaylight.controller.sal.core.Node;

public class StubNodeFactory implements INodeFactory
    {
      void init() {
      }

      /**
       * Function called by the dependency manager when at least one dependency
       * become unsatisfied or when the component is shutting down because for
       * example bundle is being stopped.
       *
       */
      void destroy() {
      }

      /**
       * Function called by dependency manager after "init ()" is called and after
       * the services provided by the class are registered in the service registry
       *
       */
      void start() {
      }

      /**
       * Function called by the dependency manager before the services exported by
       * the component are unregistered, this will be followed by a "destroy ()"
       * calls
       *
       */
      void stop() {
      }

      public Node fromString(String nodeType, String nodeId){
          if(nodeType.equals("STUB"))
              try{
                  return new Node("STUB", Integer.parseInt(nodeId));
              } catch(ConstructionException e)
              {
                  return null;
              }
          return null;
      }
}

/*
 * Copyright (c) 2014 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.controller.protocol_plugins.stub.internal;

import org.opendaylight.controller.sal.core.ConstructionException;
import org.opendaylight.controller.sal.utils.INodeFactory;
import org.opendaylight.controller.sal.core.Node;

public class StubNodeFactory implements INodeFactory {
    void init() {
    }

    /**
     * Function called by the dependency manager when at least one dependency
     * become unsatisfied or when the component is shutting down because for
     * example bundle is being stopped.
     *
     */
    void destroy() {
    }

    /**
     * Function called by dependency manager after "init ()" is called and after
     * the services provided by the class are registered in the service registry
     *
     */
    void start() {
    }

    /**
     * Function called by the dependency manager before the services exported by
     * the component are unregistered, this will be followed by a "destroy ()"
     * calls
     *
     */
    void stop() {
    }

    public Node fromString(String nodeType, String nodeId){
        if(nodeType.equals("STUB")) {
            try {
                return new Node("STUB", Integer.parseInt(nodeId));
            } catch(ConstructionException e) {
                return null;
            }
        }
        return null;
    }
}

Fix checkstyle if-statements must use braces adsal/protocol_plugins

Change-Id: I2110c4623f141e738b368d0bce0695ebc98809ff
Signed-off-by: Thanh Ha <09ea4d3a79c8bee41a16519f6a431f6bc0fd8d6f@linuxfoundation.org>


package net.ssehub.kernel_haven.fe_analysis.fes;

import net.ssehub.kernel_haven.SetUpException;
import net.ssehub.kernel_haven.analysis.AnalysisComponent;
import net.ssehub.kernel_haven.analysis.PipelineAnalysis;
import net.ssehub.kernel_haven.config.Configuration;
import net.ssehub.kernel_haven.fe_analysis.pcs.PcFinder;
import net.ssehub.kernel_haven.util.null_checks.NonNull;

/**
 * An analysis that finds feature effect formulas for variables.
 *
 * @author Adam
 */
public class FeatureEffectAnalysis extends PipelineAnalysis {

    /**
     * Creates a new {@link FeatureEffectAnalysis}.
     *
     * @param config The global configuration.
     */
    public FeatureEffectAnalysis(@NonNull Configuration config) {
        super(config);
    }

    @Override
    protected AnalysisComponent<?> createPipeline() throws SetUpException {
        return new FeatureEffectFinder(config,
                new PcFinder(config,
                        getCmComponent(),
                        getBmComponent()
                )
        );
    }

}

package net.ssehub.kernel_haven.fe_analysis.fes;

import net.ssehub.kernel_haven.SetUpException;
import net.ssehub.kernel_haven.analysis.AnalysisComponent;
import net.ssehub.kernel_haven.analysis.PipelineAnalysis;
import net.ssehub.kernel_haven.config.Configuration;
import net.ssehub.kernel_haven.fe_analysis.pcs.PcFinder;
import net.ssehub.kernel_haven.util.null_checks.NonNull;

/**
 * An analysis that finds feature effect formulas for variables.
 *
 * @author Adam
 */
public class FeatureEffectAnalysis extends PipelineAnalysis {

    /**
     * Creates a new {@link FeatureEffectAnalysis}.
     *
     * @param config The global configuration.
     */
    public FeatureEffectAnalysis(@NonNull Configuration config) {
        super(config);
    }

    @Override
    protected @NonNull AnalysisComponent<?> createPipeline() throws SetUpException {
        return new FeatureEffectFinder(config,
                new PcFinder(config,
                        getCmComponent(),
                        getBmComponent()
                )
        );
    }

}

Add some inherited @NonNull annotation

Add some inherited @NonNull annotation


package org.jrebirth.af.core.command.basic.multi;

import org.jrebirth.af.core.command.basic.BasicCommandTest;

import org.junit.Test;

//@Ignore("JavaFX can't be run in headless mode yet")
public class MultiCommandTest extends BasicCommandTest {

    @Test
    public void sequentialTest1() {
        System.out.println("Sequential Test default");
        runCommand(DefaultSequentialCommand.class);
    }

    @Test
    public void sequentialTest2() {
        System.out.println("Sequential Test annotation");
        runCommand(AnnotatedSequentialCommand.class);
    }

    @Test
    public void sequentialTest3() {
        System.out.println("Sequential Test constructor");
        runCommand(ConstructorSequentialCommand.class);
    }

    @Test
    public void parallelTest1() {
        System.out.println("Parallel Test default");
        runCommand(DefaultParallelCommand.class);
    }

    @Test
    public void parallelTest2() {
        System.out.println("Parallel Test annotation");
        runCommand(AnnotatedParallelCommand.class);
    }

    @Test
    public void parallelTest3() {
        System.out.println("Parallel Test constructor");
        runCommand(ConstructorParallelCommand.class);
    }
}

package org.jrebirth.af.core.command.basic.multi;

import org.jrebirth.af.core.command.basic.BasicCommandTest;

import org.junit.Ignore;
import org.junit.Test;

@Ignore("JavaFX can't be run in headless mode yet")
public class MultiCommandTest extends BasicCommandTest {

    @Test
    public void sequentialTest1() {
        System.out.println("Sequential Test default");
        runCommand(DefaultSequentialCommand.class);
    }

    @Test
    public void sequentialTest2() {
        System.out.println("Sequential Test annotation");
        runCommand(AnnotatedSequentialCommand.class);
    }

    @Test
    public void sequentialTest3() {
        System.out.println("Sequential Test constructor");
        runCommand(ConstructorSequentialCommand.class);
    }

    @Test
    public void parallelTest1() {
        System.out.println("Parallel Test default");
        runCommand(DefaultParallelCommand.class);
    }

    @Test
    public void parallelTest2() {
        System.out.println("Parallel Test annotation");
        runCommand(AnnotatedParallelCommand.class);
    }

    @Test
    public void parallelTest3() {
        System.out.println("Parallel Test constructor");
        runCommand(ConstructorParallelCommand.class);
    }
}

Disable test untestable without x server