/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package wicket.markup;

import wicket.MarkupContainer;

/**
 * To be implemented by MarkupContainers which wish to implement their own
 * algorithms for the markup cache key.
 *
 * @author Juergen Donnerstag
 */
public interface IMarkupCacheKeyProvider
{
	/**
	 * Provide the markup cache key for the associated Markup resource stream.
	 *
	 * @see IMarkupResourceStreamProvider
	 *
	 * @param container
	 *            The MarkupContainer object requesting the markup cache key
	 * @param containerClass
	 *            The container the markup should be associated with
	 * @return A IResourceStream if the resource was found
	 */
	CharSequence getCacheKey(final MarkupContainer container, Class containerClass);
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package wicket.markup;

import wicket.MarkupContainer;

/**
 * To be implemented by MarkupContainers that wish to implement their own
 * algorithms for the markup cache key.
 *
 * @author Juergen Donnerstag
 */
public interface IMarkupCacheKeyProvider
{
	/**
	 * Provide the markup cache key for the associated Markup resource stream.
	 *
	 * @see IMarkupResourceStreamProvider
	 *
	 * @param container
	 *            The MarkupContainer object requesting the markup cache key
	 * @param containerClass
	 *            The container the markup should be associated with
	 * @return A IResourceStream if the resource was found
	 */
	CharSequence getCacheKey(final MarkupContainer container, Class containerClass);
}

Improve Javadoc (was: typo and typo 2)

Improve Javadoc (was: typo and typo 2)

git-svn-id: 6d6ade8e88b1292e17cba3559b7335a947e495e0@513709 13f79535-47bb-0310-9956-ffa450edef68


package fibonacci;

public class Fibonacci
{
  public static int fibonacci(int n)
  {
    if (n < 2)
      return n;

    return fibonacci(n - 1) + fibonacci(n - 2);
  }

  public static void main(String[] args)
  {
    if (args.length > 0)
    {
      try
      {
        int n = Integer.parseInt(args[0]);

        System.out.println(fibonacci(n));
      }
      catch (NumberFormatException e)
      {
        System.err.printf("Given argument (%s) is not a number!", args[0]);
      }
    }
  }
}

package fibonacci;

public class Fibonacci
{
  public static long fibonacci(long n)
  {
    if (n < 2)
      return n;

    return fibonacci(n - 1) + fibonacci(n - 2);
  }

  public static void main(String[] args)
  {
    if (args.length > 0)
    {
      try
      {
        long n = Long.parseLong(args[0]);

        System.out.println(fibonacci(n));
      }
      catch (NumberFormatException e)
      {
        System.err.printf("Given argument (%s) is not a number!", args[0]);
      }
    }
  }
}

Change from int to long to allow for bigger numbers


/*
 * Copyright 2016 Space Dynamics Laboratory - Utah State University Research Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.usu.sdl.openstorefront.service.io.reader;

import edu.usu.sdl.openstorefront.common.exception.OpenStorefrontRuntimeException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class CSVReader
		extends GenericReader<String[]>
{

	private au.com.bytecode.opencsv.CSVReader reader;

	public CSVReader(InputStream in)
	{
		super(in);
		reader = new au.com.bytecode.opencsv.CSVReader(new InputStreamReader(in));
	}

	@Override
	public String[] nextRecord()
	{
		try {
			return reader.readNext();
		} catch (IOException ex) {
			throw new OpenStorefrontRuntimeException(ex);
		}
	}

}

/*
 * Copyright 2016 Space Dynamics Laboratory - Utah State University Research Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.usu.sdl.openstorefront.service.io.reader;

import edu.usu.sdl.openstorefront.common.exception.OpenStorefrontRuntimeException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class CSVReader
		extends GenericReader<String[]>
{

	private au.com.bytecode.opencsv.CSVReader reader;

	public CSVReader(InputStream in)
	{
		super(in);
		reader = new au.com.bytecode.opencsv.CSVReader(new InputStreamReader(in));
	}

	@Override
	public String[] nextRecord()
	{
		try {
			currentRecordNumber++;
			return reader.readNext();
		} catch (IOException ex) {
			throw new OpenStorefrontRuntimeException(ex);
		}
	}

}

Fix for attribute import statistics

Fix for attribute import statistics

The currentRecordNumber must be up-to-date for the UI to reflect the
proper numbers of stored / processed / total.


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

package org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser;

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.plugins.parser.ParserSettings;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
import org.apache.ivy.plugins.repository.Resource;

import java.io.IOException;
import java.net.URL;
import java.text.ParseException;

public class DownloadedIvyModuleDescriptorParser extends XmlModuleDescriptorParser {
    @Override
    public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, URL xmlURL, Resource res, boolean validate) throws ParseException, IOException {
        DefaultModuleDescriptor descriptor = (DefaultModuleDescriptor) super.parseDescriptor(ivySettings, xmlURL, res, validate);
        descriptor.setDefault(false);
        return descriptor;
    }
}

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

package org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser;

import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.plugins.parser.ParserSettings;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
import org.apache.ivy.plugins.repository.Resource;

import java.io.IOException;
import java.net.URL;
import java.text.ParseException;

public class DownloadedIvyModuleDescriptorParser extends XmlModuleDescriptorParser {
    @Override
    synchronized public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, URL xmlURL, Resource res, boolean validate) throws ParseException, IOException {
        DefaultModuleDescriptor descriptor = (DefaultModuleDescriptor) super.parseDescriptor(ivySettings, xmlURL, res, validate);
        descriptor.setDefault(false);
        return descriptor;
    }
}

GRADLE-2486: Add quickfix for fixing this enough for 1.3.


package com.edinarobotics.zeke.commands;

import com.edinarobotics.zeke.subsystems.Collector;
import com.edinarobotics.zeke.subsystems.Shooter;
import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.wpi.first.wpilibj.command.StartCommand;

public class ShootingSequenceCommand extends CommandGroup {

    public ShootingSequenceCommand(boolean lowerAfterShoot) {
        this.setInterruptible(false);
        this.addSequential(new SetCollectorCommand(Collector.CollectorState.RETRACTED,
                Collector.CollectorWheelState.STOPPED));
        this.addSequential(new WaitForCollectorUndeployedCommand());
        this.addSequential(new SetShooterCommand(Shooter.WinchState.FREE));
        if(lowerAfterShoot) {
            this.addSequential(new StartCommand(new LowerShooterAfterWaitCommand()));
        }
    }
}

package com.edinarobotics.zeke.commands;

import com.edinarobotics.zeke.subsystems.Collector;
import com.edinarobotics.zeke.subsystems.Shooter;
import edu.wpi.first.wpilibj.command.CommandGroup;
import edu.wpi.first.wpilibj.command.StartCommand;

public class ShootingSequenceCommand extends CommandGroup {

    public ShootingSequenceCommand(boolean lowerAfterShoot) {
        this.setInterruptible(false);
        this.addSequential(new SetCollectorCommand(Collector.CollectorState.RETRACTED,
                Collector.CollectorWheelState.STOPPED));
        this.addSequential(new WaitForCollectorUndeployedCommand());
        this.addSequential(new SetShooterCommand(Shooter.WinchState.FREE));
        if(lowerAfterShoot) {
            this.addSequential(new StartCommand(new LowerShooterAfterWaitCommand(3)));
        }
    }
}

Set Autonomous to maintain its 3 second delay for shooter lowering.


package org.metaborg.meta.lang.dynsem.interpreter.nodes.natives.abruptions;

import org.metaborg.meta.lang.dynsem.interpreter.nodes.natives.StatefulControlFlowException;

public final class AbortedEvaluationException extends StatefulControlFlowException {

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

	public AbortedEvaluationException(Object thrown, Object[] components) {
		super(thrown, components);
	}

}

package org.metaborg.meta.lang.dynsem.interpreter.nodes.natives.abruptions;

import org.metaborg.meta.lang.dynsem.interpreter.nodes.natives.StatefulControlFlowException;

public final class AbortedEvaluationException extends StatefulControlFlowException {

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

	public AbortedEvaluationException(Object thrown, Object[] components) {
		super(thrown, components);
	}

	@Override
	public String getMessage() {
		return "Aborted evaluation: " + getThrown().toString();
	}

}

Implement getMessage for exception trap (to allow error to be presented to user if no handler applies)


/*
 * Copyright 2020 MD Sayem Ahmed
 *
 * 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.sayemahmed.example.springboot;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HealthController {

  @GetMapping("/health")
  public String health() {
    return "up";
  }
}

/*
 * Copyright 2020 MD Sayem Ahmed
 *
 * 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.sayemahmed.example.springboot;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HealthController {

  @GetMapping("/health")
  public String health() {
    return "up";
  }

  @GetMapping("/slower-health")
  public String slowHealth() throws InterruptedException {
    Thread.sleep(5_000L);
    return "up";
  }

  @GetMapping("/slowest-health")
  public String slowestHealth() throws InterruptedException {
    Thread.sleep(20_000L);
    return "up";
  }
}

Add slower and slowest health endpoint

Add slower and slowest health endpoint


package us.kbase.auth2.lib.exceptions;

/** Thrown when a username and password do not match.
 * @author gaprice@lbl.gov
 */
@SuppressWarnings("serial")
public class PasswordMismatchException extends UnauthorizedException {

	public PasswordMismatchException(final String message) {
		super(ErrorType.PASSWORD_MISMATCH, message);
	}
}

package us.kbase.auth2.lib.exceptions;

/** Thrown when a username and password do not match.
 * @author gaprice@lbl.gov
 */
@SuppressWarnings("serial")
public class PasswordMismatchException extends AuthenticationException {

