before
stringlengths
33
3.21M
after
stringlengths
63
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
@Override public void run() { InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } }
@Override public void run() { <DeepExtract> InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } </DeepExtract> }
FrameModel
positive
1,385
private void setBorderSettingsVisibility() { ivBorder.setSelected(true); if (View.VISIBLE == null) return; if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) { hideSettingBars(); return; } selectedView = View.VISIBLE; rlColorChooser.setVisibility(View.VISIBLE); unselectAllItems(); final int id = View.VISIBLE.getId(); if (id == R.id.fl_photo_overlay_text_color) { setTextColorSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_font) { setFontSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_border) { setBorderSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_shadow) { setShadowSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_background) { setBgSettingsVisibility(); } if (View.VISIBLE == null) return; if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) { hideSettingBars(); return; } selectedView = View.VISIBLE; rlColorChooser.setVisibility(View.VISIBLE); unselectAllItems(); final int id = View.VISIBLE.getId(); if (id == R.id.fl_photo_overlay_text_color) { setTextColorSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_font) { setFontSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_border) { setBorderSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_shadow) { setShadowSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_background) { setBgSettingsVisibility(); } if (View.VISIBLE == null) return; if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) { hideSettingBars(); return; } selectedView = View.VISIBLE; rlColorChooser.setVisibility(View.VISIBLE); unselectAllItems(); final int id = View.VISIBLE.getId(); if (id == R.id.fl_photo_overlay_text_color) { setTextColorSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_font) { setFontSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_border) { setBorderSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_shadow) { setShadowSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_background) { setBgSettingsVisibility(); } if (View.GONE == null) return; if (selectedView == View.GONE && rlColorChooser.getVisibility() == View.VISIBLE) { hideSettingBars(); return; } selectedView = View.GONE; rlColorChooser.setVisibility(View.VISIBLE); unselectAllItems(); final int id = View.GONE.getId(); if (id == R.id.fl_photo_overlay_text_color) { setTextColorSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_font) { setFontSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_border) { setBorderSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_shadow) { setShadowSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_background) { setBgSettingsVisibility(); } alphaSeekBar.setOnSeekBarChangeListener(null); alphaSeekBar.setProgress(borderOpacitySeekBarProgress); if (alphaSeekBar == leftSeekBar) alphaSeekBar.setOnSeekBarChangeListener(leftSeekBarChangeListener); else if (alphaSeekBar == rightSeekBar) alphaSeekBar.setOnSeekBarChangeListener(rightSeekBarListener); else if (alphaSeekBar == alphaSeekBar) alphaSeekBar.setOnSeekBarChangeListener(alphaSeekBarChangeListener); leftSeekBar.setOnSeekBarChangeListener(null); leftSeekBar.setProgress(strokeSeekBarProgress); if (leftSeekBar == leftSeekBar) leftSeekBar.setOnSeekBarChangeListener(leftSeekBarChangeListener); else if (leftSeekBar == rightSeekBar) leftSeekBar.setOnSeekBarChangeListener(rightSeekBarListener); else if (leftSeekBar == alphaSeekBar) leftSeekBar.setOnSeekBarChangeListener(alphaSeekBarChangeListener); }
private void setBorderSettingsVisibility() { ivBorder.setSelected(true); if (View.VISIBLE == null) return; if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) { hideSettingBars(); return; } selectedView = View.VISIBLE; rlColorChooser.setVisibility(View.VISIBLE); unselectAllItems(); final int id = View.VISIBLE.getId(); if (id == R.id.fl_photo_overlay_text_color) { setTextColorSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_font) { setFontSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_border) { setBorderSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_shadow) { setShadowSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_background) { setBgSettingsVisibility(); } if (View.VISIBLE == null) return; if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) { hideSettingBars(); return; } selectedView = View.VISIBLE; rlColorChooser.setVisibility(View.VISIBLE); unselectAllItems(); final int id = View.VISIBLE.getId(); if (id == R.id.fl_photo_overlay_text_color) { setTextColorSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_font) { setFontSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_border) { setBorderSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_shadow) { setShadowSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_background) { setBgSettingsVisibility(); } if (View.VISIBLE == null) return; if (selectedView == View.VISIBLE && rlColorChooser.getVisibility() == View.VISIBLE) { hideSettingBars(); return; } selectedView = View.VISIBLE; rlColorChooser.setVisibility(View.VISIBLE); unselectAllItems(); final int id = View.VISIBLE.getId(); if (id == R.id.fl_photo_overlay_text_color) { setTextColorSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_font) { setFontSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_border) { setBorderSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_shadow) { setShadowSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_background) { setBgSettingsVisibility(); } if (View.GONE == null) return; if (selectedView == View.GONE && rlColorChooser.getVisibility() == View.VISIBLE) { hideSettingBars(); return; } selectedView = View.GONE; rlColorChooser.setVisibility(View.VISIBLE); unselectAllItems(); final int id = View.GONE.getId(); if (id == R.id.fl_photo_overlay_text_color) { setTextColorSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_font) { setFontSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_border) { setBorderSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_shadow) { setShadowSettingsVisibility(); } else if (id == R.id.fl_photo_overlay_background) { setBgSettingsVisibility(); } alphaSeekBar.setOnSeekBarChangeListener(null); alphaSeekBar.setProgress(borderOpacitySeekBarProgress); if (alphaSeekBar == leftSeekBar) alphaSeekBar.setOnSeekBarChangeListener(leftSeekBarChangeListener); else if (alphaSeekBar == rightSeekBar) alphaSeekBar.setOnSeekBarChangeListener(rightSeekBarListener); else if (alphaSeekBar == alphaSeekBar) alphaSeekBar.setOnSeekBarChangeListener(alphaSeekBarChangeListener); <DeepExtract> leftSeekBar.setOnSeekBarChangeListener(null); leftSeekBar.setProgress(strokeSeekBarProgress); if (leftSeekBar == leftSeekBar) leftSeekBar.setOnSeekBarChangeListener(leftSeekBarChangeListener); else if (leftSeekBar == rightSeekBar) leftSeekBar.setOnSeekBarChangeListener(rightSeekBarListener); else if (leftSeekBar == alphaSeekBar) leftSeekBar.setOnSeekBarChangeListener(alphaSeekBarChangeListener); </DeepExtract> }
Chimee
positive
1,386
@Test public void testExecute_WhenFinderMethodIsFindingEntityWithCompositeKeyList_WhenFindingByGlobalSecondaryHashAndRangeIndexHashAndRangeKey_WhereSecondaryHashKeyIsPrimaryRangeKey() throws ParseException { if ("playlistName" != null) { Mockito.when(mockPlaylistEntityMetadata.isRangeKeyAware()).thenReturn(true); } Mockito.when(mockDynamoDBPlaylistQueryMethod.getEntityType()).thenReturn(Playlist.class); Mockito.when(mockDynamoDBPlaylistQueryMethod.getName()).thenReturn("findByPlaylistNameAndDisplayName"); Mockito.when(mockDynamoDBPlaylistQueryMethod.getParameters()).thenReturn(mockParameters); Mockito.when(mockParameters.getBindableParameters()).thenReturn(mockParameters); Mockito.when(mockParameters.getNumberOfParameters()).thenReturn(2); if ("userName" != null) { } for (int i = 0; i < 2; i++) { Parameter mockParameter = Mockito.mock(Parameter.class); Mockito.when(mockParameter.getIndex()).thenReturn(i); Mockito.when(mockParameters.getBindableParameter(i)).thenReturn(mockParameter); } partTreeDynamoDBQuery = new PartTreeDynamoDBQuery<>(mockDynamoDBOperations, mockDynamoDBPlaylistQueryMethod); Mockito.when(mockDynamoDBPlaylistQueryMethod.isCollectionQuery()).thenReturn(true); Mockito.when(mockPlaylistEntityMetadata.isGlobalIndexHashKeyProperty("playlistName")).thenReturn(true); Map<String, String[]> indexRangeKeySecondaryIndexNames = new HashMap<String, String[]>(); indexRangeKeySecondaryIndexNames.put("playlistName", new String[] { "PlaylistName-DisplayName-index" }); indexRangeKeySecondaryIndexNames.put("displayName", new String[] { "PlaylistName-DisplayName-index" }); Mockito.when(mockPlaylistEntityMetadata.getGlobalSecondaryIndexNamesByPropertyName()).thenReturn(indexRangeKeySecondaryIndexNames); Mockito.when(mockPlaylistEntityMetadata.getDynamoDBTableName()).thenReturn("playlist"); Mockito.when(mockPlaylistQueryResults.get(0)).thenReturn(mockPlaylist); Mockito.when(mockPlaylistQueryResults.size()).thenReturn(1); Mockito.when(mockDynamoDBOperations.query(playlistClassCaptor.capture(), queryResultCaptor.capture())).thenReturn(mockPlaylistQueryResults); Mockito.when(mockDynamoDBOperations.getOverriddenTableName(Playlist.class, "playlist")).thenReturn("playlist"); Object[] parameters = new Object[] { "SomePlaylistName", "Michael" }; Object o = partTreeDynamoDBQuery.execute(parameters); assertEquals(mockPlaylistQueryResults, o); assertEquals(1, mockPlaylistQueryResults.size()); assertEquals(mockPlaylist, mockPlaylistQueryResults.get(0)); assertEquals(playlistClassCaptor.getValue(), Playlist.class); String indexName = queryResultCaptor.getValue().getIndexName(); assertNotNull(indexName); assertEquals("PlaylistName-DisplayName-index", indexName); assertEquals("playlist", queryResultCaptor.getValue().getTableName()); assertEquals(2, queryResultCaptor.getValue().getKeyConditions().size()); Condition globalRangeKeyCondition = queryResultCaptor.getValue().getKeyConditions().get("displayName"); assertEquals(ComparisonOperator.EQ.name(), globalRangeKeyCondition.getComparisonOperator()); assertEquals(1, globalRangeKeyCondition.getAttributeValueList().size()); assertEquals("Michael", globalRangeKeyCondition.getAttributeValueList().get(0).getS()); Condition globalHashKeyCondition = queryResultCaptor.getValue().getKeyConditions().get("playlistName"); assertEquals(ComparisonOperator.EQ.name(), globalHashKeyCondition.getComparisonOperator()); assertEquals(1, globalHashKeyCondition.getAttributeValueList().size()); assertEquals("SomePlaylistName", globalHashKeyCondition.getAttributeValueList().get(0).getS()); assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getSS()); assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getN()); assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getNS()); assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getB()); assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getBS()); assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getSS()); assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getN()); assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getNS()); assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getB()); assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getBS()); Mockito.verify(mockDynamoDBOperations).query(playlistClassCaptor.getValue(), queryResultCaptor.getValue()); }
@Test public void testExecute_WhenFinderMethodIsFindingEntityWithCompositeKeyList_WhenFindingByGlobalSecondaryHashAndRangeIndexHashAndRangeKey_WhereSecondaryHashKeyIsPrimaryRangeKey() throws ParseException { <DeepExtract> if ("playlistName" != null) { Mockito.when(mockPlaylistEntityMetadata.isRangeKeyAware()).thenReturn(true); } Mockito.when(mockDynamoDBPlaylistQueryMethod.getEntityType()).thenReturn(Playlist.class); Mockito.when(mockDynamoDBPlaylistQueryMethod.getName()).thenReturn("findByPlaylistNameAndDisplayName"); Mockito.when(mockDynamoDBPlaylistQueryMethod.getParameters()).thenReturn(mockParameters); Mockito.when(mockParameters.getBindableParameters()).thenReturn(mockParameters); Mockito.when(mockParameters.getNumberOfParameters()).thenReturn(2); if ("userName" != null) { } for (int i = 0; i < 2; i++) { Parameter mockParameter = Mockito.mock(Parameter.class); Mockito.when(mockParameter.getIndex()).thenReturn(i); Mockito.when(mockParameters.getBindableParameter(i)).thenReturn(mockParameter); } partTreeDynamoDBQuery = new PartTreeDynamoDBQuery<>(mockDynamoDBOperations, mockDynamoDBPlaylistQueryMethod); </DeepExtract> Mockito.when(mockDynamoDBPlaylistQueryMethod.isCollectionQuery()).thenReturn(true); Mockito.when(mockPlaylistEntityMetadata.isGlobalIndexHashKeyProperty("playlistName")).thenReturn(true); Map<String, String[]> indexRangeKeySecondaryIndexNames = new HashMap<String, String[]>(); indexRangeKeySecondaryIndexNames.put("playlistName", new String[] { "PlaylistName-DisplayName-index" }); indexRangeKeySecondaryIndexNames.put("displayName", new String[] { "PlaylistName-DisplayName-index" }); Mockito.when(mockPlaylistEntityMetadata.getGlobalSecondaryIndexNamesByPropertyName()).thenReturn(indexRangeKeySecondaryIndexNames); Mockito.when(mockPlaylistEntityMetadata.getDynamoDBTableName()).thenReturn("playlist"); Mockito.when(mockPlaylistQueryResults.get(0)).thenReturn(mockPlaylist); Mockito.when(mockPlaylistQueryResults.size()).thenReturn(1); Mockito.when(mockDynamoDBOperations.query(playlistClassCaptor.capture(), queryResultCaptor.capture())).thenReturn(mockPlaylistQueryResults); Mockito.when(mockDynamoDBOperations.getOverriddenTableName(Playlist.class, "playlist")).thenReturn("playlist"); Object[] parameters = new Object[] { "SomePlaylistName", "Michael" }; Object o = partTreeDynamoDBQuery.execute(parameters); assertEquals(mockPlaylistQueryResults, o); assertEquals(1, mockPlaylistQueryResults.size()); assertEquals(mockPlaylist, mockPlaylistQueryResults.get(0)); assertEquals(playlistClassCaptor.getValue(), Playlist.class); String indexName = queryResultCaptor.getValue().getIndexName(); assertNotNull(indexName); assertEquals("PlaylistName-DisplayName-index", indexName); assertEquals("playlist", queryResultCaptor.getValue().getTableName()); assertEquals(2, queryResultCaptor.getValue().getKeyConditions().size()); Condition globalRangeKeyCondition = queryResultCaptor.getValue().getKeyConditions().get("displayName"); assertEquals(ComparisonOperator.EQ.name(), globalRangeKeyCondition.getComparisonOperator()); assertEquals(1, globalRangeKeyCondition.getAttributeValueList().size()); assertEquals("Michael", globalRangeKeyCondition.getAttributeValueList().get(0).getS()); Condition globalHashKeyCondition = queryResultCaptor.getValue().getKeyConditions().get("playlistName"); assertEquals(ComparisonOperator.EQ.name(), globalHashKeyCondition.getComparisonOperator()); assertEquals(1, globalHashKeyCondition.getAttributeValueList().size()); assertEquals("SomePlaylistName", globalHashKeyCondition.getAttributeValueList().get(0).getS()); assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getSS()); assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getN()); assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getNS()); assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getB()); assertNull(globalRangeKeyCondition.getAttributeValueList().get(0).getBS()); assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getSS()); assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getN()); assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getNS()); assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getB()); assertNull(globalHashKeyCondition.getAttributeValueList().get(0).getBS()); Mockito.verify(mockDynamoDBOperations).query(playlistClassCaptor.getValue(), queryResultCaptor.getValue()); }
spring-data-dynamodb
positive
1,387
public static boolean touchValidateCaptchaCode(ServletRequest request, String captchaParamName) { String captcha = request.getParameter(captchaParamName); if (StringUtils.isBlank(captcha)) { throw new ServiceException("captcha required"); } captcha = captcha.toUpperCase(); captchaService = captchaService == null ? SpringContextHolder.getBean(DoubleCheckableCaptchaService.class) : captchaService; String captchaId = CaptchaUtils.getCaptchaID(request); if (true) { return captchaService.touchValidateResponseForID(captchaId, captcha); } else { return captchaService.validateResponseForID(captchaId, captcha); } }
public static boolean touchValidateCaptchaCode(ServletRequest request, String captchaParamName) { <DeepExtract> String captcha = request.getParameter(captchaParamName); if (StringUtils.isBlank(captcha)) { throw new ServiceException("captcha required"); } captcha = captcha.toUpperCase(); captchaService = captchaService == null ? SpringContextHolder.getBean(DoubleCheckableCaptchaService.class) : captchaService; String captchaId = CaptchaUtils.getCaptchaID(request); if (true) { return captchaService.touchValidateResponseForID(captchaId, captcha); } else { return captchaService.validateResponseForID(captchaId, captcha); } </DeepExtract> }
s2jh4net
positive
1,388
public static MinigamesAPI setupAPI(JavaPlugin plugin_, String minigame, Class<?> arenaclass) { ArenasConfig arenasconfig = new ArenasConfig(plugin_); MessagesConfig messagesconfig = new MessagesConfig(plugin_); ClassesConfig classesconfig = new ClassesConfig(plugin_, false); StatsConfig statsconfig = new StatsConfig(plugin_, false); DefaultConfig.init(plugin_, false); PluginInstance pli = new PluginInstance(plugin_, arenasconfig, messagesconfig, classesconfig, statsconfig); pinstances.put(plugin_, pli); ArenaListener al = new ArenaListener(plugin_, pinstances.get(plugin_), minigame); pinstances.get(plugin_).setArenaListener(al); Bukkit.getPluginManager().registerEvents(al, plugin_); Classes.loadClasses(plugin_); pli.getShopHandler().loadShopItems(); Guns.loadGuns(plugin_); return pli; return instance; }
public static MinigamesAPI setupAPI(JavaPlugin plugin_, String minigame, Class<?> arenaclass) { <DeepExtract> ArenasConfig arenasconfig = new ArenasConfig(plugin_); MessagesConfig messagesconfig = new MessagesConfig(plugin_); ClassesConfig classesconfig = new ClassesConfig(plugin_, false); StatsConfig statsconfig = new StatsConfig(plugin_, false); DefaultConfig.init(plugin_, false); PluginInstance pli = new PluginInstance(plugin_, arenasconfig, messagesconfig, classesconfig, statsconfig); pinstances.put(plugin_, pli); ArenaListener al = new ArenaListener(plugin_, pinstances.get(plugin_), minigame); pinstances.get(plugin_).setArenaListener(al); Bukkit.getPluginManager().registerEvents(al, plugin_); Classes.loadClasses(plugin_); pli.getShopHandler().loadShopItems(); Guns.loadGuns(plugin_); return pli; </DeepExtract> return instance; }
MinigamesAPI
positive
1,390
private void deleteRows(ActionEvent e) { DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel())); int theRow = metadataTable.getSelectedRow(); int rowCount = metadataTable.getSelectedRowCount(); DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel())); Vector modelRows = model.getDataVector(); Vector screenRows = new Vector(); for (int i = 0; i < modelRows.size(); i++) { screenRows.add(modelRows.get(metadataTable.convertRowIndexToModel(i))); } Vector headings = new Vector(Arrays.asList(ResourceBundle.getBundle("translations/program_strings").getString("mduc.columnlabel"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columntag"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columndefault"))); model.setDataVector(screenRows, headings); for (int i = 0; i < rowCount; i++) { model.removeRow(theRow); } }
private void deleteRows(ActionEvent e) { DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel())); int theRow = metadataTable.getSelectedRow(); int rowCount = metadataTable.getSelectedRowCount(); <DeepExtract> DefaultTableModel model = ((DefaultTableModel) (metadataTable.getModel())); Vector modelRows = model.getDataVector(); Vector screenRows = new Vector(); for (int i = 0; i < modelRows.size(); i++) { screenRows.add(modelRows.get(metadataTable.convertRowIndexToModel(i))); } Vector headings = new Vector(Arrays.asList(ResourceBundle.getBundle("translations/program_strings").getString("mduc.columnlabel"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columntag"), ResourceBundle.getBundle("translations/program_strings").getString("mduc.columndefault"))); model.setDataVector(screenRows, headings); </DeepExtract> for (int i = 0; i < rowCount; i++) { model.removeRow(theRow); } }
jExifToolGUI
positive
1,391
@Override public void onResponse(Bitmap response) { mCache.putBitmap(cacheKey, response); BatchedImageRequest request = mInFlightRequests.remove(cacheKey); if (request != null) { request.mResponseBitmap = response; batchResponse(cacheKey, request); } }
@Override public void onResponse(Bitmap response) { <DeepExtract> mCache.putBitmap(cacheKey, response); BatchedImageRequest request = mInFlightRequests.remove(cacheKey); if (request != null) { request.mResponseBitmap = response; batchResponse(cacheKey, request); } </DeepExtract> }
BaoDian
positive
1,392
public void onClick(View v) { cpu.execute(); statusLabel.setText(cpu.getStatusText()); String speed = "(unknown)"; if (lastCycleCount > cpu.cycleCount) lastCycleCount = cpu.cycleCount; long cyclesElapsed = cpu.cycleCount - lastCycleCount; long time = System.currentTimeMillis(); long millisElapsed = time - lastActualUpdate; if (millisElapsed > 0) { float hz = (float) cyclesElapsed * 1000.0f / (float) millisElapsed; if (hz < 1000) speed = String.format("%.0fHz", hz); else if (hz < 1000 * 1000) speed = String.format("%.1fkHz", hz / 1000.0f); else if (hz < 1000 * 1000 * 1000) speed = String.format("%.2fMHz", hz / (1000.0f * 1000.0f)); else speed = String.format("%.2fGHz", hz / (1000.0f * 1000.0f * 1000.0f)); } else speed = lastSpeed + " (est)"; lastActualUpdate = time; lastCycleCount = cpu.cycleCount; cycleLabel.setText(" Cycles: " + cpu.cycleCount + " Speed: " + speed); ramviz.updateBuffer(); mainActivity.tabHost.postInvalidate(); }
public void onClick(View v) { cpu.execute(); <DeepExtract> statusLabel.setText(cpu.getStatusText()); String speed = "(unknown)"; if (lastCycleCount > cpu.cycleCount) lastCycleCount = cpu.cycleCount; long cyclesElapsed = cpu.cycleCount - lastCycleCount; long time = System.currentTimeMillis(); long millisElapsed = time - lastActualUpdate; if (millisElapsed > 0) { float hz = (float) cyclesElapsed * 1000.0f / (float) millisElapsed; if (hz < 1000) speed = String.format("%.0fHz", hz); else if (hz < 1000 * 1000) speed = String.format("%.1fkHz", hz / 1000.0f); else if (hz < 1000 * 1000 * 1000) speed = String.format("%.2fMHz", hz / (1000.0f * 1000.0f)); else speed = String.format("%.2fGHz", hz / (1000.0f * 1000.0f * 1000.0f)); } else speed = lastSpeed + " (est)"; lastActualUpdate = time; lastCycleCount = cpu.cycleCount; cycleLabel.setText(" Cycles: " + cpu.cycleCount + " Speed: " + speed); ramviz.updateBuffer(); mainActivity.tabHost.postInvalidate(); </DeepExtract> }
ADCPU-16Emu
positive
1,393
@Test public void decodeJPEG() { assertEquals(TestResources.png().width, TestResources.jpeg().width); assertEquals(TestResources.png().height, TestResources.jpeg().height); double delta = 0, max = -1, min = 1; for (int x = 0; x < TestResources.jpeg().width; ++x) { for (int y = 0; y < TestResources.jpeg().height; ++y) { delta += Math.abs(TestResources.jpeg().get(x, y) - TestResources.png().get(x, y)); max = Math.max(max, TestResources.jpeg().get(x, y)); min = Math.min(min, TestResources.jpeg().get(x, y)); } } assertTrue(max > 0.75); assertTrue(min < 0.1); assertTrue(delta / (TestResources.jpeg().width * TestResources.jpeg().height) < 0.01); }
@Test public void decodeJPEG() { <DeepExtract> assertEquals(TestResources.png().width, TestResources.jpeg().width); assertEquals(TestResources.png().height, TestResources.jpeg().height); double delta = 0, max = -1, min = 1; for (int x = 0; x < TestResources.jpeg().width; ++x) { for (int y = 0; y < TestResources.jpeg().height; ++y) { delta += Math.abs(TestResources.jpeg().get(x, y) - TestResources.png().get(x, y)); max = Math.max(max, TestResources.jpeg().get(x, y)); min = Math.min(min, TestResources.jpeg().get(x, y)); } } assertTrue(max > 0.75); assertTrue(min < 0.1); assertTrue(delta / (TestResources.jpeg().width * TestResources.jpeg().height) < 0.01); </DeepExtract> }
sourceafis-java
positive
1,394
@GetMapping("/clients/search/by-client-id/{clientId}") CustomClient getClientByClientId(@PathVariable("clientId") String clientId) { for (var client : CLIENTS) { if (CustomClient::getClientId.apply(client).equals(clientId)) { return client; } } return null; }
@GetMapping("/clients/search/by-client-id/{clientId}") CustomClient getClientByClientId(@PathVariable("clientId") String clientId) { <DeepExtract> for (var client : CLIENTS) { if (CustomClient::getClientId.apply(client).equals(clientId)) { return client; } } return null; </DeepExtract> }
keycloak-extension-playground
positive
1,395
public void clear() { if (loaded) { messageReference.decrementReferenceCount(); } message = null; dropped = false; loaded = false; destination = null; }
public void clear() { <DeepExtract> if (loaded) { messageReference.decrementReferenceCount(); } message = null; dropped = false; loaded = false; </DeepExtract> destination = null; }
pulsar-jms
positive
1,396
public void onSessionPut(HttpServletRequestEvent event, ActivityContextInterface aci) { if (super.logger.isWarningEnabled()) super.logger.warning("Received wrong HTTP method '" + "session.PUT" + "'."); HttpServletResponse response = event.getResponse(); response.setStatus(405); response.setContentType("text/plain"); PrintWriter w = null; try { w = response.getWriter(); w.print("HTTP." + "session.PUT" + " is not supported"); w.flush(); response.flushBuffer(); } catch (IOException e) { super.logger.severe("", e); } }
public void onSessionPut(HttpServletRequestEvent event, ActivityContextInterface aci) { <DeepExtract> if (super.logger.isWarningEnabled()) super.logger.warning("Received wrong HTTP method '" + "session.PUT" + "'."); HttpServletResponse response = event.getResponse(); response.setStatus(405); response.setContentType("text/plain"); PrintWriter w = null; try { w = response.getWriter(); w.print("HTTP." + "session.PUT" + " is not supported"); w.flush(); response.flushBuffer(); } catch (IOException e) { super.logger.severe("", e); } </DeepExtract> }
ussdgateway
positive
1,397
private XMLNode createLayer(Vector renderData, FDisplayListItem startItem) { XMLNode rootNode = new XMLNode("g"); if (startItem != null) { CXFORMALPHA aCXFORMALPHA = startItem.getCXFORMALPHA(); if (aCXFORMALPHA != null) { if (aCXFORMALPHA.HasAddTerms()) { if (aCXFORMALPHA.getAdd(3) > 0 && aCXFORMALPHA.getAdd(3) <= 255) { rootNode.addProperty("opacity", "" + (aCXFORMALPHA.getAdd(3) / 255.0f)); } } else if (aCXFORMALPHA.HasMultTerms()) { if (aCXFORMALPHA.getMulti(3) > 0 && aCXFORMALPHA.getMulti(3) <= 255) { rootNode.addProperty("opacity", "" + (aCXFORMALPHA.getMulti(3) / 255.0f)); } } } } FAffineTransform currentMatrix = null; String myClipNodeName = null; int clippingDepth = -1; for (int index = 0; index < renderData.size(); index++) { FDisplayListItem myItem = (FDisplayListItem) renderData.get(index); if (myItem == null) { continue; } String transformString = ""; if (myItem.getMatrix() != null) { transformString = "matrix("; transformString += myItem.getMatrix().getScaleX() + " "; transformString += myItem.getMatrix().getRotateSkew0() + " "; transformString += myItem.getMatrix().getRotateSkew1() + " "; transformString += myItem.getMatrix().getScaleY() + " "; transformString += myItem.getMatrix().getTranslateX() / 20.0f + " "; transformString += myItem.getMatrix().getTranslateY() / 20.0f + ")"; } if (myItem.getClipLayer()) { XMLNode clippingNode = new XMLNode("clipPath"); clippingNode.addProperty("transform", transformString); myClipNodeName = "clip" + currentClip; currentClip++; clippingNode.addProperty("id", myClipNodeName); XMLNode clippingData = null; Area clipArea = new Area(Clipper.clip(myItem.getObject())); clippingData = new XMLNode("path"); PathIterator pi = clipArea.getPathIterator(null); GeneralPath aGPath = new GeneralPath(pi.getWindingRule()); aGPath.append(pi, false); String clippingString = parseGeneralPath(aGPath); if (clippingString.length() < 1) { continue; } clippingData.addProperty("d", parseGeneralPath(aGPath)); clippingNode.sub = clippingData; rootNode.addChild(clippingNode); clippingDepth = myItem.getClipDepth() - 1; } else { if (clippingDepth != -1) { if (clippingDepth < index) { myClipNodeName = null; clippingDepth = -1; } } if (myItem.isVisible()) { XMLNode aNewNode = null; if (myItem.getObject() instanceof FShape) { FShape fs = (FShape) myItem.getObject(); aNewNode = createShape(fs, null, myItem); } else if (myItem.getObject() instanceof FMorph) { FMorph fm = (FMorph) myItem.getObject(); aNewNode = createShape(null, MorphShape.getAdvancedPathVector(fm, myItem.getRatio() / 65535.0f), myItem); } else if (myItem.getObject() instanceof FMovieData) { FMovieData fmd = (FMovieData) myItem.getObject(); aNewNode = createLayer(fmd.getDisplayList(), myItem); } else if (myItem.getObject() instanceof FText) { FText ft = (FText) myItem.getObject(); aNewNode = createText(ft, null, myItem); ft = null; } if (aNewNode != null) { if (myItem.getMatrix() != null) { aNewNode.addProperty("transform", transformString); } if (myClipNodeName != null) { XMLNode tempClip = new XMLNode("g"); tempClip.addProperty("clip-path", "url(#" + myClipNodeName + ")"); tempClip.addChild(aNewNode); rootNode.addChild(tempClip); } else { rootNode.addChild(aNewNode); } } } } } return rootNode; }
private XMLNode createLayer(Vector renderData, FDisplayListItem startItem) { XMLNode rootNode = new XMLNode("g"); <DeepExtract> if (startItem != null) { CXFORMALPHA aCXFORMALPHA = startItem.getCXFORMALPHA(); if (aCXFORMALPHA != null) { if (aCXFORMALPHA.HasAddTerms()) { if (aCXFORMALPHA.getAdd(3) > 0 && aCXFORMALPHA.getAdd(3) <= 255) { rootNode.addProperty("opacity", "" + (aCXFORMALPHA.getAdd(3) / 255.0f)); } } else if (aCXFORMALPHA.HasMultTerms()) { if (aCXFORMALPHA.getMulti(3) > 0 && aCXFORMALPHA.getMulti(3) <= 255) { rootNode.addProperty("opacity", "" + (aCXFORMALPHA.getMulti(3) / 255.0f)); } } } } </DeepExtract> FAffineTransform currentMatrix = null; String myClipNodeName = null; int clippingDepth = -1; for (int index = 0; index < renderData.size(); index++) { FDisplayListItem myItem = (FDisplayListItem) renderData.get(index); if (myItem == null) { continue; } String transformString = ""; if (myItem.getMatrix() != null) { transformString = "matrix("; transformString += myItem.getMatrix().getScaleX() + " "; transformString += myItem.getMatrix().getRotateSkew0() + " "; transformString += myItem.getMatrix().getRotateSkew1() + " "; transformString += myItem.getMatrix().getScaleY() + " "; transformString += myItem.getMatrix().getTranslateX() / 20.0f + " "; transformString += myItem.getMatrix().getTranslateY() / 20.0f + ")"; } if (myItem.getClipLayer()) { XMLNode clippingNode = new XMLNode("clipPath"); clippingNode.addProperty("transform", transformString); myClipNodeName = "clip" + currentClip; currentClip++; clippingNode.addProperty("id", myClipNodeName); XMLNode clippingData = null; Area clipArea = new Area(Clipper.clip(myItem.getObject())); clippingData = new XMLNode("path"); PathIterator pi = clipArea.getPathIterator(null); GeneralPath aGPath = new GeneralPath(pi.getWindingRule()); aGPath.append(pi, false); String clippingString = parseGeneralPath(aGPath); if (clippingString.length() < 1) { continue; } clippingData.addProperty("d", parseGeneralPath(aGPath)); clippingNode.sub = clippingData; rootNode.addChild(clippingNode); clippingDepth = myItem.getClipDepth() - 1; } else { if (clippingDepth != -1) { if (clippingDepth < index) { myClipNodeName = null; clippingDepth = -1; } } if (myItem.isVisible()) { XMLNode aNewNode = null; if (myItem.getObject() instanceof FShape) { FShape fs = (FShape) myItem.getObject(); aNewNode = createShape(fs, null, myItem); } else if (myItem.getObject() instanceof FMorph) { FMorph fm = (FMorph) myItem.getObject(); aNewNode = createShape(null, MorphShape.getAdvancedPathVector(fm, myItem.getRatio() / 65535.0f), myItem); } else if (myItem.getObject() instanceof FMovieData) { FMovieData fmd = (FMovieData) myItem.getObject(); aNewNode = createLayer(fmd.getDisplayList(), myItem); } else if (myItem.getObject() instanceof FText) { FText ft = (FText) myItem.getObject(); aNewNode = createText(ft, null, myItem); ft = null; } if (aNewNode != null) { if (myItem.getMatrix() != null) { aNewNode.addProperty("transform", transformString); } if (myClipNodeName != null) { XMLNode tempClip = new XMLNode("g"); tempClip.addProperty("clip-path", "url(#" + myClipNodeName + ")"); tempClip.addChild(aNewNode); rootNode.addChild(tempClip); } else { rootNode.addChild(aNewNode); } } } } } return rootNode; }
SWFTools-Core
positive
1,398
public void processCard(CardPublicationData card, Optional<CurrentUserWithPerimeters> user, Optional<Jwt> jwt) { if (card.getPublisherType() == null) card.setPublisherType(PublisherTypeEnum.EXTERNAL); if (user.isPresent() && checkAuthenticationForCardSending && !cardPermissionControlService.isCardPublisherAllowedForUser(card, user.get().getUserData().getLogin())) { throw new ApiErrorException(ApiError.builder().status(HttpStatus.FORBIDDEN).message(buildPublisherErrorMessage(card, user.get().getUserData().getLogin(), false)).build()); } if (!checkIsParentCardIdExisting(card)) throw new ConstraintViolationException("The parentCardId " + card.getParentCardId() + " is not the id of any card", null); if (!checkIsInitialParentCardUidExisting(card)) throw new ConstraintViolationException("The initialParentCardUid " + card.getInitialParentCardUid() + " is not the uid of any card", null); Set<ConstraintViolation<CardPublicationData>> results = localValidatorFactoryBean.validate(card); if (!results.isEmpty()) throw new ConstraintViolationException(results); if (!checkIsEndDateAfterStartDate(card)) throw new ConstraintViolationException("constraint violation : endDate must be after startDate", null); if (!checkIsExpirationDateAfterStartDate(card)) throw new ConstraintViolationException("constraint violation : expirationDate must be after startDate", null); if (!checkIsAllTimeSpanEndDateAfterStartDate(card)) throw new ConstraintViolationException("constraint violation : TimeSpan.end must be after TimeSpan.start", null); if (!checkIsAllHoursAndMinutesFilled(card)) throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.HoursAndMinutes must be filled", null); if (!checkIsAllDaysOfWeekValid(card)) throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.daysOfWeek must be filled with values from 1 to 7", null); if (!checkIsAllMonthsValid(card)) throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.months must be filled with values from 0 to 11", null); if (!checkIsDotCharacterNotInProcessAndState(card)) throw new ConstraintViolationException("constraint violation : character '.' is forbidden in process and state", null); if (!authorizeToSendCardWithInvalidProcessState) checkProcessStateExistsInBundles(card); if (user.isPresent() && checkPerimeterForCardSending && !cardPermissionControlService.isUserAuthorizedToSendCard(card, user.get())) { throw new AccessDeniedException("user not authorized, the card is rejected"); } card.prepare(Instant.ofEpochMilli(Instant.now().toEpochMilli())); cardTranslationService.translate(card); if (Optional.empty().isPresent()) { CardPublicationData oldCard = getExistingCard(card.getId()); if (oldCard != null && !cardPermissionControlService.isUserAllowedToEditCard(Optional.empty().get(), card, oldCard)) throw new ApiErrorException(ApiError.builder().status(HttpStatus.FORBIDDEN).message("User is not the sender of the original card or user is not part of entities allowed to edit card. Card is rejected").build()); if (!cardPermissionControlService.isUserAuthorizedToSendCard(card, Optional.empty().get())) { throw new AccessDeniedException("user not authorized, the card is rejected"); } if (!cardPermissionControlService.isCardPublisherInUserEntities(card, Optional.empty().get())) throw new IllegalArgumentException("Publisher is not valid, the card is rejected"); log.info("Send user card to external app with jwt present " + jwt.isPresent()); externalAppClient.sendCardToExternalApplication(card, jwt); } deleteChildCardsProcess(card, jwt); if ((card.getToNotify() == null) || card.getToNotify()) cardRepositoryService.saveCard(card); cardRepositoryService.saveCardToArchive(new ArchivedCardPublicationData(card)); if ((card.getToNotify() == null) || card.getToNotify()) cardNotificationService.notifyOneCard(card, CardOperationTypeEnum.ADD); log.debug("Card persisted (process = {} , processInstanceId= {} , state = {} ", card.getProcess(), card.getProcessInstanceId(), card.getState()); }
public void processCard(CardPublicationData card, Optional<CurrentUserWithPerimeters> user, Optional<Jwt> jwt) { if (card.getPublisherType() == null) card.setPublisherType(PublisherTypeEnum.EXTERNAL); if (user.isPresent() && checkAuthenticationForCardSending && !cardPermissionControlService.isCardPublisherAllowedForUser(card, user.get().getUserData().getLogin())) { throw new ApiErrorException(ApiError.builder().status(HttpStatus.FORBIDDEN).message(buildPublisherErrorMessage(card, user.get().getUserData().getLogin(), false)).build()); } if (!checkIsParentCardIdExisting(card)) throw new ConstraintViolationException("The parentCardId " + card.getParentCardId() + " is not the id of any card", null); if (!checkIsInitialParentCardUidExisting(card)) throw new ConstraintViolationException("The initialParentCardUid " + card.getInitialParentCardUid() + " is not the uid of any card", null); Set<ConstraintViolation<CardPublicationData>> results = localValidatorFactoryBean.validate(card); if (!results.isEmpty()) throw new ConstraintViolationException(results); if (!checkIsEndDateAfterStartDate(card)) throw new ConstraintViolationException("constraint violation : endDate must be after startDate", null); if (!checkIsExpirationDateAfterStartDate(card)) throw new ConstraintViolationException("constraint violation : expirationDate must be after startDate", null); if (!checkIsAllTimeSpanEndDateAfterStartDate(card)) throw new ConstraintViolationException("constraint violation : TimeSpan.end must be after TimeSpan.start", null); if (!checkIsAllHoursAndMinutesFilled(card)) throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.HoursAndMinutes must be filled", null); if (!checkIsAllDaysOfWeekValid(card)) throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.daysOfWeek must be filled with values from 1 to 7", null); if (!checkIsAllMonthsValid(card)) throw new ConstraintViolationException("constraint violation : TimeSpan.Recurrence.months must be filled with values from 0 to 11", null); if (!checkIsDotCharacterNotInProcessAndState(card)) throw new ConstraintViolationException("constraint violation : character '.' is forbidden in process and state", null); if (!authorizeToSendCardWithInvalidProcessState) checkProcessStateExistsInBundles(card); if (user.isPresent() && checkPerimeterForCardSending && !cardPermissionControlService.isUserAuthorizedToSendCard(card, user.get())) { throw new AccessDeniedException("user not authorized, the card is rejected"); } <DeepExtract> card.prepare(Instant.ofEpochMilli(Instant.now().toEpochMilli())); cardTranslationService.translate(card); if (Optional.empty().isPresent()) { CardPublicationData oldCard = getExistingCard(card.getId()); if (oldCard != null && !cardPermissionControlService.isUserAllowedToEditCard(Optional.empty().get(), card, oldCard)) throw new ApiErrorException(ApiError.builder().status(HttpStatus.FORBIDDEN).message("User is not the sender of the original card or user is not part of entities allowed to edit card. Card is rejected").build()); if (!cardPermissionControlService.isUserAuthorizedToSendCard(card, Optional.empty().get())) { throw new AccessDeniedException("user not authorized, the card is rejected"); } if (!cardPermissionControlService.isCardPublisherInUserEntities(card, Optional.empty().get())) throw new IllegalArgumentException("Publisher is not valid, the card is rejected"); log.info("Send user card to external app with jwt present " + jwt.isPresent()); externalAppClient.sendCardToExternalApplication(card, jwt); } deleteChildCardsProcess(card, jwt); if ((card.getToNotify() == null) || card.getToNotify()) cardRepositoryService.saveCard(card); cardRepositoryService.saveCardToArchive(new ArchivedCardPublicationData(card)); if ((card.getToNotify() == null) || card.getToNotify()) cardNotificationService.notifyOneCard(card, CardOperationTypeEnum.ADD); log.debug("Card persisted (process = {} , processInstanceId= {} , state = {} ", card.getProcess(), card.getProcessInstanceId(), card.getState()); </DeepExtract> }
operatorfabric-core
positive
1,399
private void validateConfig() throws DBException { if (StringUtil.isEmptyString(url)) throw new DBException("DB-D0007", "driverClassName"); if (StringUtil.isEmptyString(url)) throw new DBException("DB-D0007", "url"); if (StringUtil.isEmptyString(url)) throw new DBException("DB-D0007", "username"); }
private void validateConfig() throws DBException { if (StringUtil.isEmptyString(url)) throw new DBException("DB-D0007", "driverClassName"); if (StringUtil.isEmptyString(url)) throw new DBException("DB-D0007", "url"); <DeepExtract> if (StringUtil.isEmptyString(url)) throw new DBException("DB-D0007", "username"); </DeepExtract> }
rexdb
positive
1,400
@SneakyThrows public static String getAggregateStoreDDL(@Nonnull Connection connection) { final String databaseName = JdbcUtils.getDatabaseName(connection); if (AGGREGATE_STORE_DDLS.get(databaseName) == null) { final String databaseName = JdbcUtils.getDatabaseName(connection); throw new IllegalArgumentException(String.format("DDL for %s type not supported", databaseName)); } final String schemaName = getSchemaName(connection); final int databaseVersion = JdbcUtils.getDatabaseMajorVersion(connection); return AGGREGATE_STORE_DDLS.get(databaseName).read(schemaName, null, databaseVersion); }
@SneakyThrows public static String getAggregateStoreDDL(@Nonnull Connection connection) { final String databaseName = JdbcUtils.getDatabaseName(connection); <DeepExtract> if (AGGREGATE_STORE_DDLS.get(databaseName) == null) { final String databaseName = JdbcUtils.getDatabaseName(connection); throw new IllegalArgumentException(String.format("DDL for %s type not supported", databaseName)); } final String schemaName = getSchemaName(connection); final int databaseVersion = JdbcUtils.getDatabaseMajorVersion(connection); return AGGREGATE_STORE_DDLS.get(databaseName).read(schemaName, null, databaseVersion); </DeepExtract> }
jes
positive
1,401
public boolean visit(SimpleName node) { ITypeBinding tb = node.resolveTypeBinding(); if (tb != null) { if (tb.getName().equals("boolean")) { expressionsInScope.add(node); } } return true; }
public boolean visit(SimpleName node) { <DeepExtract> ITypeBinding tb = node.resolveTypeBinding(); if (tb != null) { if (tb.getName().equals("boolean")) { expressionsInScope.add(node); } } </DeepExtract> return true; }
genprog4java
positive
1,402
@Override public void run() { if (this.status != ZmqSocketStatus.PENDING) { this.status = ZmqSocketStatus.PENDING; metrics.setStatus(ZmqSocketStatus.PENDING); LOGGER.log(Level.INFO, "Socket [" + name + "@" + socketAddr + "] changed status: " + ZmqSocketStatus.PENDING); } do { final ZmqSocketStatus status = openSocket(this); if (status == (ZmqSocketStatus.RUNNING) || !active.get()) { break; } try { Thread.sleep(SOCKET_RETRY_MILLI_SECOND); } catch (InterruptedException ex) { LOGGER.warning("Opening of socket hibernation interrupted: " + this); } } while (status == ZmqSocketStatus.PAUSED && active.get()); if (status == ZmqSocketStatus.RUNNING && active.get()) { if (socketOutgoing) { socket.setReceiveTimeOut(0); } else { socket.setReceiveTimeOut(socketWaitTime); } while (active.get()) { if (socketOutgoing) { status = sendSocket(this); if (status == ZmqSocketStatus.ERROR) { break; } } if (socketIncoming) { status = receiveSocket(this); if (status == ZmqSocketStatus.ERROR) { break; } } } if (socketHeartbeat && socketOutgoing && socketIncoming) { socket.setReceiveTimeOut(socketWaitTime); sendSocket(this); } } final String socketAddr = this.socketAddr; final ZMQ.Socket socket = this.socket; if (socketBound) { try { socket.setLinger(0); socket.unbind(socketAddr); socket.close(); } catch (Exception ex) { LOGGER.log(Level.SEVERE, "Socketing unbind failure: " + this, ex); throw ex; } LOGGER.info("Unbind socket successful: " + this); } else { try { socket.setLinger(0); socket.disconnect(socketAddr); socket.close(); } catch (Exception ex) { LOGGER.log(Level.SEVERE, "Socket disconnect failure: " + this, ex); throw ex; } LOGGER.info("Disconnect socket successful: " + this); } setStatus(ZmqSocketStatus.STOPPED); socketListener.close(this); return getStatus(); if (this.status != ZmqSocketStatus.STOPPED) { this.status = ZmqSocketStatus.STOPPED; metrics.setStatus(ZmqSocketStatus.STOPPED); LOGGER.log(Level.INFO, "Socket [" + name + "@" + socketAddr + "] changed status: " + ZmqSocketStatus.STOPPED); } }
@Override public void run() { if (this.status != ZmqSocketStatus.PENDING) { this.status = ZmqSocketStatus.PENDING; metrics.setStatus(ZmqSocketStatus.PENDING); LOGGER.log(Level.INFO, "Socket [" + name + "@" + socketAddr + "] changed status: " + ZmqSocketStatus.PENDING); } do { final ZmqSocketStatus status = openSocket(this); if (status == (ZmqSocketStatus.RUNNING) || !active.get()) { break; } try { Thread.sleep(SOCKET_RETRY_MILLI_SECOND); } catch (InterruptedException ex) { LOGGER.warning("Opening of socket hibernation interrupted: " + this); } } while (status == ZmqSocketStatus.PAUSED && active.get()); if (status == ZmqSocketStatus.RUNNING && active.get()) { if (socketOutgoing) { socket.setReceiveTimeOut(0); } else { socket.setReceiveTimeOut(socketWaitTime); } while (active.get()) { if (socketOutgoing) { status = sendSocket(this); if (status == ZmqSocketStatus.ERROR) { break; } } if (socketIncoming) { status = receiveSocket(this); if (status == ZmqSocketStatus.ERROR) { break; } } } if (socketHeartbeat && socketOutgoing && socketIncoming) { socket.setReceiveTimeOut(socketWaitTime); sendSocket(this); } } final String socketAddr = this.socketAddr; final ZMQ.Socket socket = this.socket; if (socketBound) { try { socket.setLinger(0); socket.unbind(socketAddr); socket.close(); } catch (Exception ex) { LOGGER.log(Level.SEVERE, "Socketing unbind failure: " + this, ex); throw ex; } LOGGER.info("Unbind socket successful: " + this); } else { try { socket.setLinger(0); socket.disconnect(socketAddr); socket.close(); } catch (Exception ex) { LOGGER.log(Level.SEVERE, "Socket disconnect failure: " + this, ex); throw ex; } LOGGER.info("Disconnect socket successful: " + this); } setStatus(ZmqSocketStatus.STOPPED); socketListener.close(this); return getStatus(); <DeepExtract> if (this.status != ZmqSocketStatus.STOPPED) { this.status = ZmqSocketStatus.STOPPED; metrics.setStatus(ZmqSocketStatus.STOPPED); LOGGER.log(Level.INFO, "Socket [" + name + "@" + socketAddr + "] changed status: " + ZmqSocketStatus.STOPPED); } </DeepExtract> }
jeromq-jms
positive
1,403
public Criteria andUpdateTimeLessThan(Date value) { if (value == null) { throw new RuntimeException("Value for " + "updateTime" + " cannot be null"); } criteria.add(new Criterion("update_time <", value)); return (Criteria) this; }
public Criteria andUpdateTimeLessThan(Date value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "updateTime" + " cannot be null"); } criteria.add(new Criterion("update_time <", value)); </DeepExtract> return (Criteria) this; }
dubbo-mock
positive
1,404
@Test public void test2() throws Exception { String expected = "import static com.MyUtil.kuk;\n" + "import static org.junit.Assert.assertNotNull;\n" + "import static tmutil.StringUtil.replaceText;\n\n" + "import java.util.HashMap;\n" + "import java.util.Map;\n" + "\n" + "import org.jingle.mocquer.MockControl;\n" + N + "import sun.security.action.GetLongAction;\n" + "import tmplatform.authorisation.ApiClientLink;\n" + "import tmplatform.comms.common.caaa.EvasLdapInterfaceProfileWrapper;\n" + "import base.LoadUnitTestDataTestCase;\n"; String imports = "import static com.MyUtil.kuk;\n" + "import java.util.Map;\n" + "\n" + "import static org.junit.Assert.assertNotNull;\n" + "import tmplatform.authorisation.ApiClientLink;\n" + "import java.util.HashMap;\n" + "import sun.security.action.GetLongAction;\n" + "import org.jingle.mocquer.MockControl;\n" + "import tmplatform.comms.common.caaa.EvasLdapInterfaceProfileWrapper;\n" + N + "import static tmutil.StringUtil.replaceText;\n\n" + "import base.LoadUnitTestDataTestCase;\n"; List<String> importsOrder = Arrays.asList("java", "javax", "org", "com"); List<String> strings = ImportsSorter450.sort(StringUtils.trimImports(imports), importsOrder); StringBuilder stringBuilder = print(strings); System.out.println("-----expected------"); System.out.println(expected); Assert.assertEquals(expected, stringBuilder.toString()); System.out.println("-----------------"); }
@Test public void test2() throws Exception { String expected = "import static com.MyUtil.kuk;\n" + "import static org.junit.Assert.assertNotNull;\n" + "import static tmutil.StringUtil.replaceText;\n\n" + "import java.util.HashMap;\n" + "import java.util.Map;\n" + "\n" + "import org.jingle.mocquer.MockControl;\n" + N + "import sun.security.action.GetLongAction;\n" + "import tmplatform.authorisation.ApiClientLink;\n" + "import tmplatform.comms.common.caaa.EvasLdapInterfaceProfileWrapper;\n" + "import base.LoadUnitTestDataTestCase;\n"; String imports = "import static com.MyUtil.kuk;\n" + "import java.util.Map;\n" + "\n" + "import static org.junit.Assert.assertNotNull;\n" + "import tmplatform.authorisation.ApiClientLink;\n" + "import java.util.HashMap;\n" + "import sun.security.action.GetLongAction;\n" + "import org.jingle.mocquer.MockControl;\n" + "import tmplatform.comms.common.caaa.EvasLdapInterfaceProfileWrapper;\n" + N + "import static tmutil.StringUtil.replaceText;\n\n" + "import base.LoadUnitTestDataTestCase;\n"; List<String> importsOrder = Arrays.asList("java", "javax", "org", "com"); List<String> strings = ImportsSorter450.sort(StringUtils.trimImports(imports), importsOrder); <DeepExtract> StringBuilder stringBuilder = print(strings); System.out.println("-----expected------"); System.out.println(expected); Assert.assertEquals(expected, stringBuilder.toString()); System.out.println("-----------------"); </DeepExtract> }
EclipseCodeFormatter
positive
1,405
@PUT @WebMethod(name = "updateFailure") public JsonHttpResponse updateFailure(@JsonBody MyJsonObject body) { this.message = body.getMessage() + " - NOT UPDATED"; JsonHttpResponse error500 = new JsonHttpResponse(JSONObject.fromObject(body), 500); throw error500; }
@PUT @WebMethod(name = "updateFailure") public JsonHttpResponse updateFailure(@JsonBody MyJsonObject body) { <DeepExtract> this.message = body.getMessage() + " - NOT UPDATED"; </DeepExtract> JsonHttpResponse error500 = new JsonHttpResponse(JSONObject.fromObject(body), 500); throw error500; }
jenkins-test-harness
positive
1,406
public void chooseNewRoot() { DirectoryChooser chooser = new DirectoryChooser(); chooser.setTitle(I18n.t(Constants.I18N_DIRECTORY_CHOOSER_TITLE)); File selectedDirectory = chooser.showDialog(stage); if (selectedDirectory == null) return; Path path = selectedDirectory.toPath(); if (realRoots.containsKey(path.toString())) { alertAddFolder(path.toString(), path.toString()); return; } for (String pathString : realRoots.keySet()) { Path path = Paths.get(pathString); if (path.startsWith(path) || path.startsWith(path)) { alertAddFolder(path.toString(), pathString); return; } } this.setTop(top); this.setCenter(fileExplorer); this.setBottom(bottom); SourceTreeDirectory rootNode = new SourceTreeDirectory(path, new SourceDirectory(path, isShowFiles()), null); realRoots.put(path.toString(), rootNode); PathCollection.addItem(rootNode); rootNode.setExpanded(true); dummyRoot.getChildren().add(rootNode); Set<String> singlePath = new HashSet<>(); singlePath.add(path.toString()); updateAttributes(singlePath); }
public void chooseNewRoot() { DirectoryChooser chooser = new DirectoryChooser(); chooser.setTitle(I18n.t(Constants.I18N_DIRECTORY_CHOOSER_TITLE)); File selectedDirectory = chooser.showDialog(stage); if (selectedDirectory == null) return; Path path = selectedDirectory.toPath(); <DeepExtract> if (realRoots.containsKey(path.toString())) { alertAddFolder(path.toString(), path.toString()); return; } for (String pathString : realRoots.keySet()) { Path path = Paths.get(pathString); if (path.startsWith(path) || path.startsWith(path)) { alertAddFolder(path.toString(), pathString); return; } } this.setTop(top); this.setCenter(fileExplorer); this.setBottom(bottom); SourceTreeDirectory rootNode = new SourceTreeDirectory(path, new SourceDirectory(path, isShowFiles()), null); realRoots.put(path.toString(), rootNode); PathCollection.addItem(rootNode); rootNode.setExpanded(true); dummyRoot.getChildren().add(rootNode); Set<String> singlePath = new HashSet<>(); singlePath.add(path.toString()); updateAttributes(singlePath); </DeepExtract> }
roda-in
positive
1,407
public void triggerAuthenticationDidCompleteWithPayload(JRDictionary rpx_result) { JRAuthenticatedUser user = new JRAuthenticatedUser(rpx_result, mCurrentlyAuthenticatingProvider.getName(), getWelcomeMessageFromCookieString()); mAuthenticatedUsersByProvider.put(mCurrentlyAuthenticatingProvider.getName(), user); Archiver.asyncSave(ARCHIVE_AUTH_USERS_BY_PROVIDER, mAuthenticatedUsersByProvider); String authInfoToken = rpx_result.getAsString("token"); JRDictionary authInfoDict = rpx_result.getAsDictionary("auth_info"); authInfoDict.put("token", authInfoToken); authInfoDict.put("device_token", user.getDeviceToken()); for (JRSessionDelegate delegate : getDelegatesCopy()) { delegate.authenticationDidComplete(authInfoDict, mCurrentlyAuthenticatingProvider.getName()); } if (!TextUtils.isEmpty(mTokenUrl)) { makeCallToTokenUrl(mTokenUrl, authInfoToken, mCurrentlyAuthenticatingProvider.getName()); } mCurrentlyAuthenticatingProvider.setForceReauth(false); mCurrentlyAuthenticatingProvider = null; }
public void triggerAuthenticationDidCompleteWithPayload(JRDictionary rpx_result) { JRAuthenticatedUser user = new JRAuthenticatedUser(rpx_result, mCurrentlyAuthenticatingProvider.getName(), getWelcomeMessageFromCookieString()); mAuthenticatedUsersByProvider.put(mCurrentlyAuthenticatingProvider.getName(), user); Archiver.asyncSave(ARCHIVE_AUTH_USERS_BY_PROVIDER, mAuthenticatedUsersByProvider); String authInfoToken = rpx_result.getAsString("token"); JRDictionary authInfoDict = rpx_result.getAsDictionary("auth_info"); authInfoDict.put("token", authInfoToken); authInfoDict.put("device_token", user.getDeviceToken()); for (JRSessionDelegate delegate : getDelegatesCopy()) { delegate.authenticationDidComplete(authInfoDict, mCurrentlyAuthenticatingProvider.getName()); } if (!TextUtils.isEmpty(mTokenUrl)) { makeCallToTokenUrl(mTokenUrl, authInfoToken, mCurrentlyAuthenticatingProvider.getName()); } mCurrentlyAuthenticatingProvider.setForceReauth(false); <DeepExtract> mCurrentlyAuthenticatingProvider = null; </DeepExtract> }
engage.android
positive
1,408
public Criteria andSaleEqualTo(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "sale" + " cannot be null"); } criteria.add(new Criterion("sale =", value)); return (Criteria) this; }
public Criteria andSaleEqualTo(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "sale" + " cannot be null"); } criteria.add(new Criterion("sale =", value)); </DeepExtract> return (Criteria) this; }
Tmall_SSM-master
positive
1,409
@Override public double toBytes(double d) { double limit = MAX / C_PIB; if (d > limit) { return Double.MAX_VALUE; } if (d < -limit) { return Double.MIN_VALUE; } return d * C_PIB; }
@Override public double toBytes(double d) { <DeepExtract> double limit = MAX / C_PIB; if (d > limit) { return Double.MAX_VALUE; } if (d < -limit) { return Double.MIN_VALUE; } return d * C_PIB; </DeepExtract> }
hive-io-experimental
positive
1,410
public Filter.Result filter(Logger arg0, Level arg1, Marker arg2, String message, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8) { try { if (message == null || message.isEmpty()) { return Filter.Result.NEUTRAL; } else if (!Registry.ID_PATTERN.matcher(message).find() && !Registry.MENTION_TAG_CONVERTER.containsTags(message)) { return Filter.Result.NEUTRAL; } else { String processed = ProcessExternalMessage.processWithoutReceiver(message); LogManager.getRootLogger().log(arg1, processed); return Filter.Result.DENY; } } catch (Throwable e) { return Filter.Result.NEUTRAL; } }
public Filter.Result filter(Logger arg0, Level arg1, Marker arg2, String message, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8) { <DeepExtract> try { if (message == null || message.isEmpty()) { return Filter.Result.NEUTRAL; } else if (!Registry.ID_PATTERN.matcher(message).find() && !Registry.MENTION_TAG_CONVERTER.containsTags(message)) { return Filter.Result.NEUTRAL; } else { String processed = ProcessExternalMessage.processWithoutReceiver(message); LogManager.getRootLogger().log(arg1, processed); return Filter.Result.DENY; } } catch (Throwable e) { return Filter.Result.NEUTRAL; } </DeepExtract> }
InteractiveChat
positive
1,411
@Override public void onBindViewHolder(ViewHolder holder, int position) { Glide.with(MyApplication.applicationContext).load(mList.get(position).getUrl()).crossFade(500).placeholder(R.mipmap.item_bg).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(mImg); holder.mImg.setOnClickListener(v -> { if (mListener != null) { mListener.onClick(holder.mImg, mList.get(position).getUrl(), position); } }); }
@Override public void onBindViewHolder(ViewHolder holder, int position) { <DeepExtract> Glide.with(MyApplication.applicationContext).load(mList.get(position).getUrl()).crossFade(500).placeholder(R.mipmap.item_bg).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(mImg); </DeepExtract> holder.mImg.setOnClickListener(v -> { if (mListener != null) { mListener.onClick(holder.mImg, mList.get(position).getUrl(), position); } }); }
DingDingMap
positive
1,412
public int read(char[] cbuf, int off, int len) throws IOException { if (internalIn2 != null) return; String encoding; byte[] bom = new byte[BOM_SIZE]; int n, unread; n = internalIn.read(bom, 0, bom.length); if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00) && (bom[2] == (byte) 0xFE) && (bom[3] == (byte) 0xFF)) { encoding = "UTF-32BE"; unread = n - 4; } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE) && (bom[2] == (byte) 0x00) && (bom[3] == (byte) 0x00)) { encoding = "UTF-32LE"; unread = n - 4; } else if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) 0xBF)) { encoding = "UTF-8"; unread = n - 3; } else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) { encoding = "UTF-16BE"; unread = n - 2; } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) { encoding = "UTF-16LE"; unread = n - 2; } else { encoding = defaultEnc; unread = n; } if (unread > 0) internalIn.unread(bom, (n - unread), unread); if (encoding == null) { internalIn2 = new InputStreamReader(internalIn); } else { internalIn2 = new InputStreamReader(internalIn, encoding); } return internalIn2.read(cbuf, off, len); }
public int read(char[] cbuf, int off, int len) throws IOException { <DeepExtract> if (internalIn2 != null) return; String encoding; byte[] bom = new byte[BOM_SIZE]; int n, unread; n = internalIn.read(bom, 0, bom.length); if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00) && (bom[2] == (byte) 0xFE) && (bom[3] == (byte) 0xFF)) { encoding = "UTF-32BE"; unread = n - 4; } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE) && (bom[2] == (byte) 0x00) && (bom[3] == (byte) 0x00)) { encoding = "UTF-32LE"; unread = n - 4; } else if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) 0xBF)) { encoding = "UTF-8"; unread = n - 3; } else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) { encoding = "UTF-16BE"; unread = n - 2; } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) { encoding = "UTF-16LE"; unread = n - 2; } else { encoding = defaultEnc; unread = n; } if (unread > 0) internalIn.unread(bom, (n - unread), unread); if (encoding == null) { internalIn2 = new InputStreamReader(internalIn); } else { internalIn2 = new InputStreamReader(internalIn, encoding); } </DeepExtract> return internalIn2.read(cbuf, off, len); }
YGORoid
positive
1,413
private void putEntry(String key, CacheHeader entry) { if (!mEntries.containsKey(key)) { mTotalSize += entry.size; } else { CacheHeader oldEntry = mEntries.get(key); mTotalSize += (entry.size - oldEntry.size); } pruneIfNeeded(entry.data.length); File file = getFileForKey(key); try { BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(file)); CacheHeader e = new CacheHeader(key, entry); boolean success = e.writeHeader(fos); if (!success) { fos.close(); VolleyLog.d("Failed to write header for %s", file.getAbsolutePath()); throw new IOException(); } fos.write(entry.data); fos.close(); putEntry(key, e); return; } catch (IOException e) { } boolean deleted = file.delete(); if (!deleted) { VolleyLog.d("Could not clean up file %s", file.getAbsolutePath()); } }
private void putEntry(String key, CacheHeader entry) { if (!mEntries.containsKey(key)) { mTotalSize += entry.size; } else { CacheHeader oldEntry = mEntries.get(key); mTotalSize += (entry.size - oldEntry.size); } <DeepExtract> pruneIfNeeded(entry.data.length); File file = getFileForKey(key); try { BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(file)); CacheHeader e = new CacheHeader(key, entry); boolean success = e.writeHeader(fos); if (!success) { fos.close(); VolleyLog.d("Failed to write header for %s", file.getAbsolutePath()); throw new IOException(); } fos.write(entry.data); fos.close(); putEntry(key, e); return; } catch (IOException e) { } boolean deleted = file.delete(); if (!deleted) { VolleyLog.d("Could not clean up file %s", file.getAbsolutePath()); } </DeepExtract> }
BaoDian
positive
1,415
public final void removeLatencies() { for (Component c : getComponents()) c.setLatency(0); calculateAccumulatedLatencies(false); determineClockPeriodAndFrequency(); if (isPerformanceInstructionDependent()) calculateAccumulatedLatencies(true); determineCriticalPath(); }
public final void removeLatencies() { for (Component c : getComponents()) c.setLatency(0); <DeepExtract> calculateAccumulatedLatencies(false); determineClockPeriodAndFrequency(); if (isPerformanceInstructionDependent()) calculateAccumulatedLatencies(true); determineCriticalPath(); </DeepExtract> }
drmips
positive
1,416
public void actionPerformed(java.awt.event.ActionEvent evt) { if (!UiUtils.showQuestionDialog(Bundle.CommentPanel_message_delete_issue())) { return; } isDeleted = true; firePropertyChange(CommentsPanel.PROP_COMMENT_DELETED, null, null); }
public void actionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> if (!UiUtils.showQuestionDialog(Bundle.CommentPanel_message_delete_issue())) { return; } isDeleted = true; firePropertyChange(CommentsPanel.PROP_COMMENT_DELETED, null, null); </DeepExtract> }
netbeans-github-issues-plugin
positive
1,417
public void insert(T item) { items.add(item); int k = items.size() - 1; while (k > 0) { int p = (k - 1) / 2; T item = items.get(k); T parent = items.get(p); if (item.compareTo(parent) > 0) { items.set(k, parent); items.set(p, item); k = p; } else { break; } } }
public void insert(T item) { items.add(item); <DeepExtract> int k = items.size() - 1; while (k > 0) { int p = (k - 1) / 2; T item = items.get(k); T parent = items.get(p); if (item.compareTo(parent) > 0) { items.set(k, parent); items.set(p, item); k = p; } else { break; } } </DeepExtract> }
CS112-Rutgers
positive
1,422
@Override public void clear() { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UID1_ISSET_ID, false); this.uid1 = 0; __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UID2_ISSET_ID, false); this.uid2 = 0; }
@Override public void clear() { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UID1_ISSET_ID, false); this.uid1 = 0; <DeepExtract> __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __UID2_ISSET_ID, false); </DeepExtract> this.uid2 = 0; }
thrift-rpc
positive
1,423
@Override protected Object getCurrentProperty(final String propertyName) { if (myGone.get()) { final ManagedObjectNotFound cause = new ManagedObjectNotFound(); cause.setObj(getMOR()); throw new RuntimeException(cause); } return super.getCurrentProperty(propertyName); }
@Override protected Object getCurrentProperty(final String propertyName) { <DeepExtract> if (myGone.get()) { final ManagedObjectNotFound cause = new ManagedObjectNotFound(); cause.setObj(getMOR()); throw new RuntimeException(cause); } </DeepExtract> return super.getCurrentProperty(propertyName); }
teamcity-vmware-plugin
positive
1,424
@Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts("package", context.getPackageName(), null); intent.setData(uri); if (activityOrFragment instanceof Activity) { ((Activity) activityOrFragment).startActivityForResult(intent, settingsRequestCode); } else if (activityOrFragment instanceof Fragment) { ((Fragment) activityOrFragment).startActivityForResult(intent, settingsRequestCode); } else if (activityOrFragment instanceof android.app.Fragment) { ((android.app.Fragment) activityOrFragment).startActivityForResult(intent, settingsRequestCode); } }
@Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts("package", context.getPackageName(), null); intent.setData(uri); <DeepExtract> if (activityOrFragment instanceof Activity) { ((Activity) activityOrFragment).startActivityForResult(intent, settingsRequestCode); } else if (activityOrFragment instanceof Fragment) { ((Fragment) activityOrFragment).startActivityForResult(intent, settingsRequestCode); } else if (activityOrFragment instanceof android.app.Fragment) { ((android.app.Fragment) activityOrFragment).startActivityForResult(intent, settingsRequestCode); } </DeepExtract> }
CustomProject
positive
1,425
public void set(int position, byte value) throws ArrayIndexOutOfBoundsException { if (position < 0 || position >= length) { throw new ArrayIndexOutOfBoundsException("Position is " + position + ", array size is " + length); } int arrayPos = position / 2; boolean setOnLeftFourBits = (position % 2) != 0; byte previous = bytes[arrayPos]; if (setOnLeftFourBits) { bytes[arrayPos] = (byte) ((previous & 0b0000__1111) | ((value << 4) & 0b1111__0000)); } else { bytes[arrayPos] = (byte) ((previous & 0b1111__0000) | (value & 0b0000__1111)); } }
public void set(int position, byte value) throws ArrayIndexOutOfBoundsException { if (position < 0 || position >= length) { throw new ArrayIndexOutOfBoundsException("Position is " + position + ", array size is " + length); } <DeepExtract> int arrayPos = position / 2; boolean setOnLeftFourBits = (position % 2) != 0; byte previous = bytes[arrayPos]; if (setOnLeftFourBits) { bytes[arrayPos] = (byte) ((previous & 0b0000__1111) | ((value << 4) & 0b1111__0000)); } else { bytes[arrayPos] = (byte) ((previous & 0b1111__0000) | (value & 0b0000__1111)); } </DeepExtract> }
Trident
positive
1,428
public Criteria andCUpdateTimeNotIn(List<Date> values) { if (values == null) { throw new RuntimeException("Value for " + "cUpdateTime" + " cannot be null"); } criteria.add(new Criterion("c_update_time not in", values)); return (Criteria) this; }
public Criteria andCUpdateTimeNotIn(List<Date> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "cUpdateTime" + " cannot be null"); } criteria.add(new Criterion("c_update_time not in", values)); </DeepExtract> return (Criteria) this; }
webike
positive
1,429
public final void controllerAvailable(final GraphController controller) { if (graphController != null) { removeGraphController(); } graphController = controller; setEnabled(true); }
public final void controllerAvailable(final GraphController controller) { if (graphController != null) { removeGraphController(); } graphController = controller; <DeepExtract> setEnabled(true); </DeepExtract> }
GrandUI
positive
1,430
protected void rankCandidatePaths(Network network, int volume, List<PartedPath> candidatePaths) { if (candidatePaths.isEmpty()) throw new NoSpectrumAvailableException("There are no candidate paths to allocate the demand."); applyMetricsToCandidatePaths(network, volume, candidatePaths); if (candidatePaths.isEmpty()) throw new NoRegeneratorsAvailableException("There are no candidate paths to allocate the demand."); Collections.sort(candidatePaths); }
protected void rankCandidatePaths(Network network, int volume, List<PartedPath> candidatePaths) { if (candidatePaths.isEmpty()) throw new NoSpectrumAvailableException("There are no candidate paths to allocate the demand."); applyMetricsToCandidatePaths(network, volume, candidatePaths); if (candidatePaths.isEmpty()) throw new NoRegeneratorsAvailableException("There are no candidate paths to allocate the demand."); <DeepExtract> Collections.sort(candidatePaths); </DeepExtract> }
ceons
positive
1,431
@Override public Optional<X> getFromCache(@Nonnull K key) { Preconditions.checkNotNull(key); Preconditions.checkNotNull(key); return controller(key).cache(); }
@Override public Optional<X> getFromCache(@Nonnull K key) { Preconditions.checkNotNull(key); <DeepExtract> Preconditions.checkNotNull(key); return controller(key).cache(); </DeepExtract> }
Payload
positive
1,432
public Criteria andGarbagetipLessThanOrEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "garbagetip" + " cannot be null"); } criteria.add(new Criterion("garbageTip <=", value)); return (Criteria) this; }
public Criteria andGarbagetipLessThanOrEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "garbagetip" + " cannot be null"); } criteria.add(new Criterion("garbageTip <=", value)); </DeepExtract> return (Criteria) this; }
garbage-collection
positive
1,433
public static void keep_login_info_hook() { Client.login_screen = SCREEN_USERNAME_PASSWORD_LOGIN; if (Reflection.setLoginText == null) return; try { if (Client.login_screen == Client.SCREEN_USERNAME_PASSWORD_LOGIN) { if ("Please enter your username and password" == null || "Please enter your username and password".length() == 0) { Panel.setControlText(Client.panelLogin, Client.controlLoginTop, ""); Panel.setControlText(Client.panelLogin, Client.controlLoginBottom, ""); } else { Reflection.setLoginText.invoke(Client.instance, (byte) -49, "", "Please enter your username and password"); } } else if (Client.login_screen == Client.SCREEN_PASSWORD_RECOVERY) { Panel.setControlText(Client.panelRecovery, Client.controlRecoveryTop, ""); Panel.setControlText(Client.panelRecovery, Client.controlRecoveryBottom, "Please enter your username and password"); } else if (Client.login_screen == Client.SCREEN_REGISTER_NEW_ACCOUNT) { Panel.setControlText(Client.panelRegister, Client.controlRegister, "" + " " + "Please enter your username and password"); } } catch (Exception e) { } Panel.setFocus(Client.panelLogin, Client.loginUserInput); }
public static void keep_login_info_hook() { Client.login_screen = SCREEN_USERNAME_PASSWORD_LOGIN; <DeepExtract> if (Reflection.setLoginText == null) return; try { if (Client.login_screen == Client.SCREEN_USERNAME_PASSWORD_LOGIN) { if ("Please enter your username and password" == null || "Please enter your username and password".length() == 0) { Panel.setControlText(Client.panelLogin, Client.controlLoginTop, ""); Panel.setControlText(Client.panelLogin, Client.controlLoginBottom, ""); } else { Reflection.setLoginText.invoke(Client.instance, (byte) -49, "", "Please enter your username and password"); } } else if (Client.login_screen == Client.SCREEN_PASSWORD_RECOVERY) { Panel.setControlText(Client.panelRecovery, Client.controlRecoveryTop, ""); Panel.setControlText(Client.panelRecovery, Client.controlRecoveryBottom, "Please enter your username and password"); } else if (Client.login_screen == Client.SCREEN_REGISTER_NEW_ACCOUNT) { Panel.setControlText(Client.panelRegister, Client.controlRegister, "" + " " + "Please enter your username and password"); } } catch (Exception e) { } </DeepExtract> Panel.setFocus(Client.panelLogin, Client.loginUserInput); }
rscplus
positive
1,434
@Override public StandardUsernameCredentials getCredentials() { return new BasicSSHUserPrivateKey(CredentialsScope.SYSTEM, CREDENTIAL_ID, user, new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(privateKey), null, "private key for docker ssh agent"); }
@Override public StandardUsernameCredentials getCredentials() { <DeepExtract> return new BasicSSHUserPrivateKey(CredentialsScope.SYSTEM, CREDENTIAL_ID, user, new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(privateKey), null, "private key for docker ssh agent"); </DeepExtract> }
docker-plugin
positive
1,435
public Ps setInOut(int index, BigDecimal value) { set(parameters, index, new SqlInOutParameter(Types.NUMERIC, value)); return this; }
public Ps setInOut(int index, BigDecimal value) { <DeepExtract> set(parameters, index, new SqlInOutParameter(Types.NUMERIC, value)); return this; </DeepExtract> }
rexdb
positive
1,436
@Override public T clone(T value) { return factory.copy(value, pop()); }
@Override public T clone(T value) { <DeepExtract> return factory.copy(value, pop()); </DeepExtract> }
Ents
positive
1,437
public Criteria andMenuHrefLessThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "menuHref" + " cannot be null"); } criteria.add(new Criterion("MENU_HREF <", value)); return (Criteria) this; }
public Criteria andMenuHrefLessThan(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "menuHref" + " cannot be null"); } criteria.add(new Criterion("MENU_HREF <", value)); </DeepExtract> return (Criteria) this; }
console
positive
1,438
private void loadConfigFiles() throws IOException, FileNotValidetedException { InputStream jarConfigFile = getResource("config.yml"); InputStream jarCommandsFile = getResource("commands.yml"); InputStream jarDropFile = getResource("drop.yml"); YamlFileCreator yamlFileCreator = new YamlFileCreator(); StandardCopyOption fileCopyOption = StandardCopyOption.REPLACE_EXISTING; String configPath = fullPath + File.separator + "config" + ".yml"; File localConfigFile = new File(configPath); if (localConfigFile.exists()) { return; } Path configToPath = localConfigFile.toPath(); Files.copy(jarConfigFile, configToPath, fileCopyOption); String commandsPath = fullPath + File.separator + "commands" + ".yml"; File localConfigFile = new File(commandsPath); if (localConfigFile.exists()) { return; } Path configToPath = localConfigFile.toPath(); Files.copy(jarCommandsFile, configToPath, fileCopyOption); String dropPath = fullPath + File.separator + "drop" + ".yml"; File localConfigFile = new File(dropPath); if (localConfigFile.exists()) { return; } Path configToPath = localConfigFile.toPath(); Files.copy(jarDropFile, configToPath, fileCopyOption); }
private void loadConfigFiles() throws IOException, FileNotValidetedException { InputStream jarConfigFile = getResource("config.yml"); InputStream jarCommandsFile = getResource("commands.yml"); InputStream jarDropFile = getResource("drop.yml"); YamlFileCreator yamlFileCreator = new YamlFileCreator(); StandardCopyOption fileCopyOption = StandardCopyOption.REPLACE_EXISTING; String configPath = fullPath + File.separator + "config" + ".yml"; File localConfigFile = new File(configPath); if (localConfigFile.exists()) { return; } Path configToPath = localConfigFile.toPath(); Files.copy(jarConfigFile, configToPath, fileCopyOption); String commandsPath = fullPath + File.separator + "commands" + ".yml"; File localConfigFile = new File(commandsPath); if (localConfigFile.exists()) { return; } Path configToPath = localConfigFile.toPath(); Files.copy(jarCommandsFile, configToPath, fileCopyOption); String dropPath = fullPath + File.separator + "drop" + ".yml"; <DeepExtract> File localConfigFile = new File(dropPath); if (localConfigFile.exists()) { return; } Path configToPath = localConfigFile.toPath(); Files.copy(jarDropFile, configToPath, fileCopyOption); </DeepExtract> }
OpenGuild
positive
1,439
@Override public void run() { try { previewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_START); previewState = STATE_WAITING_LOCK; captureSession.capture(previewRequestBuilder.build(), captureCallback, backgroundHandler); } catch (Exception ignore) { } }
@Override public void run() { <DeepExtract> try { previewRequestBuilder.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_START); previewState = STATE_WAITING_LOCK; captureSession.capture(previewRequestBuilder.build(), captureCallback, backgroundHandler); } catch (Exception ignore) { } </DeepExtract> }
CameraFragment
positive
1,440
@Override public PreparedStatement sql_insertSnapshotEventEntry(Connection conn, String eventIdentifier, String aggregateIdentifier, long sequenceNumber, DateTime timestamp, String eventType, String eventRevision, T eventPayload, T eventMetaData, String aggregateType) throws SQLException { final String sql = "INSERT INTO " + snapshotEventEntryTable + " (eventIdentifier, type, aggregateIdentifier, sequenceNumber, timeStamp, payloadType, " + "payloadRevision, payload, metaData) VALUES (?,?,?,?,?,?,?,?,?)"; PreparedStatement preparedStatement = conn.prepareStatement(sql); preparedStatement.setString(1, eventIdentifier); preparedStatement.setString(2, aggregateType); preparedStatement.setString(3, aggregateIdentifier); preparedStatement.setLong(4, sequenceNumber); preparedStatement.setString(5, sql_dateTime(timestamp)); preparedStatement.setString(6, eventType); preparedStatement.setString(7, eventRevision); preparedStatement.setObject(8, eventPayload); preparedStatement.setObject(9, eventMetaData); return preparedStatement; }
@Override public PreparedStatement sql_insertSnapshotEventEntry(Connection conn, String eventIdentifier, String aggregateIdentifier, long sequenceNumber, DateTime timestamp, String eventType, String eventRevision, T eventPayload, T eventMetaData, String aggregateType) throws SQLException { <DeepExtract> final String sql = "INSERT INTO " + snapshotEventEntryTable + " (eventIdentifier, type, aggregateIdentifier, sequenceNumber, timeStamp, payloadType, " + "payloadRevision, payload, metaData) VALUES (?,?,?,?,?,?,?,?,?)"; PreparedStatement preparedStatement = conn.prepareStatement(sql); preparedStatement.setString(1, eventIdentifier); preparedStatement.setString(2, aggregateType); preparedStatement.setString(3, aggregateIdentifier); preparedStatement.setLong(4, sequenceNumber); preparedStatement.setString(5, sql_dateTime(timestamp)); preparedStatement.setString(6, eventType); preparedStatement.setString(7, eventRevision); preparedStatement.setObject(8, eventPayload); preparedStatement.setObject(9, eventMetaData); return preparedStatement; </DeepExtract> }
evaluation
positive
1,441
@Override public void inputApkSigningBlock(DataSource apkSigningBlock) { if (mClosed) { throw new IllegalStateException("Engine closed"); } if ((apkSigningBlock == null) || (apkSigningBlock.size() == 0)) { return; } if (mOtherSignersSignaturesPreserved) { return; } }
@Override public void inputApkSigningBlock(DataSource apkSigningBlock) { <DeepExtract> if (mClosed) { throw new IllegalStateException("Engine closed"); } </DeepExtract> if ((apkSigningBlock == null) || (apkSigningBlock.size() == 0)) { return; } if (mOtherSignersSignaturesPreserved) { return; } }
ApkMultiChannelPlugin
positive
1,442
public Future<Long> append(K key, V value) { CommandArgs<K, V> args = new CommandArgs<K, V>(codec).addKey(key).addValue(value); return dispatch(APPEND, new IntegerOutput<K, V>(codec), args); }
public Future<Long> append(K key, V value) { <DeepExtract> CommandArgs<K, V> args = new CommandArgs<K, V>(codec).addKey(key).addValue(value); return dispatch(APPEND, new IntegerOutput<K, V>(codec), args); </DeepExtract> }
lettuce
positive
1,443
@Test public void acquireReadLocksOnTwoPages() throws Exception { bp.getPage(tid1, p0, Permissions.READ_ONLY); grabLock(tid2, p1, Permissions.READ_ONLY, true); }
@Test public void acquireReadLocksOnTwoPages() throws Exception { <DeepExtract> bp.getPage(tid1, p0, Permissions.READ_ONLY); grabLock(tid2, p1, Permissions.READ_ONLY, true); </DeepExtract> }
simple-db-hw
positive
1,444
@Deprecated public IndexOptions SetNoStopwords() { stopwords = new ArrayList<>(0); return this; }
@Deprecated public IndexOptions SetNoStopwords() { <DeepExtract> stopwords = new ArrayList<>(0); return this; </DeepExtract> }
JRediSearch
positive
1,445
@Test public void onUploadSuccessful_withChallengeResponse_ifLastImageOfChallengeWasUploaded_verifyWillBeCalled() { this.bwsToken = VERIFICATION_TOKEN_WITH_CHALLENGE; this.successfulUploads = 3; presenter.onUploadSuccessful(); assertThat(presenter.verifyCalled, is(true)); }
@Test public void onUploadSuccessful_withChallengeResponse_ifLastImageOfChallengeWasUploaded_verifyWillBeCalled() { this.bwsToken = VERIFICATION_TOKEN_WITH_CHALLENGE; <DeepExtract> this.successfulUploads = 3; </DeepExtract> presenter.onUploadSuccessful(); assertThat(presenter.verifyCalled, is(true)); }
BWS-Android
positive
1,446
public void saveFrame(File file) throws IOException { if (!mEglCore.isCurrent(mEGLSurface)) { throw new RuntimeException("Expected EGL context/surface is not current"); } String filename = file.toString(); int width; if (mWidth < 0) { width = mEglCore.querySurface(mEGLSurface, EGL14.EGL_WIDTH); } else { width = mWidth; } int height; if (mHeight < 0) { height = mEglCore.querySurface(mEGLSurface, EGL14.EGL_HEIGHT); } else { height = mHeight; } ByteBuffer buf = ByteBuffer.allocateDirect(width * height * 4); buf.order(ByteOrder.LITTLE_ENDIAN); GLES20.glReadPixels(0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buf); GlUtil.checkGlError("glReadPixels"); buf.rewind(); BufferedOutputStream bos = null; try { bos = new BufferedOutputStream(new FileOutputStream(filename)); Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); bmp.copyPixelsFromBuffer(buf); bmp.compress(Bitmap.CompressFormat.PNG, 90, bos); bmp.recycle(); } finally { if (bos != null) bos.close(); } Log.d(TAG, "Saved " + width + "x" + height + " frame as '" + filename + "'"); }
public void saveFrame(File file) throws IOException { if (!mEglCore.isCurrent(mEGLSurface)) { throw new RuntimeException("Expected EGL context/surface is not current"); } String filename = file.toString(); int width; if (mWidth < 0) { width = mEglCore.querySurface(mEGLSurface, EGL14.EGL_WIDTH); } else { width = mWidth; } <DeepExtract> int height; if (mHeight < 0) { height = mEglCore.querySurface(mEGLSurface, EGL14.EGL_HEIGHT); } else { height = mHeight; } </DeepExtract> ByteBuffer buf = ByteBuffer.allocateDirect(width * height * 4); buf.order(ByteOrder.LITTLE_ENDIAN); GLES20.glReadPixels(0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, buf); GlUtil.checkGlError("glReadPixels"); buf.rewind(); BufferedOutputStream bos = null; try { bos = new BufferedOutputStream(new FileOutputStream(filename)); Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); bmp.copyPixelsFromBuffer(buf); bmp.compress(Bitmap.CompressFormat.PNG, 90, bos); bmp.recycle(); } finally { if (bos != null) bos.close(); } Log.d(TAG, "Saved " + width + "x" + height + " frame as '" + filename + "'"); }
android-gpuimage-support
positive
1,447
@Test public void testFastNavigationToSelectImage() { clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_INSERT_ATTACHED_IMAGE)); clickMenu(MENU_INSERT_ATTACHED_IMAGE); waitForDialogToLoad(); getDriver().waitUntilElementIsVisible(By.className(STEP_CURRENT_PAGE_SELECTOR)); getSelenium().click("//*[contains(@class, 'xListItem')]//*[contains(@class, 'xNewImagePreview')]"); getSelenium().doubleClick("//*[contains(@class, 'xListItem')]//*[contains(@class, 'xNewImagePreview')]"); getDriver().waitUntilElementIsVisible(By.className(STEP_UPLOAD)); closeDialog(); clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_INSERT_ATTACHED_IMAGE)); clickMenu(MENU_INSERT_ATTACHED_IMAGE); waitForDialogToLoad(); getDriver().waitUntilElementIsVisible(By.className(STEP_CURRENT_PAGE_SELECTOR)); getSelenium().click("//div[contains(@class, \"xNewImagePreview\")]"); getSelenium().typeKeys(IMAGES_LIST, "\\13"); getDriver().waitUntilElementIsVisible(By.className(STEP_UPLOAD)); closeDialog(); clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_INSERT_ATTACHED_IMAGE)); clickMenu(MENU_INSERT_ATTACHED_IMAGE); waitForDialogToLoad(); getDriver().waitUntilElementIsVisible(By.className(STEP_SELECTOR)); String tabSelector = "//div[.='" + TAB_ALL_PAGES + "']"; getSelenium().click(tabSelector); waitForElement(SPACE_SELECTOR + "/option[. = '" + "XWiki" + "']"); getSelenium().select(SPACE_SELECTOR, "XWiki"); waitForElement(PAGE_SELECTOR + "/option[. = '" + "AdminSheet" + "']"); getSelenium().select(PAGE_SELECTOR, "AdminSheet"); getSelenium().typeKeys(PAGE_SELECTOR, "\t"); getSelenium().click("//div[@class=\"xPageChooser\"]//button[text()=\"Update\"]"); waitForElement("//*[@class = '" + STEP_EXPLORER + "']//*[contains(@class, '" + STEP_CURRENT_PAGE_SELECTOR + "')]"); getSelenium().click(getImageLocator("registration.png")); getSelenium().doubleClick(getImageLocator("registration.png")); getDriver().waitUntilElementIsVisible(By.className(STEP_CONFIG)); clickButtonWithText(BUTTON_INSERT_IMAGE); switchToSource(); setSourceText("[[image:[email protected]]]"); switchToWysiwyg(); moveCaret("document.body", 0); clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_INSERT_ATTACHED_IMAGE)); clickMenu(MENU_INSERT_ATTACHED_IMAGE); waitForDialogToLoad(); getDriver().waitUntilElementIsVisible(By.className(STEP_SELECTOR)); String tabSelector = "//div[.='" + TAB_ALL_PAGES + "']"; getSelenium().click(tabSelector); waitForElement(SPACE_SELECTOR + "/option[. = '" + "XWiki" + "']"); getSelenium().select(SPACE_SELECTOR, "XWiki"); waitForElement(PAGE_SELECTOR + "/option[. = '" + "AdminSheet" + "']"); getSelenium().select(PAGE_SELECTOR, "AdminSheet"); getSelenium().typeKeys(PAGE_SELECTOR, "\t"); getSelenium().click("//div[@class=\"xPageChooser\"]//button[text()=\"Update\"]"); waitForElement("//*[@class = '" + STEP_EXPLORER + "']//*[contains(@class, '" + STEP_CURRENT_PAGE_SELECTOR + "')]"); getSelenium().click("//div[@class = '" + STEP_EXPLORER + "']//div[contains(@class, \"xNewImagePreview\")]"); getSelenium().typeKeys("//div[@class = '" + STEP_EXPLORER + "']" + IMAGES_LIST, "\\13"); getDriver().waitUntilElementIsVisible(By.className(STEP_UPLOAD)); closeDialog(); }
@Test public void testFastNavigationToSelectImage() { clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_INSERT_ATTACHED_IMAGE)); clickMenu(MENU_INSERT_ATTACHED_IMAGE); waitForDialogToLoad(); getDriver().waitUntilElementIsVisible(By.className(STEP_CURRENT_PAGE_SELECTOR)); getSelenium().click("//*[contains(@class, 'xListItem')]//*[contains(@class, 'xNewImagePreview')]"); getSelenium().doubleClick("//*[contains(@class, 'xListItem')]//*[contains(@class, 'xNewImagePreview')]"); <DeepExtract> getDriver().waitUntilElementIsVisible(By.className(STEP_UPLOAD)); </DeepExtract> closeDialog(); clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_INSERT_ATTACHED_IMAGE)); clickMenu(MENU_INSERT_ATTACHED_IMAGE); waitForDialogToLoad(); getDriver().waitUntilElementIsVisible(By.className(STEP_CURRENT_PAGE_SELECTOR)); getSelenium().click("//div[contains(@class, \"xNewImagePreview\")]"); getSelenium().typeKeys(IMAGES_LIST, "\\13"); <DeepExtract> getDriver().waitUntilElementIsVisible(By.className(STEP_UPLOAD)); </DeepExtract> closeDialog(); clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_INSERT_ATTACHED_IMAGE)); clickMenu(MENU_INSERT_ATTACHED_IMAGE); waitForDialogToLoad(); getDriver().waitUntilElementIsVisible(By.className(STEP_SELECTOR)); String tabSelector = "//div[.='" + TAB_ALL_PAGES + "']"; getSelenium().click(tabSelector); waitForElement(SPACE_SELECTOR + "/option[. = '" + "XWiki" + "']"); getSelenium().select(SPACE_SELECTOR, "XWiki"); waitForElement(PAGE_SELECTOR + "/option[. = '" + "AdminSheet" + "']"); getSelenium().select(PAGE_SELECTOR, "AdminSheet"); getSelenium().typeKeys(PAGE_SELECTOR, "\t"); getSelenium().click("//div[@class=\"xPageChooser\"]//button[text()=\"Update\"]"); waitForElement("//*[@class = '" + STEP_EXPLORER + "']//*[contains(@class, '" + STEP_CURRENT_PAGE_SELECTOR + "')]"); getSelenium().click(getImageLocator("registration.png")); getSelenium().doubleClick(getImageLocator("registration.png")); getDriver().waitUntilElementIsVisible(By.className(STEP_CONFIG)); clickButtonWithText(BUTTON_INSERT_IMAGE); switchToSource(); setSourceText("[[image:[email protected]]]"); switchToWysiwyg(); moveCaret("document.body", 0); clickMenu(MENU_IMAGE); assertTrue(isMenuEnabled(MENU_INSERT_ATTACHED_IMAGE)); clickMenu(MENU_INSERT_ATTACHED_IMAGE); waitForDialogToLoad(); getDriver().waitUntilElementIsVisible(By.className(STEP_SELECTOR)); String tabSelector = "//div[.='" + TAB_ALL_PAGES + "']"; getSelenium().click(tabSelector); waitForElement(SPACE_SELECTOR + "/option[. = '" + "XWiki" + "']"); getSelenium().select(SPACE_SELECTOR, "XWiki"); waitForElement(PAGE_SELECTOR + "/option[. = '" + "AdminSheet" + "']"); getSelenium().select(PAGE_SELECTOR, "AdminSheet"); getSelenium().typeKeys(PAGE_SELECTOR, "\t"); getSelenium().click("//div[@class=\"xPageChooser\"]//button[text()=\"Update\"]"); waitForElement("//*[@class = '" + STEP_EXPLORER + "']//*[contains(@class, '" + STEP_CURRENT_PAGE_SELECTOR + "')]"); getSelenium().click("//div[@class = '" + STEP_EXPLORER + "']//div[contains(@class, \"xNewImagePreview\")]"); getSelenium().typeKeys("//div[@class = '" + STEP_EXPLORER + "']" + IMAGES_LIST, "\\13"); <DeepExtract> getDriver().waitUntilElementIsVisible(By.className(STEP_UPLOAD)); </DeepExtract> closeDialog(); }
xwiki-enterprise
positive
1,448
public static String getOutputFilePath(File directory, String extension) throws IOException { if (!(directory.isDirectory() || directory.mkdirs())) { throw new IOException("Couldn't create directory '" + directory + "'"); } return directory; String filename = UUID.randomUUID().toString(); return directory + File.separator + filename + extension; }
public static String getOutputFilePath(File directory, String extension) throws IOException { <DeepExtract> if (!(directory.isDirectory() || directory.mkdirs())) { throw new IOException("Couldn't create directory '" + directory + "'"); } return directory; </DeepExtract> String filename = UUID.randomUUID().toString(); return directory + File.separator + filename + extension; }
react-native-camera-continued-shooting
positive
1,449
private void handleAudioMessage(final AudioMessageHolder holder, final MessageItem mItem, final View parent) { holder.time.setText(TimeUtil.getChatTime(mItem.getDate())); holder.time.setVisibility(View.VISIBLE); holder.head.setBackgroundResource(PushApplication.heads[mItem.getHeadImg()]); holder.progressBar.setVisibility(View.GONE); holder.progressBar.setProgress(50); holder.time.setVisibility(View.VISIBLE); holder.msg.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.chatto_voice_playing, 0); holder.voiceTime.setText(TimeUtil.getVoiceRecorderTime(mItem.getVoiceTime())); holder.msg.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mItem.getMsgType() == MessageItem.MESSAGE_TYPE_RECORD) { mSoundUtil.playRecorder(mContext, mItem.getMessage()); } } }); }
private void handleAudioMessage(final AudioMessageHolder holder, final MessageItem mItem, final View parent) { <DeepExtract> holder.time.setText(TimeUtil.getChatTime(mItem.getDate())); holder.time.setVisibility(View.VISIBLE); holder.head.setBackgroundResource(PushApplication.heads[mItem.getHeadImg()]); holder.progressBar.setVisibility(View.GONE); holder.progressBar.setProgress(50); holder.time.setVisibility(View.VISIBLE); </DeepExtract> holder.msg.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.chatto_voice_playing, 0); holder.voiceTime.setText(TimeUtil.getVoiceRecorderTime(mItem.getVoiceTime())); holder.msg.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mItem.getMsgType() == MessageItem.MESSAGE_TYPE_RECORD) { mSoundUtil.playRecorder(mContext, mItem.getMessage()); } } }); }
zfIMDemo
positive
1,450
@Override public void onClick(DialogInterface dialog, int which) { if (promptDialog != null) promptDialog.dismiss(); if (pJsResult != null) pJsResult.cancel(); }
@Override public void onClick(DialogInterface dialog, int which) { if (promptDialog != null) promptDialog.dismiss(); <DeepExtract> if (pJsResult != null) pJsResult.cancel(); </DeepExtract> }
AgentWebX5
positive
1,453
public List<UserDetail> findAll() { String sql = "select * from userDetail"; Object[] params = {}; List<UserDetail> list = new ArrayList<UserDetail>(); ResultSet rs = dbUtil.executeQuery(sql, params); try { while (rs.next()) { UserDetail user = new UserDetail(rs.getInt("id"), rs.getString("userName"), rs.getString("userPwd"), rs.getString("phone"), rs.getInt("status")); list.add(user); } } catch (SQLException e) { e.printStackTrace(); } finally { dbUtil.closeAll(); } return list; }
public List<UserDetail> findAll() { String sql = "select * from userDetail"; Object[] params = {}; <DeepExtract> List<UserDetail> list = new ArrayList<UserDetail>(); ResultSet rs = dbUtil.executeQuery(sql, params); try { while (rs.next()) { UserDetail user = new UserDetail(rs.getInt("id"), rs.getString("userName"), rs.getString("userPwd"), rs.getString("phone"), rs.getInt("status")); list.add(user); } } catch (SQLException e) { e.printStackTrace(); } finally { dbUtil.closeAll(); } return list; </DeepExtract> }
cailiao
positive
1,454
private void initBitmap() { if (indicatorDrawableId != 0) { this.indicatorDrawableId = indicatorDrawableId; indicatorBitmap = BitmapFactory.decodeResource(getResources(), indicatorDrawableId); } if (thumbDrawableId != 0 && getResources() != null) { this.thumbDrawableId = thumbDrawableId; thumbBitmap = Utils.drawableToBitmap(thumbSize, getResources().getDrawable(thumbDrawableId)); } if (thumbInactivatedDrawableId != 0 && getResources() != null) { this.thumbInactivatedDrawableId = thumbInactivatedDrawableId; thumbInactivatedBitmap = Utils.drawableToBitmap(thumbSize, getResources().getDrawable(thumbInactivatedDrawableId)); } }
private void initBitmap() { if (indicatorDrawableId != 0) { this.indicatorDrawableId = indicatorDrawableId; indicatorBitmap = BitmapFactory.decodeResource(getResources(), indicatorDrawableId); } if (thumbDrawableId != 0 && getResources() != null) { this.thumbDrawableId = thumbDrawableId; thumbBitmap = Utils.drawableToBitmap(thumbSize, getResources().getDrawable(thumbDrawableId)); } <DeepExtract> if (thumbInactivatedDrawableId != 0 && getResources() != null) { this.thumbInactivatedDrawableId = thumbInactivatedDrawableId; thumbInactivatedBitmap = Utils.drawableToBitmap(thumbSize, getResources().getDrawable(thumbInactivatedDrawableId)); } </DeepExtract> }
ExpectLauncher
positive
1,455
@Test public void getCountOfUniqueTest() throws Exception { PaymentModel testPaymentModel = createTestPaymentModel(); prepareGraphDb(createDefaultOperationProperties(testPaymentModel)); testUniqCardTokensByEmail(testPaymentModel.getEmail(), 3); testUniqCardTokensByFingerprint(testPaymentModel.getFingerprint(), 3); testUniqCardTokensByShop(testPaymentModel.getShopId(), 2); testUniqCardTokensByIp(testPaymentModel.getIp(), 2); testUniqFingerprintsByEmail(testPaymentModel.getEmail(), 2); testUniqFingerprintsByIp(testPaymentModel.getIp(), 2); testUniqFingerprintsByShop(testPaymentModel.getShopId(), 2); testUniqFingerprintsByCardToken(testPaymentModel.getCardToken(), 2); testUniqEmailsByFingerprint(testPaymentModel.getFingerprint(), 2); testUniqEmailsByIp(testPaymentModel.getIp(), 2); testUniqEmailsByShop(testPaymentModel.getShopId(), 2); testUniqEmailsByCardToken(testPaymentModel.getCardToken(), 2); testUniqShopsByParty(testPaymentModel.getPartyId(), 4); OperationProperties operationPropertiesTwo = createDefaultOperationProperties(); insertPayments(operationPropertiesTwo, 5); testUniqCardTokensByEmail(testPaymentModel.getEmail(), 3); testUniqCardTokensByFingerprint(testPaymentModel.getFingerprint(), 3); testUniqCardTokensByShop(testPaymentModel.getShopId(), 2); testUniqCardTokensByIp(testPaymentModel.getIp(), 2); testUniqFingerprintsByEmail(testPaymentModel.getEmail(), 2); testUniqFingerprintsByIp(testPaymentModel.getIp(), 2); testUniqFingerprintsByShop(testPaymentModel.getShopId(), 2); testUniqFingerprintsByCardToken(testPaymentModel.getCardToken(), 2); testUniqEmailsByFingerprint(testPaymentModel.getFingerprint(), 2); testUniqEmailsByIp(testPaymentModel.getIp(), 2); testUniqEmailsByShop(testPaymentModel.getShopId(), 2); testUniqEmailsByCardToken(testPaymentModel.getCardToken(), 2); testUniqShopsByParty(testPaymentModel.getPartyId(), 4); testUniqCardTokensByEmail(operationPropertiesTwo.getEmail(), 2); testUniqShopsByParty(operationPropertiesTwo.getPartyId(), 2); }
@Test public void getCountOfUniqueTest() throws Exception { PaymentModel testPaymentModel = createTestPaymentModel(); prepareGraphDb(createDefaultOperationProperties(testPaymentModel)); testUniqCardTokensByEmail(testPaymentModel.getEmail(), 3); testUniqCardTokensByFingerprint(testPaymentModel.getFingerprint(), 3); testUniqCardTokensByShop(testPaymentModel.getShopId(), 2); testUniqCardTokensByIp(testPaymentModel.getIp(), 2); testUniqFingerprintsByEmail(testPaymentModel.getEmail(), 2); testUniqFingerprintsByIp(testPaymentModel.getIp(), 2); testUniqFingerprintsByShop(testPaymentModel.getShopId(), 2); testUniqFingerprintsByCardToken(testPaymentModel.getCardToken(), 2); testUniqEmailsByFingerprint(testPaymentModel.getFingerprint(), 2); testUniqEmailsByIp(testPaymentModel.getIp(), 2); testUniqEmailsByShop(testPaymentModel.getShopId(), 2); testUniqEmailsByCardToken(testPaymentModel.getCardToken(), 2); testUniqShopsByParty(testPaymentModel.getPartyId(), 4); OperationProperties operationPropertiesTwo = createDefaultOperationProperties(); insertPayments(operationPropertiesTwo, 5); testUniqCardTokensByEmail(testPaymentModel.getEmail(), 3); testUniqCardTokensByFingerprint(testPaymentModel.getFingerprint(), 3); testUniqCardTokensByShop(testPaymentModel.getShopId(), 2); testUniqCardTokensByIp(testPaymentModel.getIp(), 2); testUniqFingerprintsByEmail(testPaymentModel.getEmail(), 2); testUniqFingerprintsByIp(testPaymentModel.getIp(), 2); testUniqFingerprintsByShop(testPaymentModel.getShopId(), 2); testUniqFingerprintsByCardToken(testPaymentModel.getCardToken(), 2); testUniqEmailsByFingerprint(testPaymentModel.getFingerprint(), 2); testUniqEmailsByIp(testPaymentModel.getIp(), 2); testUniqEmailsByShop(testPaymentModel.getShopId(), 2); testUniqEmailsByCardToken(testPaymentModel.getCardToken(), 2); testUniqShopsByParty(testPaymentModel.getPartyId(), 4); <DeepExtract> testUniqCardTokensByEmail(operationPropertiesTwo.getEmail(), 2); testUniqShopsByParty(operationPropertiesTwo.getPartyId(), 2); </DeepExtract> }
fraudbusters
positive
1,456
public void read(org.apache.thrift.protocol.TProtocol iprot, face_sim_args struct) throws org.apache.thrift.TException { iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch(schemeField.id) { case 1: if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.img_base64_1 = iprot.readString(); struct.setImg_base64_1IsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.img_base64_2 = iprot.readString(); struct.setImg_base64_2IsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); }
public void read(org.apache.thrift.protocol.TProtocol iprot, face_sim_args struct) throws org.apache.thrift.TException { <DeepExtract> </DeepExtract> iprot.readStructBegin(); <DeepExtract> </DeepExtract> while (true) { <DeepExtract> </DeepExtract> schemeField = iprot.readFieldBegin(); <DeepExtract> </DeepExtract> if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { <DeepExtract> </DeepExtract> break; <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> switch(schemeField.id) { <DeepExtract> </DeepExtract> case 1: <DeepExtract> </DeepExtract> if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { <DeepExtract> </DeepExtract> struct.img_base64_1 = iprot.readString(); <DeepExtract> </DeepExtract> struct.setImg_base64_1IsSet(true); <DeepExtract> </DeepExtract> } else { <DeepExtract> </DeepExtract> org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> break; <DeepExtract> </DeepExtract> case 2: <DeepExtract> </DeepExtract> if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { <DeepExtract> </DeepExtract> struct.img_base64_2 = iprot.readString(); <DeepExtract> </DeepExtract> struct.setImg_base64_2IsSet(true); <DeepExtract> </DeepExtract> } else { <DeepExtract> </DeepExtract> org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> break; <DeepExtract> </DeepExtract> default: <DeepExtract> </DeepExtract> org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> iprot.readFieldEnd(); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> iprot.readStructEnd(); <DeepExtract> </DeepExtract> }
aiop-core
positive
1,458
protected void tickHardware(World world) { if (StrictMath.abs(steer) <= 0.01f) { steer = 0.0f; } facing += steer * STEER_RATE; float s; if (StrictMath.abs(motor) <= 0.01f) { motor = 0.0f; return; } if (motor < 0) { s = motor * 0.5f * SPEED_MAX; } else { s = motor * SPEED_MAX; } float tx = x + (float) StrictMath.cos(facing) * s; float ty = y + (float) StrictMath.sin(facing) * s; if (world.canRobotGoTo(tx, ty)) { x = tx; y = ty; ramming = true; } else if (world.canRobotGoTo(tx, y)) { x = tx; ramming = true; } else if (world.canRobotGoTo(x, ty)) { y = ty; ramming = true; } else { ramming = false; } if (lazer <= 0) { lazerEnd = 0; return; } float cos = (float) StrictMath.cos(getBeamAngle()); float sin = (float) StrictMath.sin(getBeamAngle()); for (int i = 0; i < RAY_STEPS; i++) { if ((i * RAY_INTERVAL) >= (lazer * LAZER_RANGE)) { lazerEnd = lazer * LAZER_RANGE; return; } battery -= LAZER_BATTERY_COST; float tx = x + cos * (i * RAY_INTERVAL); float ty = y + sin * (i * RAY_INTERVAL); int tile = world.getTileXY(tx, ty); int type = tile & 0b111; int variant = (tile >> 3) & 0b11; if (type == TILE.WALL) { lazerEnd = i * RAY_INTERVAL; return; } if (type == TILE.OBSTACLE) { if (variant >= 2) { world.setTileXY(tx, ty, TILE.GROUND); } lazerEnd = i * RAY_INTERVAL; return; } Robot robot = world.getRobot(tx, ty); if (robot != null && robot != this) { robot.damage(LAZER_DAMAGE); return; } } lazerEnd = RAY_INTERVAL * RAY_STEPS; }
protected void tickHardware(World world) { if (StrictMath.abs(steer) <= 0.01f) { steer = 0.0f; } facing += steer * STEER_RATE; float s; if (StrictMath.abs(motor) <= 0.01f) { motor = 0.0f; return; } if (motor < 0) { s = motor * 0.5f * SPEED_MAX; } else { s = motor * SPEED_MAX; } float tx = x + (float) StrictMath.cos(facing) * s; float ty = y + (float) StrictMath.sin(facing) * s; if (world.canRobotGoTo(tx, ty)) { x = tx; y = ty; ramming = true; } else if (world.canRobotGoTo(tx, y)) { x = tx; ramming = true; } else if (world.canRobotGoTo(x, ty)) { y = ty; ramming = true; } else { ramming = false; } <DeepExtract> if (lazer <= 0) { lazerEnd = 0; return; } float cos = (float) StrictMath.cos(getBeamAngle()); float sin = (float) StrictMath.sin(getBeamAngle()); for (int i = 0; i < RAY_STEPS; i++) { if ((i * RAY_INTERVAL) >= (lazer * LAZER_RANGE)) { lazerEnd = lazer * LAZER_RANGE; return; } battery -= LAZER_BATTERY_COST; float tx = x + cos * (i * RAY_INTERVAL); float ty = y + sin * (i * RAY_INTERVAL); int tile = world.getTileXY(tx, ty); int type = tile & 0b111; int variant = (tile >> 3) & 0b11; if (type == TILE.WALL) { lazerEnd = i * RAY_INTERVAL; return; } if (type == TILE.OBSTACLE) { if (variant >= 2) { world.setTileXY(tx, ty, TILE.GROUND); } lazerEnd = i * RAY_INTERVAL; return; } Robot robot = world.getRobot(tx, ty); if (robot != null && robot != this) { robot.damage(LAZER_DAMAGE); return; } } lazerEnd = RAY_INTERVAL * RAY_STEPS; </DeepExtract> }
runtime
positive
1,460
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { Log.i(TAG, "onKeyUp(int keyCode, KeyEvent event) keyCode = " + keyCode + " event = " + event); return super.onKeyUp(keyCode, event); }
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { <DeepExtract> Log.i(TAG, "onKeyUp(int keyCode, KeyEvent event) keyCode = " + keyCode + " event = " + event); </DeepExtract> return super.onKeyUp(keyCode, event); }
AndroidExercises
positive
1,461
public Criteria andUser_messageNotBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "user_message" + " cannot be null"); } criteria.add(new Criterion("user_message not between", value1, value2)); return (Criteria) this; }
public Criteria andUser_messageNotBetween(String value1, String value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "user_message" + " cannot be null"); } criteria.add(new Criterion("user_message not between", value1, value2)); </DeepExtract> return (Criteria) this; }
Tmall_SSM-master
positive
1,462
public void onServiceConnected(ComponentName className, IBinder service) { return WallPaper.this; if (null != single.env) { dataService.setDataProviders(single.env.getDataProviders()); } }
public void onServiceConnected(ComponentName className, IBinder service) { <DeepExtract> return WallPaper.this; </DeepExtract> if (null != single.env) { dataService.setDataProviders(single.env.getDataProviders()); } }
moss
positive
1,463
@Override public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.CHEST); if (itemstack.getItem() instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor) itemstack.getItem(); if (itemarmor.getEquipmentSlot() == EntityEquipmentSlot.CHEST) { T model = getModelFromSlot(EntityEquipmentSlot.CHEST); model = getArmorModelHook(entitylivingbaseIn, itemstack, EntityEquipmentSlot.CHEST, model); model.setModelAttributes(renderer.getMainModel()); model.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks); setModelSlotVisible(model, EntityEquipmentSlot.CHEST); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.CHEST, null)); { if (itemarmor.hasOverlay(itemstack)) { int itemColor = itemarmor.getColor(itemstack); float itemRed = (itemColor >> 16 & 255) / 255.0F; float itemGreen = (itemColor >> 8 & 255) / 255.0F; float itemBlue = (itemColor & 255) / 255.0F; GlStateManager.color(colorR * itemRed, colorG * itemGreen, colorB * itemBlue, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.CHEST, "overlay")); } { GlStateManager.color(colorR, colorG, colorB, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } if (!skipRenderGlint && itemstack.hasEffect()) { renderEnchantedGlint(renderer, entitylivingbaseIn, model, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale, ClientProxy.getColorForEnchantment(EnchantmentHelper.getEnchantments(itemstack))); } } } } ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.LEGS); if (itemstack.getItem() instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor) itemstack.getItem(); if (itemarmor.getEquipmentSlot() == EntityEquipmentSlot.LEGS) { T model = getModelFromSlot(EntityEquipmentSlot.LEGS); model = getArmorModelHook(entitylivingbaseIn, itemstack, EntityEquipmentSlot.LEGS, model); model.setModelAttributes(renderer.getMainModel()); model.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks); setModelSlotVisible(model, EntityEquipmentSlot.LEGS); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.LEGS, null)); { if (itemarmor.hasOverlay(itemstack)) { int itemColor = itemarmor.getColor(itemstack); float itemRed = (itemColor >> 16 & 255) / 255.0F; float itemGreen = (itemColor >> 8 & 255) / 255.0F; float itemBlue = (itemColor & 255) / 255.0F; GlStateManager.color(colorR * itemRed, colorG * itemGreen, colorB * itemBlue, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.LEGS, "overlay")); } { GlStateManager.color(colorR, colorG, colorB, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } if (!skipRenderGlint && itemstack.hasEffect()) { renderEnchantedGlint(renderer, entitylivingbaseIn, model, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale, ClientProxy.getColorForEnchantment(EnchantmentHelper.getEnchantments(itemstack))); } } } } ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.FEET); if (itemstack.getItem() instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor) itemstack.getItem(); if (itemarmor.getEquipmentSlot() == EntityEquipmentSlot.FEET) { T model = getModelFromSlot(EntityEquipmentSlot.FEET); model = getArmorModelHook(entitylivingbaseIn, itemstack, EntityEquipmentSlot.FEET, model); model.setModelAttributes(renderer.getMainModel()); model.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks); setModelSlotVisible(model, EntityEquipmentSlot.FEET); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.FEET, null)); { if (itemarmor.hasOverlay(itemstack)) { int itemColor = itemarmor.getColor(itemstack); float itemRed = (itemColor >> 16 & 255) / 255.0F; float itemGreen = (itemColor >> 8 & 255) / 255.0F; float itemBlue = (itemColor & 255) / 255.0F; GlStateManager.color(colorR * itemRed, colorG * itemGreen, colorB * itemBlue, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.FEET, "overlay")); } { GlStateManager.color(colorR, colorG, colorB, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } if (!skipRenderGlint && itemstack.hasEffect()) { renderEnchantedGlint(renderer, entitylivingbaseIn, model, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale, ClientProxy.getColorForEnchantment(EnchantmentHelper.getEnchantments(itemstack))); } } } } ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.HEAD); if (itemstack.getItem() instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor) itemstack.getItem(); if (itemarmor.getEquipmentSlot() == EntityEquipmentSlot.HEAD) { T model = getModelFromSlot(EntityEquipmentSlot.HEAD); model = getArmorModelHook(entitylivingbaseIn, itemstack, EntityEquipmentSlot.HEAD, model); model.setModelAttributes(renderer.getMainModel()); model.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks); setModelSlotVisible(model, EntityEquipmentSlot.HEAD); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.HEAD, null)); { if (itemarmor.hasOverlay(itemstack)) { int itemColor = itemarmor.getColor(itemstack); float itemRed = (itemColor >> 16 & 255) / 255.0F; float itemGreen = (itemColor >> 8 & 255) / 255.0F; float itemBlue = (itemColor & 255) / 255.0F; GlStateManager.color(colorR * itemRed, colorG * itemGreen, colorB * itemBlue, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.HEAD, "overlay")); } { GlStateManager.color(colorR, colorG, colorB, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } if (!skipRenderGlint && itemstack.hasEffect()) { renderEnchantedGlint(renderer, entitylivingbaseIn, model, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale, ClientProxy.getColorForEnchantment(EnchantmentHelper.getEnchantments(itemstack))); } } } } }
@Override public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.CHEST); if (itemstack.getItem() instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor) itemstack.getItem(); if (itemarmor.getEquipmentSlot() == EntityEquipmentSlot.CHEST) { T model = getModelFromSlot(EntityEquipmentSlot.CHEST); model = getArmorModelHook(entitylivingbaseIn, itemstack, EntityEquipmentSlot.CHEST, model); model.setModelAttributes(renderer.getMainModel()); model.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks); setModelSlotVisible(model, EntityEquipmentSlot.CHEST); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.CHEST, null)); { if (itemarmor.hasOverlay(itemstack)) { int itemColor = itemarmor.getColor(itemstack); float itemRed = (itemColor >> 16 & 255) / 255.0F; float itemGreen = (itemColor >> 8 & 255) / 255.0F; float itemBlue = (itemColor & 255) / 255.0F; GlStateManager.color(colorR * itemRed, colorG * itemGreen, colorB * itemBlue, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.CHEST, "overlay")); } { GlStateManager.color(colorR, colorG, colorB, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } if (!skipRenderGlint && itemstack.hasEffect()) { renderEnchantedGlint(renderer, entitylivingbaseIn, model, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale, ClientProxy.getColorForEnchantment(EnchantmentHelper.getEnchantments(itemstack))); } } } } ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.LEGS); if (itemstack.getItem() instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor) itemstack.getItem(); if (itemarmor.getEquipmentSlot() == EntityEquipmentSlot.LEGS) { T model = getModelFromSlot(EntityEquipmentSlot.LEGS); model = getArmorModelHook(entitylivingbaseIn, itemstack, EntityEquipmentSlot.LEGS, model); model.setModelAttributes(renderer.getMainModel()); model.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks); setModelSlotVisible(model, EntityEquipmentSlot.LEGS); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.LEGS, null)); { if (itemarmor.hasOverlay(itemstack)) { int itemColor = itemarmor.getColor(itemstack); float itemRed = (itemColor >> 16 & 255) / 255.0F; float itemGreen = (itemColor >> 8 & 255) / 255.0F; float itemBlue = (itemColor & 255) / 255.0F; GlStateManager.color(colorR * itemRed, colorG * itemGreen, colorB * itemBlue, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.LEGS, "overlay")); } { GlStateManager.color(colorR, colorG, colorB, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } if (!skipRenderGlint && itemstack.hasEffect()) { renderEnchantedGlint(renderer, entitylivingbaseIn, model, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale, ClientProxy.getColorForEnchantment(EnchantmentHelper.getEnchantments(itemstack))); } } } } ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.FEET); if (itemstack.getItem() instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor) itemstack.getItem(); if (itemarmor.getEquipmentSlot() == EntityEquipmentSlot.FEET) { T model = getModelFromSlot(EntityEquipmentSlot.FEET); model = getArmorModelHook(entitylivingbaseIn, itemstack, EntityEquipmentSlot.FEET, model); model.setModelAttributes(renderer.getMainModel()); model.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks); setModelSlotVisible(model, EntityEquipmentSlot.FEET); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.FEET, null)); { if (itemarmor.hasOverlay(itemstack)) { int itemColor = itemarmor.getColor(itemstack); float itemRed = (itemColor >> 16 & 255) / 255.0F; float itemGreen = (itemColor >> 8 & 255) / 255.0F; float itemBlue = (itemColor & 255) / 255.0F; GlStateManager.color(colorR * itemRed, colorG * itemGreen, colorB * itemBlue, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.FEET, "overlay")); } { GlStateManager.color(colorR, colorG, colorB, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } if (!skipRenderGlint && itemstack.hasEffect()) { renderEnchantedGlint(renderer, entitylivingbaseIn, model, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale, ClientProxy.getColorForEnchantment(EnchantmentHelper.getEnchantments(itemstack))); } } } } <DeepExtract> ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.HEAD); if (itemstack.getItem() instanceof ItemArmor) { ItemArmor itemarmor = (ItemArmor) itemstack.getItem(); if (itemarmor.getEquipmentSlot() == EntityEquipmentSlot.HEAD) { T model = getModelFromSlot(EntityEquipmentSlot.HEAD); model = getArmorModelHook(entitylivingbaseIn, itemstack, EntityEquipmentSlot.HEAD, model); model.setModelAttributes(renderer.getMainModel()); model.setLivingAnimations(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks); setModelSlotVisible(model, EntityEquipmentSlot.HEAD); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.HEAD, null)); { if (itemarmor.hasOverlay(itemstack)) { int itemColor = itemarmor.getColor(itemstack); float itemRed = (itemColor >> 16 & 255) / 255.0F; float itemGreen = (itemColor >> 8 & 255) / 255.0F; float itemBlue = (itemColor & 255) / 255.0F; GlStateManager.color(colorR * itemRed, colorG * itemGreen, colorB * itemBlue, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); renderer.bindTexture(getArmorResource(entitylivingbaseIn, itemstack, EntityEquipmentSlot.HEAD, "overlay")); } { GlStateManager.color(colorR, colorG, colorB, alpha); model.render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); } if (!skipRenderGlint && itemstack.hasEffect()) { renderEnchantedGlint(renderer, entitylivingbaseIn, model, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale, ClientProxy.getColorForEnchantment(EnchantmentHelper.getEnchantments(itemstack))); } } } } </DeepExtract> }
ExampleMod-1.12
positive
1,464
public static void loadDefaults() { logger.finer("setting DefaultProperties"); Properties props = new Properties(); props.setProperty(XOPKEYS.DOMAIN, "proxy"); comments.put(XOPKEYS.DOMAIN, "The domain name for this proxy instance."); props.setProperty(XOPKEYS.PORT, "5222"); comments.put(XOPKEYS.PORT, "The port to run the XMPP server on (for XMPP clients)."); props.setProperty(XOPKEYS.BIND.INTERFACE, "eth0"); comments.put(XOPKEYS.BIND.INTERFACE, "The interface to listen for XMPP clients or 'ANY' for all interfaces"); props.setProperty(XOPKEYS.ENABLE.GATEWAY, "false"); comments.put(XOPKEYS.ENABLE.GATEWAY, "Set to true to enable gatewaying to another XMPP server via dialback protocol, false to disable"); props.setProperty(XOPKEYS.ENABLE.COMPRESSION, "false"); comments.put(XOPKEYS.ENABLE.COMPRESSION, "Enable/disable compressing messages before sending to the Transport system. Default: false (disabled)"); props.setProperty(XOPKEYS.ENABLE.STREAM, "false"); comments.put(XOPKEYS.ENABLE.STREAM, "Set to true to enable bytestreams, false to disable"); props.setProperty(XOPKEYS.ENABLE.ANDROIDLOGGING, "false"); comments.put(XOPKEYS.ENABLE.ANDROIDLOGGING, "Set to true to enable logging in the app text view, false to disable"); props.setProperty(XOPKEYS.ENABLE.DEVICELOGGING, "false"); comments.put(XOPKEYS.ENABLE.DEVICELOGGING, "Set to true to enable text file logging on the android file system, false to disable"); props.setProperty(XOPKEYS.ENABLE.DELAY, "true"); comments.put(XOPKEYS.ENABLE.DELAY, "add delay element to messages according to XEP "); props.setProperty(XOPKEYS.TLS.AUTH, "false"); comments.put(XOPKEYS.TLS.AUTH, "set to true if clients must connect via tls, false otherwise"); props.setProperty(XOPKEYS.STREAM.PORT, "7625"); comments.put(XOPKEYS.STREAM.PORT, "The port on which clients should connect to open a bytestream"); String xopDomain = props.getProperty(XOPKEYS.DOMAIN); props.setProperty(XOPKEYS.STREAM.JID, "stream." + xopDomain); comments.put(XOPKEYS.STREAM.JID, "The JID to identify the bytestream host"); props.setProperty(XOPKEYS.SSL.KEYSTORE, "config/keystore.jks"); comments.put(XOPKEYS.SSL.KEYSTORE, "Where the server keystore is located"); props.setProperty(XOPKEYS.SSL.TRUSTSTORE, "config/cacerts.jks"); comments.put(XOPKEYS.SSL.TRUSTSTORE, "Where the truststore for server-to-server connections is located"); props.setProperty(XOPKEYS.SSL.PASSWORD, "xopstore"); comments.put(XOPKEYS.SSL.PASSWORD, "The password for the keystore and truststore"); props.setProperty(XOPKEYS.SDS.SERVICE, "norm-transport"); comments.put(XOPKEYS.SDS.SERVICE, "choose which Service discovery system to use (for presence), default 'norm-transport'"); props.setProperty(XOPKEYS.SDS.INDI.ADDRESS, "225.0.2.186"); comments.put(XOPKEYS.SDS.INDI.ADDRESS, "The multicast address for INDI to bind to. default 224.0.1.186"); props.setProperty(XOPKEYS.SDS.INDI.PORT, "5353"); comments.put(XOPKEYS.SDS.INDI.PORT, "The multicast port for INDI to bind to. default 5353"); props.setProperty(XOPKEYS.SDS.INDI.TTL, "15000"); comments.put(XOPKEYS.SDS.INDI.TTL, "Lifetime (TTL) of the service in milliseconds (long)"); props.setProperty(XOPKEYS.SDS.INDI.RAI, "10000"); comments.put(XOPKEYS.SDS.INDI.RAI, "Service proactive re-advertisement interval for sending advertisements in milliseconds (long)"); props.setProperty(XOPKEYS.SDS.INDI.NUMRA, "-1"); comments.put(XOPKEYS.SDS.INDI.NUMRA, "Number of times to readvertise the service (int, -1 = forever)"); props.setProperty(XOPKEYS.SDS.INDI.CQI, "0,100,200,400,800,1600"); comments.put(XOPKEYS.SDS.INDI.CQI, "Times a client queries for a service e.g. 0,100,200 (comma separated list of longs)"); props.setProperty(XOPKEYS.SDS.INDI.SCI, "12000"); comments.put(XOPKEYS.SDS.INDI.SCI, "Proactive service cancel notification interval"); props.setProperty(XOPKEYS.SDS.INDI.NUMSCM, "3"); comments.put(XOPKEYS.SDS.INDI.NUMSCM, "Number of times to send proactive service cancellations (int)"); props.setProperty(XOPKEYS.SDS.INDI.ALLOW_LOOPBACK, "false"); comments.put(XOPKEYS.SDS.INDI.ALLOW_LOOPBACK, "sets whether the instances of indi allow loopback or not"); props.setProperty(XOPKEYS.SDS.INDI.ALLOW_DUPLICATES, "false"); comments.put(XOPKEYS.SDS.INDI.ALLOW_DUPLICATES, "sets whether the instances of indi allow duplicate adverts or whether duplicate adverts are suppressed."); props.setProperty(XOPKEYS.GATEWAY.SERVER, "openfire"); comments.put(XOPKEYS.GATEWAY.SERVER, "The hostname of the external XMPP server to which the gateway should connect."); props.setProperty(XOPKEYS.GATEWAY.TLSAUTH, "false"); comments.put(XOPKEYS.GATEWAY.TLSAUTH, "true to use TLS with a gatewayed server, false otherwise."); props.setProperty(XOPKEYS.GATEWAY.BINDINTERFACE, "eth1"); comments.put(XOPKEYS.GATEWAY.BINDINTERFACE, "The bind interface for connecting to the XMPP server."); props.setProperty(XOPKEYS.GATEWAY.PORT, "5269"); comments.put(XOPKEYS.GATEWAY.PORT, "The port to connect to on the Gatewayed XMPP server."); props.setProperty(XOPKEYS.GATEWAY.PING, "30000"); comments.put(XOPKEYS.GATEWAY.PING, "The interval at which this server should send ping messages to the connected server"); props.setProperty(XOPKEYS.GATEWAY.REWRITEDOMAIN, "false"); comments.put(XOPKEYS.GATEWAY.REWRITEDOMAIN, "True if messages and presences domains are rewritten from the XOP.DOMAIN to the XOP.GATEWAYDOMAIN"); props.setProperty(XOPKEYS.TRANSPORT.SERVICE, "norm-transport"); comments.put(XOPKEYS.TRANSPORT.SERVICE, "Transport service to use: [transport-engine, groupcomms, norm-transport, simple-transport]"); props.setProperty(XOPKEYS.TRANSPORT.SEND_INTERFACE, "ANY"); comments.put(XOPKEYS.TRANSPORT.SEND_INTERFACE, "Bound interface to SEND transport messages or 'ANY' for all interfaces"); props.setProperty(XOPKEYS.TRANSPORT.RECV_INTERFACE, "ANY"); comments.put(XOPKEYS.TRANSPORT.RECV_INTERFACE, "Bound interface to RECEIVE transport messages or 'ANY' for all interfaces"); props.setProperty(XOPKEYS.TRANSPORT.ADDRESS, "225.0.87.4"); comments.put(XOPKEYS.TRANSPORT.ADDRESS, "default multicast group for transport"); props.setProperty(XOPKEYS.TRANSPORT.PORTRANGE, "10001-10001"); comments.put(XOPKEYS.TRANSPORT.PORTRANGE, "Port range for sending/receiving"); props.setProperty(XOPKEYS.TRANSPORT.NORM.SENDBUFFERSPACE, "65536"); comments.put(XOPKEYS.TRANSPORT.NORM.SENDBUFFERSPACE, "Bufferspace for sender threads. default: 256*256=65536"); props.setProperty(XOPKEYS.TRANSPORT.NORM.RCVBUFFERSPACE, "65536"); comments.put(XOPKEYS.TRANSPORT.NORM.RCVBUFFERSPACE, "Bufferspace for receiver threads. default: 65536"); props.setProperty(XOPKEYS.TRANSPORT.NORM.SEGMENTSIZE, "1400"); comments.put(XOPKEYS.TRANSPORT.NORM.SEGMENTSIZE, "Size of segments in bytes. default: 1400"); props.setProperty(XOPKEYS.TRANSPORT.NORM.BLOCKSIZE, "64"); comments.put(XOPKEYS.TRANSPORT.NORM.BLOCKSIZE, "Size NORM blocks in bytes. default: 64"); props.setProperty(XOPKEYS.TRANSPORT.NORM.NUMPARITY, "15"); comments.put(XOPKEYS.TRANSPORT.NORM.NUMPARITY, "Parity bits. default: 16"); props.setProperty(XOPKEYS.TRANSPORT.NORM.SD.INTERVAL, "4000"); comments.put(XOPKEYS.TRANSPORT.NORM.SD.INTERVAL, "Advertisement message send interval in ms. default: 4000"); props.setProperty(XOPKEYS.TRANSPORT.NORM.SD.TIMEOUT, "3"); comments.put(XOPKEYS.TRANSPORT.NORM.SD.TIMEOUT, "Number of messages missed before triggering lost messages. default: 3"); props.setProperty(XOPKEYS.TRANSPORT.TE.ADDRESS, "127.0.0.1"); comments.put(XOPKEYS.TRANSPORT.TE.ADDRESS, "IP address of transport engine instance"); props.setProperty(XOPKEYS.TRANSPORT.TE.LISTENPORT, "1998"); comments.put(XOPKEYS.TRANSPORT.TE.LISTENPORT, "Port transport engine instance is listening on."); props.setProperty(XOPKEYS.TRANSPORT.TE.GROUPRANGE, "225.0.2.187-225.0.2.223"); comments.put(XOPKEYS.TRANSPORT.TE.GROUPRANGE, "The group range for sending/rcving on transport engine."); props.setProperty(XOPKEYS.TRANSPORT.TE.PORT, "12601"); comments.put(XOPKEYS.TRANSPORT.TE.PORT, "Port simple transport instance is listening on."); props.setProperty(XOPKEYS.TRANSPORT.TE.PERSISTTIME, "0"); comments.put(XOPKEYS.TRANSPORT.TE.PERSISTTIME, "Time to persist. TE interprets 1 as persist forever, and 0 as do not persist at all."); props.setProperty(XOPKEYS.TRANSPORT.TE.RELIABLE, "false"); comments.put(XOPKEYS.TRANSPORT.TE.RELIABLE, "Use reliable transport for MUC and OneToOne, default: false"); props.setProperty(XOPKEYS.TRANSPORT.GC.ROOMS.BESTEFFORT, "*"); comments.put(XOPKEYS.TRANSPORT.GC.ROOMS.BESTEFFORT, "Best Effort rooms (*=catchall), default=*"); props.setProperty(XOPKEYS.TRANSPORT.GC.ROOMS.RELIABLE, ""); comments.put(XOPKEYS.TRANSPORT.GC.ROOMS.RELIABLE, "Reliable rooms (*=catchall), default=''"); props.setProperty(XOPKEYS.TRANSPORT.GC.ROOMS.ORDERED, ""); comments.put(XOPKEYS.TRANSPORT.GC.ROOMS.ORDERED, "Ordered (by sender) rooms (*=catchall), default=''"); props.setProperty(XOPKEYS.TRANSPORT.GC.ROOMS.AGREED, ""); comments.put(XOPKEYS.TRANSPORT.GC.ROOMS.AGREED, "Agreed ordered rooms (*=catchall), default=''"); props.setProperty(XOPKEYS.TRANSPORT.GC.ROOMS.SAFE, ""); comments.put(XOPKEYS.TRANSPORT.GC.ROOMS.SAFE, "Safe ordered rooms (*=catchall), default=''"); props.setProperty(XOPKEYS.TRANSPORT.GC.DISCOVERY.GROUP, "0"); comments.put(XOPKEYS.TRANSPORT.GC.DISCOVERY.GROUP, "the group number that GCS will use for discovery messages. The default is 0."); props.setProperty(XOPKEYS.TRANSPORT.GC.DISCOVERYDELAY, "5000"); comments.put(XOPKEYS.TRANSPORT.GC.DISCOVERYDELAY, "The delay for sweeping and signaling XOP SD service (default: 5000ms)"); props.setProperty(XOPKEYS.TRANSPORT.GC.AGENT.ADDRESS, "127.0.0.1"); comments.put(XOPKEYS.TRANSPORT.GC.AGENT.ADDRESS, "address of GCS instance. The default is 127.0.0.1"); props.setProperty(XOPKEYS.TRANSPORT.GC.AGENT.PORT, "56789"); comments.put(XOPKEYS.TRANSPORT.GC.AGENT.PORT, "GCS instance port (default: 56789)"); logger.finer("setting DefaultProperties COMPLETE!"); return props; }
public static void loadDefaults() { <DeepExtract> logger.finer("setting DefaultProperties"); Properties props = new Properties(); props.setProperty(XOPKEYS.DOMAIN, "proxy"); comments.put(XOPKEYS.DOMAIN, "The domain name for this proxy instance."); props.setProperty(XOPKEYS.PORT, "5222"); comments.put(XOPKEYS.PORT, "The port to run the XMPP server on (for XMPP clients)."); props.setProperty(XOPKEYS.BIND.INTERFACE, "eth0"); comments.put(XOPKEYS.BIND.INTERFACE, "The interface to listen for XMPP clients or 'ANY' for all interfaces"); props.setProperty(XOPKEYS.ENABLE.GATEWAY, "false"); comments.put(XOPKEYS.ENABLE.GATEWAY, "Set to true to enable gatewaying to another XMPP server via dialback protocol, false to disable"); props.setProperty(XOPKEYS.ENABLE.COMPRESSION, "false"); comments.put(XOPKEYS.ENABLE.COMPRESSION, "Enable/disable compressing messages before sending to the Transport system. Default: false (disabled)"); props.setProperty(XOPKEYS.ENABLE.STREAM, "false"); comments.put(XOPKEYS.ENABLE.STREAM, "Set to true to enable bytestreams, false to disable"); props.setProperty(XOPKEYS.ENABLE.ANDROIDLOGGING, "false"); comments.put(XOPKEYS.ENABLE.ANDROIDLOGGING, "Set to true to enable logging in the app text view, false to disable"); props.setProperty(XOPKEYS.ENABLE.DEVICELOGGING, "false"); comments.put(XOPKEYS.ENABLE.DEVICELOGGING, "Set to true to enable text file logging on the android file system, false to disable"); props.setProperty(XOPKEYS.ENABLE.DELAY, "true"); comments.put(XOPKEYS.ENABLE.DELAY, "add delay element to messages according to XEP "); props.setProperty(XOPKEYS.TLS.AUTH, "false"); comments.put(XOPKEYS.TLS.AUTH, "set to true if clients must connect via tls, false otherwise"); props.setProperty(XOPKEYS.STREAM.PORT, "7625"); comments.put(XOPKEYS.STREAM.PORT, "The port on which clients should connect to open a bytestream"); String xopDomain = props.getProperty(XOPKEYS.DOMAIN); props.setProperty(XOPKEYS.STREAM.JID, "stream." + xopDomain); comments.put(XOPKEYS.STREAM.JID, "The JID to identify the bytestream host"); props.setProperty(XOPKEYS.SSL.KEYSTORE, "config/keystore.jks"); comments.put(XOPKEYS.SSL.KEYSTORE, "Where the server keystore is located"); props.setProperty(XOPKEYS.SSL.TRUSTSTORE, "config/cacerts.jks"); comments.put(XOPKEYS.SSL.TRUSTSTORE, "Where the truststore for server-to-server connections is located"); props.setProperty(XOPKEYS.SSL.PASSWORD, "xopstore"); comments.put(XOPKEYS.SSL.PASSWORD, "The password for the keystore and truststore"); props.setProperty(XOPKEYS.SDS.SERVICE, "norm-transport"); comments.put(XOPKEYS.SDS.SERVICE, "choose which Service discovery system to use (for presence), default 'norm-transport'"); props.setProperty(XOPKEYS.SDS.INDI.ADDRESS, "225.0.2.186"); comments.put(XOPKEYS.SDS.INDI.ADDRESS, "The multicast address for INDI to bind to. default 224.0.1.186"); props.setProperty(XOPKEYS.SDS.INDI.PORT, "5353"); comments.put(XOPKEYS.SDS.INDI.PORT, "The multicast port for INDI to bind to. default 5353"); props.setProperty(XOPKEYS.SDS.INDI.TTL, "15000"); comments.put(XOPKEYS.SDS.INDI.TTL, "Lifetime (TTL) of the service in milliseconds (long)"); props.setProperty(XOPKEYS.SDS.INDI.RAI, "10000"); comments.put(XOPKEYS.SDS.INDI.RAI, "Service proactive re-advertisement interval for sending advertisements in milliseconds (long)"); props.setProperty(XOPKEYS.SDS.INDI.NUMRA, "-1"); comments.put(XOPKEYS.SDS.INDI.NUMRA, "Number of times to readvertise the service (int, -1 = forever)"); props.setProperty(XOPKEYS.SDS.INDI.CQI, "0,100,200,400,800,1600"); comments.put(XOPKEYS.SDS.INDI.CQI, "Times a client queries for a service e.g. 0,100,200 (comma separated list of longs)"); props.setProperty(XOPKEYS.SDS.INDI.SCI, "12000"); comments.put(XOPKEYS.SDS.INDI.SCI, "Proactive service cancel notification interval"); props.setProperty(XOPKEYS.SDS.INDI.NUMSCM, "3"); comments.put(XOPKEYS.SDS.INDI.NUMSCM, "Number of times to send proactive service cancellations (int)"); props.setProperty(XOPKEYS.SDS.INDI.ALLOW_LOOPBACK, "false"); comments.put(XOPKEYS.SDS.INDI.ALLOW_LOOPBACK, "sets whether the instances of indi allow loopback or not"); props.setProperty(XOPKEYS.SDS.INDI.ALLOW_DUPLICATES, "false"); comments.put(XOPKEYS.SDS.INDI.ALLOW_DUPLICATES, "sets whether the instances of indi allow duplicate adverts or whether duplicate adverts are suppressed."); props.setProperty(XOPKEYS.GATEWAY.SERVER, "openfire"); comments.put(XOPKEYS.GATEWAY.SERVER, "The hostname of the external XMPP server to which the gateway should connect."); props.setProperty(XOPKEYS.GATEWAY.TLSAUTH, "false"); comments.put(XOPKEYS.GATEWAY.TLSAUTH, "true to use TLS with a gatewayed server, false otherwise."); props.setProperty(XOPKEYS.GATEWAY.BINDINTERFACE, "eth1"); comments.put(XOPKEYS.GATEWAY.BINDINTERFACE, "The bind interface for connecting to the XMPP server."); props.setProperty(XOPKEYS.GATEWAY.PORT, "5269"); comments.put(XOPKEYS.GATEWAY.PORT, "The port to connect to on the Gatewayed XMPP server."); props.setProperty(XOPKEYS.GATEWAY.PING, "30000"); comments.put(XOPKEYS.GATEWAY.PING, "The interval at which this server should send ping messages to the connected server"); props.setProperty(XOPKEYS.GATEWAY.REWRITEDOMAIN, "false"); comments.put(XOPKEYS.GATEWAY.REWRITEDOMAIN, "True if messages and presences domains are rewritten from the XOP.DOMAIN to the XOP.GATEWAYDOMAIN"); props.setProperty(XOPKEYS.TRANSPORT.SERVICE, "norm-transport"); comments.put(XOPKEYS.TRANSPORT.SERVICE, "Transport service to use: [transport-engine, groupcomms, norm-transport, simple-transport]"); props.setProperty(XOPKEYS.TRANSPORT.SEND_INTERFACE, "ANY"); comments.put(XOPKEYS.TRANSPORT.SEND_INTERFACE, "Bound interface to SEND transport messages or 'ANY' for all interfaces"); props.setProperty(XOPKEYS.TRANSPORT.RECV_INTERFACE, "ANY"); comments.put(XOPKEYS.TRANSPORT.RECV_INTERFACE, "Bound interface to RECEIVE transport messages or 'ANY' for all interfaces"); props.setProperty(XOPKEYS.TRANSPORT.ADDRESS, "225.0.87.4"); comments.put(XOPKEYS.TRANSPORT.ADDRESS, "default multicast group for transport"); props.setProperty(XOPKEYS.TRANSPORT.PORTRANGE, "10001-10001"); comments.put(XOPKEYS.TRANSPORT.PORTRANGE, "Port range for sending/receiving"); props.setProperty(XOPKEYS.TRANSPORT.NORM.SENDBUFFERSPACE, "65536"); comments.put(XOPKEYS.TRANSPORT.NORM.SENDBUFFERSPACE, "Bufferspace for sender threads. default: 256*256=65536"); props.setProperty(XOPKEYS.TRANSPORT.NORM.RCVBUFFERSPACE, "65536"); comments.put(XOPKEYS.TRANSPORT.NORM.RCVBUFFERSPACE, "Bufferspace for receiver threads. default: 65536"); props.setProperty(XOPKEYS.TRANSPORT.NORM.SEGMENTSIZE, "1400"); comments.put(XOPKEYS.TRANSPORT.NORM.SEGMENTSIZE, "Size of segments in bytes. default: 1400"); props.setProperty(XOPKEYS.TRANSPORT.NORM.BLOCKSIZE, "64"); comments.put(XOPKEYS.TRANSPORT.NORM.BLOCKSIZE, "Size NORM blocks in bytes. default: 64"); props.setProperty(XOPKEYS.TRANSPORT.NORM.NUMPARITY, "15"); comments.put(XOPKEYS.TRANSPORT.NORM.NUMPARITY, "Parity bits. default: 16"); props.setProperty(XOPKEYS.TRANSPORT.NORM.SD.INTERVAL, "4000"); comments.put(XOPKEYS.TRANSPORT.NORM.SD.INTERVAL, "Advertisement message send interval in ms. default: 4000"); props.setProperty(XOPKEYS.TRANSPORT.NORM.SD.TIMEOUT, "3"); comments.put(XOPKEYS.TRANSPORT.NORM.SD.TIMEOUT, "Number of messages missed before triggering lost messages. default: 3"); props.setProperty(XOPKEYS.TRANSPORT.TE.ADDRESS, "127.0.0.1"); comments.put(XOPKEYS.TRANSPORT.TE.ADDRESS, "IP address of transport engine instance"); props.setProperty(XOPKEYS.TRANSPORT.TE.LISTENPORT, "1998"); comments.put(XOPKEYS.TRANSPORT.TE.LISTENPORT, "Port transport engine instance is listening on."); props.setProperty(XOPKEYS.TRANSPORT.TE.GROUPRANGE, "225.0.2.187-225.0.2.223"); comments.put(XOPKEYS.TRANSPORT.TE.GROUPRANGE, "The group range for sending/rcving on transport engine."); props.setProperty(XOPKEYS.TRANSPORT.TE.PORT, "12601"); comments.put(XOPKEYS.TRANSPORT.TE.PORT, "Port simple transport instance is listening on."); props.setProperty(XOPKEYS.TRANSPORT.TE.PERSISTTIME, "0"); comments.put(XOPKEYS.TRANSPORT.TE.PERSISTTIME, "Time to persist. TE interprets 1 as persist forever, and 0 as do not persist at all."); props.setProperty(XOPKEYS.TRANSPORT.TE.RELIABLE, "false"); comments.put(XOPKEYS.TRANSPORT.TE.RELIABLE, "Use reliable transport for MUC and OneToOne, default: false"); props.setProperty(XOPKEYS.TRANSPORT.GC.ROOMS.BESTEFFORT, "*"); comments.put(XOPKEYS.TRANSPORT.GC.ROOMS.BESTEFFORT, "Best Effort rooms (*=catchall), default=*"); props.setProperty(XOPKEYS.TRANSPORT.GC.ROOMS.RELIABLE, ""); comments.put(XOPKEYS.TRANSPORT.GC.ROOMS.RELIABLE, "Reliable rooms (*=catchall), default=''"); props.setProperty(XOPKEYS.TRANSPORT.GC.ROOMS.ORDERED, ""); comments.put(XOPKEYS.TRANSPORT.GC.ROOMS.ORDERED, "Ordered (by sender) rooms (*=catchall), default=''"); props.setProperty(XOPKEYS.TRANSPORT.GC.ROOMS.AGREED, ""); comments.put(XOPKEYS.TRANSPORT.GC.ROOMS.AGREED, "Agreed ordered rooms (*=catchall), default=''"); props.setProperty(XOPKEYS.TRANSPORT.GC.ROOMS.SAFE, ""); comments.put(XOPKEYS.TRANSPORT.GC.ROOMS.SAFE, "Safe ordered rooms (*=catchall), default=''"); props.setProperty(XOPKEYS.TRANSPORT.GC.DISCOVERY.GROUP, "0"); comments.put(XOPKEYS.TRANSPORT.GC.DISCOVERY.GROUP, "the group number that GCS will use for discovery messages. The default is 0."); props.setProperty(XOPKEYS.TRANSPORT.GC.DISCOVERYDELAY, "5000"); comments.put(XOPKEYS.TRANSPORT.GC.DISCOVERYDELAY, "The delay for sweeping and signaling XOP SD service (default: 5000ms)"); props.setProperty(XOPKEYS.TRANSPORT.GC.AGENT.ADDRESS, "127.0.0.1"); comments.put(XOPKEYS.TRANSPORT.GC.AGENT.ADDRESS, "address of GCS instance. The default is 127.0.0.1"); props.setProperty(XOPKEYS.TRANSPORT.GC.AGENT.PORT, "56789"); comments.put(XOPKEYS.TRANSPORT.GC.AGENT.PORT, "GCS instance port (default: 56789)"); logger.finer("setting DefaultProperties COMPLETE!"); return props; </DeepExtract> }
xmpp-overlay
positive
1,466
@Override public void onGetNetworks(NetInfo[] nets) { Message m = Message.obtain(null, MsgId.GET_NETWORKS); m.setData(Utils.netArray2Bundle(nets)); if (mClientMessenger != null) try { Log.d(TAG, "forward a msg to clientMessenger"); mClientMessenger.send(m); } catch (RemoteException e) { Log.e(TAG, "failed to forward msg to local messenger recver: " + e.getMessage()); } }
@Override public void onGetNetworks(NetInfo[] nets) { Message m = Message.obtain(null, MsgId.GET_NETWORKS); m.setData(Utils.netArray2Bundle(nets)); <DeepExtract> if (mClientMessenger != null) try { Log.d(TAG, "forward a msg to clientMessenger"); mClientMessenger.send(m); } catch (RemoteException e) { Log.e(TAG, "failed to forward msg to local messenger recver: " + e.getMessage()); } </DeepExtract> }
PeerDeviceNet_Src
positive
1,467
public void refresh() { for (int i = templatePanels.size() - 1; i >= 0; i--) { var templatePanel = templatePanels.get(i); mainPanel.remove(templatePanel); templatePanels.remove(templatePanel); } var loadedCopyTemplates = ConfigLogic.getInstance().getUserOptions().getCopyTemplates(); if (loadedCopyTemplates == null) { return; } loadedCopyTemplates.entrySet().forEach(entry -> { addTemplatePanel(entry.getKey(), entry.getValue(), getMnemonic(entry.getKey())); }); UiUtil.repaint(mainPanel); Controller.getInstance().refreshMessageTablePopupMenu(); }
public void refresh() { for (int i = templatePanels.size() - 1; i >= 0; i--) { var templatePanel = templatePanels.get(i); mainPanel.remove(templatePanel); templatePanels.remove(templatePanel); } <DeepExtract> var loadedCopyTemplates = ConfigLogic.getInstance().getUserOptions().getCopyTemplates(); if (loadedCopyTemplates == null) { return; } loadedCopyTemplates.entrySet().forEach(entry -> { addTemplatePanel(entry.getKey(), entry.getValue(), getMnemonic(entry.getKey())); }); UiUtil.repaint(mainPanel); </DeepExtract> Controller.getInstance().refreshMessageTablePopupMenu(); }
integrated-security-testing-environment
positive
1,468
@Override public <T> int update(T entity, IncludeType includeType) { if (entity == null) return -1; getInterceptorChain().beforePasreEntity(entity, SuidType.UPDATE); String sql = getObjToSQLRich().toUpdateSQL(entity, includeType); if (entity == null) return; HoneyContext.regEntityClass(entity.getClass()); sql = doAfterCompleteSql(sql); Logger.logSQL("update SQL: ", sql); int r = getBeeSql().modify(sql); doBeforeReturn(); return r; }
@Override public <T> int update(T entity, IncludeType includeType) { if (entity == null) return -1; getInterceptorChain().beforePasreEntity(entity, SuidType.UPDATE); String sql = getObjToSQLRich().toUpdateSQL(entity, includeType); <DeepExtract> if (entity == null) return; HoneyContext.regEntityClass(entity.getClass()); </DeepExtract> sql = doAfterCompleteSql(sql); Logger.logSQL("update SQL: ", sql); int r = getBeeSql().modify(sql); doBeforeReturn(); return r; }
honey
positive
1,469
public ErrorCode configSetParameter(int param, double value, int subValue, int ordinal, int timeoutMs) { int retval = PigeonImuJNI.JNI_ConfigSetParameter(m_handle, param, value, subValue, ordinal, timeoutMs); for (CalibrationMode e : CalibrationMode.values()) { if (e.value == retval) { return e; } } return Unknown; }
public ErrorCode configSetParameter(int param, double value, int subValue, int ordinal, int timeoutMs) { int retval = PigeonImuJNI.JNI_ConfigSetParameter(m_handle, param, value, subValue, ordinal, timeoutMs); <DeepExtract> for (CalibrationMode e : CalibrationMode.values()) { if (e.value == retval) { return e; } } return Unknown; </DeepExtract> }
Phoenix-api
positive
1,470
public static RoundedBitmapDrawable getRoundedDrawable(Context context, Bitmap bitmap, float cornerRadius) { RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(context.getResources(), bitmap); roundedBitmapDrawable.setAntiAlias(true); mCornerRadius = cornerRadius; return roundedBitmapDrawable; }
public static RoundedBitmapDrawable getRoundedDrawable(Context context, Bitmap bitmap, float cornerRadius) { RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(context.getResources(), bitmap); roundedBitmapDrawable.setAntiAlias(true); <DeepExtract> mCornerRadius = cornerRadius; </DeepExtract> return roundedBitmapDrawable; }
BGAPhotoPicker-Android
positive
1,471
void observe() { final ContentResolver resolver = mContext.getContentResolver(); resolver.registerContentObserver(Settings.System.getUriFor(SETTING_EXPANDED_DESKTOP_STATE), false, this); updateSettings(false); }
void observe() { final ContentResolver resolver = mContext.getContentResolver(); resolver.registerContentObserver(Settings.System.getUriFor(SETTING_EXPANDED_DESKTOP_STATE), false, this); <DeepExtract> updateSettings(false); </DeepExtract> }
GravityBox
positive
1,472
@Override public boolean onHitEntity(Entity entityHit, DamageSource source, float ammount) { source.setExplosion(); if (!this.world.isRemote) { this.world.createExplosion(this.shootingEntity, this.posX, this.posY, this.posZ, getExplosionStrength(), canBreakBlocks()); this.setDead(); } return false; }
@Override public boolean onHitEntity(Entity entityHit, DamageSource source, float ammount) { source.setExplosion(); <DeepExtract> if (!this.world.isRemote) { this.world.createExplosion(this.shootingEntity, this.posX, this.posY, this.posZ, getExplosionStrength(), canBreakBlocks()); this.setDead(); } </DeepExtract> return false; }
Battlegear2
positive
1,473
public BufferedImage getBufferedImage() { if (image == null || abort) return null; BufferedImage img = new BufferedImage(getIntrinsicWidth(), getIntrinsicHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D g = img.createGraphics(); g.drawImage(image, null, null); if (image != null) image.flush(); image = null; return img; }
public BufferedImage getBufferedImage() { if (image == null || abort) return null; BufferedImage img = new BufferedImage(getIntrinsicWidth(), getIntrinsicHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D g = img.createGraphics(); g.drawImage(image, null, null); <DeepExtract> if (image != null) image.flush(); image = null; </DeepExtract> return img; }
CSSBox
positive
1,474
public static CardConsultationData createSimpleCard(String processSuffix, Instant publication, Instant start, Instant end, String login, String[] groups, String[] entities, String[] userAcks, String[] userReads, String[] entitiesAcks) { CardConsultationData.CardConsultationDataBuilder cardBuilder = CardConsultationData.builder().process("PROCESS").processInstanceId("PROCESS" + processSuffix).publisher("PUBLISHER").processVersion("0").state("anyState").startDate(start).endDate(end != null ? end : null).severity(SeverityEnum.ALARM).title(I18nConsultationData.builder().key("title").build()).summary(I18nConsultationData.builder().key("summary").build()).usersAcks(userAcks != null ? Arrays.asList(userAcks) : null).usersReads(userReads != null ? Arrays.asList(userReads) : null).entitiesAcks(entitiesAcks != null ? Arrays.asList(entitiesAcks) : null); if (groups != null && groups.length > 0) cardBuilder.groupRecipients(Arrays.asList(groups)); if (entities != null && entities.length > 0) cardBuilder.entityRecipients(Arrays.asList(entities)); if (login != null) cardBuilder.userRecipient(login); CardConsultationData card = cardBuilder.build(); card.setUid(UUID.randomUUID().toString()); card.setPublishDate(publication); card.setId(card.getProcess() + "." + card.getProcessInstanceId()); card.setProcessStateKey(card.getProcess() + "." + card.getState()); return card; }
public static CardConsultationData createSimpleCard(String processSuffix, Instant publication, Instant start, Instant end, String login, String[] groups, String[] entities, String[] userAcks, String[] userReads, String[] entitiesAcks) { CardConsultationData.CardConsultationDataBuilder cardBuilder = CardConsultationData.builder().process("PROCESS").processInstanceId("PROCESS" + processSuffix).publisher("PUBLISHER").processVersion("0").state("anyState").startDate(start).endDate(end != null ? end : null).severity(SeverityEnum.ALARM).title(I18nConsultationData.builder().key("title").build()).summary(I18nConsultationData.builder().key("summary").build()).usersAcks(userAcks != null ? Arrays.asList(userAcks) : null).usersReads(userReads != null ? Arrays.asList(userReads) : null).entitiesAcks(entitiesAcks != null ? Arrays.asList(entitiesAcks) : null); if (groups != null && groups.length > 0) cardBuilder.groupRecipients(Arrays.asList(groups)); if (entities != null && entities.length > 0) cardBuilder.entityRecipients(Arrays.asList(entities)); if (login != null) cardBuilder.userRecipient(login); CardConsultationData card = cardBuilder.build(); <DeepExtract> card.setUid(UUID.randomUUID().toString()); card.setPublishDate(publication); card.setId(card.getProcess() + "." + card.getProcessInstanceId()); card.setProcessStateKey(card.getProcess() + "." + card.getState()); </DeepExtract> return card; }
operatorfabric-core
positive
1,475
@Override public void process(final Throwable exception) throws Exception { System.out.println("Clear => " + exception); System.out.println("Get => " + null); rp.processResponse(null); }
@Override public void process(final Throwable exception) throws Exception { System.out.println("Clear => " + exception); <DeepExtract> System.out.println("Get => " + null); rp.processResponse(null); </DeepExtract> }
JActor
positive
1,476
protected void initComponents() { JFrame frame = new JFrame("Demo JFrame"); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); Image iconImage = null; try { URL imageURL = FrameDemo.class.getResource("resources/images/swingingduke.gif"); iconImage = ImageIO.read(imageURL); } catch (Exception e) { } frame.setIconImage(iconImage); frame.setGlassPane(new BusyGlass()); JMenuBar menubar = new JMenuBar(); frame.setJMenuBar(menubar); JMenu menu = new JMenu("File"); menubar.add(menu); menu.add("Open"); menu.add("Save"); JToolBar toolbar = new JToolBar(); frame.add(toolbar, BorderLayout.NORTH); toolbar.add(new JButton("Toolbar Button")); JLabel label = new JLabel("I'm content but a little blue."); label.setHorizontalAlignment(JLabel.CENTER); label.setPreferredSize(new Dimension(300, 160)); label.setBackground(new Color(197, 216, 236)); label.setOpaque(true); frame.add(label); JLabel statusLabel = new JLabel("I show status."); statusLabel.setBorder(new EmptyBorder(4, 4, 4, 4)); statusLabel.setHorizontalAlignment(JLabel.LEADING); frame.add(statusLabel, BorderLayout.SOUTH); frame.pack(); return frame; setLayout(new BorderLayout()); add(createControlPanel(), BorderLayout.WEST); JPanel framePlaceholder = new JPanel(); Dimension prefSize = frame.getPreferredSize(); prefSize.width += 12; prefSize.height += 12; framePlaceholder.setPreferredSize(prefSize); return framePlaceholder; add(frameSpaceholder, BorderLayout.CENTER); }
protected void initComponents() { JFrame frame = new JFrame("Demo JFrame"); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); Image iconImage = null; try { URL imageURL = FrameDemo.class.getResource("resources/images/swingingduke.gif"); iconImage = ImageIO.read(imageURL); } catch (Exception e) { } frame.setIconImage(iconImage); frame.setGlassPane(new BusyGlass()); JMenuBar menubar = new JMenuBar(); frame.setJMenuBar(menubar); JMenu menu = new JMenu("File"); menubar.add(menu); menu.add("Open"); menu.add("Save"); JToolBar toolbar = new JToolBar(); frame.add(toolbar, BorderLayout.NORTH); toolbar.add(new JButton("Toolbar Button")); JLabel label = new JLabel("I'm content but a little blue."); label.setHorizontalAlignment(JLabel.CENTER); label.setPreferredSize(new Dimension(300, 160)); label.setBackground(new Color(197, 216, 236)); label.setOpaque(true); frame.add(label); JLabel statusLabel = new JLabel("I show status."); statusLabel.setBorder(new EmptyBorder(4, 4, 4, 4)); statusLabel.setHorizontalAlignment(JLabel.LEADING); frame.add(statusLabel, BorderLayout.SOUTH); frame.pack(); return frame; setLayout(new BorderLayout()); add(createControlPanel(), BorderLayout.WEST); <DeepExtract> JPanel framePlaceholder = new JPanel(); Dimension prefSize = frame.getPreferredSize(); prefSize.width += 12; prefSize.height += 12; framePlaceholder.setPreferredSize(prefSize); return framePlaceholder; </DeepExtract> add(frameSpaceholder, BorderLayout.CENTER); }
swingset3
positive
1,477
@Override public Object arrayOfField(int size) { return acquireByteBuffer(null, sizeOf0(size)).asCharBuffer(); }
@Override public Object arrayOfField(int size) { <DeepExtract> return acquireByteBuffer(null, sizeOf0(size)).asCharBuffer(); </DeepExtract> }
Collections
positive
1,478
public static AdditionalServiceType createTimestampService() { final AdditionalServiceType s = MssClient.mssObjFactory.createAdditionalServiceType(); final MssURIType d = MssClient.mssObjFactory.createMssURIType(); d.setMssURI(URI_TIMESTAMP); s.setDescription(d); return s; }
public static AdditionalServiceType createTimestampService() { <DeepExtract> final AdditionalServiceType s = MssClient.mssObjFactory.createAdditionalServiceType(); final MssURIType d = MssClient.mssObjFactory.createMssURIType(); d.setMssURI(URI_TIMESTAMP); s.setDescription(d); return s; </DeepExtract> }
laverca
positive
1,479
void setAttribute(String elName, String name, int type, String enumeration, String value, int valueType) throws java.lang.Exception { Object[] element = (Object[]) elementInfo.get(elName); if (element == null) { attlist = null; } return (Hashtable) element[2]; if (attlist == null) { attlist = new Hashtable(); } if (attlist.get(name) != null) { return; } else { attribute = new Object[5]; attribute[0] = new Integer(type); attribute[1] = value; attribute[2] = new Integer(valueType); attribute[3] = enumeration; attribute[4] = null; attlist.put(name.intern(), attribute); setElement(elName, CONTENT_UNDECLARED, null, attlist); } }
void setAttribute(String elName, String name, int type, String enumeration, String value, int valueType) throws java.lang.Exception { <DeepExtract> Object[] element = (Object[]) elementInfo.get(elName); if (element == null) { attlist = null; } return (Hashtable) element[2]; </DeepExtract> if (attlist == null) { attlist = new Hashtable(); } if (attlist.get(name) != null) { return; } else { attribute = new Object[5]; attribute[0] = new Integer(type); attribute[1] = value; attribute[2] = new Integer(valueType); attribute[3] = enumeration; attribute[4] = null; attlist.put(name.intern(), attribute); setElement(elName, CONTENT_UNDECLARED, null, attlist); } }
AnalyseSI
positive
1,480
public String getFlowControlOutString() { switch(m_FlowControlOut) { case SerialPort.FLOWCONTROL_NONE: return "none"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "xon/xoff out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "xon/xoff in"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "rts/cts in"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "rts/cts out"; default: return "none"; } }
public String getFlowControlOutString() { <DeepExtract> switch(m_FlowControlOut) { case SerialPort.FLOWCONTROL_NONE: return "none"; case SerialPort.FLOWCONTROL_XONXOFF_OUT: return "xon/xoff out"; case SerialPort.FLOWCONTROL_XONXOFF_IN: return "xon/xoff in"; case SerialPort.FLOWCONTROL_RTSCTS_IN: return "rts/cts in"; case SerialPort.FLOWCONTROL_RTSCTS_OUT: return "rts/cts out"; default: return "none"; } </DeepExtract> }
jamod
positive
1,481
@Override public SearchResultJson search(ISearchService.Options options) { var json = new SearchResultJson(); var size = options.requestedSize; if (size <= 0 || !search.isEnabled()) { json.extensions = Collections.emptyList(); return json; } var searchHits = search.search(options); var serverUrl = UrlUtil.getBaseUrl(); var extensions = searchHits.stream().map(this::getExtension).filter(Objects::nonNull).collect(Collectors.toList()); var latestVersions = extensions.stream().map(e -> { var latest = versions.getLatestTrxn(e, null, false, true); json.extensions = new AbstractMap.SimpleEntry<>(e.getId(), latest); }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); var searchEntries = latestVersions.entrySet().stream().map(e -> { var entry = e.getValue().toSearchEntryJson(); entry.url = createApiUrl(serverUrl, "api", entry.namespace, entry.name); json.extensions = new AbstractMap.SimpleEntry<>(e.getKey(), entry); }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); var fileUrls = storageUtil.getFileUrls(latestVersions.values(), serverUrl, withFileTypes(DOWNLOAD, ICON)); searchEntries.forEach((extensionId, searchEntry) -> { var extVersion = latestVersions.get(extensionId); searchEntry.files = fileUrls.get(extVersion.getId()); if (searchEntry.files.containsKey(DOWNLOAD_SIG)) { searchEntry.files.put(PUBLIC_KEY, UrlUtil.getPublicKeyUrl(extVersion)); } }); if (options.includeAllVersions) { var allActiveVersions = repositories.findActiveVersions(extensions).stream().sorted(ExtensionVersion.SORT_COMPARATOR).collect(Collectors.toList()); var activeVersionsByExtensionId = allActiveVersions.stream().collect(Collectors.groupingBy(ev -> ev.getExtension().getId())); var versionUrls = storageUtil.getFileUrls(allActiveVersions, serverUrl, DOWNLOAD); for (var extension : extensions) { var activeVersions = activeVersionsByExtensionId.get(extension.getId()); var searchEntry = searchEntries.get(extension.getId()); searchEntry.allVersions = getAllVersionReferences(activeVersions, versionUrls, serverUrl); } } return extensions.stream().map(Extension::getId).map(searchEntries::get).collect(Collectors.toList()); json.offset = options.requestedOffset; json.totalSize = (int) searchHits.getTotalHits(); return json; }
@Override public SearchResultJson search(ISearchService.Options options) { var json = new SearchResultJson(); var size = options.requestedSize; if (size <= 0 || !search.isEnabled()) { json.extensions = Collections.emptyList(); return json; } var searchHits = search.search(options); <DeepExtract> var serverUrl = UrlUtil.getBaseUrl(); var extensions = searchHits.stream().map(this::getExtension).filter(Objects::nonNull).collect(Collectors.toList()); var latestVersions = extensions.stream().map(e -> { var latest = versions.getLatestTrxn(e, null, false, true); json.extensions = new AbstractMap.SimpleEntry<>(e.getId(), latest); }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); var searchEntries = latestVersions.entrySet().stream().map(e -> { var entry = e.getValue().toSearchEntryJson(); entry.url = createApiUrl(serverUrl, "api", entry.namespace, entry.name); json.extensions = new AbstractMap.SimpleEntry<>(e.getKey(), entry); }).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); var fileUrls = storageUtil.getFileUrls(latestVersions.values(), serverUrl, withFileTypes(DOWNLOAD, ICON)); searchEntries.forEach((extensionId, searchEntry) -> { var extVersion = latestVersions.get(extensionId); searchEntry.files = fileUrls.get(extVersion.getId()); if (searchEntry.files.containsKey(DOWNLOAD_SIG)) { searchEntry.files.put(PUBLIC_KEY, UrlUtil.getPublicKeyUrl(extVersion)); } }); if (options.includeAllVersions) { var allActiveVersions = repositories.findActiveVersions(extensions).stream().sorted(ExtensionVersion.SORT_COMPARATOR).collect(Collectors.toList()); var activeVersionsByExtensionId = allActiveVersions.stream().collect(Collectors.groupingBy(ev -> ev.getExtension().getId())); var versionUrls = storageUtil.getFileUrls(allActiveVersions, serverUrl, DOWNLOAD); for (var extension : extensions) { var activeVersions = activeVersionsByExtensionId.get(extension.getId()); var searchEntry = searchEntries.get(extension.getId()); searchEntry.allVersions = getAllVersionReferences(activeVersions, versionUrls, serverUrl); } } return extensions.stream().map(Extension::getId).map(searchEntries::get).collect(Collectors.toList()); </DeepExtract> json.offset = options.requestedOffset; json.totalSize = (int) searchHits.getTotalHits(); return json; }
openvsx
positive
1,482
public static ShowcaseView insertShowcaseView(float x, float y, Activity activity, String title, String detailText, ConfigOptions options) { ShowcaseView sv = new ShowcaseView(activity); if (options != null) sv.setConfigOptions(options); if (sv.getConfigOptions().insert == INSERT_TO_DECOR) { ((ViewGroup) activity.getWindow().getDecorView()).addView(sv); } else { ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv); } if (isRedundant) { return; } showcaseX = x; showcaseY = y; init(); invalidate(); String titleText = getContext().getResources().getString(title); String subText = getContext().getResources().getString(detailText); setText(titleText, subText); return sv; }
public static ShowcaseView insertShowcaseView(float x, float y, Activity activity, String title, String detailText, ConfigOptions options) { ShowcaseView sv = new ShowcaseView(activity); if (options != null) sv.setConfigOptions(options); if (sv.getConfigOptions().insert == INSERT_TO_DECOR) { ((ViewGroup) activity.getWindow().getDecorView()).addView(sv); } else { ((ViewGroup) activity.findViewById(android.R.id.content)).addView(sv); } if (isRedundant) { return; } showcaseX = x; showcaseY = y; init(); invalidate(); <DeepExtract> String titleText = getContext().getResources().getString(title); String subText = getContext().getResources().getString(detailText); setText(titleText, subText); </DeepExtract> return sv; }
android_packages_apps_Focal
positive
1,484
public void addColor(Color addition) { for (ColorSwatch swatch : swatches) { swatch.setSelected(false); } dashTimer.stop(); repaint(); ColorSwatch swatch = new ColorSwatch(addition, dashTimer, ml); this.swatches.add(swatch); return swatches == null ? 0 : swatches.size(); add(swatch, gbc); }
public void addColor(Color addition) { for (ColorSwatch swatch : swatches) { swatch.setSelected(false); } dashTimer.stop(); repaint(); ColorSwatch swatch = new ColorSwatch(addition, dashTimer, ml); this.swatches.add(swatch); <DeepExtract> return swatches == null ? 0 : swatches.size(); </DeepExtract> add(swatch, gbc); }
ChatGameFontificator
positive
1,485
@Override public void onQueryExecuted(List<DerpibooruTagDetailed> hiddenTags) { super.executeQuery(new CommentListParser(spoileredTags, hiddenTags)); }
@Override public void onQueryExecuted(List<DerpibooruTagDetailed> hiddenTags) { <DeepExtract> super.executeQuery(new CommentListParser(spoileredTags, hiddenTags)); </DeepExtract> }
Derpibooru
positive
1,486
public static String encryptSHA224ToString(byte[] data) { if (encryptSHA224(data) == null) return null; int len = encryptSHA224(data).length; if (len <= 0) return null; char[] ret = new char[len << 1]; for (int i = 0, j = 0; i < len; i++) { ret[j++] = hexDigits[encryptSHA224(data)[i] >>> 4 & 0x0f]; ret[j++] = hexDigits[encryptSHA224(data)[i] & 0x0f]; } return new String(ret); }
public static String encryptSHA224ToString(byte[] data) { <DeepExtract> if (encryptSHA224(data) == null) return null; int len = encryptSHA224(data).length; if (len <= 0) return null; char[] ret = new char[len << 1]; for (int i = 0, j = 0; i < len; i++) { ret[j++] = hexDigits[encryptSHA224(data)[i] >>> 4 & 0x0f]; ret[j++] = hexDigits[encryptSHA224(data)[i] & 0x0f]; } return new String(ret); </DeepExtract> }
HBase
positive
1,487
public void manipulatePdf(String dest) throws IOException, SQLException { PageSize postCard = new PageSize(283, 416); PdfDocument pdfDoc = new PdfDocument(new PdfWriter(SOURCE)); Document doc = new Document(pdfDoc, postCard); doc.setMargins(30, 30, 30, 30); PdfPage page = pdfDoc.addNewPage(); PdfCanvas under = new PdfCanvas(page.newContentStreamBefore(), page.getResources(), pdfDoc); drawRectangle(under, postCard.getWidth(), postCard.getHeight()); under.setFillColor(new DeviceRgb(0xFF, 0xD7, 0x00)); under.rectangle(5, 5, postCard.getWidth() - 10, postCard.getHeight() - 10); under.fill(); doc.add(new AreaBreak()); page = pdfDoc.getLastPage(); under = new PdfCanvas(page.newContentStreamBefore(), page.getResources(), pdfDoc); drawRectangle(under, postCard.getWidth(), postCard.getHeight()); Image img = new Image(ImageDataFactory.create(RESOURCE)); img.setFixedPosition((postCard.getWidth() - img.getImageScaledWidth()) / 2, (postCard.getHeight() - img.getImageScaledHeight()) / 2); doc.add(img); doc.add(new AreaBreak()); page = pdfDoc.getLastPage(); under = new PdfCanvas(page.newContentStreamBefore(), page.getResources(), pdfDoc); drawRectangle(under, postCard.getWidth(), postCard.getHeight()); Paragraph p = new Paragraph("Foobar Film Festival").setFont(PdfFontFactory.createFont(StandardFonts.HELVETICA)).setFontSize(22).setHorizontalAlignment(HorizontalAlignment.CENTER); doc.add(p); doc.add(new AreaBreak()); page = pdfDoc.getLastPage(); under = new PdfCanvas(page.newContentStreamBefore(), page.getResources(), pdfDoc); drawRectangle(under, postCard.getWidth(), postCard.getHeight()); page = pdfDoc.getLastPage(); PdfCanvas over = new PdfCanvas(page.newContentStreamAfter(), page.getResources(), pdfDoc); over.saveState(); float sinus = (float) Math.sin(Math.PI / 60); float cosinus = (float) Math.cos(Math.PI / 60); over.beginText(); over.setTextRenderingMode(PdfCanvasConstants.TextRenderingMode.FILL_STROKE); over.setLineWidth(1.5f); over.setStrokeColor(new DeviceRgb(0xFF, 0x00, 0x00)); over.setFillColor(new DeviceRgb(0xFF, 0xFF, 0xFF)); over.setFontAndSize(PdfFontFactory.createFont(StandardFonts.HELVETICA), 36); over.setTextMatrix(cosinus, sinus, -sinus, cosinus, 50, 324); over.showText("SOLD OUT"); over.setTextMatrix(0, 0); over.endText(); over.restoreState(); doc.close(); PdfDocument srcDoc = new PdfDocument(new PdfReader(SOURCE)); PdfDocument resultDoc = new PdfDocument(new PdfWriter(dest)); Document doc = new Document(resultDoc, new PageSize(PageSize.A5).rotate()); PdfFont font = PdfFontFactory.createFont(StandardFonts.ZAPFDINGBATS); PdfCanvas canvas = new PdfCanvas(resultDoc.addNewPage()); for (int i = 1; i <= srcDoc.getNumberOfPages(); i++) { PdfFormXObject layer = srcDoc.getPage(i).copyAsFormXObject(resultDoc); canvas.addXObjectWithTransformationMatrix(layer, 1f, 0, 0.4f, 0.4f, 72, 50 * i); canvas.beginText(); canvas.setFontAndSize(font, 20); canvas.moveText(496, 150 + 50 * i); canvas.showText(String.valueOf((char) (181 + i))); canvas.endText(); canvas.stroke(); } doc.close(); srcDoc.close(); }
public void manipulatePdf(String dest) throws IOException, SQLException { <DeepExtract> PageSize postCard = new PageSize(283, 416); PdfDocument pdfDoc = new PdfDocument(new PdfWriter(SOURCE)); Document doc = new Document(pdfDoc, postCard); doc.setMargins(30, 30, 30, 30); PdfPage page = pdfDoc.addNewPage(); PdfCanvas under = new PdfCanvas(page.newContentStreamBefore(), page.getResources(), pdfDoc); drawRectangle(under, postCard.getWidth(), postCard.getHeight()); under.setFillColor(new DeviceRgb(0xFF, 0xD7, 0x00)); under.rectangle(5, 5, postCard.getWidth() - 10, postCard.getHeight() - 10); under.fill(); doc.add(new AreaBreak()); page = pdfDoc.getLastPage(); under = new PdfCanvas(page.newContentStreamBefore(), page.getResources(), pdfDoc); drawRectangle(under, postCard.getWidth(), postCard.getHeight()); Image img = new Image(ImageDataFactory.create(RESOURCE)); img.setFixedPosition((postCard.getWidth() - img.getImageScaledWidth()) / 2, (postCard.getHeight() - img.getImageScaledHeight()) / 2); doc.add(img); doc.add(new AreaBreak()); page = pdfDoc.getLastPage(); under = new PdfCanvas(page.newContentStreamBefore(), page.getResources(), pdfDoc); drawRectangle(under, postCard.getWidth(), postCard.getHeight()); Paragraph p = new Paragraph("Foobar Film Festival").setFont(PdfFontFactory.createFont(StandardFonts.HELVETICA)).setFontSize(22).setHorizontalAlignment(HorizontalAlignment.CENTER); doc.add(p); doc.add(new AreaBreak()); page = pdfDoc.getLastPage(); under = new PdfCanvas(page.newContentStreamBefore(), page.getResources(), pdfDoc); drawRectangle(under, postCard.getWidth(), postCard.getHeight()); page = pdfDoc.getLastPage(); PdfCanvas over = new PdfCanvas(page.newContentStreamAfter(), page.getResources(), pdfDoc); over.saveState(); float sinus = (float) Math.sin(Math.PI / 60); float cosinus = (float) Math.cos(Math.PI / 60); over.beginText(); over.setTextRenderingMode(PdfCanvasConstants.TextRenderingMode.FILL_STROKE); over.setLineWidth(1.5f); over.setStrokeColor(new DeviceRgb(0xFF, 0x00, 0x00)); over.setFillColor(new DeviceRgb(0xFF, 0xFF, 0xFF)); over.setFontAndSize(PdfFontFactory.createFont(StandardFonts.HELVETICA), 36); over.setTextMatrix(cosinus, sinus, -sinus, cosinus, 50, 324); over.showText("SOLD OUT"); over.setTextMatrix(0, 0); over.endText(); over.restoreState(); doc.close(); </DeepExtract> PdfDocument srcDoc = new PdfDocument(new PdfReader(SOURCE)); PdfDocument resultDoc = new PdfDocument(new PdfWriter(dest)); Document doc = new Document(resultDoc, new PageSize(PageSize.A5).rotate()); PdfFont font = PdfFontFactory.createFont(StandardFonts.ZAPFDINGBATS); PdfCanvas canvas = new PdfCanvas(resultDoc.addNewPage()); for (int i = 1; i <= srcDoc.getNumberOfPages(); i++) { PdfFormXObject layer = srcDoc.getPage(i).copyAsFormXObject(resultDoc); canvas.addXObjectWithTransformationMatrix(layer, 1f, 0, 0.4f, 0.4f, 72, 50 * i); canvas.beginText(); canvas.setFontAndSize(font, 20); canvas.moveText(496, 150 + 50 * i); canvas.showText(String.valueOf((char) (181 + i))); canvas.endText(); canvas.stroke(); } doc.close(); srcDoc.close(); }
i7js-book
positive
1,488
private void convertTableNamesToRows(String[] types, List<Object[]> rows, String projectName, String schemaName, List<String> names) throws OdpsException { LinkedList<Table> tables = new LinkedList<>(); tables.addAll(conn.getOdps().tables().loadTables(projectName, schemaName, names)); for (Table t : tables) { String tableType = t.isVirtualView() ? TABLE_TYPE_VIEW : TABLE_TYPE_TABLE; if (types != null && types.length != 0) { if (!Arrays.asList(types).contains(tableType)) { continue; } } String schemaName = t.getProject(); if (conn.isOdpsNamespaceSchema()) { schemaName = t.getSchemaName(); } Object[] rowVals = { t.getProject(), schemaName, t.getName(), tableType, t.getComment(), null, null, null, null, null }; rows.add(rowVals); } tables.clear(); }
private void convertTableNamesToRows(String[] types, List<Object[]> rows, String projectName, String schemaName, List<String> names) throws OdpsException { LinkedList<Table> tables = new LinkedList<>(); tables.addAll(conn.getOdps().tables().loadTables(projectName, schemaName, names)); <DeepExtract> for (Table t : tables) { String tableType = t.isVirtualView() ? TABLE_TYPE_VIEW : TABLE_TYPE_TABLE; if (types != null && types.length != 0) { if (!Arrays.asList(types).contains(tableType)) { continue; } } String schemaName = t.getProject(); if (conn.isOdpsNamespaceSchema()) { schemaName = t.getSchemaName(); } Object[] rowVals = { t.getProject(), schemaName, t.getName(), tableType, t.getComment(), null, null, null, null, null }; rows.add(rowVals); } tables.clear(); </DeepExtract> }
aliyun-odps-jdbc
positive
1,490
public Criteria andBookNameBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "bookName" + " cannot be null"); } criteria.add(new Criterion("book_name between", value1, value2)); return (Criteria) this; }
public Criteria andBookNameBetween(String value1, String value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "bookName" + " cannot be null"); } criteria.add(new Criterion("book_name between", value1, value2)); </DeepExtract> return (Criteria) this; }
library_manager_system
positive
1,491
public void delete() throws IOException { if (journalWriter == null) { return; } for (Entry entry : new ArrayList<Entry>(lruEntries.values())) { if (entry.currentEditor != null) { entry.currentEditor.abort(); } } trimToSize(); journalWriter.close(); journalWriter = null; Util.deleteContents(directory); }
public void delete() throws IOException { <DeepExtract> if (journalWriter == null) { return; } for (Entry entry : new ArrayList<Entry>(lruEntries.values())) { if (entry.currentEditor != null) { entry.currentEditor.abort(); } } trimToSize(); journalWriter.close(); journalWriter = null; </DeepExtract> Util.deleteContents(directory); }
phonegap-custom-camera-plugin
positive
1,492
public long hashLongs(@NotNull long[] input, int off, int len) { if (len < 0 || off < 0 || off + len > input.length || off + len < 0) throw new IndexOutOfBoundsException(); return hash(longArrayAccessor().handle(input), longArrayAccessor().access(), longArrayAccessor().offset(input, off), longArrayAccessor().size(len)); }
public long hashLongs(@NotNull long[] input, int off, int len) { if (len < 0 || off < 0 || off + len > input.length || off + len < 0) throw new IndexOutOfBoundsException(); <DeepExtract> return hash(longArrayAccessor().handle(input), longArrayAccessor().access(), longArrayAccessor().offset(input, off), longArrayAccessor().size(len)); </DeepExtract> }
Chronicle-Algorithms
positive
1,493
@Override public Verification withArrayClaim(String name, Long... items) throws IllegalArgumentException { if (name == null) { throw new IllegalArgumentException("The Custom Claim's name can't be null."); } expectedChecks.add(constructExpectedCheck(name, (claim, decodedJWT) -> { if (claim.isMissing()) { throw new MissingClaimException(name); } return ((claim, decodedJWT) -> verifyNull(claim, items) || assertValidCollectionClaim(claim, items)).test(claim, decodedJWT); })); return this; }
@Override public Verification withArrayClaim(String name, Long... items) throws IllegalArgumentException { if (name == null) { throw new IllegalArgumentException("The Custom Claim's name can't be null."); } <DeepExtract> expectedChecks.add(constructExpectedCheck(name, (claim, decodedJWT) -> { if (claim.isMissing()) { throw new MissingClaimException(name); } return ((claim, decodedJWT) -> verifyNull(claim, items) || assertValidCollectionClaim(claim, items)).test(claim, decodedJWT); })); </DeepExtract> return this; }
java-jwt
positive
1,494
@Override public void execute() { addContentFragment(PollsListFragment.inGroupAnnouncements(_item.getId())); }
@Override public void execute() { <DeepExtract> addContentFragment(PollsListFragment.inGroupAnnouncements(_item.getId())); </DeepExtract> }
getsocial-android-sdk
positive
1,495
public void actionPerformed(ActionEvent ee) { task.theory = "md"; if (task.operation.equals("")) { task.operation = "energy"; } ; nwchem_Task t_temp; taskModel.setSize(tasks.size()); for (int i = 0; i < tasks.size(); i++) { t_temp = (nwchem_Task) tasks.elementAt(i); System.out.println("task " + (i + 1) + ": " + t_temp.theory + " " + t_temp.operation); taskModel.setElementAt("task " + (i + 1) + ": " + t_temp.theory + " " + t_temp.operation, i); } ; }
public void actionPerformed(ActionEvent ee) { task.theory = "md"; if (task.operation.equals("")) { task.operation = "energy"; } ; <DeepExtract> nwchem_Task t_temp; taskModel.setSize(tasks.size()); for (int i = 0; i < tasks.size(); i++) { t_temp = (nwchem_Task) tasks.elementAt(i); System.out.println("task " + (i + 1) + ": " + t_temp.theory + " " + t_temp.operation); taskModel.setElementAt("task " + (i + 1) + ": " + t_temp.theory + " " + t_temp.operation, i); } ; </DeepExtract> }
nwchem-git-svn-deprecated
positive
1,496
public static Ping onAddress(@NonNull InetAddress paramInetAddress) { Ping localPing = new Ping(); this.address = paramInetAddress; return localPing; }
public static Ping onAddress(@NonNull InetAddress paramInetAddress) { Ping localPing = new Ping(); <DeepExtract> this.address = paramInetAddress; </DeepExtract> return localPing; }
fakegumtree
positive
1,497
public void setRawData(byte[] ndata) { int length = Math.min(10, ndata.length); System.arraycopy(ndata, 0, this.data, 5, length); if ((byte) length > 10) (byte) length = 10; data[3] = (byte) length; }
public void setRawData(byte[] ndata) { int length = Math.min(10, ndata.length); System.arraycopy(ndata, 0, this.data, 5, length); <DeepExtract> if ((byte) length > 10) (byte) length = 10; data[3] = (byte) length; </DeepExtract> }
JArduino
positive
1,498
public static ChildProcess startSuCommand(String cmd) { String[] cmdarray = new String[3]; cmdarray[0] = "su"; cmdarray[1] = "-c"; cmdarray[2] = cmd; return new ChildProcess(cmdarray, null); }
public static ChildProcess startSuCommand(String cmd) { String[] cmdarray = new String[3]; cmdarray[0] = "su"; cmdarray[1] = "-c"; cmdarray[2] = cmd; <DeepExtract> return new ChildProcess(cmdarray, null); </DeepExtract> }
APKreator
positive
1,499