package org.tigris.subversion.svnclientadapter.javahl;

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

import org.tigris.subversion.javahl.ChangePath;
import org.tigris.subversion.javahl.LogMessageCallback;
import org.tigris.subversion.javahl.Revision;

public class JhlLogMessageCallback implements LogMessageCallback {

	private List messages = new ArrayList();
	private Stack stack = new Stack();

	public void singleMessage(ChangePath[] changedPaths, long revision,
			String author, long timeMicros, String message, boolean hasChildren) {
		if (revision == Revision.SVN_INVALID_REVNUM) {
			stack.pop();
			return;
		}
		JhlLogMessage msg = new JhlLogMessage(changedPaths, revision, author, timeMicros, message, hasChildren);
		if (stack.empty()) {
				messages.add(msg);
		} else {
			JhlLogMessage current = (JhlLogMessage) stack.peek();
			current.addChild(msg);
		}
		if (hasChildren)
			stack.push(msg);
	}

	public JhlLogMessage[] getLogMessages() {
		JhlLogMessage[] array = new JhlLogMessage[messages.size()];
		return (JhlLogMessage[]) messages.toArray(array);
	}

}

package org.tigris.subversion.svnclientadapter.javahl;

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

import org.tigris.subversion.javahl.ChangePath;
import org.tigris.subversion.javahl.LogMessageCallback;
import org.tigris.subversion.javahl.Revision;

public class JhlLogMessageCallback implements LogMessageCallback {

	private List messages = new ArrayList();
	private Stack stack = new Stack();

	public void singleMessage(ChangePath[] changedPaths, long revision,
			String author, long timeMicros, String message, boolean hasChildren) {
		if (revision == Revision.SVN_INVALID_REVNUM) {
			if (!stack.empty())
				stack.pop();
			return;
		}
		JhlLogMessage msg = new JhlLogMessage(changedPaths, revision, author, timeMicros, message, hasChildren);
		if (stack.empty()) {
				messages.add(msg);
		} else {
			JhlLogMessage current = (JhlLogMessage) stack.peek();
			current.addChild(msg);
		}
		if (hasChildren)
			stack.push(msg);
	}

	public JhlLogMessage[] getLogMessages() {
		JhlLogMessage[] array = new JhlLogMessage[messages.size()];
		return (JhlLogMessage[]) messages.toArray(array);
	}

}

Check if stack is empty before popping off a message.


/*
 * Copyright 2018 Google LLC
 *
 * 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
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.gnd.util;

import com.google.common.collect.ImmutableSet;
import java8.util.stream.Collector;
import java8.util.stream.Collectors;

/**
 * Custom collector for compatibility between {@link Collector} compat class and Guava {@link
 * ImmutableSet}.
 */
public abstract class ImmutableSetCollector {
  /** Do not instantiate. */
  private ImmutableSetCollector() {}

  private static final Collector<Object, ?, ImmutableSet<Object>> TO_IMMUTABLE_SET =
      Collectors.of(
          ImmutableSet::builder,
          ImmutableSet.Builder::add,
          (a, b) -> {
            throw new UnsupportedOperationException();
          },
          ImmutableSet.Builder::build);

  /** Returns a {@link Collector} that accumulates the input elements into a new ImmutableSet. */
  public static <E> Collector<E, ?, ImmutableSet<E>> toImmutableSet() {
    return (Collector) TO_IMMUTABLE_SET;
  }
}

/*
 * Copyright 2019 Google LLC
 *
 * 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
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.android.gnd.util;

import com.google.common.collect.ImmutableSet;
import java8.util.stream.Collector;
import java8.util.stream.Collectors;

/**
 * Custom collector for compatibility between {@link Collector} compat class and Guava {@link
 * ImmutableSet}.
 */
public abstract class ImmutableSetCollector {
  /** Do not instantiate. */
  private ImmutableSetCollector() {}

  private static final Collector<Object, ?, ImmutableSet<Object>> TO_IMMUTABLE_SET =
      Collectors.of(
          ImmutableSet::builder,
          ImmutableSet.Builder::add,
          (a, b) -> {
            throw new UnsupportedOperationException();
          },
          ImmutableSet.Builder::build);

  /** Returns a {@link Collector} that accumulates the input elements into a new ImmutableSet. */
  public static <E> Collector<E, ?, ImmutableSet<E>> toImmutableSet() {
    return (Collector) TO_IMMUTABLE_SET;
  }
}

Fix copyright on new file

Fix copyright on new file


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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MessageComponent {

    @Autowired
    private MessageService service;

    public String getMessage() {
        return service.getMessage();
    }
}

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

import org.springframework.stereotype.Component;

@Component
public class MessageComponent {

    private MessageService messageService;

    public MessageComponent(MessageService messageService) {
        this.messageService = messageService;
    }

    public String getMessage() {
        return messageService.getMessage();
    }

}

Unify variable names in components(junit5-spring)


package uk.ac.ebi.quickgo.geneproduct.common;

import uk.ac.ebi.quickgo.geneproduct.common.document.GeneProductDocument;

import java.util.List;
import java.util.Optional;
import org.springframework.data.solr.repository.SolrCrudRepository;

/**
 * Gene product repository interface exposing methods for performing searches over its contents.
 * <p>
 * See here how to change:
 * https://github.com/spring-projects/spring-data-solr/blob/master/README.md
 *
 * @author Ricardo Antunes
 */
public interface GeneProductRepository extends SolrCrudRepository<GeneProductDocument, String> {

    Optional<GeneProductDocument> findById(String id);

    List<GeneProductDocument> findCoreAttrByGeneProductId(List<String> ids);
}

package uk.ac.ebi.quickgo.geneproduct.common;

import uk.ac.ebi.quickgo.geneproduct.common.document.GeneProductDocument;

import java.util.List;
import java.util.Optional;
import org.springframework.data.solr.repository.SolrCrudRepository;

/**
 * Gene product repository interface exposing methods for performing searches over its contents.
 * <p>
 * See here how to change:
 * https://github.com/spring-projects/spring-data-solr/blob/master/README.md
 *
 * @author Ricardo Antunes
 */
public interface GeneProductRepository extends SolrCrudRepository<GeneProductDocument, String> {

    Optional<GeneProductDocument> findById(String id);

    List<GeneProductDocument> findById(List<String> ids);
}

Use findById as lookup method name.

Use findById as lookup method name.


package edu.virginia.psyc.r01.persistence;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.mindtrails.domain.questionnaire.LinkedQuestionnaireData;

import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by dan on 8/27/15.
 */
@Entity
@Table(name="AnxietyIdentity")
@EqualsAndHashCode(callSuper = true)
@Data
public class AnxietyIdentity extends LinkedQuestionnaireData {

    private Integer anxietyIdentity;
}

package edu.virginia.psyc.r01.persistence;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.mindtrails.domain.questionnaire.LinkedQuestionnaireData;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

/**
 * Created by dan on 8/27/15.
 */
@Entity
@Table(name="AnxietyIdentity")
@EqualsAndHashCode(callSuper = true)
@Data
public class AnxietyIdentity extends LinkedQuestionnaireData {

    @NotNull
    private Integer anxietyIdentity;
}

Add @NotNull validation to the Anxiety Identity java file. Keep the form hydration logic in the HTML, because the radio button options are HTML elements, not Strings. Migrating that logic to the Java file would be a pain.


package com.hypnoticocelot.telemetry.example.sink;

import com.hypnoticocelot.telemetry.tracing.Span;
import com.hypnoticocelot.telemetry.tracing.SpanSink;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SLF4JSpanSink implements SpanSink {
    private static final Logger LOG = LoggerFactory.getLogger(SLF4JSpanSink.class);

    @Override
    public void record(Span span) {
        LOG.trace("[TELEMETRY id={}; pid={}; tid={}; name={}; start={}; end={}]",
                span.getId(),
                span.getParentId(),
                span.getTraceId(),
                span.getData().getName(),
                span.getStartTime(),
                span.getEndTime());
    }
}

package com.hypnoticocelot.telemetry.example.sink;

import com.google.common.collect.ImmutableMap;
import com.hypnoticocelot.telemetry.tracing.Span;
import com.hypnoticocelot.telemetry.tracing.SpanSink;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

public class SLF4JSpanSink implements SpanSink {
    private static final Logger LOG = LoggerFactory.getLogger(SLF4JSpanSink.class);

    @Override
    public void record(Span span) {
        LOG.trace("[TELEMETRY id={}; pid={}; tid={}; name={}; start={}; end={}; annotations={}]",
                span.getId(),
                span.getParentId(),
                span.getTraceId(),
                span.getData().getName(),
                span.getStartTime(),
                span.getEndTime(),
                renderAnnotations(span.getData().getAnnotations()));
    }

    private String renderAnnotations(ImmutableMap<String, String> annotations) {
        final StringBuilder builder = new StringBuilder();
        builder.append("{");
        for (Map.Entry<String, String> entry : annotations.entrySet()) {
            builder.append(entry.getKey()).append("=").append(entry.getValue()).append(" ");
        }
        builder.append("}");
        return builder.toString();
    }
}

Include annotations in the SLF4J logged Spans.


package org.springframework.samples.petclinic.system;

import java.util.concurrent.TimeUnit;
import javax.cache.CacheManager;

import org.ehcache.config.CacheConfiguration;
import org.ehcache.config.builders.CacheConfigurationBuilder;
import org.ehcache.config.builders.ResourcePoolsBuilder;
import org.ehcache.config.units.EntryUnit;
import org.ehcache.expiry.Duration;
import org.ehcache.expiry.Expirations;
import org.ehcache.jsr107.Eh107Configuration;

