id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
41,201
HttpLastChunk lastChunk = new HttpLastChunk(); lastChunk.addExtension(new HttpChunkExtension("this", "that")); lastChunk.addHeader(new Header("customer", "value")); String lastPayload = parser.marshalToString(lastChunk); Assert.assertEquals("0;this=that\r\ncustomer: value\r\n\r\n", lastPayload); <BUG>byte[] lastBytes = parser.marshalToBytes(lastChunk); </BUG> String lastPayloadFromBytes = new String(lastBytes, HttpParserFactory.iso8859_1); Assert.assertEquals("0;this=that\r\ncustomer: value\r\n\r\n", lastPayloadFromBytes); }
byte[] lastBytes = unwrap(parser.marshalToByteBuffer(lastChunk));
41,202
import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Optional; <BUG>import org.slf4j.Logger; import org.slf4j.LoggerFactory;</BUG> import org.webpieces.data.api.BufferPool; import org.webpieces.data.api.DataWrapper; import org.webpieces.data.api.DataWrapperGenerator;
[DELETED]
41,203
import java.nio.ByteBuffer; import org.webpieces.data.api.DataWrapper; import org.webpieces.httpparser.api.dto.HttpPayload; public interface HttpParser { ByteBuffer marshalToByteBuffer(HttpPayload request); <BUG>byte[] marshalToBytes(HttpPayload request);</BUG> String marshalToString(HttpPayload request); Memento prepareToParse(); Memento parse(Memento state, DataWrapper moreData); HttpPayload unmarshal(byte[] msg); }
[DELETED]
41,204
HttpRequestLine requestLine = new HttpRequestLine(); requestLine.setMethod(KnownHttpMethod.GET); requestLine.setUri(new HttpUri("http://www.deano.com")); HttpRequest req = new HttpRequest(); req.setRequestLine(requestLine); <BUG>byte[] array = parser.marshalToBytes(req); </BUG> ByteBuffer buffer = ByteBuffer.wrap(array); dataListener.incomingData(mockTcpChannel, ByteBuffer.allocate(0)); dataListener.incomingData(mockTcpChannel, buffer);
byte[] array = unwrap(parser.marshalToByteBuffer(req));
41,205
Assert.assertEquals(msg, result2); } @Test public void testAsciiConverter() { HttpRequest request = createPostRequest(); <BUG>byte[] payload = parser.marshalToBytes(request); </BUG> ConvertAscii converter = new ConvertAscii(); String readableForm = converter.convertToReadableForm(payload); String expected = "POST\\s http://myhost.com\\s HTTP/1.1\\r\\n\r\n"
byte[] payload = unwrap(parser.marshalToByteBuffer(request));
41,206
Assert.assertEquals(request, httpMessage); } @Test public void test2AndHalfHttpMessages() { HttpRequest request = createPostRequest(); <BUG>byte[] payload = parser.marshalToBytes(request); </BUG> byte[] first = new byte[2*payload.length + 20]; byte[] second = new byte[payload.length - 20]; System.arraycopy(payload, 0, first, 0, payload.length);
byte[] payload = unwrap(parser.marshalToByteBuffer(request));
41,207
import com.liferay.portal.kernel.json.JSONFactoryUtil; import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.model.TrashedModel; <BUG>import com.liferay.portal.kernel.portlet.JSONPortletResponseUtil; import com.liferay.portal.kernel.portlet.LiferayWindowState; import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;</BUG> import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand; import com.liferay.portal.kernel.portletfilerepository.PortletFileRepositoryUtil;
import com.liferay.portal.kernel.portlet.LiferayPortletURL; import com.liferay.portal.kernel.portlet.PortletURLFactoryUtil; import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;
41,208
import com.liferay.dynamic.data.mapping.constants.DDMPortletKeys; import com.liferay.dynamic.data.mapping.model.DDMStructure; import com.liferay.dynamic.data.mapping.model.DDMTemplate; import com.liferay.dynamic.data.mapping.model.DDMTemplateConstants; import com.liferay.dynamic.data.mapping.service.DDMStructureService; <BUG>import com.liferay.dynamic.data.mapping.service.DDMTemplateService; import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand;</BUG> import com.liferay.portal.kernel.service.ServiceContext; import com.liferay.portal.kernel.service.ServiceContextFactory; import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.portlet.LiferayPortletURL; import com.liferay.portal.kernel.portlet.PortletURLFactoryUtil; import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand;
41,209
package com.liferay.dynamic.data.mapping.web.portlet.action; import com.liferay.dynamic.data.mapping.constants.DDMPortletKeys; import com.liferay.dynamic.data.mapping.model.DDMTemplate; <BUG>import com.liferay.dynamic.data.mapping.service.DDMTemplateService; import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand;</BUG> import com.liferay.portal.kernel.service.ServiceContext; import com.liferay.portal.kernel.service.ServiceContextFactory; import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.portlet.LiferayPortletURL; import com.liferay.portal.kernel.portlet.PortletURLFactoryUtil; import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand;
41,210
public String execute( HttpServletRequest request, HttpServletResponse response) throws Exception { try { long plid = ParamUtil.getLong(request, "p_l_id"); <BUG>PortletURL portletURL = new PortletURLImpl( </BUG> request, MBPortletKeys.MESSAGE_BOARDS, plid, PortletRequest.RENDER_PHASE); portletURL.setParameter(
PortletURL portletURL = PortletURLFactoryUtil.create(
41,211
import com.liferay.dynamic.data.mapping.model.DDMStructure; import com.liferay.dynamic.data.mapping.model.DDMTemplate; import com.liferay.dynamic.data.mapping.model.DDMTemplateConstants; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.PortletPreferencesException; <BUG>import com.liferay.portal.kernel.model.Layout; import com.liferay.portal.kernel.portlet.PortletPreferencesFactoryUtil; import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;</BUG> import com.liferay.portal.kernel.servlet.SessionMessages; import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.portlet.LiferayPortletURL; import com.liferay.portal.kernel.portlet.PortletURLFactoryUtil; import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;
41,212
actionRequest, "portletResourceNamespace"); long classNameId = ParamUtil.getLong(actionRequest, "classNameId"); long classPK = ParamUtil.getLong(actionRequest, "classPK"); String structureAvailableFields = ParamUtil.getString( actionRequest, "structureAvailableFields"); <BUG>PortletURLImpl portletURL = new PortletURLImpl( actionRequest, themeDisplay.getPpid(), themeDisplay.getPlid(),</BUG> PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcPath", "/edit_template.jsp"); portletURL.setParameter("redirect", redirect, false);
LiferayPortletURL portletURL = PortletURLFactoryUtil.create( actionRequest, themeDisplay.getPpid(), themeDisplay.getPlid(),
41,213
package com.liferay.wiki.web.internal.portlet.action; import com.liferay.portal.kernel.io.unsync.UnsyncByteArrayInputStream; import com.liferay.portal.kernel.log.Log; <BUG>import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;</BUG> import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand; import com.liferay.portal.kernel.servlet.ServletResponseUtil; import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.portlet.PortletURLFactoryUtil; import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;
41,214
viewPageURL.setParameter("mvcRenderCommandName", "/wiki/view"); viewPageURL.setParameter("nodeName", nodeName); viewPageURL.setParameter("title", title); viewPageURL.setPortletMode(PortletMode.VIEW); viewPageURL.setWindowState(WindowState.MAXIMIZED); <BUG>PortletURL editPageURL = new PortletURLImpl( </BUG> actionRequest, portletConfig.getPortletName(), themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); editPageURL.setParameter("mvcRenderCommandName", "/wiki/edit_page");
PortletURL editPageURL = PortletURLFactoryUtil.create(
41,215
import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.model.Layout; import com.liferay.portal.kernel.portlet.LiferayPortletRequest; import com.liferay.portal.kernel.portlet.LiferayPortletResponse; <BUG>import com.liferay.portal.kernel.portlet.PortletPreferencesFactoryUtil; import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;</BUG> import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand; import com.liferay.portal.kernel.security.auth.AuthException; import com.liferay.portal.kernel.security.auth.session.AuthenticatedSessionManagerUtil;
import com.liferay.portal.kernel.portlet.PortletURLFactoryUtil; import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;
41,216
import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.lock.DuplicateLockException; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.model.TrashedModel; <BUG>import com.liferay.portal.kernel.portlet.JSONPortletResponseUtil; import com.liferay.portal.kernel.portlet.LiferayWindowState; import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;</BUG> import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand; import com.liferay.portal.kernel.repository.capabilities.TrashCapability;
import com.liferay.portal.kernel.portlet.LiferayPortletURL; import com.liferay.portal.kernel.portlet.PortletURLFactoryUtil; import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;
41,217
import org.jitsi.impl.neomedia.device.*; import org.jitsi.service.resources.*; import org.osgi.framework.*; public class AudioDeviceConfigurationListener extends AbstractDeviceConfigurationListener <BUG>{ public AudioDeviceConfigurationListener(</BUG> ConfigurationForm configurationForm) { super(configurationForm);
private CaptureDeviceInfo captureDevice = null; private CaptureDeviceInfo playbackDevice = null; private CaptureDeviceInfo notificationDevice = null; public AudioDeviceConfigurationListener(
41,218
ResourceManagementService resources = NeomediaActivator.getResources(); notificationService.fireNotification( popUpEvent, title, <BUG>device.getName() + "\r\n" </BUG> + resources.getI18NString( "impl.media.configform"
body + "\r\n\r\n"
41,219
e.printStackTrace(); } filePlayback=null; } @Override <BUG>public void stop() { if ( filePlayback!=null ) filePlayback.stop(); } void initFiles() throws FileNotFoundException {</BUG> if ((dataDir.length() != 0) && !dataDir.endsWith("/")) { dataDir = dataDir + "/"; } // guard path if needed String samples_str = dataDir + "samples"; String events_str = dataDir + "events";
@Override public boolean isrunning(){ if ( filePlayback!=null ) return filePlayback.isrunning(); return false; } void initFiles() throws FileNotFoundException {
41,220
public class BufferMonitor extends Thread implements FieldtripBufferMonitor { public static final String TAG = BufferMonitor.class.toString(); private final Context context; private final SparseArray<BufferConnectionInfo> clients = new SparseArray<BufferConnectionInfo>(); private final BufferInfo info; <BUG>private final BroadcastReceiver mMessageReceiver = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) { if (intent.getIntExtra(C.MESSAGE_TYPE, -1) == C.UPDATE_REQUEST) { Log.i(TAG, "Received update request."); sendAllInfo(); } } };</BUG> private boolean run = true;
[DELETED]
41,221
public static final String CLIENT_INFO_TIME = "c_time"; public static final String CLIENT_INFO_WAITTIMEOUT = "c_waitTimeout"; public static final String CLIENT_INFO_CONNECTED = "c_connected"; public static final String CLIENT_INFO_CHANGED = "c_changed"; public static final String CLIENT_INFO_DIFF = "c_diff"; <BUG>public static final int UPDATE_REQUEST = 0; </BUG> public static final int UPDATE = 1; public static final int REQUEST_PUT_HEADER = 2; public static final int REQUEST_FLUSH_HEADER = 3;
public static final int THREAD_INFO_TYPE = 0;
41,222
catch (Exception e) { e.printStackTrace(); throw new RuntimeException("error calculating mcmc question."); } AnswerIfc answer = (AnswerIfc) publishedAnswerHash.get(item.getPublishedAnswerId()); <BUG>if (answer.getIsCorrect() == null || (!answer.getIsCorrect().booleanValue())) </BUG> { hasIncorrect = true; break;
if ( answer != null && (answer.getIsCorrect() == null || (!answer.getIsCorrect().booleanValue())))
41,223
public static final String LOG_FILE_SYNC_INTERVAL_BYTES = "log.file.sync.interval.bytes"; public static final String NUM_PARTITIONS = "log.publish.num.partitions"; public static final String KAFKA_SEED_BROKERS = "kafka.seed.brokers"; public static final String LOG_SAVER_EVENT_BUCKET_INTERVAL_MS = "log.saver.event.bucket.interval.ms"; public static final String LOG_SAVER_MAXIMUM_INMEMORY_EVENT_BUCKETS = "log.saver.event.max.inmemory.buckets"; <BUG>public static final String LOG_SAVER_INACTIVE_FILE_INTERVAL_MS = "log.saver.inactive.file.interval.ms"; public static final String LOG_SAVER_CHECKPOINT_INTERVAL_MS = "log.saver.checkpoint.interval.ms";</BUG> public static final String LOG_SAVER_TOPIC_WAIT_SLEEP_MS = "log.saver.topic.wait.sleep.ms"; public static final String LOG_RETENTION_DURATION_DAYS = "log.retention.duration.days"; public static final String LOG_MAX_FILE_SIZE_BYTES = "log.max.file.size.bytes";
public static final String LOG_SAVER_MAX_FILE_LIFETIME = "log.saver.max.file.lifetime.ms"; public static final String LOG_SAVER_CHECKPOINT_INTERVAL_MS = "log.saver.checkpoint.interval.ms";
41,224
public static final long DEFAULT_KAFKA_PROCUDER_BUFFER_MS = 1000; public static final String DEFAULT_NUM_PARTITIONS = "10"; public static final int DEFAULT_LOG_CLEANUP_RUN_INTERVAL_MINS = 24 * 60; public static final long DEFAULT_LOG_SAVER_EVENT_BUCKET_INTERVAL_MS = 1 * 1000; public static final long DEFAULT_LOG_SAVER_MAXIMUM_INMEMORY_EVENT_BUCKETS = 4; <BUG>public static final long DEFAULT_LOG_SAVER_INACTIVE_FILE_INTERVAL_MS = 60 * 60 * 1000; public static final long DEFAULT_LOG_SAVER_CHECKPOINT_INTERVAL_MS = 60 * 1000;</BUG> public static final long DEFAULT_LOG_RETENTION_DURATION_DAYS = 30; public static final long DEFAULT_LOG_SAVER_TOPIC_WAIT_SLEEP_MS = TimeUnit.MILLISECONDS.convert(10, TimeUnit.SECONDS); private LoggingConfiguration() {}
public static final long DEFAULT_LOG_SAVER_MAX_FILE_LIFETIME_MS = TimeUnit.HOURS.toMillis(6); public static final long DEFAULT_LOG_SAVER_CHECKPOINT_INTERVAL_MS = 60 * 1000;
41,225
private final RootLocationFactory rootLocationFactory; private final String logBaseDir; private final int syncIntervalBytes; private final long retentionDurationMs; private final long maxLogFileSizeBytes; <BUG>private final long inactiveIntervalMs; private final long checkpointIntervalMs;</BUG> private final int logCleanupIntervalMins; private final ListeningScheduledExecutorService scheduledExecutor; private final Impersonator impersonator;
private final long maxFileLifetimeMs; private final long checkpointIntervalMs;
41,226
FileMetaDataManager fileMetaDataManager = new FileMetaDataManager(tableUtil, txExecutorFactory, rootLocationFactory, namespacedLocationFactory, cConf, impersonator); AvroFileWriter avroFileWriter = new AvroFileWriter(fileMetaDataManager, namespacedLocationFactory, logBaseDir, logSchema, maxLogFileSizeBytes, syncIntervalBytes, <BUG>inactiveIntervalMs, impersonator); logFileWriter = new SimpleLogFileWriter(avroFileWriter, checkpointIntervalMs);</BUG> LogCleanup logCleanup = new LogCleanup(fileMetaDataManager, rootLocationFactory, retentionDurationMs, impersonator); scheduledExecutor.scheduleAtFixedRate(logCleanup, 10,
maxFileLifetimeMs, impersonator); logFileWriter = new SimpleLogFileWriter(avroFileWriter, checkpointIntervalMs);
41,227
Entry<String, Collection<KafkaLogEvent>> mapEntry = it.next(); List<KafkaLogEvent> list = (List<KafkaLogEvent>) mapEntry.getValue(); Collections.sort(list); logFileWriter.append(list); it.remove(); <BUG>} exponentialBackoff.reset();</BUG> } catch (Throwable e) { LOG.error("Caught exception during save, will try again with backoff.", e); try {
logFileWriter.flush(false); exponentialBackoff.reset();
41,228
LoggingConfiguration.DEFAULT_LOG_CLEANUP_RUN_INTERVAL_MINS); Preconditions.checkArgument(logCleanupIntervalMins > 0, "Log cleanup run interval is invalid: %s", logCleanupIntervalMins); AvroFileWriter avroFileWriter = new AvroFileWriter(fileMetaDataManager, namespacedLocationFactory, logBaseDir, serializer.getAvroSchema(), maxLogFileSizeBytes, <BUG>syncIntervalBytes, inactiveIntervalMs, impersonator); </BUG> checkpointManager = checkpointManagerFactory.create(cConf.get(Constants.Logging.KAFKA_TOPIC), CHECKPOINT_ROW_KEY_PREFIX); this.logFileWriter = new CheckpointingLogFileWriter(avroFileWriter, checkpointManager, checkpointIntervalMs);
syncIntervalBytes, maxFileLifetimeMs, impersonator);
41,229
this.logBaseDir = logBaseDir; this.schema = schema; this.syncIntervalBytes = syncIntervalBytes; this.fileMap = Maps.newHashMap(); this.maxFileSize = maxFileSize; <BUG>this.inactiveIntervalMs = inactiveIntervalMs; this.impersonator = impersonator;</BUG> } public void append(List<? extends LogWriteEvent> events) throws Exception { if (events.isEmpty()) {
this.maxFileLifetimeMs = maxFileLifetimeMs; this.impersonator = impersonator;
41,230
AvroFile avroFile = it.next().getValue(); if (!avroFile.isOpen()) { it.remove(); } else { avroFile.sync(); <BUG>if (currentTs - avroFile.getLastModifiedTs() > inactiveIntervalMs) { avroFile.close();</BUG> it.remove(); } }
long timeSinceFileCreate = currentTs - avroFile.getCreateTime(); if (timeSinceFileCreate > maxFileLifetimeMs) { avroFile.close();
41,231
import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter; import org.springframework.core.ResolvableType; import org.springframework.http.MediaType; import org.springframework.http.ReactiveHttpInputMessage; <BUG>import org.springframework.http.server.reactive.ServerHttpRequest; public abstract class AbstractServerHttpMessageReader<T> implements ServerHttpMessageReader<T> {</BUG> private HttpMessageReader<T> reader; public AbstractServerHttpMessageReader(HttpMessageReader<T> reader) { this.reader = reader;
import org.springframework.http.server.reactive.ServerHttpResponse; public abstract class AbstractServerHttpMessageReader<T> implements ServerHttpMessageReader<T> {
41,232
private HttpMessageReader<T> reader; public AbstractServerHttpMessageReader(HttpMessageReader<T> reader) { this.reader = reader; } @Override <BUG>public boolean canRead(ResolvableType elementType, MediaType mediaType, Map<String, Object> hints) { return this.reader.canRead(elementType, mediaType, hints); }</BUG> @Override public Flux<T> read(ResolvableType elementType, ReactiveHttpInputMessage inputMessage, Map<String, Object> hints) {
public boolean canRead(ResolvableType elementType, MediaType mediaType) { return this.reader.canRead(elementType, mediaType);
41,233
package org.springframework.http.codec; <BUG>import java.util.Collections; import java.util.Map; import com.fasterxml.jackson.annotation.JsonView; import org.springframework.core.MethodParameter;</BUG> import org.springframework.core.ResolvableType;
import java.util.HashMap; import org.reactivestreams.Publisher; import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter;
41,234
import com.fasterxml.jackson.annotation.JsonView; import org.springframework.core.MethodParameter;</BUG> import org.springframework.core.ResolvableType; import org.springframework.http.MediaType; import org.springframework.http.codec.json.AbstractJackson2Codec; <BUG>import org.springframework.http.server.reactive.ServerHttpRequest; public class Jackson2ServerHttpMessageWriter extends AbstractServerHttpMessageWriter<Object> {</BUG> public Jackson2ServerHttpMessageWriter(HttpMessageWriter<Object> writer) { super(writer); }
import org.reactivestreams.Publisher; import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter; import org.springframework.http.server.reactive.ServerHttpResponse; public class Jackson2ServerHttpMessageWriter extends AbstractServerHttpMessageWriter<Object> {
41,235
ReactiveAdapter adapter = getAdapterRegistry().getAdapterTo(bodyType.resolve()); ResolvableType elementType = ResolvableType.forMethodParameter(bodyParameter); if (adapter != null) { elementType = elementType.getGeneric(0); } <BUG>ServerHttpRequest request = exchange.getRequest(); MediaType mediaType = request.getHeaders().getContentType();</BUG> if (mediaType == null) { mediaType = MediaType.APPLICATION_OCTET_STREAM; }
ServerHttpResponse response = exchange.getResponse(); MediaType mediaType = request.getHeaders().getContentType();
41,236
flux = flux.map(applyValidationIfApplicable(bodyParameter)); } return Mono.just(adapter.fromPublisher(flux)); } else { <BUG>Mono<?> mono = reader.readMono(elementType, request, hints) .otherwise(ex -> Mono.error(getReadError(ex, bodyParameter))); </BUG> if (checkRequired(adapter, isBodyRequired)) { mono = mono.otherwiseIfEmpty(Mono.error(getRequiredBodyError(bodyParameter)));
Mono<?> mono = (reader instanceof ServerHttpMessageReader ? ((ServerHttpMessageReader<?>)reader).readMono(bodyType, elementType, request, response, Collections.emptyMap()) : reader.readMono(elementType, request, Collections.emptyMap()) .otherwise(ex -> Mono.error(getReadError(ex, bodyParameter))));
41,237
import reactor.core.publisher.Mono; import org.springframework.core.MethodParameter; import org.springframework.core.ResolvableType; import org.springframework.http.MediaType; import org.springframework.http.ReactiveHttpOutputMessage; <BUG>import org.springframework.http.server.reactive.ServerHttpRequest; public abstract class AbstractServerHttpMessageWriter<T> implements ServerHttpMessageWriter<T> {</BUG> private HttpMessageWriter<T> writer; public AbstractServerHttpMessageWriter(HttpMessageWriter<T> writer) { this.writer = writer;
import org.springframework.http.server.reactive.ServerHttpResponse; public abstract class AbstractServerHttpMessageWriter<T> implements ServerHttpMessageWriter<T> {
41,238
private HttpMessageWriter<T> writer; public AbstractServerHttpMessageWriter(HttpMessageWriter<T> writer) { this.writer = writer; } @Override <BUG>public boolean canWrite(ResolvableType elementType, MediaType mediaType, Map<String, Object> hints) { return this.writer.canWrite(elementType, mediaType, hints); }</BUG> @Override public Mono<Void> write(Publisher<? extends T> inputStream, ResolvableType elementType,
public boolean canWrite(ResolvableType elementType, MediaType mediaType) { return this.writer.canWrite(elementType, mediaType); public List<MediaType> getWritableMediaTypes() { return this.writer.getWritableMediaTypes();
41,239
private final FuzzyStack stack; private final int amount; private final int volume; public BlockCondition(FuzzyStack stack, BlockRange range) { this.amount = stack.toStack().stackSize; <BUG>this.volume = range.getVolume(); if(this.amount > this.volume) {</BUG> throw new IndexOutOfBoundsException("Required amount of blocks exceeds volume of range!"); } this.range = range;
if(this.amount > 1) { throw new IndexOutOfBoundsException("The required amount of blocks must be greater than zero!"); if(this.amount > this.volume) {
41,240
public BlockRange getRange() { return range; } @Override public boolean isMet(IBlockAccess world, BlockPos pos) { <BUG>return new BlockRange(this.range, pos).stream() .map(loc -> new FuzzyStack(world, loc)) .filter(this.stack::equals)</BUG> .skip(this.amount - 1) .findAny()
.map(loc -> FuzzyStack.fromBlockState(world.getBlockState(loc)).orElse(null))
41,241
import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public interface IGrowthRequirement { default boolean hasValidSoil(IBlockAccess world, BlockPos pos) { <BUG>final FuzzyStack soil = new FuzzyStack(world, pos.add(0, -1, 0)); return this.getSoils().stream().anyMatch(s -> s.isVarient(soil)); }</BUG> default boolean hasValidConditions(IBlockAccess world, BlockPos pos) {
return FuzzyStack.fromBlockState(world.getBlockState(pos.add(0, -1, 0))) .filter(soil -> this.getSoils().stream().anyMatch(e -> e.isVarient(soil))) .isPresent(); }
41,242
import net.minecraft.item.ItemStack; public interface IAgriSoilRegistry { boolean isSoil(IAgriSoil plant); Optional<IAgriSoil> getSoil(String id); default Optional<IAgriSoil> getSoil(IBlockState state) { <BUG>return this.getSoil(new FuzzyStack(state)); }</BUG> default Optional<IAgriSoil> getSoil(ItemStack stack) { return this.getSoil(new FuzzyStack(stack)); }
return FuzzyStack.fromBlockState(state).flatMap(this::getSoil);
41,243
package com.infinityraider.agricraft.api.seed; import com.infinityraider.agricraft.api.plant.IAgriPlant; import com.infinityraider.agricraft.api.stat.IAgriStat; import com.infinityraider.agricraft.api.plant.IAgriPlantAcceptor; <BUG>import com.infinityraider.agricraft.api.stat.IAgriStatAcceptor; public interface IAgriSeedAcceptor extends IAgriPlantAcceptor, IAgriStatAcceptor {</BUG> default boolean acceptsSeed(AgriSeed seed) { return seed != null && acceptsPlant(seed.getPlant()) && acceptsStat(seed.getStat()); }
import java.util.Optional; public interface IAgriSeedAcceptor extends IAgriPlantAcceptor, IAgriStatAcceptor {
41,244
private LocalBroadcastManager mLocalBroadcastManager; private String mActiveDownloadUrlString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); <BUG>setContentView(R.layout.activity_app_details2); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);</BUG> toolbar.setTitle(""); // Nice and clean toolbar setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.app_details2); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
41,245
.inflate(R.layout.app_details2_screenshots, parent, false); return new ScreenShotsViewHolder(view); } else if (viewType == VIEWTYPE_WHATS_NEW) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.app_details2_whatsnew, parent, false); <BUG>return new WhatsNewViewHolder(view); } else if (viewType == VIEWTYPE_LINKS) {</BUG> View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.app_details2_links, parent, false); return new ExpandableLinearLayoutViewHolder(view);
} else if (viewType == VIEWTYPE_DONATE) { .inflate(R.layout.app_details2_donate, parent, false); return new DonateViewHolder(view); } else if (viewType == VIEWTYPE_LINKS) {
41,246
return intern(new StringIdItem(new CstString(string))); } public StringIdItem intern(CstString string) { return intern(new StringIdItem(string)); } <BUG>public StringIdItem intern(StringIdItem string) { </BUG> if (string == null) { throw new NullPointerException("string == null"); }
public synchronized StringIdItem intern(StringIdItem string) {
41,247
return already; } strings.put(value, string); return string; } <BUG>public void intern(CstNat nat) { </BUG> intern(nat.getName()); intern(nat.getDescriptor()); }
public synchronized void intern(CstNat nat) {
41,248
out.annotate(4, "proto_ids_off: " + Hex.u4(offset)); } out.writeInt(sz); out.writeInt(offset); } <BUG>public ProtoIdItem intern(Prototype prototype) { </BUG> if (prototype == null) { throw new NullPointerException("prototype == null"); }
public synchronized ProtoIdItem intern(Prototype prototype) {
41,249
} catch (NullPointerException ex) { throw new NullPointerException("item == null"); } items.add(item); } <BUG>public <T extends OffsettedItem> T intern(T item) { </BUG> throwIfPrepared(); OffsettedItem result = interns.get(item); if (result != null) {
public synchronized <T extends OffsettedItem> T intern(T item) {
41,250
out.annotate(4, "type_ids_off: " + Hex.u4(offset)); } out.writeInt(sz); out.writeInt(offset); } <BUG>public TypeIdItem intern(Type type) { </BUG> if (type == null) { throw new NullPointerException("type == null"); }
public synchronized TypeIdItem intern(Type type) {
41,251
import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; <BUG>import java.util.TreeMap; import java.util.concurrent.Callable;</BUG> import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.Callable;
41,252
if (args.incremental && !anyFilesProcessed) { return 0; // this was a no-op incremental build } byte[] outArray = null; if (!outputDex.isEmpty() || (args.humanOutName != null)) { <BUG>outArray = writeDex(); </BUG> if (outArray == null) { return 2; }
outArray = writeDex(outputDex);
41,253
DxConsole.err.println("\ntrouble processing \"" + name + "\":\n\n" + IN_RE_CORE_CLASSES); errors.incrementAndGet(); throw new StopProcessing(); } <BUG>private static byte[] writeDex() { </BUG> byte[] outArray = null; try { try {
private static byte[] writeDex(DexFile outputDex) {
41,254
if (minimalMainDex && (mainDexListFile == null || !multiDex)) { System.err.println(MINIMAL_MAIN_DEX_OPTION + " is only supported in combination with " + MULTI_DEX_OPTION + " and " + MAIN_DEX_LIST_OPTION); throw new UsageException(); } <BUG>if (multiDex && numThreads != 1) { System.out.println(NUM_THREADS_OPTION + " is ignored when used with " + MULTI_DEX_OPTION); numThreads = 1; }</BUG> if (multiDex && incremental) {
[DELETED]
41,255
import ml.puredark.hviewer.ui.activities.BaseActivity; import ml.puredark.hviewer.ui.dataproviders.ListDataProvider; import ml.puredark.hviewer.ui.fragments.SettingFragment; import ml.puredark.hviewer.ui.listeners.OnItemLongClickListener; import ml.puredark.hviewer.utils.SharedPreferencesUtil; <BUG>import static android.webkit.WebSettings.LOAD_CACHE_ELSE_NETWORK; public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {</BUG> private BaseActivity activity; private Site site; private ListDataProvider mProvider;
import static ml.puredark.hviewer.R.id.container; public class PictureViewerAdapter extends RecyclerView.Adapter<PictureViewerAdapter.PictureViewerViewHolder> {
41,256
final PictureViewHolder viewHolder = new PictureViewHolder(view); if (pictures != null && position < pictures.size()) { final Picture picture = pictures.get(getPicturePostion(position)); if (picture.pic != null) { loadImage(container.getContext(), picture, viewHolder); <BUG>} else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null && site.extraRule.pictureUrl != null) { getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);</BUG> } else if (site.picUrlSelector != null) { getPictureUrl(container.getContext(), viewHolder, picture, site, site.picUrlSelector, null); } else {
} else if (site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) && site.extraRule != null) { if(site.extraRule.pictureRule != null && site.extraRule.pictureRule.url != null) getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureRule.url, site.extraRule.pictureRule.highRes); else if(site.extraRule.pictureUrl != null) getPictureUrl(container.getContext(), viewHolder, picture, site, site.extraRule.pictureUrl, site.extraRule.pictureHighRes);
41,257
import java.util.regex.Pattern; import butterknife.BindView; import butterknife.ButterKnife; import ml.puredark.hviewer.R; import ml.puredark.hviewer.beans.Category; <BUG>import ml.puredark.hviewer.beans.CommentRule; import ml.puredark.hviewer.beans.Rule;</BUG> import ml.puredark.hviewer.beans.Selector; import ml.puredark.hviewer.beans.Site; import ml.puredark.hviewer.ui.adapters.CategoryInputAdapter;
import ml.puredark.hviewer.beans.PictureRule; import ml.puredark.hviewer.beans.Rule;
41,258
inputGalleryRulePictureUrlReplacement.setText(site.galleryRule.pictureUrl.replacement); } if (site.galleryRule.pictureHighRes != null) { inputGalleryRulePictureHighResSelector.setText(joinSelector(site.galleryRule.pictureHighRes)); inputGalleryRulePictureHighResRegex.setText(site.galleryRule.pictureHighRes.regex); <BUG>inputGalleryRulePictureHighResReplacement.setText(site.galleryRule.pictureHighRes.replacement); }</BUG> if (site.galleryRule.commentRule != null) { if (site.galleryRule.commentRule.item != null) { inputGalleryRuleCommentItemSelector.setText(joinSelector(site.galleryRule.commentRule.item));
[DELETED]
41,259
inputExtraRuleCommentDatetimeReplacement.setText(site.extraRule.commentDatetime.replacement); } if (site.extraRule.commentContent != null) { inputExtraRuleCommentContentSelector.setText(joinSelector(site.extraRule.commentContent)); inputExtraRuleCommentContentRegex.setText(site.extraRule.commentContent.regex); <BUG>inputExtraRuleCommentContentReplacement.setText(site.extraRule.commentContent.replacement); }</BUG> } } }
[DELETED]
41,260
lastSite.galleryRule.cover = loadSelector(inputGalleryRuleCoverSelector, inputGalleryRuleCoverRegex, inputGalleryRuleCoverReplacement); lastSite.galleryRule.category = loadSelector(inputGalleryRuleCategorySelector, inputGalleryRuleCategoryRegex, inputGalleryRuleCategoryReplacement); lastSite.galleryRule.datetime = loadSelector(inputGalleryRuleDatetimeSelector, inputGalleryRuleDatetimeRegex, inputGalleryRuleDatetimeReplacement); lastSite.galleryRule.rating = loadSelector(inputGalleryRuleRatingSelector, inputGalleryRuleRatingRegex, inputGalleryRuleRatingReplacement); lastSite.galleryRule.description = loadSelector(inputGalleryRuleDescriptionSelector, inputGalleryRuleDescriptionRegex, inputGalleryRuleDescriptionReplacement); <BUG>lastSite.galleryRule.tags = loadSelector(inputGalleryRuleTagsSelector, inputGalleryRuleTagsRegex, inputGalleryRuleTagsReplacement); lastSite.galleryRule.pictureThumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement); lastSite.galleryRule.pictureUrl = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement); lastSite.galleryRule.pictureHighRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement); lastSite.galleryRule.commentRule = new CommentRule(); lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);</BUG> lastSite.galleryRule.commentRule.avatar = loadSelector(inputGalleryRuleCommentAvatarSelector, inputGalleryRuleCommentAvatarRegex, inputGalleryRuleCommentAvatarReplacement);
lastSite.galleryRule.pictureRule = (lastSite.galleryRule.pictureRule == null) ? new PictureRule() : lastSite.galleryRule.pictureRule; lastSite.galleryRule.pictureRule.thumbnail = loadSelector(inputGalleryRulePictureThumbnailSelector, inputGalleryRulePictureThumbnailRegex, inputGalleryRulePictureThumbnailReplacement); lastSite.galleryRule.pictureRule.url = loadSelector(inputGalleryRulePictureUrlSelector, inputGalleryRulePictureUrlRegex, inputGalleryRulePictureUrlReplacement); lastSite.galleryRule.pictureRule.highRes = loadSelector(inputGalleryRulePictureHighResSelector, inputGalleryRulePictureHighResRegex, inputGalleryRulePictureHighResReplacement); lastSite.galleryRule.commentRule = (lastSite.galleryRule.commentRule == null) ? new CommentRule() : lastSite.galleryRule.commentRule; lastSite.galleryRule.commentRule.item = loadSelector(inputGalleryRuleCommentItemSelector, inputGalleryRuleCommentItemRegex, inputGalleryRuleCommentItemReplacement);
41,261
lastSite.extraRule.cover = loadSelector(inputExtraRuleCoverSelector, inputExtraRuleCoverRegex, inputExtraRuleCoverReplacement); lastSite.extraRule.category = loadSelector(inputExtraRuleCategorySelector, inputExtraRuleCategoryRegex, inputExtraRuleCategoryReplacement); lastSite.extraRule.datetime = loadSelector(inputExtraRuleDatetimeSelector, inputExtraRuleDatetimeRegex, inputExtraRuleDatetimeReplacement); lastSite.extraRule.rating = loadSelector(inputExtraRuleRatingSelector, inputExtraRuleRatingRegex, inputExtraRuleRatingReplacement); lastSite.extraRule.description = loadSelector(inputExtraRuleDescriptionSelector, inputExtraRuleDescriptionRegex, inputExtraRuleDescriptionReplacement); <BUG>lastSite.extraRule.tags = loadSelector(inputExtraRuleTagsSelector, inputExtraRuleTagsRegex, inputExtraRuleTagsReplacement); lastSite.extraRule.pictureThumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement); lastSite.extraRule.pictureUrl = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement); lastSite.extraRule.pictureHighRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement); lastSite.extraRule.commentRule = new CommentRule(); lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);</BUG> lastSite.extraRule.commentRule.avatar = loadSelector(inputExtraRuleCommentAvatarSelector, inputExtraRuleCommentAvatarRegex, inputExtraRuleCommentAvatarReplacement);
lastSite.extraRule.pictureRule = (lastSite.extraRule.pictureRule == null) ? new PictureRule() : lastSite.extraRule.pictureRule; lastSite.extraRule.pictureRule.thumbnail = loadSelector(inputExtraRulePictureThumbnailSelector, inputExtraRulePictureThumbnailRegex, inputExtraRulePictureThumbnailReplacement); lastSite.extraRule.pictureRule.url = loadSelector(inputExtraRulePictureUrlSelector, inputExtraRulePictureUrlRegex, inputExtraRulePictureUrlReplacement); lastSite.extraRule.pictureRule.highRes = loadSelector(inputExtraRulePictureHighResSelector, inputExtraRulePictureHighResRegex, inputExtraRulePictureHighResReplacement); lastSite.extraRule.commentRule = (lastSite.extraRule.commentRule == null) ? new CommentRule() : lastSite.extraRule.commentRule; lastSite.extraRule.commentRule.item = loadSelector(inputExtraRuleCommentItemSelector, inputExtraRuleCommentItemRegex, inputExtraRuleCommentItemReplacement);
41,262
notifyItemChanged(position); if (mItemClickListener != null) mItemClickListener.onItemClick(v, position); } }); <BUG>if (tag.selected) label.getChildAt(0).setBackgroundResource(R.color.colorPrimary); else label.getChildAt(0).setBackgroundResource(R.color.dimgray);</BUG> }
[DELETED]
41,263
loadPicture(picture, task, null, true); } else if (!TextUtils.isEmpty(picture.pic) && !highRes) { picture.retries = 0; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_SINGLE_PAGE_BIG_PICTURE) <BUG>&& task.collection.site.extraRule != null && task.collection.site.extraRule.pictureUrl != null) { </BUG> getPictureUrl(picture, task, task.collection.site.extraRule.pictureUrl, task.collection.site.extraRule.pictureHighRes);
&& task.collection.site.extraRule != null) { if(task.collection.site.extraRule.pictureRule != null && task.collection.site.extraRule.pictureRule.url != null) getPictureUrl(picture, task, task.collection.site.extraRule.pictureRule.url, task.collection.site.extraRule.pictureRule.highRes); else if(task.collection.site.extraRule.pictureUrl != null)
41,264
if (Picture.hasPicPosfix(picture.url)) { picture.pic = picture.url; loadPicture(picture, task, null, false); } else if (task.collection.site.hasFlag(Site.FLAG_JS_NEEDED_ALL)) { <BUG>new Handler(Looper.getMainLooper()).post(()->{ </BUG> WebView webView = new WebView(HViewerApplication.mContext); WebSettings mWebSettings = webView.getSettings(); mWebSettings.setJavaScriptEnabled(true);
new Handler(Looper.getMainLooper()).post(() -> {
41,265
package org.zanata.process; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.AutoCreate; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; <BUG>import org.jboss.seam.annotations.async.Asynchronous; import lombok.extern.slf4j.Slf4j;</BUG> @Name("asynchronousExecutor") @Scope(ScopeType.STATELESS) @AutoCreate
import org.zanata.security.ZanataIdentity; import lombok.extern.slf4j.Slf4j;
41,266
package org.zanata.process; import lombok.extern.slf4j.Slf4j; @Slf4j public abstract class RunnableProcess<H extends ProcessHandle> <BUG>{ protected abstract void run( H handle ) throws Throwable;</BUG> protected void prepare( H handle ) { }
import org.zanata.security.ZanataIdentity; private String runAsUsername; private String runAsApiKey; protected abstract void run( H handle ) throws Throwable;
41,267
errorMessage = "A document with name " + resource.getName() + " already exists."; } } if( errorMessage == null ) { <BUG>processManagerServiceImpl.startProcess( new RunnableProcess<ProcessHandle>()</BUG> { @Override protected void run(ProcessHandle handle) throws Throwable
RunnableProcess<ProcessHandle> process = new RunnableProcess<ProcessHandle>()
41,268
DocumentService documentServiceImpl = (DocumentService)Component.getInstance(DocumentServiceImpl.class); documentServiceImpl.saveDocument( projectSlug, iterationSlug, resource, extensions, copytrans, true, handle); handle.setCurrentProgress( handle.getMaxProgress() ); // TODO This should update with real progress <BUG>} }, handle );</BUG> return this.getProcessStatus(handle.getId());
[DELETED]
41,269
String errorMessage = null; HProjectIteration hProjectIteration = retrieveAndCheckIteration(projectSlug, iterationSlug, true); resourceUtils.validateExtensions(extensions); //gettext, comment if( errorMessage == null ) { <BUG>processManagerServiceImpl.startProcess( new RunnableProcess<ProcessHandle>()</BUG> { @Override protected void prepare(ProcessHandle handle)
RunnableProcess<ProcessHandle> process = new RunnableProcess<ProcessHandle>()
41,270
@Override protected void handleThrowable(ProcessHandle handle, Throwable t) { AsynchronousProcessResourceService.log.error("Error pushing source document", t); super.handleThrowable(handle, t); //To change body of overridden methods use File | Settings | File Templates. <BUG>} }, handle );</BUG> return this.getProcessStatus(handle.getId());
protected void prepare(ProcessHandle handle) handle.setMaxProgress(resource.getTextFlows().size());
41,271
final MergeType finalMergeType = mergeType; final String userName = identity.getCredentials().getUsername(); HProjectIteration hProjectIteration = projectIterationDAO.getBySlug(projectSlug, iterationSlug); if( errorMessage == null ) { <BUG>processManagerServiceImpl.startProcess( new RunnableProcess<MessagesProcessHandle>()</BUG> { @Override protected void run(MessagesProcessHandle handle) throws Throwable
RunnableProcess<MessagesProcessHandle> process = new RunnableProcess<MessagesProcessHandle>()
41,272
@Override protected void handleThrowable(MessagesProcessHandle handle, Throwable t) { AsynchronousProcessResourceService.log.error("Error pushing translations", t); super.handleThrowable(handle, t); //To change body of overridden methods use File | Settings | File Templates. <BUG>} }, handle );</BUG> return this.getProcessStatus(handle.getId());
protected void run(MessagesProcessHandle handle) throws Throwable TranslationService translationServiceImpl = (TranslationService)Component.getInstance(TranslationServiceImpl.class); translationServiceImpl.translateAllInDoc(projectSlug, iterationSlug, id, locale, translatedDoc, extensions, finalMergeType, true, userName, handle);
41,273
if (this.maxInactive == -1) return false; else { long currentTime = System.currentTimeMillis(); long staleTime = 0; <BUG>try { staleTime = df.getMetaFile().getLastAccessed()</BUG> + this.maxInactive; } catch (Exception e) { SDFSLogger.getLog().error("error checking last accessed", e);
if(df.getMetaFile() == null) return true; else staleTime = df.getMetaFile().getLastAccessed()
41,274
Long hid = Long.parseLong(key); File mf = HashBlobArchive.getPath(hid); HashBlobArchive.addToCompressedLength(mf.length()); try { HashMap<String, String> metaData = this.readHashMap(hid); <BUG>HashBlobArchive.addToCompressedLength(Integer.parseInt(metaData .get("bsize")));</BUG> if (metaData.containsKey("deleted-objects") || metaData.containsKey("deleted")) { metaData.remove("deleted-objects");
HashBlobArchive.addToLength(Integer.parseInt(metaData .get("bsize")));
41,275
} catch (Exception _e) { e = _e; SDFSLogger.getLog().debug("unable to connect to bucket try " + i + " of 3", e); } } <BUG>if (e != null) SDFSLogger.getLog().warn("unable to connect to bucket try " + 3 + " of 3", e);</BUG> return true; } @Override
if (e != null && !this.atmosStore ) SDFSLogger.getLog().warn("unable to connect to bucket try " + 3 + " of 3", e);
41,276
e.printStackTrace(); System.exit(3); } } } <BUG>archive = new HashBlobArchive(false); </BUG> if (z > 0 || c > 0) { SDFSLogger.getLog().info("Uploaded " + z + " archives. Failed to upload " + c + " archives"); }
archive = new HashBlobArchive(false,MAX_HM_SZ);
41,277
return archive.compact(); } else { return 0; } } <BUG>private HashBlobArchive(boolean compact) throws IOException { </BUG> long pid = rand.nextLong(); while (pid < 100 && store.fileExists(pid)) pid = rand.nextLong();
private HashBlobArchive(boolean compact,int sz) throws IOException {
41,278
if (SDFSLogger.isDebug()) SDFSLogger.getLog().debug("waiting to write " + id + " rchunks sz=" + rchunks.size()); this.writeable = true; this.compactStaged = compact; wMaps.put(id, new SimpleByteArrayLongMap(new File(staged_chunk_location, Long.toString(id) + ".map").getPath(), <BUG>MAX_HM_SZ, VERSION)); if (!this.compactStaged)</BUG> executor.execute(this); f = new File(staged_chunk_location, Long.toString(id)); if (VERSION > 0) {
sz, VERSION)); if (!this.compactStaged)
41,279
return getChunk(hash); } catch (IOException e) { throw e; } catch (Exception e) { SDFSLogger.getLog() <BUG>.error("unable to read at " + pos + " " + nlen + " flen " + f.length() + " file=" + f.getPath(), e); </BUG> throw new IOException(e); } finally { l.unlock();
} catch (MapClosedException e) { .error("unable to read at " + pos + " " + nlen + " flen " + f.length() + " file=" + f.getPath() + " openFiles " + openFiles.size(), e);
41,280
while (!_har.moveFile(this.id)) { Thread.sleep(100); trys++; if (trys > 4) throw new IOException(); <BUG>} } else {</BUG> _har.delete(); return 0; }
HashBlobArchive.compressedLength.addAndGet(_har.f.length()); HashBlobArchive.currentLength.addAndGet(_har.uncompressedLength.get()); } else {
41,281
HashBlobArchive.compressedLength.addAndGet(-1 * _har.f.length()); HashBlobArchive.currentLength.addAndGet(-1 * _har.uncompressedLength.get()); throw new IOException(e);</BUG> } <BUG>HashBlobArchive.compressedLength.addAndGet(-1 * ofl); return f.length() - ofl;</BUG> } private boolean uploadFile(long nid) throws Exception { Lock l = this.lock.readLock(); l.lock();
throw new IOException(e); HashBlobArchive.compressedLength.addAndGet(-1* ofl); return f.length() - ofl;
41,282
for (int i = 0; i < (numshards); i++) { BitSet cl = new BitSet(partSize); this.claims.add(i, cl); } int cp = 0; <BUG>if (!closedCorrectly) { for (int i = 0; i < (numshards); i++) {</BUG> BitSet mp = new BitSet(partSize); BitSet rm = new BitSet(partSize); BitSet cl = new BitSet(partSize);
[DELETED]
41,283
@SideOnly(Side.CLIENT) public class GuiSeedAnalyzer extends GuiContainer { public static final ResourceLocation texture = new ResourceLocation(Reference.MOD_ID, "textures/gui/GuiSeedAnalyzer.png"); public TileEntitySeedAnalyzer seedAnalyzer; private boolean journalOpen; <BUG>private GuiJournal guiJournal; </BUG> public GuiSeedAnalyzer(InventoryPlayer inventory, TileEntitySeedAnalyzer seedAnalyzer) { super(new ContainerSeedAnalyzer(inventory, seedAnalyzer)); this.seedAnalyzer = seedAnalyzer;
private AgriGuiWrapper guiJournal;
41,284
return; } ItemStack journal = seedAnalyzer.getStackInSlot(ContainerSeedAnalyzer.journalSlotId); if(journal != null) { journalOpen = true; <BUG>guiJournal = new GuiJournal(journal); </BUG> guiJournal.setWorldAndResolution(this.mc, this.width, this.height); } }
guiJournal = new AgriGuiWrapper(new GuiJournal(journal));
41,285
import org.apache.sling.jcr.resource.JcrResourceConstants; import org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl; import org.apache.sling.jcr.resource.internal.helper.MapEntries; import org.apache.sling.jcr.resource.internal.helper.Mapping; import org.apache.sling.performance.annotation.PerformanceTestSuite; <BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG> import org.junit.runner.RunWith;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
41,286
@PerformanceTestSuite public ParameterizedTestList testPerformance() throws Exception { Helper helper = new Helper(); ParameterizedTestList testCenter = new ParameterizedTestList(); testCenter.setTestSuiteTitle("jcr.resource-2.0.10"); <BUG>testCenter.addTestObject(new ResolveNonExistingWith1000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith1000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000AliasTest(helper)); </BUG> return testCenter;
testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith1000VanityPathTest",helper, 100, 10)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith5000VanityPathTest",helper, 100, 50)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith10000VanityPathTest",helper, 100, 100)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWithManyAliasTest",helper, 1000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith5000AliasTest",helper, 5000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith10000AliasTest",helper, 10000));
41,287
package org.apache.sling.performance; <BUG>import static org.mockito.Mockito.*; import javax.jcr.NamespaceRegistry;</BUG> import javax.jcr.Session; import junitx.util.PrivateAccessor;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.mock; import javax.jcr.NamespaceRegistry;
41,288
import org.apache.sling.jcr.resource.JcrResourceConstants; import org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl; import org.apache.sling.jcr.resource.internal.helper.MapEntries; import org.apache.sling.jcr.resource.internal.helper.Mapping; import org.apache.sling.performance.annotation.PerformanceTestSuite; <BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG> import org.junit.runner.RunWith;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
41,289
import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.jcr.api.SlingRepository; import org.apache.sling.jcr.resource.JcrResourceConstants; import org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory; import org.apache.sling.performance.annotation.PerformanceTestSuite; <BUG>import org.apache.sling.performance.tests.ResolveNonExistingWith10000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith10000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith1000VanityPathTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000AliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWith5000VanityPathTest;</BUG> import org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator;
import org.apache.sling.performance.tests.ResolveNonExistingWithManyAliasTest; import org.apache.sling.performance.tests.ResolveNonExistingWithManyVanityPathTest;
41,290
@PerformanceTestSuite public ParameterizedTestList testPerformance() throws Exception { Helper helper = new Helper(); ParameterizedTestList testCenter = new ParameterizedTestList(); testCenter.setTestSuiteTitle("jcr.resource-2.2.0"); <BUG>testCenter.addTestObject(new ResolveNonExistingWith1000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000VanityPathTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith1000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith5000AliasTest(helper)); testCenter.addTestObject(new ResolveNonExistingWith10000AliasTest(helper)); </BUG> return testCenter;
testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith1000VanityPathTest",helper, 100, 10)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith5000VanityPathTest",helper, 100, 50)); testCenter.addTestObject(new ResolveNonExistingWithManyVanityPathTest("ResolveNonExistingWith10000VanityPathTest",helper, 100, 100)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith1000AliasTest",helper, 1000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith5000AliasTest",helper, 5000)); testCenter.addTestObject(new ResolveNonExistingWithManyAliasTest("ResolveNonExistingWith10000AliasTest",helper, 10000));
41,291
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;
41,292
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;
41,293
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"),
41,294
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]
41,295
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) {
41,296
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;
41,297
String className = resourceType.getStorageStrategy().getClazz(); Class<?> cinst; try { cinst = Class.forName(className); } catch (ClassNotFoundException e) { <BUG>throw new ObjectRetrievalFailureException(StorageStrategy.class, className, "Could not load class", e);</BUG> }
throw new ObjectRetrievalFailureException(StorageStrategy.class, className, "Could not load class '" + className + "' for resource type '" + resourceType.getName() + "'", e);
41,298
} StorageStrategy storageStrategy; try { storageStrategy = (StorageStrategy) cinst.newInstance(); } catch (InstantiationException e) { <BUG>throw new ObjectRetrievalFailureException(StorageStrategy.class, className, "Could not instantiate", e);</BUG> } catch (IllegalAccessException e) {
throw new ObjectRetrievalFailureException(StorageStrategy.class, className, "Could not instantiate class '" + className + "' for resource type '" + resourceType.getName() + "'", e);
41,299
className, "Could not instantiate", e);</BUG> } catch (IllegalAccessException e) { <BUG>throw new ObjectRetrievalFailureException(StorageStrategy.class, className, "Could not instantiate", e);</BUG> }
StorageStrategy storageStrategy; try { storageStrategy = (StorageStrategy) cinst.newInstance(); } catch (InstantiationException e) { throw new ObjectRetrievalFailureException(StorageStrategy.class, className, "Could not instantiate class '" + className + "' for resource type '" + resourceType.getName() + "'", e); throw new ObjectRetrievalFailureException(StorageStrategy.class, className, "Could not instantiate class '" + className + "' for resource type '" + resourceType.getName() + "'", e);
41,300
import java.sql.SQLException; import java.sql.Statement; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; <BUG>import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set;</BUG> import java.util.concurrent.locks.Lock;
import java.util.HashMap; import java.util.Map; import java.util.Set;