id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
46,601
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics); mCameraPoseTimestamp = lastFramePose.timestamp;</BUG> } else { <BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); }</BUG> } } } @Override
mRenderer.updateRenderCameraPose(lastFramePose); mCameraPoseTimestamp = lastFramePose.timestamp; Log.w(TAG, "Can't get device pose at time: " +
46,602
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
46,603
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
46,604
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
46,605
SyncUtil.checkSyncEnabled(repositoryId); repositoryService.checkRepository(repositoryId); List<SyncDLObject> syncDLObjects = syncDLObjectPersistence.findByC_R_T( companyId, repositoryId, SyncConstants.TYPE_FOLDER); <BUG>return checkSyncDLObjects(syncDLObjects); }</BUG> catch (PortalException pe) { throw new PortalException(SyncUtil.buildExceptionMessage(pe), pe); }
SyncDLObjectUpdate syncDLObjectUpdate = checkSyncDLObjects( return syncDLObjectUpdate.getSyncDLObjects();
46,606
PortletPropsValues.SYNC_PAGINATION_DELTA, new SyncDLObjectTypeComparator()); if (syncDLObjects.isEmpty()) { return new SyncDLObjectUpdate(syncDLObjects, lastAccessTime); } <BUG>SyncDLObject syncDLObject = syncDLObjects.get( syncDLObjects.size() - 1); syncDLObjects = checkSyncDLObjects(syncDLObjects); return new SyncDLObjectUpdate( syncDLObjects, syncDLObject.getModifiedTime());</BUG> }
return checkSyncDLObjects(syncDLObjects);
46,607
} DLSyncEvent dlSyncEvent = dlSyncEvents.get(0); syncDLObject.setModifiedTime(dlSyncEvent.getModifiedTime()); return syncDLObject; } <BUG>protected List<SyncDLObject> checkSyncDLObjects( </BUG> List<SyncDLObject> syncDLObjects) throws PortalException { PermissionChecker permissionChecker = getPermissionChecker();
else { events = new String[0];
46,608
List<SyncDLObject> syncDLObjects) throws PortalException { PermissionChecker permissionChecker = getPermissionChecker(); <BUG>List<SyncDLObject> checkedSyncDLObjects = new ArrayList<>(); for (SyncDLObject syncDLObject : syncDLObjects) { String event = syncDLObject.getEvent();</BUG> if (event.equals(SyncConstants.EVENT_DELETE)) { continue; } String type = syncDLObject.getType();
long lastAccessTime = 0; if (syncDLObject.getModifiedTime() > lastAccessTime) { lastAccessTime = syncDLObject.getModifiedTime(); String event = syncDLObject.getEvent();
46,609
long parentFolderId, long lastAccessTime) throws PortalException { List<SyncDLObject> curSyncDLObjects = syncDLObjectPersistence.findByC_M_R_P( companyId, lastAccessTime, repositoryId, parentFolderId); <BUG>curSyncDLObjects = checkSyncDLObjects(curSyncDLObjects); syncDLObjects.addAll(curSyncDLObjects);</BUG> for (SyncDLObject curSyncDLObject : curSyncDLObjects) { String type = curSyncDLObject.getType(); if (!type.equals(SyncConstants.TYPE_FOLDER)) {
SyncDLObjectUpdate syncDLObjectUpdate = checkSyncDLObjects( curSyncDLObjects = syncDLObjectUpdate.getSyncDLObjects(); syncDLObjects.addAll(curSyncDLObjects);
46,610
package com.liferay.sync.util.comparator; import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.sync.model.SyncDLObject; public class SyncDLObjectTypeComparator extends OrderByComparator<SyncDLObject> { <BUG>public static final String ORDER_BY_ASC = "SyncDLObject.type_ ASC, SyncDLObject.modifiedTime ASC"; public static final String ORDER_BY_DESC = "SyncDLObject.type_ DESC, SyncDLObject.modifiedTime ASC"; public static final String[] ORDER_BY_FIELDS = {"type", "modifiedTime"}; public SyncDLObjectTypeComparator() {</BUG> this(false);
public static final String ORDER_BY_ASC = "SyncDLObject.type_ ASC"; public static final String ORDER_BY_DESC = "SyncDLObject.type_ DESC"; public static final String[] ORDER_BY_FIELDS = {"type"}; public SyncDLObjectTypeComparator() {
46,611
} @Override public boolean isAscending() { return _ascending; } <BUG>@Override public boolean isAscending(String field) { if (field.equals("type")) { return isAscending(); } else { return true; } }</BUG> private boolean _ascending;
public SyncDLObjectTypeComparator(boolean ascending) { _ascending = ascending; public int compare(SyncDLObject syncDLObject1, SyncDLObject syncDLObject2) { String type1 = syncDLObject1.getType(); String type2 = syncDLObject2.getType(); int value = type1.compareTo(type2); if (_ascending) { return value;
46,612
mTempGlobalRect[1] - mHost.getScrollY()); mTempScreenRect.intersect(mTempVisibleRect);</BUG> node.setBoundsInScreen(mTempScreenRect); <BUG>if (isVisibleToUser(mTempScreenRect)) { node.setVisibleToUser(true); }</BUG> } return node; } boolean performAction(int virtualViewId, int action, Bundle arguments) {
[DELETED]
46,613
return clearKeyboardFocusForVirtualView(virtualViewId); default: return onPerformActionForVirtualView(virtualViewId, action, arguments); } } <BUG>private boolean isVisibleToUser(Rect localRect) { </BUG> if ((localRect == null) || localRect.isEmpty()) { return false; }
private boolean intersectVisibleToUser(Rect localRect) {
46,614
IMPL = new AccessibilityNodeInfoStubImpl(); } } static final AccessibilityNodeInfoImpl IMPL; private final Object mInfo; <BUG>@RestrictTo(LIBRARY_GROUP) public int mParentVirtualDescendantId = -1;</BUG> public static final int ACTION_FOCUS = 0x00000001; public static final int ACTION_CLEAR_FOCUS = 0x00000002; public static final int ACTION_SELECT = 0x00000004;
[DELETED]
46,615
CustomView.CustomItem itemB = customView.addItem(getString(R.string.sample_item_b), 0.5f, 0.5f, 1, 1); CustomView.CustomItem itemC = customView.addItem(getString(R.string.sample_item_c), 0, 0.75f, 1, 1); customView.setParentItem(itemC, itemB); <BUG>CustomView.CustomItem itemD = customView.addItem(getString(R.string.sample_item_d), 0, 0f, 0.25f, 1); customView.setParentItem(itemD, itemC); customView.layoutItems();</BUG> }
[DELETED]
46,616
item.mBoundsInRoot.set(parent.mBounds.left + bounds.left * parent.mBounds.width(), </BUG> parent.mBounds.top + bounds.top * parent.mBounds.height(), parent.mBounds.left + bounds.right * parent.mBounds.width(), parent.mBounds.top + bounds.bottom * parent.mBounds.height()); <BUG>parent = parent.mParent; }</BUG> } @Override protected void onDraw(Canvas canvas) {
return item; public void setParentItem(CustomItem item, CustomItem parent) { item.mParent = parent; parent.mChildren.add(item.mId); RectF bounds = item.mBounds; item.mBounds = new RectF(parent.mBounds.left + bounds.left * parent.mBounds.width(),
46,617
paint.setColor(item.mChecked ? Color.RED : Color.BLUE); } else { paint.setColor(item.mChecked ? Color.MAGENTA : Color.GREEN); } paint.setStyle(Style.FILL); <BUG>scaleRectF(item.mBoundsInRoot, bounds, width, height); canvas.drawRect(bounds, paint);</BUG> paint.setColor(Color.WHITE); paint.setTextAlign(Align.CENTER); canvas.drawText(item.mDescription, bounds.centerX(), bounds.centerY(), paint);
scaleRectF(item.mBounds, bounds, width, height); canvas.drawRect(bounds, paint);
46,618
final float scaledX = (x / getWidth()); final float scaledY = (y / getHeight()); final int n = mItems.size(); for (int i = n - 1; i >= 0; i--) { final CustomItem item = mItems.get(i); <BUG>if (item.mBoundsInRoot.contains(scaledX, scaledY)) { return i;</BUG> } } return NO_ITEM;
if (item.mBounds.contains(scaledX, scaledY)) { return i;
46,619
this.queryLogger = Loggers.getLogger(logger, ".query"); this.fetchLogger = Loggers.getLogger(logger, ".fetch"); queryLogger.setLevel(level); fetchLogger.setLevel(level); indexSettingsService.addListener(new ApplySettings()); <BUG>} private long parseTimeSetting(String name, long defaultNanos) { try { return componentSettings.getAsTime(name, TimeValue.timeValueNanos(defaultNanos)).nanos(); } catch (ElasticSearchParseException e) { logger.error("Could not parse setting for [{}], disabling", name); return -1; }</BUG> }
[DELETED]
46,620
}); } } private void addWeldIntegration(final ServiceTarget target, final ComponentConfiguration configuration, final ComponentDescription description, final Class<?> componentClass, final String beanName, final ServiceName weldServiceName, final Set<Class<?>> interceptorClasses, final ClassLoader classLoader, final String beanDeploymentArchiveId) { final ServiceName serviceName = configuration.getComponentDescription().getServiceName().append("WeldInstantiator"); <BUG>final WeldManagedReferenceFactory factory = new WeldManagedReferenceFactory(componentClass, beanName, interceptorClasses, classLoader, beanDeploymentArchiveId); </BUG> ServiceBuilder<WeldManagedReferenceFactory> builder = target.addService(serviceName, factory) .addDependency(weldServiceName, WeldContainer.class, factory.getWeldContainer()); configuration.setInstanceFactory(factory);
final WeldManagedReferenceFactory factory = new WeldManagedReferenceFactory(componentClass, beanName, interceptorClasses, classLoader, beanDeploymentArchiveId, description.isCDIInterceptorEnabled());
46,621
package org.jboss.as.ee.component; <BUG>import static org.jboss.as.ee.EeLogger.SERVER_DEPLOYMENT_LOGGER; import static org.jboss.as.ee.EeMessages.MESSAGES; import static org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX;</BUG> import java.io.Serializable; import java.lang.reflect.Constructor;
[DELETED]
46,622
import org.jboss.modules.ModuleLoader; import org.jboss.msc.service.ServiceBuilder; import org.jboss.msc.service.ServiceName; import org.jboss.msc.value.ConstructedValue; import org.jboss.msc.value.InjectedValue; <BUG>import org.jboss.msc.value.Value; public class ComponentDescription implements ResourceInjectionTarget {</BUG> private static final DefaultComponentConfigurator FIRST_CONFIGURATOR = new DefaultComponentConfigurator(); private static final AtomicInteger PROXY_ID = new AtomicInteger(0); private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
import static org.jboss.as.ee.EeLogger.SERVER_DEPLOYMENT_LOGGER; import static org.jboss.as.ee.EeMessages.MESSAGES; import static org.jboss.as.server.deployment.Attachments.REFLECTION_INDEX; public class ComponentDescription implements ResourceInjectionTarget {
46,623
System.out.println(" " + lineInfo[j]); } } } public boolean start() { <BUG>AudioFormat fmt = new AudioFormat(44100.0f, 16, 2, true, false); </BUG> try { lineIn = AudioSystem.getTargetDataLine(fmt); lineIn.open(fmt);
AudioFormat fmt = new AudioFormat(fSample, 16, 2, true, false);
46,624
} else { System.out.println("Usage: java AudioToBuffer hostname:port"); return;</BUG> } <BUG>a2b.listDevices(); System.out.println("Trying to open default AUDIO IN device...\n"); if (!a2b.start()) return; System.out.println("Now streaming audio. Press q and <enter> to quit.\n"); while (true) { a2b.tick();</BUG> try {
Thread.sleep((long)(blockSize*1000.0/fSample)); } catch (InterruptedException e){ System.out.println(e); t = System.currentTimeMillis() - t0; // current time since start if (t >= printTime) { System.out.print(nBlk + " " + nSample + " 0 " + (t/1000) + " (blk,samp,event,sec)\r"); printTime = t + 5000; // 5s between prints
46,625
this.queryLogger = Loggers.getLogger(logger, ".query"); this.fetchLogger = Loggers.getLogger(logger, ".fetch"); queryLogger.setLevel(level); fetchLogger.setLevel(level); indexSettingsService.addListener(new ApplySettings()); <BUG>} private long parseTimeSetting(String name, long defaultNanos) { try { return componentSettings.getAsTime(name, TimeValue.timeValueNanos(defaultNanos)).nanos(); } catch (ElasticSearchParseException e) { logger.error("Could not parse setting for [{}], disabling", name); return -1; }</BUG> }
[DELETED]
46,626
} catch (Exception e) { throw new SSLConfigurationException(e.getMessage(), e); } } @Override <BUG>public void CreateAndconfigureHttpConnection( HttpConfiguration clientConfiguration) throws MalformedURLException, UnknownHostException, IOException {</BUG> this.config = clientConfiguration;
public void createAndconfigureHttpConnection( HttpConfiguration clientConfiguration) throws IOException {
46,627
.openConnection(proxy); } else { this.connection = (HttpsURLConnection) url .openConnection(Proxy.NO_PROXY); } <BUG>((HttpsURLConnection)this.connection).setSSLSocketFactory(this.sslContext .getSocketFactory()); if (isDefaultSSL()) { ((HttpsURLConnection)this.connection).setHostnameVerifier(hv); </BUG> }
((HttpsURLConnection) this.connection) .setSSLSocketFactory(this.sslContext.getSocketFactory()); ((HttpsURLConnection) this.connection).setHostnameVerifier(hv);
46,628
this.connection.setDoOutput(true); this.connection.setRequestMethod("POST"); this.connection.setConnectTimeout(this.config .getConnectionTimeout()); this.connection.setReadTimeout(this.config.getReadTimeout()); <BUG>} catch (MalformedURLException me) { throw me; } catch (UnknownHostException uhe) { throw uhe;</BUG> } catch (IOException ioe) {
[DELETED]
46,629
httpConfiguration.setEndPointUrl(url); AuthenticationService auth = new AuthenticationService(); try { headers = auth.getPayPalHeaders(apiUsername, connection, accessToken, tokenSecret, httpConfiguration); <BUG>connection.CreateAndconfigureHttpConnection(httpConfiguration); </BUG> } catch (SSLConfigurationException ssl) { LoggingManager.severe(APIService.class, ssl.getMessage()); throw ssl;
connection.createAndconfigureHttpConnection(httpConfiguration);
46,630
public class BaseService { private String serviceName; private String version; protected String accessToken = null; protected String tokenSecret = null; <BUG>protected String lastRequest=null; protected String lastResponse=null; </BUG> public String getLastRequest() {
protected String lastRequest = null; protected String lastResponse = null;
46,631
} catch (IOException ioe) { LoggingManager.debug(BaseService.class, ioe.getMessage(), ioe); throw ioe; } } <BUG>public static void initConfig(File file) throws FileNotFoundException, IOException {</BUG> try { if (!file.exists()) {
public static void initConfig(File file) throws IOException {
46,632
throw new FileNotFoundException("File doesn't exist: " + file.getAbsolutePath()); } FileInputStream fis = new FileInputStream(file); initConfig(fis); <BUG>} catch (FileNotFoundException fe) { LoggingManager.debug(BaseService.class, fe.getMessage(), fe); throw fe;</BUG> } catch (IOException ioe) { LoggingManager.debug(BaseService.class, ioe.getMessage(), ioe);
[DELETED]
46,633
} catch (IOException ioe) { LoggingManager.debug(BaseService.class, ioe.getMessage(), ioe); throw ioe; } } <BUG>public static void initConfig(String filepath) throws IOException, FileNotFoundException {</BUG> try { File file = new File(filepath);
public static void initConfig(String filepath) throws IOException {
46,634
FileNotFoundException {</BUG> try { File file = new File(filepath); initConfig(file); <BUG>} catch (FileNotFoundException fe) { LoggingManager.debug(BaseService.class, fe.getMessage(), fe); throw fe;</BUG> } catch (IOException ioe) { LoggingManager.debug(BaseService.class, ioe.getMessage(), ioe);
throw ioe; } } public static void initConfig(String filepath) throws IOException {
46,635
import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Properties; import java.util.Set; <BUG>public class ConfigManager { </BUG> private static ConfigManager conf; private Enumeration<Object> em; private Properties properties;
public final class ConfigManager {
46,636
private Enumeration<Object> loadKeys() { em = properties.keys(); return em; } public String getValue(String key) { <BUG>String value = properties.getProperty(key); return value;</BUG> } public HashMap<String, String> getValuesByCategory(String category) {
return properties.getProperty(key);
46,637
import java.util.HashMap; import java.util.Map; import java.util.Set; import com.paypal.exception.InvalidCredentialException; import com.paypal.exception.MissingCredentialException; <BUG>public class CredentialManager { </BUG> private static CredentialManager instance = null; private Map<String, ICredential> credentialMap = new HashMap<String, ICredential>(); private String defaultAcctName = null;
public final class CredentialManager {
46,638
if (acctSet.size() == 0) { throw new MissingCredentialException( "No valid API accounts have been configured"); } while (suffix <= acctSet.size()) { <BUG>String userName = (String) credMap.get(prefix + suffix+ ".UserName"); String password = (String) credMap.get(prefix + suffix+ ".Password"); String appId = (String) credMap.get(prefix + suffix + ".AppId");</BUG> String subject = (String) credMap.get(prefix + suffix + ".Subject"); if (credMap.get(prefix + suffix + ".Signature") != null) {
String userName = (String) credMap.get(prefix + suffix String password = (String) credMap.get(prefix + suffix String appId = (String) credMap.get(prefix + suffix + ".AppId");
46,639
String signature = (String) credMap.get(prefix + suffix + ".Signature"); credentialMap.put(userName, new SignatureCredential(userName, password, signature, appId, subject)); } else if (credMap.get(prefix + suffix + ".CertPath") != null) { <BUG>String certPath = (String) credMap.get(prefix + suffix+ ".CertPath"); String certKey = (String) credMap.get(prefix + suffix+ ".CertKey"); credentialMap.put(userName, new CertificateCredential(userName,</BUG> password, certPath, certKey, appId, subject)); }
String certPath = (String) credMap.get(prefix + suffix String certKey = (String) credMap.get(prefix + suffix credentialMap.put(userName, new CertificateCredential(userName,
46,640
public void setupClientSSL(String certPath, String certKey) throws SSLConfigurationException { if( certPath != null || certKey != null ) LoggingManager.warn(GoogleAppEngineHttpConnection.class, "The PayPal SDK cannot be used with client SSL on Google App Engine; configure the SDK to use a PayPal API Signature instead"); } @Override <BUG>public void CreateAndconfigureHttpConnection(HttpConfiguration clientConfiguration) throws MalformedURLException, UnknownHostException, IOException { this.config = clientConfiguration;</BUG> URL url = new URL(this.config.getEndPointUrl()); this.connection = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
public void createAndconfigureHttpConnection( HttpConfiguration clientConfiguration) throws IOException { this.config = clientConfiguration;
46,641
package com.paypal.core; <BUG>public class ConnectionManager { </BUG> private static ConnectionManager instance; private ConnectionManager() { }
public final class ConnectionManager {
46,642
LogicalGraph iig = getIntegratedInstanceGraph(); out.add("Integrated Instance Graph", iig); GraphCollection btgs = iig .callForCollection(new BusinessTransactionGraphs()); btgs = btgs <BUG>.apply(new ApplyAggregation(new IsClosedAggregateFunction())); btgs = btgs.select(new IsClosedPredicateFunction()); btgs = btgs</BUG> .apply(new ApplyAggregation(new CountSalesOrdersAggregateFunction())); out.add("Business Transaction Graphs with Measures", btgs);
.apply(new ApplyAggregation(new IsClosedAggregateFunction())) .select(g -> g.getPropertyValue("isClosed").getBoolean())
46,643
FlinkAsciiGraphLoader loader = new FlinkAsciiGraphLoader(gradoopConf); String gdl = IOUtils.toString(CategoryCharacteristicPatterns.class .getResourceAsStream("/data/gdl/itbda.gdl")); gdl = gdl .replaceAll("SOURCEID_KEY", <BUG>BusinessTransactionGraphs.SOURCEID_KEY) .replaceAll("SUPERTYPE_KEY", BusinessTransactionGraphs.SUPERTYPE_KEY) .replaceAll("SUPERCLASS_VALUE_MASTER", BusinessTransactionGraphs.SUPERCLASS_VALUE_MASTER) .replaceAll("SUPERCLASS_VALUE_TRANSACTIONAL", BusinessTransactionGraphs.SUPERCLASS_VALUE_TRANSACTIONAL); loader.initDatabaseFromString(gdl);</BUG> return loader.getLogicalGraphByVariable("iig");
loader.initDatabaseFromString(gdl);
46,644
vertex.getLabel().equals("Quotation") && !vertex.getPropertyValue("status").toString().equals("open"); return PropertyValue.create(isClosedQuotation); } } <BUG>private static class IsClosedPredicateFunction implements FilterFunction<GraphHead> { @Override public boolean filter(GraphHead graphHead) throws Exception { return graphHead.getPropertyValue("isClosed").getBoolean(); } }</BUG> private static class CountSalesOrdersAggregateFunction
[DELETED]
46,645
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.List; <BUG>import java.util.Optional; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandDelete extends FCCommandBase { private static final FlagMapper MAPPER = map -> key -> value -> { map.put(key, value);
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
46,646
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { <BUG>if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); IRegion region = FGManager.getInstance().getRegion(parse.args[1]); </BUG> boolean isWorldRegion = false; if (region == null) {
String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null);
46,647
</BUG> isWorldRegion = true; } if (region == null) <BUG>throw new CommandException(Text.of("No region exists with the name \"" + parse.args[1] + "\"!")); if (region instanceof GlobalWorldRegion) { </BUG> throw new CommandException(Text.of("You may not delete the global region!")); }
if (world == null) throw new CommandException(Text.of("No world exists with name \"" + worldName + "\"!")); if (world == null) throw new CommandException(Text.of("Must specify a world!")); region = FGManager.getInstance().getWorldRegion(world, regionName).orElse(null); throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) {
46,648
source.getName() + " deleted " + (isWorldRegion ? "world" : "") + "region" ); return CommandResult.success(); } else if (isIn(HANDLERS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); <BUG>IHandler handler = FGManager.getInstance().gethandler(parse.args[1]); if (handler == null) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); if (handler instanceof GlobalHandler)</BUG> throw new CommandException(Text.of("You may not delete the global handler!"));
Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler)
46,649
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
46,650
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
46,651
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") <BUG>public final class FoxGuardMain { public final Cause pluginCause = Cause.builder().named("plugin", this).build(); private static FoxGuardMain instanceField;</BUG> @Inject private Logger logger;
private static FoxGuardMain instanceField;
46,652
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { <BUG>return instanceField; }</BUG> @Listener public void construct(GameConstructionEvent event) { instanceField = this;
} public static Cause getCause() { return instance().pluginCause; }
46,653
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
[DELETED]
46,654
import org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.*; <BUG>import java.util.stream.Collectors; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;</BUG> public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*;
46,655
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "handler").stream() .filter(new StartsWithPredicate(parse.current.token))</BUG> .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index > 0) {
return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token))
46,656
private static FGStorageManager instance; private final Logger logger = FoxGuardMain.instance().getLogger();</BUG> private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; <BUG>private FGStorageManager() { defaultModifiedMap = new CacheMap<>((k, m) -> {</BUG> if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> {
46,657
String name = fgObject.getName(); Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving handler \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
UUID owner = fgObject.getOwner(); boolean isOwned = !owner.equals(SERVER_UUID); Optional<User> userOwner = userStorageService.get(owner); String logName = (userOwner.isPresent() ? userOwner.get().getName() + ":" : "") + (isOwned ? owner + ":" : "") + name; if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir);
46,658
if (fgObject.autoSave()) { Path singleDir = dir.resolve(name.toLowerCase()); </BUG> boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { <BUG>logger.info((shouldSave ? "S" : "Force s") + "aving world region \"" + name + "\" in directory: " + singleDir); </BUG> constructDirectory(singleDir); try { fgObject.save(singleDir);
Path singleDir = serverDir.resolve(name.toLowerCase()); logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir);
46,659
public synchronized void loadRegionLinks() { logger.info("Loading region links"); try (DB mainDB = DBMaker.fileDB(directory.resolve("regions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getRegion(entry.getKey()); if (region != null) { logger.info("Loading links for region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\"");
46,660
public synchronized void loadWorldRegionLinks(World world) { logger.info("Loading world region links for world \"" + world.getName() + "\""); try (DB mainDB = DBMaker.fileDB(worldDirectories.get(world.getName()).resolve("wregions.foxdb").normalize().toString()).make()) { Map<String, String> linksMap = mainDB.hashMap("links", Serializer.STRING, Serializer.STRING).createOrOpen(); linksMap.entrySet().forEach(entry -> { <BUG>IRegion region = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (region != null) { logger.info("Loading links for world region \"" + region.getName() + "\"");</BUG> String handlersString = entry.getValue();
Optional<IWorldRegion> regionOpt = FGManager.getInstance().getWorldRegion(world, entry.getKey()); if (regionOpt.isPresent()) { IWorldRegion region = regionOpt.get(); logger.info("Loading links for world region \"" + region.getName() + "\"");
46,661
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } <BUG>return builder.toString(); }</BUG> private final class LoadEntry { public final String name; public final Type type;
public enum Type { REGION, WREGION, HANDLER
46,662
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) <BUG>return ImmutableList.of("region", "worldregion", "handler", "controller").stream() </BUG> .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
return Stream.of("region", "worldregion", "handler", "controller")
46,663
} else { updateMemo(); callback.updateMemo(); } dismiss(); <BUG>}else{ </BUG> Toast.makeText(getActivity(), getString(R.string.toast_memo_empty), Toast.LENGTH_SHORT).show(); } }
[DELETED]
46,664
} @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_memo); <BUG>ChinaPhoneHelper.setStatusBar(this,true); </BUG> topicId = getIntent().getLongExtra("topicId", -1); if (topicId == -1) { finish();
ChinaPhoneHelper.setStatusBar(this, true);
46,665
MemoEntry.COLUMN_REF_TOPIC__ID + " = ?" , new String[]{String.valueOf(topicId)}); } public Cursor selectMemo(long topicId) { Cursor c = db.query(MemoEntry.TABLE_NAME, null, MemoEntry.COLUMN_REF_TOPIC__ID + " = ?", new String[]{String.valueOf(topicId)}, null, null, <BUG>MemoEntry._ID + " DESC", null); </BUG> if (c != null) { c.moveToFirst(); }
MemoEntry.COLUMN_ORDER + " ASC", null);
46,666
MemoEntry._ID + " = ?", new String[]{String.valueOf(memoId)}); } public long updateMemoContent(long memoId, String memoContent) { ContentValues values = new ContentValues(); <BUG>values.put(MemoEntry.COLUMN_CONTENT, memoContent); return db.update(</BUG> MemoEntry.TABLE_NAME, values, MemoEntry._ID + " = ?",
return db.update(
46,667
import android.widget.RelativeLayout; import android.widget.TextView; import com.kiminonawa.mydiary.R; import com.kiminonawa.mydiary.db.DBManager; import com.kiminonawa.mydiary.shared.EditMode; <BUG>import com.kiminonawa.mydiary.shared.ThemeManager; import java.util.List; public class MemoAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements EditMode { </BUG> private List<MemoEntity> memoList;
import com.marshalchen.ultimaterecyclerview.dragsortadapter.DragSortAdapter; public class MemoAdapter extends DragSortAdapter<DragSortAdapter.ViewHolder> implements EditMode {
46,668
private DBManager dbManager; private boolean isEditMode = false; private EditMemoDialogFragment.MemoCallback callback; private static final int TYPE_HEADER = 0; private static final int TYPE_ITEM = 1; <BUG>public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback) { this.mActivity = activity;</BUG> this.topicId = topicId; this.memoList = memoList;
public MemoAdapter(FragmentActivity activity, long topicId, List<MemoEntity> memoList, DBManager dbManager, EditMemoDialogFragment.MemoCallback callback, RecyclerView recyclerView) { super(recyclerView); this.mActivity = activity;
46,669
this.memoList = memoList; this.dbManager = dbManager; this.callback = callback; } @Override <BUG>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { </BUG> View view; if (isEditMode) { if (viewType == TYPE_HEADER) {
public DragSortAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
46,670
editMemoDialogFragment.show(mActivity.getSupportFragmentManager(), "editMemoDialogFragment"); } }); } } <BUG>protected class MemoViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private View rootView; private TextView TV_memo_item_content;</BUG> private ImageView IV_memo_item_delete;
protected class MemoViewHolder extends DragSortAdapter.ViewHolder implements View.OnClickListener, View.OnLongClickListener { private ImageView IV_memo_item_dot; private TextView TV_memo_item_content;
46,671
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> {
46,672
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);
46,673
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;
46,674
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]
46,675
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]
46,676
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);
46,677
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);
46,678
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]
46,679
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)
46,680
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(() -> {
46,681
package com.projecttango.examples.java.augmentedreality; import com.google.atap.tangoservice.Tango; import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoConfig; <BUG>import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoEvent;</BUG> import com.google.atap.tangoservice.TangoOutOfDateException; import com.google.atap.tangoservice.TangoPoseData; import com.google.atap.tangoservice.TangoXyzIjData;
import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
46,682
super.onResume(); if (!mIsConnected) { mTango = new Tango(AugmentedRealityActivity.this, new Runnable() { @Override public void run() { <BUG>try { connectTango();</BUG> setupRenderer(); mIsConnected = true; } catch (TangoOutOfDateException e) {
TangoSupport.initialize(); connectTango();
46,683
if (lastFramePose.statusCode == TangoPoseData.POSE_VALID) { mRenderer.updateRenderCameraPose(lastFramePose, mExtrinsics); mCameraPoseTimestamp = lastFramePose.timestamp;</BUG> } else { <BUG>Log.w(TAG, "Can't get device pose at time: " + mRgbTimestampGlThread); }</BUG> } } } @Override
mRenderer.updateRenderCameraPose(lastFramePose); mCameraPoseTimestamp = lastFramePose.timestamp; Log.w(TAG, "Can't get device pose at time: " +
46,684
import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; <BUG>import org.rajawali3d.math.Matrix4; import org.rajawali3d.math.vector.Vector3;</BUG> import org.rajawali3d.primitives.ScreenQuad; import org.rajawali3d.primitives.Sphere; import org.rajawali3d.renderer.RajawaliRenderer;
import org.rajawali3d.math.Quaternion; import org.rajawali3d.math.vector.Vector3;
46,685
translationMoon.setRepeatMode(Animation.RepeatMode.INFINITE); translationMoon.setTransformable3D(moon); getCurrentScene().registerAnimation(translationMoon); translationMoon.play(); } <BUG>public void updateRenderCameraPose(TangoPoseData devicePose, DeviceExtrinsics extrinsics) { Pose cameraPose = ScenePoseCalculator.toOpenGlCameraPose(devicePose, extrinsics); getCurrentCamera().setRotation(cameraPose.getOrientation()); getCurrentCamera().setPosition(cameraPose.getPosition()); }</BUG> public int getTextureId() {
public void updateRenderCameraPose(TangoPoseData cameraPose) { float[] rotation = cameraPose.getRotationAsFloats(); float[] translation = cameraPose.getTranslationAsFloats(); Quaternion quaternion = new Quaternion(rotation[3], rotation[0], rotation[1], rotation[2]); getCurrentCamera().setRotation(quaternion.conjugate()); getCurrentCamera().setPosition(translation[0], translation[1], translation[2]);
46,686
package com.projecttango.examples.java.helloareadescription; import com.google.atap.tangoservice.Tango; <BUG>import com.google.atap.tangoservice.Tango.OnTangoUpdateListener; import com.google.atap.tangoservice.TangoConfig;</BUG> import com.google.atap.tangoservice.TangoCoordinateFramePair; import com.google.atap.tangoservice.TangoErrorException; import com.google.atap.tangoservice.TangoEvent;
import com.google.atap.tangoservice.TangoAreaDescriptionMetaData; import com.google.atap.tangoservice.TangoConfig;
46,687
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
46,688
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++) {
46,689
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++) {
46,690
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
46,691
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++) {
46,692
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
46,693
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++) {
46,694
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
46,695
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++) {
46,696
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
46,697
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++) {
46,698
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
46,699
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++) {
46,700
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;