	public PasswordMismatchException(final String message) {
		super(ErrorType.PASSWORD_MISMATCH, message);
	}
}

Make password login errors 401s vs 403s

Make password login errors 401s vs 403s


package org.rcsb.mmtf.serialization;

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

import org.msgpack.jackson.dataformat.MessagePackFactory;
import org.rcsb.mmtf.dataholders.MmtfStructure;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * A message pack implementation of the {@link MmtfStructure} serializer / deserializer.
 * @author Anthony Bradley
 *
 */
public class MessagePackSerialization implements MmtfStructureSerializationInterface {

	@Override
	public MmtfStructure deserialize(InputStream inputStream){
		MmtfStructure mmtfBean = null;
		try {
			mmtfBean = new ObjectMapper(new MessagePackFactory()).readValue(inputStream, MmtfStructure.class);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return mmtfBean;
	}

	@Override
	public void serialize(MmtfStructure mmtfStructure, OutputStream outputStream) {
		ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory());
		objectMapper.setSerializationInclusion(Include.NON_NULL);
		try {
			objectMapper.writeValue(outputStream, mmtfStructure);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

package org.rcsb.mmtf.serialization;

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

import org.msgpack.jackson.dataformat.MessagePackFactory;
import org.rcsb.mmtf.dataholders.MmtfStructure;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * A message pack implementation of the {@link MmtfStructure} serializer / deserializer.
 * @author Anthony Bradley
 *
 */
public class MessagePackSerialization implements MmtfStructureSerializationInterface {

	private ObjectMapper objectMapper;

	/**
	 * Constructor for the {@link MessagePackSerialization} class.
	 * Generates {@link ObjectMapper} and sets to include non-null.
	 */
	public MessagePackSerialization() {
		objectMapper = new ObjectMapper(new MessagePackFactory());
		objectMapper.setSerializationInclusion(Include.NON_NULL);
	}

	@Override
	public MmtfStructure deserialize(InputStream inputStream){
		MmtfStructure mmtfBean = null;
		try {
			mmtfBean = objectMapper.readValue(inputStream, MmtfStructure.class);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return mmtfBean;
	}

	@Override
	public void serialize(MmtfStructure mmtfStructure, OutputStream outputStream) {
		try {
			objectMapper.writeValue(outputStream, mmtfStructure);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

Update to the serialization module - only construct object mapper once.


package se.soy.gpg;

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

public class GPG {
  // FIXME Remove when done
  static<T> void println(T arg) { System.out.println(arg); }

  public static void main(String[] args) {
    println("main");
    GPG.encrypt().armor().recipient("0xrecipient").output();
    /*
    GPG.decrypt().armor().local-user("0xlocaluser").output("/tmp/a-file");
    GPG.sign().armor().();
    */
  }

  private String mode;
  private boolean armor = false;
  private List<String> recipients = new ArrayList<String>();

  public void output() {
    println("OPTIONS:");
    println(String.format("mode: %s", mode));
    println(String.format("armor?: %s", (armor) ? "true" : "false"));
    println(String.format("recipients?: %s", recipients));
  }

  public static GPG encrypt() {
    GPG gpg = new GPG();
    gpg.mode = "encrypt";
    return gpg;
  }

  public static GPG clearsign() {
    GPG gpg = new GPG();
    gpg.mode = "clearsign";
    return gpg;
  }

  public GPG armor() {
    this.armor = true;
    return this;
  }

  // TODO: Add recipients(List<String> recipients)
  public GPG recipient(String recipient) {
    this.recipients.add(recipient);
    return this;
  }
}

package se.soy.gpg;

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

public class GPG {
  // FIXME Remove when done
  static<T> void println(T arg) { System.out.println(arg); }

  public static void main(String[] args) {
    println("main");
    GPG.encrypt().armor().recipient("0xrecipient").output();
    /*
    GPG.decrypt().armor().local-user("0xlocaluser").output("/tmp/a-file");
    GPG.sign().armor().();
    */
  }

  private String mode;
  private boolean armor = false;
  private List<String> recipients = new ArrayList<String>();

  public void output() {
    println("OPTIONS:");
    println(String.format("mode: %s", mode));
    println(String.format("armor?: %s", (armor) ? "true" : "false"));
    println(String.format("recipients?: %s", recipients));
  }

  public static GPG encrypt() {
    GPG gpg = new GPG();
    gpg.mode = "encrypt";
    return gpg;
  }

    GPG gpg = new GPG();
    gpg.mode = "clearsign";
  public static GPG sign() {
    return gpg;
  }

  public GPG armor() {
    this.armor = true;
    return this;
  }

  // TODO: Add recipients(List<String> recipients)
  public GPG recipient(String recipient) {
    this.recipients.add(recipient);
    return this;
  }
}

Make it a regular sign

Make it a regular sign


package org.certificatetransparency.ctlog;

import java.util.List;
import org.certificatetransparency.ctlog.PreCert;

public class PrecertChainEntry {
  // The chain certifying the precertificate, as submitted by the CA.
  public List<byte[]> precertificateChain;

  // PreCert input to the SCT. Can be computed from the above.
  // Store it alongside the entry data so that the signers don't have to
  // parse certificates to recompute it.
  public PreCert preCert;

  public PrecertChainEntry() {
    precertificateChain = new java.util.ArrayList<byte[]>();
  }
}

package org.certificatetransparency.ctlog;

import java.util.ArrayList;
import java.util.List;
import org.certificatetransparency.ctlog.PreCert;

public class PrecertChainEntry {
  // The chain certifying the precertificate, as submitted by the CA.
  public List<byte[]> precertificateChain;

  // PreCert input to the SCT. Can be computed from the above.
  // Store it alongside the entry data so that the signers don't have to
  // parse certificates to recompute it.
  public PreCert preCert;

  public PrecertChainEntry() {
    precertificateChain = new ArrayList<byte[]>();
  }
}

Use an import for java.util.ArrayList.

Use an import for java.util.ArrayList.


package kurs.zadania.adressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigationHelper extends HelperBase{

  public NavigationHelper(WebDriver wd) {
    super(wd);
  }

  public void gotoGroupPage() {
      click(By.linkText("groups"));
  }

  public void gotoMainPage() {
      click(By.linkText("home"));

  }
}

package kurs.zadania.adressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigationHelper extends HelperBase{

  public NavigationHelper(WebDriver wd) {
    super(wd);
  }

 // public void gotoGroupPage() { click(By.linkText("groups")); }

/* sprawdzanie elementu na stronie i przejście po linku - wariant 1
  public void gotoGroupPage() {
    if (!isElementPresent(By.tagName("h1"))
            || !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            || !isElementPresent(By.name("new"))) {
      click(By.linkText("groups"));
    }
  }
*/
// sprawdzanie elementu na stronie i przejście po linku - wariant 2 lepszy

  public void gotoGroupPage() {
    if (isElementPresent(By.tagName("h1"))
            && !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            && !isElementPresent(By.name("new"))) {
      return;
    }
      click(By.linkText("groups"));
    }

  public void gotoMainPage() {
    if (isElementPresent(By.id("maintable"))) {
      return;
    }
      click(By.linkText("home"));
  }
}

Revert "Revert "Revert "Revert "optimization of the transition between the pages""""

This reverts commit 1fde695a1625d503e54d90719c87460cf6f5a4c1.


/**
 * Copyright © 2015 MicroWorld (contact@microworld.org)
 *
 * 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.microworld.mangopay.tests;

import org.junit.Test;
import org.microworld.mangopay.MangopayClient;
import org.microworld.mangopay.MangopayConnection;
import org.microworld.mangopay.exceptions.MangopayUnauthorizedException;

public class ConnectIT extends AbstractIntegrationTest {
  @Test
  public void anExceptionIsThrownWhenConnectingToMangopayWithInvalidCredentials() {
    thrown.expect(MangopayUnauthorizedException.class);
    thrown.expectMessage("invalid_client: Authentication failed");
    final MangopayConnection connection = MangopayConnection.createDefault("api.sandbox.mangopay.com", "bar", "baz");
    MangopayClient.createDefault(connection).getUserService().get("42");
  }
}

/**
 * Copyright © 2015 MicroWorld (contact@microworld.org)
 *
 * 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.microworld.mangopay.tests;

import org.junit.Test;
import org.microworld.mangopay.MangopayClient;
import org.microworld.mangopay.MangopayConnection;
import org.microworld.mangopay.exceptions.MangopayUnauthorizedException;

public class ConnectIT extends AbstractIntegrationTest {
  @Test
  public void anExceptionIsThrownWhenConnectingToMangopayWithInvalidCredentials() {
    thrown.expect(MangopayUnauthorizedException.class);
    thrown.expectMessage("invalid_client: Your authorization do not allow you to access to this information");
    final MangopayConnection connection = MangopayConnection.createDefault("api.sandbox.mangopay.com", "bar", "baz");
    MangopayClient.createDefault(connection).getUserService().get("42");
  }
}

Update error message in tests.

Update error message in tests.


/*
 * This program is part of the OpenLMIS logistics management information system platform software.
 * Copyright © 2017 VillageReach
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details. You should have received a copy of
 * the GNU Affero General Public License along with this program. If not, see
 * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.
 */

package org.openlmis.fulfillment.service;

import org.apache.commons.lang3.StringUtils;

public class ResourceNames {
  private ResourceNames() {}

  public static final String SEPARATOR = "/";

  public static final String BASE_PATH = "/api";
  public static final String USERS = "users";

  public static String getUsersPath() {
    return getPath(USERS);
  }

  private static String getPath(String resourseName) {
    return StringUtils.joinWith(SEPARATOR, BASE_PATH, resourseName) + SEPARATOR;
  }
}

/*
 * This program is part of the OpenLMIS logistics management information system platform software.
 * Copyright © 2017 VillageReach
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details. You should have received a copy of
 * the GNU Affero General Public License along with this program. If not, see
 * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.
 */

package org.openlmis.fulfillment.service;

import org.apache.commons.lang3.StringUtils;

public class ResourceNames {
  public static final String SEPARATOR = "/";
  public static final String BASE_PATH = "/api";
  public static final String USERS = "users";

  private ResourceNames() {}

  public static String getUsersPath() {
    return getPath(USERS);
  }

  private static String getPath(String resourseName) {
    return StringUtils.joinWith(SEPARATOR, BASE_PATH, resourseName) + SEPARATOR;
  }
}

OLMIS-3608: Move variable to comply with Java Code Conventions.


package net.sf.commonclipse;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;

import java.util.regex.Pattern;

/**
 * Tests for CCPluginPreferences.
 * @author fgiust
 * @version $Revision$ ($Author$)
 */
public class CCPluginPreferencesTest
{

    /**
     * test the conversion from an array of strings to a regexp.
     */
    public void testRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp("log;test?u?;done*");
        assertThat(regexp.pattern(), equalTo("(^log$)|(^test.u.$)|(^done*$)"));
    }

    /**
     * test the conversion from an array of strings to a regexp.
     */
    public void testEmptyRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp("");
        assertFalse(regexp.matcher("").matches());
        assertFalse(regexp.matcher("a").matches());

    }

    /**
     * test the conversion from an array of strings to a regexp.
     */
    public void testNullRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp(null);
        assertFalse(regexp.matcher("").matches());
        assertFalse(regexp.matcher("a").matches());
    }

}

package net.sf.commonclipse;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;

import java.util.regex.Pattern;

import org.junit.Test;

/**
 * Tests for CCPluginPreferences.
 * @author fgiust
 * @version $Revision$ ($Author$)
 */
public class CCPluginPreferencesTest
{

    /**
     * test the conversion from an array of strings to a regexp.
     */
    @Test
    public void testRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp("log;test?u?;done*");
        assertThat(regexp.pattern(), equalTo("(^log$)|(^test.u.$)|(^done*$)"));
    }

    /**
     * test the conversion from an array of strings to a regexp.
     */
    @Test
    public void testEmptyRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp("");
        assertFalse(regexp.matcher("").matches());
        assertFalse(regexp.matcher("a").matches());

    }

    /**
     * test the conversion from an array of strings to a regexp.
     */
    @Test
    public void testNullRegexpConversion()
    {
        Pattern regexp = CCPluginPreferences.generateRegExp(null);
        assertFalse(regexp.matcher("").matches());
        assertFalse(regexp.matcher("a").matches());
    }

}

Fix missing @Test annotations for JUnit tests.

Forgot to add the annotations when upgrading to JUnit 4.


package graphql;

public class GraphQLException extends RuntimeException {

    public GraphQLException() {
    }

    public GraphQLException(String message) {
        super(message);
    }

    public GraphQLException(String message, Throwable cause) {
        super(message, cause);
    }

    public GraphQLException(Throwable cause) {
        super(cause);
    }

}

package graphql;

public class GraphQLException extends RuntimeException {

    public GraphQLException() {
    }

    public GraphQLException(String message) {
        super(message);
    }

    public GraphQLException(String message, Throwable cause) {
        super(message, cause);
    }

    public GraphQLException(Throwable cause) {
        super(cause);
    }

    @Override
    public String toString() {
        return getMessage();
    }

}

Make graphql exception tostring be the message


package com.bradmcevoy.http.values;

import com.bradmcevoy.http.DateUtils;
import com.bradmcevoy.http.DateUtils.DateParseException;
import com.bradmcevoy.http.XmlWriter;
import java.util.Date;
import java.util.Map;

public class DateValueWriter implements ValueWriter {

    public boolean supports( String nsUri, String localName, Class c ) {
        return Date.class.equals( c );
    }

    public void writeValue( XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes ) {
        if( val == null ) {
            writer.writeProperty( prefix, localName );
        } else {
            Date date = (Date) val;
            String s = DateUtils.formatDate( date );
            writer.writeProperty( prefix, localName, s );
        }
    }

    public Object parse( String namespaceURI, String localPart, String value ) {
        if( value == null || value.length() == 0 ) return null;
        Date dt;
        try {
            dt = DateUtils.parseDate( value );
            return dt;
        } catch( DateParseException ex ) {
            throw new RuntimeException( value, ex );
        }
    }
}

package com.bradmcevoy.http.values;

import com.bradmcevoy.http.DateUtils;
import com.bradmcevoy.http.DateUtils.DateParseException;
import com.bradmcevoy.http.XmlWriter;
import java.util.Date;
import java.util.Map;

public class DateValueWriter implements ValueWriter {

	@Override
    public boolean supports( String nsUri, String localName, Class c ) {
        return c.isInstance(Date.class);
    }

	@Override
    public void writeValue( XmlWriter writer, String nsUri, String prefix, String localName, Object val, String href, Map<String, String> nsPrefixes ) {
        if( val == null ) {
            writer.writeProperty( prefix, localName );
        } else {
            Date date = (Date) val;
            String s = DateUtils.formatDate( date );
            writer.writeProperty( prefix, localName, s );
        }
    }

	@Override
    public Object parse( String namespaceURI, String localPart, String value ) {
        if( value == null || value.length() == 0 ) return null;
        Date dt;
        try {
            dt = DateUtils.parseDate( value );
            return dt;
        } catch( DateParseException ex ) {
            throw new RuntimeException( value, ex );
        }
    }
}

Fix so that Timestamp objects get formatted as Date's


package protocolsupport.protocol.packet.middleimpl.writeable.play.v_5_6;

import io.netty.buffer.ByteBuf;
import net.md_5.bungee.protocol.packet.Team;
import protocolsupport.protocol.packet.id.LegacyPacketId;
import protocolsupport.protocol.packet.middleimpl.writeable.LegacySingleWriteablePacket;
import protocolsupport.protocol.serializer.StringSerializer;

public class ScoreboardTeamPacket extends LegacySingleWriteablePacket<Team> {

	public ScoreboardTeamPacket() {
		super(LegacyPacketId.Clientbound.PLAY_SCOREBOARD_SCORE);
	}

	@Override
	protected void write(ByteBuf data, Team packet) {
		StringSerializer.writeShortUTF16BEString(data, packet.getName());
		int mode = packet.getMode();
		data.writeByte(mode);
		if ((mode == 0) || (mode == 2)) {
			StringSerializer.writeShortUTF16BEString(data, packet.getDisplayName());
			StringSerializer.writeShortUTF16BEString(data, packet.getPrefix());
			StringSerializer.writeShortUTF16BEString(data, packet.getSuffix());
			data.writeByte(packet.getFriendlyFire());
		}
		if ((mode == 0) || (mode == 3) || (mode == 4)) {
			data.writeShort(packet.getPlayers().length);
			for (String player : packet.getPlayers()) {
				StringSerializer.writeShortUTF16BEString(data, player);
			}
		}
	}

}

package protocolsupport.protocol.packet.middleimpl.writeable.play.v_5_6;

import io.netty.buffer.ByteBuf;
import net.md_5.bungee.protocol.packet.Team;
import protocolsupport.protocol.packet.id.LegacyPacketId;
import protocolsupport.protocol.packet.middleimpl.writeable.LegacySingleWriteablePacket;
import protocolsupport.protocol.serializer.StringSerializer;

public class ScoreboardTeamPacket extends LegacySingleWriteablePacket<Team> {

	public ScoreboardTeamPacket() {
		super(LegacyPacketId.Clientbound.PLAY_SCOREBOARD_TEAM);
	}

	@Override
	protected void write(ByteBuf data, Team packet) {
		StringSerializer.writeShortUTF16BEString(data, packet.getName());
		int mode = packet.getMode();
		data.writeByte(mode);
		if ((mode == 0) || (mode == 2)) {
			StringSerializer.writeShortUTF16BEString(data, packet.getDisplayName());
			StringSerializer.writeShortUTF16BEString(data, packet.getPrefix());
			StringSerializer.writeShortUTF16BEString(data, packet.getSuffix());
			data.writeByte(packet.getFriendlyFire());
		}
		if ((mode == 0) || (mode == 3) || (mode == 4)) {
			data.writeShort(packet.getPlayers().length);
			for (String player : packet.getPlayers()) {
				StringSerializer.writeShortUTF16BEString(data, player);
			}
		}
	}

}

Fix scoreboard team using wrong packet idTeam


package com.datatheorem.android.trustkit.pinning;

import android.net.SSLCertificateSocketFactory;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import javax.net.ssl.TrustManager;

public class TrustKitSSLSocketFactory extends SSLCertificateSocketFactory {

    // TODO(ad): Figure this out
    // REVIEW(bj): resolve this TODO or remove it. ;P
    public TrustKitSSLSocketFactory() {
        super(0);
    }

    @Override
    public Socket createSocket(String host, int port, InetAddress localAddr, int localPort)
            throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(host, port, localAddr, localPort);
    }

    @Override
    public Socket createSocket(Socket k, String host, int port, boolean close) throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(k, host, port, close);
    }

    @Override
    public Socket createSocket(String host, int port) throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(host, port);
    }
}

package com.datatheorem.android.trustkit.pinning;

import android.net.SSLCertificateSocketFactory;

import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import javax.net.ssl.TrustManager;

public class TrustKitSSLSocketFactory extends SSLCertificateSocketFactory {

    public TrustKitSSLSocketFactory() {
        // Inheritance is the only way to customize the SSLCertificateSocketFactory but it requires
        // calling this deprecated method
        super(0);
    }

    @Override
    public Socket createSocket(String host, int port, InetAddress localAddr, int localPort)
            throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(host, port, localAddr, localPort);
    }

    @Override
    public Socket createSocket(Socket k, String host, int port, boolean close) throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(k, host, port, close);
    }

    @Override
    public Socket createSocket(String host, int port) throws IOException {
        // Force the use of our trust manager
        setTrustManagers(new TrustManager[]{TrustManagerBuilder.getTrustManager(host)});

        // Try to create the socket, which will trigger the SSL handshake
        return super.createSocket(host, port);
    }
}

Remove and TODO and add explanation

Remove and TODO and add explanation


package uk.co.alynn.games.ld30.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

import uk.co.alynn.games.ld30.SpaceHams;
import uk.co.alynn.games.ld30.world.Constants;

public class DesktopLauncher {
	public static void main (String[] arg) {
		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
		config.width = Constants.STANDARD_RES_WIDTH;
		config.height = Constants.STANDARD_RES_HEIGHT;
		config.samples = 2;
		config.vSyncEnabled = true;
		config.title = "Border Patrol";
		config.resizable = true;
		config.fullscreen = System.getProperty("os.name").equals("Mac OS X");
		new LwjglApplication(new SpaceHams(), config);
	}
}

package uk.co.alynn.games.ld30.desktop;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

import uk.co.alynn.games.ld30.SpaceHams;
import uk.co.alynn.games.ld30.world.Constants;

public class DesktopLauncher {
	public static void main (String[] arg) {
		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
		config.width = Constants.STANDARD_RES_WIDTH;
		config.height = Constants.STANDARD_RES_HEIGHT;
		config.samples = 2;
		config.vSyncEnabled = true;
		config.title = "Intergalactopol";
		config.resizable = true;
		config.fullscreen = System.getProperty("os.name").equals("Mac OS X");
		new LwjglApplication(new SpaceHams(), config);
	}
}

Switch the name to Intergalactopol

Switch the name to Intergalactopol


/*
 * Copyright 2012 Artur Dryomov
 *
 * 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 ru.ming13.gambit.local.sqlite;

final class DbFieldParams
{
	private DbFieldParams() {
	}

	public static final String ID = "integer primary key autoincrement not null unique";

	public static final String INDEX = "int not null";

	public static final String DECK_TITLE = "text not null unique";
	public static final String DECK_FOREIGN_ID;

	static {
		final String foreignKeyMask = "integer not null references %s(%s)";

		DECK_FOREIGN_ID = String.format(foreignKeyMask, DbTableNames.DECKS, DbFieldNames.ID);
	}

	public static final String CARD_TEXT = "text not null";
}

/*
 * Copyright 2012 Artur Dryomov
 *
 * 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 ru.ming13.gambit.local.sqlite;

final class DbFieldParams
{
	private DbFieldParams() {
	}

	public static final String ID = "integer primary key autoincrement not null unique";

	public static final String INDEX = "int not null";

	public static final String DECK_TITLE = "text not null unique";
	public static final String DECK_FOREIGN_ID;

	static {
		final String deckForeignKeyMask = "integer not null references %s(%s) on delete cascade";

		DECK_FOREIGN_ID = String.format(deckForeignKeyMask, DbTableNames.DECKS, DbFieldNames.ID);
	}

	public static final String CARD_TEXT = "text not null";
}

Add cascade deletion for deck cards.

Add cascade deletion for deck cards.


package org.jvirtanen.parity.net.poe;

import static org.jvirtanen.parity.net.poe.POE.*;

import com.paritytrading.nassau.MessageListener;
import java.io.IOException;
import java.nio.ByteBuffer;

/**
 * A parser for inbound messages on the server side.
 */
public class POEServerParser implements MessageListener {

    private EnterOrder  enterOrder;
    private CancelOrder cancelOrder;

    private POEServerListener listener;

    /**
     * Create a parser for inbound messages on the server side.
     *
     * @param listener the message listener
     */
    public POEServerParser(POEServerListener listener) {
        this.enterOrder  = new EnterOrder();
        this.cancelOrder = new CancelOrder();

        this.listener = listener;
    }

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

        switch (messageType) {
        case MESSAGE_TYPE_ENTER_ORDER:
            enterOrder(buffer);
            break;
        case MESSAGE_TYPE_CANCEL_ORDER:
            cancelOrder(buffer);
            break;
        default:
            throw new POEException("Unknown message type: " + (char)messageType);
        }
    }

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

        listener.enterOrder(enterOrder);
    }

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

        listener.cancelOrder(cancelOrder);
    }

}

package org.jvirtanen.parity.net.poe;

import static org.jvirtanen.parity.net.poe.POE.*;

import com.paritytrading.nassau.MessageListener;
import java.io.IOException;
import java.nio.ByteBuffer;

/**
 * A parser for inbound messages on the server side.
 */
public class POEServerParser implements MessageListener {

    private EnterOrder  enterOrder;
    private CancelOrder cancelOrder;

    private POEServerListener listener;

    /**
     * Create a parser for inbound messages on the server side.
     *
     * @param listener the message listener
     */
    public POEServerParser(POEServerListener listener) {
        this.enterOrder  = new EnterOrder();
        this.cancelOrder = new CancelOrder();

        this.listener = listener;
    }

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

        switch (messageType) {
        case MESSAGE_TYPE_ENTER_ORDER:
            enterOrder.get(buffer);
            listener.enterOrder(enterOrder);
            break;
        case MESSAGE_TYPE_CANCEL_ORDER:
            cancelOrder.get(buffer);
            listener.cancelOrder(cancelOrder);
            break;
        default:
            throw new POEException("Unknown message type: " + (char)messageType);
        }
    }

}

Simplify POE server parser in network protocols


package de.codecentric.centerdevice.glass;

import com.sun.glass.ui.Application;

import de.codecentric.centerdevice.util.ReflectionUtils;
import javafx.application.Platform;

public class MacApplicationAdapter {

	private Application app;

	private boolean forceQuitOnCmdQ = true;

	public MacApplicationAdapter() throws ReflectiveOperationException {
		app = Application.GetApplication();
	}

	public void hide() {
		ReflectionUtils.invokeQuietly(app, "_hide");
	}

	public void hideOtherApplications() {
		ReflectionUtils.invokeQuietly(app, "_hideOtherApplications");
	}

	public void unhideAllApplications() {
		ReflectionUtils.invokeQuietly(app, "_unhideAllApplications");
	}

	public void quit() {
		Application.EventHandler eh = app.getEventHandler();
		if (eh != null) {
			eh.handleQuitAction(Application.GetApplication(), System.nanoTime());
		}
		if (forceQuitOnCmdQ) {
			Platform.exit();
		}
	}

	public void setForceQuitOnCmdQ(boolean forceQuit) {
		this.forceQuitOnCmdQ = forceQuit;
	}

}

package de.codecentric.centerdevice.glass;

import com.sun.glass.ui.Application;

import de.codecentric.centerdevice.util.ReflectionUtils;
import javafx.application.Platform;

public class MacApplicationAdapter {

	private Application app;

	private boolean forceQuitOnCmdQ = true;

	public MacApplicationAdapter() {
		app = Application.GetApplication();
	}

	public void hide() {
		ReflectionUtils.invokeQuietly(app, "_hide");
	}

	public void hideOtherApplications() {
		ReflectionUtils.invokeQuietly(app, "_hideOtherApplications");
	}

	public void unhideAllApplications() {
		ReflectionUtils.invokeQuietly(app, "_unhideAllApplications");
	}

	public void quit() {
		Application.EventHandler eh = app.getEventHandler();
		if (eh != null) {
			eh.handleQuitAction(Application.GetApplication(), System.nanoTime());
		}
		if (forceQuitOnCmdQ) {
			Platform.exit();
		}
	}

	public void setForceQuitOnCmdQ(boolean forceQuit) {
		this.forceQuitOnCmdQ = forceQuit;
	}

}

Remove exception from method signature

Remove exception from method signature


package uk.ac.ic.wlgitbridge.snapshot.getsavedvers;

import uk.ac.ic.wlgitbridge.util.Util;

/**
 * Created by Winston on 06/11/14.
 */
public class SnapshotInfo implements Comparable<SnapshotInfo> {

    private int versionId;
    private String comment;
    private WLUser user;
    private String createdAt;

    public SnapshotInfo(int versionID, String createdAt, String name, String email) {
        this(versionID, "Update on " + Util.getServiceName() + ".", email, name, createdAt);
    }

    public SnapshotInfo(int versionID, String comment, String email, String name, String createdAt) {
        versionId = versionID;
        this.comment = comment;
        user = new WLUser(name, email);
        this.createdAt = createdAt;
    }

    public int getVersionId() {
        return versionId;
    }

    public String getComment() {
        return comment;
    }

    public WLUser getUser() {
        return user;
    }

    public String getCreatedAt() {
        return createdAt;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof SnapshotInfo)) {
            return false;
        }
        SnapshotInfo that = (SnapshotInfo) obj;
        return versionId == that.versionId;
    }

    @Override
    public int compareTo(SnapshotInfo o) {
        return Integer.compare(versionId, o.versionId);
    }
}

package uk.ac.ic.wlgitbridge.snapshot.getsavedvers;

import uk.ac.ic.wlgitbridge.util.Util;

/**
 * Created by Winston on 06/11/14.
 */
public class SnapshotInfo implements Comparable<SnapshotInfo> {

    private int versionId;
    private String comment;
    private WLUser user;
    private String createdAt;

    public SnapshotInfo(int versionID, String createdAt, String name, String email) {
        this(versionID, "Update on " + Util.getServiceName() + ".", email, name, createdAt);
    }

    public SnapshotInfo(int versionID, String comment, String email, String name, String createdAt) {
        versionId = versionID;
        this.comment = comment;
        user = new WLUser(name, email);
        this.createdAt = createdAt;
    }

    public int getVersionId() {
        return versionId;
    }

    public String getComment() {
        return comment;
    }

    public WLUser getUser() {
        return user != null ? user : new WLUser();
    }

    public String getCreatedAt() {
        return createdAt;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof SnapshotInfo)) {
            return false;
        }
        SnapshotInfo that = (SnapshotInfo) obj;
        return versionId == that.versionId;
    }

    @Override
    public int compareTo(SnapshotInfo o) {
        return Integer.compare(versionId, o.versionId);
    }
}

Support for anonymous saved versions

Support for anonymous saved versions

This fixes a case when de API sends a version without user. There was a
bug allowing to create anonymous versions in the application and we
have to support the old data.

The problem here is that SnapshotInfo classes are inflated from json
via Gson. This method does not call any constructor and, since the json
does not include the ‘user’ key, the bridge crashes because we’re not
expecting null users.

I’m not happy with this fix, but is the minimum solution that does not
affect anything else.


package com.thomasnyberg.minset;

import android.app.Activity;
import android.os.Bundle;

public class Mindset extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
  }
}

package com.thomasnyberg.mindset;

import android.app.Activity;
import android.os.Bundle;

public class Mindset extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
  }
}

Fix minset <--> mindset spelling mistake


package io.quarkus.arc.deployment;

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

import java.util.List;

import io.quarkus.arc.runtime.ArcRecorder;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ApplicationStartBuildItem;
import io.quarkus.deployment.builditem.ServiceStartBuildItem;
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;

public class LifecycleEventsBuildStep {

    @BuildStep
    @Record(RUNTIME_INIT)
    ApplicationStartBuildItem startupEvent(ArcRecorder recorder,
            List<ServiceStartBuildItem> startList,
            BeanContainerBuildItem beanContainer,
            ShutdownContextBuildItem shutdown) {
        recorder.handleLifecycleEvents(shutdown, beanContainer.getValue());
        return new ApplicationStartBuildItem();
    }

}

package io.quarkus.arc.deployment;

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

import java.util.List;

import io.quarkus.arc.runtime.ArcRecorder;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.Consume;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ApplicationStartBuildItem;
import io.quarkus.deployment.builditem.RuntimeConfigSetupCompleteBuildItem;
import io.quarkus.deployment.builditem.ServiceStartBuildItem;
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;

public class LifecycleEventsBuildStep {

    @Consume(RuntimeConfigSetupCompleteBuildItem.class)
    @BuildStep
    @Record(RUNTIME_INIT)
    ApplicationStartBuildItem startupEvent(ArcRecorder recorder,
            List<ServiceStartBuildItem> startList,
            BeanContainerBuildItem beanContainer,
            ShutdownContextBuildItem shutdown) {
        recorder.handleLifecycleEvents(shutdown, beanContainer.getValue());
        return new ApplicationStartBuildItem();
    }

}

Make sure the StartupEvent is fired after the runtime config is set


package gov.nih.nci.cananolab.restful.view.edit;

public class SimpleInstrumentBean {

	String manufacturer;
	String modelName;
	String type;
	public String getManufacturer() {
		return manufacturer;
	}
	public void setManufacturer(String manufacturer) {
		this.manufacturer = manufacturer;
	}
	public String getModelName() {
		return modelName;
	}
	public void setModelName(String modelName) {
		this.modelName = modelName;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}

}

package gov.nih.nci.cananolab.restful.view.edit;

public class SimpleInstrumentBean {

	String manufacturer = "";
	String modelName = "";
	String type = "";

	public String getManufacturer() {
		return manufacturer;
	}
	public void setManufacturer(String manufacturer) {
		if (manufacturer != null)
			this.manufacturer = manufacturer;
	}
	public String getModelName() {
		return modelName;
	}
	public void setModelName(String modelName) {
		if (modelName != null)
			this.modelName = modelName;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		if (type != null)
			this.type = type;
	}

}

Make sure type doesn't have null value. Otherwise, got hibernate error


package tars.testutil;

import tars.commons.exceptions.IllegalValueException;
import tars.model.task.*;
import tars.model.tag.Tag;

/**
 *
 */
public class TaskBuilder {

    private TestTask task;

    public TaskBuilder() {
        this.task = new TestTask();
    }

    public TaskBuilder withName(String name) throws IllegalValueException {
        this.task.setName(new Name(name));
        return this;
    }

    public TaskBuilder withTags(String ... tags) throws IllegalValueException {
        for (String tag: tags) {
            task.getTags().add(new Tag(tag));
        }
        return this;
    }

    public TaskBuilder withAddress(String address) throws IllegalValueException {
        this.task.setAddress(new Address(address));
        return this;
    }

    public TaskBuilder withPhone(String phone) throws IllegalValueException {
        this.task.setPhone(new Phone(phone));
        return this;
    }

    public TaskBuilder withEmail(String email) throws IllegalValueException {
        this.task.setEmail(new Email(email));
        return this;
    }

    public TestTask build() {
        return this.task;
    }

}

package tars.testutil;

import tars.commons.exceptions.IllegalValueException;
import tars.model.task.*;
import tars.model.tag.Tag;

/**
 *
 */
public class TaskBuilder {

    private TestTask task;

    public TaskBuilder() {
        this.task = new TestTask();
    }

    public TaskBuilder withName(String name) throws IllegalValueException {
        this.task.setName(new Name(name));
        return this;
    }

    public TaskBuilder withTags(String ... tags) throws IllegalValueException {
        for (String tag: tags) {
            task.getTags().add(new Tag(tag));
        }
        return this;
    }

    public TaskBuilder withDateTime(String dateTime) throws IllegalValueException {
        this.task.setDateTime(new DateTime(dateTime, ""));
        return this;
    }

    public TaskBuilder withPriority(String priority) throws IllegalValueException {
        this.task.setPriority(new Priority(priority));
        return this;
    }

    public TestTask build() {
        return this.task;
    }

}

Add methods withDateTime(String) and withPriority(String)


// Copyright 2012 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.tapestry5.services.compatibility;

import org.apache.tapestry5.internal.services.compatibility.CompatibilityImpl;
import org.apache.tapestry5.internal.services.compatibility.DeprecationWarningImpl;
import org.apache.tapestry5.ioc.Configuration;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Contribute;

/**
 * Defines services for managing compatibility across releases.
 *
 * @since 5.4
 */
public class CompatibilityModule
{
    public static void bind(ServiceBinder binder)
    {
        binder.bind(Compatibility.class, CompatibilityImpl.class);
        binder.bind(DeprecationWarning.class, DeprecationWarningImpl.class);
    }

    @Contribute(Compatibility.class)
    public void enableAllCompatibilityTemporarily(Configuration<Trait> configuration)
    {
        for (Trait t : Trait.values())
        {
            configuration.add(t);
        }
    }

}

// Copyright 2012 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.tapestry5.services.compatibility;

import org.apache.tapestry5.internal.services.compatibility.CompatibilityImpl;
import org.apache.tapestry5.internal.services.compatibility.DeprecationWarningImpl;
import org.apache.tapestry5.ioc.ServiceBinder;

/**
 * Defines services for managing compatibility across releases.
 *
 * @since 5.4
 */
public class CompatibilityModule
{
    public static void bind(ServiceBinder binder)
    {
        binder.bind(Compatibility.class, CompatibilityImpl.class);
        binder.bind(DeprecationWarning.class, DeprecationWarningImpl.class);
    }
}

Remove broken contribution to Compatibility service


package net.kencochrane.raven;

import com.google.common.collect.Iterators;
import mockit.Injectable;
import mockit.Mocked;
import mockit.NonStrictExpectations;
import mockit.Tested;
import net.kencochrane.raven.dsn.Dsn;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.ServiceLoader;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class RavenFactoryTest {
    @Tested
    private RavenFactory ravenFactory;
    @Mocked
    private ServiceLoader mockServiceLoader;

    @BeforeMethod
    public void setUp() throws Exception {
        new NonStrictExpectations() {{
            ServiceLoader.load(RavenFactory.class);
            result = mockServiceLoader;
        }};
    }

    @Test
    public void testGetFactoriesFromServiceLoader(@Injectable final Raven mockRaven,
                                                  @Injectable final Dsn mockDsn) throws Exception {
        new NonStrictExpectations() {{
            mockServiceLoader.iterator();
            result = Iterators.singletonIterator(ravenFactory);
            ravenFactory.createRavenInstance(mockDsn);
            result = mockRaven;
        }};

        Raven raven = RavenFactory.ravenInstance(mockDsn);

        assertThat(raven, is(mockRaven));
    }
}

package net.kencochrane.raven;

import com.google.common.collect.Iterators;
import mockit.Injectable;
import mockit.Mocked;
import mockit.NonStrictExpectations;
import mockit.Tested;
import net.kencochrane.raven.dsn.Dsn;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.ServiceLoader;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class RavenFactoryTest {
    @Tested
    private RavenFactory ravenFactory;
    @Mocked
    private ServiceLoader mockServiceLoader;

    @BeforeMethod
    public void setUp() throws Exception {
        new NonStrictExpectations() {{
            ServiceLoader.load(RavenFactory.class);
            result = mockServiceLoader;
        }};
    }

    @Test
    public void testGetFactoriesFromServiceLoader(@Injectable final Raven mockRaven,
                                                  @Injectable final Dsn mockDsn) throws Exception {
        new NonStrictExpectations() {{
            mockServiceLoader.iterator();
            result = Iterators.singletonIterator(ravenFactory);
            ravenFactory.createRavenInstance(mockDsn);
            result = mockRaven;
        }};

        Raven raven = RavenFactory.ravenInstance(mockDsn);

        assertThat(raven, is(mockRaven));
    }

    @Test
    public void testGetFactoriesManuallyAdded(@Injectable final Raven mockRaven,
                                                  @Injectable final Dsn mockDsn) throws Exception {
        new NonStrictExpectations() {{
            RavenFactory.registerFactory(ravenFactory);
            ravenFactory.createRavenInstance(mockDsn);
            result = mockRaven;
        }};

        Raven raven = RavenFactory.ravenInstance(mockDsn);

        assertThat(raven, is(mockRaven));
    }
}

Test that factories can be added manually


package com.openxc.measurements;

import java.util.Locale;

import com.openxc.units.KeylessEntryCode;
import com.openxc.units.State;

public class KeylessEntryProgrammingCommand extends BaseMeasurement<
        State<KeylessEntryProgrammingCommand.Command>> {
    public final static String ID = "keyless_entry_command";

    public enum Command {
        ADD,
        ERASE,
        AUTHENTICATE
    }

    public KeylessEntryProgrammingCommand(State<Command> command,
            KeylessEntryCode code) {
        super(command, code);
    }

    public KeylessEntryProgrammingCommand(Command command,
            String code) {
        super(new State<Command>(command), new KeylessEntryCode(code));
    }

    public KeylessEntryProgrammingCommand(Command command) {
        super(new State<Command>(command));
    }

    public KeylessEntryProgrammingCommand(String command, String code) {
        this(Command.valueOf(command.toUpperCase(Locale.US)), code);
    }

    @Override
    public String getSerializedValue() {
        return getValue().enumValue().toString().toLowerCase();
    }

    @Override
    public KeylessEntryCode getEvent() {
        return (KeylessEntryCode) super.getEvent();
    }

    @Override
    public String getSerializedEvent() {
        return getEvent().getSerializedValue();
    }

    @Override
    public String getGenericName() {
        return ID;
    }
}

package com.openxc.measurements;

import java.util.Locale;

import com.openxc.units.KeylessEntryCode;
import com.openxc.units.State;

public class KeylessEntryProgrammingCommand extends BaseMeasurement<
        State<KeylessEntryProgrammingCommand.Command>> {
    public final static String ID = "keyless_entry_command";

    public enum Command {
        ADD,
        ERASE,
        AUTHENTICATE
    }

    public KeylessEntryProgrammingCommand(State<Command> command,
            KeylessEntryCode code) {
        super(command, code);
    }

    public KeylessEntryProgrammingCommand(Command command,
            String code) {
        super(new State<Command>(command), new KeylessEntryCode(code));
    }

    public KeylessEntryProgrammingCommand(Command command) {
        super(new State<Command>(command));
    }

    public KeylessEntryProgrammingCommand(String command, String code) {
        this(Command.valueOf(command.toUpperCase(Locale.US)), code);
    }

    @Override
    public String getSerializedValue() {
        return getValue().enumValue().toString().toLowerCase();
    }

    @Override
    public KeylessEntryCode getEvent() {
        return (KeylessEntryCode) super.getEvent();
    }

    @Override
    public String getSerializedEvent() {
        return getEvent() != null ? getEvent().getSerializedValue() : null;
    }

    @Override
    public String getGenericName() {
        return ID;
    }
}

Allow keyless entry command to have no event.


package de.tum.in.www1.artemis.web.rest;

import java.time.Instant;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TimeResource {

    /**
     * {@code GET /time}:
     * @return the current server time as Instant
     */
    @GetMapping(value = "/time", produces = MediaType.TEXT_PLAIN_VALUE)
    public String time() {
        return Instant.now().toString();
    }
}

package de.tum.in.www1.artemis.web.rest;

import java.time.Instant;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TimeResource {

    /**
     * {@code GET /time}:
     * @return the current server time as Instant
     */
    @GetMapping("/time")
    public ResponseEntity<Instant> time() {
        return ResponseEntity.ok(Instant.now());
    }
}

Fix "/time" not returning JSON string

Fix "/time" not returning JSON string

Signed-off-by: Jan Philip Bernius <814ff5be9e22112ef64fe4fffd286a913b75a514@tum.de>


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

package net.openhft.chronicle.queue;

import net.openhft.chronicle.wire.MessageHistory;

/**
 * Created by peter on 27/03/16.
 */
public enum NoMessageHistory implements MessageHistory {
    INSTANCE;

    @Override
    public int timings() {
        return 0;
    }

    @Override
    public long timing(int n) {
        return -1;
    }

    @Override
    public int sources() {
        return 0;
    }

    @Override
    public int sourceId(int n) {
        return -1;
    }

    @Override
    public long sourceIndex(int n) {
        return -1;
    }

    @Override
    public void reset(int sourceId, long sourceIndex) {
        // ignored
    }
}

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

package net.openhft.chronicle.queue;

import net.openhft.chronicle.wire.MessageHistory;

/**
 * Created by peter on 27/03/16.
 */
public enum NoMessageHistory implements MessageHistory {
    INSTANCE;

    @Override
    public int timings() {
        return 0;
    }

    @Override
    public long timing(int n) {
        return -1;
    }

    @Override
    public int sources() {
        return 0;
    }

    @Override
    public int sourceId(int n) {
        return -1;
    }

    @Override
    public long sourceIndex(int n) {
        return -1;
    }

    @Override
    public void reset(int sourceId, long sourceIndex) {
        // ignored
    }

    @Override
    public int lastSourceId() {
        return -1;
    }

    @Override
    public long lastSourceIndex() {
        return -1;
    }

}

Improve logging for unknown/empty messages


/*******************************************************************************
 * Copyright (C) 2016 Push Technology Ltd.
 *
 * 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.pushtechnology.diffusion.transform.transformer;

/**
 * A transformer. Converts values of one type into values of a different
 * type. It will not throw an exception.
 *
 * @param <S> the type of the source values
 * @param <T> the type of the transformed values
 * @author Push Technology Limited
 * @deprecated since 2.0.0 in favour of {@link java.util.function.Function}
 */
@SuppressWarnings("deprecation")
@Deprecated
public interface SafeTransformer<S, T> extends Transformer<S, T> {
    @Override
    T transform(S value);
}

/*******************************************************************************
 * Copyright (C) 2016 Push Technology Ltd.
 *
 * 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.pushtechnology.diffusion.transform.transformer;

import java.util.function.Function;

/**
 * A transformer. Converts values of one type into values of a different
 * type. It will not throw an exception.
 *
 * @param <S> the type of the source values
 * @param <T> the type of the transformed values
 * @author Push Technology Limited
 * @deprecated since 2.0.0 in favour of {@link java.util.function.Function}
 */
@SuppressWarnings("deprecation")
@Deprecated
public interface SafeTransformer<S, T> extends Transformer<S, T> {
    @Override
    T transform(S value);

    /**
     * Convert the transformer to a function.
     *
     * @return the transformer as a function
     */
    default Function<S, T> asFunction() {
        return this::transform;
    }
}

Add a method to convert a safe transformer to a function.


package com.veyndan.redditclient.api.reddit.network.interceptor;

import com.google.common.base.Preconditions;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public final class UserAgentInterceptor implements Interceptor {
    private static final String USER_AGENT_HEADER_NAME = "User-Agent";
    private final String userAgentHeaderValue;

    public UserAgentInterceptor(final String userAgentHeaderValue) {
        this.userAgentHeaderValue = Preconditions.checkNotNull(userAgentHeaderValue);
    }

    @Override
    public Response intercept(final Chain chain) throws IOException {
        final Request originalRequest = chain.request();
        final Request requestWithUserAgent = originalRequest.newBuilder()
                .header(USER_AGENT_HEADER_NAME, userAgentHeaderValue)
                .build();
        return chain.proceed(requestWithUserAgent);
    }
}

package com.veyndan.redditclient.api.reddit.network.interceptor;

import java.io.IOException;
import java.util.Objects;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public final class UserAgentInterceptor implements Interceptor {
    private static final String USER_AGENT_HEADER_NAME = "User-Agent";
    private final String userAgentHeaderValue;

    public UserAgentInterceptor(final String userAgentHeaderValue) {
        this.userAgentHeaderValue = Objects.requireNonNull(userAgentHeaderValue);
    }

    @Override
    public Response intercept(final Chain chain) throws IOException {
        final Request originalRequest = chain.request();
        final Request requestWithUserAgent = originalRequest.newBuilder()
                .header(USER_AGENT_HEADER_NAME, userAgentHeaderValue)
                .build();
        return chain.proceed(requestWithUserAgent);
    }
}

Replace Preconditions.checkNonNull() from Guava with Java sdks Objects.requireNonNull()


package org.cytoscape.editor.internal;

import java.util.List;

import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNetworkManager;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyTableUtil;
import org.cytoscape.task.AbstractNetworkViewTaskFactory;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.work.TaskIterator;

public class CopyTaskFactory extends AbstractNetworkViewTaskFactory {
	final CyNetworkManager netMgr;
	final ClipboardManagerImpl clipMgr;

	public CopyTaskFactory(final ClipboardManagerImpl clipboardMgr, final CyNetworkManager netMgr) {
		this.netMgr = netMgr;
		this.clipMgr = clipboardMgr;
	}

	@Override
	public boolean isReady(CyNetworkView networkView) {
		if (!super.isReady(networkView))
			return false;

		// Make sure we've got something selected
		List<CyNode> selNodes = CyTableUtil.getNodesInState(networkView.getModel(), CyNetwork.SELECTED, true);
		if (selNodes != null && selNodes.size() > 0) return true;

		return false;
	}

	@Override
	public TaskIterator createTaskIterator(CyNetworkView networkView) {
		return new TaskIterator(new CopyTask(networkView, clipMgr));
	}
}

package org.cytoscape.editor.internal;

import java.util.List;

import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNetworkManager;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyTableUtil;
import org.cytoscape.task.AbstractNetworkViewTaskFactory;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.work.TaskIterator;

public class CopyTaskFactory extends AbstractNetworkViewTaskFactory {
	final CyNetworkManager netMgr;
	final ClipboardManagerImpl clipMgr;

	public CopyTaskFactory(final ClipboardManagerImpl clipboardMgr, final CyNetworkManager netMgr) {
		this.netMgr = netMgr;
		this.clipMgr = clipboardMgr;
	}

	@Override
	public boolean isReady(CyNetworkView networkView) {
		if (!super.isReady(networkView))
			return false;

		// Make sure we've got something selected
		List<CyNode> selNodes = CyTableUtil.getNodesInState(networkView.getModel(), CyNetwork.SELECTED, true);
		if (selNodes != null && selNodes.size() > 0) return true;

		List<CyEdge> selEdges = CyTableUtil.getEdgesInState(networkView.getModel(), CyNetwork.SELECTED, true);
		if (selEdges != null && selEdges.size() > 0) return true;

		return false;
	}

	@Override
	public TaskIterator createTaskIterator(CyNetworkView networkView) {
		return new TaskIterator(new CopyTask(networkView, clipMgr));
	}
}

Make sure to allow copy if only edges are selected


/**
    ______    _           _
    |  ___|  | |         | |   1.0
    | |_ __ _| |__  _   _| | __ _
    |  _/ _` | '_ \| | | | |/ _` |
    | || (_| | |_) | |_| | | (_| |
    |_| \__,_|_.__/ \__,_|_|\__,_|

    © The Unitry, 2015

**/

package eu.theunitry.fabula;

import eu.theunitry.fabula.UNGameEngine.graphics.UNGameScreen;

public class UNFabula
{
    public static void main(String[] args)
    {
        new UNGameScreen();
    }
}

/**
    ______    _           _
    |  ___|  | |         | |   1.0
    | |_ __ _| |__  _   _| | __ _
    |  _/ _` | '_ \| | | | |/ _` |
    | || (_| | |_) | |_| | | (_| |
    \_| \__,_|_.__/ \__,_|_|\__,_|

    © The Unitry, 2015

**/

package eu.theunitry.fabula;

import eu.theunitry.fabula.UNGameEngine.graphics.UNGameScreen;

public class UNFabula
{
    public static void main(String[] args)
    {
        new UNGameScreen();
    }
}

Fix rounded corner of ASCII art

Fix rounded corner of ASCII art


package org.gitlab4j.api.models;

import org.gitlab4j.api.utils.JacksonJson;

public class ArtifactsFile {

    private String filename;
    private Integer size;

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public Integer getSize() {
        return size;
    }

    public void setSize(Integer size) {
        this.size = size;
    }

    @Override
    public String toString() {
        return (JacksonJson.toJsonString(this));
    }
}

package org.gitlab4j.api.models;

import org.gitlab4j.api.utils.JacksonJson;

public class ArtifactsFile {

    private String filename;
    private Long size;

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public Long getSize() {
        return size;
    }

    public void setSize(Long size) {
        this.size = size;
    }

    @Override
    public String toString() {
        return (JacksonJson.toJsonString(this));
    }
}

Support larger file sizes by expanding the size type to a Long.


package io.quarkus.rest.runtime.injection;

import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.sse.Sse;

import io.quarkus.rest.runtime.core.QuarkusRestRequestContext;
import io.quarkus.rest.runtime.jaxrs.QuarkusRestSse;
import io.quarkus.vertx.http.runtime.CurrentVertxRequest;

@Singleton
public class ContextProducers {

    @Inject
    CurrentVertxRequest currentVertxRequest;

    @RequestScoped
    @Produces
    UriInfo uriInfo() {
        return getContext().getUriInfo();
    }

    @RequestScoped
    @Produces
    HttpHeaders headers() {
        return getContext().getHttpHeaders();
    }

    @Singleton
    @Produces
    Sse sse() {
        return QuarkusRestSse.INSTANCE;
    }

    private QuarkusRestRequestContext getContext() {
        return (QuarkusRestRequestContext) currentVertxRequest.getOtherHttpContextObject();
    }
}

package io.quarkus.rest.runtime.injection;

import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.sse.Sse;

import io.quarkus.rest.runtime.core.QuarkusRestRequestContext;
import io.quarkus.rest.runtime.jaxrs.QuarkusRestSse;
import io.quarkus.vertx.http.runtime.CurrentVertxRequest;
import io.vertx.core.http.HttpServerRequest;

/**
 * Provides CDI producers for objects that can be injected via @Context
 * In quarkus-rest this works because @Context is considered an alias for @Inject
 * through the use of {@code AutoInjectAnnotationBuildItem}
 */
@Singleton
public class ContextProducers {

    @Inject
    CurrentVertxRequest currentVertxRequest;

    @RequestScoped
    @Produces
    UriInfo uriInfo() {
        return getContext().getUriInfo();
    }

    @RequestScoped
    @Produces
    HttpHeaders headers() {
        return getContext().getHttpHeaders();
    }

    @Singleton
    @Produces
    Sse sse() {
        return QuarkusRestSse.INSTANCE;
    }

    // HttpServerRequest is a Vert.x type so it's not necessary to have it injectable via @Context,
    // however we do use it in the Quickstarts so let's make it work

    @RequestScoped
    @Produces
    HttpServerRequest httpServerRequest() {
        return currentVertxRequest.getCurrent().request();
    }

    private QuarkusRestRequestContext getContext() {
        return (QuarkusRestRequestContext) currentVertxRequest.getOtherHttpContextObject();
    }
}

Add support for doing injecting HttpServerRequest with @Context


package com.pm.server.controller;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.pm.server.datatype.Coordinate;
import com.pm.server.player.Ghost;
import com.pm.server.player.GhostRepository;

@RestController
@RequestMapping("/ghost")
public class GhostControllerImpl implements GhostController {

	@Autowired
	private GhostRepository ghostRepository;

	@Override
	@RequestMapping(
			value="/integer",
			method=RequestMethod.GET
	)
	public int getInteger() {
		return 0;
	}

	// Returns map of ghost id to location
	@Override
	@RequestMapping(
			value="/locations",
			method=RequestMethod.GET
	)
	public Map<Integer, Coordinate> getAllLocations() {

		List<Ghost> ghosts = ghostRepository.getAllGhosts();

		Map<Integer, Coordinate> ghostsLocations =
				new HashMap<Integer, Coordinate>();

		for(Ghost ghost : ghosts) {
			ghostsLocations.put(ghost.getId(), ghost.getLocation());
		}

		return ghostsLocations;
	}

}

package com.pm.server.controller;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.pm.server.datatype.Coordinate;
import com.pm.server.player.Ghost;
import com.pm.server.player.GhostRepository;

@RestController
@RequestMapping("/ghost")
public class GhostControllerImpl implements GhostController {

	@Autowired
	private GhostRepository ghostRepository;

	@Override
	@RequestMapping(
			value="/integer",
			method=RequestMethod.GET
	)
	public int getInteger() {
		return 0;
	}

	// Returns map of ghost id to location
	@Override
	@RequestMapping(
			value="/locations",
			method=RequestMethod.GET,
			produces={ "application/json" }
	)
	public Map<Integer, Coordinate> getAllLocations() {

		List<Ghost> ghosts = ghostRepository.getAllGhosts();

		Map<Integer, Coordinate> ghostsLocations =
				new HashMap<Integer, Coordinate>();

		if(ghosts != null) {
			for(Ghost ghost : ghosts) {
				ghostsLocations.put(ghost.getId(), ghost.getLocation());
			}
		}

		return ghostsLocations;
	}

}

Fix null exception if no ghosts found

Fix null exception if no ghosts found


package org.jenkinsci.plugins.ghprb;

import hudson.ProxyConfiguration;
import org.kohsuke.github.HttpConnector;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

public class HttpConnectorWithJenkinsProxy implements HttpConnector {
    public HttpURLConnection connect(URL url) throws IOException {
        return (HttpURLConnection) ProxyConfiguration.open(url);
    }
}

package org.jenkinsci.plugins.ghprb;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

import org.kohsuke.github.HttpConnector;

import hudson.ProxyConfiguration;

public class HttpConnectorWithJenkinsProxy implements HttpConnector {
    public HttpURLConnection connect(URL url) throws IOException {
        HttpURLConnection con = (HttpURLConnection) ProxyConfiguration.open(url);

        // Set default timeouts in case there are none
        if (con.getConnectTimeout() == 0) {
            con.setConnectTimeout(10000);
        }
        if (con.getReadTimeout() == 0) {
            con.setReadTimeout(10000);
        }
        return con;
    }
}

Use default timeouts for URLConnections

[JENKINS-31827] Use default timeouts for URLConnections


package BU.transactions;

public class Rule {
	final String TYPE = "operation";

	String softwareService;
	String url;

	public Rule(String softwareService, String url) {
		this.softwareService = softwareService;
		this.url = url;
	}

	public String toString() {
		String res = "";
		String[] ssArray = this.softwareService.replaceAll(" ", "").split("\\|");

		for(int i=0; i < ssArray.length; i++)
		{
			String ss = ssArray[i];

			res += "  - ruletype: software-service" + "\n";
			res += "        softwareService: \"" + ss + "\"\n";
			res += "        type: " + TYPE + "\n";
			res += "        label: " + url + "\n";

			if(i < ssArray.length - 1)
				res += "    ";
		}

		res += "      filtered: true" + "\n";

		return res;
	}
}

package BU.transactions;

public class Rule {
	final String TYPE = "operation";

	String softwareService;
	String url;

	public Rule(String softwareService, String url) {
		this.softwareService = softwareService;
		this.url = url;
	}

	public String toString() {
		String res = "";
		String[] ssArray = this.softwareService.split("\\|");

		for(int i=0; i < ssArray.length; i++)
		{
			String ss = ssArray[i];

			res += "  - ruletype: software-service" + "\n";
			res += "        softwareService: \"" + ss + "\"\n";
			res += "        type: " + TYPE + "\n";
			res += "        label: " + url + "\n";

			if(i < ssArray.length - 1)
				res += "    ";
		}

		res += "      filtered: true" + "\n";

		return res;
	}
}

Fix bug removes spaces from Software Service names


// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document;

import com.yahoo.document.datatypes.FieldValue;
import com.yahoo.document.datatypes.ReferenceFieldValue;

public class ReferenceDataType extends DataType {

    private final DocumentType targetType;

    public ReferenceDataType(DocumentType targetType, int id) {
        super(buildTypeName(targetType), id);
        this.targetType = targetType;
    }

    private ReferenceDataType(DocumentType targetType) {
        super(buildTypeName(targetType), 0);
        setId(getName().hashCode());
        this.targetType = targetType;
    }

    private static String buildTypeName(DocumentType targetType) {
        return "Reference<" + targetType.getName() + ">";
    }

    // Creates a new type where the numeric ID is based no the hash of targetType
    public static ReferenceDataType createWithInferredId(DocumentType targetType) {
        return new ReferenceDataType(targetType);
    }

    public DocumentType getTargetType() { return targetType; }

    @Override
    public ReferenceFieldValue createFieldValue() {
        return new ReferenceFieldValue(this);
    }

    @Override
    public Class<? extends ReferenceFieldValue> getValueClass() {
        return ReferenceFieldValue.class;
    }

    @Override
    public boolean isValueCompatible(FieldValue value) {
        if (value == null) {
            return false;
        }
        if (!ReferenceFieldValue.class.isAssignableFrom(value.getClass())) {
            return false;
        }
        ReferenceFieldValue rhs = (ReferenceFieldValue)value;
        return rhs.getDataType().equals(this);
    }
}

// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document;

import com.yahoo.document.datatypes.FieldValue;
import com.yahoo.document.datatypes.ReferenceFieldValue;

public class ReferenceDataType extends DataType {

    private final DocumentType targetType;

    public ReferenceDataType(DocumentType targetType, int id) {
        super(buildTypeName(targetType), id);
        this.targetType = targetType;
    }

    private ReferenceDataType(DocumentType targetType) {
        this(targetType, buildTypeName(targetType).hashCode());
    }

    private static String buildTypeName(DocumentType targetType) {
        return "Reference<" + targetType.getName() + ">";
    }

    // Creates a new type where the numeric ID is based on the hash of targetType
    public static ReferenceDataType createWithInferredId(DocumentType targetType) {
        return new ReferenceDataType(targetType);
    }

    public DocumentType getTargetType() { return targetType; }

    @Override
    public ReferenceFieldValue createFieldValue() {
        return new ReferenceFieldValue(this);
    }

    @Override
    public Class<? extends ReferenceFieldValue> getValueClass() {
        return ReferenceFieldValue.class;
    }

    @Override
    public boolean isValueCompatible(FieldValue value) {
        if (value == null) {
            return false;
        }
        if (!ReferenceFieldValue.class.isAssignableFrom(value.getClass())) {
            return false;
        }
        ReferenceFieldValue rhs = (ReferenceFieldValue)value;
        return rhs.getDataType().equals(this);
    }
}

Delete to existing constructor and fix typo


/*
 * Copyright 2012-2014 One Platform 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.onepf.opfiab.model.event;

import android.support.annotation.NonNull;

public abstract class BillingEvent {

    public static enum Type {
        SETUP,

        CONSUME,
        PURCHASE,
        SKU_DETAILS,
        INVENTORY,
    }

    @NonNull
    private final Type type;

    protected BillingEvent(@NonNull final Type type) {
        this.type = type;
    }

    public abstract int getId();

    @NonNull
    public Type getType() {
        return type;
    }
}

/*
 * Copyright 2012-2014 One Platform 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.onepf.opfiab.model.event;

import android.support.annotation.NonNull;

public abstract class BillingEvent {

    public static enum Type {

        CONSUME,
        PURCHASE,
        SKU_DETAILS,
        INVENTORY,
    }

    @NonNull
    private final Type type;

    protected BillingEvent(@NonNull final Type type) {
        this.type = type;
    }

    public abstract int getId();

    @NonNull
    public Type getType() {
        return type;
    }
}

Change Setup as a standalone Event.

Change Setup as a standalone Event.


/**
 *
 */
package org.mwc.debrief.core.creators.chartFeatures;

import MWC.GUI.*;
import MWC.GUI.Tools.Palette.CreateVPFLayers;

/**
 * @author ian.mayo
 *
 */
public class InsertVPFLayers extends CoreInsertChartFeature
{

	/**
	 * @return
	 */
	protected Plottable getPlottable(PlainChart theChart)
	{
		return CreateVPFLayers.createMyLibrary(true);
	}

}

/**
 *
 */
package org.mwc.debrief.core.creators.chartFeatures;

import MWC.GUI.*;
import MWC.GUI.Tools.Palette.CreateVPFLayers;

/**
 * @author ian.mayo
 *
 */
public class InsertVPFLayers extends CoreInsertChartFeature
{

	public InsertVPFLayers()
	{
		// tell our parent that we want to be inserted as a top-level layer
		super(false);
	}

	/**
	 * @return
	 */
	protected Plottable getPlottable(PlainChart theChart)
	{
		return CreateVPFLayers.createMyLibrary(true);
	}

}

Stop us going in as top-level layer

Stop us going in as top-level layer

git-svn-id: d2601f1668e3cd2de409f5c059006a6eeada0abf@883 cb33b658-6c9e-41a7-9690-cba343611204


/**
 * Copyright 2014 Transmode AB
 *
 * 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 se.transmode.gradle.plugins.docker;

import org.gradle.api.JavaVersion;

/**
 * @author Matthias Grüter, matthias.gruter@transmode.com
 */
public enum JavaBaseImage {
    JAVA6("fkautz/java6-jre", JavaVersion.VERSION_1_6),
    JAVA7("dockerfile/java", JavaVersion.VERSION_1_7),
    JAVA8("aglover/java8-pier", JavaVersion.VERSION_1_8);

    final String imageName;
    final JavaVersion target;

    JavaBaseImage(String imageName, JavaVersion target) {
        this.imageName = imageName;
        this.target = target;
    }

    public static JavaBaseImage imageFor(JavaVersion target) {
        for(JavaBaseImage image: JavaBaseImage.values()) {
            if(image.target == target) {
                return image;
            }
        }
        throw new IllegalArgumentException("No Java base image for the supplied target " + target + " found.");
    }
}

/**
 * Copyright 2014 Transmode AB
 *
 * 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 se.transmode.gradle.plugins.docker;

import org.gradle.api.JavaVersion;

/**
 * @author Matthias Grüter, matthias.gruter@transmode.com
 */
public enum JavaBaseImage {
    JAVA6("java:openjdk-6-jre", JavaVersion.VERSION_1_6),
    JAVA7("java:openjdk-7-jre", JavaVersion.VERSION_1_7),
    JAVA8("java:openjdk-8-jre", JavaVersion.VERSION_1_8);

    final String imageName;
    final JavaVersion target;

    JavaBaseImage(String imageName, JavaVersion target) {
        this.imageName = imageName;
        this.target = target;
    }

    public static JavaBaseImage imageFor(JavaVersion target) {
        for(JavaBaseImage image: JavaBaseImage.values()) {
            if(image.target == target) {
                return image;
            }
        }
        throw new IllegalArgumentException("No Java base image for target " + target + " found.");
    }
}

Use new official java (openjdk-jre) base images