id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
45,201
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { <BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); IRegion region = FGManager.getInstance().getRegion(parse.args[1]); </BUG> boolean isWorldRegion = false; if (region == null) {
String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
45,202
</BUG> isWorldRegion = true; } if (region == null) <BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!")); if (region instanceof GlobalWorldRegion) { </BUG> throw new CommandException(Text.of("You may not delete the global region!")); }
if (world == null) throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!")); if (world == null) throw new CommandException(Text.of("Must specify a world!")); region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null); throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) {
45,203
source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region" ); return CommandResult.success(); } else if (isIn(HANDLERS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); <BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]); if (handler == null) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); if (handler instanceof GlobalHandler)</BUG> throw new CommandException(Text.of("You may not delete the global handler!"));
Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler)
45,204
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
45,205
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
45,206
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") <BUG>public final class FoxGuardMain { public final Cause pluginCause = Cause.builder().named("plugin", this).build(); private static FoxGuardMain instanceField;</BUG> @Inject private Logger logger;
private static FoxGuardMain instanceField;
45,207
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { <BUG>return instanceField; }</BUG> @Listener public void construct(GameConstructionEvent event) { instanceField = this;
} public static Cause getCause() { return instance().pluginCause; }
45,208
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
45,209
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.*; <BUG>import java.util.stream.Collectors; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
45,210
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index > 0) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
45,211
private static FGStorageManager instance; private final Logger logger = FoxGuardMain.instance().getLogger();</BUG> private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; <BUG>private FGStorageManager() { defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG> if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> {
45,212
String name = fgObject.getName(); Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
UUID owner = fgObject.getOwner(); boolean isOwned = !owner.equals(SERVER_UUID); Optional<User> userOwner = userStorageService.get(owner); String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name; if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
45,213
if (fgObject.autoSave()) { Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
45,214
public synchronized void loadRegionLinks() { logger.info("Loading region links"); try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey()); if (region != null) { logger.info("Loading links for region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\"");
45,215
public synchronized void loadWorldRegionLinks(World world) { logger.info("Loading world region links for world \"" + world.getName() + "\""); try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (region != null) { logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (regionOpt.isPresent()) { IWorldRegion region = regionOpt.get(); logger.info("Loading links for world region \"" + region.getName() + "\"");
45,216
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } <BUG>return builder.toString(); }</BUG> private final class LoadEntry { public final String name; public final Type type;
public enum Type { REGION, WREGION, HANDLER
45,217
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream() </BUG> .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "worldregion", "handler", "controller")
45,218
import javax.swing.ListModel; import javax.swing.SwingUtilities; import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataListener; import javax.swing.event.ListSelectionEvent; <BUG>import javax.swing.event.ListSelectionListener; import comeon.ui.UI;</BUG> import comeon.ui.preferences.BaseListCellRenderer; import comeon.ui.preferences.Model; import comeon.ui.preferences.SubController;
import org.netbeans.validation.api.ui.swing.ValidationPanel; import comeon.ui.UI;
45,219
layout.setAutoCreateContainerGaps(true); layout.setAutoCreateGaps(true); layout.setHorizontalGroup(layout.createSequentialGroup() .addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(toolboxPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); <BUG>layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(scrollPane).addComponent(toolboxPanel)); }</BUG> private List<JButton> buildButtons() { return new LinkedList<>(Arrays.asList(new JButton(addAction), new JButton(changeAction), new JButton(removeAction))); }
this.validationPanel = new ValidationPanel(); this.validationPanel.setInnerComponent(subPanel); this.subPanel.attach(validationPanel.getValidationGroup());
45,220
public void actionPerformed(final ActionEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { subController.switchToBlankModel(); <BUG>final int result = JOptionPane.showOptionDialog(SwingUtilities.getWindowAncestor((Component) e.getSource()), subPanel, UI.BUNDLE.getString(titleKey), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (JOptionPane.OK_OPTION == result) { subController.addCurrentModel();</BUG> } else { subController.rollback();
final boolean result = validationPanel.showOkCancelDialog(UI.BUNDLE.getString(titleKey)); if (result) { subController.addCurrentModel();
45,221
@Override public void actionPerformed(final ActionEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { <BUG>final int result = JOptionPane.showOptionDialog(SwingUtilities.getWindowAncestor((Component) e.getSource()), subPanel, UI.BUNDLE.getString(titleKey), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (result == JOptionPane.OK_OPTION) { subController.commit(list.getSelectedIndex());</BUG> } else { subController.rollback();
subController.switchToBlankModel(); final boolean result = validationPanel.showOkCancelDialog(UI.BUNDLE.getString(titleKey)); if (result) { subController.addCurrentModel();
45,222
package comeon.ui.preferences; import javax.swing.GroupLayout; import javax.swing.JComponent; import javax.swing.JLabel; <BUG>import javax.swing.JPanel; import comeon.ui.UI; import comeon.ui.preferences.input.NotBlankInputVerifier;</BUG> public abstract class SubPanel<M> extends JPanel { private static final long serialVersionUID = 1L;
import org.netbeans.validation.api.ui.ValidationGroup;
45,223
this.setLayout(layout); } protected final void layoutComponents() { this.doLayoutComponents(layout); } <BUG>protected abstract void doLayoutComponents(final GroupLayout layout); protected static final class AssociatedLabel extends JLabel {</BUG> private static final long serialVersionUID = 1L; public AssociatedLabel(final String key, final JComponent component) { super(UI.BUNDLE.getString(key));
public final void attach(final ValidationGroup validationGroup) { this.doAttach(validationGroup); protected abstract void doAttach(final ValidationGroup validationGroup); protected static final class AssociatedLabel extends JLabel {
45,224
import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; <BUG>import javax.swing.SwingUtilities; import com.google.inject.Inject;</BUG> import com.google.inject.Singleton; import comeon.model.TemplateKind; import comeon.templates.Templates;
import org.netbeans.validation.api.builtin.stringvalidation.StringValidators; import org.netbeans.validation.api.ui.ValidationGroup; import com.google.inject.Inject;
45,225
this.fileField.setEditable(false); this.fileField.setInputVerifier(NOT_BLANK_INPUT_VERIFIER);</BUG> this.fileButton = new JButton(UI.BUNDLE.getString("prefs.templates.path.pick")); <BUG>this.charsetField = new JComboBox<>(templates.getSupportedCharsets()); this.kindField = new JComboBox<>(templates.getTemplateKinds().toArray(new TemplateKind[0])); this.fileChooser = new JFileChooser();</BUG> this.fileChooser.setMultiSelectionEnabled(false); this.fileButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) {
this.charsetField.setName(UI.BUNDLE.getString("prefs.templates.charset")); this.kindField.setName(UI.BUNDLE.getString("prefs.templates.kind")); this.fileChooser = new JFileChooser();
45,226
throw new IllegalArgumentException("Unexpected method: "+method); } setupRequest(url, httpRequest, res); // can throw IOException } catch (Exception e) { res.sampleStart(); <BUG>res.sampleEnd(); HTTPSampleResult err = errorResult(e, res); err.setSampleLabel("Error: " + url.toString()); return err; </BUG> }
return res;
45,227
if (cacheManager != null){ cacheManager.saveDetails(httpResponse, res); } res = resultProcessing(areFollowingRedirect, frameDepth, res); } catch (IOException e) { <BUG>res.sampleEnd(); HTTPSampleResult err = errorResult(e, res); err.setSampleLabel("Error: " + url.toString()); return err; </BUG> } catch (RuntimeException e) {
return res;
45,228
err.setSampleLabel("Error: " + url.toString()); return err; </BUG> } catch (RuntimeException e) { <BUG>res.sampleEnd(); HTTPSampleResult err = errorResult(e, res); err.setSampleLabel("Error: " + url.toString()); return err; </BUG> } finally {
if (cacheManager != null){ cacheManager.saveDetails(httpResponse, res); } res = resultProcessing(areFollowingRedirect, frameDepth, res); } catch (IOException e) { return res; return res;
45,229
err.setSampleLabel("Error: " + url.toString()); return err; </BUG> } catch (IOException e) { <BUG>res.sampleEnd(); HTTPSampleResult err = errorResult(e, res); err.setSampleLabel("Error: " + url.toString()); return err; </BUG> } finally {
cacheManager.saveDetails(httpMethod, res); } res = resultProcessing(areFollowingRedirect, frameDepth, res); log.debug("End : sample"); return res; } catch (IllegalArgumentException e) { // e.g. some kinds of invalid URL return res; return res;
45,230
package heros; import java.util.Collection; import java.util.List; import java.util.Set; public interface InterproceduralCFG<N,M> { <BUG>public M getMethodOf(N n); public List<N> getSuccsOf(N n);</BUG> public Collection<M> getCalleesOfCallAt(N n); public Collection<N> getCallersOf(M m); public Set<N> getCallsFromWithin(M m);
public List<N> getPredsOf(N u); public List<N> getSuccsOf(N n);
45,231
} @RootTask static Task<Exec.Result> exec(String parameter, int number) { Task<String> task1 = MyTask.create(parameter); Task<Integer> task2 = Adder.create(number, number + 2); <BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh") .in(() -> task1)</BUG> .in(() -> task2) .process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\""))); }
return Task.named("exec", "/bin/sh").ofType(Exec.Result.class) .in(() -> task1)
45,232
return args; } static class MyTask { static final int PLUS = 10; static Task<String> create(String parameter) { <BUG>return Task.ofType(String.class).named("MyTask", parameter) .in(() -> Adder.create(parameter.length(), PLUS))</BUG> .in(() -> Fib.create(parameter.length())) .process((sum, fib) -> something(parameter, sum, fib)); }
return Task.named("MyTask", parameter).ofType(String.class) .in(() -> Adder.create(parameter.length(), PLUS))
45,233
final String instanceField = "from instance"; final TaskContext context = TaskContext.inmem(); final AwaitingConsumer<String> val = new AwaitingConsumer<>(); @Test public void shouldJavaUtilSerialize() throws Exception { <BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39) .process(() -> 9999L); Task<String> task2 = Task.ofType(String.class).named("Baz", 40) .in(() -> task1)</BUG> .ins(() -> singletonList(task1))
Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class) Task<String> task2 = Task.named("Baz", 40).ofType(String.class) .in(() -> task1)
45,234
assertEquals(des.id().name(), "Baz"); assertEquals(val.awaitAndGet(), "[9999] hello 10004"); } @Test(expected = NotSerializableException.class) public void shouldNotSerializeWithInstanceFieldReference() throws Exception { <BUG>Task<String> task = Task.ofType(String.class).named("WithRef") .process(() -> instanceField + " causes an outer reference");</BUG> serialize(task); } @Test
Task<String> task = Task.named("WithRef").ofType(String.class) .process(() -> instanceField + " causes an outer reference");
45,235
serialize(task); } @Test public void shouldSerializeWithLocalReference() throws Exception { String local = instanceField; <BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef") .process(() -> local + " won't cause an outer reference");</BUG> serialize(task); Task<String> des = deserialize(); context.evaluate(des).consume(val);
Task<String> task = Task.named("WithLocalRef").ofType(String.class) .process(() -> local + " won't cause an outer reference");
45,236
} @RootTask public static Task<String> standardArgs(int first, String second) { firstInt = first; secondString = second; <BUG>return Task.ofType(String.class).named("StandardArgs", first, second) .process(() -> second + " " + first * 100);</BUG> } @Test public void shouldParseFlags() throws Exception {
return Task.named("StandardArgs", first, second).ofType(String.class) .process(() -> second + " " + first * 100);
45,237
assertThat(parsedEnum, is(CustomEnum.BAR)); } @RootTask public static Task<String> enums(CustomEnum enm) { parsedEnum = enm; <BUG>return Task.ofType(String.class).named("Enums", enm) .process(enm::toString);</BUG> } @Test public void shouldParseCustomTypes() throws Exception {
return Task.named("Enums", enm).ofType(String.class) .process(enm::toString);
45,238
assertThat(parsedType.content, is("blarg parsed for you!")); } @RootTask public static Task<String> customType(CustomType myType) { parsedType = myType; <BUG>return Task.ofType(String.class).named("Types", myType.content) .process(() -> myType.content);</BUG> } public enum CustomEnum { BAR
return Task.named("Types", myType.content).ofType(String.class) .process(() -> myType.content);
45,239
TaskContext taskContext = TaskContext.inmem(); TaskContext.Value<Long> value = taskContext.evaluate(fib92); value.consume(f92 -> System.out.println("fib(92) = " + f92)); } static Task<Long> create(long n) { <BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n); </BUG> if (n < 2) { return fib .process(() -> n);
TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
45,240
rest("/cart/").description("Personal Shopping Cart Service") .produces(MediaType.APPLICATION_JSON_VALUE) .options("/{cartId}") .route().id("getCartOptionsRoute").end().endRest() .options("/checkout/{cartId}") <BUG>.route().id("checkoutCartOptionsRoute").end().endRest() .options("/{cartId}/{itemId}/{quantity}")</BUG> .route().id("cartAddDeleteOptionsRoute").end().endRest() .post("/checkout/{cartId}").description("Finalize shopping cart and process payment") .param().name("cartId").type(RestParamType.path).description("The ID of the cart to process").dataType("string").endParam()
.options("/{cartId}/{tmpId}") .route().id("cartSetOptionsRoute").end().endRest() .options("/{cartId}/{itemId}/{quantity}")
45,241
} @RootTask static Task<Exec.Result> exec(String parameter, int number) { Task<String> task1 = MyTask.create(parameter); Task<Integer> task2 = Adder.create(number, number + 2); <BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh") .in(() -> task1)</BUG> .in(() -> task2) .process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\""))); }
return Task.named("exec", "/bin/sh").ofType(Exec.Result.class) .in(() -> task1)
45,242
return args; } static class MyTask { static final int PLUS = 10; static Task<String> create(String parameter) { <BUG>return Task.ofType(String.class).named("MyTask", parameter) .in(() -> Adder.create(parameter.length(), PLUS))</BUG> .in(() -> Fib.create(parameter.length())) .process((sum, fib) -> something(parameter, sum, fib)); }
return Task.named("MyTask", parameter).ofType(String.class) .in(() -> Adder.create(parameter.length(), PLUS))
45,243
final String instanceField = "from instance"; final TaskContext context = TaskContext.inmem(); final AwaitingConsumer<String> val = new AwaitingConsumer<>(); @Test public void shouldJavaUtilSerialize() throws Exception { <BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39) .process(() -> 9999L); Task<String> task2 = Task.ofType(String.class).named("Baz", 40) .in(() -> task1)</BUG> .ins(() -> singletonList(task1))
Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class) Task<String> task2 = Task.named("Baz", 40).ofType(String.class) .in(() -> task1)
45,244
assertEquals(des.id().name(), "Baz"); assertEquals(val.awaitAndGet(), "[9999] hello 10004"); } @Test(expected = NotSerializableException.class) public void shouldNotSerializeWithInstanceFieldReference() throws Exception { <BUG>Task<String> task = Task.ofType(String.class).named("WithRef") .process(() -> instanceField + " causes an outer reference");</BUG> serialize(task); } @Test
Task<String> task = Task.named("WithRef").ofType(String.class) .process(() -> instanceField + " causes an outer reference");
45,245
serialize(task); } @Test public void shouldSerializeWithLocalReference() throws Exception { String local = instanceField; <BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef") .process(() -> local + " won't cause an outer reference");</BUG> serialize(task); Task<String> des = deserialize(); context.evaluate(des).consume(val);
Task<String> task = Task.named("WithLocalRef").ofType(String.class) .process(() -> local + " won't cause an outer reference");
45,246
} @RootTask public static Task<String> standardArgs(int first, String second) { firstInt = first; secondString = second; <BUG>return Task.ofType(String.class).named("StandardArgs", first, second) .process(() -> second + " " + first * 100);</BUG> } @Test public void shouldParseFlags() throws Exception {
return Task.named("StandardArgs", first, second).ofType(String.class) .process(() -> second + " " + first * 100);
45,247
assertThat(parsedEnum, is(CustomEnum.BAR)); } @RootTask public static Task<String> enums(CustomEnum enm) { parsedEnum = enm; <BUG>return Task.ofType(String.class).named("Enums", enm) .process(enm::toString);</BUG> } @Test public void shouldParseCustomTypes() throws Exception {
return Task.named("Enums", enm).ofType(String.class) .process(enm::toString);
45,248
assertThat(parsedType.content, is("blarg parsed for you!")); } @RootTask public static Task<String> customType(CustomType myType) { parsedType = myType; <BUG>return Task.ofType(String.class).named("Types", myType.content) .process(() -> myType.content);</BUG> } public enum CustomEnum { BAR
return Task.named("Types", myType.content).ofType(String.class) .process(() -> myType.content);
45,249
TaskContext taskContext = TaskContext.inmem(); TaskContext.Value<Long> value = taskContext.evaluate(fib92); value.consume(f92 -> System.out.println("fib(92) = " + f92)); } static Task<Long> create(long n) { <BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n); </BUG> if (n < 2) { return fib .process(() -> n);
TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
45,250
import javax.jcr.NodeIterator; import javax.jcr.RepositoryException; import javax.jcr.Session;</BUG> import javax.jcr.query.Query; <BUG>import javax.jcr.query.QueryManager; import javax.jcr.query.QueryResult;</BUG> import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property;
package com.cognifide.actions.core.internal; import java.util.Calendar; import java.util.Iterator; import java.util.Map;
45,251
import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Reference; <BUG>import org.apache.jackrabbit.util.ISO8601; import org.apache.sling.api.resource.ResourceResolver;</BUG> import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.commons.osgi.PropertiesUtil; import org.apache.sling.commons.scheduler.Scheduler;
import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.PersistenceException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver;
45,252
@Activate void activate(Map<String, Object> config) throws Exception { ttl = PropertiesUtil.toInteger(config.get(TTL_NAME), TTL_DEFAULT); } public void run() { <BUG>Calendar until = Calendar.getInstance(); </BUG> until.add(Calendar.HOUR, -ttl); ResourceResolver resolver = null; try {
final Calendar until = Calendar.getInstance();
45,253
} else if (name == until) { untilNode = childNode; }</BUG> } if (modified) { <BUG>session.save(); } return untilNode; </BUG> }
untilResource = childResource; resolver.commit(); return untilResource;
45,254
String ip = null; int port = -1; if(localAddressSecond != null && relayedAddressSecond != null) { LocalCandidate candidate = createJingleNodesCandidate( <BUG>relayedAddressSecond, component, localAddressSecond); candidates.add(candidate); component.addLocalCandidate(candidate); localAddressSecond = null;</BUG> relayedAddressSecond = null;
if( component.addLocalCandidate(candidate)) } localAddressSecond = null;
45,255
relayedAddress, component, localAddress); relayedAddressSecond = new TransportAddress(ip, port + 1,Transport.UDP); localAddressSecond = new TransportAddress(ip, ciq.getLocalport() + 1, <BUG>Transport.UDP); candidates.add(local); component.addLocalCandidate(local); }</BUG> return candidates;
if( component.addLocalCandidate(local)) {
45,256
"</employee>" + "<employee>" + "<age>22</age>" + "<name>Sheldon</name>" + "</employee>" + <BUG>"</employees>") .status(HttpStatus.OK));</BUG> citrusFramework.run(citrus.getTestCase()); }
"<age>21</age>" + "<name>Leonard</name>" + "</employees>");
45,257
} @Test @InSequence(5) @CitrusTest public void testClientSideNegotiation(@CitrusResource TestDesigner citrus) { <BUG>citrus.send(serviceUri) .message(new HttpMessage() .method(HttpMethod.GET) .accept(MediaType.APPLICATION_JSON)); citrus.receive(serviceUri) .messageType(MessageType.JSON) .message(new HttpMessage("{\"employee\":[" + "{\"name\":\"Penny\",\"age\":20,\"email\":null}," +</BUG> "{\"name\":\"Sheldon\",\"age\":22,\"email\":null}," +
citrus.http().client(serviceUri) .get() .accept(MediaType.APPLICATION_JSON); citrus.http().client(serviceUri) .response(HttpStatus.OK) .payload("{\"employee\":[" + "{\"name\":\"Penny\",\"age\":20,\"email\":null}," +
45,258
.messageType(MessageType.JSON) .message(new HttpMessage("{\"employee\":[" + "{\"name\":\"Penny\",\"age\":20,\"email\":null}," +</BUG> "{\"name\":\"Sheldon\",\"age\":22,\"email\":null}," + "{\"name\":\"Howard\",\"age\":21,\"email\":\"howard@example.com\"}" + <BUG>"]}") .status(HttpStatus.OK));</BUG> citrusFramework.run(citrus.getTestCase()); }
.payload("{\"employee\":[" + "{\"name\":\"Penny\",\"age\":20,\"email\":null}," + "]}");
45,259
serviceUri = new URL(baseUri, "registry/employee").toExternalForm(); } @Test @CitrusTest public void testPostWithWelcomeEmail(@CitrusResource TestDesigner citrus) { <BUG>citrus.send(serviceUri) .fork(true) .message(new HttpMessage("name=Rajesh&age=20&email=rajesh@example.com") .method(HttpMethod.POST) .contentType(MediaType.APPLICATION_FORM_URLENCODED)); citrus.receive(mailServer)</BUG> .payload("<mail-message xmlns=\"http://www.citrusframework.org/schema/mail/message\">" +
citrus.http().client(serviceUri) .post() .contentType(MediaType.APPLICATION_FORM_URLENCODED) .payload("name=Rajesh&age=20&email=rajesh@example.com"); citrus.receive(mailServer)
45,260
public ReportElement getBase() { return base; } @Override public float print(PDDocument document, PDPageContentStream stream, int pageNumber, float startX, float startY, float allowedWidth) throws IOException { <BUG>PDPage currPage = (PDPage) document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, true, false); </BUG> base.print(document, pageStream, pageNo, x, y, width); pageStream.close();
PDPage currPage = document.getDocumentCatalog().getPages().get(pageNo); PDPageContentStream pageStream = new PDPageContentStream(document, currPage, PDPageContentStream.AppendMode.APPEND, false);
45,261
public PdfTextStyle(String config) { Assert.hasText(config); String[] split = config.split(","); Assert.isTrue(split.length == 3, "config must look like: 10,Times-Roman,#000000"); fontSize = Integer.parseInt(split[0]); <BUG>font = resolveStandard14Name(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));</BUG> } public int getFontSize() { return fontSize;
font = getFont(split[1]); color = new Color(Integer.valueOf(split[2].substring(1), 16));
45,262
package cc.catalysts.boot.report.pdf.elements; import cc.catalysts.boot.report.pdf.config.PdfTextStyle; import cc.catalysts.boot.report.pdf.utils.ReportAlignType; import org.apache.pdfbox.pdmodel.PDPageContentStream; <BUG>import org.apache.pdfbox.pdmodel.font.PDFont; import org.slf4j.Logger;</BUG> import org.slf4j.LoggerFactory; import org.springframework.util.StringUtils; import java.io.IOException;
import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.util.Matrix; import org.slf4j.Logger;
45,263
addTextSimple(stream, textConfig, textX, nextLineY, ""); return nextLineY; } try { <BUG>String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, fixedText); </BUG> float x = calculateAlignPosition(textX, align, textConfig, allowedWidth, split[0]); if (!underline) { addTextSimple(stream, textConfig, x, nextLineY, split[0]); } else {
String[] split = splitText(textConfig.getFont(), textConfig.getFontSize(), allowedWidth, text);
45,264
public static void addTextSimple(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { try { stream.setFont(textConfig.getFont(), textConfig.getFontSize()); stream.setNonStrokingColor(textConfig.getColor()); stream.beginText(); <BUG>stream.newLineAtOffset(textX, textY); stream.showText(text);</BUG> } catch (Exception e) { LOG.warn("Could not add text: " + e.getClass() + " - " + e.getMessage()); }
stream.setTextMatrix(new Matrix(1,0,0,1, textX, textY)); stream.showText(text);
45,265
public static void addTextSimpleUnderlined(PDPageContentStream stream, PdfTextStyle textConfig, float textX, float textY, String text) { addTextSimple(stream, textConfig, textX, textY, text); try { float lineOffset = textConfig.getFontSize() / 8F; stream.setStrokingColor(textConfig.getColor()); <BUG>stream.setLineWidth(0.5F); stream.drawLine(textX, textY - lineOffset, textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset); </BUG> stream.stroke(); } catch (IOException e) {
stream.moveTo(textX, textY - lineOffset); stream.lineTo(textX + getTextWidth(textConfig.getFont(), textConfig.getFontSize(), text), textY - lineOffset);
45,266
list.add(text.length()); return list; } public static String[] splitText(PDFont font, int fontSize, float allowedWidth, String text) { String endPart = ""; <BUG>String shortenedText = text; List<String> breakSplitted = Arrays.asList(shortenedText.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {</BUG> String[] splittedFirst = splitText(font, fontSize, allowedWidth, breakSplitted.get(0)); StringBuilder remaining = new StringBuilder(splittedFirst[1] == null ? "" : splittedFirst[1] + "\n");
List<String> breakSplitted = Arrays.asList(text.split("(\\r\\n)|(\\n)|(\\n\\r)")).stream().collect(Collectors.toList()); if (breakSplitted.size() > 1) {
45,267
package cc.catalysts.boot.report.pdf.elements; import org.apache.pdfbox.pdmodel.PDDocument; <BUG>import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import java.io.IOException;</BUG> import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList;
import org.apache.pdfbox.pdmodel.PDPageContentStream; import java.io.IOException;
45,268
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.util.Progressable; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AFileSystem extends FileSystem {</BUG> private URI uri; private Path workingDir; private AmazonS3Client s3;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AFileSystem extends FileSystem {
45,269
public void initialize(URI name, Configuration conf) throws IOException { super.initialize(name, conf); uri = URI.create(name.getScheme() + "://" + name.getAuthority()); workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri, this.getWorkingDirectory()); <BUG>String accessKey = conf.get(ACCESS_KEY, null); String secretKey = conf.get(SECRET_KEY, null); </BUG> String userInfo = name.getUserInfo();
String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null)); String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
45,270
} else { accessKey = userInfo; } } AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain( <BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey), new InstanceProfileCredentialsProvider(), new S3AAnonymousAWSCredentialsProvider() );</BUG> bucket = name.getHost();
new BasicAWSCredentialsProvider(accessKey, secretKey), new AnonymousAWSCredentialsProvider()
45,271
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)); </BUG> s3 = new AmazonS3Client(credentials, awsConf); <BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS); partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (partSize < 5 * 1024 * 1024) {
new InstanceProfileCredentialsProvider(), new AnonymousAWSCredentialsProvider() bucket = name.getHost(); ClientConfiguration awsConf = new ClientConfiguration(); awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS))); awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP); awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES))); awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT))); maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS)); partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE)); partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
45,272
cannedACL = null; } if (!s3.doesBucketExist(bucket)) { throw new IOException("Bucket " + bucket + " does not exist"); } <BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART); long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE); </BUG> if (purgeExistingMultipart) {
boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART)); long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
45,273
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AOutputStream extends OutputStream {</BUG> private OutputStream backupStream; private File backupFile; private boolean closed;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AOutputStream extends OutputStream {
45,274
this.client = client; this.progress = progress; this.fs = fs; this.cannedACL = cannedACL; this.statistics = statistics; <BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (conf.get(BUFFER_DIR, null) != null) {
partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
45,275
log.info("tree node link was clicked, user object: " + node.getUserObject()); } protected AbstractImage getNodeImage(final DefaultMutableTreeNode node) { if (node.isLeaf()) <BUG>{ String url = getRequestCycle().urlFor(IMG_NODE, IResourceListener.class); LocalImage img = new LocalImage(NODE_IMAGE_NAME, url); return img;</BUG> }
return IMG_NODE;
45,276
return img;</BUG> } else { if (isExpanded(node)) <BUG>{ String url= getRequestCycle().urlFor(IMG_FOLDER_OPEN, IResourceListener.class); LocalImage img = new LocalImage(NODE_IMAGE_NAME, url); return img;</BUG> }
log.info("tree node link was clicked, user object: " + node.getUserObject()); protected AbstractImage getNodeImage(final DefaultMutableTreeNode node) if (node.isLeaf()) return IMG_NODE; return IMG_FOLDER_OPEN;
45,277
String url= getRequestCycle().urlFor(IMG_FOLDER_OPEN, IResourceListener.class); LocalImage img = new LocalImage(NODE_IMAGE_NAME, url); return img;</BUG> } else <BUG>{ String url = getRequestCycle().urlFor(IMG_FOLDER, IResourceListener.class); LocalImage img = new LocalImage(NODE_IMAGE_NAME, url); return img;</BUG> }
log.info("tree node link was clicked, user object: " + node.getUserObject()); protected AbstractImage getNodeImage(final DefaultMutableTreeNode node) if (node.isLeaf()) return IMG_NODE; if (isExpanded(node)) return IMG_FOLDER_OPEN;
45,278
else { return String.valueOf(node.getUserObject()); } } <BUG>private static final class LocalImage extends Image { public LocalImage(String name, Serializable object) { super(name, object);</BUG> }
if (isExpanded(node)) return IMG_FOLDER_OPEN;
45,279
} @RootTask static Task<Exec.Result> exec(String parameter, int number) { Task<String> task1 = MyTask.create(parameter); Task<Integer> task2 = Adder.create(number, number + 2); <BUG>return Task.ofType(Exec.Result.class).named("exec", "/bin/sh") .in(() -> task1)</BUG> .in(() -> task2) .process(Exec.exec((str, i) -> args("/bin/sh", "-c", "\"echo " + i + "\""))); }
return Task.named("exec", "/bin/sh").ofType(Exec.Result.class) .in(() -> task1)
45,280
return args; } static class MyTask { static final int PLUS = 10; static Task<String> create(String parameter) { <BUG>return Task.ofType(String.class).named("MyTask", parameter) .in(() -> Adder.create(parameter.length(), PLUS))</BUG> .in(() -> Fib.create(parameter.length())) .process((sum, fib) -> something(parameter, sum, fib)); }
return Task.named("MyTask", parameter).ofType(String.class) .in(() -> Adder.create(parameter.length(), PLUS))
45,281
final String instanceField = "from instance"; final TaskContext context = TaskContext.inmem(); final AwaitingConsumer<String> val = new AwaitingConsumer<>(); @Test public void shouldJavaUtilSerialize() throws Exception { <BUG>Task<Long> task1 = Task.ofType(Long.class).named("Foo", "Bar", 39) .process(() -> 9999L); Task<String> task2 = Task.ofType(String.class).named("Baz", 40) .in(() -> task1)</BUG> .ins(() -> singletonList(task1))
Task<Long> task1 = Task.named("Foo", "Bar", 39).ofType(Long.class) Task<String> task2 = Task.named("Baz", 40).ofType(String.class) .in(() -> task1)
45,282
assertEquals(des.id().name(), "Baz"); assertEquals(val.awaitAndGet(), "[9999] hello 10004"); } @Test(expected = NotSerializableException.class) public void shouldNotSerializeWithInstanceFieldReference() throws Exception { <BUG>Task<String> task = Task.ofType(String.class).named("WithRef") .process(() -> instanceField + " causes an outer reference");</BUG> serialize(task); } @Test
Task<String> task = Task.named("WithRef").ofType(String.class) .process(() -> instanceField + " causes an outer reference");
45,283
serialize(task); } @Test public void shouldSerializeWithLocalReference() throws Exception { String local = instanceField; <BUG>Task<String> task = Task.ofType(String.class).named("WithLocalRef") .process(() -> local + " won't cause an outer reference");</BUG> serialize(task); Task<String> des = deserialize(); context.evaluate(des).consume(val);
Task<String> task = Task.named("WithLocalRef").ofType(String.class) .process(() -> local + " won't cause an outer reference");
45,284
} @RootTask public static Task<String> standardArgs(int first, String second) { firstInt = first; secondString = second; <BUG>return Task.ofType(String.class).named("StandardArgs", first, second) .process(() -> second + " " + first * 100);</BUG> } @Test public void shouldParseFlags() throws Exception {
return Task.named("StandardArgs", first, second).ofType(String.class) .process(() -> second + " " + first * 100);
45,285
assertThat(parsedEnum, is(CustomEnum.BAR)); } @RootTask public static Task<String> enums(CustomEnum enm) { parsedEnum = enm; <BUG>return Task.ofType(String.class).named("Enums", enm) .process(enm::toString);</BUG> } @Test public void shouldParseCustomTypes() throws Exception {
return Task.named("Enums", enm).ofType(String.class) .process(enm::toString);
45,286
assertThat(parsedType.content, is("blarg parsed for you!")); } @RootTask public static Task<String> customType(CustomType myType) { parsedType = myType; <BUG>return Task.ofType(String.class).named("Types", myType.content) .process(() -> myType.content);</BUG> } public enum CustomEnum { BAR
return Task.named("Types", myType.content).ofType(String.class) .process(() -> myType.content);
45,287
TaskContext taskContext = TaskContext.inmem(); TaskContext.Value<Long> value = taskContext.evaluate(fib92); value.consume(f92 -> System.out.println("fib(92) = " + f92)); } static Task<Long> create(long n) { <BUG>TaskBuilder<Long> fib = Task.ofType(Long.class).named("Fib", n); </BUG> if (n < 2) { return fib .process(() -> n);
TaskBuilder<Long> fib = Task.named("Fib", n).ofType(Long.class);
45,288
import java.util.Arrays; import java.util.List; import java.util.Map; import org.jenkinsci.plugins.dockerbuildstep.action.EnvInvisibleAction; import org.jenkinsci.plugins.dockerbuildstep.log.ConsoleLogger; <BUG>import org.jenkinsci.plugins.dockerbuildstep.util.BindParser; import org.jenkinsci.plugins.dockerbuildstep.util.PortBindingParser;</BUG> import org.jenkinsci.plugins.dockerbuildstep.util.PortUtils; import org.jenkinsci.plugins.dockerbuildstep.util.Resolver; import org.kohsuke.stapler.DataBoundConstructor;
import org.jenkinsci.plugins.dockerbuildstep.util.LinkUtils; import org.jenkinsci.plugins.dockerbuildstep.util.PortBindingParser;
45,289
import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.api.DockerException; import com.github.dockerjava.api.command.InspectContainerResponse; <BUG>import com.github.dockerjava.api.model.Bind; import com.github.dockerjava.api.model.PortBinding;</BUG> public class StartCommand extends DockerCommand { private final String containerIds; private final boolean publishAllPorts;
import com.github.dockerjava.api.model.Links; import com.github.dockerjava.api.model.PortBinding;
45,290
public String getPortBindings() { return portBindings; } public String getWaitPorts() { return waitPorts; <BUG>} public String getBindMounts() {</BUG> return bindMounts; } public boolean getPrivileged() {
public String getLinks() { return links; public String getBindMounts() {
45,291
public void execute(@SuppressWarnings("rawtypes") AbstractBuild build, ConsoleLogger console) throws DockerException { if (containerIds == null || containerIds.isEmpty()) { throw new IllegalArgumentException("At least one parameter is required"); } <BUG>String containerIdsRes = Resolver.buildVar(build, containerIds); String portBindingsRes = Resolver.buildVar(build, portBindings); String bindMountsRes = Resolver.buildVar(build, bindMounts); List<String> ids = Arrays.asList(containerIdsRes.split(",")); PortBinding[] portBindings = PortBindingParser.parse(portBindingsRes); Bind[] binds = BindParser.parse(bindMountsRes); DockerClient client = getClient();</BUG> for (String id : ids) {
List<String> ids = Arrays.asList(Resolver.buildVar(build, containerIds).split(",")); PortBinding[] portBindingsRes = PortBindingParser.parse(Resolver.buildVar(build, portBindings)); Links linksRes = LinkUtils.parseLinks(Resolver.buildVar(build, links)); Bind[] bindsRes = BindParser.parse(Resolver.buildVar(build, bindMounts)); DockerClient client = getClient();
45,292
private final String signature; private MemberSignature(@NotNull String signature) { this.signature = signature; } @NotNull <BUG>public static MemberSignature fromMethodNameAndDesc(@NotNull Name name, @NotNull String desc) { return new MemberSignature(name.asString() + desc); } @NotNull public static MemberSignature fromAsmMethod(@NotNull Method method) { return new MemberSignature(method.toString());</BUG> }
[DELETED]
45,293
String type = deserializer.typeDescriptor(field.getType()); Name name = nameResolver.getName(field.getName()); return MemberSignature.fromFieldNameAndDesc(name, type); } else if (propertySignature.hasSyntheticMethod()) { <BUG>return MemberSignature.fromAsmMethod(deserializer.methodSignature(propertySignature.getSyntheticMethod())); }</BUG> } break; }
return deserializer.methodSignature(propertySignature.getSyntheticMethod());
45,294
for (int i = 0, length = signature.getParameterTypeCount(); i < length; i++) { typeDescriptor(signature.getParameterType(i), sb); } sb.append(')'); typeDescriptor(signature.getReturnType(), sb); <BUG>return new Method(name.asString(), sb.toString()); }</BUG> @NotNull public String typeDescriptor(@NotNull JavaProtoBuf.JavaType type) {
return name.asString() + sb.toString(); public DescriptorDeserializersStorage.MemberSignature methodSignature(@NotNull JavaProtoBuf.JavaMethodSignature signature) { return DescriptorDeserializersStorage.MemberSignature.fromMethodNameAndDesc(methodSignatureString(signature));
45,295
private final UnaryCallable<ListGroupStatsRequest, ListGroupStatsPagedResponse> listGroupStatsPagedCallable; private final UnaryCallable<ListEventsRequest, ListEventsResponse> listEventsCallable; private final UnaryCallable<ListEventsRequest, ListEventsPagedResponse> listEventsPagedCallable; private final UnaryCallable<DeleteEventsRequest, DeleteEventsResponse> deleteEventsCallable; <BUG>private static final PathTemplate PROJECT_PATH_TEMPLATE = PathTemplate.createWithoutUrlEncoding("projects/{project}"); public static final String formatProjectName(String project) { return PROJECT_PATH_TEMPLATE.instantiate("project", project); } public static final String parseProjectFromProjectName(String projectName) { return PROJECT_PATH_TEMPLATE.parse(projectName).get("project"); }</BUG> public static final ErrorStatsServiceClient create() throws IOException {
[DELETED]
45,296
package org.glowroot.agent.config; import com.google.common.collect.ImmutableList; <BUG>import org.immutables.value.Value; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;</BUG> @Value.Immutable public abstract class UiConfig { @Value.Default
import org.glowroot.common.config.ConfigDefaults; import org.glowroot.wire.api.model.AgentConfigOuterClass.AgentConfig;
45,297
class RepoAdminImpl implements RepoAdmin { private final DataSource dataSource; private final List<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; private final ConfigRepository configRepository; <BUG>private final AgentDao agentDao; </BUG> private final GaugeValueDao gaugeValueDao; private final GaugeNameDao gaugeNameDao; private final TransactionTypeDao transactionTypeDao;
private final EnvironmentDao agentDao;
45,298
private final TransactionTypeDao transactionTypeDao; private final FullQueryTextDao fullQueryTextDao; private final TraceAttributeNameDao traceAttributeNameDao; RepoAdminImpl(DataSource dataSource, List<CappedDatabase> rollupCappedDatabases, CappedDatabase traceCappedDatabase, ConfigRepository configRepository, <BUG>AgentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao, </BUG> TransactionTypeDao transactionTypeDao, FullQueryTextDao fullQueryTextDao, TraceAttributeNameDao traceAttributeNameDao) { this.dataSource = dataSource;
EnvironmentDao agentDao, GaugeValueDao gaugeValueDao, GaugeNameDao gaugeNameDao,
45,299
this.fullQueryTextDao = fullQueryTextDao; this.traceAttributeNameDao = traceAttributeNameDao; } @Override public void deleteAllData() throws Exception { <BUG>Environment environment = agentDao.readEnvironment(""); dataSource.deleteAll();</BUG> agentDao.reinitAfterDeletingDatabase(); gaugeValueDao.reinitAfterDeletingDatabase(); gaugeNameDao.invalidateCache();
Environment environment = agentDao.read(""); dataSource.deleteAll();
45,300
public class SimpleRepoModule { private static final long SNAPSHOT_REAPER_PERIOD_MINUTES = 5; private final DataSource dataSource; private final ImmutableList<CappedDatabase> rollupCappedDatabases; private final CappedDatabase traceCappedDatabase; <BUG>private final AgentDao agentDao; private final TransactionTypeDao transactionTypeDao;</BUG> private final AggregateDao aggregateDao; private final TraceAttributeNameDao traceAttributeNameDao; private final TraceDao traceDao;
private final EnvironmentDao environmentDao; private final TransactionTypeDao transactionTypeDao;