id
int64
1
60k
buggy
stringlengths
34
37.5k
fixed
stringlengths
6
37.4k
401
handler.post(new Runnable() { @Override public void run() { callBack.success(compressBitmap); if (compressBitmap != null) { <BUG>MemoryCache.getInstance().putBitmapToCache(url + reqWidth + "/" + reqHeight, compressBitmap); DiskCache.getInstance().putBitmapToCache(url + reqWidth + "/" + reqHeight, compressBitmap); </BUG> }
handler.post(new Runnable() { @Override public void run() { callBack.success(compressBitmap); if (compressBitmap != null) { MemoryCache.getInstance().put(Util.getCacheKey(url + reqWidth + "/" + reqHeight), compressBitmap); DiskCache.getInstance().put(Util.getCacheKey(url + reqWidth + "/" + reqHeight), compressBitmap);
402
case "deploymentInfo": try { DatasetInfoDao.updateDatasetDeployment(rootNode); } catch (Exception ex) { Logger.debug("Metadata change exception: deployment ", ex); <BUG>} break; case "caseSensitivity": try { DatasetInfoDao.updateDatasetCaseSensitivity(rootNode); } catch (Exception ex) { Logger.debug("Metadata change exception: case sensitivity ", ex);</BUG> }
case "deploymentInfo": try { DatasetInfoDao.updateDatasetDeployment(rootNode); } catch (Exception ex) { Logger.debug("Metadata change exception: deployment ", ex); }
403
private static final String DATASET_CAPACITY_TABLE = "dataset_capacity"; private static final String DATASET_TAG_TABLE = "dataset_tag"; private static final String DATASET_CASE_SENSITIVE_TABLE = "dataset_case_sensitivity"; private static final String DATASET_REFERENCE_TABLE = "dataset_reference"; private static final String DATASET_PARTITION_TABLE = "dataset_partition"; <BUG>private static final String DATASET_SECURITY_TABLE = "dataset_security"; </BUG> private static final String DATASET_OWNER_TABLE = "dataset_owner"; private static final String DATASET_OWNER_UNMATCHED_TABLE = "stg_dataset_owner_unmatched"; private static final String DATASET_CONSTRAINT_TABLE = "dataset_constraint";
private static final String DATASET_CAPACITY_TABLE = "dataset_capacity"; private static final String DATASET_TAG_TABLE = "dataset_tag"; private static final String DATASET_CASE_SENSITIVE_TABLE = "dataset_case_sensitivity"; private static final String DATASET_REFERENCE_TABLE = "dataset_reference"; private static final String DATASET_PARTITION_TABLE = "dataset_partition"; private static final String DATASET_SECURITY_TABLE = "dataset_security_info"; private static final String DATASET_OWNER_TABLE = "dataset_owner"; private static final String DATASET_OWNER_UNMATCHED_TABLE = "stg_dataset_owner_unmatched"; private static final String DATASET_CONSTRAINT_TABLE = "dataset_constraint";
404
throw new IllegalArgumentException( "Dataset deployment info update fail, " + "Json missing necessary fields: " + root.toString()); </BUG> } <BUG>final Object[] idUrn = findIdAndUrn(idNode, urnNode); final Integer datasetId = (Integer) idUrn[0];</BUG> final String urn = (String) idUrn[1]; ObjectMapper om = new ObjectMapper(); for (final JsonNode deploymentInfo : deployment) { DatasetDeploymentRecord record = om.convertValue(deploymentInfo, DatasetDeploymentRecord.class);
throw new IllegalArgumentException( "Dataset deployment info update error, missing necessary fields: " + root.toString()); } final Object[] idUrn = findDataset(root); if (idUrn[0] == null || idUrn[1] == null) { throw new IllegalArgumentException("Cannot identify dataset from id/uri/urn: " + root.toString()); } final Integer datasetId = (Integer) idUrn[0]; final String urn = (String) idUrn[1]; ObjectMapper om = new ObjectMapper(); for (final JsonNode deploymentInfo : deployment) { DatasetDeploymentRecord record = om.convertValue(deploymentInfo, DatasetDeploymentRecord.class);
405
} return records; } public static void updateDatasetCapacity(JsonNode root) throws Exception { <BUG>final JsonNode idNode = root.path("datasetId"); final JsonNode urnNode = root.path("urn");</BUG> final JsonNode capacity = root.path("capacity"); <BUG>if ((idNode.isMissingNode() && urnNode.isMissingNode()) || capacity.isMissingNode() || !capacity.isArray()) { throw new IllegalArgumentException( "Dataset capacity info update fail, " + "Json missing necessary fields: " + root.toString()); </BUG> }
} return records; }
406
} return records; } public static void updateDatasetTags(JsonNode root) throws Exception { <BUG>final JsonNode idNode = root.path("datasetId"); final JsonNode urnNode = root.path("urn");</BUG> final JsonNode tags = root.path("tags"); <BUG>if ((idNode.isMissingNode() && urnNode.isMissingNode()) || tags.isMissingNode() || !tags.isArray()) { throw new IllegalArgumentException( "Dataset tag info update fail, " + "Json missing necessary fields: " + root.toString()); </BUG> }
} return records; }
407
{ ownerName = owner.substring(lastIndex+1); </BUG> namespace = owner.substring(0, lastIndex); <BUG>if (namespace != null && namespace.equalsIgnoreCase("urn:li:griduser")) {</BUG> isGroup = "Y"; <BUG>ownerIdType = "GROUP"; } else {</BUG> ownerIdType = "PERSON";
} else { datasetId = (Integer) idUrn[0]; urn = (String) idUrn[1];
408
rec.setModifiedTime(System.currentTimeMillis() / 1000); if (datasetId == 0) { DatasetRecord record = new DatasetRecord(); record.setUrn(urn); record.setSourceCreatedTime("" + rec.getCreateTime() / 1000); <BUG>record.setSchema(rec.getOriginalSchema()); record.setSchemaType(rec.getFormat()); </BUG> record.setFields((String) StringUtil.objectToJsonString(rec.getFieldSchema()));
rec.setModifiedTime(System.currentTimeMillis() / 1000); if (datasetId == 0) { DatasetRecord record = new DatasetRecord(); record.setUrn(urn); record.setSourceCreatedTime("" + rec.getCreateTime() / 1000); record.setSchema(rec.getOriginalSchema().getText()); record.setSchemaType(rec.getOriginalSchema().getFormat()); record.setFields((String) StringUtil.objectToJsonString(rec.getFieldSchema()));
409
datasetId = Integer.valueOf(DatasetDao.getDatasetByUrn(urn).get("id").toString()); rec.setDatasetId(datasetId); } else { DICT_DATASET_WRITER.execute(UPDATE_DICT_DATASET_WITH_SCHEMA_CHANGE, <BUG>new Object[]{rec.getOriginalSchema(), rec.getFormat(), StringUtil.objectToJsonString(rec.getFieldSchema()), "API", System.currentTimeMillis() / 1000, datasetId}); }</BUG> List<Map<String, Object>> oldInfo; try {
datasetId = Integer.valueOf(DatasetDao.getDatasetByUrn(urn).get("id").toString()); rec.setDatasetId(datasetId); } else { DICT_DATASET_WRITER.execute(UPDATE_DICT_DATASET_WITH_SCHEMA_CHANGE, new Object[]{rec.getOriginalSchema().getText(), rec.getOriginalSchema().getFormat(), StringUtil.objectToJsonString(rec.getFieldSchema()), "API", System.currentTimeMillis() / 1000, datasetId}); } List<Map<String, Object>> oldInfo; try {
410
import com.intellij.openapi.actionSystem.ActionGroup; import com.intellij.openapi.actionSystem.DataProvider; import com.intellij.openapi.ui.popup.JBPopup; import com.intellij.openapi.util.ActionCallback; import com.intellij.openapi.util.DimensionService; <BUG>import com.intellij.openapi.util.MutualMap; import com.intellij.ui.awt.RelativePoint;</BUG> import com.intellij.ui.components.panels.NonOpaquePanel; import com.intellij.ui.content.Content; import com.intellij.ui.switcher.SwitchTarget;
import com.intellij.openapi.actionSystem.ActionGroup; import com.intellij.openapi.actionSystem.DataProvider; import com.intellij.openapi.ui.popup.JBPopup; import com.intellij.openapi.util.ActionCallback; import com.intellij.openapi.util.DimensionService; import com.intellij.openapi.util.MutualMap; import com.intellij.ui.ColorUtil; import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.components.panels.NonOpaquePanel; import com.intellij.ui.content.Content; import com.intellij.ui.switcher.SwitchTarget;
411
myPlaceInGrid = placeInGrid; myPlaceholder = placeholder; myTabs = new JBTabsImpl(myContext.getProject(), myContext.getActionManager(), myContext.getFocusManager(), container) { @Override protected Color getFocusedTopFillColor() { <BUG>return new Color(202, 211, 227); }</BUG> @Override public boolean useSmallLabels() { return true;
myPlaceInGrid = placeInGrid; myPlaceholder = placeholder; myTabs = new JBTabsImpl(myContext.getProject(), myContext.getActionManager(), myContext.getFocusManager(), container) { @Override protected Color getFocusedTopFillColor() { return UIUtil.isUnderDarcula() ? ColorUtil.toAlpha(new Color(0x1E2533), 100) : new Color(202, 211, 227); } @Override public boolean useSmallLabels() { return true;
412
public boolean useSmallLabels() { return true; } @Override protected Color getFocusedBottomFillColor() { <BUG>return new Color(194, 203, 219); }</BUG> @Override public void processDropOver(TabInfo over, RelativePoint point) { ((RunnerContentUi)myContext).myTabs.processDropOver(over, point);
public boolean useSmallLabels() { return true; } @Override protected Color getFocusedBottomFillColor() { return UIUtil.isUnderDarcula() ? new Color(0x1E2533) : new Color(0xc2cbdb); } @Override public Color getBackground() { return UIUtil.isUnderDarcula() ? new Color(0x27292A) : super.getBackground(); } @Override public void processDropOver(TabInfo over, RelativePoint point) { ((RunnerContentUi)myContext).myTabs.processDropOver(over, point);
413
package com.intellij.execution.ui.layout.impl; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.ActionGroup; import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.project.Project; <BUG>import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.ui.Gray;</BUG> import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.tabs.TabInfo; import com.intellij.ui.tabs.TabsUtil;
package com.intellij.execution.ui.layout.impl; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.ActionGroup; import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.ui.ColorUtil; import com.intellij.ui.Gray; import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.tabs.TabInfo; import com.intellij.ui.tabs.TabsUtil;
414
protected void doPaintInactive(Graphics2D g2d, boolean leftGhostExists, TabLabel label, Rectangle effectiveBounds, boolean rightGhostExists, int row, int column) { <BUG>Insets insets = getTabsBorder().getEffectiveBorder(); int _x = effectiveBounds.x + insets.left;</BUG> int _y = effectiveBounds.y + insets.top + 3; int _width = effectiveBounds.width - insets.left - insets.right; int _height = effectiveBounds.height - insets.top - insets.bottom - 3;
protected void doPaintInactive(Graphics2D g2d, boolean leftGhostExists, TabLabel label, Rectangle effectiveBounds, boolean rightGhostExists, int row, int column) { Insets insets = getTabsBorder().getEffectiveBorder(); final boolean dark = UIUtil.isUnderDarcula(); int _x = effectiveBounds.x + insets.left; int _y = effectiveBounds.y + insets.top + 3; int _width = effectiveBounds.width - insets.left - insets.right; int _height = effectiveBounds.height - insets.top - insets.bottom - 3;
415
g2d.fillRect(0, 0, rectangle.x + rectangle.width, 3); g2d.fillRect(2, maxLength, getSize().width, getSize().height); g2d.drawLine(0, 0, 0, getSize().height); } protected void paintSelectionAndBorder(Graphics2D g2d) { <BUG>if (getSelectedInfo() == null) return; TabLabel label = getSelectedLabel();</BUG> Rectangle r = label.getBounds(); r = new Rectangle(r.x, r.y + 3, r.width, r.height - 3); ShapeInfo selectedShape = _computeSelectedLabelShape(r);
g2d.fillRect(0, 0, rectangle.x + rectangle.width, 3); g2d.fillRect(2, maxLength, getSize().width, getSize().height); g2d.drawLine(0, 0, 0, getSize().height); } protected void paintSelectionAndBorder(Graphics2D g2d) { if (getSelectedInfo() == null) return; final boolean dark = UIUtil.isUnderDarcula(); final Color col = dark ? ColorUtil.shift(UIUtil.getListBackground(), 1.6) : Gray._255; final Color panelBg = dark ? ColorUtil.shift(UIUtil.getPanelBackground(), 1.3) : UIUtil.getPanelBackground(); TabLabel label = getSelectedLabel(); Rectangle r = label.getBounds(); r = new Rectangle(r.x, r.y + 3, r.width, r.height - 3); ShapeInfo selectedShape = _computeSelectedLabelShape(r);
416
Insets i = selectedShape.path.transformInsets(insets); int _x = r.x; int _y = r.y; int _height = r.height; if (!isHideTabs()) { <BUG>g2d.setPaint(new GradientPaint(_x, _y, Gray._255, _x, _y + _height - 3, UIUtil.getPanelBackground())); </BUG> g2d.fill(selectedShape.fillPath.getShape()); <BUG>g2d.setColor(Gray._255.withAlpha(180)); g2d.draw(selectedShape.fillPath.getShape());</BUG> g2d.draw(selectedShape.labelPath
Insets i = selectedShape.path.transformInsets(insets); int _x = r.x; int _y = r.y; int _height = r.height; if (!isHideTabs()) { g2d.setPaint(new GradientPaint(_x, _y, col, _x, _y + _height - 3, panelBg)); g2d.fill(selectedShape.fillPath.getShape()); g2d.setColor(ColorUtil.toAlpha(col, 180)); g2d.draw(selectedShape.fillPath.getShape()); g2d.draw(selectedShape.labelPath
417
.transformLine(selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getY() + selectedShape.labelPath.deltaY(1), selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getMaxY() - selectedShape.labelPath.deltaY(4))); } <BUG>g2d.setColor(UIUtil.getPanelBackground()); g2d.fillRect(2, selectedShape.labelPath.getMaxY() - 2, selectedShape.path.getMaxX() - 2, 3);</BUG> g2d.drawLine(1, selectedShape.labelPath.getMaxY(), 1, getHeight() - 1); g2d.drawLine(selectedShape.path.getMaxX() - 1, selectedShape.labelPath.getMaxY() - 4, selectedShape.path.getMaxX() - 1, getHeight() - 1);
.transformLine(selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getY() + selectedShape.labelPath.deltaY(1), selectedShape.labelPath.getMaxX() - selectedShape.labelPath.deltaX(1), selectedShape.labelPath.getMaxY() - selectedShape.labelPath.deltaY(4))); } g2d.setColor(panelBg); g2d.fillRect(2, selectedShape.labelPath.getMaxY() - 2, selectedShape.path.getMaxX() - 2, 3); g2d.drawLine(1, selectedShape.labelPath.getMaxY(), 1, getHeight() - 1); g2d.drawLine(selectedShape.path.getMaxX() - 1, selectedShape.labelPath.getMaxY() - 4, selectedShape.path.getMaxX() - 1, getHeight() - 1);
418
package org.gradle.model.internal.manage.schema; <BUG>import org.gradle.internal.Cast; import org.gradle.model.internal.core.MutableModelNode;</BUG> import org.gradle.model.internal.type.ModelType; <BUG>import java.util.Collection;</BUG> public class ScalarCollectionSchema<T, E> extends CollectionSchema<T, E> { public ScalarCollectionSchema(ModelType<T> type, ModelType<E> elementType) { super(type, elementType); } <BUG>public static void clear(MutableModelNode node) { node.setPrivateData(Collection.class, null);</BUG> }
package org.gradle.model.internal.manage.schema; import org.gradle.model.internal.type.ModelType; public class ScalarCollectionSchema<T, E> extends CollectionSchema<T, E> {
419
import org.gradle.model.internal.core.rule.describe.ModelRuleDescriptor; import org.gradle.model.internal.manage.binding.StructBindings; import org.gradle.model.internal.manage.instance.ManagedInstance; import org.gradle.model.internal.manage.instance.ManagedProxyFactory; import org.gradle.model.internal.manage.instance.ModelElementState; <BUG>import org.gradle.model.internal.manage.schema.*; import org.gradle.model.internal.type.ModelType;</BUG> import java.util.Collection; import java.util.HashMap; import java.util.Map;
import org.gradle.model.internal.core.rule.describe.ModelRuleDescriptor; import org.gradle.model.internal.manage.binding.StructBindings; import org.gradle.model.internal.manage.instance.ManagedInstance; import org.gradle.model.internal.manage.instance.ManagedProxyFactory; import org.gradle.model.internal.manage.instance.ModelElementState; import org.gradle.model.internal.manage.schema.*; import org.gradle.model.internal.manage.schema.extract.ScalarCollectionModelView; import org.gradle.model.internal.type.ModelType; import java.util.Collection; import java.util.HashMap; import java.util.Map;
420
private <T> T doGet(ModelProperty<T> property, String propertyName) { ModelType<T> propertyType = property.getType(); MutableModelNode propertyNode = modelNode.getLink(propertyName); propertyNode.ensureUsable(); ModelView<? extends T> modelView; <BUG>ModelSchema<T> propertySchema = property.getSchema(); if (property.isWritable() && propertySchema instanceof ScalarCollectionSchema) { Collection<?> instance = ScalarCollectionSchema.get(propertyNode); if (instance == null) { return null; } }</BUG> if (writable) {
private <T> T doGet(ModelProperty<T> property, String propertyName) { ModelType<T> propertyType = property.getType(); MutableModelNode propertyNode = modelNode.getLink(propertyName); propertyNode.ensureUsable(); ModelView<? extends T> modelView; if (writable) { modelView = propertyNode.asMutable(propertyType, ruleDescriptor); if (closed) { modelView.close();
421
private <T> Object doSet(String name, Object value, ModelProperty<T> property) { ModelSchema<T> propertySchema = property.getSchema(); MutableModelNode propertyNode = modelNode.getLink(name); propertyNode.ensureUsable(); if (propertySchema instanceof ManagedImplSchema) { <BUG>if (value == null) {</BUG> if (propertySchema instanceof ScalarCollectionSchema) { <BUG>ScalarCollectionSchema.clear(propertyNode); } else { propertyNode.setTarget(null); }</BUG> } else if (ManagedInstance.class.isInstance(value)) {
private <T> Object doSet(String name, Object value, ModelProperty<T> property) { ModelSchema<T> propertySchema = property.getSchema(); MutableModelNode propertyNode = modelNode.getLink(name); propertyNode.ensureUsable(); if (propertySchema instanceof ManagedImplSchema) { if (propertySchema instanceof ScalarCollectionSchema) { ModelView<? extends Collection<?>> modelView = propertyNode.asMutable(COLLECTION_MODEL_TYPE, ruleDescriptor); return ((ScalarCollectionModelView<?, ? extends Collection<?>>) modelView).setValue(value); } else if (value == null) { propertyNode.setTarget(null); } else if (ManagedInstance.class.isInstance(value)) {
422
private final ModelType<T> elementType; public ModelSetModelViewFactory(ModelType<T> elementType) { this.elementType = elementType; } @Override <BUG>public ModelView<ModelSet<T>> toView(MutableModelNode modelNode, ModelRuleDescriptor ruleDescriptor, boolean writable) { </BUG> ModelType<ModelSet<T>> setType = ModelTypes.modelSet(elementType); <BUG>DefaultModelViewState state = new DefaultModelViewState(modelNode.getPath(), setType, ruleDescriptor, writable, !writable); </BUG> ChildNodeInitializerStrategy<T> childStrategy = Cast.uncheckedCast(modelNode.getPrivateData(ChildNodeInitializerStrategy.class));
private final ModelType<T> elementType; public ModelSetModelViewFactory(ModelType<T> elementType) { this.elementType = elementType; } @Override public ModelView<ModelSet<T>> toView(MutableModelNode modelNode, ModelRuleDescriptor ruleDescriptor, boolean mutable) { ModelType<ModelSet<T>> setType = ModelTypes.modelSet(elementType); DefaultModelViewState state = new DefaultModelViewState(modelNode.getPath(), setType, ruleDescriptor, mutable, !mutable); ChildNodeInitializerStrategy<T> childStrategy = Cast.uncheckedCast(modelNode.getPrivateData(ChildNodeInitializerStrategy.class));
423
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;
private static FGStorageManager instance; public final HashMap<IFGObject, Boolean> defaultModifiedMap; private final UserStorageService userStorageService; private final Logger logger = FoxGuardMain.instance().getLogger(); private final Set<LoadEntry> loaded = new HashSet<>(); private final Path directory = getDirectory(); private final Map<String, Path> worldDirectories; private FGStorageManager() { userStorageService = FoxGuardMain.instance().getUserStorage(); defaultModifiedMap = new CacheMap<>((k, m) -> { if (k instanceof IFGObject) { m.put((IFGObject) k, true); return true;
424
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { <BUG>logger.error("There was an error while saving region \"" + name + "\"!", e); </BUG> } <BUG>logger.info("Saving metadata for region \"" + name + "\""); </BUG> try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { logger.error("There was an error while saving region " + logName + "!", e); } logger.info("Saving metadata for region " + logName); try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
425
metaCategory.set(FGUtil.getCategory(fgObject)); <BUG>metaType.set(fgObject.getUniqueTypeString()); metaEnabled.set(fgObject.isEnabled());</BUG> } } else { <BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping..."); </BUG> } mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false);
metaCategory.set(FGUtil.getCategory(fgObject)); metaType.set(fgObject.getUniqueTypeString()); metaOwner.set(owner); metaEnabled.set(fgObject.isEnabled()); } } else { logger.info("Region " + logName + " is already up to date. Skipping..."); } mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false);
426
mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false); } else { <BUG>logger.info("Region " + fgObject.getName() + " does not need saving. Skipping..."); </BUG> } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false); } else { logger.info("Region " + logName + " does not need saving. Skipping..."); } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
427
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { <BUG>logger.error("There was an error while saving world region \"" + name + "\" in world \"" + world.getName() + "\"!", e); </BUG> } <BUG>logger.info("Saving metadata for world region \"" + name + "\""); </BUG> try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { logger.error("There was an error while saving world region " + logName + " in world " + world.getName() + "!", e); } logger.info("Saving metadata for world region " + logName); try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
428
metaCategory.set(FGUtil.getCategory(fgObject)); <BUG>metaType.set(fgObject.getUniqueTypeString()); metaEnabled.set(fgObject.isEnabled());</BUG> } } else { <BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping..."); </BUG> } mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false);
metaCategory.set(FGUtil.getCategory(fgObject)); metaType.set(fgObject.getUniqueTypeString()); metaOwner.set(owner); metaEnabled.set(fgObject.isEnabled()); } } else { logger.info("Region " + logName + " is already up to date. Skipping..."); } mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false);
429
mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false); } else { <BUG>logger.info("World region " + fgObject.getName() + " does not need saving. Skipping..."); </BUG> } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false); } else { logger.info("World region " + logName + " does not need saving. Skipping..."); } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
430
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);
String name = fgObject.getName(); 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()); boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { logger.info((shouldSave ? "S" : "Force s") + "aving handler " + logName + " in directory: " + singleDir); constructDirectory(singleDir); try { fgObject.save(singleDir);
431
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { <BUG>logger.error("There was an error while saving region \"" + name + "\"!", e); </BUG> } <BUG>logger.info("Saving metadata for region \"" + name + "\""); </BUG> try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { logger.error("There was an error while saving region " + logName + "!", e); } logger.info("Saving metadata for region " + logName); try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
432
metaCategory.set(FGUtil.getCategory(fgObject)); <BUG>metaType.set(fgObject.getUniqueTypeString()); metaEnabled.set(fgObject.isEnabled());</BUG> } } else { <BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping..."); </BUG> } mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false);
metaCategory.set(FGUtil.getCategory(fgObject)); metaType.set(fgObject.getUniqueTypeString()); metaOwner.set(owner); metaEnabled.set(fgObject.isEnabled()); } } else { logger.info("Region " + logName + " is already up to date. Skipping..."); } mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false);
433
mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false); } else { <BUG>logger.info("Region " + fgObject.getName() + " does not need saving. Skipping..."); </BUG> } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false); } else { logger.info("Region " + logName + " does not need saving. Skipping..."); } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
434
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);
if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir); constructDirectory(singleDir); try { fgObject.save(singleDir);
435
</BUG> constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { <BUG>logger.error("There was an error while saving world region \"" + name + "\" in world \"" + world.getName() + "\"!", e); </BUG> } <BUG>logger.info("Saving metadata for world region \"" + name + "\""); </BUG> try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
if (fgObject.autoSave()) { Path singleDir = serverDir.resolve(name.toLowerCase()); boolean shouldSave = fgObject.shouldSave(); if (force || shouldSave) { logger.info((shouldSave ? "S" : "Force s") + "aving world region " + logName + " in directory: " + singleDir); constructDirectory(singleDir); try { fgObject.save(singleDir); } catch (Exception e) { logger.error("There was an error while saving world region " + logName + " in world " + world.getName() + "!", e); } logger.info("Saving metadata for world region " + logName); try (DB metaDB = DBMaker.fileDB(singleDir.resolve("metadata.foxdb").normalize().toString()).make()) {
436
metaCategory.set(FGUtil.getCategory(fgObject)); <BUG>metaType.set(fgObject.getUniqueTypeString()); metaEnabled.set(fgObject.isEnabled());</BUG> } } else { <BUG>logger.info("Region \"" + name + "\" is already up to date. Skipping..."); }</BUG> mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false);
metaCategory.set(FGUtil.getCategory(fgObject)); metaType.set(fgObject.getUniqueTypeString()); metaOwner.set(owner); metaEnabled.set(fgObject.isEnabled()); } } else { logger.info("Region " + name + " is already up to date. Skipping..."); } mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled());
437
mainMap.put(name, FGUtil.getCategory(fgObject)); <BUG>typeMap.put(name, fgObject.getUniqueTypeString()); enabledMap.put(name, fgObject.isEnabled());</BUG> defaultModifiedMap.put(fgObject, false); } else { <BUG>logger.info("World region " + fgObject.getName() + " does not need saving. Skipping..."); </BUG> } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
mainMap.put(name, FGUtil.getCategory(fgObject)); typeMap.put(name, fgObject.getUniqueTypeString()); ownerMap.put(name, owner); enabledMap.put(name, fgObject.isEnabled()); defaultModifiedMap.put(fgObject, false); } else { logger.info("World region " + logName + " does not need saving. Skipping..."); } if (fgObject.saveLinks()) { linksMap.put(name, serializeHandlerList(fgObject.getHandlers()));
438
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();
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 -> { Optional<IRegion> regionOpt = FGManager.getInstance().getRegion(entry.getKey()); if (regionOpt.isPresent()) { IRegion region = regionOpt.get(); logger.info("Loading links for region \"" + region.getName() + "\""); String handlersString = entry.getValue();
439
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();
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 -> { 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() + "\""); String handlersString = entry.getValue();
440
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;
StringBuilder builder = new StringBuilder(); for (Iterator<IHandler> it = handlers.iterator(); it.hasNext(); ) { builder.append(it.next().getName()); if (it.hasNext()) builder.append(","); } return builder.toString(); } public enum Type { REGION, WREGION, HANDLER } private final class LoadEntry { public final String name; public final Type type;
441
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 org.spongepowered.api.world.Locatable; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import javax.annotation.Nullable; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*; public class CommandHere extends FCCommandBase { private static final String[] PRIORITY_ALIASES = {"priority", "prio", "p"}; private static final FlagMapper MAPPER = map -> key -> value -> {
442
import net.foxdenstudio.sponge.foxguard.plugin.handler.GlobalHandler; import net.foxdenstudio.sponge.foxguard.plugin.handler.IHandler; import net.foxdenstudio.sponge.foxguard.plugin.object.IFGObject; import net.foxdenstudio.sponge.foxguard.plugin.object.IGlobal; import net.foxdenstudio.sponge.foxguard.plugin.region.IRegion; <BUG>import net.foxdenstudio.sponge.foxguard.plugin.region.world.GlobalWorldRegion;</BUG> import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandException; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.ArgumentParseException; <BUG>import org.spongepowered.api.entity.living.player.Player;</BUG> import org.spongepowered.api.text.Text;
import net.foxdenstudio.sponge.foxguard.plugin.handler.GlobalHandler; import net.foxdenstudio.sponge.foxguard.plugin.handler.IHandler; import net.foxdenstudio.sponge.foxguard.plugin.object.IFGObject; import net.foxdenstudio.sponge.foxguard.plugin.object.IGlobal; import net.foxdenstudio.sponge.foxguard.plugin.region.IRegion; import org.spongepowered.api.Sponge; import org.spongepowered.api.command.CommandException; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.args.ArgumentParseException; import org.spongepowered.api.text.Text;
443
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 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; import java.util.Optional; import java.util.stream.Stream; import static net.foxdenstudio.sponge.foxcore.plugin.util.Aliases.*; public class CommandDelete extends FCCommandBase { private static final FlagMapper MAPPER = map -> key -> value -> { map.put(key, value);
444
.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) {
.append(Text.of(TextColors.GREEN, "Usage: ")) .append(getUsage(source)) .build()); return CommandResult.empty(); } else if (isIn(REGIONS_ALIASES, parse.args[0])) { if (parse.args.length < 2) throw new CommandException(Text.of("Must specify a name!")); String regionName = parse.args[1]; IRegion region = FGManager.getInstance().getRegion(regionName).orElse(null); boolean isWorldRegion = false; if (region == null) {
445
</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); isWorldRegion = true; } if (region == null) throw new CommandException(Text.of("No region exists with the name \"" + regionName + "\"!")); if (region instanceof IGlobal) { throw new CommandException(Text.of("You may not delete the global region!")); }
446
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!"));
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!")); Optional<IHandler> handlerOpt = FGManager.getInstance().gethandler(parse.args[1]); if (!handlerOpt.isPresent()) throw new ArgumentParseException(Text.of("No handler exists with that name!"), parse.args[1], 1); IHandler handler = handlerOpt.get(); if (handler instanceof GlobalHandler) throw new CommandException(Text.of("You may not delete the global handler!"));
447
.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) {
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token)) .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
448
.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) {
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token)) .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
449
.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) {
.autoCloseQuotes(true) .leaveFinalAsIs(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) return Stream.of("region", "worldregion", "handler", "controller") .filter(new StartsWithPredicate(parse.current.token)) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index == 1) {
450
.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) {
.excludeCurrent(true) .autoCloseQuotes(true) .parse(); if (parse.current.type.equals(AdvCmdParser.CurrentElement.ElementType.ARGUMENT)) { if (parse.current.index == 0) return Stream.of("region", "handler") .filter(new StartsWithPredicate(parse.current.token)) .map(args -> parse.current.prefix + args) .collect(GuavaCollectors.toImmutableList()); else if (parse.current.index > 0) {
451
@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;
@Dependency(id = "foxcore") }, description = "A world protection plugin built for SpongeAPI. Requires FoxCore.", authors = {"gravityfox"}, url = "https://github.com/FoxDenStudio/FoxGuard") public final class FoxGuardMain { private static FoxGuardMain instanceField; public final Cause pluginCause = Cause.builder().named("plugin", this).build(); @Inject private Logger logger;
452
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;
private UserStorageService userStorage; private EconomyService economyService = null; private boolean loaded = false; private FCCommandDispatcher fgDispatcher; public static FoxGuardMain instance() { return instanceField; } public static Cause getCause() { return instance().pluginCause; } @Listener public void construct(GameConstructionEvent event) { instanceField = this;
453
return configDirectory; } public boolean isLoaded() { return loaded; } <BUG>public static Cause getCause() { return instance().pluginCause; }</BUG> public EconomyService getEconomyService() { return economyService;
return configDirectory; } public boolean isLoaded() { return loaded; } public EconomyService getEconomyService() { return economyService;
454
public static int lavaBowDurability = 1750; <BUG>@ModConfigProperty(category = "Weapons.Bows.Properties", name = "guardianBowDurability", comment = "Set the amount of durability the Guardian Bow have") </BUG> public static int guardianBowDurability = 1800; <BUG>@ModConfigProperty(category = "Weapons.Bows.Properties", name = "superStarBowDurability", comment = "Set the amount of durability the Super Star Bow have") </BUG> public static int superStarBowDurability = 1950; <BUG>@ModConfigProperty(category = "Weapons.Bows.Properties", name = "enderDragonBowDurability", comment = "Set the amount of durability the Ender Dragon Bow have") </BUG> public static int enderDragonBowDurability = 2310;
public static int lavaBowDurability = 1750; @ModConfigProperty(category = "Weapons.Guardian.Bow", name = "guardianBowDurability", comment = "Set the amount of durability the Guardian Bow have") public static int guardianBowDurability = 1800; @ModConfigProperty(category = "Weapons.SuperStar.Bow", name = "superStarBowDurability", comment = "Set the amount of durability the Super Star Bow have") public static int superStarBowDurability = 1950; @ModConfigProperty(category = "Weapons.EnderDragon.Bow", name = "enderDragonBowDurability", comment = "Set the amount of durability the Ender Dragon Bow have") public static int enderDragonBowDurability = 2310;
455
public static boolean debugMode = false; @ModConfigProperty(category = "Debug", name = "debugModeGOTG", comment = "Enable/Disable Debug Mode for the Gift Of The Gods") public static boolean debugModeGOTG = false; @ModConfigProperty(category = "Debug", name = "debugModeEnchantments", comment = "Enable/Disable Debug Mode for the Enchantments") public static boolean debugModeEnchantments = false; <BUG>@ModConfigProperty(category = "Weapons", name = "enableSwordsRecipes", comment = "Enable/Disable The ArmorPlus Sword's Recipes") public static boolean enableSwordsRecipes = true; @ModConfigProperty(category = "Weapons", name = "enableBattleAxesRecipes", comment = "Enable/Disable The ArmorPlus Battle Axes's Recipes") public static boolean enableBattleAxesRecipes = true; @ModConfigProperty(category = "Weapons", name = "enableBowsRecipes", comment = "Enable/Disable The ArmorPlus Bows's Recipes") public static boolean enableBowsRecipes = true; @ModConfigProperty(category = "Armors.SuperStarArmor.Effects", name = "enableSuperStarHRegen", comment = "Enable/Disable The Super Star Helmet Regeneration") </BUG> public static boolean enableSuperStarHRegen = true;
public static boolean debugMode = false; @ModConfigProperty(category = "Debug", name = "debugModeGOTG", comment = "Enable/Disable Debug Mode for the Gift Of The Gods") public static boolean debugModeGOTG = false; @ModConfigProperty(category = "Debug", name = "debugModeEnchantments", comment = "Enable/Disable Debug Mode for the Enchantments") public static boolean debugModeEnchantments = false; @ModConfigProperty(category = "Weapons", name = "enableSwordsRecipes", comment = "Enable/Disable ArmorPlus Sword's Recipes") public static boolean enableSwordsRecipes = true; @ModConfigProperty(category = "Weapons", name = "enableBattleAxesRecipes", comment = "Enable/Disable ArmorPlus Battle Axes's Recipes") public static boolean enableBattleAxesRecipes = true; @ModConfigProperty(category = "Weapons", name = "enableBowsRecipes", comment = "Enable/Disable ArmorPlus Bows's Recipes")
456
public static boolean enableSlimeArmor = true; <BUG>@ModConfigProperty(category = "Armors.SteelArmor.Registry", name = "enableSteelArmor", comment = "Enable/Disable The Steel Armors From the Game") </BUG> public static boolean enableSteelArmor = true; <BUG>@ModConfigProperty(category = "Armors.ElectricalArmor.Registry", name = "enableElectricalArmor", comment = "Enable/Disable The Electrical Armors From the Game") </BUG> public static boolean enableElectricalArmor = true; <BUG>@ModConfigProperty(category = "FlightAbility", name = "enableFlightAbility", comment = "Enable/Disable The Armors Flight") </BUG> public static boolean enableFlightAbility = true;
public static boolean enableSlimeArmor = true; @ModConfigProperty(category = "Armors.SteelArmor.Registry", name = "enableSteelArmor", comment = "Enable/Disable the Steel Armors from the Game") public static boolean enableSteelArmor = true; @ModConfigProperty(category = "Armors.ElectricalArmor.Registry", name = "enableElectricalArmor", comment = "Enable/Disable the Electrical Armors from the Game") public static boolean enableElectricalArmor = true; @ModConfigProperty(category = "FlightAbility", name = "enableFlightAbility", comment = "Enable/Disable the Armors Flight") public static boolean enableFlightAbility = true;
457
package util; import java.util.Arrays; import java.util.Collection; import java.util.Collections; <BUG>import java.util.Iterator; import java.util.SortedSet;</BUG> import java.util.TreeSet; import javax.swing.AbstractListModel; public class SortedListModel extends AbstractListModel
package util; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import javax.swing.AbstractListModel; public class SortedListModel extends AbstractListModel
458
import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; <BUG>import java.io.BufferedWriter;</BUG> import java.io.File; <BUG>import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader;</BUG> import java.io.IOException;
import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.File;
459
import java.io.FileReader;</BUG> import java.io.IOException; <BUG>import java.io.OutputStreamWriter;</BUG> import java.net.URI; import java.net.URISyntaxException; <BUG>import java.util.Map; import java.util.Set;</BUG> import java.util.TreeMap; import javax.imageio.IIOException; import javax.imageio.ImageIO;
import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.util.TreeMap; import javax.imageio.IIOException; import javax.imageio.ImageIO;
460
import javax.swing.JTextField; import javax.swing.ScrollPaneConstants; import javax.swing.SwingUtilities; import javax.swing.border.LineBorder; import javax.swing.text.AbstractDocument; <BUG>import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser;</BUG> import main.AnimeIndex;
import javax.swing.JTextField; import javax.swing.ScrollPaneConstants; import javax.swing.SwingUtilities; import javax.swing.border.LineBorder; import javax.swing.text.AbstractDocument; import main.AnimeIndex;
461
if (f.isDirectory()) return true; String extension = MAMUtil.getExtension(f); if (extension != null) { <BUG>if (extension.equalsIgnoreCase(".zip")) </BUG> return true; return false; }
if (f.isDirectory()) return true; String extension = MAMUtil.getExtension(f); if (extension != null) { if (extension.equalsIgnoreCase(".MAMListBKP")) return true; return false; }
462
package util.task; import java.awt.event.ActionEvent; <BUG>import java.awt.event.ActionListener; import java.io.IOException;</BUG> import java.net.URISyntaxException; import java.security.GeneralSecurityException; import javax.swing.SwingWorker;
package util.task; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; import java.security.GeneralSecurityException; import javax.swing.SwingWorker;
463
private Set<Conditional> conditionals; public int fortuneLevel; public boolean enchanted; private float sortIndex; public LootDrop(ItemStack item) { <BUG>this(item, item.stackSize); }</BUG> public LootDrop(ItemStack item, float chance) { this(item, chance, 0); }
private Set<Conditional> conditionals; public int fortuneLevel; public boolean enchanted; private float sortIndex; public LootDrop(ItemStack item) { this(item, item.func_190916_E()); } public LootDrop(ItemStack item, float chance) { this(item, chance, 0); }
464
package jeresources.collection; <BUG>import jeresources.entry.VillagerEntry; import mezz.jei.api.recipe.IFocus; import net.minecraft.entity.passive.EntityVillager;</BUG> import net.minecraft.item.ItemStack; import net.minecraft.village.MerchantRecipe;
package jeresources.collection; import jeresources.entry.VillagerEntry; import jeresources.util.FakeMerchant; import mezz.jei.api.recipe.IFocus; import net.minecraft.entity.IMerchant; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.item.ItemStack; import net.minecraft.village.MerchantRecipe;
465
import java.util.LinkedList; import java.util.List; import java.util.Random; import java.util.stream.Collectors; public class TradeList extends LinkedList<TradeList.Trade> { <BUG>private static final Random r = new Random(); private VillagerEntry villagerEntry;</BUG> public TradeList(VillagerEntry villagerEntry) { this.villagerEntry = villagerEntry; }
import java.util.LinkedList; import java.util.List; import java.util.Random; import java.util.stream.Collectors; public class TradeList extends LinkedList<TradeList.Trade> { private static final Random r = new Random(); private static final IMerchant m = new FakeMerchant(); private VillagerEntry villagerEntry; public TradeList(VillagerEntry villagerEntry) { this.villagerEntry = villagerEntry; }
466
return this.stream().filter(trade -> trade.sellsItem(itemStack)).collect(Collectors.toCollection(() -> new TradeList(villagerEntry))); } public TradeList getSubListBuy(ItemStack itemStack) { return this.stream().filter(trade -> trade.buysItem(itemStack)).collect(Collectors.toCollection(() -> new TradeList(villagerEntry))); } <BUG>public TradeList getFocusedList(IFocus<ItemStack> focus) { switch (focus.getMode()) {</BUG> case INPUT: return getSubListBuy(focus.getValue()); case OUTPUT:
return this.stream().filter(trade -> trade.sellsItem(itemStack)).collect(Collectors.toCollection(() -> new TradeList(villagerEntry))); } public TradeList getSubListBuy(ItemStack itemStack) { return this.stream().filter(trade -> trade.buysItem(itemStack)).collect(Collectors.toCollection(() -> new TradeList(villagerEntry))); } public TradeList getFocusedList(IFocus<ItemStack> focus) { if (focus == null) { return this; } else { switch (focus.getMode()) { case INPUT: return getSubListBuy(focus.getValue()); case OUTPUT:
467
public boolean buysItem(ItemStack itemStack) { return this.buy1.isItemEqual(itemStack) || (this.buy2 != null && this.buy2.isItemEqual(itemStack)); } public ItemStack getMinBuyStack1() { ItemStack minBuyStack = this.buy1.copy(); <BUG>minBuyStack.stackSize = this.minBuy1; return minBuyStack;</BUG> } public ItemStack getMinBuyStack2() { if (this.buy2 == null) return null;
public boolean buysItem(ItemStack itemStack) { return this.buy1.isItemEqual(itemStack) || (this.buy2 != null && this.buy2.isItemEqual(itemStack)); } public ItemStack getMinBuyStack1() { ItemStack minBuyStack = this.buy1.copy(); minBuyStack.func_190920_e(this.minBuy1); return minBuyStack; } public ItemStack getMinBuyStack2() { if (this.buy2 == null) return null;
468
} @Override public void getIngredients(@Nonnull IIngredients ingredients) { ingredients.setOutputs(ItemStack.class, this.chest.getItemStacks(null)); } <BUG>@Nonnull @Override public List getOutputs() { return this.chest.getItemStacks(null); }</BUG> public int amountOfItems(IFocus<ItemStack> focus) {
} @Override public void getIngredients(@Nonnull IIngredients ingredients) { ingredients.setOutputs(ItemStack.class, this.chest.getItemStacks(null)); } public int amountOfItems(IFocus<ItemStack> focus) {
469
@Override <BUG>public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) { RenderHelper.renderChest(15, 20, -40, 20, getLidAngle()); } @Override public void onTooltip(int slotIndex, boolean input, ItemStack ingredient, List<String> tooltip) { </BUG> tooltip.add(this.chest.getChestDrop(ingredient).toString()); } private boolean done;
@Override public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { RenderHelper.renderChest(15, 20, -40, 20, getLidAngle()); Font.normal.print(TranslationHelper.translateToLocal(this.chest.getName()), 60, 7); Font.small.print(DungeonRegistry.getInstance().getNumStacks(this.chest), 60, 20); } @Override public void onTooltip(int slotIndex, boolean input, @Nonnull ItemStack ingredient, @Nonnull List<String> tooltip) { tooltip.add(this.chest.getChestDrop(ingredient).toString()); } private boolean done;
470
import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLivingBase; import net.minecraft.world.World; public abstract class CompatBase { public static World getWorld() { <BUG>World world = Minecraft.getMinecraft().theWorld; </BUG> if (world == null) { world = new FakeClientWorld(); }
import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLivingBase; import net.minecraft.world.World; public abstract class CompatBase { public static World getWorld() { World world = Minecraft.getMinecraft().world; if (world == null) { world = new FakeClientWorld(); }
471
import jeresources.entry.DungeonEntry; import jeresources.entry.MobEntry; import jeresources.entry.PlantEntry; import jeresources.entry.WorldGenEntry; import jeresources.util.LootTableHelper; <BUG>import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.monster.EntityGiantZombie; import net.minecraft.entity.monster.EntityGuardian; import net.minecraft.entity.passive.EntityBat;</BUG> import net.minecraft.entity.passive.EntitySquid;
import jeresources.entry.DungeonEntry; import jeresources.entry.MobEntry; import jeresources.entry.PlantEntry; import jeresources.entry.WorldGenEntry; import jeresources.util.LootTableHelper; import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.monster.EntityElderGuardian; import net.minecraft.entity.monster.EntityGiantZombie; import net.minecraft.entity.monster.EntityGuardian; import net.minecraft.entity.monster.EntityShulker; import net.minecraft.entity.passive.EntityBat; import net.minecraft.entity.passive.EntitySquid;
472
LootTableHelper.getAllMobLootTables(world).entrySet().stream() .map(entry -> new MobEntry(entry.getValue(), manager.getLootTableFromLocation(entry.getKey()))) .forEach(this::registerMob); registerMobRenderHook(EntityBat.class, RenderHooks.BAT); registerMobRenderHook(EntityDragon.class, RenderHooks.ENDER_DRAGON); <BUG>registerMobRenderHook(EntityGuardian.class, RenderHooks.ELDER_GUARDIAN); </BUG> registerMobRenderHook(EntitySquid.class, RenderHooks.SQUID); <BUG>registerMobRenderHook(EntityGiantZombie.class, RenderHooks.GIANT); }</BUG> private void registerDungeonLoot() {
LootTableHelper.getAllMobLootTables(world).entrySet().stream() .map(entry -> new MobEntry(entry.getValue(), manager.getLootTableFromLocation(entry.getKey()))) .forEach(this::registerMob); registerMobRenderHook(EntityBat.class, RenderHooks.BAT); registerMobRenderHook(EntityDragon.class, RenderHooks.ENDER_DRAGON); registerMobRenderHook(EntityElderGuardian.class, RenderHooks.ELDER_GUARDIAN); registerMobRenderHook(EntitySquid.class, RenderHooks.SQUID); registerMobRenderHook(EntityGiantZombie.class, RenderHooks.GIANT); registerMobRenderHook(EntityShulker.class, RenderHooks.SHULKER); } private void registerDungeonLoot() {
473
String name = DungeonRegistry.categoryToLocalKeyMap.get(this.name); return name == null ? this.name : name; } public List<ItemStack> getItemStacks(IFocus<ItemStack> focus) { return drops.stream().map(drop -> drop.item) <BUG>.filter(stack -> focus == null || focus.getValue() == null || ItemStack.areItemStacksEqual(ItemHandlerHelper.copyStackWithSize(stack, focus.getValue().stackSize), focus.getValue())) </BUG> .collect(Collectors.toList()); } public int getMaxStacks() {
String name = DungeonRegistry.categoryToLocalKeyMap.get(this.name); return name == null ? this.name : name; } public List<ItemStack> getItemStacks(IFocus<ItemStack> focus) { return drops.stream().map(drop -> drop.item) .filter(stack -> focus == null || ItemStack.areItemStacksEqual(ItemHandlerHelper.copyStackWithSize(stack, focus.getValue().func_190916_E()), focus.getValue())) .collect(Collectors.toList()); } public int getMaxStacks() {
474
package jeresources.compatibility.minecraft; import jeresources.api.render.IMobRenderHook; import net.minecraft.client.renderer.GlStateManager; <BUG>import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.monster.EntityGiantZombie; import net.minecraft.entity.monster.EntityGuardian; </BUG> import net.minecraft.entity.passive.EntityBat;
package jeresources.compatibility.minecraft; import jeresources.api.render.IMobRenderHook; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.monster.EntityElderGuardian; import net.minecraft.entity.monster.EntityGiantZombie; import net.minecraft.entity.monster.EntityShulker; import net.minecraft.entity.passive.EntityBat;
475
import net.minecraftforge.fml.common.ModMetadata; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; <BUG>@Mod(modid = Reference.ID, name = Reference.NAME, version = Reference.VERSION, guiFactory = "jeresources.gui.ModGuiFactory", dependencies = "required-after:JEI@[3.11.0,);", clientSideOnly = true) </BUG> public class JEResources { @Mod.Metadata(Reference.ID) public static ModMetadata metadata;
import net.minecraftforge.fml.common.ModMetadata; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLServerStartingEvent; @Mod(modid = Reference.ID, name = Reference.NAME, version = Reference.VERSION, guiFactory = "jeresources.gui.ModGuiFactory", dependencies = "required-after:jei@[4.0.0,);", clientSideOnly = true) public class JEResources { @Mod.Metadata(Reference.ID) public static ModMetadata metadata;
476
if (postAnalysisFilterScript != null) { if (Files.exists(Paths.get(postAnalysisFilterScript))) { ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByName("groovy"); Bindings bindings = scriptEngine.createBindings(); bindings.put("jApiClasses", jApiClasses); <BUG>try { Object returnValue = scriptEngine.eval(new FileReader(postAnalysisFilterScript), bindings); </BUG> if (returnValue instanceof List) { List returnedList = (List) returnValue;
if (postAnalysisFilterScript != null) { if (Files.exists(Paths.get(postAnalysisFilterScript))) { ScriptEngine scriptEngine = new ScriptEngineManager().getEngineByName("groovy"); Bindings bindings = scriptEngine.createBindings(); bindings.put("jApiClasses", jApiClasses); try (InputStreamReader fileReader = new InputStreamReader(new FileInputStream(postAnalysisFilterScript), Charset.forName("UTF-8"))) { Object returnValue = scriptEngine.eval(fileReader, bindings); if (returnValue instanceof List) { List returnedList = (List) returnValue;
477
throw new MojoFailureException("Post-analysis script does not return a list."); } } catch (ScriptException e) { throw new MojoFailureException("Execution of post-analysis script failed: " + e.getMessage(), e); } catch (FileNotFoundException e) { <BUG>throw new MojoFailureException("Post-analysis script '" + postAnalysisFilterScript + " does not exist."); }</BUG> } else { throw new MojoFailureException("Post-analysis script '" + postAnalysisFilterScript + " does not exist."); }
throw new MojoFailureException("Post-analysis script does not return a list."); } } catch (ScriptException e) { throw new MojoFailureException("Execution of post-analysis script failed: " + e.getMessage(), e); } catch (FileNotFoundException e) { throw new MojoFailureException("Post-analysis script '" + postAnalysisFilterScript + " does not exist."); } catch (IOException e) { throw new MojoFailureException("Failed to load post-analysis script '" + postAnalysisFilterScript + ": " + e.getMessage(), e); }
478
private String generateDiffOutput(List<JApiClass> jApiClasses, Options options) { StdoutOutputGenerator stdoutOutputGenerator = new StdoutOutputGenerator(options, jApiClasses); return stdoutOutputGenerator.generate(); } private XmlOutput generateXmlOutput(List<JApiClass> jApiClasses, File jApiCmpBuildDir, Options options, MavenParameters mavenParameters, PluginParameters pluginParameters) throws IOException, MojoFailureException { <BUG>String filename = createFilename(mavenParameters); options.setXmlOutputFile(Optional.of(jApiCmpBuildDir.getCanonicalPath() + File.separator + filename + ".xml")); options.setHtmlOutputFile(Optional.of(jApiCmpBuildDir.getCanonicalPath() + File.separator + filename + ".html")); SemverOut semverOut = new SemverOut(options, jApiClasses);</BUG> XmlOutputGeneratorOptions xmlOutputGeneratorOptions = new XmlOutputGeneratorOptions();
private String generateDiffOutput(List<JApiClass> jApiClasses, Options options) { StdoutOutputGenerator stdoutOutputGenerator = new StdoutOutputGenerator(options, jApiClasses); return stdoutOutputGenerator.generate(); } private XmlOutput generateXmlOutput(List<JApiClass> jApiClasses, File jApiCmpBuildDir, Options options, MavenParameters mavenParameters, PluginParameters pluginParameters) throws IOException, MojoFailureException { String filename = createFilename(mavenParameters); if (!skipXmlReport(pluginParameters)) { options.setXmlOutputFile(Optional.of(jApiCmpBuildDir.getCanonicalPath() + File.separator + filename + ".xml")); } if (!skipHtmlReport(pluginParameters)) { options.setHtmlOutputFile(Optional.of(jApiCmpBuildDir.getCanonicalPath() + File.separator + filename + ".html")); } SemverOut semverOut = new SemverOut(options, jApiClasses); XmlOutputGeneratorOptions xmlOutputGeneratorOptions = new XmlOutputGeneratorOptions();
479
} else { if (getLog().isDebugEnabled()) { getLog().debug("Element <dependencies/> found. Using " + JApiCli.ClassPathMode.ONE_COMMON_CLASSPATH); } for (Dependency dependency : pluginParameters.getDependenciesParam()) { <BUG>List<File> files = resolveDependencyToFile("dependencies", dependency, mavenParameters, true, pluginParameters); </BUG> for (File file : files) { comparatorOptions.getClassPathEntries().add(file.getAbsolutePath()); }
} else { if (getLog().isDebugEnabled()) { getLog().debug("Element <dependencies/> found. Using " + JApiCli.ClassPathMode.ONE_COMMON_CLASSPATH); } for (Dependency dependency : pluginParameters.getDependenciesParam()) { List<File> files = resolveDependencyToFile("dependencies", dependency, mavenParameters, true, pluginParameters, ConfigurationVersion.NEW); for (File file : files) { comparatorOptions.getClassPathEntries().add(file.getAbsolutePath()); }
480
Set<Artifact> dependencyArtifacts = mavenParameters.getMavenProject().getArtifacts(); Set<String> classPathEntries = new HashSet<>(); for (Artifact artifact : dependencyArtifacts) { String scope = artifact.getScope(); if (!"test".equals(scope) && !artifact.isOptional()) { <BUG>Set<Artifact> artifacts = resolveArtifact(artifact, mavenParameters, false, pluginParameters); </BUG> for (Artifact resolvedArtifact : artifacts) { File resolvedFile = resolvedArtifact.getFile(); if (resolvedFile != null) {
Set<Artifact> dependencyArtifacts = mavenParameters.getMavenProject().getArtifacts(); Set<String> classPathEntries = new HashSet<>(); for (Artifact artifact : dependencyArtifacts) { String scope = artifact.getScope(); if (!"test".equals(scope) && !artifact.isOptional()) { Set<Artifact> artifacts = resolveArtifact(artifact, mavenParameters, false, pluginParameters, configurationVersion); for (Artifact resolvedArtifact : artifacts) { File resolvedFile = resolvedArtifact.getFile(); if (resolvedFile != null) {
481
} for (String classPathEntry : classPathEntries) { comparatorOptions.getClassPathEntries().add(classPathEntry); } } <BUG>private List<File> retrieveFileFromConfiguration(DependencyDescriptor dependencyDescriptor, String parameterName, MavenParameters mavenParameters, PluginParameters pluginParameters) throws MojoFailureException { </BUG> List<File> files; if (dependencyDescriptor instanceof Dependency) { Dependency dependency = (Dependency) dependencyDescriptor;
} comparatorOptions.setClassPathMode(JarArchiveComparatorOptions.ClassPathMode.ONE_COMMON_CLASSPATH); } } }
482
throw new MojoFailureException("Missing configuration parameter 'dependency'."); } } throw new MojoFailureException(String.format("Missing configuration parameter: %s", parameterName)); } <BUG>private List<File> resolveConfigurationFileToFile(String parameterName, ConfigurationFile configurationFile) throws MojoFailureException { </BUG> String path = configurationFile.getPath(); if (path == null) { throw new MojoFailureException(String.format("The path element in the configuration of the plugin is missing for %s.", parameterName));
throw new MojoFailureException("Missing configuration parameter 'dependency'."); } } throw new MojoFailureException(String.format("Missing configuration parameter: %s", parameterName)); } private List<File> resolveConfigurationFileToFile(String parameterName, ConfigurationFile configurationFile, ConfigurationVersion configurationVersion, PluginParameters pluginParameters) throws MojoFailureException { String path = configurationFile.getPath(); if (path == null) { throw new MojoFailureException(String.format("The path element in the configuration of the plugin is missing for %s.", parameterName));
483
String path = configurationFile.getPath(); if (path == null) { throw new MojoFailureException(String.format("The path element in the configuration of the plugin is missing for %s.", parameterName)); } File file = new File(path); <BUG>if (!file.exists()) { throw new MojoFailureException(String.format("The path '%s' does not point to an existing file.", path)); } if (!file.isFile() || !file.canRead()) { throw new MojoFailureException(String.format("The file given by path '%s' is either not a file or is not readable.", path)); } return Collections.singletonList(file);</BUG> }
String path = configurationFile.getPath(); if (path == null) { throw new MojoFailureException(String.format("The path element in the configuration of the plugin is missing for %s.", parameterName));
484
throw new MojoFailureException(String.format("The file given by path '%s' is either not a file or is not readable.", path)); } return Collections.singletonList(file);</BUG> } <BUG>private List<File> resolveDependencyToFile(String parameterName, Dependency dependency, MavenParameters mavenParameters, boolean transitively, PluginParameters pluginParameters) throws MojoFailureException { </BUG> List<File> files = new ArrayList<>(); if (getLog().isDebugEnabled()) { getLog().debug("Trying to resolve dependency '" + dependency + "' to file."); }
throw new MojoFailureException(String.format("The file given by path '%s' is either not a file or is not readable.", path)); } } return Collections.singletonList(file); } private List<File> resolveDependencyToFile(String parameterName, Dependency dependency, MavenParameters mavenParameters, boolean transitively, PluginParameters pluginParameters, ConfigurationVersion configurationVersion) throws MojoFailureException { List<File> files = new ArrayList<>(); if (getLog().isDebugEnabled()) { getLog().debug("Trying to resolve dependency '" + dependency + "' to file."); }
485
getLog().debug("Trying to resolve dependency '" + dependency + "' to file."); } if (dependency.getSystemPath() == null) { String descriptor = dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion(); getLog().debug(parameterName + ": " + descriptor); <BUG>Set<Artifact> artifacts = resolveArtifact(dependency, mavenParameters, transitively, pluginParameters); </BUG> for (Artifact artifact : artifacts) { File file = artifact.getFile(); if (file != null) {
getLog().debug("Trying to resolve dependency '" + dependency + "' to file."); } if (dependency.getSystemPath() == null) { String descriptor = dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion(); getLog().debug(parameterName + ": " + descriptor); Set<Artifact> artifacts = resolveArtifact(dependency, mavenParameters, transitively, pluginParameters, configurationVersion); for (Artifact artifact : artifacts) { File file = artifact.getFile(); if (file != null) {
486
throw new MojoFailureException(String.format("Could not resolve dependency with descriptor '%s'.", descriptor)); } } if (files.size() == 0) { String message = String.format("Could not resolve dependency with descriptor '%s'.", descriptor); <BUG>if (ignoreNonResolvableArtifacts(pluginParameters)) { getLog().warn(message);</BUG> } else { throw new MojoFailureException(message); }
throw new MojoFailureException(String.format("Could not resolve dependency with descriptor '%s'.", descriptor)); } } if (files.size() == 0) { String message = String.format("Could not resolve dependency with descriptor '%s'.", descriptor); if (ignoreNonResolvableArtifacts(pluginParameters) || ignoreMissingOldVersion(pluginParameters, configurationVersion)) { getLog().warn(message); } else { throw new MojoFailureException(message);
487
Artifact artifact = mavenParameters.getArtifactFactory().createArtifactWithClassifier(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), dependency.getType(), dependency.getClassifier()); <BUG>return resolveArtifact(artifact, mavenParameters, transitively, pluginParameters); </BUG> } <BUG>private Set<Artifact> resolveArtifact(Artifact artifact, MavenParameters mavenParameters, boolean transitively, PluginParameters pluginParameters) throws MojoFailureException { </BUG> notNull(mavenParameters.getLocalRepository(), "Maven parameter localRepository should be provided by maven container."); notNull(mavenParameters.getArtifactResolver(), "Maven parameter artifactResolver should be provided by maven container."); ArtifactResolutionRequest request = new ArtifactResolutionRequest(); request.setArtifact(artifact);
Artifact artifact = mavenParameters.getArtifactFactory().createArtifactWithClassifier(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), dependency.getType(), dependency.getClassifier()); return resolveArtifact(artifact, mavenParameters, transitively, pluginParameters, configurationVersion); } private Set<Artifact> resolveArtifact(Artifact artifact, MavenParameters mavenParameters, boolean transitively, PluginParameters pluginParameters, ConfigurationVersion configurationVersion) throws MojoFailureException { notNull(mavenParameters.getLocalRepository(), "Maven parameter localRepository should be provided by maven container."); notNull(mavenParameters.getArtifactResolver(), "Maven parameter artifactResolver should be provided by maven container."); ArtifactResolutionRequest request = new ArtifactResolutionRequest(); request.setArtifact(artifact);
488
JApiMethod jApiMethod = getJApiMethod(jApiClass.getMethods(), "method"); assertThat(jApiMethod.getCompatibilityChanges().size(), is(0)); assertThat(jApiMethod.isBinaryCompatible(), is(true)); assertThat(jApiMethod.isSourceCompatible(), is(true)); } <BUG>@Test public void testClassNowCheckedException() throws Exception {</BUG> JarArchiveComparatorOptions options = new JarArchiveComparatorOptions(); options.setAccessModifier(AccessModifier.PRIVATE); List<JApiClass> jApiClasses = ClassesHelper.compareClasses(options, new ClassesHelper.ClassesGenerator() {
JApiMethod jApiMethod = getJApiMethod(jApiClass.getMethods(), "method"); assertThat(jApiMethod.getCompatibilityChanges(), hasItem(JApiCompatibilityChange.METHOD_ADDED_TO_INTERFACE)); assertThat(jApiMethod.isBinaryCompatible(), is(true)); assertThat(jApiMethod.isSourceCompatible(), is(false)); } @Test public void testAbstractClassNowExtendsAnotherAbstractClass() throws Exception { JarArchiveComparatorOptions options = new JarArchiveComparatorOptions(); options.setIncludeSynthetic(true); options.setAccessModifier(AccessModifier.PRIVATE); List<JApiClass> jApiClasses = ClassesHelper.compareClasses(options, new ClassesHelper.ClassesGenerator() {
489
package com.example.mapdemo; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; <BUG>import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Polygon;</BUG> import com.google.android.gms.maps.model.PolygonOptions; import android.graphics.Color;
package com.example.mapdemo; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.Dash; import com.google.android.gms.maps.model.Dot; import com.google.android.gms.maps.model.Gap; import com.google.android.gms.maps.model.JointType; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.PatternItem; import com.google.android.gms.maps.model.Polygon; import com.google.android.gms.maps.model.PolygonOptions; import android.graphics.Color;
490
package jetbrains.mps.baseLanguage.behavior; import jetbrains.mps.smodel.SNode; import java.util.Set; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; <BUG>import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.internal.collections.runtime.SetSequence;</BUG> public class ThrowStatement_Behavior { public static void init(SNode thisNode) { }
package jetbrains.mps.baseLanguage.behavior; import jetbrains.mps.smodel.SNode; import java.util.Set; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.typesystem.inference.TypeChecker; import jetbrains.mps.internal.collections.runtime.SetSequence; public class ThrowStatement_Behavior { public static void init(SNode thisNode) { }
491
Range nod = nodata; <BUG>Double destNod = null; </BUG> if (backgroundValues != null && backgroundValues.length > 0) { <BUG>destNod = backgroundValues[0]; }</BUG> if (interp instanceof InterpolationBilinear) { interpB = (InterpolationBilinear) interp; this.interp = interpB; interpB.setROIdata(roiBounds, roiIter);
Range nod = nodata; double[] destNod = null; if (backgroundValues != null && backgroundValues.length > 0) { destNod = backgroundValues; } if (interp instanceof InterpolationBilinear) { interpB = (InterpolationBilinear) interp; this.interp = interpB; interpB.setROIdata(roiBounds, roiIter);
492
interpB.setROIdata(roiBounds, roiIter); if (nod == null) { nod = interpB.getNoDataRange(); } if (destNod == null) { <BUG>destNod = interpB.getDestinationNoData(); </BUG> } } if (nod != null) {
interpB.setROIdata(roiBounds, roiIter); if (nod == null) { nod = interpB.getNoDataRange(); } if (destNod == null) { destNod = new double[]{interpB.getDestinationNoData()}; } } if (nod != null) {
493
} else { <BUG>byteLookupTable[i] = 0; </BUG> if(i !=0){ <BUG>byteLookupTable[0] = 1; </BUG> } } } else { <BUG>byteLookupTable[i] = value; </BUG> }
} else { byteLookupTable[b][i] = 0; if(i !=0){ byteLookupTable[b][0] = 1; } } } else { byteLookupTable[b][i] = value;
494
s_ix = startPts[0].x; s_iy = startPts[0].y; if (setDestinationNoData) { for (int x = dst_min_x; x < clipMinX; x++) { for (int k2 = 0; k2 < dst_num_bands; k2++) <BUG>dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte; </BUG> dstPixelOffset += dstPixelStride; } } else
s_ix = startPts[0].x; s_iy = startPts[0].y; if (setDestinationNoData) { for (int x = dst_min_x; x < clipMinX; x++) { for (int k2 = 0; k2 < dst_num_bands; k2++) dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte[k2]; dstPixelOffset += dstPixelStride; } } else
495
dstPixelOffset += dstPixelStride; } if (setDestinationNoData && clipMinX <= clipMaxX) { for (int x = clipMaxX; x < dst_max_x; x++) { for (int k2 = 0; k2 < dst_num_bands; k2++) <BUG>dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte; </BUG> dstPixelOffset += dstPixelStride; } }
dstPixelOffset += dstPixelStride; } if (setDestinationNoData && clipMinX <= clipMaxX) { for (int x = clipMaxX; x < dst_max_x; x++) { for (int k2 = 0; k2 < dst_num_bands; k2++) dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte[k2]; dstPixelOffset += dstPixelStride; } }
496
s_ix = startPts[0].x; s_iy = startPts[0].y; if (setDestinationNoData) { for (int x = dst_min_x; x < clipMinX; x++) { for (int k2 = 0; k2 < dst_num_bands; k2++) <BUG>dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte; </BUG> dstPixelOffset += dstPixelStride; } } else
s_ix = startPts[0].x; s_iy = startPts[0].y; if (setDestinationNoData) { for (int x = dst_min_x; x < clipMinX; x++) { for (int k2 = 0; k2 < dst_num_bands; k2++) dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte[k2]; dstPixelOffset += dstPixelStride; } } else
497
final int w10 = roiIter.getSample(x0, y0 + 1, 0) & 0xff; final int w11 = roiIter.getSample(x0 + 1, y0 + 1, 0) & 0xff; if (w00 == 0 && w01 == 0 && w10 == 0 && w11 == 0) { if (setDestinationNoData) { for (int k2 = 0; k2 < dst_num_bands; k2++) { <BUG>dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte; </BUG> } } } else {
final int w10 = roiIter.getSample(x0, y0 + 1, 0) & 0xff; final int w11 = roiIter.getSample(x0 + 1, y0 + 1, 0) & 0xff; if (w00 == 0 && w01 == 0 && w10 == 0 && w11 == 0) { if (setDestinationNoData) { for (int k2 = 0; k2 < dst_num_bands; k2++) { dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte[k2]; } } } else {
498
dstPixelOffset += dstPixelStride; } if (setDestinationNoData && clipMinX <= clipMaxX) { for (int x = clipMaxX; x < dst_max_x; x++) { for (int k2 = 0; k2 < dst_num_bands; k2++) <BUG>dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte; </BUG> dstPixelOffset += dstPixelStride; } }
dstPixelOffset += dstPixelStride; } if (setDestinationNoData && clipMinX <= clipMaxX) { for (int x = clipMaxX; x < dst_max_x; x++) { for (int k2 = 0; k2 < dst_num_bands; k2++) dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte[k2]; dstPixelOffset += dstPixelStride; } }
499
for (int k2 = 0; k2 < dst_num_bands; k2++) { int s00 = srcDataArrays[k2][posx + posy + bandOffsets[k2]]; int s01 = srcDataArrays[k2][posxhigh + posy + bandOffsets[k2]]; int s10 = srcDataArrays[k2][posx + posyhigh + bandOffsets[k2]]; int s11 = srcDataArrays[k2][posxhigh + posyhigh + bandOffsets[k2]]; <BUG>int w00 = byteLookupTable[s00&0xFF] == destinationNoDataByte ? 0 : 1; int w01 = byteLookupTable[s01&0xFF] == destinationNoDataByte ? 0 : 1; int w10 = byteLookupTable[s10&0xFF] == destinationNoDataByte ? 0 : 1; int w11 = byteLookupTable[s11&0xFF] == destinationNoDataByte ? 0 : 1; </BUG> if (w00 == 0 && w01 == 0 && w10 == 0 && w11 == 0) {
for (int k2 = 0; k2 < dst_num_bands; k2++) { int s00 = srcDataArrays[k2][posx + posy + bandOffsets[k2]]; int s01 = srcDataArrays[k2][posxhigh + posy + bandOffsets[k2]]; int s10 = srcDataArrays[k2][posx + posyhigh + bandOffsets[k2]]; int s11 = srcDataArrays[k2][posxhigh + posyhigh + bandOffsets[k2]]; int w00 = byteLookupTable[k2][s00&0xFF] == destinationNoDataByte[k2] ? 0 : 1; int w01 = byteLookupTable[k2][s01&0xFF] == destinationNoDataByte[k2] ? 0 : 1; int w10 = byteLookupTable[k2][s10&0xFF] == destinationNoDataByte[k2] ? 0 : 1; int w11 = byteLookupTable[k2][s11&0xFF] == destinationNoDataByte[k2] ? 0 : 1; if (w00 == 0 && w01 == 0 && w10 == 0 && w11 == 0) {
500
dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = (byte) (intResult & 0xff); } } } else if (setDestinationNoData) { for (int k2 = 0; k2 < dst_num_bands; k2++) { <BUG>dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte; </BUG> } } if (fracx < fracdx1) {
dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = (byte) (intResult & 0xff); } } } else if (setDestinationNoData) { for (int k2 = 0; k2 < dst_num_bands; k2++) { dstDataArrays[k2][dstPixelOffset + dstBandOffsets[k2]] = destinationNoDataByte[k2]; } } if (fracx < fracdx1) {