import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * Cache could be disable in unit test.
 */
@Configuration
@EnableCaching
@Profile("production")
class CacheConfig {

    @Bean
    public JCacheManagerCustomizer cacheManagerCustomizer() {
        return new JCacheManagerCustomizer() {
            @Override
            public void customize(CacheManager cacheManager) {
                CacheConfiguration<Object, Object> config = CacheConfigurationBuilder
                    .newCacheConfigurationBuilder(Object.class, Object.class,
                        ResourcePoolsBuilder.newResourcePoolsBuilder()
                            .heap(100, EntryUnit.ENTRIES))
                    .withExpiry(Expirations.timeToLiveExpiration(Duration.of(60, TimeUnit.SECONDS)))
                    .build();
                cacheManager.createCache("vets", Eh107Configuration.fromEhcacheCacheConfiguration(config));
            }
        };
    }

}

package org.springframework.samples.petclinic.system;

import java.util.concurrent.TimeUnit;
import javax.cache.CacheManager;

import org.ehcache.config.CacheConfiguration;
import org.ehcache.config.builders.CacheConfigurationBuilder;
import org.ehcache.config.builders.ResourcePoolsBuilder;
import org.ehcache.config.units.EntryUnit;
import org.ehcache.expiry.Duration;
import org.ehcache.expiry.Expirations;
import org.ehcache.jsr107.Eh107Configuration;

import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * Cache could be disable in unit test.
 */
@Configuration
@EnableCaching
@Profile("production")
class CacheConfig {

    @Bean
    public JCacheManagerCustomizer cacheManagerCustomizer() {
        return cacheManager -> {
            CacheConfiguration<Object, Object> config = CacheConfigurationBuilder
                .newCacheConfigurationBuilder(Object.class, Object.class,
                    ResourcePoolsBuilder.newResourcePoolsBuilder()
                        .heap(100, EntryUnit.ENTRIES))
                .withExpiry(Expirations.timeToLiveExpiration(Duration.of(60, TimeUnit.SECONDS)))
                .build();
            cacheManager.createCache("vets", Eh107Configuration.fromEhcacheCacheConfiguration(config));
        };
    }

}

Replace anonymous class with lambda

Replace anonymous class with lambda


/**
 * Copyright 2012 The PlayN 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 playn.ios;

import playn.core.Log;

class IOSLog implements Log
{
  @Override
  public void error(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void error(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void info(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void info(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void debug(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void debug(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void warn(String msg) {
    throw new RuntimeException("TODO");
  }

  @Override
  public void warn(String msg, Throwable e) {
    throw new RuntimeException("TODO");
  }
}

/**
 * Copyright 2012 The PlayN 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 playn.ios;

import cli.System.Console;

import playn.core.Log;

class IOSLog implements Log
{
  // TODO: stack traces

  @Override
  public void debug(String msg) {
    Console.WriteLine("DEBUG: " + msg);
  }

  @Override
  public void debug(String msg, Throwable e) {
    debug(msg + ": " + e.getMessage());
  }

  @Override
  public void info(String msg) {
    Console.WriteLine(msg);
  }

  @Override
  public void info(String msg, Throwable e) {
    info(msg + ": " + e.getMessage());
  }

  @Override
  public void warn(String msg) {
    Console.WriteLine("WARN: " + msg);
  }

  @Override
  public void warn(String msg, Throwable e) {
    warn(msg + ": " + e.getMessage());
  }

  @Override
  public void error(String msg) {
    Console.WriteLine("ERROR: " + msg);
  }

  @Override
  public void error(String msg, Throwable e) {
    error(msg + ": " + e.getMessage());
  }
}

Implement simple logging to console.

Implement simple logging to console.


package edu.wpi.first.wpilibj.templates.commands;

import edu.wpi.first.wpilibj.templates.dashboardrelations.DashboardStore;
import edu.wpi.first.wpilibj.templates.debugging.DebugLevel;
import edu.wpi.first.wpilibj.templates.debugging.DebugOutput;
import edu.wpi.first.wpilibj.templates.debugging.Debuggable;
import edu.wpi.first.wpilibj.templates.debugging.InfoState;
import edu.wpi.first.wpilibj.templates.debugging.RobotDebugger;
import edu.wpi.first.wpilibj.templates.vstj.VstJ;

/**
 * Run Frisbee dumper (For top of pyramid).
 *
 * @author daboross
 */
public class RunFrisbeeDumperSolenoid extends CommandBase implements Debuggable {

    private boolean done;

    public RunFrisbeeDumperSolenoid() {
        requires(frisbeeDumperSolenoid);
    }

    protected void initialize() {
    }

    protected void execute() {
        if (VstJ.getFrisbeeDumpButtonValue() && DashboardStore.getIsClimberEnabled()) {
            frisbeeDumperSolenoid.startExpand();
            done = true;
        }
        RobotDebugger.push(this);
    }

    protected boolean isFinished() {
        return done;
    }

    protected void end() {
    }

    public DebugOutput getStatus() {
        return new InfoState("RunFrisbeeDumper", done ? "Extending" : "Not Extending", DebugLevel.HIGH);
    }
}

package edu.wpi.first.wpilibj.templates.commands;

import edu.wpi.first.wpilibj.templates.dashboardrelations.DashboardStore;
import edu.wpi.first.wpilibj.templates.debugging.DebugLevel;
import edu.wpi.first.wpilibj.templates.debugging.DebugOutput;
import edu.wpi.first.wpilibj.templates.debugging.Debuggable;
import edu.wpi.first.wpilibj.templates.debugging.InfoState;
import edu.wpi.first.wpilibj.templates.debugging.RobotDebugger;
import edu.wpi.first.wpilibj.templates.vstj.VstJ;

/**
 * Run Frisbee dumper (For top of pyramid).
 *
 * @author daboross
 */
public class RunFrisbeeDumperSolenoid extends CommandBase implements Debuggable {

    private boolean done;

    public RunFrisbeeDumperSolenoid() {
        requires(frisbeeDumperSolenoid);
    }

    protected void initialize() {
        frisbeeDumperSolenoid.startExpand();
        RobotDebugger.push(this);
    }

    protected void execute() {
        if (VstJ.getFrisbeeDumpButtonValue() && DashboardStore.getIsClimberEnabled()) {
            frisbeeDumperSolenoid.startRetract();
            done = true;
        }
        RobotDebugger.push(this);
    }

    protected boolean isFinished() {
        return done;
    }

    protected void end() {
    }

    public DebugOutput getStatus() {
        return new InfoState("RunFrisbeeDumper", done ? "Retracting" : "Extending", DebugLevel.HIGH);
    }
}

Use 2 solenoids instead of 1. Also have startExpand and startRetract instead of just one.


package com.welovecoding.nbeditorconfig.processor;

import org.openide.filesystems.FileObject;

public class SmartSkip {

  public static final boolean IS_ON = true;
  static final String[] IGNORED_FILES = {
    ".git",
    ".svn",
    "bower_components",
    "nbproject",
    "node_modules"
  };

  public static boolean skipDirectory(FileObject directory) {
    String fileName = directory.getName();
    boolean skip = false;

    for (String pattern : IGNORED_FILES) {
      if (fileName.startsWith(pattern)) {
        skip = true;
      }
    }

    if (directory.isFolder() && fileName.startsWith(".")) {
      skip = true;
    }

    return skip;
  }
}

package com.welovecoding.nbeditorconfig.processor;

import org.openide.filesystems.FileObject;

public class SmartSkip {

  public static final boolean IS_ON = true;
  static final String[] IGNORED_FILES = {
    ".git",
    ".svn",
    "bower_components",
    "nbproject",
    "node_modules",
    "vendor"
  };

  public static boolean skipDirectory(FileObject directory) {
    String fileName = directory.getName();
    boolean skip = false;

    for (String pattern : IGNORED_FILES) {
      if (fileName.startsWith(pattern)) {
        skip = true;
      }
    }

    if (directory.isFolder() && fileName.startsWith(".")) {
      skip = true;
    }

    return skip;
  }
}

Add PHP Composer vendor exception

Add PHP Composer vendor exception


/*******************************************************************************
 * This file is part of Pebble.
 *
 * Copyright (c) 2014 by Mitchell Bösecke
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 ******************************************************************************/
package com.mitchellbosecke.pebble.node.expression;

import java.util.Map;

import com.mitchellbosecke.pebble.error.PebbleException;
import com.mitchellbosecke.pebble.extension.LocaleAware;
import com.mitchellbosecke.pebble.extension.Test;
import com.mitchellbosecke.pebble.node.ArgumentsNode;
import com.mitchellbosecke.pebble.node.TestInvocationExpression;
import com.mitchellbosecke.pebble.template.EvaluationContext;
import com.mitchellbosecke.pebble.template.PebbleTemplateImpl;

public class NegativeTestExpression extends BinaryExpression<Object> {

    @Override
    public Object evaluate(PebbleTemplateImpl self, EvaluationContext context) throws PebbleException {

        TestInvocationExpression testInvocation = (TestInvocationExpression) getRightExpression();
        ArgumentsNode args = testInvocation.getArgs();
        String testName = testInvocation.getTestName();

        Map<String, Test> tests = context.getTests();
        Test test = tests.get(testInvocation.getTestName());

        if (test == null) {
            throw new PebbleException(null, String.format("Test [%s] does not exist.", testName));
        }

        if (test instanceof LocaleAware) {
            ((LocaleAware) test).setLocale(context.getLocale());
        }

        Map<String, Object> namedArguments = args.getArgumentMap(self, context, test);

        return !test.apply(getLeftExpression().evaluate(self, context), namedArguments);
    }
}

