id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
6,101
else { formatPattern = "%s%n%n%-b"; } h.addParameters("--pretty=format:" + formatPattern); return h.run(); <BUG>} @NotNull</BUG> private List<String> getUsersList(@NotNull Project project) { VcsUserRegistry userRegistry = ServiceManager.getService(project, VcsUserRegistry.class); return map(userRegistry.getUsers(), new Function<VcsUser, String>() {
@NotNull
6,102
import java.util.List; import java.util.Map; import mirror.android.app.ActivityThread; import mirror.android.app.ActivityThreadNMR1; import mirror.android.app.ContextImpl; <BUG>import mirror.android.app.ContextImplICS; import mirror.android.app.ContextImplKitkat;</BUG> import mirror.android.app.IActivityManager; import mirror.android.app.LoadedApk; import mirror.android.providers.Settings;
[DELETED]
6,103
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { codeCacheDir = context.getCodeCacheDir(); } else { codeCacheDir = context.getCacheDir(); } <BUG>if (Build.VERSION.SDK_INT < 24) { if (HardwareRenderer.setupDiskCache != null) {</BUG> HardwareRenderer.setupDiskCache.call(codeCacheDir); } } else {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { if (HardwareRenderer.setupDiskCache != null) {
6,104
VMRuntime.setTargetSdkVersion.call(VMRuntime.getRuntime.call(), data.appInfo.targetSdkVersion); boolean conflict = SpecialComponentList.isConflictingInstrumentation(packageName); if (!conflict) { PatchManager.getInstance().checkEnv(AppInstrumentation.class); } <BUG>Application app = LoadedApk.makeApplication.call(data.info, false, null); mInitialApplication = app; mirror.android.app.ActivityThread.mInitialApplication.set(mainThread, app); ContextFixer.fixContext(app); </BUG> List<ProviderInfo> providers = VPackageManager.get().queryContentProviders(data.processName, vuid, PackageManager.GET_META_DATA);
mInitialApplication = LoadedApk.makeApplication.call(data.info, false, null); Application injectedApp = mirror.android.app.ActivityThread.mInitialApplication.get(mainThread); if (injectedApp != null) { mInitialApplication = injectedApp; } else { mirror.android.app.ActivityThread.mInitialApplication.set(mainThread, mInitialApplication); ContextFixer.fixContext(mInitialApplication);
6,105
if (lock != null) { lock.open(); mTempLock = null; } try { <BUG>mInstrumentation.callApplicationOnCreate(app); </BUG> PatchManager.getInstance().checkEnv(HCallbackHook.class); if (conflict) { PatchManager.getInstance().checkEnv(AppInstrumentation.class);
mInstrumentation.callApplicationOnCreate(mInitialApplication);
6,106
import java.util.function.ToDoubleBiFunction; public class NestableLoadProfileEstimator implements LoadProfileEstimator { private final LoadEstimator cpuLoadEstimator, ramLoadEstimator, diskLoadEstimator, networkLoadEstimator; private final ToDoubleBiFunction<long[], long[]> resourceUtilizationEstimator; private final long overheadMillis; <BUG>private Collection<LoadProfileEstimator> nestedEstimators = new LinkedList<>(); public NestableLoadProfileEstimator(LoadEstimator cpuLoadEstimator, LoadEstimator ramLoadEstimator) {</BUG> this(cpuLoadEstimator, ramLoadEstimator, null, null); } public NestableLoadProfileEstimator(LoadEstimator cpuLoadEstimator,
private final String configurationKey; public NestableLoadProfileEstimator(LoadEstimator cpuLoadEstimator, LoadEstimator ramLoadEstimator) {
6,107
} public NestableLoadProfileEstimator(LoadEstimator cpuLoadEstimator, LoadEstimator ramLoadEstimator, LoadEstimator diskLoadEstimator, LoadEstimator networkLoadEstimator) { <BUG>this(cpuLoadEstimator, ramLoadEstimator, diskLoadEstimator, networkLoadEstimator, (in, out) -> 1d, 0L); </BUG> } public NestableLoadProfileEstimator(LoadEstimator cpuLoadEstimator, LoadEstimator ramLoadEstimator,
[DELETED]
6,108
return Optional.ofNullable(mainEstimator); } static NestableLoadProfileEstimator createLoadProfileEstimator(Configuration configuration, String configurationKey) { final Optional<String> optSpecification = configuration.getOptionalStringProperty(configurationKey); if (optSpecification.isPresent()) { <BUG>return LoadProfileEstimators.createFromSpecification(optSpecification.get()); </BUG> } else { LoggerFactory.getLogger(ExecutionOperator.class) .warn("Could not find an estimator specification associated with '{}'.", configuration);
return LoadProfileEstimators.createFromSpecification(configurationKey, optSpecification.get());
6,109
.setMaximumSize(spinnerSize); ((JSpinner.DefaultEditor) walkMP.getEditor()) .setPreferredSize(spinnerSize); ((JSpinner.DefaultEditor) walkMP.getEditor()) .setMinimumSize(spinnerSize); <BUG>((JSpinner.DefaultEditor) walkMP.getEditor()).getTextField() .setEditable(false);</BUG> runMP = new JTextField(); runMP.setEditable(false); setFieldSize(runMP, new Dimension(60, 25));
[DELETED]
6,110
.setMaximumSize(spinnerSize); ((JSpinner.DefaultEditor) heatSinkNumber.getEditor()) .setPreferredSize(spinnerSize); ((JSpinner.DefaultEditor) heatSinkNumber.getEditor()) .setMinimumSize(spinnerSize); <BUG>((JSpinner.DefaultEditor) heatSinkNumber.getEditor()).getTextField() .setEditable(false);</BUG> baseChassisHeatSinks = new JSpinner(new SpinnerNumberModel(0, 0, 50, 1)); ((JSpinner.DefaultEditor) baseChassisHeatSinks.getEditor()) .setSize(spinnerSize);
[DELETED]
6,111
(int) lastStreamBytes), mTachyonOutStreamMap.get(filledStreams).getDataWritten()); Assert.assertArrayEquals(BufferUtils.getIncreasingByteArray(start, len), mUnderStorageOutputStream.toByteArray()); } <BUG>private FileOutStream createTestStream(long fileId, OutStreamOptions options) throws IOException { FileOutStream stream = new FileOutStream(FILE_ID, options, mFileSystemContext); Whitebox.setInternalState(stream, "mBlockStoreContext", mBlockStoreContext);</BUG> return stream; }
[DELETED]
6,112
mFileId = fileId; mNonce = ClientContext.getRandomNonNegativeLong(); mBlockSize = options.getBlockSizeBytes(); mTachyonStorageType = options.getTachyonStorageType(); mUnderStorageType = options.getUnderStorageType(); <BUG>mContext = context; mBlockStoreContext = BlockStoreContext.INSTANCE; </BUG> mPreviousBlockOutStreams = new LinkedList<BufferedBlockOutStream>(); if (mUnderStorageType.isSyncPersist()) {
mContext = FileSystemContext.INSTANCE;
6,113
package common.legobmw99.allomancy.util; import java.util.ArrayList; import common.legobmw99.allomancy.common.Registry; <BUG>import common.legobmw99.allomancy.entity.EntityGoldNugget; import common.legobmw99.allomancy.network.packets.MoveEntityPacket;</BUG> import common.legobmw99.allomancy.network.packets.StopFallPacket; import net.minecraft.block.Block; import net.minecraft.client.Minecraft;
import common.legobmw99.allomancy.entity.EntityIronNugget; import common.legobmw99.allomancy.network.packets.MoveEntityPacket;
6,114
this.metallist.add(Items.MILK_BUCKET.getUnlocalizedName()); this.metallist.add(Items.WATER_BUCKET.getUnlocalizedName()); this.metallist.add(Items.CAULDRON.getUnlocalizedName()); this.metallist.add(Items.COMPASS.getUnlocalizedName()); this.metallist.add(Items.FLINT_AND_STEEL.getUnlocalizedName()); <BUG>this.metallist.add(Items.GOLD_NUGGET.getUnlocalizedName()); this.metallist.add(Items.CHAINMAIL_HELMET.getUnlocalizedName());</BUG> this.metallist.add(Items.GOLDEN_HELMET.getUnlocalizedName()); this.metallist.add(Items.IRON_HELMET.getUnlocalizedName()); this.metallist.add(Items.GOLDEN_HOE.getUnlocalizedName());
this.metallist.add(Items.field_191525_da.getUnlocalizedName()); //IRON_NUGGET this.metallist.add(Items.CHAINMAIL_HELMET.getUnlocalizedName());
6,115
+ Math.pow((toMove.posY - (double) (vec.getY() + .5)), 2) + Math.pow((toMove.posZ - (double) (vec.getZ() + .5)), 2)); motionX = ((toMove.posX - (double) (vec.getX() + .5)) * directionScalar * (1.1) / magnitude); motionY = ((toMove.posY - (double) (vec.getY() + .5)) * directionScalar * (1.1) / magnitude); motionZ = ((toMove.posZ - (double) (vec.getZ() + .5)) * directionScalar * (1.1) / magnitude); <BUG>toMove.motionX = MathHelper.clamp(toMove.motionX + motionX, -Math.abs(motionX), motionX); toMove.motionY = MathHelper.clamp(toMove.motionY + motionY, -Math.abs(motionY), motionY); toMove.motionZ = MathHelper.clamp(toMove.motionZ + motionZ, -Math.abs(motionZ), motionZ); </BUG> if (toMove instanceof EntityPlayer) {
toMove.motionX = Math.abs(toMove.motionX + motionX) > 0.01 ? MathHelper.clamp(toMove.motionX + motionX, -Math.abs(motionX), motionX) : 0; toMove.motionY = Math.abs(toMove.motionY + motionY) > 0.01 ? MathHelper.clamp(toMove.motionY + motionY, -Math.abs(motionY), motionY) : 0; toMove.motionZ = Math.abs(toMove.motionZ + motionZ) > 0.01 ? MathHelper.clamp(toMove.motionZ + motionZ, -Math.abs(motionZ), motionZ) : 0;
6,116
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.DigestOutputStream; import java.security.MessageDigest; <BUG>import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.List;</BUG> public final class PatchUtils {
import java.text.DateFormat; import java.util.Date; import java.util.List;
6,117
package org.jboss.as.patching.runner; <BUG>import org.jboss.as.boot.DirectoryStructure; import org.jboss.as.patching.LocalPatchInfo;</BUG> import org.jboss.as.patching.PatchInfo; import org.jboss.as.patching.PatchLogger; import org.jboss.as.patching.PatchMessages;
import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp; import org.jboss.as.patching.CommonAttributes; import org.jboss.as.patching.LocalPatchInfo;
6,118
private static final String PATH_DELIMITER = "/"; public static final byte[] NO_CONTENT = PatchingTask.NO_CONTENT; enum Element { ADDED_BUNDLE("added-bundle"), ADDED_MISC_CONTENT("added-misc-content"), <BUG>ADDED_MODULE("added-module"), BUNDLES("bundles"),</BUG> CUMULATIVE("cumulative"), DESCRIPTION("description"), MISC_FILES("misc-files"),
APPLIES_TO_VERSION("applies-to-version"), BUNDLES("bundles"),
6,119
final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { <BUG>case APPLIES_TO_VERSION: builder.addAppliesTo(value); break;</BUG> case RESULTING_VERSION: if(type == Patch.PatchType.CUMULATIVE) {
[DELETED]
6,120
final StringBuilder path = new StringBuilder(); for(final String p : item.getPath()) { path.append(p).append(PATH_DELIMITER); } path.append(item.getName()); <BUG>writer.writeAttribute(Attribute.PATH.name, path.toString()); if(type != ModificationType.REMOVE) {</BUG> writer.writeAttribute(Attribute.HASH.name, bytesToHexString(item.getContentHash())); } if(type != ModificationType.ADD) {
if (item.isDirectory()) { writer.writeAttribute(Attribute.DIRECTORY.name, "true"); if(type != ModificationType.REMOVE) {
6,121
package org.jboss.as.patching; import org.jboss.as.controller.OperationFailedException; import org.jboss.as.patching.runner.PatchingException; import org.jboss.logging.Messages; import org.jboss.logging.annotations.Message; <BUG>import org.jboss.logging.annotations.MessageBundle; import java.io.IOException;</BUG> import java.util.List; @MessageBundle(projectCode = "JBAS") public interface PatchMessages {
import org.jboss.logging.annotations.Cause; import java.io.IOException;
6,122
</BUG> while (index != -1) { group.getLayers().remove(index); group.getStyles().remove(index); <BUG>index = group.getLayers().indexOf(layerGroupToRemove); </BUG> } if (group.getLayers().size() == 0) { visit(group); } else {
Filter associatedTo = Predicates.equal("layers.id", layerGroupToRemove.getId(), MatchAction.ANY); try (CloseableIterator<LayerGroupInfo> it = catalog .list(LayerGroupInfo.class, associatedTo)) { while (it.hasNext()) { LayerGroupInfo group = it.next(); int index = getLayerGroupIndex(layerGroupToRemove, group); index = getLayerGroupIndex(layerGroupToRemove, group);
6,123
package org.geoserver.gwc.layer; import static com.google.common.base.Throwables.propagate; <BUG>import static com.google.common.base.Throwables.propagateIfInstanceOf; import java.io.FileNotFoundException;</BUG> import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter;
import java.io.ByteArrayInputStream; import java.io.FileNotFoundException;
6,124
private GeoServerTileLayerInfoImpl depersist(final Resource res) throws IOException { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Depersisting GeoServerTileLayerInfo from " + res.path()); } GeoServerTileLayerInfoImpl info; <BUG>try(Reader reader = new InputStreamReader(res.in(), "UTF-8")) { </BUG> info = (GeoServerTileLayerInfoImpl) serializer.fromXML(reader); } return info;
try(Reader reader = new InputStreamReader(new ByteArrayInputStream(res.getContents()), "UTF-8")) {
6,125
} @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)
6,126
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))
6,127
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)
6,128
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");
6,129
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");
6,130
} @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);
6,131
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);
6,132
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);
6,133
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);
6,134
import de.vanita5.twittnuker.receiver.NotificationReceiver; import de.vanita5.twittnuker.service.LengthyOperationsService; import de.vanita5.twittnuker.util.ActivityTracker; import de.vanita5.twittnuker.util.AsyncTwitterWrapper; import de.vanita5.twittnuker.util.DataStoreFunctionsKt; <BUG>import de.vanita5.twittnuker.util.DataStoreUtils; import de.vanita5.twittnuker.util.ImagePreloader;</BUG> import de.vanita5.twittnuker.util.InternalTwitterContentUtils; import de.vanita5.twittnuker.util.JsonSerializer; import de.vanita5.twittnuker.util.NotificationManagerWrapper;
import de.vanita5.twittnuker.util.DebugLog; import de.vanita5.twittnuker.util.ImagePreloader;
6,135
final List<InetAddress> addresses = mDns.lookup(host); for (InetAddress address : addresses) { c.addRow(new String[]{host, address.getHostAddress()}); } } catch (final IOException ignore) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, ignore); }</BUG> }
DebugLog.w(LOGTAG, null, ignore);
6,136
@Override public void afterExecute(Bus handler, SingleResponse<Relationship> result) { if (result.hasData()) { handler.post(new FriendshipUpdatedEvent(accountKey, userKey, result.getData())); } else if (result.hasException()) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, "Unable to update friendship", result.getException()); }</BUG> }
public UserKey[] getAccountKeys() { return DataStoreUtils.getActivatedAccountKeys(context);
6,137
MicroBlog microBlog = MicroBlogAPIFactory.getInstance(context, accountId); if (!Utils.isOfficialCredentials(context, accountId)) continue; try { microBlog.setActivitiesAboutMeUnread(cursor); } catch (MicroBlogException e) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, e); }</BUG> }
DebugLog.w(LOGTAG, null, e);
6,138
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBannerImage(fileBody); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
if (deleteImage) { Utils.deleteMedia(context, imageUri);
6,139
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); twitter.updateProfileBackgroundImage(fileBody, tile); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
twitter.updateProfileBannerImage(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);
6,140
FileBody fileBody = null; try { fileBody = getFileBody(context, imageUri); return twitter.updateProfileImage(fileBody); } finally { <BUG>Utils.closeSilently(fileBody); if (deleteImage && "file".equals(imageUri.getScheme())) { final File file = new File(imageUri.getPath()); if (!file.delete()) { Log.w(LOGTAG, String.format("Unable to delete %s", file)); }</BUG> }
twitter.updateProfileBannerImage(fileBody); if (deleteImage) { Utils.deleteMedia(context, imageUri);
6,141
import de.vanita5.twittnuker.annotation.CustomTabType; import de.vanita5.twittnuker.library.MicroBlog; import de.vanita5.twittnuker.library.MicroBlogException; import de.vanita5.twittnuker.library.twitter.model.RateLimitStatus; import de.vanita5.twittnuker.library.twitter.model.Status; <BUG>import de.vanita5.twittnuker.fragment.AbsStatusesFragment; import org.mariotaku.sqliteqb.library.AllColumns;</BUG> import org.mariotaku.sqliteqb.library.Columns; import org.mariotaku.sqliteqb.library.Columns.Column; import org.mariotaku.sqliteqb.library.Expression;
import org.mariotaku.pickncrop.library.PNCUtils; import org.mariotaku.sqliteqb.library.AllColumns;
6,142
context.getApplicationContext().sendBroadcast(intent); } } @Nullable public static Location getCachedLocation(Context context) { <BUG>if (BuildConfig.DEBUG) { Log.v(LOGTAG, "Fetching cached location", new Exception()); }</BUG> Location location = null;
DebugLog.v(LOGTAG, "Fetching cached location", new Exception());
6,143
import java.util.List; import java.util.Map.Entry; import javax.inject.Singleton; import okhttp3.Dns; @Singleton <BUG>public class TwidereDns implements Constants, Dns { </BUG> private static final String RESOLVER_LOGTAG = "TwittnukerDns"; private final SharedPreferences mHostMapping; private final SharedPreferencesWrapper mPreferences;
public class TwidereDns implements Dns, Constants {
6,144
for (Location location : twitter.getAvailableTrends()) { map.put(location); } return map.pack(); } catch (final MicroBlogException e) { <BUG>if (BuildConfig.DEBUG) { Log.w(LOGTAG, e); }</BUG> }
DebugLog.w(LOGTAG, null, e);
6,145
public class UserControllerTest { private static final Logger LOGGER = Logger.getLogger( UserControllerTest.class.getName() ); Properties properties = new Properties(); InputStream input = null; <BUG>private String neo4jServerPort = System.getProperty( "neo4j.server.port" ); private String neo4jRemoteShellPort = System.getProperty( "neo4j.remoteShell.port" ); private String neo4jGraphDb = System.getProperty( "neo4j.graph.db" ); private ServerControls server;</BUG> @Before
private String dbmsConnectorHttpPort = System.getProperty( "dbms.connector.http.port" ); private String dbmsConnectorBoltPort = System.getProperty( "dbms.connector.bolt.port" ); private String dbmsShellPort = System.getProperty( "dbms.shell.port" ); private String dbmsDirectoriesData = System.getProperty( "dbms.directories.data" ); private ServerControls server;
6,146
@Bean public Configuration getConfiguration() { if ( StringUtils.isEmpty( url ) ) { <BUG>url = "http://localhost:" + port; </BUG> } Configuration config = new Configuration(); config.driverConfiguration().setDriverClassName( HttpDriver.class.getName() )
url = "http://localhost:" + dbmsConnectorHttpPort;
6,147
import io.atomix.copycat.Command; public final class LockCommands { private LockCommands() { } public static abstract class LockCommand<V> implements Command<V>, CatalystSerializable { <BUG>@Override public ConsistencyLevel consistency() { return ConsistencyLevel.LINEARIZABLE; }</BUG> @Override
[DELETED]
6,148
member = buffer.readString(); } } public static abstract class GroupCommand<V> extends GroupOperation<V> implements Command<V> { @Override <BUG>public ConsistencyLevel consistency() { return ConsistencyLevel.LINEARIZABLE; } @Override</BUG> public CompactionMode compaction() {
[DELETED]
6,149
public static abstract class MemberQuery<V> extends MemberOperation<V> implements Query<V> { public MemberQuery(String member) { super(member); } public MemberQuery() { <BUG>} @Override public ConsistencyLevel consistency() { return ConsistencyLevel.BOUNDED_LINEARIZABLE;</BUG> }
[DELETED]
6,150
} public GetResource(String key, ResourceType type, Properties config) { super(key); this.type = Assert.notNull(type, "type"); this.config = config; <BUG>} @Override public ConsistencyLevel consistency() { return ConsistencyLevel.LINEARIZABLE;</BUG> }
[DELETED]
6,151
import io.atomix.catalyst.transport.Address; import io.atomix.catalyst.transport.Transport; import io.atomix.catalyst.util.Assert; import io.atomix.catalyst.util.ConfigurationException; import io.atomix.catalyst.util.concurrent.Futures; <BUG>import io.atomix.catalyst.util.concurrent.ThreadContext; import io.atomix.copycat.client.*; import io.atomix.manager.options.ClientOptions; import io.atomix.manager.internal.GetResourceKeys;</BUG> import io.atomix.manager.internal.ResourceExists;
import io.atomix.copycat.client.ConnectionStrategies; import io.atomix.copycat.client.CopycatClient; import io.atomix.copycat.client.RecoveryStrategies; import io.atomix.copycat.client.ServerSelectionStrategies; import io.atomix.manager.internal.GetResourceKeys;
6,152
private Transport transport; protected Builder() { clientBuilder = CopycatClient.builder() .withServerSelectionStrategy(ServerSelectionStrategies.ANY) .withConnectionStrategy(ConnectionStrategies.FIBONACCI_BACKOFF) <BUG>.withRecoveryStrategy(RecoveryStrategies.RECOVER) .withRetryStrategy(RetryStrategies.FIBONACCI_BACKOFF);</BUG> } public Builder withTransport(Transport transport) {
.withRecoveryStrategy(RecoveryStrategies.RECOVER);
6,153
} @AfterMethod protected void afterMethod() throws Throwable { cleanup(); } <BUG>public void testSubmitCommandWithSequentialConsistency() throws Throwable { testSubmitCommand(WriteConsistency.SEQUENTIAL_EVENT); } public void testSubmitCommandWithAtomicConsistency() throws Throwable { testSubmitCommand(WriteConsistency.ATOMIC); } private void testSubmitCommand(WriteConsistency consistency) throws Throwable {</BUG> Atomix replica = createReplicas(3, new ResourceType(TestResource.class)).iterator().next();
public void testSubmitCommand() throws Throwable {
6,154
this.clientAddress = Assert.notNull(clientAddress, "clientAddress"); this.clientBuilder = CopycatClient.builder() .withSerializer(serializer.clone()) .withServerSelectionStrategy(ServerSelectionStrategies.ANY) .withConnectionStrategy(ConnectionStrategies.FIBONACCI_BACKOFF) <BUG>.withRecoveryStrategy(RecoveryStrategies.RECOVER) .withRetryStrategy(RetryStrategies.FIBONACCI_BACKOFF);</BUG> this.serverBuilder = CopycatServer.builder(clientAddress, serverAddress).withSerializer(serializer.clone()); }
.withRecoveryStrategy(RecoveryStrategies.RECOVER);
6,155
} public InstanceCommand(long resource, T command) { super(resource, command); } @Override <BUG>public ConsistencyLevel consistency() { return operation.consistency(); } @Override</BUG> public CompactionMode compaction() {
[DELETED]
6,156
private final Set<String> joining = new CopyOnWriteArraySet<>(); private final DistributedGroup.Options options; private final GroupElection election = new GroupElection(this); private final GroupMessageClient messages; private final Map<String, AbstractGroupMember> members = new ConcurrentHashMap<>(); <BUG>private final GroupSubmitter submitter = new GroupSubmitter() { @Override public <T extends Command<U>, U> CompletableFuture<U> submit(T command) { return MembershipGroup.this.submit(command, WriteConsistency.SEQUENTIAL_EVENT); } };</BUG> private final MessageProducerService producerService = new MessageProducerService(submitter);
private final GroupSubmitter submitter = this::submit; private final MessageConsumerService consumerService = new MessageConsumerService(submitter); public MembershipGroup(CopycatClient client, Properties options) { super(client, new ResourceType(DistributedGroup.class), options); this.options = new DistributedGroup.Options(Assert.notNull(options, "options")); this.messages = new GroupMessageClient(producerService);
6,157
package io.atomix.resource; import io.atomix.copycat.Query; public enum ReadConsistency { ATOMIC(Query.ConsistencyLevel.LINEARIZABLE), <BUG>ATOMIC_LEASE(Query.ConsistencyLevel.BOUNDED_LINEARIZABLE), SEQUENTIAL(Query.ConsistencyLevel.SEQUENTIAL), CAUSAL(Query.ConsistencyLevel.CAUSAL);</BUG> private final Query.ConsistencyLevel level;
ATOMIC_LEASE(Query.ConsistencyLevel.LINEARIZABLE_LEASE), SEQUENTIAL(Query.ConsistencyLevel.SEQUENTIAL);
6,158
} @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)
6,159
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))
6,160
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)
6,161
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");
6,162
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");
6,163
} @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);
6,164
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);
6,165
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);
6,166
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);
6,167
GsonFieldTree mapWithRoot = new GsonFieldTree(); rootFieldTree.addTreeBranch(rootField, mapWithRoot); return mapWithRoot; } } <BUG>protected void createObjectParser(int fieldDepth, CodeBlock.Builder codeBlock,</BUG> GsonFieldTree jsonMapping, ObjectParserCallback callback) throws ProcessingException {
protected void createObjectParser(boolean modelAlreadyCreated, CodeBlock.Builder codeBlock,
6,168
codeBlock.addStatement("throw new gsonpath.JsonFieldMissingException(\"Mandatory " + "JSON element '$L' was null for class '$L'\")", fieldPathInfo.jsonPath, fieldInfo.getParentClassName()); } <BUG>codeBlock.endControlFlow(); // if } else {</BUG> GsonFieldTree nextLevelMap = (GsonFieldTree) value; if (nextLevelMap.size() == 0) { callback.onNodeEmpty();
} else {
6,169
GsonFieldTree nextLevelMap = (GsonFieldTree) value; if (nextLevelMap.size() == 0) { callback.onNodeEmpty(); addBreak = false; } else { <BUG>createObjectParser(fieldDepth + 1, codeBlock, nextLevelMap, callback); }</BUG> } if (addBreak) { codeBlock.addStatement("break");
createObjectParser(modelAlreadyCreated, fieldDepth + 1, codeBlock, nextLevelMap,
6,170
InterfaceInfo handle(TypeElement element) throws ProcessingException { ClassName modelClassName = ClassName.get(element); ClassName outputClassName = ClassName.get(modelClassName.packageName(), generateClassName(modelClassName)); TypeSpec.Builder typeBuilder = TypeSpec.classBuilder(outputClassName) .addModifiers(Modifier.PUBLIC, Modifier.FINAL) <BUG>.addSuperinterface(modelClassName); List<InterfaceFieldInfo> interfaceInfoList = new ArrayList<>();</BUG> for (Element enclosedElement : element.getEnclosedElements()) { if (enclosedElement.getKind() == ElementKind.METHOD) { ExecutableType methodType = (ExecutableType) enclosedElement.asType();
MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder() .addModifiers(Modifier.PUBLIC); List<InterfaceFieldInfo> interfaceInfoList = new ArrayList<>();
6,171
if (typeName == null) { throw new ProcessingException("Interface methods must not return null", enclosedElement); } String methodName = enclosedElement.getSimpleName().toString(); String fieldName = methodName; <BUG>for (int i = fieldName.length() - 1; i >= 0; i--) { </BUG> char character = fieldName.charAt(i); if (Character.isUpperCase(character)) { fieldName = Character.toLowerCase(character) + fieldName.substring(i + 1);
for (int i = 0; i < fieldName.length() - 1; i++) {
6,172
if (Character.isUpperCase(character)) { fieldName = Character.toLowerCase(character) + fieldName.substring(i + 1); break; } } <BUG>typeBuilder.addField(typeName, fieldName); MethodSpec.Builder accessorMethod = MethodSpec.methodBuilder(methodName)</BUG> .addAnnotation(Override.class) .addModifiers(Modifier.PUBLIC) .returns(typeName);
typeBuilder.addField(typeName, fieldName, Modifier.PRIVATE, Modifier.FINAL); MethodSpec.Builder accessorMethod = MethodSpec.methodBuilder(methodName)
6,173
.addModifiers(Modifier.PUBLIC) .returns(baseElement) .addParameter(JsonReader.class, "in") .addException(IOException.class); final CodeBlock.Builder codeBlock = CodeBlock.builder(); <BUG>mCounterVariableCount = 0; createObjectParser(0, codeBlock, rootElements, new ObjectParserCallback() { </BUG> @Override public void onInitialObjectNull() {
final boolean modelAlreadyCreated = baseElement.equals(concreteElement); createObjectParser(modelAlreadyCreated, 0, codeBlock, rootElements, new ObjectParserCallback() {
6,174
@Override public void onInitialObjectNull() { codeBlock.addStatement("return null"); } @Override <BUG>public void onInitialise() { codeBlock.addStatement("$T result = new $T()", concreteElement, concreteElement); if (mandatoryInfoMap.size() > 0) {</BUG> codeBlock.addStatement("boolean[] mandatoryFieldsCheckList = new boolean[MANDATORY_FIELDS_SIZE]"); }
[DELETED]
6,175
import java.net.URI; import java.util.Calendar; import java.util.Date; import java.util.Formatter; import java.util.List; <BUG>import javax.ws.rs.core.UriBuilder; import org.apache.commons.httpclient.URIException; import org.apache.commons.httpclient.util.URIUtil;</BUG> import org.suigeneris.jrcs.rcs.Version; import org.xwiki.rest.Relations;
[DELETED]
6,176
if (home != null) { space.setHome(home.getPrefixedFullName()); space.setXwikiRelativeUrl(home.getURL("view")); space.setXwikiAbsoluteUrl(home.getExternalURL("view")); } <BUG>String pagesUri = UriBuilder.fromUri(baseUri).path(PagesResource.class).build(wikiName, spaceName).toString(); </BUG> Link pagesLink = objectFactory.createLink(); pagesLink.setHref(pagesUri); pagesLink.setRel(Relations.PAGES);
String pagesUri = uri(baseUri, PagesResource.class, wikiName, spaceName);
6,177
Link pagesLink = objectFactory.createLink(); pagesLink.setHref(pagesUri); pagesLink.setRel(Relations.PAGES); space.getLinks().add(pagesLink); if (home != null) { <BUG>String homeUri = UriBuilder.fromUri(baseUri).path(PageResource.class).build(wikiName, spaceName, home.getName()) .toString();</BUG> Link homeLink = objectFactory.createLink();
String homeUri = uri(baseUri, PageResource.class, wikiName, spaceName, home.getName());
6,178
.toString();</BUG> Link homeLink = objectFactory.createLink(); homeLink.setHref(homeUri); homeLink.setRel(Relations.HOME); space.getLinks().add(homeLink); <BUG>} String searchUri = UriBuilder.fromUri(baseUri).path(SpaceSearchResource.class).build(wikiName, spaceName).toString();</BUG> Link searchLink = objectFactory.createLink(); searchLink.setHref(searchUri);
Link pagesLink = objectFactory.createLink(); pagesLink.setHref(pagesUri); pagesLink.setRel(Relations.PAGES); space.getLinks().add(pagesLink); if (home != null) { String homeUri = uri(baseUri, PageResource.class, wikiName, spaceName, home.getName()); String searchUri = uri(baseUri, SpaceSearchResource.class, wikiName, spaceName);
6,179
if (!languages.isEmpty()) { if (!doc.getDefaultLanguage().equals("")) { translations.setDefault(doc.getDefaultLanguage()); Translation translation = objectFactory.createTranslation(); translation.setLanguage(doc.getDefaultLanguage()); <BUG>String pageTranslationUri = UriBuilder.fromUri(baseUri).path(PageResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG> Link pageTranslationLink = objectFactory.createLink(); pageTranslationLink.setHref(pageTranslationUri);
uri(baseUri, PageResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
6,180
} } for (String language : languages) { Translation translation = objectFactory.createTranslation(); translation.setLanguage(language); <BUG>String pageTranslationUri = UriBuilder.fromUri(baseUri).path(PageTranslationResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), language).toString();</BUG> Link pageTranslationLink = objectFactory.createLink(); pageTranslationLink.setHref(pageTranslationUri);
uri(baseUri, PageTranslationResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), language);
6,181
Link pageTranslationLink = objectFactory.createLink(); pageTranslationLink.setHref(pageTranslationUri); pageTranslationLink.setRel(Relations.PAGE); translation.getLinks().add(pageTranslationLink); String historyUri = <BUG>UriBuilder.fromUri(baseUri).path(PageTranslationHistoryResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), language).toString(); Link historyLink = objectFactory.createLink();</BUG> historyLink.setHref(historyUri); historyLink.setRel(Relations.HISTORY);
uri(baseUri, PageTranslationHistoryResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), language); Link historyLink = objectFactory.createLink();
6,182
pageSummary.setParent(doc.getParent()); if (parent != null && !parent.isNew()) { pageSummary.setParentId(parent.getPrefixedFullName()); } else { pageSummary.setParentId(""); <BUG>} String spaceUri = UriBuilder.fromUri(baseUri).path(SpaceResource.class).build(doc.getWiki(), doc.getSpace()).toString();</BUG> Link spaceLink = objectFactory.createLink(); spaceLink.setHref(spaceUri);
String spaceUri = uri(baseUri, SpaceResource.class, doc.getWiki(), doc.getSpace());
6,183
UriBuilder.fromUri(baseUri).path(SpaceResource.class).build(doc.getWiki(), doc.getSpace()).toString();</BUG> Link spaceLink = objectFactory.createLink(); spaceLink.setHref(spaceUri); spaceLink.setRel(Relations.SPACE); pageSummary.getLinks().add(spaceLink); <BUG>if (parent != null) { String parentUri = UriBuilder.fromUri(baseUri).path(PageResource.class) .build(parent.getWiki(), parent.getSpace(), parent.getName()).toString();</BUG> Link parentLink = objectFactory.createLink();
pageSummary.setParent(doc.getParent()); if (parent != null && !parent.isNew()) { pageSummary.setParentId(parent.getPrefixedFullName()); } else { pageSummary.setParentId(""); } String spaceUri = uri(baseUri, SpaceResource.class, doc.getWiki(), doc.getSpace()); String parentUri = uri(baseUri, PageResource.class, parent.getWiki(), parent.getSpace(), parent.getName());
6,184
Link historyLink = objectFactory.createLink(); historyLink.setHref(historyUri); historyLink.setRel(Relations.HISTORY); pageSummary.getLinks().add(historyLink); if (!doc.getChildren().isEmpty()) { <BUG>String pageChildrenUri = UriBuilder.fromUri(baseUri).path(PageChildrenResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG> Link pageChildrenLink = objectFactory.createLink(); pageChildrenLink.setHref(pageChildrenUri);
uri(baseUri, PageChildrenResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
6,185
objectsLink.setRel(Relations.OBJECTS); pageSummary.getLinks().add(objectsLink); } com.xpn.xwiki.api.Object tagsObject = doc.getObject("XWiki.TagClass", 0); if (tagsObject != null) { <BUG>if (tagsObject.getProperty("tags") != null) { String tagsUri = UriBuilder.fromUri(baseUri).path(PageTagsResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName()).toString();</BUG> Link tagsLink = objectFactory.createLink();
String tagsUri = uri(baseUri, PageTagsResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
6,186
tagsLink.setHref(tagsUri); tagsLink.setRel(Relations.TAGS); pageSummary.getLinks().add(tagsLink); } } <BUG>String syntaxesUri = UriBuilder.fromUri(baseUri).path(SyntaxesResource.class).build().toString(); Link syntaxesLink = objectFactory.createLink();</BUG> syntaxesLink.setHref(syntaxesUri); syntaxesLink.setRel(Relations.SYNTAXES); pageSummary.getLinks().add(syntaxesLink);
String syntaxesUri = uri(baseUri, SyntaxesResource.class); Link syntaxesLink = objectFactory.createLink();
6,187
} return historySummary; } private static void fillAttachment(Attachment attachment, ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Document doc = xwikiAttachment.getDocument(); attachment.setId(String.format("%s@%s", doc.getPrefixedFullName(), xwikiAttachment.getFilename()));
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
6,188
Calendar calendar = Calendar.getInstance(); calendar.setTime(xwikiAttachment.getDate()); attachment.setDate(calendar); attachment.setXwikiRelativeUrl(xwikiRelativeUrl); attachment.setXwikiAbsoluteUrl(xwikiAbsoluteUrl); <BUG>String pageUri = UriBuilder.fromUri(baseUri).path(PageResource.class).build(doc.getWiki(), doc.getSpace(), doc.getName()) .toString();</BUG> Link pageLink = objectFactory.createLink();
String pageUri = uri(baseUri, PageResource.class, doc.getWiki(), doc.getSpace(), doc.getName());
6,189
} return attachmentUri; }</BUG> public static Attachment createAttachment(ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Attachment attachment = objectFactory.createAttachment(); fillAttachment(attachment, objectFactory, baseUri, xwikiAttachment, xwikiRelativeUrl, xwikiAbsoluteUrl,
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
6,190
attachmentLink.setRel(Relations.ATTACHMENT_DATA); attachment.getLinks().add(attachmentLink); return attachment; } public static Attachment createAttachmentAtVersion(ObjectFactory objectFactory, URI baseUri, <BUG>com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, Boolean withPrettyNames) {</BUG> Attachment attachment = new Attachment();
com.xpn.xwiki.api.Attachment xwikiAttachment, String xwikiRelativeUrl, String xwikiAbsoluteUrl, XWiki xwikiApi, {
6,191
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> } else { <BUG>propertiesUri = UriBuilder .fromUri(baseUri) .path(ObjectPropertiesResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> }
fillObjectSummary(objectSummary, objectFactory, baseUri, doc, xwikiObject, xwikiApi, withPrettyNames); Link objectLink = getObjectLink(objectFactory, baseUri, doc, xwikiObject, useVersion, Relations.OBJECT); objectSummary.getLinks().add(objectLink); String propertiesUri; if (useVersion) { uri(baseUri, ObjectPropertiesAtPageVersionResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()); uri(baseUri, ObjectPropertiesResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
6,192
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber(), propertyClass.getName()) .toString();</BUG> } else { <BUG>propertyUri = UriBuilder .fromUri(baseUri) .path(ObjectPropertyResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber(), propertyClass.getName()).toString();</BUG> }
propertiesUri = uri(baseUri, ObjectPropertiesResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
6,193
.build(doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> } else { <BUG>objectUri = UriBuilder .fromUri(baseUri) .path(ObjectResource.class) .build(doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber()).toString();</BUG> }
private static Link getObjectLink(ObjectFactory objectFactory, URI baseUri, Document doc, BaseObject xwikiObject, boolean useVersion, String relation) String objectUri; if (useVersion) { uri(baseUri, ObjectAtPageVersionResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), doc.getVersion(), xwikiObject.getClassName(), xwikiObject.getNumber()); uri(baseUri, ObjectResource.class, doc.getWiki(), doc.getSpace(), doc.getName(), xwikiObject.getClassName(), xwikiObject.getNumber());
6,194
Link propertyLink = objectFactory.createLink(); propertyLink.setHref(propertyUri); propertyLink.setRel(Relations.SELF); property.getLinks().add(propertyLink); clazz.getProperties().add(property); <BUG>} String classUri = UriBuilder.fromUri(baseUri).path(ClassResource.class).build(wikiName, xwikiClass.getName()).toString();</BUG> Link classLink = objectFactory.createLink(); classLink.setHref(classUri);
String classUri = uri(baseUri, ClassResource.class, wikiName, xwikiClass.getName());
6,195
String classUri = UriBuilder.fromUri(baseUri).path(ClassResource.class).build(wikiName, xwikiClass.getName()).toString();</BUG> Link classLink = objectFactory.createLink(); classLink.setHref(classUri); classLink.setRel(Relations.SELF); <BUG>clazz.getLinks().add(classLink); String propertiesUri = UriBuilder.fromUri(baseUri).path(ClassPropertiesResource.class).build(wikiName, xwikiClass.getName()) .toString();</BUG> Link propertyLink = objectFactory.createLink();
propertyLink.setHref(propertyUri); propertyLink.setRel(Relations.SELF); property.getLinks().add(propertyLink); clazz.getProperties().add(property); } String classUri = uri(baseUri, ClassResource.class, wikiName, xwikiClass.getName()); String propertiesUri = uri(baseUri, ClassPropertiesResource.class, wikiName, xwikiClass.getName());
6,196
<BUG>package org.xwiki.rest.internal; import org.apache.commons.lang3.StringUtils;</BUG> import org.xwiki.component.manager.ComponentManager; import org.xwiki.context.Execution; import org.xwiki.model.reference.EntityReferenceSerializer;
import java.net.URI; import javax.ws.rs.core.UriBuilder; import org.apache.commons.httpclient.URIException; import org.apache.commons.httpclient.util.URIUtil; import org.apache.commons.lang3.StringUtils;
6,197
else { addCategoryResources( category, serviceContext.getCommunityPermissions(), serviceContext.getGuestPermissions()); } <BUG>ExpandoBridge expandoBridge = category.getExpandoBridge(); expandoBridge.setAttributes(serviceContext);</BUG> mbMailingListLocalService.addMailingList( null, userId, category.getCategoryId(), emailAddress, inProtocol, inServerName, inServerPort, inUseSSL, inUserName, inPassword,
[DELETED]
6,198
mbMailingListLocalService.addMailingList( null, userId, category.getCategoryId(), emailAddress, inProtocol, inServerName, inServerPort, inUseSSL, inUserName, inPassword, inReadInterval, outEmailAddress, outCustom, outServerName, outServerPort, outUseSSL, outUserName, outPassword, <BUG>mailingListActive); return category;</BUG> } public void addCategoryResources( long categoryId, boolean addCommunityPermissions,
ExpandoBridge expandoBridge = category.getExpandoBridge(); expandoBridge.setAttributes(serviceContext); return category;
6,199
Indexer.deleteMessages( category.getCompanyId(), category.getCategoryId()); } catch (SearchException se) { _log.error("Deleting index " + category.getCategoryId(), se); <BUG>} mbThreadLocalService.deleteThreads(category.getCategoryId());</BUG> try { mbMailingListLocalService.deleteCategoryMailingList( category.getCategoryId());
expandoValueLocalService.deleteValues( MBCategory.class.getName(), category.getCategoryId()); mbThreadLocalService.deleteThreads(category.getCategoryId());
6,200
category.setModifiedDate(new Date()); category.setParentCategoryId(parentCategoryId); category.setName(name); category.setDescription(description); mbCategoryPersistence.update(category, false); <BUG>ExpandoBridge expandoBridge = category.getExpandoBridge(); expandoBridge.setAttributes(serviceContext);</BUG> if (mergeWithParentCategory && (categoryId != parentCategoryId) && (parentCategoryId != MBCategoryImpl.DEFAULT_PARENT_CATEGORY_ID)) {
[DELETED]