rem stringlengths 0 477k | add stringlengths 0 313k | context stringlengths 6 599k |
|---|---|---|
.will(returnValue("/testProvider/testFactory/with/slash/list")); | .will(returnValue("/testProvider/testFactory/with/slash/list?recurse")); | public void testJMSCommandAndItsRunnerAreGeneratedCorrectly() { Mock mockRequest = generateMockRequest(); mockRequest.expects(atLeastOnce()) .method("getPathInfo") .will(returnValue("/testProvider/testFactory/with/slash/list")); HttpServletRequest testRequest = (HttpServle... |
assertTrue(listingCommand.isRecursive()); | public void testJMSCommandAndItsRunnerAreGeneratedCorrectly() { Mock mockRequest = generateMockRequest(); mockRequest.expects(atLeastOnce()) .method("getPathInfo") .will(returnValue("/testProvider/testFactory/with/slash/list")); HttpServletRequest testRequest = (HttpServle... | |
assertTrue(generator.matches("/foo/bar/list")); | assertTrue(generator.matches("/foo/bar/list?recurse=anyOldText")); | public void testMatchWorksCorrectly() { assertFalse(generator.matches("/foo/")); assertFalse(generator.matches("/foo/bar/not-end-with-slash-list")); assertFalse(generator.matches("/foo/bar/looks/like/a/session/connection-134/list")); assertTrue(generator.matches("/foo/bar/list")); ... |
assertTrue(generator.matches("/foo/baz/multiple/slashes/list?recurse")); | public void testMatchWorksCorrectly() { assertFalse(generator.matches("/foo/")); assertFalse(generator.matches("/foo/bar/not-end-with-slash-list")); assertFalse(generator.matches("/foo/bar/looks/like/a/session/connection-134/list")); assertTrue(generator.matches("/foo/bar/list")); ... | |
protected boolean isRecursive() { | public boolean isRecursive() { | protected boolean isRecursive() { return recursive; } |
mPosition = mEnd = position; | public void setPosition(int position) { try { if (position < mDocument.getLength()) { mCurrentPartition = mDocument.getPartition(position); if (mCurrentPartition.getType() == SchemePartitionScanner.SCHEME_STRING) { mPosition = mCurrentPartition.getO... | |
String value = TypeUtil.toString(args[i]); ret.add(value); | ret.add(args[i]); | public Object sys_sort(VariableStack stack) throws ExecutionException { boolean descending = TypeUtil.toBoolean(OA_DESCENDING.getValue(stack)); Object[] args = Arg.VARGS.asArray(stack); ArrayList ret = new ArrayList(); if (args.length > 1) { for (int i = 0; i < args.length; i++) { String value = TypeUtil.toSt... |
Arrays.sort(array); | try { if (descending) { Arrays.sort(array, INVERSE_COMPARATOR); } else { Arrays.sort(array); } } catch (ClassCastException e) { throw new ExecutionException("Cannot sort items of different types"); } | public Object sys_sort(VariableStack stack) throws ExecutionException { boolean descending = TypeUtil.toBoolean(OA_DESCENDING.getValue(stack)); Object[] args = Arg.VARGS.asArray(stack); ArrayList ret = new ArrayList(); if (args.length > 1) { for (int i = 0; i < args.length; i++) { String value = TypeUtil.toSt... |
String value = TypeUtil.toString(i.next()); ret.add(value); | ret.add(i.next()); | public Object sys_sort(VariableStack stack) throws ExecutionException { boolean descending = TypeUtil.toBoolean(OA_DESCENDING.getValue(stack)); Object[] args = Arg.VARGS.asArray(stack); ArrayList ret = new ArrayList(); if (args.length > 1) { for (int i = 0; i < args.length; i++) { String value = TypeUtil.toSt... |
try { if (descending) { Arrays.sort(array, INVERSE_COMPARATOR); } else { Arrays.sort(array); } } catch (ClassCastException e) { throw new ExecutionException("Cannot sort items of different types"); } | public Object sys_sort(VariableStack stack) throws ExecutionException { boolean descending = TypeUtil.toBoolean(OA_DESCENDING.getValue(stack)); Object[] args = Arg.VARGS.asArray(stack); ArrayList ret = new ArrayList(); if (args.length > 1) { for (int i = 0; i < args.length; i++) { String value = TypeUtil.toSt... | |
if (!this.names.containsKey(nameClass)) this.names.put(nameClass,new TreeSet()); ((Set)this.names.get(nameClass)).add(n); | if (!this.namesMap.containsKey(nameClass)) this.namesMap.put(nameClass,new TreeSet()); ((Set)this.namesMap.get(nameClass)).add(n); this.names.add(n); | public void addName(String nameClass, String name) throws IllegalArgumentException,ChangeVetoException { if (name==null) throw new IllegalArgumentException("Name cannot be null"); if (nameClass==null) throw new IllegalArgumentException("Name class cannot be null"); SimpleNCBITaxonName n = new S... |
((Set)this.names.get(nameClass)).contains(n)?name:null | ((Set)this.namesMap.get(nameClass)).contains(n)?name:null | public void addName(String nameClass, String name) throws IllegalArgumentException,ChangeVetoException { if (name==null) throw new IllegalArgumentException("Name cannot be null"); if (nameClass==null) throw new IllegalArgumentException("Name class cannot be null"); SimpleNCBITaxonName n = new S... |
if (!this.names.containsKey(nameClass)) return false; | if (!this.namesMap.containsKey(nameClass)) return false; | public boolean containsName(String nameClass, String name) throws IllegalArgumentException { if (name==null) throw new IllegalArgumentException("Name cannot be null"); if (nameClass==null) throw new IllegalArgumentException("Name class cannot be null"); if (!this.names.containsKey(nameClass)) r... |
return ((Set)this.names.get(nameClass)).contains(n); | return ((Set)this.namesMap.get(nameClass)).contains(n); | public boolean containsName(String nameClass, String name) throws IllegalArgumentException { if (name==null) throw new IllegalArgumentException("Name cannot be null"); if (nameClass==null) throw new IllegalArgumentException("Name class cannot be null"); if (!this.names.containsKey(nameClass)) r... |
public Set getNameClasses() { return this.names.keySet(); } | public Set getNameClasses() { return this.namesMap.keySet(); } | public Set getNameClasses() { return this.names.keySet(); } |
private Set getNameSet() { Set n = new TreeSet(); for (Iterator i = this.names.values().iterator(); i.hasNext(); ) n.addAll((Set)i.next()); return n; } | private Set getNameSet() { return this.names; } | private Set getNameSet() { Set n = new TreeSet(); for (Iterator i = this.names.values().iterator(); i.hasNext(); ) n.addAll((Set)i.next()); return n; } |
for (Iterator j = ((Set)this.names.get(nameClass)).iterator(); j.hasNext(); ) { | for (Iterator j = ((Set)this.namesMap.get(nameClass)).iterator(); j.hasNext(); ) { | public Set getNames(String nameClass) throws IllegalArgumentException { if (nameClass==null) throw new IllegalArgumentException("Name class cannot be null"); Set n = new TreeSet(); for (Iterator j = ((Set)this.names.get(nameClass)).iterator(); j.hasNext(); ) { SimpleNCBITaxonName nam... |
if (!this.names.containsKey(nameClass)) return false; | if (!this.namesMap.containsKey(nameClass)) return false; | public boolean removeName(String nameClass, String name) throws IllegalArgumentException,ChangeVetoException { if (name==null) throw new IllegalArgumentException("Name cannot be null"); if (nameClass==null) throw new IllegalArgumentException("Name class cannot be null"); SimpleNCBITaxonName n =... |
results = ((Set)this.names.get(nameClass)).remove(n); | results = ((Set)this.namesMap.get(nameClass)).remove(n); this.names.remove(n); | public boolean removeName(String nameClass, String name) throws IllegalArgumentException,ChangeVetoException { if (name==null) throw new IllegalArgumentException("Name cannot be null"); if (nameClass==null) throw new IllegalArgumentException("Name class cannot be null"); SimpleNCBITaxonName n =... |
Set newn = new TreeSet(); if (names!=null) for (Iterator i = names.iterator(); i.hasNext(); ) { newn.add(i.next()); } this.names.clear(); for (Iterator i = newn.iterator(); i.hasNext(); ) { | this.names = names; this.namesMap.clear(); for (Iterator i = names.iterator(); i.hasNext(); ) { | private void setNameSet(Set names) { Set newn = new TreeSet(); if (names!=null) for (Iterator i = names.iterator(); i.hasNext(); ) { newn.add(i.next()); } this.names.clear(); for (Iterator i = newn.iterator(); i.hasNext(); ) { SimpleNCBITaxonName n = (SimpleN... |
public void cleanSearch() throws Exception | public void cleanSearch() | public void cleanSearch() throws Exception { PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.cleanSearchTopics")); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.executeUpdate(); p.close(); p = JForumExecutionContext.getConnection... |
PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.cleanSearchTopics")); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.executeUpdate(); p.close(); p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchMode... | PreparedStatement p=null; try { p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.cleanSearchTopics")); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.executeUpdate(); p.close(); p=null; p = JForumExecutionContext.getConnection().prepareStatement(SystemGlob... | public void cleanSearch() throws Exception { PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.cleanSearchTopics")); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.executeUpdate(); p.close(); p = JForumExecutionContext.getConnection... |
public List search(SearchData sd) throws Exception | public List search(SearchData sd) | public List search(SearchData sd) throws Exception { List l = new ArrayList(); // Check for the search cache if (!sd.getSearchStarted()) { if (sd.getTime() == null) { this.topicsByKeyword(sd); } else { this.topicsByTime(sd); } } String sql = SystemGlobals.getSql("SearchModel.searchBase").replaceAll... |
List l = new ArrayList(); | PreparedStatement p=null; try { if (!sd.getSearchStarted()) { if (sd.getTime() == null) { this.topicsByKeyword(sd); } else { this.topicsByTime(sd); } } | public List search(SearchData sd) throws Exception { List l = new ArrayList(); // Check for the search cache if (!sd.getSearchStarted()) { if (sd.getTime() == null) { this.topicsByKeyword(sd); } else { this.topicsByTime(sd); } } String sql = SystemGlobals.getSql("SearchModel.searchBase").replaceAll... |
if (!sd.getSearchStarted()) { if (sd.getTime() == null) { this.topicsByKeyword(sd); } else { this.topicsByTime(sd); } } | String sql = SystemGlobals.getSql("SearchModel.searchBase").replaceAll(":fids:",ForumRepository.getListAllowedForums()); StringBuffer criterias = new StringBuffer(512); | public List search(SearchData sd) throws Exception { List l = new ArrayList(); // Check for the search cache if (!sd.getSearchStarted()) { if (sd.getTime() == null) { this.topicsByKeyword(sd); } else { this.topicsByTime(sd); } } String sql = SystemGlobals.getSql("SearchModel.searchBase").replaceAll... |
String sql = SystemGlobals.getSql("SearchModel.searchBase").replaceAll(":fids:",ForumRepository.getListAllowedForums()); StringBuffer criterias = new StringBuffer(512); | if (sd.getForumId() != 0) { criterias.append(" AND t.forum_id = ").append( sd.getForumId()); } | public List search(SearchData sd) throws Exception { List l = new ArrayList(); // Check for the search cache if (!sd.getSearchStarted()) { if (sd.getTime() == null) { this.topicsByKeyword(sd); } else { this.topicsByTime(sd); } } String sql = SystemGlobals.getSql("SearchModel.searchBase").replaceAll... |
if (sd.getForumId() != 0) { criterias.append(" AND t.forum_id = " + sd.getForumId()); } if (sd.getCategoryId() != 0) { sql = sql.replaceAll(":table_category:", ", jforum_forums f"); | if (sd.getCategoryId() != 0) { sql = sql.replaceAll(":table_category:", ", jforum_forums f"); | public List search(SearchData sd) throws Exception { List l = new ArrayList(); // Check for the search cache if (!sd.getSearchStarted()) { if (sd.getTime() == null) { this.topicsByKeyword(sd); } else { this.topicsByTime(sd); } } String sql = SystemGlobals.getSql("SearchModel.searchBase").replaceAll... |
criterias.append(" AND f.categories_id = "+ sd.getCategoryId()); criterias.append(" AND t.forum_id = f.forum_id"); } else { sql = sql.replaceAll(":table_category:", ""); } if (sd.getOrderByField() == null || sd.getOrderByField().equals("")) { sd.setOrderByField("p.post_time"); } sql = sql.replaceAll(":orderByField:"... | criterias.append(" AND f.categories_id = ").append( sd.getCategoryId()); criterias.append(" AND t.forum_id = f.forum_id"); } else { sql = sql.replaceAll(":table_category:", ""); } | public List search(SearchData sd) throws Exception { List l = new ArrayList(); // Check for the search cache if (!sd.getSearchStarted()) { if (sd.getTime() == null) { this.topicsByKeyword(sd); } else { this.topicsByTime(sd); } } String sql = SystemGlobals.getSql("SearchModel.searchBase").replaceAll... |
return new GenericTopicDAO().fillTopicsData(p); } | if (sd.getOrderByField() == null || sd.getOrderByField().equals("")) { sd.setOrderByField("p.post_time"); } sql = sql.replaceAll(":orderByField:", sd.getOrderByField()); sql = sql.replaceAll(":orderBy:", sd.getOrderBy()); sql = sql.replaceAll(":criterias:", criterias.toString()); p = JForumExecutionContext.getConnec... | public List search(SearchData sd) throws Exception { List l = new ArrayList(); // Check for the search cache if (!sd.getSearchStarted()) { if (sd.getTime() == null) { this.topicsByKeyword(sd); } else { this.topicsByTime(sd); } } String sql = SystemGlobals.getSql("SearchModel.searchBase").replaceAll... |
private void selectTopicData() throws Exception | private void selectTopicData() throws SQLException | private void selectTopicData() throws Exception { PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.selectTopicData")); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.setString(2, SessionFacade.getUserSession().getSessionId()); p.execu... |
PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.selectTopicData")); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.setString(2, SessionFacade.getUserSession().getSessionId()); p.executeUpdate(); p.close(); } | PreparedStatement p=null; try { p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.selectTopicData")); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.setString(2, SessionFacade.getUserSession().getSessionId()); p.executeUpdate(); } finally { DbUtils.close(p);... | private void selectTopicData() throws Exception { PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.selectTopicData")); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.setString(2, SessionFacade.getUserSession().getSessionId()); p.execu... |
private void topicsByKeyword(SearchData sd) throws Exception { | private void topicsByKeyword(SearchData sd) throws SQLException { | private void topicsByKeyword(SearchData sd) throws Exception { boolean isLike = "like".equals(SystemGlobals.getValue(ConfigKeys.SEARCH_WORD_MATCHING).trim()); String sql = isLike ? SystemGlobals.getSql("SearchModel.searchByLikeWord") : SystemGlobals.getSql("SearchModel.searchByWord"); PreparedStatement p =... |
PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(sql); | PreparedStatement p=null; try { p = JForumExecutionContext.getConnection().prepareStatement(sql); | private void topicsByKeyword(SearchData sd) throws Exception { boolean isLike = "like".equals(SystemGlobals.getValue(ConfigKeys.SEARCH_WORD_MATCHING).trim()); String sql = isLike ? SystemGlobals.getSql("SearchModel.searchByLikeWord") : SystemGlobals.getSql("SearchModel.searchByWord"); PreparedStatement p =... |
Map eachWordMap = new HashMap(); int maxWordSize = SystemGlobals.getIntValue(ConfigKeys.SEARCH_MAX_WORD_SIZE); | Map eachWordMap = new HashMap(); | private void topicsByKeyword(SearchData sd) throws Exception { boolean isLike = "like".equals(SystemGlobals.getValue(ConfigKeys.SEARCH_WORD_MATCHING).trim()); String sql = isLike ? SystemGlobals.getSql("SearchModel.searchByLikeWord") : SystemGlobals.getSql("SearchModel.searchByWord"); PreparedStatement p =... |
for (int i = 0; i < sd.getKeywords().length; i++) { String word = sd.getKeywords()[i].toLowerCase(); if (word.length() > maxWordSize) { word = word.substring(0, maxWordSize); } if (isLike) { p.setString(1, "%" + word + "%"); } else { p.setString(1, word); } Set postsIds = new HashSet(); ResultSet rs = p.executeQuer... | int maxWordSize = SystemGlobals.getIntValue(ConfigKeys.SEARCH_MAX_WORD_SIZE); | private void topicsByKeyword(SearchData sd) throws Exception { boolean isLike = "like".equals(SystemGlobals.getValue(ConfigKeys.SEARCH_WORD_MATCHING).trim()); String sql = isLike ? SystemGlobals.getSql("SearchModel.searchByLikeWord") : SystemGlobals.getSql("SearchModel.searchByWord"); PreparedStatement p =... |
sql = SystemGlobals.getSql("SearchModel.insertTopicsIds"); sql = sql.replaceAll(":posts:", sb.toString()); sql = sql.replaceAll(":fids:",ForumRepository.getListAllowedForums()); p = JForumExecutionContext.getConnection().prepareStatement(sql); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.executeUp... | for (int i = 0; i < sd.getKeywords().length; i++) { String word = sd.getKeywords()[i].toLowerCase(); if (word.length() > maxWordSize) { word = word.substring(0, maxWordSize); } if (isLike) { p.setString(1, "%" + word + "%"); } else { p.setString(1, word); } Set postsIds = new HashSet(); ResultSet rs=null; try { rs ... | private void topicsByKeyword(SearchData sd) throws Exception { boolean isLike = "like".equals(SystemGlobals.getValue(ConfigKeys.SEARCH_WORD_MATCHING).trim()); String sql = isLike ? SystemGlobals.getSql("SearchModel.searchByLikeWord") : SystemGlobals.getSql("SearchModel.searchByWord"); PreparedStatement p =... |
private void topicsByTime(SearchData sd) throws Exception | private void topicsByTime(SearchData sd) throws SQLException | private void topicsByTime(SearchData sd) throws Exception { PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.searchByTime").replaceAll(":fids:",ForumRepository.getListAllowedForums())); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.se... |
PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.searchByTime").replaceAll(":fids:",ForumRepository.getListAllowedForums())); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.setTimestamp(2, new Timestamp(sd.getTime().getTime())); p.executeU... | PreparedStatement p=null; try { p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.searchByTime").replaceAll(":fids:", ForumRepository.getListAllowedForums())); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.setTimestamp(2, new Timestamp(sd.getTime().getTime(... | private void topicsByTime(SearchData sd) throws Exception { PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("SearchModel.searchByTime").replaceAll(":fids:",ForumRepository.getListAllowedForums())); p.setString(1, SessionFacade.getUserSession().getSessionId()); p.se... |
"Assertion Failure: Should have a legal symbol." | "Assertion Failure: Should have a legal symbol: " + s | private AtomicSymbol putSymbol(List s) { AtomicSymbol ss; if(parent != null) { try { ss = (AtomicSymbol) parent.getSymbol(s); } catch (IllegalSymbolException ise) { throw new BioError(ise, "Balls up - couldn't fetch symbol from parent"); } } else { try { ss = (AtomicS... |
boolean supportAutoGeneratedKeys, String autoKeysQuery) throws Exception | boolean supportAutoGeneratedKeys, String autoKeysQuery) | public static void executeAddRole(String sql, int id, Role role, RoleValueCollection roleValues, boolean supportAutoGeneratedKeys, String autoKeysQuery) throws Exception { PreparedStatement p; if (supportAutoGeneratedKeys) { p = JForumExecutionContext.getConnection().prepareStatement(sql, Statement.RETURN_GENE... |
PreparedStatement p; if (supportAutoGeneratedKeys) { p = JForumExecutionContext.getConnection().prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); } else { p = JForumExecutionContext.getConnection().prepareStatement(sql); } p.setInt(1, id); p.setString(2, role.getName()); p.setInt(3, role.getType()); p.executeU... | PreparedStatement p=null; ResultSet rs=null; try { if (supportAutoGeneratedKeys) { p = JForumExecutionContext.getConnection().prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); } else { p = JForumExecutionContext.getConnection().prepareStatement(sql); } p.setInt(1, id); p.setString(2, role.getName()); p.setInt(3,... | public static void executeAddRole(String sql, int id, Role role, RoleValueCollection roleValues, boolean supportAutoGeneratedKeys, String autoKeysQuery) throws Exception { PreparedStatement p; if (supportAutoGeneratedKeys) { p = JForumExecutionContext.getConnection().prepareStatement(sql, Statement.RETURN_GENE... |
public static RoleCollection processLoadRoles(String sql, int id) throws Exception | public static RoleCollection processLoadRoles(String sql, int id) | public static RoleCollection processLoadRoles(String sql, int id) throws Exception { RoleCollection rc = new RoleCollection(); PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(sql); p.setInt(1, id); Role r = null; int lastId = -1; ResultSet rs = p.executeQuery(); while (rs.nex... |
PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(sql); p.setInt(1, id); Role r = null; int lastId = -1; ResultSet rs = p.executeQuery(); while (rs.next()) { if (rs.getInt("role_id") != lastId) { if (r != null) { rc.add(r); } | PreparedStatement p=null; ResultSet rs=null; try { p = JForumExecutionContext.getConnection().prepareStatement(sql); p.setInt(1, id); | public static RoleCollection processLoadRoles(String sql, int id) throws Exception { RoleCollection rc = new RoleCollection(); PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(sql); p.setInt(1, id); Role r = null; int lastId = -1; ResultSet rs = p.executeQuery(); while (rs.nex... |
r = new Role(); | Role r = null; int lastId = -1; | public static RoleCollection processLoadRoles(String sql, int id) throws Exception { RoleCollection rc = new RoleCollection(); PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(sql); p.setInt(1, id); Role r = null; int lastId = -1; ResultSet rs = p.executeQuery(); while (rs.nex... |
r.setGroupId(id); r.setName(rs.getString("name")); r.setType(rs.getInt("role_type")); r.setId(rs.getInt("role_id")); lastId = r.getId(); } if (rs.getString("role_value") != null) { RoleValue rv = new RoleValue(); rv.setRoleId(r.getId()); rv.setType(rs.getInt("rv_type")); rv.setValue(rs.getString("role_value")); r.ge... | rs = p.executeQuery(); while (rs.next()) { if (rs.getInt("role_id") != lastId) { if (r != null) { rc.add(r); } r = new Role(); r.setGroupId(id); r.setName(rs.getString("name")); r.setType(rs.getInt("role_type")); r.setId(rs.getInt("role_id")); lastId = r.getId(); } String role = rs.getString("role_value"); if (!rs... | public static RoleCollection processLoadRoles(String sql, int id) throws Exception { RoleCollection rc = new RoleCollection(); PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(sql); p.setInt(1, id); Role r = null; int lastId = -1; ResultSet rs = p.executeQuery(); while (rs.nex... |
"OC" | EbiFormat.getInstance(), "OC", "OS", "OX" | public static void main(String [] args) { try { if(args.length != 1) { throw new Exception("Use: TestSwissProt swissprotFile"); } File swissProtFile = new File(args[0]); SequenceFormat sFormat = new EmblLikeFormat(); BufferedReader sReader = new BufferedReader( new InputStreamReader(new FileInputS... |
System.out.println("Species:"); System.out.println("\t" + seq.getAnnotation().getProperty(OrganismParser.PROPERTY_ORGANISM)); | System.out.println("Species:"); Taxa taxa = (Taxa) seq.getAnnotation().getProperty(OrganismParser.PROPERTY_ORGANISM); System.out.println("\t" + taxa); for(Iterator i = taxa.getAnnotation().asMap().entrySet().iterator(); i.hasNext(); ) { Map.Entry ent = (Map.Entry) i.next(); System.out.println("\t : " + ent.getKey() + "... | public static void main(String [] args) { try { if(args.length != 1) { throw new Exception("Use: TestSwissProt swissprotFile"); } File swissProtFile = new File(args[0]); SequenceFormat sFormat = new EmblLikeFormat(); BufferedReader sReader = new BufferedReader( new InputStreamReader(new FileInputS... |
handler.setQuerySeq(line.substring(2, line.indexOf(" "))); | String trimmed = line.trim(); int i = trimmed.indexOf(" "); if (i > 0) handler.setQuerySeq(trimmed.substring(1, i)); else handler.setQuerySeq(trimmed.substring(1)); | public void parseSearch(final BufferedReader reader, final SearchContentHandler handler) throws IOException, BioException, ParserException { lineNumber = 0; boolean parsedQueryId = false; this.handler = handler; LINE: while ((line = reader.readLine()) != null) { lin... |
Message testMessage = messageBuilder.throwsOnSome(PROPERTY_METHODS[i][0], "testMessage" + mocks, "testName", ORDERED_EXPECTED_DECODED_VALUES_OBJECTS[i][j], throwsOn); | Mock mockMessage = new Mock(MapMessage.class); String methodName = PROPERTY_METHODS[i][0]; List toThrowOn = new ArrayList(throwsOn); Object returnValue = ORDERED_EXPECTED_DECODED_VALUES_OBJECTS[i][j]; if ("getBooleanProperty".equals(methodName)) { toThrowOn.remove("getStringProperty"); mockMessage.stubs().method("getSt... | public void testCanBeEncodedReturnsTrueForCorrectValues() { OrderedPropertyValueCopier testCopier = new OrderedPropertyValueCopier(); ArrayList throwsOn = new ArrayList(); for (int i = 0, mocks = 0; i < PROPERTY_METHODS.length; i++) { for (int j = 0; j < ORDERED_EXPECTED_DECODED_VALU... |
Message testMessage = messageBuilder.throwsOnSome(PROPERTY_METHODS[i][0], "testMessage" + mocks, "testName", ORDERED_EXPECTED_DECODED_VALUES_OBJECTS[i][j], throwsOn); | Mock mockMessage = new Mock(MapMessage.class); String methodName = PROPERTY_METHODS[i][0]; List toThrowOn = new ArrayList(throwsOn); Object returnValue = ORDERED_EXPECTED_DECODED_VALUES_OBJECTS[i][j]; if ("getBooleanProperty".equals(methodName)) { toThrowOn.remove("getStringProperty"); mockMessage.stubs().method("getSt... | public void testGetAsEncodedValueReturnsValuesCorrectlyEncoded() { OrderedPropertyValueCopier testCopier = new OrderedPropertyValueCopier(); ArrayList throwsOn = new ArrayList(); for (int i = 0, mocks = 0; i < PROPERTY_METHODS.length; i++) { for (int j = 0; j < ORDERED_EXPECTED_DECOD... |
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "reviewer", "required", "Field is required."); | ValidationUtils.rejectIfEmptyOrWhitespace(errors, "reviewer", "required", "Reviewer is required."); Review review = (Review)target; if (review.getPerformanceRating() > 10 || review.getPerformanceRating() < 1) { errors.rejectValue("performanceRating", "numberRange", "Rating must be between 1 and 10."); } if (review.getR... | public void validate(Object target, Errors errors) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "reviewer", "required", "Field is required."); } |
File path = new File( basedir, destinationDirectory ); | File path; | public void putDirectory( File sourceDirectory, String destinationDirectory ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { String basedir = getRepository().getBasedir(); destinationDirectory = StringUtils.replace( destinationDirectory, "\\", "/" ); ... |
boolean result = path.mkdirs(); | if ( destinationDirectory.equals( "." ) ) { path = new File( basedir ); } else { path = new File( basedir, destinationDirectory ); } | public void putDirectory( File sourceDirectory, String destinationDirectory ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { String basedir = getRepository().getBasedir(); destinationDirectory = StringUtils.replace( destinationDirectory, "\\", "/" ); ... |
path.mkdirs(); | public void putDirectory( File sourceDirectory, String destinationDirectory ) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { String basedir = getRepository().getBasedir(); destinationDirectory = StringUtils.replace( destinationDirectory, "\\", "/" ); ... | |
setClass(context.getTypeFactory().createReferenceType(TypeFactory.RFT_OBJECT).getCClass()); | public CType checkType(CTypeContext context) throws UnpositionedError { if (!isChecked()) { if (arrayBound > 255) { // JVMS 4.10 // The number of dimensions in an array is limited to 255 by the // size of the dimensions opcode of the multianewarray instruction throw new Unpositio... | |
setClass(context.getTypeFactory().createReferenceType(TypeFactory.RFT_OBJECT).getCClass()); | public CType checkType(CTypeContext context) throws UnpositionedError { if (!isChecked()) { if (arrayBound > 255) { // JVMS 4.10 // The number of dimensions in an array is limited to 255 by the // size of the dimensions opcode of the multianewarray instruction throw new Unpositio... | |
public Mail findLastMailHeldFrom(String senderEmail) | public Mail findLastMailHeldFrom(String senderEmail, Long excludeMailId) | public Mail findLastMailHeldFrom(String senderEmail) { if (log.isDebugEnabled()) log.debug("Finding the last held mail from " + senderEmail); senderEmail = Validator.normalizeEmail(senderEmail); Query q = this.createNamedQuery("HeldMailFrom"); q.setParameter("sender", senderEmail); q.setMaxResults(1); re... |
q.setParameter("excluding", excludeMailId); | public Mail findLastMailHeldFrom(String senderEmail) { if (log.isDebugEnabled()) log.debug("Finding the last held mail from " + senderEmail); senderEmail = Validator.normalizeEmail(senderEmail); Query q = this.createNamedQuery("HeldMailFrom"); q.setParameter("sender", senderEmail); q.setMaxResults(1); re... | |
return cunit; | return cunit.getExport(); | public CCompilationUnit getCunit() { return cunit; } |
return cunit.lookupClass(caller, name); | return cunit.getExport().lookupClass(caller, name); | public CClass lookupClass(CClass caller, String name) throws UnpositionedError { return cunit.lookupClass(caller, name); } |
return "" + getInt(ExifConstants.IMAGE_HEIGHT); | String out = ""; if (getInt(ExifConstants.IMAGE_HEIGHT) > 0) { out += getInt(ExifConstants.IMAGE_HEIGHT); } return out ; | public String getImageHeight() { return "" + getInt(ExifConstants.IMAGE_HEIGHT); } |
return "" + getInt(ExifConstants.IMAGE_WIDTH); | String out = ""; if (getInt(ExifConstants.IMAGE_WIDTH) > 0) { out += getInt(ExifConstants.IMAGE_WIDTH); } return out ; | public String getImageWidth() { return "" + getInt(ExifConstants.IMAGE_WIDTH); } |
this.bindAddress = bindAddress; | public SMTPServer(String hostname, InetAddress bindAddress, int port, Map<MessageListener, MessageListener> listeners) throws UnknownHostException { this.hostName = hostname; this.port = port; this.listeners = listeners; this.commandHandler = new CommandHandler(); } | |
return "SubethaMail Server"; | return "SubEthaMail Server"; | public String getName() { return "SubethaMail Server"; } |
connectionHanderGroup = new ThreadGroup(SMTPServer.class.getName() + " ConnectionHandler Group"); | public void run() { try { if (this.bindAddress == null) serverSocket = new ServerSocket(this.port, 50); else serverSocket = new ServerSocket(this.port, 50, this.bindAddress); } catch (Exception e) { throw new RuntimeException(e); } go = true; while (go) { try { ConnectionHandler connectionH... | |
if (thread != null) | if (serverThread != null) | public void start() { if (thread != null) throw new IllegalStateException("SMTPServer already started"); thread = new Thread(this, SMTPServer.class.getName()); thread.start(); } |
thread = new Thread(this, SMTPServer.class.getName()); thread.start(); | serverThread = new Thread(this, SMTPServer.class.getName()); serverThread.start(); watchdogThread = new Watchdog(this); watchdogThread.start(); | public void start() { if (thread != null) throw new IllegalStateException("SMTPServer already started"); thread = new Thread(this, SMTPServer.class.getName()); thread.start(); } |
this.thread = null; | this.serverThread = null; this.watchdogThread = null; | public void stop() { go = false; this.thread = null; // force a socket close for good measure try { if (serverSocket != null && serverSocket.isBound() && !serverSocket.isClosed()) serverSocket.close(); } catch (IOException e) { } } |
super(ConnectionHandler.class.getName()); | super(server.getConnectionGroup(), ConnectionHandler.class.getName()); | public ConnectionHandler(SMTPServer server, Socket socket) throws IOException { super(ConnectionHandler.class.getName()); this.server = server; this.socket = socket; input = socket.getInputStream(); output = socket.getOutputStream(); reader = new BufferedReader(new InputStreamReader(input)); writer = new Pri... |
startTime = System.currentTimeMillis(); lastActiveTime = startTime; | public ConnectionHandler(SMTPServer server, Socket socket) throws IOException { super(ConnectionHandler.class.getName()); this.server = server; this.socket = socket; input = socket.getInputStream(); output = socket.getOutputStream(); reader = new BufferedReader(new InputStreamReader(input)); writer = new Pri... | |
me.getEmailArray(), | me.getEmailList(), | public Self getSelf() { log.debug("Getting self"); Person me = this.getMe(); return new Self( me.getId(), me.getName(), me.getEmailArray(), me.isSiteAdmin(), Transmute.subscriptions(me.getSubscriptions().values()) ); } |
return this.emailAddresses.remove(email); | EmailAddress addy = this.emailAddresses.get(email); this.emailAddresses.remove(email); return addy; | public EmailAddress removeEmailAddress(String email) { if (this.emailAddresses.size() <= 1) throw new IllegalStateException("Cannot remove last email address"); email = Validator.normalizeEmail(email); return this.emailAddresses.remove(email); } |
if (DEBUG_ENABLED) smap.put(obj.getObjectID(), System.currentTimeMillis()); | public synchronized boolean add(Cacheable obj) { cache.addLast(obj); return isCacheFull(); } | |
long start = System.currentTimeMillis(); Collection rv = new HashSet(); int count = 0; ArrayList accessCounts; Cacheable stop, c; synchronized (this) { if (capacity > 0) { if (!isCacheFull()) { return Collections.EMPTY_LIST; } if (maxCount <= 0 || maxCount > evictionSize) { maxCount = evictionSize; } } else if (maxCoun... | Collection candidates = getRemovalCandidatesInternal(maxCount); if (DEBUG_ENABLED) { reportTime("Cache", cache.subList(0, cache.size())); reportTime("Eviction candidates", candidates); | public Collection getRemovalCandidates(int maxCount) { long start = System.currentTimeMillis(); Collection rv = new HashSet(); int count = 0; ArrayList accessCounts; Cacheable stop, c; synchronized (this) { if (capacity > 0) { if (!isCacheFull()) { return Collections.EMPTY_LIST; } ... |
Map accessCountSummary = new TreeMap(); for (Iterator i = accessCounts.iterator(); i.hasNext();) { Integer ac = (Integer) i.next(); incrementAccessCountFor(accessCountSummary, ac); } accessCounts = null; int accessCountCutOff = 0; int remaining = count; for (Iterator i = accessCountSummary.entrySet().iterator(); i.... | return candidates; | public Collection getRemovalCandidates(int maxCount) { long start = System.currentTimeMillis(); Collection rv = new HashSet(); int count = 0; ArrayList accessCounts; Cacheable stop, c; synchronized (this) { if (capacity > 0) { if (!isCacheFull()) { return Collections.EMPTY_LIST; } ... |
if (DEBUG_ENABLED) smap.remove(obj.getObjectID()); | public synchronized void remove(Cacheable obj) { if (contains(obj)) { if (mark == obj) { mark = obj.getPrevious(); } cache.remove(obj); } } | |
if ( digester == null ) { return; } | public void transferCompleted( TransferEvent transferEvent ) { if ( digester == null ) { return; } Wagon wagon = transferEvent.getWagon(); actualChecksum = encode( digester.digest() ); digester = null; InputStream inputStream = null; transferingC... | |
digester = null; | public void transferCompleted( TransferEvent transferEvent ) { if ( digester == null ) { return; } Wagon wagon = transferEvent.getWagon(); actualChecksum = encode( digester.digest() ); digester = null; InputStream inputStream = null; transferingC... | |
transferingChecksum = true; | public void transferCompleted( TransferEvent transferEvent ) { if ( digester == null ) { return; } Wagon wagon = transferEvent.getWagon(); actualChecksum = encode( digester.digest() ); digester = null; InputStream inputStream = null; transferingC... | |
WagonUtils.fromString( checksumResource, wagon, actualChecksum ); | public void transferCompleted( TransferEvent transferEvent ) { if ( digester == null ) { return; } Wagon wagon = transferEvent.getWagon(); actualChecksum = encode( digester.digest() ); digester = null; InputStream inputStream = null; transferingC... | |
transferingChecksum = false; | public void transferCompleted( TransferEvent transferEvent ) { if ( digester == null ) { return; } Wagon wagon = transferEvent.getWagon(); actualChecksum = encode( digester.digest() ); digester = null; InputStream inputStream = null; transferingC... | |
if ( digester != null ) { digester.update( buffer, 0, length ); } | digester.update( buffer, 0, length ); | public void transferProgress( TransferEvent transferEvent, byte[] buffer, int length ) { if ( digester != null ) { digester.update( buffer, 0, length ); } } |
if ( transferingChecksum ) { return; } | public void transferStarted( TransferEvent transferEvent ) { if ( transferingChecksum ) { return; } expectedChecksum = null; actualChecksum = null; digester.reset(); } | |
public void delete(Config config) throws Exception | public void delete(Config config) | public void delete(Config config) throws Exception { // TODO Auto-generated method stub } |
public void insert(Config config) throws Exception { | public void insert(Config config) { | public void insert(Config config) throws Exception { // TODO Auto-generated method stub } |
public List selectAll() throws Exception | public List selectAll() | public List selectAll() throws Exception { // TODO Auto-generated method stub return null; } |
public Config selectByName(String name) throws Exception | public Config selectByName(String name) | public Config selectByName(String name) throws Exception { // TODO Auto-generated method stub return null; } |
public void update(Config config) throws Exception | public void update(Config config) | public void update(Config config) throws Exception { // TODO Auto-generated method stub } |
public void delete(Config config) throws Exception; | public void delete(Config config) ; | public void delete(Config config) throws Exception; |
public void insert(Config config) throws Exception; | public void insert(Config config); | public void insert(Config config) throws Exception; |
public Config selectByName(String name) throws Exception; | public Config selectByName(String name) ; | public Config selectByName(String name) throws Exception; |
public void update(Config config) throws Exception; | public void update(Config config); | public void update(Config config) throws Exception; |
public List getPosts(int start, int count, int minPostId, int maxPostId, Connection conn) throws Exception | public List getPosts(int start, int count, int minPostId, int maxPostId, Connection conn) | public List getPosts(int start, int count, int minPostId, int maxPostId, Connection conn) throws Exception { List l = new ArrayList(); PreparedStatement p = conn.prepareStatement(SystemGlobals.getSql("SearchModel.getPostsToIndex")); p.setInt(1, minPostId); p.setInt(2, maxPostId); p.setInt(3, start); p.setInt(4... |
PreparedStatement p = conn.prepareStatement(SystemGlobals.getSql("SearchModel.getPostsToIndex")); p.setInt(1, minPostId); p.setInt(2, maxPostId); p.setInt(3, start); p.setInt(4, count); ResultSet rs = p.executeQuery(); while (rs.next()) { l.add(this.makePost(rs)); } rs.close(); p.close(); return l; } | PreparedStatement p=null; ResultSet rs=null; try { p = conn.prepareStatement(SystemGlobals.getSql("SearchModel.getPostsToIndex")); p.setInt(1, minPostId); p.setInt(2, maxPostId); p.setInt(3, start); p.setInt(4, count); rs = p.executeQuery(); while (rs.next()) { l.add(this.makePost(rs)); } return l; } catch (SQLExcept... | public List getPosts(int start, int count, int minPostId, int maxPostId, Connection conn) throws Exception { List l = new ArrayList(); PreparedStatement p = conn.prepareStatement(SystemGlobals.getSql("SearchModel.getPostsToIndex")); p.setInt(1, minPostId); p.setInt(2, maxPostId); p.setInt(3, start); p.setInt(4... |
public int index(int step, Connection conn) throws Exception | public int index(int step, Connection conn) | public int index(int step, Connection conn) throws Exception { Timestamp timestamp = new Timestamp(System.currentTimeMillis()); // Get the last post id so far PreparedStatement p = conn.prepareStatement(SystemGlobals.getSql("SearchModel.maxPostIdUntilNow")); p.setTimestamp(1, timestamp); ResultSet rs = p.execut... |
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); PreparedStatement p = conn.prepareStatement(SystemGlobals.getSql("SearchModel.maxPostIdUntilNow")); p.setTimestamp(1, timestamp); | PreparedStatement p=null; ResultSet rs=null; | public int index(int step, Connection conn) throws Exception { Timestamp timestamp = new Timestamp(System.currentTimeMillis()); // Get the last post id so far PreparedStatement p = conn.prepareStatement(SystemGlobals.getSql("SearchModel.maxPostIdUntilNow")); p.setTimestamp(1, timestamp); ResultSet rs = p.execut... |
ResultSet rs = p.executeQuery(); int maxPostId = -1; if (rs.next()) { maxPostId = rs.getInt(1); } rs.close(); p.close(); int latestIndexedPostId = -1; p = conn.prepareStatement(SystemGlobals.getSql("SearchModel.lastIndexedPostId")); rs = p.executeQuery(); if (rs.next()) { latestIndexedPostId = rs.getInt(1); } rs... | try { Timestamp timestamp = new Timestamp(System.currentTimeMillis()); p = conn.prepareStatement(SystemGlobals.getSql("SearchModel.maxPostIdUntilNow")); p.setTimestamp(1, timestamp); rs = p.executeQuery(); int maxPostId = -1; if (rs.next()) { maxPostId = rs.getInt(1); } rs.close(); rs=null; p.close(); p=null; in... | public int index(int step, Connection conn) throws Exception { Timestamp timestamp = new Timestamp(System.currentTimeMillis()); // Get the last post id so far PreparedStatement p = conn.prepareStatement(SystemGlobals.getSql("SearchModel.maxPostIdUntilNow")); p.setTimestamp(1, timestamp); ResultSet rs = p.execut... |
protected Post makePost(ResultSet rs) throws Exception | protected Post makePost(ResultSet rs) throws SQLException | protected Post makePost(ResultSet rs) throws Exception { Post p = new Post(); p.setId(rs.getInt("post_id")); p.setText(this.getPostTextFromResultSet(rs)); p.setSubject("post_subject"); return p; } |
public int index(int step, Connection conn) throws Exception; | public int index(int step, Connection conn) ; | public int index(int step, Connection conn) throws Exception; |
public void insertSearchWords(List posts) throws Exception; | public void insertSearchWords(List posts); | public void insertSearchWords(List posts) throws Exception; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.