/*******************************************************************************
 * This file is part of Pebble.
 *
 * Copyright (c) 2014 by Mitchell Bösecke
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 ******************************************************************************/
package com.mitchellbosecke.pebble.node.expression;

import com.mitchellbosecke.pebble.error.PebbleException;
import com.mitchellbosecke.pebble.template.EvaluationContext;
import com.mitchellbosecke.pebble.template.PebbleTemplateImpl;

public class NegativeTestExpression extends PositiveTestExpression {

    @Override
    public Object evaluate(PebbleTemplateImpl self, EvaluationContext context) throws PebbleException {
        return !((Boolean) super.evaluate(self, context));
    }
}

Improve handling negative test expression (reuse the positive expression).


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

package com.google.devtools.cdbg.debuglets.java;

/**
 * Defines the version of the Java Cloud Debugger agent.
 */
public final class GcpDebugletVersion {
  /**
   * Major version of the debugger.

   * All agents of the same major version are compatible with each other. In other words an
   * application can mix different agents with the same major version within the same debuggee.
   */
  public static final int MAJOR_VERSION = 2;

  /**
   * Minor version of the agent.
   */
  public static final int MINOR_VERSION = 11;

  /**
   * Debugger agent version string in the format of MAJOR.MINOR.
   */
  public static final String VERSION = String.format("%d.%d", MAJOR_VERSION, MINOR_VERSION);

  /**
   * Main function to print the version string.
   */
  public static void main(String[] args) {
    System.out.println(VERSION);
  }
}

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

package com.google.devtools.cdbg.debuglets.java;

/**
 * Defines the version of the Java Cloud Debugger agent.
 */
public final class GcpDebugletVersion {
  /**
   * Major version of the debugger.

   * All agents of the same major version are compatible with each other. In other words an
   * application can mix different agents with the same major version within the same debuggee.
   */
  public static final int MAJOR_VERSION = 2;

  /**
   * Minor version of the agent.
   */
  public static final int MINOR_VERSION = 12;

  /**
   * Debugger agent version string in the format of MAJOR.MINOR.
   */
  public static final String VERSION = String.format("%d.%d", MAJOR_VERSION, MINOR_VERSION);

  /**
   * Main function to print the version string.
   */
  public static void main(String[] args) {
    System.out.println(VERSION);
  }
}

Increment minor version to 2.12 to prepare for a new release.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153211686


package gov.samhsa.c2s.c2suiapi.service;

import feign.FeignException;
import gov.samhsa.c2s.c2suiapi.infrastructure.PhrClient;
import gov.samhsa.c2s.c2suiapi.service.exception.NoDocumentsFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PhrServiceImpl implements PhrService{

    private final PhrClient phrClient;

    @Autowired
    public PhrServiceImpl(PhrClient phrClient) {
        this.phrClient = phrClient;
    }

    @Override
    public List<Object> getAllDocumentTypeCodesList(){
        return phrClient.getAllDocumentTypeCodesList();
    }

    @Override
    public List<Object> getPatientDocumentInfoList(String patientMrn){
        try{
            return phrClient.getPatientDocumentInfoList(patientMrn);
        }catch (FeignException fe){
            if(fe.status() == 404){
                throw new NoDocumentsFoundException(fe.getMessage());
            }
        }
        return null;
    }

}

package gov.samhsa.c2s.c2suiapi.service;

import com.netflix.hystrix.exception.HystrixRuntimeException;
import feign.FeignException;
import gov.samhsa.c2s.c2suiapi.infrastructure.PhrClient;
import gov.samhsa.c2s.c2suiapi.service.exception.NoDocumentsFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PhrServiceImpl implements PhrService{

    private final PhrClient phrClient;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    public PhrServiceImpl(PhrClient phrClient) {
        this.phrClient = phrClient;
    }

    @Override
    public List<Object> getAllDocumentTypeCodesList(){
        return phrClient.getAllDocumentTypeCodesList();
    }

    @Override
    public List<Object> getPatientDocumentInfoList(String patientMrn){
        try{
            return phrClient.getPatientDocumentInfoList(patientMrn);
        }catch(HystrixRuntimeException err) {
            Throwable t = err.getCause();
            if(t instanceof FeignException && ((FeignException) t).status() == 404){
                throw new NoDocumentsFoundException(t.getMessage());
            }
        }
        return null;
    }

}

Throw custom error when status code is 404

#13763:As a developer, I will have implemented the Try My Policy UI and integrated with backend [v3.0]


/*
 *
		Fugerit Java Library is distributed under the terms of :

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

	Full license :
		http://www.apache.org/licenses/LICENSE-2.0

	Project site:
		http://www.fugerit.org/java/

	SCM site :
		https://github.com/fugerit79/fj-lib

 *
 */
package org.fugerit.java.core.lang.helpers;

public class ConcatHelper {

	public static final String CONCAT_SEPARATOR_DEFAULT = "/";

	public static String convertNullToBlank( String v ) {
		String r = "";
		if ( v != null ) {
			r = v;
		}
		return r;
	}

	public static String concatWithDefaultSeparator( String... values ) {
		return concat( CONCAT_SEPARATOR_DEFAULT, values );
	}

	public static String concat( String separator, String... values ) {
		StringBuffer buffer = new StringBuffer();
		buffer.append( convertNullToBlank( values[0] ) );
		for ( int k=1; k<values.length; k++ ) {
			buffer.append( CONCAT_SEPARATOR_DEFAULT );
			buffer.append( convertNullToBlank( values[k] ) );
		}
		return buffer.toString();
	}

}

/*
 *
		Fugerit Java Library is distributed under the terms of :

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

	Full license :
		http://www.apache.org/licenses/LICENSE-2.0

	Project site:
		http://www.fugerit.org/java/

	SCM site :
		https://github.com/fugerit79/fj-lib

 *
 */
package org.fugerit.java.core.lang.helpers;

public class ConcatHelper {

	public static final String CONCAT_SEPARATOR_DEFAULT = "/";

	public static String convertNullToBlank( String v ) {
		String r = "";
		if ( v != null ) {
			r = v;
		}
		return r;
	}

	public static String concatWithDefaultSeparator( String... values ) {
		return concat( CONCAT_SEPARATOR_DEFAULT, values );
	}

	public static String concat( String separator, String... values ) {
		StringBuffer buffer = new StringBuffer();
		buffer.append( convertNullToBlank( values[0] ) );
		for ( int k=1; k<values.length; k++ ) {
			buffer.append( separator );
			buffer.append( convertNullToBlank( values[k] ) );
		}
		return buffer.toString();
	}

}

Correct concat helper separator handler

Correct concat helper separator handler


package org.elasticsearch.mapping;

import java.beans.IntrospectionException;
import java.io.IOException;

import junit.framework.Assert;

import org.elasticsearch.mapping.model.Person;
import org.junit.Test;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;

/**
 * Test the mappings.
 *
 * @author luc boutier
 */
public class MappingBuilderTest {

    @Test
    public void testSimpleClassMapping() throws IntrospectionException, JsonGenerationException, JsonMappingException,
            IOException {
        MappingBuilder mappingBuilder = new MappingBuilder();
        mappingBuilder.initialize("org.elasticsearch.mapping.model");
        String personMapping = mappingBuilder.getMapping(Person.class);
        Assert.assertEquals(
                "{\"person\":{\"_type\":{\"index\":\"not_analyzed\",\"store\":false},\"_id\":{\"index\":\"no\",\"store\":false,\"path\":\"id\"},\"_source\":{\"enabled\":true},\"properties\":{\"lastname\":{\"include_in_all\":true,\"index\":\"analyzed\",\"store\":false,\"boost\":1.0,\"term_vector\":\"no\",\"type\":\"string\"},\"firstname\":{\"include_in_all\":false,\"index\":\"no\",\"store\":false,\"boost\":1.0,\"term_vector\":\"no\",\"type\":\"string\"}},\"_all\":{\"enabled\":true}}}",
                personMapping);
    }
}

package org.elasticsearch.mapping;

import java.beans.IntrospectionException;
import java.io.IOException;

import junit.framework.Assert;

import org.elasticsearch.mapping.model.Person;
import org.junit.Test;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;

/**
 * Test the mappings.
 *
 * @author luc boutier
 */
public class MappingBuilderTest {

    @Test
    public void testSimpleClassMapping() throws IntrospectionException, JsonGenerationException, JsonMappingException,
            IOException {
        MappingBuilder mappingBuilder = new MappingBuilder();
        mappingBuilder.initialize("org.elasticsearch.mapping.model");
        String personMapping = mappingBuilder.getMapping(Person.class);
        Assert.assertEquals(
                "{\"person\":{\"_type\":{\"index\":\"not_analyzed\",\"store\":false},\"_id\":{\"index\":\"no\",\"store\":false,\"path\":\"id\"},\"_source\":{\"enabled\":true},\"properties\":{\"address\":{\"properties\":{\"city\":{\"include_in_all\":false,\"index\":\"not_analyzed\",\"store\":false,\"boost\":1.0,\"term_vector\":\"no\",\"type\":\"string\"}},\"type\":\"nested\"},\"lastname\":{\"include_in_all\":true,\"index\":\"analyzed\",\"store\":false,\"boost\":1.0,\"term_vector\":\"no\",\"type\":\"string\"},\"firstname\":{\"include_in_all\":false,\"index\":\"no\",\"store\":false,\"boost\":1.0,\"term_vector\":\"no\",\"type\":\"string\"}},\"_all\":{\"enabled\":true}}}",
                personMapping);
    }
}

