id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
2,301
isClosed = true; exService.shutdown(); try { exService.awaitTermination(Integer.MAX_VALUE, TimeUnit.SECONDS); } catch (InterruptedException e) { <BUG>LOGGER.log(LogLevel.WARN, "Execution Service shutdown is interrupted.", e); }finally {</BUG> flushNow(); out.close(); bufferQueue.clear();
LOGGER.log(LogLevel.WARN, Messages.getString("HDFS_ASYNC_SERVICE_SHUTDOWN_INTERRUPTED"), e); }finally {
2,302
import org.springframework.stereotype.Service; @Service @Scope("singleton") public class XGroupUserService extends XGroupUserServiceBase<XXGroupUser, VXGroupUser> { <BUG>public static Long createdByUserId = 1L; @Autowired</BUG> RangerDaoManager rangerDaoManager; @Autowired RangerEnumUtil xaEnumUtil;
private final Long createdByUserId;
2,303
public XGroupUserService() { searchFields.add(new SearchField("xUserId", "obj.userId", SearchField.DATA_TYPE.INTEGER, SearchField.SEARCH_TYPE.FULL)); searchFields.add(new SearchField("xGroupId", "obj.parentGroupId", SearchField.DATA_TYPE.INTEGER, SearchField.SEARCH_TYPE.FULL)); <BUG>createdByUserId = Long.valueOf(PropertiesUtil.getIntProperty("ranger.xuser.createdByUserId", 1)); </BUG> } @Override protected void validateForCreate(VXGroupUser vObj) {
createdByUserId = PropertiesUtil.getLongProperty("ranger.xuser.createdByUserId", 1);
2,304
import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @Service @Scope("singleton") public class XGroupService extends XGroupServiceBase<XXGroup, VXGroup> { <BUG>public static Long createdByUserId = 1L; @Autowired</BUG> RangerDaoManager rangerDaoManager; @Autowired RangerEnumUtil xaEnumUtil;
private final Long createdByUserId;
2,305
SearchField.DATA_TYPE.STRING, SearchField.SEARCH_TYPE.PARTIAL)); searchFields.add(new SearchField("groupSource", "obj.groupSource", SearchField.DATA_TYPE.STRING, SearchField.SEARCH_TYPE.FULL)); searchFields.add(new SearchField("isVisible", "obj.isVisible", SearchField.DATA_TYPE.INTEGER, SearchField.SEARCH_TYPE.FULL )); <BUG>createdByUserId = Long.valueOf(PropertiesUtil.getIntProperty("ranger.xuser.createdByUserId", 1)); </BUG> sortFields.add(new SortField("name", "obj.name",true,SortField.SORT_ORDER.ASC)); } @Override
createdByUserId = PropertiesUtil.getLongProperty("ranger.xuser.createdByUserId", 1);
2,306
import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @Service @Scope("singleton") public class XUserService extends XUserServiceBase<XXUser, VXUser> { <BUG>public static Long createdByUserId = 1L; @Autowired</BUG> RangerDaoManager daoManager; @Autowired XPermMapService xPermMapService;
private final Long createdByUserId;
2,307
return new String[0]; } } public static Integer getIntProperty(String key, int defaultValue) { if (key == null) { <BUG>return null; }</BUG> String rtrnVal = propertiesMap.get(key); if (rtrnVal == null) { return defaultValue;
[DELETED]
2,308
package model; import model.battlefield.Battlefield; import model.battlefield.BattlefieldFactory; <BUG>import model.battlefield.map.parcel.ParcelManager; import model.builders.entity.definitions.DefParser;</BUG> import event.BattleFieldUpdateEvent; import event.EventManager; import geometry.tools.LogUtil;
import model.builders.MapArtisan; import model.builders.entity.definitions.DefParser;
2,309
private static void setBattlefield(Battlefield battlefield) { if (battlefield != null) { ModelManager.battlefield = battlefield; battlefieldReady = true; ParcelManager.createParcelMeshes(ModelManager.getBattlefield().getMap()); <BUG>getBattlefield().getMap().resetTrinkets(); getBattlefield().getEngagement().reset();</BUG> EventManager.post(new BattleFieldUpdateEvent()); LogUtil.logger.info("Done."); }
MapArtisan.act(getBattlefield().getMap()); getBattlefield().getEngagement().reset();
2,310
package controller.editor; <BUG>import model.ModelManager; import model.battlefield.lighting.SunLight;</BUG> import model.editor.ToolManager; import com.jme3.input.InputManager; import com.jme3.input.KeyInput;
import model.Reporter; import model.battlefield.lighting.SunLight;
2,311
protected final static String DEC_GREEN = "decgreen"; protected final static String DEC_BLUE = "decblue"; protected final static String RESET_COLOR = "resetcolor"; protected final static String SAVE = "save"; protected final static String LOAD = "load"; <BUG>protected final static String NEW = "new"; boolean analogUnpressed = false;</BUG> EditorInputInterpreter(EditorController controller) { super(controller); controller.spatialSelector.centered = false;
protected final static String REPORT = "report"; boolean analogUnpressed = false;
2,312
mappings = new String[] { SWITCH_CTRL_1, SWITCH_CTRL_2, SWITCH_CTRL_3, PRIMARY_ACTION, SECONDARY_ACTION, TOGGLE_PENCIL_SHAPE, TOGGLE_PENCIL_MODE, INC_SELECTOR_RADIUS, DEC_SELECTOR_RADIUS, SET_CLIFF_TOOL, SET_HEIGHT_TOOL, SET_ATLAS_TOOL, SET_RAMP_TOOL, SET_UNIT_TOOL, TOGGLE_GRID, TOGGLE_SOWER, TOGGLE_SET, TOGGLE_OPERATION, INC_AIRBRUSH_FALLOF, DEC_AIRBRUSH_FALLOF, TOGGLE_LIGHT_COMP, INC_DAYTIME, DEC_DAYTIME, COMPASS_EAST, COMPASS_WEST, INC_INTENSITY, DEC_INTENSITY, TOGGLE_SPEED, DEC_RED, DEC_GREEN, <BUG>DEC_BLUE, RESET_COLOR, SAVE, LOAD, NEW, }; </BUG> } @Override protected void registerInputs(InputManager inputManager) {
DEC_BLUE, RESET_COLOR, SAVE, LOAD, NEW, REPORT};
2,313
inputManager.addMapping(DEC_GREEN, new KeyTrigger(KeyInput.KEY_NUMPAD2)); inputManager.addMapping(DEC_BLUE, new KeyTrigger(KeyInput.KEY_NUMPAD3)); inputManager.addMapping(RESET_COLOR, new KeyTrigger(KeyInput.KEY_NUMPAD0)); inputManager.addMapping(SAVE, new KeyTrigger(KeyInput.KEY_F5)); inputManager.addMapping(LOAD, new KeyTrigger(KeyInput.KEY_F9)); <BUG>inputManager.addMapping(NEW, new KeyTrigger(KeyInput.KEY_F12)); inputManager.addListener(this, mappings);</BUG> } @Override protected void unregisterInputs(InputManager inputManager) {
inputManager.addMapping(REPORT, new KeyTrigger(KeyInput.KEY_SPACE)); inputManager.addListener(this, mappings);
2,314
case LOAD: ModelManager.loadBattlefield(); break; case NEW: ModelManager.setNewBattlefield(); <BUG>break; }</BUG> ctrl.guiController.askRedraw(); } }
case REPORT: Reporter.reportAll();
2,315
List<MapStyleBuilder> builders = BuilderManager.getAllMapStyleBuilders(); List<String> ids = new ArrayList<>(); for (MapStyleBuilder b : builders) { ids.add(b.getId()); } <BUG>int selIndex = ids.indexOf(ModelManager.getBattlefield().getMap().mapStyleID); </BUG> fillDropDown(DROPDOWN_STYLE_ID, ids, selIndex); } private void drawPencilPanel() {
int selIndex = ids.indexOf(ModelManager.getBattlefield().getMap().getMapStyleID());
2,316
<BUG>package geometry.structure.grid; public class Node { protected final int index; protected final Grid<? extends Node> grid; public Node(Grid<? extends Node> grid, int index) {</BUG> this.grid = grid;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @JsonProperty @JsonIgnore protected Grid<? extends Node> grid; public Node(Grid<? extends Node> grid, int index) {
2,317
package geometry.structure.grid; import geometry.collections.Map2D; import geometry.geom2d.Point2D; import java.util.ArrayList; import java.util.List; <BUG>public class Grid<T extends Node> extends Map2D<T> { public Grid(int width, int height) {</BUG> super(width, height); } public T getNorthNode(T n){
public Grid(){ super(); public Grid(int width, int height) {
2,318
import geometry.geom2d.Point2D; import geometry.geom3d.Point3D; import geometry.geom3d.Triangle3D; import geometry.math.Angle; import geometry.structure.grid.Grid; <BUG>public class Grid3D<T extends Node3D> extends Grid<T> { public Grid3D(int width, int height) {</BUG> super(width, height); } private Triangle3D getTriangleAt(Point2D coord) {
public Grid3D(){ super(); public Grid3D(int width, int height) {
2,319
import java.util.ArrayList; import java.util.List; public class Map2D<E> { private List<E> values; protected int xSize; <BUG>protected int ySize; public Map2D(int xSize, int ySize) {</BUG> this(xSize, ySize, null); } public Map2D(int xSize, int ySize, E defaultVal) {
public Map2D(){ public Map2D(int xSize, int ySize) {
2,320
} public Map2D(int xSize, int ySize, E defaultVal) { this.xSize = xSize; this.ySize = ySize; values = new ArrayList<>(xSize*ySize); <BUG>setAll(defaultVal); </BUG> } public void set(int index, E val) { values.set(index, val);
public Map2D(int xSize, int ySize) { this(xSize, ySize, null); setAllAs(defaultVal);
2,321
return x >= 0 && x < xSize && y >= 0 && y < ySize; } public boolean isInBounds(Point2D p){ return isInBounds((int)p.x, (int)p.y); } <BUG>public void setAll(E value){ </BUG> values.clear(); for (int i = 0; i < xSize*ySize; i++) values.add(value);
private void setAllAs(E value){
2,322
values.clear(); for (int i = 0; i < xSize*ySize; i++) values.add(value); } public List<E> getAll(){ <BUG>return values; }</BUG> public int getIndex(int x, int y){ return y*xSize+x; }
protected void setAll(List<E> values){ this.values = values;
2,323
import model.ModelManager; import model.battlefield.map.Map; import model.battlefield.map.Tile; import model.battlefield.map.cliff.Cliff; import model.battlefield.map.cliff.Ramp; <BUG>import model.battlefield.map.parcel.ParcelManager; import model.builders.entity.MapStyleBuilder;</BUG> import model.builders.entity.definitions.BuilderManager; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature;
import model.builders.MapArtisan; import model.builders.entity.MapStyleBuilder;
2,324
} } LogUtil.logger.info(" map builders");</BUG> Battlefield res = new Battlefield(); <BUG>res.setMap(m); LogUtil.logger.info("Loading done.");</BUG> return res; } public Battlefield loadWithFileChooser() { final JFileChooser fc = new JFileChooser(ModelManager.DEFAULT_MAP_PATH);
public Battlefield getNew(int width, int height) { LogUtil.logger.info("Creating new battlefield..."); MapArtisan.buildMap(res); LogUtil.logger.info("Loading done.");
2,325
try { LogUtil.logger.info("Loading battlefield " + file.getCanonicalPath() + "..."); ObjectMapper mapper = new ObjectMapper(); // can reuse, share globally bField = mapper.readValue(file, Battlefield.class); bField.setFileName(file.getCanonicalPath()); <BUG>bField.getMap().atlas.finalize(); bField.getMap().cover.finalize();</BUG> } catch (Exception e1) { e1.printStackTrace(); }
[DELETED]
2,326
@Nullable <T> ModelView<? extends T> asReadOnly(ModelType<T> type, @Nullable ModelRuleDescriptor ruleDescriptor); MutableModelNode addLink(String name, ModelRuleDescriptor descriptor, ModelPromise promise, ModelAdapter adapter); MutableModelNode addLink(ModelCreator creator); void removeLink(String name); <BUG><T> void mutateAllLinks(MutationType type, ModelMutator<T> mutator); @Nullable</BUG> MutableModelNode getLink(String name); boolean hasLink(String name); <T> void setPrivateData(ModelType<T> type, T object);
<T> ModelView<? extends T> asWritable(ModelType<T> type, ModelRuleDescriptor ruleDescriptor, @Nullable Inputs inputs); <T> void mutateLink(MutationType type, ModelMutator<T> mutator);
2,327
import org.gradle.model.internal.type.ModelType; import java.util.Collections; import java.util.Map; public class ModelNode implements ModelCreation { public enum State { <BUG>Known, Created, Mutated, SelfClosed, GraphClosed }</BUG> private final ModelPath creationPath; private final ModelRuleDescriptor descriptor; private final ModelPromise promise;
Known, Created, SelfClosed, GraphClosed }
2,328
throw new IllegalStateException("Don't know how to create model element at '" + path + "'"); } doCreate(node, creator); node.setState(ModelNode.State.Created); } <BUG>if (node.getState() == ModelNode.State.Created) { fireMutations(node, path, mutators.removeAll(new MutationKey(path, MutationType.Mutate)), usedMutators); node.setState(ModelNode.State.Mutated); } if (node.getState() == ModelNode.State.Mutated) {</BUG> fireMutations(node, path, mutators.removeAll(new MutationKey(path, MutationType.Finalize)), usedMutators);
fireMutations(node, path, mutators.removeAll(new MutationKey(path, MutationType.Defaults)), usedMutators); fireMutations(node, path, mutators.removeAll(new MutationKey(path, MutationType.Initialize)), usedMutators);
2,329
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.util.Progressable; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AFileSystem extends FileSystem {</BUG> private URI uri; private Path workingDir; private AmazonS3Client s3;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AFileSystem extends FileSystem {
2,330
public void initialize(URI name, Configuration conf) throws IOException { super.initialize(name, conf); uri = URI.create(name.getScheme() + "://" + name.getAuthority()); workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri, this.getWorkingDirectory()); <BUG>String accessKey = conf.get(ACCESS_KEY, null); String secretKey = conf.get(SECRET_KEY, null); </BUG> String userInfo = name.getUserInfo();
String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null)); String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
2,331
} else { accessKey = userInfo; } } AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain( <BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey), new InstanceProfileCredentialsProvider(), new S3AAnonymousAWSCredentialsProvider() );</BUG> bucket = name.getHost();
new BasicAWSCredentialsProvider(accessKey, secretKey), new AnonymousAWSCredentialsProvider()
2,332
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)); </BUG> s3 = new AmazonS3Client(credentials, awsConf); <BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS); partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (partSize < 5 * 1024 * 1024) {
new InstanceProfileCredentialsProvider(), new AnonymousAWSCredentialsProvider() bucket = name.getHost(); ClientConfiguration awsConf = new ClientConfiguration(); awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS))); awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP); awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES))); awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT))); maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS)); partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE)); partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
2,333
cannedACL = null; } if (!s3.doesBucketExist(bucket)) { throw new IOException("Bucket " + bucket + " does not exist"); } <BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART); long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE); </BUG> if (purgeExistingMultipart) {
boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART)); long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
2,334
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AOutputStream extends OutputStream {</BUG> private OutputStream backupStream; private File backupFile; private boolean closed;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AOutputStream extends OutputStream {
2,335
this.client = client; this.progress = progress; this.fs = fs; this.cannedACL = cannedACL; this.statistics = statistics; <BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (conf.get(BUFFER_DIR, null) != null) {
partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
2,336
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> {
2,337
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);
2,338
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;
2,339
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]
2,340
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]
2,341
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);
2,342
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);
2,343
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]
2,344
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)
2,345
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(() -> {
2,346
package org.springframework.integration.file.dsl; <BUG>import java.io.File; import java.util.Comparator; import org.springframework.beans.factory.BeanCreationException; import org.springframework.integration.dsl.MessageSourceSpec; import org.springframework.integration.file.DirectoryScanner;</BUG> import org.springframework.integration.file.FileLocker;
import java.util.Collection; import java.util.Collections; import java.util.function.Function; import org.springframework.integration.dsl.ComponentsRegistration; import org.springframework.integration.expression.FunctionExpression; import org.springframework.integration.file.DirectoryScanner;
2,347
import org.springframework.integration.file.filters.RegexPatternFileListFilter; import org.springframework.integration.file.filters.SimplePatternFileListFilter; import org.springframework.integration.file.locking.NioFileLocker; import org.springframework.util.Assert; public class FileInboundChannelAdapterSpec <BUG>extends MessageSourceSpec<FileInboundChannelAdapterSpec, FileReadingMessageSource> { private final FileListFilterFactoryBean fileListFilterFactoryBean = new FileListFilterFactoryBean(); private FileLocker locker; FileInboundChannelAdapterSpec() {</BUG> this.target = new FileReadingMessageSource();
extends MessageSourceSpec<FileInboundChannelAdapterSpec, FileReadingMessageSource> implements ComponentsRegistration { private ExpressionFileListFilter<File> expressionFileListFilter; FileInboundChannelAdapterSpec() {
2,348
import org.w3c.dom.Element; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.integration.config.xml.AbstractConsumerEndpointParser; <BUG>import org.springframework.integration.config.xml.IntegrationNamespaceUtils; import org.springframework.integration.file.filters.RegexPatternFileListFilter;</BUG> import org.springframework.integration.file.filters.SimplePatternFileListFilter; import org.springframework.integration.file.remote.RemoteFileOperations; import org.springframework.util.StringUtils;
import org.springframework.integration.file.filters.ExpressionFileListFilter; import org.springframework.integration.file.filters.RegexPatternFileListFilter;
2,349
import org.w3c.dom.Element; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.integration.config.xml.IntegrationNamespaceUtils; <BUG>import org.springframework.integration.file.DefaultFileNameGenerator; import org.springframework.integration.file.filters.FileListFilter;</BUG> import org.springframework.integration.file.remote.RemoteFileOperations; import org.springframework.util.StringUtils; public final class FileParserUtils {
import org.springframework.integration.file.filters.ExpressionFileListFilter; import org.springframework.integration.file.filters.FileListFilter;
2,350
package org.springframework.integration.file.dsl; <BUG>import java.io.File; import java.util.Collection; import java.util.Collections; </BUG> import java.util.function.Function;
import java.util.ArrayList; import java.util.List;
2,351
if (this.filter == null) { if (filter instanceof CompositeFileListFilter) { this.filter = (CompositeFileListFilter<F>) filter; } else { <BUG>this.filter = new CompositeFileListFilter<F>(); this.filter.addFilter(filter);</BUG> } this.synchronizer.setFilter(this.filter); }
this.filter = new CompositeFileListFilter<>(); this.filter.addFilter(filter);
2,352
import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionReaderUtils; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.integration.config.xml.AbstractPollingInboundChannelAdapterParser; <BUG>import org.springframework.integration.config.xml.IntegrationNamespaceUtils; import org.springframework.integration.file.locking.NioFileLocker;</BUG> import org.springframework.util.StringUtils; import org.springframework.util.xml.DomUtils; public class FileInboundChannelAdapterParser extends AbstractPollingInboundChannelAdapterParser {
import org.springframework.integration.file.filters.ExpressionFileListFilter; import org.springframework.integration.file.locking.NioFileLocker;
2,353
package com.easytoolsoft.easyreport.web.controller.common; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping(value = "/error") <BUG>public class ErrorController extends AbstractController { @RequestMapping(value = {"/404"})</BUG> public String error404() { return "/error/404"; }
public class ErrorController { @RequestMapping(value = {"/404"})
2,354
public void setJumpTo(int jumpTo) { myJumpTo = jumpTo; } public void buildEdges() { super.buildEdges(); <BUG>addEdgeTo(getProgram().getInstructions().get(myJumpTo)); }</BUG> String commandPresentation() { return "ifjump " + myJumpTo; }
addEdgeTo(getProgram().get(myJumpTo));
2,355
package jetbrains.mps.dataFlow.framework.instructions; import java.util.List; public class RetInstruction extends Instruction { public RetInstruction() { } <BUG>public void buildEdges() { List<Instruction> instructions = getProgram().getInstructions(); addEdgeTo(instructions.get(instructions.size() - 1));</BUG> } String commandPresentation() {
addEdgeTo(getProgram().end());
2,356
public Map<Instruction, E> getMap() { return Collections.unmodifiableMap(myResult); } public String toString() { StringBuilder r = new StringBuilder(); <BUG>for (int i = 0; i < myProgram.getInstructions().size(); i++) { Instruction instruction = myProgram.getInstructions().get(i); r.append(instruction).append(" ");</BUG> r.append(toString(myResult.get(instruction))); r.append("\n");
for (int i = 0; i < myProgram.size(); i++) { Instruction instruction = myProgram.get(i); r.append(instruction).append(" ");
2,357
private String getSubject(MessageContext msgCtxt) throws Exception { String subject = (String) this.properties.get("subject"); if (subject == null || subject.equals("")) { return null; // subject is OPTIONAL } <BUG>subject = resolvePropertyValue(subject, msgCtxt); </BUG> if (subject == null || subject.equals("")) { return null; // subject is OPTIONAL }
subject = (String) resolvePropertyValue(subject, msgCtxt);
2,358
private String getSecretKey(MessageContext msgCtxt) throws Exception { String key = (String) this.properties.get("secret-key"); if (key == null || key.equals("")) { throw new IllegalStateException("secret-key is not specified or is empty."); } <BUG>key = resolvePropertyValue(key, msgCtxt); </BUG> if (key == null || key.equals("")) { throw new IllegalStateException("secret-key is null or empty."); }
key = (String) resolvePropertyValue(key, msgCtxt);
2,359
private String getIssuer(MessageContext msgCtxt) throws Exception { String issuer = (String) this.properties.get("issuer"); if (issuer == null || issuer.equals("")) { return null; // "iss" is OPTIONAL per RFC-7519 } <BUG>issuer = resolvePropertyValue(issuer, msgCtxt); </BUG> if (issuer == null || issuer.equals("")) { return null; // "iss" is OPTIONAL per RFC-7519 }
issuer = (String) resolvePropertyValue(issuer, msgCtxt);
2,360
private String getAlgorithm(MessageContext msgCtxt) throws Exception { String algorithm = ((String) this.properties.get("algorithm")).trim(); if (algorithm == null || algorithm.equals("")) { throw new IllegalStateException("algorithm is not specified or is empty."); } <BUG>algorithm = resolvePropertyValue(algorithm, msgCtxt); </BUG> if (algorithm == null || algorithm.equals("")) { throw new IllegalStateException("issuer is not specified or is empty."); }
algorithm = (String) resolvePropertyValue(algorithm, msgCtxt);
2,361
if (audience == null || audience.equals("")) { return null; } String[] audiences = StringUtils.split(audience,","); for(int i=0; i<audiences.length; i++) { <BUG>audiences[i] = resolvePropertyValue(audiences[i], msgCtxt); </BUG> } return audiences; }
audiences[i] = (String) resolvePropertyValue(audiences[i], msgCtxt);
2,362
private String getPrivateKeyPassword(MessageContext msgCtxt) { String password = (String) this.properties.get("private-key-password"); if (password == null || password.equals("")) { return null; } <BUG>password = resolvePropertyValue(password, msgCtxt); </BUG> if (password == null || password.equals("")) { return null; } return password; }
password = (String) resolvePropertyValue(password, msgCtxt);
2,363
private int getExpiresIn(MessageContext msgCtxt) throws IllegalStateException { String expiry = (String) this.properties.get("expiresIn"); if (expiry == null || expiry.equals("")) { return 60*60; // one hour } <BUG>expiry = resolvePropertyValue(expiry, msgCtxt); </BUG> if (expiry == null || expiry.equals("")) { throw new IllegalStateException("variable " + expiry + " resolves to nothing."); }
expiry = (String) resolvePropertyValue(expiry, msgCtxt);
2,364
if (privateKey==null) { String pemfile = (String) this.properties.get("pemfile"); if (pemfile == null || pemfile.equals("")) { throw new IllegalStateException("must specify pemfile or private-key when algorithm is RS*"); } <BUG>pemfile = resolvePropertyValue(pemfile, msgCtxt); </BUG> if (pemfile == null || pemfile.equals("")) { throw new IllegalStateException("pemfile resolves to nothing; invalid when algorithm is RS*"); }
pemfile = (String) resolvePropertyValue(pemfile, msgCtxt);
2,365
providedValue != null) { String claimName = parts[1]; if (claimName.equals("aud") && providedValue.indexOf(",")!=-1) { audiences = StringUtils.split(providedValue,","); for(int i=0; i<audiences.length; i++) { <BUG>audiences[i] = resolvePropertyValue(audiences[i], msgCtxt); </BUG> } claims.setAudience(java.util.Arrays.asList(audiences)); }
audiences[i] = (String) resolvePropertyValue(audiences[i], msgCtxt);
2,366
signedJWT.sign(signer); String jwt = signedJWT.serialize(); msgCtxt.setVariable(varName("jwt"), jwt); } catch (Exception e) { <BUG>if (debug) { e.printStackTrace(); } </BUG> String error = e.toString(); msgCtxt.setVariable(varName("error"), error); int ch = error.indexOf(':');
if (debug) { e.printStackTrace(); /* to MP system.log */ }
2,367
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.util.Progressable; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AFileSystem extends FileSystem {</BUG> private URI uri; private Path workingDir; private AmazonS3Client s3;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AFileSystem extends FileSystem {
2,368
public void initialize(URI name, Configuration conf) throws IOException { super.initialize(name, conf); uri = URI.create(name.getScheme() + "://" + name.getAuthority()); workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this.uri, this.getWorkingDirectory()); <BUG>String accessKey = conf.get(ACCESS_KEY, null); String secretKey = conf.get(SECRET_KEY, null); </BUG> String userInfo = name.getUserInfo();
String accessKey = conf.get(NEW_ACCESS_KEY, conf.get(OLD_ACCESS_KEY, null)); String secretKey = conf.get(NEW_SECRET_KEY, conf.get(OLD_SECRET_KEY, null));
2,369
} else { accessKey = userInfo; } } AWSCredentialsProviderChain credentials = new AWSCredentialsProviderChain( <BUG>new S3ABasicAWSCredentialsProvider(accessKey, secretKey), new InstanceProfileCredentialsProvider(), new S3AAnonymousAWSCredentialsProvider() );</BUG> bucket = name.getHost();
new BasicAWSCredentialsProvider(accessKey, secretKey), new AnonymousAWSCredentialsProvider()
2,370
awsConf.setSocketTimeout(conf.getInt(SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT)); </BUG> s3 = new AmazonS3Client(credentials, awsConf); <BUG>maxKeys = conf.getInt(MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS); partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (partSize < 5 * 1024 * 1024) {
new InstanceProfileCredentialsProvider(), new AnonymousAWSCredentialsProvider() bucket = name.getHost(); ClientConfiguration awsConf = new ClientConfiguration(); awsConf.setMaxConnections(conf.getInt(NEW_MAXIMUM_CONNECTIONS, conf.getInt(OLD_MAXIMUM_CONNECTIONS, DEFAULT_MAXIMUM_CONNECTIONS))); awsConf.setProtocol(conf.getBoolean(NEW_SECURE_CONNECTIONS, conf.getBoolean(OLD_SECURE_CONNECTIONS, DEFAULT_SECURE_CONNECTIONS)) ? Protocol.HTTPS : Protocol.HTTP); awsConf.setMaxErrorRetry(conf.getInt(NEW_MAX_ERROR_RETRIES, conf.getInt(OLD_MAX_ERROR_RETRIES, DEFAULT_MAX_ERROR_RETRIES))); awsConf.setSocketTimeout(conf.getInt(NEW_SOCKET_TIMEOUT, conf.getInt(OLD_SOCKET_TIMEOUT, DEFAULT_SOCKET_TIMEOUT))); maxKeys = conf.getInt(NEW_MAX_PAGING_KEYS, conf.getInt(OLD_MAX_PAGING_KEYS, DEFAULT_MAX_PAGING_KEYS)); partSize = conf.getLong(NEW_MULTIPART_SIZE, conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE)); partSizeThreshold = conf.getInt(NEW_MIN_MULTIPART_THRESHOLD, conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD));
2,371
cannedACL = null; } if (!s3.doesBucketExist(bucket)) { throw new IOException("Bucket " + bucket + " does not exist"); } <BUG>boolean purgeExistingMultipart = conf.getBoolean(PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART); long purgeExistingMultipartAge = conf.getLong(PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE); </BUG> if (purgeExistingMultipart) {
boolean purgeExistingMultipart = conf.getBoolean(NEW_PURGE_EXISTING_MULTIPART, conf.getBoolean(OLD_PURGE_EXISTING_MULTIPART, DEFAULT_PURGE_EXISTING_MULTIPART)); long purgeExistingMultipartAge = conf.getLong(NEW_PURGE_EXISTING_MULTIPART_AGE, conf.getLong(OLD_PURGE_EXISTING_MULTIPART_AGE, DEFAULT_PURGE_EXISTING_MULTIPART_AGE));
2,372
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; <BUG>import static org.apache.hadoop.fs.s3a.S3AConstants.*; public class S3AOutputStream extends OutputStream {</BUG> private OutputStream backupStream; private File backupFile; private boolean closed;
import static org.apache.hadoop.fs.s3a.Constants.*; public class S3AOutputStream extends OutputStream {
2,373
this.client = client; this.progress = progress; this.fs = fs; this.cannedACL = cannedACL; this.statistics = statistics; <BUG>partSize = conf.getLong(MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD); </BUG> if (conf.get(BUFFER_DIR, null) != null) {
partSize = conf.getLong(OLD_MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); partSizeThreshold = conf.getInt(OLD_MIN_MULTIPART_THRESHOLD, DEFAULT_MIN_MULTIPART_THRESHOLD);
2,374
package org.cloudfoundry.identity.uaa.zone; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; <BUG>import org.cloudfoundry.identity.uaa.audit.event.SystemDeletable; import org.cloudfoundry.identity.uaa.oauth.client.ClientConstants;</BUG> import org.cloudfoundry.identity.uaa.resources.ResourceMonitor; import org.cloudfoundry.identity.uaa.util.JsonUtils; import org.springframework.dao.DuplicateKeyException;
import org.cloudfoundry.identity.uaa.authentication.UaaPrincipal; import org.cloudfoundry.identity.uaa.client.ClientMetadata; import org.cloudfoundry.identity.uaa.client.ClientMetadataProvisioning; import org.cloudfoundry.identity.uaa.oauth.client.ClientConstants;
2,375
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.InvalidDataAccessResourceUsageException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; <BUG>import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.security.crypto.password.NoOpPasswordEncoder;</BUG> import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.oauth2.common.exceptions.InvalidClientException; import org.springframework.security.oauth2.common.util.DefaultJdbcListFactory;
import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.crypto.password.NoOpPasswordEncoder;
2,376
private String findClientDetailsSql = DEFAULT_FIND_STATEMENT; private String updateClientDetailsSql = DEFAULT_UPDATE_STATEMENT; private String updateClientSecretSql = DEFAULT_UPDATE_SECRET_STATEMENT; private String insertClientDetailsSql = DEFAULT_INSERT_STATEMENT; private String selectClientDetailsSql = DEFAULT_SELECT_STATEMENT; <BUG>private PasswordEncoder passwordEncoder = NoOpPasswordEncoder.getInstance(); private final JdbcTemplate jdbcTemplate;</BUG> private JdbcListFactory listFactory; public MultitenantJdbcClientDetailsService(DataSource dataSource) { Assert.notNull(dataSource, "DataSource required");
private ClientMetadataProvisioning clientMetadataProvisioning; private final JdbcTemplate jdbcTemplate;
2,377
private String clientId; private String clientName; private String identityZoneId; private boolean showOnHomePage; private URL appLaunchUrl; <BUG>private String appIcon; public String getClientId() {</BUG> return clientId; } public void setClientId(String clientId) {
private String createdBy; private String lastUpdatedBy; public String getClientId() {
2,378
import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; <BUG>import static org.cloudfoundry.identity.uaa.oauth.client.SecretChangeRequest.ChangeMode.ADD; import static org.cloudfoundry.identity.uaa.oauth.client.SecretChangeRequest.ChangeMode.DELETE;</BUG> @Controller @ManagedResource public class ClientAdminEndpoints implements InitializingBean {
[DELETED]
2,379
@ManagedResource public class ClientAdminEndpoints implements InitializingBean { private static final String SCIM_CLIENTS_SCHEMA_URI = "http://cloudfoundry.org/schema/scim/oauth-clients-1.0"; private final Log logger = LogFactory.getLog(getClass()); private ClientServicesExtension clientRegistrationService; <BUG>private QueryableResourceManager<ClientDetails> clientDetailsService; private ResourceMonitor<ClientDetails> clientDetailsResourceMonitor;</BUG> private AttributeNameMapper attributeNameMapper = new SimpleAttributeNameMapper( Collections.<String, String> emptyMap()); private SecurityContextAccessor securityContextAccessor = new DefaultSecurityContextAccessor();
private ClientMetadataProvisioning clientMetadataProvisioning; private ResourceMonitor<ClientDetails> clientDetailsResourceMonitor;
2,380
@RequestMapping(value = "/oauth/clients", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) @ResponseBody public ClientDetails createClientDetails(@RequestBody BaseClientDetails client) throws Exception { ClientDetails details = clientDetailsValidator.validate(client, Mode.CREATE); <BUG>return removeSecret(clientDetailsService.create(details)); }</BUG> @RequestMapping(value = "/oauth/clients/restricted", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK)
ClientDetails ret = removeSecret(clientDetailsService.create(details)); return ret; }
2,381
package org.cloudfoundry.identity.uaa.client; <BUG>import org.cloudfoundry.identity.uaa.approval.ApprovalStore; import org.cloudfoundry.identity.uaa.client.ClientDetailsValidator.Mode;</BUG> import org.cloudfoundry.identity.uaa.error.UaaException; import org.cloudfoundry.identity.uaa.oauth.client.ClientDetailsModification; import org.cloudfoundry.identity.uaa.oauth.client.SecretChangeRequest;
import org.cloudfoundry.identity.uaa.authentication.UaaAuthenticationTestFactory; import org.cloudfoundry.identity.uaa.client.ClientDetailsValidator.Mode;
2,382
private ClientAdminEndpoints endpoints = null; private BaseClientDetails input = null; private ClientDetailsModification[] inputs = new ClientDetailsModification[5]; private BaseClientDetails detail = null; private BaseClientDetails[] details = new BaseClientDetails[inputs.length]; <BUG>private QueryableResourceManager<ClientDetails> clientDetailsService = null; private SecurityContextAccessor securityContextAccessor = null;</BUG> private ClientServicesExtension clientRegistrationService = null; private AuthenticationManager authenticationManager = null; private ApprovalStore approvalStore = null;
private ClientMetadataProvisioning clientMetadataProvisioning = null; private SecurityContextAccessor securityContextAccessor = null;
2,383
synchronized (bc) { read = bc.startToByteArray(len); bc.notifyAll(); } boolean timedOut = false; <BUG>while (read.length == 0) { synchronized (flagLock) {</BUG> if (closed) { if (_log.shouldLog(Log.DEBUG)) _log.debug(getStreamPrefix() + "Closed is set after reading "
while ( (read.length == 0) && (!inStreamClosed) ) { synchronized (flagLock) {
2,384
super.close(); notifyClosed(); synchronized (bc) { inStreamClosed = true; bc.notifyAll(); <BUG>} }</BUG> } private class I2POutputStream extends OutputStream { public I2PInputStream sendTo;
if (_log.shouldLog(Log.DEBUG)) _log.debug(getStreamPrefix() + "After close");
2,385
String peer = I2PSocketImpl.this.remote.calculateHash().toBase64(); setName("SocketRunner " + (++__runnerId) + "/" + _socketId + " " + peer.substring(0, 4)); start(); } private boolean handleNextPacket(ByteCollector bc, byte buffer[]) <BUG>throws IOException, I2PSessionException { int len = in.read(buffer); int bcsize = bc.getCurrentSize(); if (len != -1) { bc.append(buffer, len); } else if (bcsize == 0) {</BUG> return false;
[DELETED]
2,386
package com.cronutils.model.time.generator; import java.util.Collections; <BUG>import java.util.List; import org.apache.commons.lang3.Validate;</BUG> import com.cronutils.model.field.CronField; import com.cronutils.model.field.expression.FieldExpression; public abstract class FieldValueGenerator {
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
2,387
import java.util.ResourceBundle; import java.util.function.Function;</BUG> class DescriptionStrategyFactory { private DescriptionStrategyFactory() {} public static DescriptionStrategy daysOfWeekInstance(final ResourceBundle bundle, final FieldExpression expression) { <BUG>final Function<Integer, String> nominal = integer -> new DateTime().withDayOfWeek(integer).dayOfWeek().getAsText(bundle.getLocale()); </BUG> NominalDescriptionStrategy dow = new NominalDescriptionStrategy(bundle, nominal, expression); dow.addDescription(fieldExpression -> { if (fieldExpression instanceof On) {
import java.util.function.Function; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.model.field.expression.On; final Function<Integer, String> nominal = integer -> DayOfWeek.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale());
2,388
return dom; } public static DescriptionStrategy monthsInstance(final ResourceBundle bundle, final FieldExpression expression) { return new NominalDescriptionStrategy( bundle, <BUG>integer -> new DateTime().withMonthOfYear(integer).monthOfYear().getAsText(bundle.getLocale()), expression</BUG> ); } public static DescriptionStrategy plainInstance(ResourceBundle bundle, final FieldExpression expression) {
integer -> Month.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale()), expression
2,389
<BUG>package com.cronutils.model.time.generator; import com.cronutils.mapper.WeekDay;</BUG> import com.cronutils.model.field.CronField; import com.cronutils.model.field.CronFieldName; import com.cronutils.model.field.constraint.FieldConstraintsBuilder;
import java.time.LocalDate; import java.util.Collections; import java.util.List; import java.util.Set; import org.apache.commons.lang3.Validate; import com.cronutils.mapper.WeekDay;
2,390
import com.cronutils.model.field.expression.Between; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.parser.CronParserField; import com.google.common.collect.Lists; import com.google.common.collect.Sets; <BUG>import org.apache.commons.lang3.Validate; import org.joda.time.DateTime; import java.util.Collections; import java.util.List; import java.util.Set;</BUG> class BetweenDayOfWeekValueGenerator extends FieldValueGenerator {
[DELETED]
2,391
<BUG>package com.cronutils.model.time.generator; import com.cronutils.model.field.CronField;</BUG> import com.cronutils.model.field.CronFieldName; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.model.field.expression.On;
import java.time.DayOfWeek; import java.time.LocalDate; import java.util.List; import org.apache.commons.lang3.Validate; import com.cronutils.model.field.CronField;
2,392
import com.cronutils.model.field.CronField;</BUG> import com.cronutils.model.field.CronFieldName; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.model.field.expression.On; import com.google.common.collect.Lists; <BUG>import org.apache.commons.lang3.Validate; import org.joda.time.DateTime; import java.util.List;</BUG> class OnDayOfMonthValueGenerator extends FieldValueGenerator { private int year;
package com.cronutils.model.time.generator; import java.time.DayOfWeek; import java.time.LocalDate; import java.util.List; import com.cronutils.model.field.CronField;
2,393
class OnDayOfMonthValueGenerator extends FieldValueGenerator { private int year; private int month; public OnDayOfMonthValueGenerator(CronField cronField, int year, int month) { super(cronField); <BUG>Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of month"); this.year = year;</BUG> this.month = month; }
Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of" + " month"); this.year = year;
2,394
package com.cronutils.mapper; public class ConstantsMapper { private ConstantsMapper() {} public static final WeekDay QUARTZ_WEEK_DAY = new WeekDay(2, false); <BUG>public static final WeekDay JODATIME_WEEK_DAY = new WeekDay(1, false); </BUG> public static final WeekDay CRONTAB_WEEK_DAY = new WeekDay(1, true); public static int weekDayMapping(WeekDay source, WeekDay target, int weekday){ return source.mapTo(weekday, target);
public static final WeekDay JAVA8 = new WeekDay(1, false);
2,395
return nextMatch; } catch (NoSuchValueException e) { throw new IllegalArgumentException(e); } } <BUG>DateTime nextClosestMatch(DateTime date) throws NoSuchValueException { </BUG> List<Integer> year = yearsValueGenerator.generateCandidates(date.getYear(), date.getYear()); TimeNode days = null; int lowestMonth = months.getValues().get(0);
ZonedDateTime nextClosestMatch(ZonedDateTime date) throws NoSuchValueException {
2,396
boolean questionMarkSupported = cronDefinition.getFieldDefinition(DAY_OF_WEEK).getConstraints().getSpecialChars().contains(QUESTION_MARK); if(questionMarkSupported){ return new TimeNode( generateDayCandidatesQuestionMarkSupported( <BUG>date.getYear(), date.getMonthOfYear(), </BUG> ((DayOfWeekFieldDefinition) cronDefinition.getFieldDefinition(DAY_OF_WEEK) ).getMondayDoWValue()
date.getYear(), date.getMonthValue(),
2,397
) ); }else{ return new TimeNode( generateDayCandidatesQuestionMarkNotSupported( <BUG>date.getYear(), date.getMonthOfYear(), </BUG> ((DayOfWeekFieldDefinition) cronDefinition.getFieldDefinition(DAY_OF_WEEK) ).getMondayDoWValue()
date.getYear(), date.getMonthValue(),
2,398
} public DateTime lastExecution(DateTime date){ </BUG> Validate.notNull(date); try { <BUG>DateTime previousMatch = previousClosestMatch(date); </BUG> if(previousMatch.equals(date)){ previousMatch = previousClosestMatch(date.minusSeconds(1)); }
public java.time.Duration timeToNextExecution(ZonedDateTime date){ return java.time.Duration.between(date, nextExecution(date)); public ZonedDateTime lastExecution(ZonedDateTime date){ ZonedDateTime previousMatch = previousClosestMatch(date);
2,399
return previousMatch; } catch (NoSuchValueException e) { throw new IllegalArgumentException(e); } } <BUG>public Duration timeFromLastExecution(DateTime date){ return new Interval(lastExecution(date), date).toDuration(); } public boolean isMatch(DateTime date){ </BUG> return nextExecution(lastExecution(date)).equals(date);
[DELETED]
2,400
<BUG>package com.cronutils.model.time.generator; import com.cronutils.model.field.CronField;</BUG> import com.cronutils.model.field.expression.Every; import com.cronutils.model.field.expression.FieldExpression; import com.google.common.annotations.VisibleForTesting;
import java.time.ZonedDateTime; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.cronutils.model.field.CronField;