id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
15,501
if ( data.fieldsMaximumLengthAsInt[i] >= 0 && stringLength > data.fieldsMaximumLengthAsInt[i] ) { KettleValidatorException exception = new KettleValidatorException( this, field, KettleValidatorException.ERROR_LONGER_THAN_MAXIMUM_LENGTH, BaseMessages.getString( PKG, "Validator.Exception.LongerThanMaximumLength", field.getFieldName(), valueMeta.getString( valueData ), Integer.toString( stringValue.length() ), field <BUG>.getMaximumLength() ), field.getFieldName() ); if ( meta.isValidatingAll() ) { exceptions.add( exception ); } else { throw exception; </BUG> }
if ( !meta.isValidatingAll() ) { return exceptions;
15,502
if ( data.minimumValue[i] != null && valueMeta.compare( valueData, validatorMeta, data.minimumValue[i] ) < 0 ) { KettleValidatorException exception = new KettleValidatorException( this, field, KettleValidatorException.ERROR_LOWER_THAN_ALLOWED_MINIMUM, BaseMessages.getString( PKG, "Validator.Exception.LowerThanMinimumValue", field.getFieldName(), valueMeta.getString( valueData ), data.constantsMeta[i].getString( data.minimumValue[i] ) ), <BUG>field.getFieldName() ); if ( meta.isValidatingAll() ) { exceptions.add( exception ); } else { throw exception; </BUG> }
if ( !meta.isValidatingAll() ) { return exceptions;
15,503
if ( data.maximumValue[i] != null && valueMeta.compare( valueData, validatorMeta, data.maximumValue[i] ) > 0 ) { KettleValidatorException exception = new KettleValidatorException( this, field, KettleValidatorException.ERROR_HIGHER_THAN_ALLOWED_MAXIMUM, BaseMessages.getString( PKG, "Validator.Exception.HigherThanMaximumValue", field.getFieldName(), valueMeta.getString( valueData ), data.constantsMeta[i].getString( data.maximumValue[i] ) ), <BUG>field.getFieldName() ); if ( meta.isValidatingAll() ) { exceptions.add( exception ); } else { throw exception; </BUG> }
if ( !meta.isValidatingAll() ) { return exceptions;
15,504
if ( field.isOnlyNumericAllowed() ) { if ( valueMeta.isNumeric() || !containsOnlyDigits( valueMeta.getString( valueData ) ) ) { KettleValidatorException exception = new KettleValidatorException( this, field, KettleValidatorException.ERROR_NON_NUMERIC_DATA, BaseMessages.getString( PKG, "Validator.Exception.NonNumericDataNotAllowed", <BUG>field.getFieldName(), valueMeta.toStringMeta() ), field.getFieldName() ); if ( meta.isValidatingAll() ) { exceptions.add( exception ); } else { throw exception; </BUG> }
if ( !meta.isValidatingAll() ) { return exceptions;
15,505
if ( !Const.isEmpty( data.startStringNotAllowed[i] ) && stringValue.startsWith( data.startStringNotAllowed[i] ) ) { KettleValidatorException exception = new KettleValidatorException( this, field, KettleValidatorException.ERROR_STARTS_WITH_STRING, BaseMessages.getString( PKG, "Validator.Exception.StartsWithString", field.getFieldName(), <BUG>valueMeta.getString( valueData ), field.getStartStringNotAllowed() ), field.getFieldName() ); if ( meta.isValidatingAll() ) { exceptions.add( exception ); } else { throw exception; </BUG> }
if ( !meta.isValidatingAll() ) { return exceptions;
15,506
if ( !matcher.matches() ) { KettleValidatorException exception = new KettleValidatorException( this, field, KettleValidatorException.ERROR_MATCHING_REGULAR_EXPRESSION_EXPECTED, BaseMessages.getString( PKG, "Validator.Exception.MatchingRegExpExpected", field.getFieldName(), valueMeta <BUG>.getString( valueData ), field.getRegularExpression() ), field.getFieldName() ); if ( meta.isValidatingAll() ) { exceptions.add( exception ); } else { throw exception; </BUG> }
if ( !meta.isValidatingAll() ) { return exceptions;
15,507
if ( matcher.matches() ) { KettleValidatorException exception = new KettleValidatorException( this, field, KettleValidatorException.ERROR_MATCHING_REGULAR_EXPRESSION_NOT_ALLOWED, BaseMessages.getString( PKG, "Validator.Exception.MatchingRegExpNotAllowed", field.getFieldName(), valueMeta <BUG>.getString( valueData ), field.getRegularExpressionNotAllowed() ), field.getFieldName() ); if ( meta.isValidatingAll() ) { exceptions.add( exception ); } else { throw exception; </BUG> }
if ( !meta.isValidatingAll() ) { return exceptions;
15,508
package org.optaplanner.core.api.score.buildin.bendable; import org.junit.Test; <BUG>import org.kie.api.runtime.rule.RuleContext; import org.optaplanner.core.api.score.holder.AbstractScoreHolderTest;</BUG> import static org.junit.Assert.*; public class BendableScoreHolderTest extends AbstractScoreHolderTest { @Test
import org.optaplanner.core.api.score.buildin.hardmediumsoft.HardMediumSoftScore; import org.optaplanner.core.api.score.holder.AbstractScoreHolderTest;
15,509
package org.optaplanner.core.api.score.buildin.hardmediumsoft; import org.junit.Test; <BUG>import org.kie.api.runtime.rule.RuleContext; import org.optaplanner.core.api.score.holder.AbstractScoreHolderTest;</BUG> import static org.junit.Assert.*; public class HardMediumSoftScoreHolderTest extends AbstractScoreHolderTest { @Test
import org.optaplanner.core.api.score.buildin.hardsoft.HardSoftScore; import org.optaplanner.core.api.score.holder.AbstractScoreHolderTest;
15,510
package org.optaplanner.core.api.score.buildin.bendablebigdecimal; import java.math.BigDecimal; import org.junit.Test; <BUG>import org.kie.api.runtime.rule.RuleContext; import org.optaplanner.core.api.score.holder.AbstractScoreHolderTest;</BUG> import static org.junit.Assert.*; public class BendableBigDecimalScoreHolderTest extends AbstractScoreHolderTest { @Test
import org.optaplanner.core.api.score.buildin.bendablelong.BendableLongScore; import org.optaplanner.core.api.score.holder.AbstractScoreHolderTest;
15,511
package org.optaplanner.core.api.score.buildin.bendablelong; import org.junit.Test; <BUG>import org.kie.api.runtime.rule.RuleContext; import org.optaplanner.core.api.score.holder.AbstractScoreHolderTest;</BUG> import static org.junit.Assert.*; public class BendableLongScoreHolderTest extends AbstractScoreHolderTest { @Test
import org.optaplanner.core.api.score.buildin.bendable.BendableScore; import org.optaplanner.core.api.score.holder.AbstractScoreHolderTest;
15,512
import es.icarto.gvsig.navtableforms.utils.TOCTableManager; public class TableModelFactory { public static AlphanumericTableModel createFromTable(String sourceTable, String[] columnNames, String[] columnAliases) { TOCTableManager toc = new TOCTableManager(); <BUG>IEditableSource model = toc.getTableByName(sourceTable).getModel() .getModelo();</BUG> return new AlphanumericTableModel(model, columnNames, columnAliases); }
IEditableSource model = toc.getTableModelByName(sourceTable);
15,513
String rowFilterValue, String[] columnNames, String[] columnAliases) throws ReadDriverException { TOCTableManager toc = new TOCTableManager(); <BUG>IEditableSource model = toc.getTableByName(sourceTable).getModel() .getModelo();</BUG> int fieldIndex = model.getRecordset() .getFieldIndexByName(rowFilterName);
IEditableSource model = toc.getTableModelByName(sourceTable);
15,514
String sourceTable, String rowFilterName, String[] rowFilterValues, String[] columnNames, String[] columnAliases) throws ReadDriverException { TOCTableManager toc = new TOCTableManager(); <BUG>IEditableSource model = toc.getTableByName(sourceTable).getModel() .getModelo();</BUG> int fieldIndex = model.getRecordset() .getFieldIndexByName(rowFilterName);
IEditableSource model = toc.getTableModelByName(sourceTable);
15,515
public boolean checkLayerLoaded(String layerName) { return (new TOCLayerManager().getLayerByName(layerName) != null); } @Override public boolean checkTableLoaded(String tableName) { <BUG>return (new TOCTableManager().getTableByName(tableName) != null); </BUG> } protected void loadLayer(String layerName, String dbSchema) { IWindow[] windows = PluginServices.getMDIManager().getOrderedWindows();
return (new TOCTableManager().getTableModelByName(tableName) != null);
15,516
"<head><title>FindBugs Cloud Stats</title></head>" + "<body>"); showChartImg(resp, evalsOverTimeChart.toURLString()); resp.getOutputStream().print("<br><br>"); showChartImg(resp, evalsByUserChart.toURLString()); <BUG>showChartImg(resp, issuesByUserChart.toURLString()); }</BUG> private LineChart createEvalsByWeekChart(Map<Long, Integer> evalsByWeek) { long first = Collections.min(evalsByWeek.keySet()); Calendar cal = Calendar.getInstance();
} private <E> void increment(Map<E, Integer> map, E key) { Integer oldCount = map.get(key); if (oldCount == null) oldCount = 0; map.put(key, oldCount + 1); }
15,517
import org.apache.mina.core.session.IoSession; import org.apache.mina.core.session.IoSessionInitializer; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.apache.mina.filter.codec.textline.TextLineCodecFactory; import org.apache.mina.filter.logging.LoggingFilter; <BUG>import org.apache.mina.filter.ssl.SslFilter; import org.opennms.core.utils.LogUtils;</BUG> import org.opennms.netmgt.provision.DetectFuture; import org.opennms.netmgt.provision.DetectorMonitor; import org.opennms.netmgt.provision.support.AsyncClientConversation.AsyncExchangeImpl;
import org.opennms.core.utils.InetAddressUtils; import org.opennms.core.utils.LogUtils;
15,518
session.getFilterChain().addLast( "codec", getProtocolCodecFilter()); session.getConfig().setIdleTime(IdleStatus.READER_IDLE, getIdleTime()); session.setAttribute( IoHandler.class, createDetectorHandler(detectFuture) ); } }; <BUG>final InetSocketAddress socketAddress = new InetSocketAddress(address, getPort()); final ConnectFuture cf = m_connectionFactory.connect(socketAddress, init); </BUG> cf.addListener(retryAttemptListener(m_connectionFactory, detectFuture, socketAddress, init, getRetries() )); } catch (KeyManagementException e) {
final InetSocketAddress localAddress = new InetSocketAddress(InetAddressUtils.getLocalHostAddress(), 0); final ConnectFuture cf = m_connectionFactory.connect(socketAddress, localAddress, init);
15,519
if(cause instanceof IOException) { if(retryAttempt == 0) { LogUtils.infof(this, "Service %s detected false",getServiceName()); detectFuture.setServiceDetected(false); }else { <BUG>LogUtils.infof(this, "Connection exception occurred %s for service %s, retrying attempt %d", cause, getServiceName(), retryAttempt); future = connector.reConnect(address, init); </BUG> future.addListener(retryAttemptListener(connector, detectFuture, address, init, retryAttempt - 1)); }
final InetSocketAddress localAddress = new InetSocketAddress(InetAddressUtils.getLocalHostAddress(), 0); future = connector.reConnect(address, localAddress, init);
15,520
public static void dispose(ConnectionFactory factory) { if (s_availableConnections != null) { s_availableConnections.release(); } if (--factory.m_references <= 0) { <BUG>LogUtils.debugf(factory, "Disposing of factory for interval %d", factory.getTimeout()); Iterator<Entry<Integer, ConnectionFactory>> i = s_connectorPool.entrySet().iterator();</BUG> while(i.hasNext()) { if(i.next().getValue() == factory) {
LogUtils.debugf(factory, "Disposing of factory %s for interval %d", factory, factory.m_timeout); synchronized (s_connectorPool) { Iterator<Entry<Integer, ConnectionFactory>> i = s_connectorPool.entrySet().iterator();
15,521
Iterator<Entry<Integer, ConnectionFactory>> i = s_connectorPool.entrySet().iterator();</BUG> while(i.hasNext()) { if(i.next().getValue() == factory) { i.remove(); } <BUG>} synchronized (factory.m_connector) { factory.m_connector.dispose(); </BUG> }
public static void dispose(ConnectionFactory factory) { if (s_availableConnections != null) { s_availableConnections.release(); if (--factory.m_references <= 0) { LogUtils.debugf(factory, "Disposing of factory %s for interval %d", factory, factory.m_timeout); synchronized (s_connectorPool) { Iterator<Entry<Integer, ConnectionFactory>> i = s_connectorPool.entrySet().iterator();
15,522
package org.opennms.netmgt.provision.detector; import static org.junit.Assert.assertFalse; <BUG>import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue;</BUG> import java.io.IOException; import java.net.InetAddress; import org.apache.mina.core.future.IoFutureListener;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue;
15,523
m_detector.setBanner(".*"); m_detector.init(); } @BeforeClass public static void beforeTest(){ <BUG>System.setProperty("org.opennms.netmgt.provision.maxConcurrentConnectors", "2000"); }</BUG> @After public void tearDown() throws IOException { if(m_server != null){
ConnectionFactory.init();
15,524
setUp(); LogUtils.debugf(this, "current loop: %d", i); assertNotNull(m_detector); m_detector.setPort(port); final DefaultDetectFuture future = (DefaultDetectFuture)m_detector.isServiceDetected(address, new NullDetectorMonitor()); <BUG>future.addListener(new IoFutureListener<DetectFuture>() { public void operationComplete(final DetectFuture future) { m_detector.dispose(); } });</BUG> future.awaitUninterruptibly();
[DELETED]
15,525
@Test @Repeat(10000) public void testNoServerPresent() throws Exception { m_detector.setPort(1999); System.err.printf("Starting testNoServerPresent with detector: %s\n", m_detector); <BUG>final DetectFuture future = m_detector.isServiceDetected(InetAddress.getLocalHost(), new NullDetectorMonitor()); future.addListener(new IoFutureListener<DetectFuture>() { public void operationComplete(final DetectFuture future) { m_detector.dispose(); } });</BUG> assertNotNull(future);
final DetectFuture future = m_detector.isServiceDetected(InetAddressUtils.getLocalHostAddress(), new NullDetectorMonitor()); future.awaitUninterruptibly(); assertFalse(future.isServiceDetected()); assertNull(future.getException()); System.err.printf("Finished testNoServerPresent with detector: %s\n", m_detector);
15,526
import net.sf.samtools.SAMRecord; import org.broad.tribble.util.variantcontext.VariantContext; import org.broadinstitute.sting.utils.MathUtils; import org.broadinstitute.sting.utils.QualityUtils; import org.broadinstitute.sting.utils.Utils; <BUG>import org.broadinstitute.sting.utils.genotype.Haplotype; import java.util.Arrays;</BUG> import java.util.List; public class HaplotypeIndelErrorModel { private final int maxReadDeletionLength; // maximum length of deletion on a read
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import java.util.Arrays;
15,527
import org.broadinstitute.sting.utils.pileup.PileupElement; import java.util.Map; </BUG> import java.util.HashMap; import java.util.List; <BUG>import java.util.Arrays; </BUG> public class MappingQualityZero implements InfoFieldAnnotation, StandardAnnotation { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) { if ( stratifiedContexts.size() == 0 )
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
15,528
package org.broadinstitute.sting.gatk.walkers.annotator; import org.broad.tribble.util.variantcontext.VariantContext; import org.broad.tribble.vcf.VCFHeaderLineType; <BUG>import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;</BUG> import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
15,529
rest("/cart/").description("Personal Shopping Cart Service") .produces(MediaType.APPLICATION_JSON_VALUE) .options("/{cartId}") .route().id("getCartOptionsRoute").end().endRest() .options("/checkout/{cartId}") <BUG>.route().id("checkoutCartOptionsRoute").end().endRest() .options("/{cartId}/{itemId}/{quantity}")</BUG> .route().id("cartAddDeleteOptionsRoute").end().endRest() .post("/checkout/{cartId}").description("Finalize shopping cart and process payment") .param().name("cartId").type(RestParamType.path).description("The ID of the cart to process").dataType("string").endParam()
.options("/{cartId}/{tmpId}") .route().id("cartSetOptionsRoute").end().endRest() .options("/{cartId}/{itemId}/{quantity}")
15,530
protected Role role; protected Set<VlanId> sVlanIdSet; String tpid; public CarrierEthernetEnni(ConnectPoint connectPoint, String uniCfgId, Role role, VlanId sVlanId, String tpid, Bandwidth usedCapacity) { <BUG>super(connectPoint, uniCfgId); </BUG> this.role = role; this.sVlanIdSet = Sets.newConcurrentHashSet(); if (sVlanId != null) {
super(connectPoint, Type.ENNI, uniCfgId);
15,531
return ltpCfgId; } public Role role() { return role; } <BUG>public Type type() { return type; </BUG> } public CarrierEthernetNetworkInterface ni() {
public CarrierEthernetNetworkInterface.Type type() { return ni.type();
15,532
protected Role role; protected Set<VlanId> sVlanIdSet; String tpid; public CarrierEthernetInni(ConnectPoint connectPoint, String uniCfgId, Role role, VlanId sVlanId, String tpid, Bandwidth usedCapacity) { <BUG>super(connectPoint, uniCfgId); </BUG> this.role = role; this.sVlanIdSet = Sets.newConcurrentHashSet(); if (sVlanId != null) {
super(connectPoint, Type.INNI, uniCfgId);
15,533
Packages modulePkgs = modulePkgMap.get(module); for (int i = 0; i < reqs.size(); i++) { Requirement req = reqs.get(i); Capability cap = caps.get(i); <BUG>calculateExportedPackages(cap.getModule(), modulePkgMap); </BUG> mergeCandidatePackages(module, req, cap, modulePkgMap, candidateMap); } for (int i = 0; i < caps.size(); i++)
calculateExportedPackages(cap.getModule(), candidateMap, modulePkgMap);
15,534
mergeCandidatePackage( current, false, currentReq, candCap, modulePkgMap); } else if (candCap.getNamespace().equals(Capability.MODULE_NAMESPACE)) { <BUG>calculateExportedPackages(candCap.getModule(), modulePkgMap); Packages candPkgs = modulePkgMap.get(candCap.getModule());</BUG> for (Entry<String, Blame> entry : candPkgs.m_exportedPkgs.entrySet()) { mergeCandidatePackage(
calculateExportedPackages( candCap.getModule(), candidateMap, modulePkgMap); Packages candPkgs = modulePkgMap.get(candCap.getModule());
15,535
return size()+offset; } public PlaLineInt[] to_array() { return a_list.toArray(new PlaLineInt[size()]); <BUG>} @Override</BUG> public Iterator<PlaLineInt> iterator() { return a_list.iterator();
public ArrayList<PlaLineInt>to_alist() return a_list; @Override
15,536
while (Math.abs(prev_dist) < c_epsilon) { ++corners_skipped_before; int curr_no = p_start_no - corners_skipped_before; if (curr_no < 0) return null; <BUG>prev_corner = p_line_arr[curr_no].intersection_approx(p_line_arr[curr_no + 1]); </BUG> prev_dist = translate_line.distance_signed(prev_corner); } double next_dist = translate_line.distance_signed(next_corner);
prev_corner = p_line_arr.get(curr_no).intersection_approx(p_line_arr.get(curr_no + 1));
15,537
</BUG> { return null; } <BUG>next_corner = p_line_arr[curr_no].intersection_approx(p_line_arr[curr_no + 1]); </BUG> next_dist = translate_line.distance_signed(next_corner); } if (Signum.of(prev_dist) != Signum.of(next_dist)) {
double next_dist = translate_line.distance_signed(next_corner); while (Math.abs(next_dist) < c_epsilon) ++corners_skipped_after; int curr_no = p_start_no + 3 + corners_skipped_after; if (curr_no >= p_line_arr.size() - 2) next_corner = p_line_arr.get(curr_no).intersection_approx(p_line_arr.get(curr_no + 1));
15,538
check_ok = r_board.check_trace(shape_to_check, curr_layer, curr_net_no_arr, curr_cl_type, contact_pins); } delta_dist /= 2; if (check_ok) { <BUG>result = curr_lines[p_start_no + 2]; </BUG> if (translate_dist == max_translate_dist) break; translate_dist += delta_dist; }
result = curr_lines.get(p_start_no + 2);
15,539
translate_dist -= shorten_value; delta_dist -= shorten_value; } } if (result == null) return null; <BUG>PlaPointFloat new_prev_corner = curr_lines[p_start_no].intersection_approx(curr_lines[p_start_no + 1]); PlaPointFloat new_next_corner = curr_lines[p_start_no + 3].intersection_approx(curr_lines[p_start_no + 4]); </BUG> r_board.changed_area.join(new_prev_corner, curr_layer);
PlaPointFloat new_prev_corner = curr_lines.get(p_start_no).intersection_approx(curr_lines.get(p_start_no + 1)); PlaPointFloat new_next_corner = curr_lines.get(p_start_no + 3).intersection_approx(curr_lines.get(p_start_no + 4));
15,540
import org.apache.commons.lang3.math.NumberUtils; import org.json.JSONException; import org.mariotaku.microblog.library.MicroBlog; import org.mariotaku.microblog.library.MicroBlogException; import org.mariotaku.microblog.library.twitter.model.RateLimitStatus; <BUG>import org.mariotaku.microblog.library.twitter.model.Status; 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;
15,541
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());
15,542
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);
15,543
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);
15,544
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);
15,545
import org.mariotaku.twidere.receiver.NotificationReceiver; import org.mariotaku.twidere.service.LengthyOperationsService; import org.mariotaku.twidere.util.ActivityTracker; import org.mariotaku.twidere.util.AsyncTwitterWrapper; import org.mariotaku.twidere.util.DataStoreFunctionsKt; <BUG>import org.mariotaku.twidere.util.DataStoreUtils; import org.mariotaku.twidere.util.ImagePreloader;</BUG> import org.mariotaku.twidere.util.InternalTwitterContentUtils; import org.mariotaku.twidere.util.JsonSerializer; import org.mariotaku.twidere.util.NotificationManagerWrapper;
import org.mariotaku.twidere.util.DebugLog; import org.mariotaku.twidere.util.ImagePreloader;
15,546
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);
15,547
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);
15,548
import android.content.Context; import android.content.SharedPreferences; import android.location.Location; import android.os.AsyncTask; import android.support.annotation.NonNull; <BUG>import android.util.Log; import org.mariotaku.twidere.BuildConfig; import org.mariotaku.twidere.Constants; import org.mariotaku.twidere.util.JsonSerializer;</BUG> import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.util.DebugLog; import org.mariotaku.twidere.util.JsonSerializer;
15,549
} public static LatLng getCachedLatLng(@NonNull final Context context) { final Context appContext = context.getApplicationContext(); final SharedPreferences prefs = DependencyHolder.Companion.get(context).getPreferences(); if (!prefs.getBoolean(KEY_USAGE_STATISTICS, false)) return null; <BUG>if (BuildConfig.DEBUG) { Log.d(HotMobiLogger.LOGTAG, "getting cached location"); }</BUG> final Location location = Utils.getCachedLocation(appContext);
DebugLog.d(HotMobiLogger.LOGTAG, "getting cached location", null);
15,550
public int destroySavedSearchAsync(final UserKey accountKey, final long searchId) { final DestroySavedSearchTask task = new DestroySavedSearchTask(accountKey, searchId); return asyncTaskManager.add(task, true); } public int destroyStatusAsync(final UserKey accountKey, final String statusId) { <BUG>final DestroyStatusTask task = new DestroyStatusTask(context,accountKey, statusId); </BUG> return asyncTaskManager.add(task, true); } public int destroyUserListAsync(final UserKey accountKey, final String listId) {
final DestroyStatusTask task = new DestroyStatusTask(context, accountKey, statusId);
15,551
@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);
15,552
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);
15,553
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
15,554
final int lineStride = dst.getScanlineStride(); final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final byte[][] data = dst.getByteDataArrays(); final float[] warpData = new float[2 * dstWidth]; <BUG>int lineOffset = 0; if (ctable == null) { // source does not have IndexColorModel if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset;
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
15,555
pixelOffset += pixelStride; } // COLS LOOP } // ROWS LOOP } } else {// source has IndexColorModel <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
} else if (caseB) { for (int h = 0; h < dstHeight; h++) {
15,556
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
15,557
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
15,558
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
15,559
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final short[][] data = dst.getShortDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
15,560
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
15,561
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final int[][] data = dst.getIntDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
15,562
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
15,563
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final float[][] data = dst.getFloatDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
15,564
minX = src.getMinX(); maxX = src.getMaxX(); minY = src.getMinY(); maxY = src.getMaxY(); } else { <BUG>iterSource = RandomIterFactory.create(src, src.getBounds(), TILE_CACHED, ARRAY_CALC); minX = src.getMinX() + 1; // Left padding maxX = src.getMaxX() - 2; // Right padding minY = src.getMinY() + 1; // Top padding maxY = src.getMaxY() - 2; // Bottom padding </BUG> }
iterSource = getRandomIterator(src, null); minX = src.getMinX() + leftPad; // Left padding maxX = src.getMaxX() - rightPad; // Right padding minY = src.getMinY() + topPad; // Top padding maxY = src.getMaxY() - bottomPad; // Bottom padding
15,565
final int pixelStride = dst.getPixelStride(); final int[] bandOffsets = dst.getBandOffsets(); final double[][] data = dst.getDoubleDataArrays(); final float[] warpData = new float[2 * dstWidth]; int lineOffset = 0; <BUG>if (caseA) { for (int h = 0; h < dstHeight; h++) {</BUG> int pixelOffset = lineOffset; lineOffset += lineStride; warp.warpRect(dst.getX(), dst.getY() + h, dstWidth, 1, warpData);
if(hasROI && !roiContainsTile && roiIter == null){ throw new IllegalArgumentException("Error on creating the ROI iterator"); } if (caseA || (caseB && roiContainsTile)) { for (int h = 0; h < dstHeight; h++) {
15,566
.setName(fields.get("name")) .setEmail(fields.get("email")) .build()); } } <BUG>public byte[] createDatabaseForPreview(@Nullable Long projectId) { return get(PreviewCache.class).getDatabaseForPreview(projectId); </BUG> } public String getPeriodLabel(int periodIndex) {
public String pathToPreviewDbFile(@Nullable Long projectId) { return get(PreviewCache.class).getPathToDatabaseFile(projectId);
15,567
this.serverFileSystem = serverFileSystem; this.propertiesDao = propertiesDao; this.resourceDao = resourceDao; this.previewDatabaseFactory = previewDatabaseFactory; } <BUG>public byte[] getDatabaseForPreview(@Nullable Long projectId) { </BUG> long notNullProjectId = projectId != null ? projectId.longValue() : 0L; ReadWriteLock rwl = getLock(notNullProjectId); try {
public String getPathToDatabaseFile(@Nullable Long projectId) {
15,568
File cacheLocation = getCacheLocation(projectId); FileUtils.deleteQuietly(cacheLocation); File dbFile = previewDatabaseFactory.createNewDatabaseForDryRun(projectId, cacheLocation, String.valueOf(newTimestamp)); LOG.debug("Cached DB at {}", dbFile); lastTimestampPerProject.put(notNullProjectId, newTimestamp); <BUG>} private byte[] fileToByte(File dbFile) { try { return Files.toByteArray(dbFile); } catch (IOException e) { throw new SonarException("Unable to create h2 database file", e); }</BUG> }
[DELETED]
15,569
FileUtils.write(dbFile, "fake db content"); return dbFile; } }); when(resourceDao.getRootProjectByComponentId(123L)).thenReturn(new ResourceDto().setId(123L)); <BUG>byte[] dbContent = dryRunCache.getDatabaseForPreview(123L); assertThat(new String(dbContent)).isEqualTo("fake db content"); dbContent = dryRunCache.getDatabaseForPreview(123L); assertThat(new String(dbContent)).isEqualTo("fake db content"); verify(dryRunDatabaseFactory, times(1)).createNewDatabaseForDryRun(anyLong(), any(File.class), anyString());</BUG> }
String path = dryRunCache.getPathToDatabaseFile(null); assertThat(FileUtils.readFileToString(new File(path))).isEqualTo("fake db content"); path = dryRunCache.getPathToDatabaseFile(null); assertThat(FileUtils.readFileToString(new File(path))).isEqualTo("fake db content"); verify(dryRunDatabaseFactory, times(1)).createNewDatabaseForDryRun(anyLong(), any(File.class), anyString());
15,570
import org.sonar.plugins.javascript.api.visitors.IssueLocation; import org.sonar.plugins.javascript.api.visitors.LineIssue; import org.sonar.plugins.javascript.api.visitors.PreciseIssue; import org.sonar.plugins.javascript.api.visitors.TreeVisitor; import org.sonar.plugins.javascript.api.visitors.TreeVisitorContext; <BUG>import org.sonar.plugins.javascript.lcov.ITCoverageSensor; import org.sonar.plugins.javascript.lcov.OverallCoverageSensor;</BUG> import org.sonar.plugins.javascript.lcov.UTCoverageSensor; import org.sonar.plugins.javascript.minify.MinificationAssessor; import org.sonar.squidbridge.ProgressReport;
import org.sonar.plugins.javascript.lcov.LCOVCoverageSensor; import org.sonar.plugins.javascript.lcov.OverallCoverageSensor;
15,571
List<TreeVisitor> treeVisitors = Lists.newArrayList(); boolean isAtLeastSq62 = context.getSonarQubeVersion().isGreaterThanOrEqual(V6_2); MetricsVisitor metricsVisitor = new MetricsVisitor( context, noSonarFilter, <BUG>settings.getBoolean(JavaScriptPlugin.IGNORE_HEADER_COMMENTS), </BUG> fileLinesContextFactory, isAtLeastSq62); treeVisitors.add(metricsVisitor);
context.settings().getBoolean(JavaScriptPlugin.IGNORE_HEADER_COMMENTS),
15,572
assertThat(context.getExtensions()).hasSize(13); } @Test public void count_extensions_for_sonarqube_server_6_2() throws Exception { Plugin.Context context = setupContext(SonarRuntimeImpl.forSonarQube(Version.create(6, 2), SonarQubeSide.SERVER)); <BUG>assertThat(context.getExtensions()).hasSize(12); </BUG> } @Test public void count_extensions_for_sonarlint() throws Exception {
public void count_extensions_for_sonarqube_server_6_0() throws Exception { Plugin.Context context = setupContext(SonarRuntimeImpl.forSonarQube(Version.create(6, 0), SonarQubeSide.SERVER));
15,573
private static final String GENERAL = "General"; private static final String TEST_AND_COVERAGE = "Tests and Coverage"; private static final String LIBRARIES = "Libraries"; public static final String FILE_SUFFIXES_KEY = "sonar.javascript.file.suffixes"; public static final String FILE_SUFFIXES_DEFVALUE = ".js"; <BUG>public static final String PROPERTY_PREFIX = "sonar.javascript"; public static final String LCOV_UT_REPORT_PATH = PROPERTY_PREFIX + ".lcov.reportPath";</BUG> public static final String LCOV_UT_REPORT_PATH_DEFAULT_VALUE = ""; public static final String LCOV_IT_REPORT_PATH = PROPERTY_PREFIX + ".lcov.itReportPath"; public static final String LCOV_IT_REPORT_PATH_DEFAULT_VALUE = "";
public static final String LCOV_REPORT_PATHS = PROPERTY_PREFIX + ".lcov.reportPaths"; public static final String LCOV_REPORT_PATHS_DEFAULT_VALUE = ""; public static final String LCOV_UT_REPORT_PATH = PROPERTY_PREFIX + ".lcov.reportPath";
15,574
if (!context.getSonarQubeVersion().isGreaterThanOrEqual(V6_0) || context.getRuntime().getProduct() != SonarProduct.SONARLINT) { context.addExtensions( UTCoverageSensor.class, ITCoverageSensor.class, OverallCoverageSensor.class); <BUG>} context.addExtensions(</BUG> PropertyDefinition.builder(FILE_SUFFIXES_KEY) .defaultValue(FILE_SUFFIXES_DEFVALUE) .name("File Suffixes")
boolean isAtLeastSq62 = context.getSonarQubeVersion().isGreaterThanOrEqual(V6_2); String reportPropertyDeprecationMessage = isAtLeastSq62 ? "DEPRECATED: use sonar.javascript.lcov.reportPaths. " : "";
15,575
.type(PropertyType.BOOLEAN) .build(), PropertyDefinition.builder(LCOV_UT_REPORT_PATH) .defaultValue(LCOV_UT_REPORT_PATH_DEFAULT_VALUE) .name("Unit Tests LCOV File") <BUG>.description("Path (absolute or relative) to the file with LCOV data for unit tests.") </BUG> .onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT) .subCategory(TEST_AND_COVERAGE) .build(),
.description(reportPropertyDeprecationMessage + "Path (absolute or relative) to the file with LCOV data for unit tests.")
15,576
.subCategory(TEST_AND_COVERAGE) .build(), PropertyDefinition.builder(LCOV_IT_REPORT_PATH) .defaultValue(LCOV_IT_REPORT_PATH_DEFAULT_VALUE) .name("Integration Tests LCOV File") <BUG>.description("Path (absolute or relative) to the file with LCOV data for integration tests.") </BUG> .onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT) .subCategory(TEST_AND_COVERAGE) .build(),
.description(reportPropertyDeprecationMessage + "Path (absolute or relative) to the file with LCOV data for integration tests.")
15,577
assertThat(getProjectMeasure("overall_uncovered_lines")).isNull(); assertThat(getProjectMeasure("overall_conditions_to_cover")).isNull(); assertThat(getProjectMeasure("overall_uncovered_conditions")).isNull(); } } <BUG>@Test public void force_zero_coverage() {</BUG> SonarScanner build = Tests.createScanner() .setProjectDir(TestUtils.projectDir("lcov")) .setProjectKey(Tests.PROJECT_KEY)
public void LCOV_report_paths() {
15,578
package org.sonar.plugins.javascript.lcov; <BUG>import java.io.File; import java.util.LinkedList;</BUG> import java.util.List; import java.util.Map; import java.util.Set;
import com.google.common.annotations.VisibleForTesting; import java.util.ArrayList; import java.util.LinkedList;
15,579
fileSystem.predicates().hasType(InputFile.Type.MAIN), fileSystem.predicates().hasLanguage(JavaScriptLanguage.KEY)); } public void execute(SensorContext context, Map<InputFile, Set<Integer>> linesOfCode, boolean isAtLeastSq62) { this.isAtLeastSq62 = isAtLeastSq62; <BUG>if (isLCOVReportProvided(context)) { saveMeasureFromLCOVFile(context, linesOfCode); </BUG> } else if (!isAtLeastSq62 && isForceZeroCoverageActivated(context)) { saveZeroValueForAllFiles(context, linesOfCode);
List<String> reportPaths = parseReportsProperty(context); if (!reportPaths.isEmpty()) { saveMeasureFromLCOVFile(context, linesOfCode, reportPaths);
15,580
public void execute(MinecraftServer server, ICommandSender ics, String[] args) throws CommandException { EntityPlayerMP ep = getCommandSenderAsPlayer(ics); IForgePlayer p = getForgePlayer(ep); FTBUPlayerData data = FTBUPlayerData.get(p); <BUG>if(data != null) { if(data.lastDeath == null) </BUG> {
if(data == null) return; } else if(data.lastDeath == null)
15,581
{ data.lastDeath = null; } } } <BUG>}</BUG>
return "back"; @Override public int getRequiredPermissionLevel()
15,582
LoadedChunkStorage.INSTANCE.checkAll(); } @SubscribeEvent public void onDeath(ForgePlayerDeathEvent event) { <BUG>FTBUPlayerData data = FTBUPlayerData.get(event.getPlayer()); data.lastDeath = new EntityDimPos(event.getPlayer().getPlayer()).toBlockDimPos(); } @SubscribeEvent</BUG> public void getSettings(ForgePlayerSettingsEvent event)
Map<UUID, Integer> map = new HashMap<>(1); int flags = FTBUPlayerData.get(event.getPlayer()).getClientFlags(); map.put(ep.getGameProfile().getId(), flags); new MessageSendFTBUClientFlags(map).sendTo(null); map.clear(); for(EntityPlayerMP ep1 : LMServerUtils.getServer().getPlayerList().getPlayerList())
15,583
data.lastDeath = new EntityDimPos(event.getPlayer().getPlayer()).toBlockDimPos(); } @SubscribeEvent</BUG> public void getSettings(ForgePlayerSettingsEvent event) { <BUG>FTBUPlayerData data = FTBUPlayerData.get(event.getPlayer()); data.addConfig(event.getSettings()); }</BUG> @SubscribeEvent public void addInfo(ForgePlayerInfoEvent event)
if(data != null)
15,584
IForgePlayer player = FTBLibIntegration.API.getUniverse().getPlayer(ep); if(player == null || !player.isOnline()) { return; } <BUG>FTBUPlayerData data = FTBUPlayerData.get(player); data.lastSafePos = new EntityDimPos(ep).toBlockDimPos(); updateChunkMessage(ep, new ChunkDimPos(e.getNewChunkX(), e.getNewChunkZ(), ep.dimension));</BUG> } public static void updateChunkMessage(EntityPlayerMP player, ChunkDimPos pos)
if(data != null) updateChunkMessage(ep, new ChunkDimPos(e.getNewChunkX(), e.getNewChunkZ(), ep.dimension));
15,585
} @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { checkArgs(args, 1, "<player>"); <BUG>FTBUPlayerData d = FTBUPlayerData.get(getForgePlayer(args[0])); sender.addChatMessage(new TextComponentString(LMStringUtils.strip(d.listHomes()))); </BUG> }
public boolean isUsernameIndex(String[] args, int i) return i == 0;
15,586
.withRel("orderedItem")); } return offers; } private Offer createOffer(String productName, double val, Offer... addOns) { <BUG>Product product = new Product(productName); product.setProductID(String.valueOf(productCounter++)); </BUG> Offer offer = new Offer(); offer.setItemOffered(product);
Product product = new Product(productName, String.valueOf(productCounter++));
15,587
package de.escalon.hypermedia.spring.hydra; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; <BUG>import com.fasterxml.jackson.databind.ser.std.StdSerializer; import de.escalon.hypermedia.DataType; </BUG> import de.escalon.hypermedia.PropertyUtils; import de.escalon.hypermedia.action.Cardinality;
import de.escalon.hypermedia.action.Input; import de.escalon.hypermedia.affordance.AnnotatedParameter; import de.escalon.hypermedia.affordance.DataType;
15,588
import de.escalon.hypermedia.hydra.mapping.Expose; import de.escalon.hypermedia.hydra.serialize.JacksonHydraSerializer; import de.escalon.hypermedia.hydra.serialize.JsonLdKeywords; import de.escalon.hypermedia.hydra.serialize.LdContext; import de.escalon.hypermedia.hydra.serialize.LdContextFactory; <BUG>import de.escalon.hypermedia.spring.Affordance; import de.escalon.hypermedia.action.ActionDescriptor; import de.escalon.hypermedia.action.ActionInputParameter; </BUG> import org.apache.commons.lang3.StringUtils;
import de.escalon.hypermedia.affordance.Affordance; import de.escalon.hypermedia.affordance.ActionDescriptor; import de.escalon.hypermedia.spring.ActionInputParameter;
15,589
jgen.writeStartObject(); // begin a hydra:Operation final String semanticActionType = actionDescriptor.getSemanticActionType(); if (semanticActionType != null) { jgen.writeStringField("@type", semanticActionType); } <BUG>jgen.writeStringField("hydra:method", actionDescriptor.getHttpMethod() .name());</BUG> final ActionInputParameter requestBodyInputParameter = actionDescriptor.getRequestBody(); if (requestBodyInputParameter != null) {
jgen.writeStringField("hydra:method", actionDescriptor.getHttpMethod());
15,590
Object propertyValue = PropertyUtils.getPropertyValue(currentCallValue, propertyDescriptor); MethodParameter methodParameter = new MethodParameter(propertyDescriptor.getWriteMethod(), 0); ActionInputParameter propertySetterInputParameter = new ActionInputParameter( methodParameter, propertyValue); final Object[] possiblePropertyValues = <BUG>actionInputParameter.getPossibleValues(methodParameter, actionDescriptor); </BUG> writeSupportedProperty(jgen, currentVocab, propertySetterInputParameter, propertyName, property, possiblePropertyValues); } else {
actionInputParameter.getPossibleValues(propertyDescriptor.getWriteMethod(), 0, actionDescriptor);
15,591
return ret; } private void writeSupportedProperty(JsonGenerator jgen, String currentVocab, ActionInputParameter actionInputParameter, String propertyName, Property property, <BUG>Object[] possiblePropertyValues) throws IOException { jgen.writeStartObject();</BUG> if (actionInputParameter.hasCallValue() || actionInputParameter.hasInputConstraints()) { jgen.writeStringField(JsonLdKeywords.AT_TYPE, getPropertyOrClassNameInVocab(currentVocab, "PropertyValueSpecification", LdContextFactory.HTTP_SCHEMA_ORG, "schema:"));
@SuppressWarnings("unused") Object[] possiblePropertyValues) jgen.writeStartObject();
15,592
jgen.writeStringField("hydra:property", propertyName); writePossiblePropertyValues(jgen, currentVocab, actionInputParameter, possiblePropertyValues); jgen.writeEndObject(); } private void writePossiblePropertyValues(JsonGenerator jgen, String currentVocab, ActionInputParameter <BUG>actionInputParameter, Object[] possiblePropertyValues) throws IOException { </BUG> if (actionInputParameter.isArrayOrCollection()) { jgen.writeBooleanField(getPropertyOrClassNameInVocab(currentVocab, "multipleValues", LdContextFactory.HTTP_SCHEMA_ORG, "schema:"), true);
actionInputParameter, @SuppressWarnings("unused") Object[] possiblePropertyValues) throws IOException {
15,593
writeScalarValue(jgen, actionInputParameter.getCallValue(), actionInputParameter .getParameterType()); } } if (!inputConstraints.isEmpty()) { <BUG>final List<String> keysToAppendValue = Arrays.asList(ActionInputParameter.MAX, ActionInputParameter.MIN, ActionInputParameter.STEP); for (String keyToAppendValue : keysToAppendValue) {</BUG> final Object constraint = inputConstraints.get(keyToAppendValue); if (constraint != null) {
final List<String> keysToAppendValue = Arrays.asList(Input.MAX, Input.MIN, Input.STEP); for (String keyToAppendValue : keysToAppendValue) {
15,594
final Object constraint = inputConstraints.get(keyToPrependValue); if (constraint != null) { jgen.writeFieldName(getPropertyOrClassNameInVocab(currentVocab, "value" + StringUtils.capitalize (keyToPrependValue), LdContextFactory.HTTP_SCHEMA_ORG, "schema:")); <BUG>if (ActionInputParameter.PATTERN.equals(keyToPrependValue)) { jgen.writeString(constraint.toString());</BUG> } else { jgen.writeNumber(constraint .toString());
if (Input.PATTERN.equals(keyToPrependValue)) { jgen.writeString(constraint.toString());
15,595
package de.escalon.hypermedia.sample.store; import de.escalon.hypermedia.action.Cardinality; <BUG>import de.escalon.hypermedia.action.Resource; </BUG> import de.escalon.hypermedia.sample.beans.store.Order; import de.escalon.hypermedia.sample.beans.store.Product; import de.escalon.hypermedia.spring.AffordanceBuilder;
import de.escalon.hypermedia.action.ResourceHandler;
15,596
public class OrderController { @Autowired private OrderBackend orderBackend; @Autowired private OrderAssembler orderAssembler; <BUG>@Resource(Cardinality.COLLECTION) </BUG> @RequestMapping(method = RequestMethod.POST) public ResponseEntity<Void> makeOrder(@RequestBody Product product) { OrderModel orderModel = orderBackend.createOrder();
@ResourceHandler(Cardinality.COLLECTION)
15,597
</BUG> @RequestMapping(method = RequestMethod.POST) public ResponseEntity<Void> makeOrder(@RequestBody Product product) { OrderModel orderModel = orderBackend.createOrder(); orderModel = orderBackend.addOrderedItem(orderModel.getId(), <BUG>new ProductModel(product.name, product.getProductID())); </BUG> AffordanceBuilder location = linkTo(methodOn(this.getClass()).getOrder(orderModel.getId())); HttpHeaders headers = new HttpHeaders(); headers.setLocation(location.toUri());
public class OrderController { @Autowired private OrderBackend orderBackend; @Autowired private OrderAssembler orderAssembler; @ResourceHandler(Cardinality.COLLECTION) new ProductModel(product.name, product.productID));
15,598
@Controller public class PaymentController { public ResponseEntity<Void> makePayment(int id) { HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setLocation(linkTo(AffordanceBuilder.methodOn(this.getClass()).getPayment()).toUri()); <BUG>return new ResponseEntity(httpHeaders, HttpStatus.CREATED); </BUG> } public Payment getPayment() { return null;
return new ResponseEntity<Void>(httpHeaders, HttpStatus.CREATED);
15,599
package de.escalon.hypermedia.spring.hydra; <BUG>import de.escalon.hypermedia.AnnotatedParameter; </BUG> import de.escalon.hypermedia.AnnotationUtils; import de.escalon.hypermedia.hydra.mapping.Expose; import de.escalon.hypermedia.hydra.serialize.LdContextFactory;
import de.escalon.hypermedia.affordance.AnnotatedParameter;
15,600
while ( stream.readShort() == PersisterEnums.WORK_ITEM ) { WorkItem workItem = readWorkItem( context ); ((WorkItemManager) wm.getWorkItemManager()).internalAddWorkItem( workItem ); } } <BUG>public static WorkItem readWorkItem(MarshallerReaderContext context) throws IOException { ObjectInputStream stream = context.stream;</BUG> WorkItemImpl workItem = new WorkItemImpl(); workItem.setId( stream.readLong() ); workItem.setProcessInstanceId( stream.readLong() );
return readWorkItem(context, true); public static WorkItem readWorkItem(MarshallerReaderContext context, boolean includeVariables) throws IOException { ObjectInputStream stream = context.stream;