Fix test as we now have the address mapping (nested type)


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

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleSpawnPainting;
import protocolsupport.protocol.packet.middleimpl.PacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class SpawnPainting extends MiddleSpawnPainting<RecyclableCollection<PacketData>> {

	@Override
	public RecyclableCollection<PacketData> toData(ProtocolVersion version) {
		switch (direction) {
			case 0: {
				position.modifyZ(-1);
				break;
			}
			case 1: {
				position.modifyX(1);
				break;
			}
			case 2: {
				position.modifyZ(1);
				break;
			}
			case 3: {
				position.modifyX(-1);
				break;
			}
		}
		PacketData serializer = PacketData.create(ClientBoundPacket.PLAY_SPAWN_PAINTING_ID, version);
		serializer.writeInt(entityId);
		serializer.writeString(type);
		serializer.writeLegacyPositionI(position);
		return RecyclableSingletonList.create(serializer);
	}

}

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

import protocolsupport.api.ProtocolVersion;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleSpawnPainting;
import protocolsupport.protocol.packet.middleimpl.PacketData;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class SpawnPainting extends MiddleSpawnPainting<RecyclableCollection<PacketData>> {

	@Override
	public RecyclableCollection<PacketData> toData(ProtocolVersion version) {
		switch (direction) {
			case 0: {
				position.modifyZ(-1);
				break;
			}
			case 1: {
				position.modifyX(1);
				break;
			}
			case 2: {
				position.modifyZ(1);
				break;
			}
			case 3: {
				position.modifyX(-1);
				break;
			}
		}
		PacketData serializer = PacketData.create(ClientBoundPacket.PLAY_SPAWN_PAINTING_ID, version);
		serializer.writeInt(entityId);
		serializer.writeString(type);
		serializer.writeLegacyPositionI(position);
		serializer.writeInt(direction);
		return RecyclableSingletonList.create(serializer);
	}

}

Fix spawn painting encode for 1.4.7-1.6.5


package com.zygon.htm.core;

import com.google.common.util.concurrent.AbstractScheduledService;
import java.util.concurrent.TimeUnit;

/**
 *
 * @author zygon
 */
public abstract class AbstractScheduledServiceImpl extends AbstractScheduledService {

    public static final class Settings {

        private long period = 0;
        private TimeUnit timeUnit = TimeUnit.SECONDS;

        public long getPeriod() {
            return period;
        }

        public TimeUnit getTimeUnit() {
            return timeUnit;
        }

        public void setPeriod(long period) {
            this.period = period;
        }

        public void setTimeUnit(TimeUnit timeUnit) {
            this.timeUnit = timeUnit;
        }
    }

    private final Scheduler scheduler;

    protected AbstractScheduledServiceImpl(Settings settings) {
        super();

        if (settings == null) {
            // defaults
            settings = new Settings();
        }

        this.scheduler = Scheduler.newFixedRateSchedule(0, settings.getPeriod(), settings.getTimeUnit());
    }

    protected abstract void doRun() throws Exception;

    @Override
    protected final void runOneIteration() throws Exception {
        try {
            this.doRun();
        } catch (Exception e) {
            // TODO: log?
            e.printStackTrace();
        }
    }

    @Override
    protected final Scheduler scheduler() {
        return this.scheduler;
    }
}

package com.zygon.htm.core;

import com.google.common.util.concurrent.AbstractScheduledService;
import java.util.concurrent.TimeUnit;

/**
 *
 * @author zygon
 */
public abstract class AbstractScheduledServiceImpl extends AbstractScheduledService {

    public static final class Settings {

        public static Settings create(long period, TimeUnit timeUnit) {
            Settings s = new Settings();
            s.setPeriod(period);
            s.setTimeUnit(timeUnit);
            return s;
        }

        private long period = 0;
        private TimeUnit timeUnit = TimeUnit.SECONDS;

        public long getPeriod() {
            return period;
        }

        public TimeUnit getTimeUnit() {
            return timeUnit;
        }

        public void setPeriod(long period) {
            this.period = period;
        }

        public void setTimeUnit(TimeUnit timeUnit) {
            this.timeUnit = timeUnit;
        }
    }

    private final Scheduler scheduler;

    protected AbstractScheduledServiceImpl(Settings settings) {
        super();

        if (settings == null) {
            // defaults
            settings = new Settings();
        }

        this.scheduler = Scheduler.newFixedRateSchedule(0, settings.getPeriod(), settings.getTimeUnit());
    }

    protected abstract void doRun() throws Exception;

    @Override
    protected final void runOneIteration() throws Exception {
        try {
            this.doRun();
        } catch (Exception e) {
            // TODO: log?
            e.printStackTrace();
        }
    }

    @Override
    protected final Scheduler scheduler() {
        return this.scheduler;
    }
}

Add static factory method for settings.

Add static factory method for settings.


package seedu.ezdo.model.task;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

import seedu.ezdo.model.todo.StartDate;

public class StartDateTest {

    @Test
    public void isValidStartDate() {
        // invalid dates
        assertFalse(StartDate.isValidTaskDate(" ")); // spaces only
        assertFalse(StartDate.isValidTaskDate("next")); // non-numeric
        assertFalse(StartDate.isValidTaskDate("13 12 1999")); // spaces within
                                                              // digits
        assertFalse(StartDate.isValidTaskDate("05.10.1977")); // fullstops
                                                              // within digits
        assertFalse(StartDate.isValidTaskDate("22/11/q2r1")); // alphabets
                                                              // within digits

        // valid dates
        assertTrue(StartDate.isValidTaskDate("15/12/1992 10:12")); // month with
                                                                   // 31 days
        assertTrue(StartDate.isValidTaskDate("11/02/2014 07:21")); // month with
                                                                   // 30 days
        assertTrue(StartDate.isValidTaskDate("29/02/2003 20:21")); // leap year
    }

}

Remove extra line in line 33

Remove extra line in line 33


package org.rapidoid.test;

/*
 * #%L
 * rapidoid-commons
 * %%
 * Copyright (C) 2014 - 2015 Nikolche Mihajlovski and contributors
 * %%
 * 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.
 * #L%
 */

import org.junit.Before;
import org.rapidoid.log.Log;
import org.rapidoid.log.LogLevel;
import org.rapidoid.security.Roles;

public abstract class AbstractCommonsTest extends TestCommons {

	@Before
	public void openContext() {
		Roles.resetConfig();
		Log.setLogLevel(LogLevel.INFO);
	}

}

package org.rapidoid.test;

/*
 * #%L
 * rapidoid-commons
 * %%
 * Copyright (C) 2014 - 2015 Nikolche Mihajlovski and contributors
 * %%
 * 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.
 * #L%
 */

import org.junit.Before;
import org.rapidoid.config.Conf;
import org.rapidoid.log.Log;
import org.rapidoid.log.LogLevel;
import org.rapidoid.security.Roles;

public abstract class AbstractCommonsTest extends TestCommons {

	@Before
	public void openContext() {
		Conf.setRootPath(Conf.rootPathDefault());
		Roles.resetConfig();
		Log.setLogLevel(LogLevel.INFO);
	}

}

Reset root path config for each test.

Reset root path config for each test.


package com.proxerme.library.parameters;

import android.support.annotation.StringDef;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Class containing the the available countries, used for translator groups and industries.
 *
 * @author Ruben Gees
 */
public class CountryParameter {

    public static final String GERMAN = "de";
    public static final String ENGLISH = "en";
    public static final String JAPANESE = "jp";
    public static final String MISCELLANEOUS = "misc";

    private CountryParameter() {
    }

    /**
     * An annotation representing the available countries.
     */
    @StringDef({GERMAN, ENGLISH, JAPANESE, MISCELLANEOUS})
    @Retention(value = RetentionPolicy.SOURCE)
    @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
    public @interface Country {
    }
}

package com.proxerme.library.parameters;

import android.support.annotation.StringDef;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Class containing the the available countries, used for translator groups and industries.
 *
 * @author Ruben Gees
 */
public class CountryParameter {

    public static final String GERMAN = "de";
    public static final String ENGLISH = "en";
    public static final String UNITED_STATES = "us";
    public static final String JAPANESE = "jp";
    public static final String MISCELLANEOUS = "misc";

    private CountryParameter() {
    }

    /**
     * An annotation representing the available countries.
     */
    @StringDef({GERMAN, ENGLISH, UNITED_STATES, JAPANESE, MISCELLANEOUS})
    @Retention(value = RetentionPolicy.SOURCE)
    @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
    public @interface Country {
    }
}

Add united states to the languages

Add united states to the languages


package com.google.sps.servlets;

import com.google.appengine.api.users.UserServiceFactory;
import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/user-events")
public class UserProfileEventsServlet extends HttpServlet {
  private static final String email =
      UserServiceFactory.getUserService().getCurrentUser().getEmail();

  /** Gets the current user's corresponding events in DB */
  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

  }

  /** Updates the current user's corresponding events in DB */
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {

  }
}

package com.google.sps.servlets;

import com.google.appengine.api.users.UserServiceFactory;
import com.google.sps.data.EventVolunteering;
import com.google.sps.utilities.CommonUtils;
import com.google.sps.utilities.SpannerTasks;
import java.io.IOException;
import java.util.Set;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/user-events")
public class UserProfileEventsServlet extends HttpServlet {
  private static final String EVENT_TYPE = "event-type";
  private static final String VOLUNTEERING = "volunteering";
  private static final String email =
      UserServiceFactory.getUserService().getCurrentUser().getEmail();

