id
stringlengths
31
34
content
stringlengths
74
328k
api-misuse-repair-single_data_5401
private static boolean isValidDate(int year, int month, int day) { if (month < 1 || month > 12 || day < 1 || day > 31) { return false; } int[] longMonths = { 1, 3, 5, 7, 8, 10, 12 }; int[] shortMonths = { 4, 6, 9, 11 }; int maxDay; if (IntStream.of(longMonths).anyMatch(x -> x == month)) { maxDay = 31; } else if (IntStr...
api-misuse-repair-single_data_5402
private BytecodeExpr buildClassFromMap(MapExpression exp, ClassNode type, final CompilerTransformer compiler) { final List<MapEntryExpression> list = exp.getMapEntryExpressions(); Expression superArgs = null; for (int i = 0; i != list.size(); ++i) { final MapEntryExpression me = list.get(i); Expression key = me.getKeyE...
api-misuse-repair-single_data_5403
private synchronized void cancelBackup() { if (this.finished) return; this.updateUiThread.stop(); this.checkThread.shouldRun = false; if (this.backupThread != null) this.backupThread.shouldRun = false; this.backupFrame.dispose(); this.progressTaskBar.setState(State.NO_PROGRESS); this.finished = true; } private synchr...
api-misuse-repair-single_data_5404
private void itemYesActionPerformed(java.awt.event.ActionEvent evt) { searchActivity sa = new searchActivity(); sa.setVisible(true); String sql = "SELECT *\n" + "FROM activity\n" + "WHERE DAY(date) = DAY(CURRENT_DATE())-1;"; sa.setT("Yesterday"); try { sa.tableRun(sql); } catch (Exception e) { System.out.println(e); } ...
api-misuse-repair-single_data_5405
private void displayNotifications() { for (int i = 0; i < notificationList.size(); i++) { boolean firstIteration = false; boolean lastIteration = false; if (i == 0) { firstIteration = true; } if (i == notificationList.size() - 1) { lastIteration = true; } final LinearLayout parentll = new LinearLayout(this); parentll.s...
api-misuse-repair-single_data_5406
@Override @Actions({ @Action(value = "*/index", results = { @Result(name = "success", type = "tiles", location = "manual"), @Result(name = "input", type = "redirectAction", location = "index.html", params = { "namespace", "/" }), @Result(name = "error", type = "redirectAction", location = "index.html", params = { "name...
api-misuse-repair-single_data_5407
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); boolean enableDark = MultiprocessPreferences.getDefaultSharedPreferences(this).getBoolean(Common.PREF_ENABLE_DARK_THEME, false); if (enableDark) { setTheme(R.style.AppThemeDark); } setContentView(R.layout.activity_main); ...
api-misuse-repair-single_data_5408
public CalendarDate getStartDate() { String sd = _element.getAttribute("startDate").getValue(); if (sd != "") return new CalendarDate(_element.getAttribute("startDate").getValue()); Task parent = this.getParentTask(); if (parent != null) return parent.getStartDate(); Project pr = this._tl.getProject(); if (pr.getStartD...
api-misuse-repair-single_data_5409
private long parseElbTimestamp(String date) { try { Date d = parser.parse(date); int dot = date.indexOf('.'); String millisString = date.substring(dot + 1, date.length() - 1); long millis = Long.parseLong(millisString) / 1000l; return d.getTime() + millis; } catch (ParseException e) { } return -1; } private long pars...
api-misuse-repair-single_data_5410
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DatabaseUtils.wipeDatabase(getApplicationContext()); DatabaseUtils.tempSeedDatabase(getApplicationContext(), 10); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getFragmentManager().beginTransac...
api-misuse-repair-single_data_5411
@Override public void valueChanged(ListSelectionEvent event) { if (!active || event.getValueIsAdjusting()) return; if (jtable.getSelectedRow() > -1) { System.out.println("romoved words to swap : valueChanged.SwapRemoveListner"); System.out.println(jtable.getValueAt(jtable.getSelectedRow(), 0).toString()); System.out.pr...
api-misuse-repair-single_data_5412
public String post(String url, Object data) { HttpPost httpPost = new HttpPost(); if (data != null) { httpPost.setEntity(new StringEntity(data.toString(), charset)); } return execMethod(httpPost); } public String post(String url, Object data) { HttpPost httpPost = new HttpPost(url); if (data != null) { httpPost.setEn...
api-misuse-repair-single_data_5413
public void update() { while (game_state != STATE_GAME_OVER) { try { Thread.sleep(1000 / p1.level); } catch (Exception e) { System.out.println(e.toString()); } movePiece('d'); } } public void update() { while (game_state == STATE_GAME) { try { Thread.sleep(1000 / p1.level); } catch (Exception e) { System.out.println(...
api-misuse-repair-single_data_5414
public boolean isValid(String value) { if (value == null) { return false; } Matcher urlMatcher = URL_PATTERN.matcher(value); if (!urlMatcher.matches()) { return false; } String scheme = urlMatcher.group(PARSE_URL_SCHEME); if (!isValidScheme(scheme)) { return false; } String authority = urlMatcher.group(PARSE_URL_AUTHOR...
api-misuse-repair-single_data_5415
@Override public void onBindViewHolder(InventoryAdapter.ViewHolder viewHolder, int position) { ItemData item = itemList.get(position); TextView tvName = viewHolder.tvName; tvName.setText(item.getItemName()); TextView tvPower = viewHolder.tvPower; int power = item.getItemPower(); if (power != 0) { tvPower.setText("Power...
api-misuse-repair-single_data_5416
@SuppressWarnings("unchecked") private T cast(Number val) { Class<?> clazz = val.getClass(); if (clazz == Byte.class || clazz == Byte.TYPE) { return (T) Byte.valueOf(String.valueOf((byte) val)); } else if (clazz == Short.class || clazz == Short.TYPE) { return (T) Short.valueOf(String.valueOf((short) val)); } else if (c...
api-misuse-repair-single_data_5417
Map<Type, Converter> getDefaultConverters() { Map<Type, Converter> result = new HashMap<>(); result.put(Boolean.class, new BooleanConverter()); result.put(Integer.class, new IntegerConverter()); result.put(Long.class, new LongConverter()); result.put(Float.class, new FloatConverter()); result.put(Double.class, new Doub...
api-misuse-repair-single_data_5418
public int changePaths(int idxEdgeAVertex1, int idxEdgeBVertex1, int[] vertexIdxs) { int tIdxA1 = getTourIndex(idxEdgeAVertex1); int tIdxA2 = getNextTourIndex(tIdxA1); int tIdxPrevA1 = getPrevTourIndex(tIdxA1); int tIdxNextA2 = getNextTourIndex(tIdxA2); int tIdxB1 = getTourIndex(idxEdgeBVertex1); int tIdxB2 = getTourIn...
api-misuse-repair-single_data_5419
@Override public void loadFromCache() { Cursor cursor = DatabaseHelper.selectAll(CourseTable.NAME); final List<CourseTableModel> list = new ArrayList<>(); while (cursor.moveToNext()) { CourseTableModel model = new CourseTableModel(); model.setDayOfWeek(cursor.getInt(CourseTable.ID_DAY_OF_WEEK)); model.setTerm(cursor.ge...
api-misuse-repair-single_data_5420
public void registerTileEntities() { GameRegistry.registerTileEntity(TileEntityWoodenStrainer.class, new ResourceLocation(Dawn.Reference.MODID, ":wooden_strainer")); } public void registerTileEntities() { GameRegistry.registerTileEntity(TileEntityWoodenStrainer.class, new ResourceLocation(Dawn.Reference.MODID, "woode...
api-misuse-repair-single_data_5421
@Override public void onDestroy() { super.onDestroy(); if (isDownloading) { NotificationManager manager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE); manager.cancel(NOTfICATION_ID); } if (adView != null) { adView.destroy(); } } @Override public void onDestroy() { supe...
api-misuse-repair-single_data_5422
@Override public View getView(final int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.subforsublisteditor, parent, false); } final TextView t = ((TextView) convertView.findViewById(R.id.name)); t.setText(objects.get(position))...
api-misuse-repair-single_data_5423
protected LogEvent relativeCurrentEvent() { Deque<LogEvent> stack = getOrCreateRelativeStack(); return stack.getLast(); } protected LogEvent relativeCurrentEvent() { Deque<LogEvent> stack = getOrCreateRelativeStack(); return stack.peekLast(); }
api-misuse-repair-single_data_5424
public void convertToMinimalRepresentation() { if (ref.length() == 1 && alt.length() == 1) { return; } else { int i = ref.length(), j = alt.length(); while (i > 1 && j > 1) { if (ref.charAt(i - 1) != alt.charAt(j - 1)) { break; } --i; --j; } ref = ref.substring(0, i); alt = alt.substring(0, j); i = 1; j = 1; while (ref...
api-misuse-repair-single_data_5425
public List<String> dictionaryLookup(String accessToken, List<String> words) throws ApiRequestException { LOG.info("Checking if the following words are in the WWF dictionary: " + words); return parser.parseDictionaryLookupResponse(comm.dictionaryLookup(words, accessToken)); } public List<String> dictionaryLookup(Stri...
api-misuse-repair-single_data_5426
public void onEnable() { LorStyleStarsSystem.setup(); PluginManager pm = this.getServer().getPluginManager(); pm.registerEvent(Type.PLAYER_LOGIN, new LorStyleStarsPlayerListener(), Priority.Normal, this); } public void onEnable() { LorStyleStarsSystem.setup(); PluginManager pm = this.getServer().getPluginManager(); p...
api-misuse-repair-single_data_5427
@Override public Map<Integer, Node<T>> dict() { if (nodeDict == null && !CollectionUtils.isEmpty(nodeList)) { nodeDict = new HashMap<>(); for (Node<T> node : nodeList) { nodeDict.put(node.getId(), node); } return nodeDict; } return new HashMap<>(); } @Override public Map<Integer, Node<T>> dict() { if (nodeDict == nul...
api-misuse-repair-single_data_5428
public void delete(Long id) { ConnectionBox cnb = ConnectionBoxImpl.Builder().connection(DataSourceUtils.getConnection(datasource)).build(); try { cnb.setStatement("DELETE sdqf from computer where id=?;"); cnb.getStatement().setString(1, Long.toString(id)); cnb.getStatement().executeUpdate(); } catch (SQLException e) {...
api-misuse-repair-single_data_5429
@Override public String toString() { return "VarDefBuilder [build()=" + build() + "]"; } @Override public String toString() { return "VarDefBuilder [build()=" + buildInternal() + "]"; }
api-misuse-repair-single_data_5430
default <S extends CommonState> FdfEntity<S> save(Class<S> entityState, S state, long userId, long systemId, long tenantId) { state.arsd = Calendar.getInstance().getTime(); state.ared = null; state.cf = true; state.euid = userId; state.esid = systemId; state.tid = tenantId; if (state.id <= 0) { state.id = getNewEnityId...
api-misuse-repair-single_data_5431
public boolean isVowel(String character) { String[] vowels = new String[] { "a", "e", "i", "o", "u" }; for (String vowel : vowels) { if (character == vowel) { return true; } } return false; } public boolean isVowel(String s) { String[] vowels = new String[] { "a", "e", "i", "o", "u" }; for (String vowel : vowels) { i...
api-misuse-repair-single_data_5432
public void flush() throws IOException { outBuf.flip(); sock.write(outBuf); outBuf.compact(); } public void flush() throws IOException { outBuf.flip(); sock.write(outBuf); outBuf.clear(); }
api-misuse-repair-single_data_5433
@Override public void addUser(String name, String password, int level) throws UserExistsException, DatabaseException { this.addUser(new polly.data.User(name, password, level)); } @Override public void addUser(String name, String password, int level) throws UserExistsException, DatabaseException { this.addUser(this.cr...
api-misuse-repair-single_data_5434
@Override public void hint(URI needURI, URI otherNeed, double score, URI originator, Model content, WonMessage wonMessage) throws Exception { logger.info("need-facing: HINT called for needURI {} and otherNeed {} " + "with score {} from originator {}.", new Object[] { needURI, otherNeed, score, originator }); CamelConfi...
api-misuse-repair-single_data_5435
@Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); sharedPreferences = context.getSharedPreferences(Constants.SHARED_PREFERENCES, Context.MODE_PRIVATE); String tripTitle = sharedPreferences.getString(Constants...
api-misuse-repair-single_data_5436
public void addEdge(int source, int destination, T... edgeVariables) { checkInvalidVertex(source); checkInvalidVertex(destination); checkInvalidNrEdgeVariables(edgeVariables.length); checkHasNotEdge(source, destination); Edge<T> edge = new Edge(source, destination, edgeVariables); adjacencyLists[source].add(edge); nrEd...
api-misuse-repair-single_data_5437
@Override public StyledString getStyledText(Object element) { if (element instanceof ExternalModuleNode) { ExternalModuleNode externalModule = (ExternalModuleNode) element; JDTModule jdtModule = externalModule.getModule(); JDTModule mod = ((ExternalModuleNode) element).getModule(); String name = super.getStyledText(mod...
api-misuse-repair-single_data_5438
void sort(SimpleFeatureType featureType, SortBy[] sort, String prefix, StringBuffer sql) throws IOException { if ((sort != null) && (sort.length > 0)) { PrimaryKey key = getPrimaryKey(featureType); sql.append(" ORDER BY "); for (int i = 0; i < sort.length; i++) { String order; if (sort[i].getSortOrder() == SortOrder.DE...
api-misuse-repair-single_data_5439
public static void init() { GameRegistry.addSmelting(new ItemStack(ItemInit.RAW_STEEL, 5), new ItemStack(ItemInit.INGOT_STEEL, 1), 0.1f); } public static void init() { GameRegistry.addSmelting(new ItemStack(ItemInit.RAW_STEEL, 1), new ItemStack(ItemInit.INGOT_STEEL, 1), 0.1f); }
api-misuse-repair-single_data_5440
public void mousePressed(MouseEvent e) { if (nodeViewDest == null) { panel.setSelectedNode(null); return; } if (e.getClickCount() == 1 && e.getButton() == LEFTBUTTON && nodeViewDest != null) { panel.setSelectedNode(nodeViewDest); System.out.print("one click pressed\n"); } if (e.getClickCount() >= 2 && e.getButton() == ...
api-misuse-repair-single_data_5441
public void writeColor(String pkgName, String actName, int color) { Editor edit = mPreferences.edit(); String r = Integer.toHexString(Color.red(color)); String g = Integer.toHexString(Color.green(color)); String b = Integer.toHexString(Color.blue(color)); edit.putString(r + g + b, null); edit.commit(); Intent intent = ...
api-misuse-repair-single_data_5442
@SuppressWarnings("unchecked") public OCommandExecutorSQLDeleteEdge parse(final OCommandRequest iRequest) { init((OCommandRequestText) iRequest); parserRequiredKeyword("DELETE"); parserRequiredKeyword("EDGE"); OClass clazz = null; String temp = parseOptionalWord(true); final OrientBaseGraph graph = OGraphCommandExecuto...
api-misuse-repair-single_data_5443
private boolean loadUsingFilePath(String evalLocation, Properties properties) { if (evalLocation.startsWith("file:")) { evalLocation = evalLocation.substring(6); } File file = new File(evalLocation); if (!file.exists()) { return false; } try { properties.load(new FileReader(file)); return true; } catch (IOException e) ...
api-misuse-repair-single_data_5444
public void supportOrStep(int userid, int id, SupportTypeEnum type, int result, ApiOperationCallback<ReturnInfo<String>> callback) { if (SystemUtil.isNetworkAvailable(MainApplication.UIContext)) { if (flag) { StringBuffer path = new StringBuffer(URL_SUPPORTORSTEP); path.append("?userid=" + userid); path.append("&id=" +...
api-misuse-repair-single_data_5445
public List<User> loadUsers(Properties config) { List<String> usernames = getUserNames(config); List<User> users = new ArrayList<>(); for (String username : usernames) { String bzEmail = config.getProperty("user." + username + ".bugzilla"); String trId = config.getProperty("user." + username + ".trello"); String ghNick...
api-misuse-repair-single_data_5446
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.activity_home, container, false); mToolbar = view.findViewById(R.id.toolbar); mUserAvatar = view.findViewById(R.id.user_avatar)...
api-misuse-repair-single_data_5447
private void voiceChannelLonelyCheck(GenericGuildVoiceEvent e) { Member self = e.getGuild().getSelfMember(); if (self.getVoiceState().inVoiceChannel()) { if (self.getVoiceState().getChannel().getMembers().size() == 1) { new CommandStop().executeCommandAux(e); } } } private void voiceChannelLonelyCheck(GenericGuildVoi...
api-misuse-repair-single_data_5448
public static String recomputeHashTags(String name, Set<Group> groups) { String base = name.split(" #")[0]; for (Group g : groups) { if (g.type == Type.TAG) { base += " #" + g.value; } } return base; } public static String recomputeHashTags(String name, Set<Group> groups) { String base = name.split(" #")[0]; for (Gro...
api-misuse-repair-single_data_5449
private static <N extends AbstractDirectedGraphNode> boolean checkRedundancy(Set<PlaceEvaluation<N>> currentCombination, PlaceEvaluation<N> placeEval) { if (currentCombination == null || currentCombination.size() < 2 || placeEval == null) throw new RuntimeException("Check the inputs of checkRedundancy!"); Set<N> inters...
api-misuse-repair-single_data_5450
public int process(String[] args) throws NoSuchFuzzerException { String inputFileName = ""; String url = ""; String request = ""; String fuzzers = ""; String encoder = ""; String prefix = ""; String suffix = ""; int fuzzersStart = -1; int fuzzersEnd = -1; int fuzzerNumber = -1; int returnValue = -1; boolean result = fa...
api-misuse-repair-single_data_5451
public static void ingestInheritedMetadata(Catalog catalog) throws SaxonApiException, IOException, JDOMException { String catalogKey = catalog.getCatalogKey(); ReentrantReadWriteLock.WriteLock writeLock = _inventoryLock.writeLock(); try { writeLock.lock(); JDOMSource cat = new JDOMSource(catalog.getRawCatalogDocument()...