  /** Gets the current user's corresponding events in DB */
  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    String eventType = request.getParameter(EVENT_TYPE);
    if (eventType.equals(VOLUNTEERING)) {
        Set<EventVolunteering> eventsVolunteering = SpannerTasks.getEventsVolunteeringByEmail(email);
        response.getWriter().println(CommonUtils.convertToJson(eventsVolunteering));
    }
  }

  /** Updates the current user's corresponding events in DB */
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {

  }
}

Add servlet functionality to retrieve events volunteering.


package com.github.steveice10.mc.protocol.packet.ingame.server.window;

import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.io.NetOutput;
import com.github.steveice10.packetlib.packet.Packet;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;

import java.io.IOException;

@Data
@Setter(AccessLevel.NONE)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor
public class ServerSetSlotPacket implements Packet {
    private int windowId;
    private int slot;
    private @NonNull ItemStack item;

    @Override
    public void read(NetInput in) throws IOException {
        this.windowId = in.readUnsignedByte();
        this.slot = in.readShort();
        this.item = ItemStack.read(in);
    }

    @Override
    public void write(NetOutput out) throws IOException {
        out.writeByte(this.windowId);
        out.writeShort(this.slot);
        ItemStack.write(out, this.item);
    }

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

package com.github.steveice10.mc.protocol.packet.ingame.server.window;

import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.io.NetOutput;
import com.github.steveice10.packetlib.packet.Packet;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;

import java.io.IOException;

@Data
@Setter(AccessLevel.NONE)
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@AllArgsConstructor
public class ServerSetSlotPacket implements Packet {
    private int windowId;
    private int slot;
    private ItemStack item;

    @Override
    public void read(NetInput in) throws IOException {
        this.windowId = in.readUnsignedByte();
        this.slot = in.readShort();
        this.item = ItemStack.read(in);
    }

    @Override
    public void write(NetOutput out) throws IOException {
        out.writeByte(this.windowId);
        out.writeShort(this.slot);
        ItemStack.write(out, this.item);
    }

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

Remove @NonNull from a nullable parameter

Slot data can be null: https://wiki.vg/Slot_Data


/**
 * Copyright (C) 2014 android10.org. All rights reserved.
 * @author Fernando Cejas (the android10 coder)
 */
package com.fernandocejas.android10.sample.presentation.navigation;

import android.content.Context;
import android.content.Intent;
import com.fernandocejas.android10.sample.presentation.view.activity.UserDetailsActivity;
import com.fernandocejas.android10.sample.presentation.view.activity.UserListActivity;
import javax.inject.Inject;

/**
 * Class used to navigate through the application.
 */
public class Navigator {

  @Inject
  public void Navigator() {
    //empty
  }

  /**
   * Goes to the user list screen.
   *
   * @param context A Context needed to open the destiny activity.
   */
  public void navigateToUserList(Context context) {
    if (context != null) {
      Intent intentToLaunch = UserListActivity.getCallingIntent(context);
      context.startActivity(intentToLaunch);
    }
  }

  /**
   * Goes to the user details screen.
   *
   * @param context A Context needed to open the destiny activity.
   */
  public void navigateToUserDetails(Context context, int userId) {
    if (context != null) {
      Intent intentToLaunch = UserDetailsActivity.getCallingIntent(context, userId);
      context.startActivity(intentToLaunch);
    }
  }
}

/**
 * Copyright (C) 2014 android10.org. All rights reserved.
 * @author Fernando Cejas (the android10 coder)
 */
package com.fernandocejas.android10.sample.presentation.navigation;

import android.content.Context;
import android.content.Intent;
import com.fernandocejas.android10.sample.presentation.view.activity.UserDetailsActivity;
import com.fernandocejas.android10.sample.presentation.view.activity.UserListActivity;
import javax.inject.Singleton;

/**
 * Class used to navigate through the application.
 */
@Singleton
public class Navigator {

  public void Navigator() {
    //empty
  }

  /**
   * Goes to the user list screen.
   *
   * @param context A Context needed to open the destiny activity.
   */
  public void navigateToUserList(Context context) {
    if (context != null) {
      Intent intentToLaunch = UserListActivity.getCallingIntent(context);
      context.startActivity(intentToLaunch);
    }
  }

  /**
   * Goes to the user details screen.
   *
   * @param context A Context needed to open the destiny activity.
   */
  public void navigateToUserDetails(Context context, int userId) {
    if (context != null) {
      Intent intentToLaunch = UserDetailsActivity.getCallingIntent(context, userId);
      context.startActivity(intentToLaunch);
    }
  }
}

Add singleton scope to navigator.

Add singleton scope to navigator.


package devopsdistilled.operp.client.items.controllers;

import devopsdistilled.operp.client.abstracts.SubTaskPaneController;
import devopsdistilled.operp.client.items.exceptions.ItemNameExistsException;
import devopsdistilled.operp.client.items.exceptions.ProductBrandPairExistsException;
import devopsdistilled.operp.server.data.entity.items.Item;

public interface CreateItemPaneController extends SubTaskPaneController {

	void validate(Item item) throws ProductBrandPairExistsException,
			ItemNameExistsException;

	Item save(Item item);

}

package devopsdistilled.operp.client.items.controllers;

import devopsdistilled.operp.client.abstracts.SubTaskPaneController;
import devopsdistilled.operp.client.items.exceptions.ItemNameExistsException;
import devopsdistilled.operp.client.items.exceptions.NullFieldException;
import devopsdistilled.operp.client.items.exceptions.ProductBrandPairExistsException;
import devopsdistilled.operp.server.data.entity.items.Item;

public interface CreateItemPaneController extends SubTaskPaneController {

	void validate(Item item) throws ProductBrandPairExistsException,
			ItemNameExistsException, NullFieldException;

	Item save(Item item);

}

Add throws declaration for NullFieldException

OPEN - task 45: Creation of Item with null value for Product and Brand
possible
http://github.com/DevOpsDistilled/OpERP/issues/issue/45


package au.com.codeka.warworlds.game.starfield;

import java.io.IOException;

import org.andengine.entity.scene.Scene;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.Window;
import au.com.codeka.warworlds.BaseGlActivity;
import au.com.codeka.warworlds.R;
import au.com.codeka.warworlds.model.EmpireShieldManager;

/** This is the base activity for activities that show a starfield. */
@SuppressLint("Registered") // it's a base class
public abstract class BaseStarfieldActivity extends BaseGlActivity {
    protected StarfieldSceneManager mStarfield;

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);

        EmpireShieldManager.i.clearTextureCache();

        mStarfield = new StarfieldSceneManager(this);
    }

    @Override
    protected int getRenderSurfaceViewID() {
        return R.id.starfield;
    }

    @Override
    protected void onCreateResources() throws IOException {
        mStarfield.onLoadResources();
    }

    @Override
    protected Scene onCreateScene() throws IOException {
        return mStarfield.createScene();
    }

    @Override
    public void onStart() {
        super.onStart();
        mStarfield.onStart();
    }

    @Override
    public void onStop() {
        super.onStop();
        mStarfield.onStop();
    }
}

package au.com.codeka.warworlds.game.starfield;

import java.io.IOException;

import org.andengine.entity.scene.Scene;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.Window;
import au.com.codeka.warworlds.BaseGlActivity;
import au.com.codeka.warworlds.R;
import au.com.codeka.warworlds.model.EmpireShieldManager;

/** This is the base activity for activities that show a starfield. */
@SuppressLint("Registered") // it's a base class
public abstract class BaseStarfieldActivity extends BaseGlActivity {
    protected StarfieldSceneManager mStarfield;

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);

        mStarfield = new StarfieldSceneManager(this);
    }

    @Override
    protected int getRenderSurfaceViewID() {
        return R.id.starfield;
    }

    @Override
    protected void onCreateResources() throws IOException {
        mStarfield.onLoadResources();
    }

    @Override
    protected Scene onCreateScene() throws IOException {
        return mStarfield.createScene();
    }

    @Override
    public void onStart() {
        super.onStart();
        mStarfield.onStart();
    }

    @Override
    public void onResume() {
        super.onResume();
        EmpireShieldManager.i.clearTextureCache();
    }

    @Override
    public void onStop() {
        super.onStop();
        mStarfield.onStop();
    }
}

Clear the texture cache in onResume, not onCreate().


package org.workcraft.plugins.circuit.tools;

import java.awt.Color;

import org.workcraft.gui.graph.tools.Decoration;

public interface StateDecoration extends Decoration {
    boolean showForcedInit();

    class Empty implements StateDecoration {

        @Override
        public Color getColorisation() {
            return Decoration.Empty.INSTANCE.getColorisation();
        }

        @Override
        public Color getBackground() {
            return Decoration.Empty.INSTANCE.getBackground();
        }

        @Override
        public boolean showForcedInit() {
            return true;
        }

        public static final Empty INSTANCE = new Empty();
    }

}

package org.workcraft.plugins.circuit.tools;

import java.awt.Color;

import org.workcraft.gui.graph.tools.Decoration;

public interface StateDecoration extends Decoration {
    boolean showForcedInit();

    class Empty implements StateDecoration {

        @Override
        public Color getColorisation() {
            return Decoration.Empty.INSTANCE.getColorisation();
        }

        @Override
        public Color getBackground() {
            return Decoration.Empty.INSTANCE.getBackground();
        }

        @Override
        public boolean showForcedInit() {
            return true;
        }

        public static final StateDecoration.Empty INSTANCE = new StateDecoration.Empty();
    }

}

Clarify ambiguous reference to Empty class


/*
 * Copyright 2012 SURFnet bv, The Netherlands
 *
 * 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 nl.surfnet.coin.selfservice.control;

import org.junit.Before;
import org.junit.Test;
import org.springframework.web.servlet.ModelAndView;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;

/**
 * Test class for {@link LogoutController}
 */
public class LogoutControllerTest {
  private LogoutController controller;

  @Before
  public void setUp() throws Exception {
    controller = new LogoutController();
  }

  @Test
  public void testLogout() throws Exception {
    final ModelAndView modelAndView = controller.logout();
    assertEquals("logout", modelAndView.getViewName());
    assertTrue(modelAndView.getModelMap().isEmpty());
  }
}

/*
 * Copyright 2012 SURFnet bv, The Netherlands
 *
 * 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 nl.surfnet.coin.selfservice.control;

import org.junit.Before;
import org.junit.Test;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.bind.support.SimpleSessionStatus;
import org.springframework.web.servlet.ModelAndView;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;

/**
 * Test class for {@link LogoutController}
 */
public class LogoutControllerTest {
  private LogoutController controller;

  @Before
  public void setUp() throws Exception {
    controller = new LogoutController();
  }

  @Test
  public void testLogout() throws Exception {
    SessionStatus status = new SimpleSessionStatus();
    final ModelAndView modelAndView = controller.logout(status);
    assertEquals("logout", modelAndView.getViewName());
    assertTrue(modelAndView.getModelMap().isEmpty());
  }
}

Clear session status on logout

Clear session status on logout


package nl.ekholabs.nlp.controller;

import java.io.IOException;

import nl.ekholabs.nlp.model.TextResponse;
import nl.ekholabs.nlp.service.SpeechToTextService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;

@RestController
public class SpeechToTextController {

  private final SpeechToTextService speechToTextService;

  @Autowired
  public SpeechToTextController(final SpeechToTextService speechToTextService) {
    this.speechToTextService = speechToTextService;
  }

  @PostMapping(path = "/", produces = APPLICATION_JSON_UTF8_VALUE, consumes = MULTIPART_FORM_DATA_VALUE)
  public TextResponse process(final @RequestParam(value = "input") MultipartFile fileToProcess) throws IOException {

    final String outputText = speechToTextService.processSpeech(fileToProcess.getBytes());
    return new TextResponse(outputText);
  }
}

package nl.ekholabs.nlp.controller;

import java.io.IOException;

import nl.ekholabs.nlp.model.TextResponse;
import nl.ekholabs.nlp.service.SpeechToTextService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import static org.springframework.http.MediaType.APPLICATION_JSON_UTF8_VALUE;
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;

@RestController
public class SpeechToTextController {

  private final SpeechToTextService speechToTextService;

  @Autowired
  public SpeechToTextController(final SpeechToTextService speechToTextService) {
    this.speechToTextService = speechToTextService;
  }

  @PostMapping(produces = APPLICATION_JSON_UTF8_VALUE, consumes = MULTIPART_FORM_DATA_VALUE)
  public TextResponse process(final @RequestParam(value = "input") MultipartFile fileToProcess) throws IOException {

    final String outputText = speechToTextService.processSpeech(fileToProcess.getBytes());
    return new TextResponse(outputText);
  }
}

Remove path attribute from PostMapping

Remove path attribute from PostMapping


package com.elmakers.mine.bukkit.action.builtin;

import com.elmakers.mine.bukkit.action.BaseSpellAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.block.MaterialBrush;
import com.elmakers.mine.bukkit.api.spell.SpellResult;
import org.bukkit.block.Block;

public class CheckBlockAction extends BaseSpellAction {
    @SuppressWarnings("deprecation")
    @Override
    public SpellResult perform(CastContext context) {
        MaterialBrush brush = context.getBrush();
        Block block = context.getTargetBlock();
        if (brush != null && brush.isErase()) {
            if (!context.hasBreakPermission(block)) {
                return SpellResult.STOP;
            }
        } else {
            if (!context.hasBuildPermission(block)) {
                return SpellResult.STOP;
            }
        }
        if (!context.isDestructible(block)) {
            return SpellResult.STOP;
        }
        return SpellResult.CAST;
    }

    @Override
    public boolean requiresTarget() {
        return true;
    }
}

package com.elmakers.mine.bukkit.action.builtin;

import com.elmakers.mine.bukkit.action.BaseSpellAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.block.MaterialBrush;
import com.elmakers.mine.bukkit.api.spell.Spell;
import com.elmakers.mine.bukkit.api.spell.SpellResult;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;

import java.util.Set;

public class CheckBlockAction extends BaseSpellAction {
    private Set<Material> allowed;

    @Override
    public void initialize(Spell spell, ConfigurationSection parameters)
    {
        super.initialize(spell, parameters);
        allowed = spell.getController().getMaterialSet(parameters.getString("allowed"));
    }

    @SuppressWarnings("deprecation")
    @Override
    public SpellResult perform(CastContext context) {
        MaterialBrush brush = context.getBrush();
        Block block = context.getTargetBlock();
        if (allowed != null) {
            if (!allowed.contains(block.getType())) return SpellResult.STOP;
        } else {
            if (brush != null && brush.isErase()) {
                if (!context.hasBreakPermission(block)) {
                    return SpellResult.STOP;
                }
            } else {
                if (!context.hasBuildPermission(block)) {
                    return SpellResult.STOP;
                }
            }
            if (!context.isDestructible(block)) {
                return SpellResult.STOP;
            }
        }
        return SpellResult.CAST;
    }

    @Override
    public boolean requiresTarget() {
        return true;
    }
}

Add "allowed" parameter to CheckBlock action


package org.metaborg.meta.lang.dynsem.interpreter.nodes.rules;

import org.metaborg.meta.lang.dynsem.interpreter.DynSemLanguage;
import org.metaborg.meta.lang.dynsem.interpreter.nodes.DynSemRootNode;

import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;

public abstract class Rule extends DynSemRootNode {

	private final DynSemLanguage lang;

	public Rule(DynSemLanguage lang, SourceSection source, FrameDescriptor fd) {
		super(lang, source, fd);
		this.lang = lang;
	}

	public Rule(DynSemLanguage lang, SourceSection source) {
		this(lang, source, null);
	}

	protected DynSemLanguage language() {
		return lang;
	}

	@Override
	public abstract RuleResult execute(VirtualFrame frame);

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

	@Override
	protected boolean isCloneUninitializedSupported() {
		return false;
	}

	@Override
	protected abstract Rule cloneUninitialized();

	public Rule makeUninitializedClone() {
		return cloneUninitialized();
	}
}

package org.metaborg.meta.lang.dynsem.interpreter.nodes.rules;

import org.metaborg.meta.lang.dynsem.interpreter.DynSemLanguage;
import org.metaborg.meta.lang.dynsem.interpreter.nodes.DynSemRootNode;

import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;

public abstract class Rule extends DynSemRootNode {

	private final DynSemLanguage lang;

	public Rule(DynSemLanguage lang, SourceSection source, FrameDescriptor fd) {
		super(lang, source, fd);
		this.lang = lang;
	}

	public Rule(DynSemLanguage lang, SourceSection source) {
		this(lang, source, null);
	}

	protected DynSemLanguage language() {
		return lang;
	}

	@Override
	public abstract RuleResult execute(VirtualFrame frame);

	@Override
	public boolean isCloningAllowed() {
		return true;
	}

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

	@Override
	protected abstract Rule cloneUninitialized();

	public Rule makeUninitializedClone() {
		return cloneUninitialized();
	}
}

Revert "Temporarily disallow rule cloning (for benchmarks)"

This reverts commit 15c01bdcc559e04fad09f19672e7306b3e316f2a.


package ca.coglinc.gradle.plugins.javacc;

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

import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.testfixtures.ProjectBuilder;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class JavaccPluginTest {
    private Project project;

    @Before
    public void applyJavaccPluginToProject() {
        project = ProjectBuilder.builder().build();
        Map<String, String> pluginNames = new HashMap<String, String>(1);
        pluginNames.put("plugin", "ca.coglinc.javacc");

        project.apply(pluginNames);
    }

    @Test
    public void pluginAddsCompileJavaccTaskToProject() {
        final Task compileJavaccTask = project.getTasks().getByName("compileJavacc");
        Assert.assertNotNull(compileJavaccTask);
        Assert.assertTrue(compileJavaccTask instanceof CompileJavaccTask);
    }

    @Test
    public void pluginAddsCompileJJTreeTaskToProject() {
        final Task compileJJTreeTask = project.getTasks().getByName("compileJjtree");
        Assert.assertNotNull(compileJJTreeTask);
        Assert.assertTrue(compileJJTreeTask instanceof CompileJjTreeTask);
    }

    @Test
    public void pluginAddsCompileJjdocTaskToProject() {
        final Task compileJjdocTask = project.getTasks().getByName("jjdoc");
        Assert.assertNotNull(compileJjdocTask);
        Assert.assertTrue(compileJjdocTask instanceof CompileJjdocTask);
    }
}

package ca.coglinc.gradle.plugins.javacc;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.artifacts.Configuration;
import org.gradle.testfixtures.ProjectBuilder;
import org.junit.Before;
import org.junit.Test;

public class JavaccPluginTest {
    private JavaccPlugin plugin;
    private Project project;

    @Before
    public void applyJavaccPluginToProject() {
        plugin = new JavaccPlugin();
        project = ProjectBuilder.builder().build();

        plugin.apply(project);
    }

    @Test
    public void pluginAddsCompileJavaccTaskToProject() {
        final Task compileJavaccTask = project.getTasks().getByName("compileJavacc");

        assertNotNull(compileJavaccTask);
        assertTrue(compileJavaccTask instanceof CompileJavaccTask);
    }

    @Test
    public void pluginAddsCompileJJTreeTaskToProject() {
        final Task compileJJTreeTask = project.getTasks().getByName("compileJjtree");

        assertNotNull(compileJJTreeTask);
        assertTrue(compileJJTreeTask instanceof CompileJjTreeTask);
    }

    @Test
    public void pluginAddsCompileJjdocTaskToProject() {
        final Task compileJjdocTask = project.getTasks().getByName("jjdoc");

        assertNotNull(compileJjdocTask);
        assertTrue(compileJjdocTask instanceof CompileJjdocTask);
    }

    @Test
    public void pluginDefinesDefaultDependencyOnJavacc() {
        Configuration javaccDependencyConfiguration = project.getConfigurations().getByName("javacc");

        assertNotNull(javaccDependencyConfiguration);
    }
}

Add unit test to verify javacc dependency configuration


package com.example.mirnabouchra.cloudolympics;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;

import com.firebase.client.Firebase;

/**
 * Created by steren
 */
public class GameActivity extends Activity {
    private static final String LOG_TAG = GameActivity.class.getSimpleName();
    protected Firebase firebaseRef;
    protected String code;
    protected String playerID;

    // Called when the activity is first created.
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // get the room code
        String code = getIntent().getStringExtra("code");
        Log.d(LOG_TAG, "Room code is " + code);

        // get the player ID
        String playerID = getIntent().getStringExtra("player");
        Log.d(LOG_TAG, "Player ID is " + playerID);

        // TODO for testing purposes only
        playerID = "player1";

        Firebase.setAndroidContext(this);
        firebaseRef = new Firebase(Consts.FIREBASE_URL);
        firebaseRef = firebaseRef.child("room");
        firebaseRef = firebaseRef.child(code);
        firebaseRef = firebaseRef.child("game");
        firebaseRef = firebaseRef.child("data");
        firebaseRef = firebaseRef.child("players");
        firebaseRef = firebaseRef.child(playerID);

    }

}

package com.example.mirnabouchra.cloudolympics;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;

import com.firebase.client.Firebase;

/**
 * Created by steren
 */
public class GameActivity extends Activity {
    private static final String LOG_TAG = GameActivity.class.getSimpleName();
    protected Firebase firebaseRef;
    protected String code;
    protected String playerID;

    // Called when the activity is first created.
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // get the room code
        String code = getIntent().getStringExtra("code");
        Log.d(LOG_TAG, "Room code is " + code);

        // get the player ID
        String playerID = getIntent().getStringExtra("playerId");
        Log.d(LOG_TAG, "Player ID is " + playerID);

        Firebase.setAndroidContext(this);
        firebaseRef = new Firebase(Consts.FIREBASE_URL);
        firebaseRef = firebaseRef.child("room");
        firebaseRef = firebaseRef.child(code);
        firebaseRef = firebaseRef.child("game");
        firebaseRef = firebaseRef.child("data");
        firebaseRef = firebaseRef.child("players");
        firebaseRef = firebaseRef.child(playerID);

    }

}

Save tap number to actual player ID received from intent


package com.davidmogar.nji;

import com.davidmogar.nji.lexicon.Lexicon;
import com.davidmogar.nji.syntactic.Parser;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class Main {

    public static void main(String[] args) {
        if (args.length < 1) {
            System.err.println("Input file expected.");
            System.exit(0);
        }

        File inputFile = null;
        FileReader fileReader = null;
        try {
            inputFile = new File(args[0]);
            fileReader = new FileReader(inputFile);
        } catch (IOException e) {
            System.err.println(e.getMessage());
            System.exit(-1);
        }

        Lexicon lexicon = new Lexicon(fileReader);
        Parser parser = new Parser(lexicon);
        parser.run();
    }
}

package com.davidmogar.nji;

import com.davidmogar.nji.lexicon.Lexicon;
import com.davidmogar.nji.syntactic.Parser;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class Main {

    public static void main(String[] args) {
        if (args.length < 1) {
            System.err.println("Input file expected.");
            System.exit(0);
        }

        File inputFile = null;
        FileReader fileReader = null;
        try {
            inputFile = new File(args[0]);
            fileReader = new FileReader(inputFile);
        } catch (IOException e) {
            System.err.println(e.getMessage());
            System.exit(-1);
        }

        Lexicon lexicon = new Lexicon(fileReader);
        Parser parser = new Parser(lexicon);
        parser.run();
        System.out.println("fin");
    }
}

Add code to test the parser

Add code to test the parser


package info.u_team.u_team_test.blockentity;

import info.u_team.u_team_core.blockentity.UBlockEntity;
import info.u_team.u_team_test.init.TestBlockEntityTypes;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;

public class BasicSyncBlockEntity extends UBlockEntity {

	public BasicSyncBlockEntity(BlockPos pos, BlockState state) {
		super(TestBlockEntityTypes.BASIC_SYNC.get(), pos, state);
	}

}

package info.u_team.u_team_test.blockentity;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;

import com.mojang.logging.LogUtils;

import info.u_team.u_team_core.blockentity.UBlockEntity;
import info.u_team.u_team_test.init.TestBlockEntityTypes;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.block.state.BlockState;

public class BasicSyncBlockEntity extends UBlockEntity {

	private static final Logger LOGGER = LogUtils.getLogger();

	public BasicSyncBlockEntity(BlockPos pos, BlockState state) {
		super(TestBlockEntityTypes.BASIC_SYNC.get(), pos, state);
	}

	@Override
	public void sendChunkLoadData(CompoundTag tag) {
		tag.putString("data", "This is chunk load data");

		logMethod(tag);
	}

	@Override
	public void handleChunkLoadData(CompoundTag tag) {
		logMethod(tag);
	}

	private void logMethod(Object data) {
		final String marker = StringUtils.repeat('#', 70);
		final String methodName = StackWalker.getInstance().walk(frames -> frames.skip(1).findFirst().map(StackWalker.StackFrame::getMethodName)).get();
		final String side = hasLevel() ? (level.isClientSide() ? "client" : "server") : "unknown";

		LOGGER.info(marker);
		LOGGER.info("# Method '{}' was called", methodName);
		LOGGER.info("# Side is '{}'", side);
		if (data != null) {
			LOGGER.info("# Data is '{}'", data.toString());
		}
		LOGGER.info(marker);
	}
}

Add test for chunk load data

Add test for chunk load data


package org.granite.classification.model;

import java.util.TreeSet;

public class TrainingText implements Comparable<TrainingText> {
    private int id;
    private TreeSet<String> classifications = new TreeSet<>();
    private TreeSet<String> wordBag = new TreeSet<>();
    private String text;

    TrainingText(){}

    public TrainingText(final int id, final TreeSet<String> classifications, final String text) {
        this.id = id;
        this.classifications = classifications;
        this.text = text;
    }

    public int getId() {
        return id;
    }

    public TreeSet<String> getClassifications() {
        return classifications;
    }

    public TreeSet<String> getWordBag() {
        return wordBag;
    }

    public String getText() {
        return text;
    }

    @Override
    public int compareTo(TrainingText trainingText) {
        return Integer.compare(id, trainingText.getId());
    }

    @Override
    public boolean equals(Object obj) {
        return obj instanceof TrainingText
                && getId() == ((TrainingText) obj).getId();
    }

    @Override
    public int hashCode() {
        return getId();
    }
}

package org.granite.classification.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.util.TreeSet;

@JsonIgnoreProperties(ignoreUnknown = true)
public class TrainingText implements Comparable<TrainingText> {
    private int id;
    private TreeSet<String> classifications = new TreeSet<>();
    private TreeSet<String> wordBag = new TreeSet<>();
    private String text;

    TrainingText(){}

    public TrainingText(final int id, final TreeSet<String> classifications, final String text) {
        this.id = id;
        this.classifications = classifications;
        this.text = text;
    }

    public int getId() {
        return id;
    }

    public TreeSet<String> getClassifications() {
        return classifications;
    }

    public TreeSet<String> getWordBag() {
        return wordBag;
    }

    public String getText() {
        return text;
    }

    @Override
    public int compareTo(TrainingText trainingText) {
        return Integer.compare(id, trainingText.getId());
    }

    @Override
    public boolean equals(Object obj) {
        return obj instanceof TrainingText
                && getId() == ((TrainingText) obj).getId();
    }

    @Override
    public int hashCode() {
        return getId();
    }
}

Add ignoreUnknown to training text type

Add ignoreUnknown to training text type


/*
 * Copyright 2012 JBoss Inc
 *
 * 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.drools.planner.core.heuristic.selector.common.iterator;

import java.util.Iterator;
import java.util.List;
import java.util.Random;

/**
 * This {@link Iterator} does not shuffle and is never ending.
 * @param <S>
 */
public class CachedListRandomIterator<S> implements Iterator<S>  {

    protected final List<S> cachedList;
    protected final Random workingRandom;

    public CachedListRandomIterator(List<S> cachedList, Random workingRandom) {
        this.cachedList = cachedList;
        this.workingRandom = workingRandom;
    }

    public boolean hasNext() {
        return true;
    }

    public S next() {
        int index = workingRandom.nextInt(cachedList.size());
        return cachedList.get(index);
    }

    public void remove() {
        throw new UnsupportedOperationException("Remove is not supported.");
    }

}

/*
 * Copyright 2012 JBoss Inc
 *
 * 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.drools.planner.core.heuristic.selector.common.iterator;

import java.util.Iterator;
import java.util.List;
import java.util.Random;

/**
 * This {@link Iterator} does not shuffle and is never ending.
 * @param <S>
 */
public class CachedListRandomIterator<S> implements Iterator<S>  {

    protected final List<S> cachedList;
    protected final Random workingRandom;
    protected final boolean notEmpty;

    public CachedListRandomIterator(List<S> cachedList, Random workingRandom) {
        this.cachedList = cachedList;
        this.workingRandom = workingRandom;
        notEmpty = !cachedList.isEmpty();
    }

    public boolean hasNext() {
        return notEmpty;
    }

    public S next() {
        int index = workingRandom.nextInt(cachedList.size());
        return cachedList.get(index);
    }

    public void remove() {
        throw new UnsupportedOperationException("Remove is not supported.");
    }

}

Fix IllegalArgumentException in Random.nextInt (thanks to Prabakar)


package sourcecoded.core.configuration.gui;

import cpw.mods.fml.client.config.GuiConfig;
import net.minecraft.client.gui.GuiScreen;
import sourcecoded.core.configuration.SCConfigManager;

public class SourceConfigBaseGui extends GuiConfig {

    public SourceConfigBaseGui(GuiScreen parentScreen) {
        super(parentScreen, SourceConfigGuiFactory.createElements(SCConfigManager.getConfig()), "sourcecodedcore", false, false, "SourceCodedCore");
    }

}

package sourcecoded.core.configuration.gui;

import cpw.mods.fml.client.config.GuiConfig;
import net.minecraft.client.gui.GuiScreen;
import sourcecoded.core.configuration.SCConfigManager;

public class SourceConfigBaseGui extends GuiConfig {

    static String modid;
    static String name;
    static SourceConfig config;
    static List<IConfigElement> elements;

    public SourceConfigBaseGui(GuiScreen parentScreen) {
        super(parentScreen, elements, modid, false, false, modid);
    }

    public static void injectGuiContext(SourceConfigGuiFactory factory) {
        this.modid = factory.modid;
        this.name = this.modid;
        this.config = factory.config;
        this.elements = SourceConfigGuiFactory.createElements(factory.config);
    }

}

Update BaseGui to use contexts

Update BaseGui to use contexts


package info.u_team.u_team_core.screen;

import com.mojang.blaze3d.matrix.MatrixStack;

import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

public class UBasicContainerScreen<T extends Container> extends UContainerScreen<T> {

	public UBasicContainerScreen(T container, PlayerInventory playerInventory, ITextComponent title, ResourceLocation background, int xSize, int ySize) {
		super(container, playerInventory, title, background);
		setSize(xSize, ySize);
	}

	@Override
	public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
		func_230446_a_(matrixStack);
		super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks);
		field_230710_m_.forEach(widget -> widget.func_230443_a_(matrixStack, mouseX, mouseY));
		func_230459_a_(matrixStack, mouseX, mouseY);
	}

}

package info.u_team.u_team_core.screen;

import com.mojang.blaze3d.matrix.MatrixStack;

import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

public class UBasicContainerScreen<T extends Container> extends UContainerScreen<T> {

	public UBasicContainerScreen(T container, PlayerInventory playerInventory, ITextComponent title, ResourceLocation background) {
		super(container, playerInventory, title, background);
	}

	public UBasicContainerScreen(T container, PlayerInventory playerInventory, ITextComponent title, ResourceLocation background, int xSize, int ySize) {
		super(container, playerInventory, title, background);
		setSize(xSize, ySize);
	}

	@Override
	public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
		func_230446_a_(matrixStack);
		super.func_230430_a_(matrixStack, mouseX, mouseY, partialTicks);
		field_230710_m_.forEach(widget -> widget.func_230443_a_(matrixStack, mouseX, mouseY));
		func_230459_a_(matrixStack, mouseX, mouseY);
	}

}

Add also ctor without setSize back

Add also ctor without setSize back


package com.cosium.openapi.annotation_processor;

import com.cosium.openapi.annotation_processor.standard.ParserTester;
import com.cosium.openapi.annotation_processor.standard.PathUtils;
import org.junit.Test;

import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * Created on 13/07/17.
 *
 * @author Reda.Housni-Alaoui
 */
public class StandardTest {

    private final Path basePath;

    public StandardTest() throws Exception{
        URL url = getClass().getResource("/standard");
        this.basePath = Paths.get(url.toURI());
    }

    @Test
    public void test() throws Exception{
        PathUtils
                .subDirectories(basePath)
                .stream()
                .map(ParserTester::new)
                .forEach(parserTester -> {
                    try {
                        parserTester.test();
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                });
    }

}

package com.cosium.openapi.annotation_processor;

import com.cosium.openapi.annotation_processor.standard.ParserTester;
import com.cosium.openapi.annotation_processor.standard.PathUtils;
import org.junit.Test;

import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * Created on 13/07/17.
 *
 * @author Reda.Housni-Alaoui
 */
public class StandardTest {

    private final Path basePath;

    public StandardTest() throws Exception {
        URL url = getClass().getResource("/standard");
        this.basePath = Paths.get(url.toURI());
    }

    @Test
    public void test() throws Exception {
        PathUtils
                .subDirectories(basePath)
                .stream()
                .map(ParserTester::new)
                .forEach(parserTester -> {
                    try {
                        parserTester.test();
                    } catch (Exception e) {
                        throw new RuntimeException(e);
                    }
                });
    }

}

Create a standard test system

Create a standard test system


package org.helioviewer.plugins.eveplugin.view.linedataselector.cellrenderer;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

import org.helioviewer.plugins.eveplugin.view.linedataselector.LineDataSelectorElement;
import org.helioviewer.plugins.eveplugin.view.linedataselector.LineDateSelectorTablePanel;

public class LoadingCellRenderer extends DefaultTableCellRenderer {

    private final JProgressBar downloadProgressBar = new JProgressBar();

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        LineDataSelectorElement element = (LineDataSelectorElement) value;
        if (element.isDownloading()) {
            downloadProgressBar.setIndeterminate(true);
            downloadProgressBar.setVisible(element.isDownloading());
            downloadProgressBar.setBorder(LineDateSelectorTablePanel.commonBorder);
            return downloadProgressBar;
        } else {
            JPanel p = new JPanel();
            p.setBorder(LineDateSelectorTablePanel.commonBorder);
            p.setBackground(Color.WHITE);
            return p;
        }
    }

}

package org.helioviewer.plugins.eveplugin.view.linedataselector.cellrenderer;

import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

import org.helioviewer.plugins.eveplugin.view.linedataselector.LineDataSelectorElement;
import org.helioviewer.plugins.eveplugin.view.linedataselector.LineDateSelectorTablePanel;

public class LoadingCellRenderer extends DefaultTableCellRenderer {

    private final JProgressBar downloadProgressBar = new JProgressBar();

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        LineDataSelectorElement element = (LineDataSelectorElement) value;
        if (element.isDownloading()) {
            downloadProgressBar.setIndeterminate(true);
            downloadProgressBar.setVisible(element.isDownloading());
            downloadProgressBar.setBorder(LineDateSelectorTablePanel.commonBorder);
            downloadProgressBar.setOpaque(false);
            return downloadProgressBar;
        } else {
            JLabel p = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            p.setBorder(LineDateSelectorTablePanel.commonBorder);
            p.setText("");
            return p;
        }
    }

}

Fix loading panel not selected

Fix loading panel not selected

git-svn-id: 4e353c0944fe8da334633afc35765ef362dec675@4467 b4e469a2-07ce-4b26-9273-4d7d95a670c7


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

import edu.emory.mathcs.backport.java.util.concurrent.Executor;
import edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor;

/**
 *
 * @version $Revision$
 */
public class DefaultThreadPools {

    private static final Executor defaultPool = new ScheduledThreadPoolExecutor(5);
    private static final TaskRunnerFactory defaultTaskRunnerFactory = new TaskRunnerFactory(defaultPool,10);

    public static Executor getDeaultPool() {
        return defaultPool;
    }

    public static TaskRunnerFactory getDefaultTaskRunnerFactory() {
        return defaultTaskRunnerFactory;
    }

}

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

import edu.emory.mathcs.backport.java.util.concurrent.Executor;
import edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor;
import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory;

/**
 *
 * @version $Revision$
 */
public class DefaultThreadPools {

    private static final Executor defaultPool;
    static {
        defaultPool = new ScheduledThreadPoolExecutor(5, new ThreadFactory() {
            public Thread newThread(Runnable runnable) {
                Thread thread = new Thread(runnable, "ActiveMQ Default Thread Pool Thread");
                thread.setDaemon(true);
                return thread;
            }
        });
    }

    private static final TaskRunnerFactory defaultTaskRunnerFactory = new TaskRunnerFactory(defaultPool,10);

    public static Executor getDeaultPool() {
        return defaultPool;
    }

    public static TaskRunnerFactory getDefaultTaskRunnerFactory() {
        return defaultTaskRunnerFactory;
    }

}

Make the default thread pool create deamon threads

git-svn-id: 7f3df76e74c7ad56904d6048df705810748eb1a6@360169 13f79535-47bb-0310-9956-ffa450edef68