rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
| meta
stringlengths 141
403
|
---|---|---|---|
throw new TypeError(getRuntime(), | throw getRuntime().newTypeError( | public JavaObject set_value(IRubyObject object, IRubyObject value) { if (! (object instanceof JavaObject)) { throw new TypeError(getRuntime(), "not a java object: " + object); } if (! (value instanceof JavaObject)) { throw new TypeError(getRuntime(), "not a java object:" + value); } Object javaObject = ((JavaObject) object).getValue(); try { Object convertedValue = JavaUtil.convertArgument(((JavaObject) value).getValue(), field.getType()); field.set(javaObject, convertedValue); } catch (IllegalAccessException iae) { throw new TypeError(getRuntime(), "illegal access on setting variable: " + iae.getMessage()); } catch (IllegalArgumentException iae) { throw new TypeError(getRuntime(), "wrong type for " + field.getType().getName() + ": " + ((JavaObject) value).getValue().getClass().getName()); } return (JavaObject) value; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/JavaField.java/clean/src/org/jruby/javasupport/JavaField.java |
return RubyBoolean.newBoolean(getRuntime(), Modifier.isStatic(field.getModifiers())); | return getRuntime().newBoolean(Modifier.isStatic(field.getModifiers())); | public RubyBoolean static_p() { return RubyBoolean.newBoolean(getRuntime(), Modifier.isStatic(field.getModifiers())); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/JavaField.java/clean/src/org/jruby/javasupport/JavaField.java |
throw new TypeError(getRuntime(), "not a java object"); | throw getRuntime().newTypeError("not a java object"); | public JavaObject value(IRubyObject object) { if (! (object instanceof JavaObject)) { throw new TypeError(getRuntime(), "not a java object"); } Object javaObject = ((JavaObject) object).getValue(); try { return JavaObject.wrap(getRuntime(), field.get(javaObject)); } catch (IllegalAccessException iae) { throw new TypeError(getRuntime(), "illegal access"); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/JavaField.java/clean/src/org/jruby/javasupport/JavaField.java |
throw new TypeError(getRuntime(), "illegal access"); | throw getRuntime().newTypeError("illegal access"); | public JavaObject value(IRubyObject object) { if (! (object instanceof JavaObject)) { throw new TypeError(getRuntime(), "not a java object"); } Object javaObject = ((JavaObject) object).getValue(); try { return JavaObject.wrap(getRuntime(), field.get(javaObject)); } catch (IllegalAccessException iae) { throw new TypeError(getRuntime(), "illegal access"); } } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/JavaField.java/clean/src/org/jruby/javasupport/JavaField.java |
return RubyString.newString(getRuntime(), field.getType().getName()); | return getRuntime().newString(field.getType().getName()); | public RubyString value_type() { return RubyString.newString(getRuntime(), field.getType().getName()); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/JavaField.java/clean/src/org/jruby/javasupport/JavaField.java |
public void mouseDragged( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); setCursor( box ); | public void mouseDragged(MouseEvent evt) { Box box = panel.findBox(evt.getX(), evt.getY()); setCursor(box); | public void mouseDragged( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); setCursor( box ); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/LinkListener.java/clean/src/java/org/xhtmlrenderer/swing/LinkListener.java |
public void mouseEntered( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); setCursor( box ); | public void mouseEntered(MouseEvent evt) { Box box = panel.findBox(evt.getX(), evt.getY()); setCursor(box); | public void mouseEntered( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); setCursor( box ); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/LinkListener.java/clean/src/java/org/xhtmlrenderer/swing/LinkListener.java |
public void mouseExited( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); setCursor( box ); | public void mouseExited(MouseEvent evt) { Box box = panel.findBox(evt.getX(), evt.getY()); setCursor(box); | public void mouseExited( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); setCursor( box ); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/LinkListener.java/clean/src/java/org/xhtmlrenderer/swing/LinkListener.java |
public void mouseMoved( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); setCursor( box ); | public void mouseMoved(MouseEvent evt) { Box box = panel.findBox(evt.getX(), evt.getY()); setCursor(box); | public void mouseMoved( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); setCursor( box ); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/LinkListener.java/clean/src/java/org/xhtmlrenderer/swing/LinkListener.java |
public void mousePressed( MouseEvent evt ) { } | public void mousePressed(MouseEvent evt) { } | public void mousePressed( MouseEvent evt ) { } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/LinkListener.java/clean/src/java/org/xhtmlrenderer/swing/LinkListener.java |
public void mouseReleased( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); if ( box == null ) { | public void mouseReleased(MouseEvent evt) { Box box = panel.findBox(evt.getX(), evt.getY()); if (box == null) { | public void mouseReleased( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); if ( box == null ) { return; } Element elem = box.element; if ( elem == null ) { return; } if ( panel.getContext().getNamespaceHandler().getLinkUri( elem ) != null ) { linkClicked( box, evt ); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/LinkListener.java/clean/src/java/org/xhtmlrenderer/swing/LinkListener.java |
if ( elem == null ) { | if (elem == null) { | public void mouseReleased( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); if ( box == null ) { return; } Element elem = box.element; if ( elem == null ) { return; } if ( panel.getContext().getNamespaceHandler().getLinkUri( elem ) != null ) { linkClicked( box, evt ); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/LinkListener.java/clean/src/java/org/xhtmlrenderer/swing/LinkListener.java |
if ( panel.getContext().getNamespaceHandler().getLinkUri( elem ) != null ) { linkClicked( box, evt ); | String uri = findLink(elem); if (uri != null) { linkClicked(uri); | public void mouseReleased( MouseEvent evt ) { Box box = panel.findBox( evt.getX(), evt.getY() ); if ( box == null ) { return; } Element elem = box.element; if ( elem == null ) { return; } if ( panel.getContext().getNamespaceHandler().getLinkUri( elem ) != null ) { linkClicked( box, evt ); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/LinkListener.java/clean/src/java/org/xhtmlrenderer/swing/LinkListener.java |
private void setCursor( Box box ) { if ( prev == box || box == null || box.element == null ) { | private void setCursor(Box box) { if (prev == box || box == null || box.element == null) { | private void setCursor( Box box ) { if ( prev == box || box == null || box.element == null ) { return; } if ( panel.getContext().getNamespaceHandler().getLinkUri( box.element ) != null ) { if ( !panel.getCursor().equals( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ) ) { panel.setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ); } } else { if ( !panel.getCursor().equals( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ) ) { panel.setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ); } } prev = box; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/LinkListener.java/clean/src/java/org/xhtmlrenderer/swing/LinkListener.java |
if ( panel.getContext().getNamespaceHandler().getLinkUri( box.element ) != null ) { if ( !panel.getCursor().equals( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ) ) { panel.setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ); | if (findLink(box.element) != null) { if (!panel.getCursor().equals(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))) { panel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); | private void setCursor( Box box ) { if ( prev == box || box == null || box.element == null ) { return; } if ( panel.getContext().getNamespaceHandler().getLinkUri( box.element ) != null ) { if ( !panel.getCursor().equals( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ) ) { panel.setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ); } } else { if ( !panel.getCursor().equals( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ) ) { panel.setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ); } } prev = box; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/LinkListener.java/clean/src/java/org/xhtmlrenderer/swing/LinkListener.java |
if ( !panel.getCursor().equals( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ) ) { panel.setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ); | if (!panel.getCursor().equals(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR))) { panel.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); | private void setCursor( Box box ) { if ( prev == box || box == null || box.element == null ) { return; } if ( panel.getContext().getNamespaceHandler().getLinkUri( box.element ) != null ) { if ( !panel.getCursor().equals( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ) ) { panel.setCursor( Cursor.getPredefinedCursor( Cursor.HAND_CURSOR ) ); } } else { if ( !panel.getCursor().equals( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ) ) { panel.setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) ); } } prev = box; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0bcb35d367c0f0b2a89eb6aabedfe9807525ad3a/LinkListener.java/clean/src/java/org/xhtmlrenderer/swing/LinkListener.java |
pos.append(primVal.getCssText().trim() + suffix); | StringBuffer s = new StringBuffer(primVal.getCssText().trim()); if (s.charAt(0) == '"') s.deleteCharAt(0); if (s.charAt(s.length() - 1) == '"') s.deleteCharAt(s.length() - 1); pos.append(s + suffix); | protected Iterator doBuildDeclarations(CSSPrimitiveValue[] primVals, boolean important, CSSName cssName, int origin) { StringBuffer pos = new StringBuffer(); String suffix = " "; for (int i = 0; i < primVals.length; i++) { CSSPrimitiveValue primVal = primVals[i]; pos.append(primVal.getCssText().trim() + suffix); } pos.deleteCharAt(pos.length() - suffix.length());// remove ,spc FSCssValue fsCssValue = new FSCssValue(primVals[0], pos.toString().trim()); List declarations = new ArrayList(1); declarations.add(newPropertyDeclaration(cssName, fsCssValue, origin, important)); return declarations.iterator(); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0088314e16993b75305f7b1f8f7a8fc17cd713ca/ContentPropertyDeclarationFactory.java/clean/src/java/org/xhtmlrenderer/css/sheet/factory/ContentPropertyDeclarationFactory.java |
protected Iterator doBuildDeclarations(CSSPrimitiveValue[] primVals, boolean important, CSSName cssName, int origin) { StringBuffer pos = new StringBuffer(); String suffix = " "; for (int i = 0; i < primVals.length; i++) { CSSPrimitiveValue primVal = primVals[i]; pos.append(primVal.getCssText().trim() + suffix); } pos.deleteCharAt(pos.length() - suffix.length());// remove ,spc FSCssValue fsCssValue = new FSCssValue(primVals[0], pos.toString().trim()); List declarations = new ArrayList(1); declarations.add(newPropertyDeclaration(cssName, fsCssValue, origin, important)); return declarations.iterator(); } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/0088314e16993b75305f7b1f8f7a8fc17cd713ca/ContentPropertyDeclarationFactory.java/clean/src/java/org/xhtmlrenderer/css/sheet/factory/ContentPropertyDeclarationFactory.java |
||
private void createCollectorIfRequired(String subTask, double work) { boolean newCollector = false; | private boolean createCollectorIfRequired(String subTask, double work) { | private void createCollectorIfRequired(String subTask, double work) { boolean newCollector = false; synchronized (this) { if(collector == null) collector = new Collector(subTask, work, getWrappedProgressMonitor()); } if(newCollector) display.asyncExec(collector); } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/7b5621604ec00ac4408107c990a055979b19405b/AccumulatingProgressMonitor.java/clean/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/AccumulatingProgressMonitor.java |
if(collector == null) collector = new Collector(subTask, work, getWrappedProgressMonitor()); | if(collector != null) return false; collector = new Collector(subTask, work, getWrappedProgressMonitor()); | private void createCollectorIfRequired(String subTask, double work) { boolean newCollector = false; synchronized (this) { if(collector == null) collector = new Collector(subTask, work, getWrappedProgressMonitor()); } if(newCollector) display.asyncExec(collector); } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/7b5621604ec00ac4408107c990a055979b19405b/AccumulatingProgressMonitor.java/clean/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/AccumulatingProgressMonitor.java |
if(newCollector) display.asyncExec(collector); | display.asyncExec(collector); return true; | private void createCollectorIfRequired(String subTask, double work) { boolean newCollector = false; synchronized (this) { if(collector == null) collector = new Collector(subTask, work, getWrappedProgressMonitor()); } if(newCollector) display.asyncExec(collector); } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/7b5621604ec00ac4408107c990a055979b19405b/AccumulatingProgressMonitor.java/clean/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/AccumulatingProgressMonitor.java |
public synchronized void internalWorked(final double work) { createCollectorIfRequired(null, work); collector.worked(work); | public void internalWorked(final double work) { if( createCollectorIfRequired(null, work)) return; synchronized (this) { collector.worked(work); } | public synchronized void internalWorked(final double work) { createCollectorIfRequired(null, work); collector.worked(work); } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/7b5621604ec00ac4408107c990a055979b19405b/AccumulatingProgressMonitor.java/clean/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/AccumulatingProgressMonitor.java |
createCollectorIfRequired(name, 0); collector.subTask(name); | if(createCollectorIfRequired(name, 0)) return; synchronized (this) { collector.subTask(name); } | public void subTask(final String name) { createCollectorIfRequired(name, 0); collector.subTask(name); } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/7b5621604ec00ac4408107c990a055979b19405b/AccumulatingProgressMonitor.java/clean/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/AccumulatingProgressMonitor.java |
public synchronized void worked(int work) { | public void worked(int work) { | public synchronized void worked(int work) { internalWorked(work); } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/7b5621604ec00ac4408107c990a055979b19405b/AccumulatingProgressMonitor.java/clean/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/AccumulatingProgressMonitor.java |
outerBox.height = 0; for (Iterator i = outerBox.getChildIterator(); i.hasNext();) { Box child = (Box) i.next(); outerBox.height += child.height; outerBox.adjustWidthForChild(child.getWidth()); | if (outerBox.getChildCount() > 0) { Box table = (Box)outerBox.getChild(0); outerBox.height = table.height; outerBox.contentWidth = table.contentWidth; | private static void calculateOuterBoxDimensions(BlockBox outerBox) { outerBox.height = 0; for (Iterator i = outerBox.getChildIterator(); i.hasNext();) { Box child = (Box) i.next(); outerBox.height += child.height; outerBox.adjustWidthForChild(child.getWidth()); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3e9da5a6a193dd3ded6d850d4f9fbc8df5854462/TableBoxing.java/buggy/src/java/org/xhtmlrenderer/table/TableBoxing.java |
cell.expandToMaxChildWidth(); | private static CellBox layoutCell(LayoutContext c, CellBox cell, Content content, boolean fixed, TableBox table, int col) { //OK, first set up the current style. All depends on this... CascadedStyle pushed = content.getStyle(); if (pushed != null) { c.pushStyle(pushed); } if (c.getCurrentStyle().isIdent(CSSName.BACKGROUND_ATTACHMENT, IdentValue.FIXED)) { c.getRootLayer().setFixedBackground(true); } // a cell defines a new bfc cell.setStyle(new Style(c.getCurrentStyle(), (int) c.getExtents().width)); BlockFormattingContext bfc = new BlockFormattingContext(cell, c); c.pushBFC(bfc); // copy the extents Rectangle oe = c.getExtents(); c.setExtents(new Rectangle(oe)); cell.colspan = (int) c.getCurrentStyle().asFloat(CSSName.FS_COLSPAN); cell.rowspan = (int) c.getCurrentStyle().asFloat(CSSName.FS_ROWSPAN); if (fixed) { int width = 0; for (int i = 0; i < cell.colspan; i++) width += table.columns[col + i]; c.getExtents().width = width; } CalculatedStyle style = c.getCurrentStyle(); BorderPropertySet border = c.getCurrentStyle().getBorder(c); RectPropertySet padding = c.getCurrentStyle().getPaddingRect((float) oe.getWidth(), (float) oe.getWidth(), c); // calculate the width and height as much as possible int setHeight = -1;//means height is not set by css int setWidth = -1;//means width is not set by css if (!cell.getStyle().isAutoWidth()) { setWidth = (int) style.getFloatPropertyProportionalWidth(CSSName.WIDTH, c.getExtents().width, c); c.getExtents().width = setWidth; cell.contentWidth = (int) (setWidth - border.left() - padding.left() - padding.right() - border.right()); } if (!cell.getStyle().isAutoHeight()) { setHeight = (int) style.getFloatPropertyProportionalHeight(CSSName.HEIGHT, c.getExtents().height, c); c.getExtents().height = setHeight; cell.height = setHeight; } //check if replaced JComponent cc = c.getNamespaceHandler().getCustomComponent(content.getElement(), c.getUac(), setWidth, setHeight); if (cc != null) { Rectangle bounds = cc.getBounds(); //cell.x = bounds.x; //cell.y = bounds.y; cell.contentWidth = bounds.width; cell.height = bounds.height; cell.component = cc; } // save height incase fixed height int original_height = cell.height; // do children's layout cell.leftMBP = (int) border.left() + (int) padding.left(); cell.rightMBP = (int) padding.right() + (int) border.right(); int tx = (int) border.left() + (int) padding.left(); int ty = (int) border.top() + (int) padding.top(); cell.tx = tx; cell.ty = ty; c.translate(tx, ty); Rectangle extents = c.shrinkExtents(tx + (int) border.right() + (int) padding.right(), ty + (int) border.bottom() + (int) padding.bottom()); if (cell.component == null) Boxing.layoutChildren(c, cell, content); else { if (c.isInteractive()) { c.getCanvas().add(cell.component); } } c.setExtents(extents); c.translate(-tx, -ty); // restore height incase fixed height if (!cell.getStyle().isAutoHeight()) { // Uu.p("restoring original height"); cell.height = original_height; } else { int delta = c.getBlockFormattingContext().getFloatManager().getClearDelta( c, (int) border.top() + (int) padding.top() + cell.height); if (delta > 0) { cell.height += delta; } } cell.height = (int) border.top() + (int) padding.top() + cell.height + (int) padding.bottom() + (int) border.bottom(); //restore the extents c.setExtents(oe); // remove the bfc c.popBFC(); //and now, back to previous style if (pushed != null) { c.popStyle(); } // Uu.p("BoxLayout: finished with cell: " + cell); cell.setState(Box.DONE); return cell; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3e9da5a6a193dd3ded6d850d4f9fbc8df5854462/TableBoxing.java/buggy/src/java/org/xhtmlrenderer/table/TableBoxing.java |
|
tableBox.adjustWidthForChild(row.getWidth()); | private static void layoutChildren(LayoutContext c, TableBox tableBox, Content content, boolean fixed, int borderSpacingHorizontal, int borderSpacingVertical) { Iterator contentIterator = content.getChildContent(c).iterator(); while (contentIterator.hasNext() && !c.shouldStop()) { Object o = contentIterator.next(); if (o instanceof TableRowContent) { c.translate(0, tableBox.height); RowBox row = layoutRow(c, (TableRowContent) o, tableBox, fixed, borderSpacingHorizontal, borderSpacingVertical); c.translate(0, -tableBox.height); tableBox.addChild(c, row); row.setParent(tableBox); row.element = ((TableRowContent) o).getElement(); // set the child_box location row.x = 0; row.y = tableBox.height + borderSpacingVertical; // increase the final layout width if the child was greater tableBox.adjustWidthForChild(row.getWidth()); // increase the final layout height by the height of the child tableBox.height = row.y + row.height; } else { XRLog.layout(Level.WARNING, "Unsupported inside table: " + o.getClass().getName()); } } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/3e9da5a6a193dd3ded6d850d4f9fbc8df5854462/TableBoxing.java/buggy/src/java/org/xhtmlrenderer/table/TableBoxing.java |
|
addAlert(state, rb.getString("java.user") + " " + noEmailInIdAccount + " " + rb.getString("java.exists")); | existingUsers.add(noEmailInIdAccount); | private void checkAddParticipant(ParameterParser params, SessionState state) { // get the participants to be added int i; Vector pList = new Vector(); Site site = null; String siteId = (String) state.getAttribute(STATE_SITE_INSTANCE_ID); try { site = SiteService.getSite(siteId); } catch (IdUnusedException e) { addAlert(state, rb.getString("java.specif") + " " + siteId); } String invalidEmailInIdAccountString = ServerConfigurationService.getString("invalidEmailInIdAccountString", null); //accept noEmailInIdAccounts and/or emailInIdAccount account names String noEmailInIdAccounts = ""; String emailInIdAccounts = ""; //check that there is something with which to work noEmailInIdAccounts = StringUtil.trimToNull((params.getString("noEmailInIdAccount"))); emailInIdAccounts = StringUtil.trimToNull(params.getString("emailInIdAccount")); state.setAttribute("noEmailInIdAccountValue", noEmailInIdAccounts); state.setAttribute("emailInIdAccountValue", emailInIdAccounts); //if there is no uniquname or emailInIdAccount entered if (noEmailInIdAccounts == null && emailInIdAccounts == null) { addAlert(state, rb.getString("java.guest")); state.setAttribute(STATE_TEMPLATE_INDEX, "5"); return; } String at = "@"; if (noEmailInIdAccounts != null) { // adding noEmailInIdAccounts String[] noEmailInIdAccountArray = noEmailInIdAccounts.replaceAll(",","\r\n").split("\r\n"); for (i = 0; i < noEmailInIdAccountArray.length; i++) { String noEmailInIdAccount = StringUtil.trimToNull(noEmailInIdAccountArray[i]); //if there is some text, try to use it noEmailInIdAccount.replaceAll("[\t\r\n]",""); if(noEmailInIdAccount != null) { //automaticially add emailInIdAccount account Participant participant = new Participant(); try { User u = UserDirectoryService.getUserByEid(noEmailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + noEmailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = noEmailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { addAlert(state, noEmailInIdAccount + " "+rb.getString("java.username")+" "); } } } } // noEmailInIdAccounts if (emailInIdAccounts != null) { String[] emailInIdAccountArray = emailInIdAccounts.split("\r\n"); for (i = 0; i < emailInIdAccountArray.length; i++) { String emailInIdAccount = emailInIdAccountArray[i]; //if there is some text, try to use it emailInIdAccount.replaceAll("[ \t\r\n]",""); //remove the trailing dots and empty space while (emailInIdAccount.endsWith(".") || emailInIdAccount.endsWith(" ")) { emailInIdAccount = emailInIdAccount.substring(0, emailInIdAccount.length() -1); } if(emailInIdAccount != null && emailInIdAccount.length() > 0) { String[] parts = emailInIdAccount.split(at); if(emailInIdAccount.indexOf(at) == -1 ) { // must be a valid email address addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")); } else if((parts.length != 2) || (parts[0].length() == 0)) { // must have both id and address part addAlert(state, emailInIdAccount + " "+rb.getString("java.notemailid")); } else if (!Validator.checkEmailLocal(parts[0])) { addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress") + INVALID_EMAIL); } else if (invalidEmailInIdAccountString != null && emailInIdAccount.indexOf(invalidEmailInIdAccountString) != -1) { // wrong string inside emailInIdAccount id addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")+" "); } else { Participant participant = new Participant(); try { // if the emailInIdAccount user already exists User u = UserDirectoryService.getUserByEid(emailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + emailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = emailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { // if the emailInIdAccount user is not in the system yet participant.name = emailInIdAccount; participant.uniqname = emailInIdAccount; // TODO: what would the UDS case this name to? -ggolden pList.add(participant); } } } // if } // } // emailInIdAccounts boolean same_role = true; if (params.getString("same_role") == null) { addAlert(state, rb.getString("java.roletype")+" "); } else { same_role = params.getString("same_role").equals("true")?true:false; state.setAttribute("form_same_role", new Boolean(same_role)); } if (state.getAttribute(STATE_MESSAGE) != null) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); } else { if (same_role) { state.setAttribute(STATE_TEMPLATE_INDEX, "19"); } else { state.setAttribute(STATE_TEMPLATE_INDEX, "20"); } } // remove duplicate or existing user from participant list int pListOldSize = pList.size(); pList=removeDuplicateParticipants(pList, state); pList=removeExistingParticipants(pList, state); state.setAttribute(STATE_ADD_PARTICIPANTS, pList); // if the add participant list is empty after above removal, stay in the current page if (pListOldSize > 0 && pList.size() == 0) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); addAlert(state, rb.getString("java.guest")); } return; } // checkAddParticipant | 54846 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54846/ae9321aa9385c399662bf50168986adc2841be6d/SiteAction.java/buggy/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java |
addAlert(state, rb.getString("java.user") + " " + emailInIdAccount + " " + rb.getString("java.exists")); | existingUsers.add(emailInIdAccount); | private void checkAddParticipant(ParameterParser params, SessionState state) { // get the participants to be added int i; Vector pList = new Vector(); Site site = null; String siteId = (String) state.getAttribute(STATE_SITE_INSTANCE_ID); try { site = SiteService.getSite(siteId); } catch (IdUnusedException e) { addAlert(state, rb.getString("java.specif") + " " + siteId); } String invalidEmailInIdAccountString = ServerConfigurationService.getString("invalidEmailInIdAccountString", null); //accept noEmailInIdAccounts and/or emailInIdAccount account names String noEmailInIdAccounts = ""; String emailInIdAccounts = ""; //check that there is something with which to work noEmailInIdAccounts = StringUtil.trimToNull((params.getString("noEmailInIdAccount"))); emailInIdAccounts = StringUtil.trimToNull(params.getString("emailInIdAccount")); state.setAttribute("noEmailInIdAccountValue", noEmailInIdAccounts); state.setAttribute("emailInIdAccountValue", emailInIdAccounts); //if there is no uniquname or emailInIdAccount entered if (noEmailInIdAccounts == null && emailInIdAccounts == null) { addAlert(state, rb.getString("java.guest")); state.setAttribute(STATE_TEMPLATE_INDEX, "5"); return; } String at = "@"; if (noEmailInIdAccounts != null) { // adding noEmailInIdAccounts String[] noEmailInIdAccountArray = noEmailInIdAccounts.replaceAll(",","\r\n").split("\r\n"); for (i = 0; i < noEmailInIdAccountArray.length; i++) { String noEmailInIdAccount = StringUtil.trimToNull(noEmailInIdAccountArray[i]); //if there is some text, try to use it noEmailInIdAccount.replaceAll("[\t\r\n]",""); if(noEmailInIdAccount != null) { //automaticially add emailInIdAccount account Participant participant = new Participant(); try { User u = UserDirectoryService.getUserByEid(noEmailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + noEmailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = noEmailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { addAlert(state, noEmailInIdAccount + " "+rb.getString("java.username")+" "); } } } } // noEmailInIdAccounts if (emailInIdAccounts != null) { String[] emailInIdAccountArray = emailInIdAccounts.split("\r\n"); for (i = 0; i < emailInIdAccountArray.length; i++) { String emailInIdAccount = emailInIdAccountArray[i]; //if there is some text, try to use it emailInIdAccount.replaceAll("[ \t\r\n]",""); //remove the trailing dots and empty space while (emailInIdAccount.endsWith(".") || emailInIdAccount.endsWith(" ")) { emailInIdAccount = emailInIdAccount.substring(0, emailInIdAccount.length() -1); } if(emailInIdAccount != null && emailInIdAccount.length() > 0) { String[] parts = emailInIdAccount.split(at); if(emailInIdAccount.indexOf(at) == -1 ) { // must be a valid email address addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")); } else if((parts.length != 2) || (parts[0].length() == 0)) { // must have both id and address part addAlert(state, emailInIdAccount + " "+rb.getString("java.notemailid")); } else if (!Validator.checkEmailLocal(parts[0])) { addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress") + INVALID_EMAIL); } else if (invalidEmailInIdAccountString != null && emailInIdAccount.indexOf(invalidEmailInIdAccountString) != -1) { // wrong string inside emailInIdAccount id addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")+" "); } else { Participant participant = new Participant(); try { // if the emailInIdAccount user already exists User u = UserDirectoryService.getUserByEid(emailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + emailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = emailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { // if the emailInIdAccount user is not in the system yet participant.name = emailInIdAccount; participant.uniqname = emailInIdAccount; // TODO: what would the UDS case this name to? -ggolden pList.add(participant); } } } // if } // } // emailInIdAccounts boolean same_role = true; if (params.getString("same_role") == null) { addAlert(state, rb.getString("java.roletype")+" "); } else { same_role = params.getString("same_role").equals("true")?true:false; state.setAttribute("form_same_role", new Boolean(same_role)); } if (state.getAttribute(STATE_MESSAGE) != null) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); } else { if (same_role) { state.setAttribute(STATE_TEMPLATE_INDEX, "19"); } else { state.setAttribute(STATE_TEMPLATE_INDEX, "20"); } } // remove duplicate or existing user from participant list int pListOldSize = pList.size(); pList=removeDuplicateParticipants(pList, state); pList=removeExistingParticipants(pList, state); state.setAttribute(STATE_ADD_PARTICIPANTS, pList); // if the add participant list is empty after above removal, stay in the current page if (pListOldSize > 0 && pList.size() == 0) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); addAlert(state, rb.getString("java.guest")); } return; } // checkAddParticipant | 54846 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54846/ae9321aa9385c399662bf50168986adc2841be6d/SiteAction.java/buggy/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java |
int pListOldSize = pList.size(); | private void checkAddParticipant(ParameterParser params, SessionState state) { // get the participants to be added int i; Vector pList = new Vector(); Site site = null; String siteId = (String) state.getAttribute(STATE_SITE_INSTANCE_ID); try { site = SiteService.getSite(siteId); } catch (IdUnusedException e) { addAlert(state, rb.getString("java.specif") + " " + siteId); } String invalidEmailInIdAccountString = ServerConfigurationService.getString("invalidEmailInIdAccountString", null); //accept noEmailInIdAccounts and/or emailInIdAccount account names String noEmailInIdAccounts = ""; String emailInIdAccounts = ""; //check that there is something with which to work noEmailInIdAccounts = StringUtil.trimToNull((params.getString("noEmailInIdAccount"))); emailInIdAccounts = StringUtil.trimToNull(params.getString("emailInIdAccount")); state.setAttribute("noEmailInIdAccountValue", noEmailInIdAccounts); state.setAttribute("emailInIdAccountValue", emailInIdAccounts); //if there is no uniquname or emailInIdAccount entered if (noEmailInIdAccounts == null && emailInIdAccounts == null) { addAlert(state, rb.getString("java.guest")); state.setAttribute(STATE_TEMPLATE_INDEX, "5"); return; } String at = "@"; if (noEmailInIdAccounts != null) { // adding noEmailInIdAccounts String[] noEmailInIdAccountArray = noEmailInIdAccounts.replaceAll(",","\r\n").split("\r\n"); for (i = 0; i < noEmailInIdAccountArray.length; i++) { String noEmailInIdAccount = StringUtil.trimToNull(noEmailInIdAccountArray[i]); //if there is some text, try to use it noEmailInIdAccount.replaceAll("[\t\r\n]",""); if(noEmailInIdAccount != null) { //automaticially add emailInIdAccount account Participant participant = new Participant(); try { User u = UserDirectoryService.getUserByEid(noEmailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + noEmailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = noEmailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { addAlert(state, noEmailInIdAccount + " "+rb.getString("java.username")+" "); } } } } // noEmailInIdAccounts if (emailInIdAccounts != null) { String[] emailInIdAccountArray = emailInIdAccounts.split("\r\n"); for (i = 0; i < emailInIdAccountArray.length; i++) { String emailInIdAccount = emailInIdAccountArray[i]; //if there is some text, try to use it emailInIdAccount.replaceAll("[ \t\r\n]",""); //remove the trailing dots and empty space while (emailInIdAccount.endsWith(".") || emailInIdAccount.endsWith(" ")) { emailInIdAccount = emailInIdAccount.substring(0, emailInIdAccount.length() -1); } if(emailInIdAccount != null && emailInIdAccount.length() > 0) { String[] parts = emailInIdAccount.split(at); if(emailInIdAccount.indexOf(at) == -1 ) { // must be a valid email address addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")); } else if((parts.length != 2) || (parts[0].length() == 0)) { // must have both id and address part addAlert(state, emailInIdAccount + " "+rb.getString("java.notemailid")); } else if (!Validator.checkEmailLocal(parts[0])) { addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress") + INVALID_EMAIL); } else if (invalidEmailInIdAccountString != null && emailInIdAccount.indexOf(invalidEmailInIdAccountString) != -1) { // wrong string inside emailInIdAccount id addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")+" "); } else { Participant participant = new Participant(); try { // if the emailInIdAccount user already exists User u = UserDirectoryService.getUserByEid(emailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + emailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = emailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { // if the emailInIdAccount user is not in the system yet participant.name = emailInIdAccount; participant.uniqname = emailInIdAccount; // TODO: what would the UDS case this name to? -ggolden pList.add(participant); } } } // if } // } // emailInIdAccounts boolean same_role = true; if (params.getString("same_role") == null) { addAlert(state, rb.getString("java.roletype")+" "); } else { same_role = params.getString("same_role").equals("true")?true:false; state.setAttribute("form_same_role", new Boolean(same_role)); } if (state.getAttribute(STATE_MESSAGE) != null) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); } else { if (same_role) { state.setAttribute(STATE_TEMPLATE_INDEX, "19"); } else { state.setAttribute(STATE_TEMPLATE_INDEX, "20"); } } // remove duplicate or existing user from participant list int pListOldSize = pList.size(); pList=removeDuplicateParticipants(pList, state); pList=removeExistingParticipants(pList, state); state.setAttribute(STATE_ADD_PARTICIPANTS, pList); // if the add participant list is empty after above removal, stay in the current page if (pListOldSize > 0 && pList.size() == 0) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); addAlert(state, rb.getString("java.guest")); } return; } // checkAddParticipant | 54846 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54846/ae9321aa9385c399662bf50168986adc2841be6d/SiteAction.java/buggy/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java |
|
pList=removeExistingParticipants(pList, state); | private void checkAddParticipant(ParameterParser params, SessionState state) { // get the participants to be added int i; Vector pList = new Vector(); Site site = null; String siteId = (String) state.getAttribute(STATE_SITE_INSTANCE_ID); try { site = SiteService.getSite(siteId); } catch (IdUnusedException e) { addAlert(state, rb.getString("java.specif") + " " + siteId); } String invalidEmailInIdAccountString = ServerConfigurationService.getString("invalidEmailInIdAccountString", null); //accept noEmailInIdAccounts and/or emailInIdAccount account names String noEmailInIdAccounts = ""; String emailInIdAccounts = ""; //check that there is something with which to work noEmailInIdAccounts = StringUtil.trimToNull((params.getString("noEmailInIdAccount"))); emailInIdAccounts = StringUtil.trimToNull(params.getString("emailInIdAccount")); state.setAttribute("noEmailInIdAccountValue", noEmailInIdAccounts); state.setAttribute("emailInIdAccountValue", emailInIdAccounts); //if there is no uniquname or emailInIdAccount entered if (noEmailInIdAccounts == null && emailInIdAccounts == null) { addAlert(state, rb.getString("java.guest")); state.setAttribute(STATE_TEMPLATE_INDEX, "5"); return; } String at = "@"; if (noEmailInIdAccounts != null) { // adding noEmailInIdAccounts String[] noEmailInIdAccountArray = noEmailInIdAccounts.replaceAll(",","\r\n").split("\r\n"); for (i = 0; i < noEmailInIdAccountArray.length; i++) { String noEmailInIdAccount = StringUtil.trimToNull(noEmailInIdAccountArray[i]); //if there is some text, try to use it noEmailInIdAccount.replaceAll("[\t\r\n]",""); if(noEmailInIdAccount != null) { //automaticially add emailInIdAccount account Participant participant = new Participant(); try { User u = UserDirectoryService.getUserByEid(noEmailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + noEmailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = noEmailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { addAlert(state, noEmailInIdAccount + " "+rb.getString("java.username")+" "); } } } } // noEmailInIdAccounts if (emailInIdAccounts != null) { String[] emailInIdAccountArray = emailInIdAccounts.split("\r\n"); for (i = 0; i < emailInIdAccountArray.length; i++) { String emailInIdAccount = emailInIdAccountArray[i]; //if there is some text, try to use it emailInIdAccount.replaceAll("[ \t\r\n]",""); //remove the trailing dots and empty space while (emailInIdAccount.endsWith(".") || emailInIdAccount.endsWith(" ")) { emailInIdAccount = emailInIdAccount.substring(0, emailInIdAccount.length() -1); } if(emailInIdAccount != null && emailInIdAccount.length() > 0) { String[] parts = emailInIdAccount.split(at); if(emailInIdAccount.indexOf(at) == -1 ) { // must be a valid email address addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")); } else if((parts.length != 2) || (parts[0].length() == 0)) { // must have both id and address part addAlert(state, emailInIdAccount + " "+rb.getString("java.notemailid")); } else if (!Validator.checkEmailLocal(parts[0])) { addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress") + INVALID_EMAIL); } else if (invalidEmailInIdAccountString != null && emailInIdAccount.indexOf(invalidEmailInIdAccountString) != -1) { // wrong string inside emailInIdAccount id addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")+" "); } else { Participant participant = new Participant(); try { // if the emailInIdAccount user already exists User u = UserDirectoryService.getUserByEid(emailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + emailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = emailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { // if the emailInIdAccount user is not in the system yet participant.name = emailInIdAccount; participant.uniqname = emailInIdAccount; // TODO: what would the UDS case this name to? -ggolden pList.add(participant); } } } // if } // } // emailInIdAccounts boolean same_role = true; if (params.getString("same_role") == null) { addAlert(state, rb.getString("java.roletype")+" "); } else { same_role = params.getString("same_role").equals("true")?true:false; state.setAttribute("form_same_role", new Boolean(same_role)); } if (state.getAttribute(STATE_MESSAGE) != null) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); } else { if (same_role) { state.setAttribute(STATE_TEMPLATE_INDEX, "19"); } else { state.setAttribute(STATE_TEMPLATE_INDEX, "20"); } } // remove duplicate or existing user from participant list int pListOldSize = pList.size(); pList=removeDuplicateParticipants(pList, state); pList=removeExistingParticipants(pList, state); state.setAttribute(STATE_ADD_PARTICIPANTS, pList); // if the add participant list is empty after above removal, stay in the current page if (pListOldSize > 0 && pList.size() == 0) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); addAlert(state, rb.getString("java.guest")); } return; } // checkAddParticipant | 54846 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54846/ae9321aa9385c399662bf50168986adc2841be6d/SiteAction.java/buggy/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java |
|
if (pListOldSize > 0 && pList.size() == 0) | if (pList.size() == 0) | private void checkAddParticipant(ParameterParser params, SessionState state) { // get the participants to be added int i; Vector pList = new Vector(); Site site = null; String siteId = (String) state.getAttribute(STATE_SITE_INSTANCE_ID); try { site = SiteService.getSite(siteId); } catch (IdUnusedException e) { addAlert(state, rb.getString("java.specif") + " " + siteId); } String invalidEmailInIdAccountString = ServerConfigurationService.getString("invalidEmailInIdAccountString", null); //accept noEmailInIdAccounts and/or emailInIdAccount account names String noEmailInIdAccounts = ""; String emailInIdAccounts = ""; //check that there is something with which to work noEmailInIdAccounts = StringUtil.trimToNull((params.getString("noEmailInIdAccount"))); emailInIdAccounts = StringUtil.trimToNull(params.getString("emailInIdAccount")); state.setAttribute("noEmailInIdAccountValue", noEmailInIdAccounts); state.setAttribute("emailInIdAccountValue", emailInIdAccounts); //if there is no uniquname or emailInIdAccount entered if (noEmailInIdAccounts == null && emailInIdAccounts == null) { addAlert(state, rb.getString("java.guest")); state.setAttribute(STATE_TEMPLATE_INDEX, "5"); return; } String at = "@"; if (noEmailInIdAccounts != null) { // adding noEmailInIdAccounts String[] noEmailInIdAccountArray = noEmailInIdAccounts.replaceAll(",","\r\n").split("\r\n"); for (i = 0; i < noEmailInIdAccountArray.length; i++) { String noEmailInIdAccount = StringUtil.trimToNull(noEmailInIdAccountArray[i]); //if there is some text, try to use it noEmailInIdAccount.replaceAll("[\t\r\n]",""); if(noEmailInIdAccount != null) { //automaticially add emailInIdAccount account Participant participant = new Participant(); try { User u = UserDirectoryService.getUserByEid(noEmailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + noEmailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = noEmailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { addAlert(state, noEmailInIdAccount + " "+rb.getString("java.username")+" "); } } } } // noEmailInIdAccounts if (emailInIdAccounts != null) { String[] emailInIdAccountArray = emailInIdAccounts.split("\r\n"); for (i = 0; i < emailInIdAccountArray.length; i++) { String emailInIdAccount = emailInIdAccountArray[i]; //if there is some text, try to use it emailInIdAccount.replaceAll("[ \t\r\n]",""); //remove the trailing dots and empty space while (emailInIdAccount.endsWith(".") || emailInIdAccount.endsWith(" ")) { emailInIdAccount = emailInIdAccount.substring(0, emailInIdAccount.length() -1); } if(emailInIdAccount != null && emailInIdAccount.length() > 0) { String[] parts = emailInIdAccount.split(at); if(emailInIdAccount.indexOf(at) == -1 ) { // must be a valid email address addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")); } else if((parts.length != 2) || (parts[0].length() == 0)) { // must have both id and address part addAlert(state, emailInIdAccount + " "+rb.getString("java.notemailid")); } else if (!Validator.checkEmailLocal(parts[0])) { addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress") + INVALID_EMAIL); } else if (invalidEmailInIdAccountString != null && emailInIdAccount.indexOf(invalidEmailInIdAccountString) != -1) { // wrong string inside emailInIdAccount id addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")+" "); } else { Participant participant = new Participant(); try { // if the emailInIdAccount user already exists User u = UserDirectoryService.getUserByEid(emailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + emailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = emailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { // if the emailInIdAccount user is not in the system yet participant.name = emailInIdAccount; participant.uniqname = emailInIdAccount; // TODO: what would the UDS case this name to? -ggolden pList.add(participant); } } } // if } // } // emailInIdAccounts boolean same_role = true; if (params.getString("same_role") == null) { addAlert(state, rb.getString("java.roletype")+" "); } else { same_role = params.getString("same_role").equals("true")?true:false; state.setAttribute("form_same_role", new Boolean(same_role)); } if (state.getAttribute(STATE_MESSAGE) != null) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); } else { if (same_role) { state.setAttribute(STATE_TEMPLATE_INDEX, "19"); } else { state.setAttribute(STATE_TEMPLATE_INDEX, "20"); } } // remove duplicate or existing user from participant list int pListOldSize = pList.size(); pList=removeDuplicateParticipants(pList, state); pList=removeExistingParticipants(pList, state); state.setAttribute(STATE_ADD_PARTICIPANTS, pList); // if the add participant list is empty after above removal, stay in the current page if (pListOldSize > 0 && pList.size() == 0) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); addAlert(state, rb.getString("java.guest")); } return; } // checkAddParticipant | 54846 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54846/ae9321aa9385c399662bf50168986adc2841be6d/SiteAction.java/buggy/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java |
addAlert(state, rb.getString("java.guest")); | } if (!existingUsers.isEmpty()) { int count = 0; String accounts = ""; for (Iterator eIterator = existingUsers.iterator();eIterator.hasNext();) { if (count == 0) { accounts = (String) eIterator.next(); } else { accounts = accounts + ", " + (String) eIterator.next(); } count++; } addAlert(state, rb.getString("add.existingpart.1") + accounts + rb.getString("add.existingpart.2")); | private void checkAddParticipant(ParameterParser params, SessionState state) { // get the participants to be added int i; Vector pList = new Vector(); Site site = null; String siteId = (String) state.getAttribute(STATE_SITE_INSTANCE_ID); try { site = SiteService.getSite(siteId); } catch (IdUnusedException e) { addAlert(state, rb.getString("java.specif") + " " + siteId); } String invalidEmailInIdAccountString = ServerConfigurationService.getString("invalidEmailInIdAccountString", null); //accept noEmailInIdAccounts and/or emailInIdAccount account names String noEmailInIdAccounts = ""; String emailInIdAccounts = ""; //check that there is something with which to work noEmailInIdAccounts = StringUtil.trimToNull((params.getString("noEmailInIdAccount"))); emailInIdAccounts = StringUtil.trimToNull(params.getString("emailInIdAccount")); state.setAttribute("noEmailInIdAccountValue", noEmailInIdAccounts); state.setAttribute("emailInIdAccountValue", emailInIdAccounts); //if there is no uniquname or emailInIdAccount entered if (noEmailInIdAccounts == null && emailInIdAccounts == null) { addAlert(state, rb.getString("java.guest")); state.setAttribute(STATE_TEMPLATE_INDEX, "5"); return; } String at = "@"; if (noEmailInIdAccounts != null) { // adding noEmailInIdAccounts String[] noEmailInIdAccountArray = noEmailInIdAccounts.replaceAll(",","\r\n").split("\r\n"); for (i = 0; i < noEmailInIdAccountArray.length; i++) { String noEmailInIdAccount = StringUtil.trimToNull(noEmailInIdAccountArray[i]); //if there is some text, try to use it noEmailInIdAccount.replaceAll("[\t\r\n]",""); if(noEmailInIdAccount != null) { //automaticially add emailInIdAccount account Participant participant = new Participant(); try { User u = UserDirectoryService.getUserByEid(noEmailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + noEmailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = noEmailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { addAlert(state, noEmailInIdAccount + " "+rb.getString("java.username")+" "); } } } } // noEmailInIdAccounts if (emailInIdAccounts != null) { String[] emailInIdAccountArray = emailInIdAccounts.split("\r\n"); for (i = 0; i < emailInIdAccountArray.length; i++) { String emailInIdAccount = emailInIdAccountArray[i]; //if there is some text, try to use it emailInIdAccount.replaceAll("[ \t\r\n]",""); //remove the trailing dots and empty space while (emailInIdAccount.endsWith(".") || emailInIdAccount.endsWith(" ")) { emailInIdAccount = emailInIdAccount.substring(0, emailInIdAccount.length() -1); } if(emailInIdAccount != null && emailInIdAccount.length() > 0) { String[] parts = emailInIdAccount.split(at); if(emailInIdAccount.indexOf(at) == -1 ) { // must be a valid email address addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")); } else if((parts.length != 2) || (parts[0].length() == 0)) { // must have both id and address part addAlert(state, emailInIdAccount + " "+rb.getString("java.notemailid")); } else if (!Validator.checkEmailLocal(parts[0])) { addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress") + INVALID_EMAIL); } else if (invalidEmailInIdAccountString != null && emailInIdAccount.indexOf(invalidEmailInIdAccountString) != -1) { // wrong string inside emailInIdAccount id addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")+" "); } else { Participant participant = new Participant(); try { // if the emailInIdAccount user already exists User u = UserDirectoryService.getUserByEid(emailInIdAccount); if (site != null && site.getUserRole(u.getId()) != null) { // user already exists in the site, cannot be added again addAlert(state, rb.getString("java.user") + " " + emailInIdAccount + " " + rb.getString("java.exists")); } else { participant.name = u.getDisplayName(); participant.uniqname = emailInIdAccount; pList.add(participant); } } catch (UserNotDefinedException e) { // if the emailInIdAccount user is not in the system yet participant.name = emailInIdAccount; participant.uniqname = emailInIdAccount; // TODO: what would the UDS case this name to? -ggolden pList.add(participant); } } } // if } // } // emailInIdAccounts boolean same_role = true; if (params.getString("same_role") == null) { addAlert(state, rb.getString("java.roletype")+" "); } else { same_role = params.getString("same_role").equals("true")?true:false; state.setAttribute("form_same_role", new Boolean(same_role)); } if (state.getAttribute(STATE_MESSAGE) != null) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); } else { if (same_role) { state.setAttribute(STATE_TEMPLATE_INDEX, "19"); } else { state.setAttribute(STATE_TEMPLATE_INDEX, "20"); } } // remove duplicate or existing user from participant list int pListOldSize = pList.size(); pList=removeDuplicateParticipants(pList, state); pList=removeExistingParticipants(pList, state); state.setAttribute(STATE_ADD_PARTICIPANTS, pList); // if the add participant list is empty after above removal, stay in the current page if (pListOldSize > 0 && pList.size() == 0) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); addAlert(state, rb.getString("java.guest")); } return; } // checkAddParticipant | 54846 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54846/ae9321aa9385c399662bf50168986adc2841be6d/SiteAction.java/buggy/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java |
if (release.isNew() || release.isModified()) { session = openSession(); if (release.isNew()) { Release releaseModel = new Release(); releaseModel.setReleaseId(release.getReleaseId()); releaseModel.setCreateDate(release.getCreateDate()); releaseModel.setModifiedDate(release.getModifiedDate()); releaseModel.setBuildNumber(release.getBuildNumber()); releaseModel.setBuildDate(release.getBuildDate()); session.save(releaseModel); session.flush(); } else { Release releaseModel = (Release)session.get(Release.class, release.getPrimaryKey()); if (releaseModel != null) { releaseModel.setCreateDate(release.getCreateDate()); releaseModel.setModifiedDate(release.getModifiedDate()); releaseModel.setBuildNumber(release.getBuildNumber()); releaseModel.setBuildDate(release.getBuildDate()); session.flush(); } else { releaseModel = new Release(); releaseModel.setReleaseId(release.getReleaseId()); releaseModel.setCreateDate(release.getCreateDate()); releaseModel.setModifiedDate(release.getModifiedDate()); releaseModel.setBuildNumber(release.getBuildNumber()); releaseModel.setBuildDate(release.getBuildDate()); session.save(releaseModel); session.flush(); } } release.setNew(false); release.setModified(false); } | session = openSession(); session.saveOrUpdate(release); session.flush(); release.setNew(false); | public com.liferay.portal.model.Release update( com.liferay.portal.model.Release release) throws SystemException { Session session = null; try { if (release.isNew() || release.isModified()) { session = openSession(); if (release.isNew()) { Release releaseModel = new Release(); releaseModel.setReleaseId(release.getReleaseId()); releaseModel.setCreateDate(release.getCreateDate()); releaseModel.setModifiedDate(release.getModifiedDate()); releaseModel.setBuildNumber(release.getBuildNumber()); releaseModel.setBuildDate(release.getBuildDate()); session.save(releaseModel); session.flush(); } else { Release releaseModel = (Release)session.get(Release.class, release.getPrimaryKey()); if (releaseModel != null) { releaseModel.setCreateDate(release.getCreateDate()); releaseModel.setModifiedDate(release.getModifiedDate()); releaseModel.setBuildNumber(release.getBuildNumber()); releaseModel.setBuildDate(release.getBuildDate()); session.flush(); } else { releaseModel = new Release(); releaseModel.setReleaseId(release.getReleaseId()); releaseModel.setCreateDate(release.getCreateDate()); releaseModel.setModifiedDate(release.getModifiedDate()); releaseModel.setBuildNumber(release.getBuildNumber()); releaseModel.setBuildDate(release.getBuildDate()); session.save(releaseModel); session.flush(); } } release.setNew(false); release.setModified(false); } return release; } catch (HibernateException he) { throw new SystemException(he); } finally { closeSession(session); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ReleasePersistence.java/buggy/portal-ejb/src/com/liferay/portal/service/persistence/ReleasePersistence.java |
if (line.firstLinePseudo != null) { line.firstLinePseudo.paintBackground(c, line, inline, BorderPainter.TOP + BorderPainter.BOTTOM); } | public static void paintBackground(RenderingContext c, LineBox line, InlineBox inline) { if (inline.getInlineElement() != null) { inline.getInlineElement().paintBackground(c, line, inline, BorderPainter.TOP + BorderPainter.BOTTOM); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/84c49e5f6931ce245212756a3af63d4c69677805/InlineRendering.java/buggy/src/java/org/xhtmlrenderer/render/InlineRendering.java |
|
if (line.firstLinePseudo != null) { line.firstLinePseudo.paintTextDecoration(c, line, inline); line.firstLinePseudo.untranslateRelative(c, line.isFirstLine); } | static int paintInline(RenderingContext c, InlineBox ib, int lx, int ly, LineBox line, int padX) { if (ib.pushstyles > 0) padX = ib.getInlineElement().handleStart(c, line, ib, padX, ib.pushstyles); if (ib instanceof InlineBlockBox) { c.translate(line.x, line.y + (line.getBaseline() - VerticalAlign.getBaselineOffset(c, line, ib, c.getTextRenderer(), c.getGraphics(), c.getBlockFormattingContext()) - ib.height)); c.translate(ib.x, ib.y); BoxRendering.paint(c, ((InlineBlockBox) ib).sub_block); c.translate(-ib.x, -ib.y); c.translate(-line.x, -(line.y + (line.getBaseline() - VerticalAlign.getBaselineOffset(c, line, ib, c.getTextRenderer(), c.getGraphics(), c.getBlockFormattingContext()) - ib.height))); debugInlines(c, ib, lx, ly); } else { InlineTextBox inline = (InlineTextBox) ib; //Uu.p("inline = " + inline); //Uu.p("line.x = " + line.x + " lx = " + lx); //Uu.p("ib.x .y = " + ib.x + " " + ib.y); c.updateSelection(inline); // calculate the Xx and y relative to the baseline of the line (ly) and the // left edge of the line (lx) int iy = ly - VerticalAlign.getBaselineOffset(c, line, inline, c.getTextRenderer(), c.getGraphics(), c.getBlockFormattingContext()); int ix = lx + inline.x;//TODO: find the right way to work this out // account for padding // Uu.p("adjusted inline by: " + inline.totalLeftPadding()); // Uu.p("inline = " + inline); // Uu.p("padding = " + inline.padding); // JMM: new adjustments to move the text to account for horizontal insets //int padding_xoff = inline.totalLeftPadding(c.getCurrentStyle()); c.translate(padX, 0); LineMetrics lm = FontUtil.getLineMetrics(inline.getStyle().getFont(c), inline, c.getTextRenderer(), c.getGraphics()); paintBackground(c, line, inline); if (inline.getInlineElement() != null) inline.getInlineElement().translateRelative(c, line.isFirstLine); paintSelection(c, inline, lx, ly, lm); paintText(c, ix, iy, inline, lm); if (inline.getInlineElement() != null) inline.getInlineElement().untranslateRelative(c, line.isFirstLine); //TODO: handle Block element text decorations if (inline.getInlineElement() != null) { inline.getInlineElement().paintTextDecoration(c, line, inline); inline.getInlineElement().untranslateRelative(c, line.isFirstLine); } c.translate(-padX, 0); debugInlines(c, inline, lx, ly); } padX = ib.getWidth() - ib.rightPadding; if (ib.popstyles > 0) padX = ib.getInlineElement().handleEnd(c, line, ib, padX, ib.popstyles); return padX; } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/84c49e5f6931ce245212756a3af63d4c69677805/InlineRendering.java/buggy/src/java/org/xhtmlrenderer/render/InlineRendering.java |
|
poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + border.top); g.setColor(color.topColor); | poly.addPoint(bounds.x + bounds.width - border.right+1, bounds.y + border.top-1); poly.addPoint(bounds.x + border.left-1, bounds.y + border.top-1); | private static void paintSolid(final Graphics g, final Rectangle bounds, final Border border, final BorderColor color, final int side) { Polygon poly; // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == TOP) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + border.top); g.setColor(color.topColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == BOTTOM) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.bottomColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == RIGHT) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.rightColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == LEFT) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); g.setColor(color.leftColor); g.fillPolygon(poly); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/ea4b196646f28c797bd3b0d90c7fcf22c63219af/BorderPainter.java/buggy/src/java/org/xhtmlrenderer/render/BorderPainter.java |
poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); | poly.addPoint(bounds.x + bounds.width - border.right+1, bounds.y + bounds.height - border.bottom+1); poly.addPoint(bounds.x + border.left-1, bounds.y + bounds.height - border.bottom+1); | private static void paintSolid(final Graphics g, final Rectangle bounds, final Border border, final BorderColor color, final int side) { Polygon poly; // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == TOP) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + border.top); g.setColor(color.topColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == BOTTOM) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.bottomColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == RIGHT) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.rightColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == LEFT) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); g.setColor(color.leftColor); g.fillPolygon(poly); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/ea4b196646f28c797bd3b0d90c7fcf22c63219af/BorderPainter.java/buggy/src/java/org/xhtmlrenderer/render/BorderPainter.java |
g.setColor(color.bottomColor); | private static void paintSolid(final Graphics g, final Rectangle bounds, final Border border, final BorderColor color, final int side) { Polygon poly; // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == TOP) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + border.top); g.setColor(color.topColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == BOTTOM) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.bottomColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == RIGHT) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.rightColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == LEFT) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); g.setColor(color.leftColor); g.fillPolygon(poly); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/ea4b196646f28c797bd3b0d90c7fcf22c63219af/BorderPainter.java/buggy/src/java/org/xhtmlrenderer/render/BorderPainter.java |
|
poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); | poly.addPoint(bounds.x + bounds.width - border.right+1, bounds.y + border.top-1); poly.addPoint(bounds.x + bounds.width - border.right+1, bounds.y + bounds.height - border.bottom+1); | private static void paintSolid(final Graphics g, final Rectangle bounds, final Border border, final BorderColor color, final int side) { Polygon poly; // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == TOP) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + border.top); g.setColor(color.topColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == BOTTOM) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.bottomColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == RIGHT) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.rightColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == LEFT) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); g.setColor(color.leftColor); g.fillPolygon(poly); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/ea4b196646f28c797bd3b0d90c7fcf22c63219af/BorderPainter.java/buggy/src/java/org/xhtmlrenderer/render/BorderPainter.java |
g.setColor(color.rightColor); | private static void paintSolid(final Graphics g, final Rectangle bounds, final Border border, final BorderColor color, final int side) { Polygon poly; // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == TOP) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + border.top); g.setColor(color.topColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == BOTTOM) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.bottomColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == RIGHT) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.rightColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == LEFT) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); g.setColor(color.leftColor); g.fillPolygon(poly); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/ea4b196646f28c797bd3b0d90c7fcf22c63219af/BorderPainter.java/buggy/src/java/org/xhtmlrenderer/render/BorderPainter.java |
|
poly.addPoint(bounds.x + border.left, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); | poly.addPoint(bounds.x + border.left-1, bounds.y + border.top-1); poly.addPoint(bounds.x + border.left-1, bounds.y + bounds.height - border.bottom+1); | private static void paintSolid(final Graphics g, final Rectangle bounds, final Border border, final BorderColor color, final int side) { Polygon poly; // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == TOP) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + border.top); g.setColor(color.topColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == BOTTOM) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.bottomColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == RIGHT) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.rightColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == LEFT) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); g.setColor(color.leftColor); g.fillPolygon(poly); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/ea4b196646f28c797bd3b0d90c7fcf22c63219af/BorderPainter.java/buggy/src/java/org/xhtmlrenderer/render/BorderPainter.java |
g.setColor(color.leftColor); | private static void paintSolid(final Graphics g, final Rectangle bounds, final Border border, final BorderColor color, final int side) { Polygon poly; // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == TOP) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + border.top); g.setColor(color.topColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == BOTTOM) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.bottomColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == RIGHT) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.rightColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == LEFT) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); g.setColor(color.leftColor); g.fillPolygon(poly); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/ea4b196646f28c797bd3b0d90c7fcf22c63219af/BorderPainter.java/buggy/src/java/org/xhtmlrenderer/render/BorderPainter.java |
|
return; | private static void paintSolid(final Graphics g, final Rectangle bounds, final Border border, final BorderColor color, final int side) { Polygon poly; // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == TOP) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + border.top); g.setColor(color.topColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == BOTTOM) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.bottomColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == RIGHT) { poly = new Polygon(); poly.addPoint(bounds.x + bounds.width, bounds.y); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + border.top); poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x + bounds.width, bounds.y + bounds.height); g.setColor(color.rightColor); g.fillPolygon(poly); } // CLEAN: duplicate, except for color, with paintGoodBevel() for BOTTOM (PWW 25-01-05) if (side == LEFT) { poly = new Polygon(); poly.addPoint(bounds.x, bounds.y); poly.addPoint(bounds.x + border.left, bounds.y + border.top); poly.addPoint(bounds.x + border.left, bounds.y + bounds.height - border.bottom); poly.addPoint(bounds.x, bounds.y + bounds.height); g.setColor(color.leftColor); g.fillPolygon(poly); } } | 57883 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57883/ea4b196646f28c797bd3b0d90c7fcf22c63219af/BorderPainter.java/buggy/src/java/org/xhtmlrenderer/render/BorderPainter.java |
|
new NewWizardDropDownAction(workbench, newWizardAction); | new NewWizardDropDownAction(window, newWizardAction); | private void makeActions() { // The actions in jface do not have menu vs. enable, vs. disable vs. color // There are actions in here being passed the workbench - problem // Get services for notification. IPartService partService = getWindow().getPartService(); WWinKeyBindingService keyBindingService = getWindow().getKeyBindingService(); // Many actions need the workbench. IWorkbench workbench = getWindow().getWorkbench(); newWizardAction = new NewWizardAction(); // images for this action are set in its constructor keyBindingService.registerGlobalAction(newWizardAction); ISharedImages sharedImages = workbench.getSharedImages(); newWizardDropDownAction = new NewWizardDropDownAction(workbench, newWizardAction); newWizardDropDownAction.setImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD)); newWizardDropDownAction.setHoverImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD_HOVER)); newWizardDropDownAction.setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD_DISABLED)); importResourcesAction = new ImportResourcesAction(workbench); importResourcesAction.setImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_IMPORT_WIZ)); importResourcesAction.setHoverImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_IMPORT_WIZ_HOVER)); importResourcesAction.setDisabledImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_IMPORT_WIZ_DISABLED)); exportResourcesAction = new ExportResourcesAction(workbench, WorkbenchMessages.getString("ExportResourcesAction.fileMenuText")); //$NON-NLS-1$ exportResourcesAction.setImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_EXPORT_WIZ)); exportResourcesAction.setHoverImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_EXPORT_WIZ_HOVER)); exportResourcesAction.setDisabledImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_EXPORT_WIZ_DISABLED)); rebuildAllAction = new GlobalBuildAction(window, IncrementalProjectBuilder.FULL_BUILD); rebuildAllAction.setActionDefinitionId(rebuildAllActionDefId); keyBindingService.registerGlobalAction(rebuildAllAction); buildAllAction = new GlobalBuildAction( window, IncrementalProjectBuilder.INCREMENTAL_BUILD); buildAllAction.setImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC)); buildAllAction.setHoverImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC_HOVER)); buildAllAction.setDisabledImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC_DISABLED)); buildAllAction.setActionDefinitionId(buildAllActionDefId); keyBindingService.registerGlobalAction(buildAllAction); saveAction = new SaveAction(window); saveAction.setImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_SAVE_EDIT)); saveAction.setHoverImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_SAVE_EDIT_HOVER)); saveAction.setDisabledImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_SAVE_EDIT_DISABLED)); partService.addPartListener(saveAction); saveAction.setActionDefinitionId(saveActionDefId); keyBindingService.registerGlobalAction(saveAction); saveAsAction = new SaveAsAction(window); saveAsAction.setImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_SAVEAS_EDIT)); saveAsAction.setHoverImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_SAVEAS_EDIT_HOVER)); saveAsAction.setDisabledImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_SAVEAS_EDIT_DISABLED)); partService.addPartListener(saveAsAction); saveAllAction = new SaveAllAction(window); saveAllAction.setImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_SAVEALL_EDIT)); saveAllAction.setHoverImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_SAVEALL_EDIT_HOVER)); saveAllAction.setDisabledImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_SAVEALL_EDIT_DISABLED)); partService.addPartListener(saveAllAction); saveAllAction.setActionDefinitionId(saveAllActionDefId); keyBindingService.registerGlobalAction(saveAllAction); undoAction = createGlobalAction(IWorkbenchActionConstants.UNDO, "edit", true); //$NON-NLS-1$ undoAction.setImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO)); undoAction.setHoverImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_HOVER)); undoAction.setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED)); redoAction = createGlobalAction(IWorkbenchActionConstants.REDO, "edit", true); //$NON-NLS-1$ redoAction.setImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO)); redoAction.setHoverImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_HOVER)); redoAction.setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED)); cutAction = createGlobalAction(IWorkbenchActionConstants.CUT, "edit", false); //$NON-NLS-1$ cutAction.setImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT)); cutAction.setHoverImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_HOVER)); cutAction.setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED)); copyAction = createGlobalAction(IWorkbenchActionConstants.COPY, "edit", false); //$NON-NLS-1$ copyAction.setImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); copyAction.setHoverImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_HOVER)); copyAction.setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED)); pasteAction = createGlobalAction(IWorkbenchActionConstants.PASTE, "edit", false); //$NON-NLS-1$ pasteAction.setImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE)); pasteAction.setHoverImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_HOVER)); pasteAction.setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED)); printAction = createGlobalAction(IWorkbenchActionConstants.PRINT, "file", false); //$NON-NLS-1$ printAction.setImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_PRINT_EDIT)); printAction.setHoverImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_PRINT_EDIT_HOVER)); printAction.setDisabledImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_PRINT_EDIT_DISABLED)); selectAllAction = createGlobalAction(IWorkbenchActionConstants.SELECT_ALL, "edit", false); //$NON-NLS-1$ findAction = createGlobalAction(IWorkbenchActionConstants.FIND, "findReplace", "edit", "findReplace", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // Find's images are commented out due to a conflict with Search. // See bug 16412. // findAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SEARCH_SRC)); // findAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SEARCH_SRC_HOVER)); // findAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SEARCH_SRC_DISABLED)); closeAction = new CloseEditorAction(window); partService.addPartListener(closeAction); closeAction.setActionDefinitionId(closeActionDefId); keyBindingService.registerGlobalAction(closeAction); closeAllAction = new CloseAllAction(window); partService.addPartListener(closeAllAction); closeAllAction.setActionDefinitionId(closeAllActionDefId); keyBindingService.registerGlobalAction(closeAllAction); closeAllSavedAction = new CloseAllSavedAction(window); partService.addPartListener(closeAllSavedAction); closeAllSavedAction.setActionDefinitionId(closeAllSavedActionDefId); keyBindingService.registerGlobalAction(closeAllSavedAction); pinEditorAction = new PinEditorAction(window); partService.addPartListener(pinEditorAction); pinEditorAction.setImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_PIN_EDITOR)); pinEditorAction.setHoverImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_PIN_EDITOR_HOVER)); pinEditorAction.setDisabledImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_PIN_EDITOR_DISABLED)); aboutAction = new AboutAction(window); aboutAction.setImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_OBJS_DEFAULT_PROD)); openPreferencesAction = new OpenPreferencesAction(window); addBookmarkAction = createGlobalAction(IWorkbenchActionConstants.BOOKMARK, "addBookMark", "edit", "addBookmark", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ addTaskAction = createGlobalAction(IWorkbenchActionConstants.ADD_TASK, "edit", false); //$NON-NLS-1$ // can't use createGlobalAction convenience since deleteAction is not registered with the key binding service deleteAction = new RetargetAction(IWorkbenchActionConstants.DELETE, WorkbenchMessages.getString("Workbench.delete")); //$NON-NLS-1$ deleteAction.setToolTipText(WorkbenchMessages.getString("Workbench.deleteToolTip")); //$NON-NLS-1$ deleteAction.setImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); deleteAction.setHoverImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_HOVER)); deleteAction.setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED)); deleteAction.enableAccelerator(false); WorkbenchHelp.setHelp( deleteAction, IHelpContextIds.DELETE_RETARGET_ACTION); partService.addPartListener(deleteAction); deleteAction.setActionDefinitionId(deleteActionDefId); // don't register the delete action with the key binding service. // doing so would break cell editors that listen for keyPressed SWT // events. //keyBindingService.registerGlobalAction(deleteAction); AboutInfo[] infos = ((Workbench) workbench).getConfigurationInfo().getFeaturesInfo(); // See if a welcome page is specified for (int i = 0; i < infos.length; i++) { if (infos[i].getWelcomePageURL() != null) { quickStartAction = new QuickStartAction(workbench); break; } } // See if a tips and tricks page is specified for (int i = 0; i < infos.length; i++) { if (infos[i].getTipsAndTricksHref() != null) { tipsAndTricksAction = new TipsAndTricksAction(workbench); break; } } // Actions for invisible accelerators showViewMenuAction = new ShowViewMenuAction(window); showViewMenuAction.setActionDefinitionId(showViewMenuActionDefId); keyBindingService.registerGlobalAction(showViewMenuAction); showPartPaneMenuAction = new ShowPartPaneMenuAction(window); showPartPaneMenuAction.setActionDefinitionId( showPartPaneMenuActionDefId); keyBindingService.registerGlobalAction(showPartPaneMenuAction); nextEditorAction = new CycleEditorAction(window, true); nextEditorAction.setActionDefinitionId(nextEditorActionDefId); keyBindingService.registerGlobalAction(nextEditorAction); nextEditorAction.commandForward = nextEditorActionDefId; nextEditorAction.commandBackward = prevEditorActionDefId; prevEditorAction = new CycleEditorAction(window, false); prevEditorAction.setActionDefinitionId(prevEditorActionDefId); keyBindingService.registerGlobalAction(prevEditorAction); prevEditorAction.commandForward = nextEditorActionDefId; prevEditorAction.commandBackward = prevEditorActionDefId; nextPartAction = new CyclePartAction(window, true); nextPartAction.setActionDefinitionId(nextPartActionDefId); keyBindingService.registerGlobalAction(nextPartAction); nextPartAction.commandForward = nextPartActionDefId; nextPartAction.commandBackward = prevPartActionDefId; prevPartAction = new CyclePartAction(window, false); prevPartAction.setActionDefinitionId(prevPartActionDefId); keyBindingService.registerGlobalAction(prevPartAction); prevPartAction.commandForward = nextPartActionDefId; prevPartAction.commandBackward = prevPartActionDefId; nextPerspectiveAction = new CyclePerspectiveAction(window, true); nextPerspectiveAction.setActionDefinitionId(nextPerspectiveActionDefId); keyBindingService.registerGlobalAction(nextPerspectiveAction); nextPerspectiveAction.commandForward = nextPerspectiveActionDefId; nextPerspectiveAction.commandBackward = prevPerspectiveActionDefId; prevPerspectiveAction = new CyclePerspectiveAction(window, false); prevPerspectiveAction.setActionDefinitionId(prevPerspectiveActionDefId); keyBindingService.registerGlobalAction(prevPerspectiveAction); prevPerspectiveAction.commandForward = nextPerspectiveActionDefId; prevPerspectiveAction.commandBackward = prevPerspectiveActionDefId; activateEditorAction = new ActivateEditorAction(window); activateEditorAction.setActionDefinitionId(activateEditorActionDefId); keyBindingService.registerGlobalAction(activateEditorAction); workbenchEditorsAction = new WorkbenchEditorsAction(window); workbenchEditorsAction.setActionDefinitionId( workbenchEditorsActionDefId); keyBindingService.registerGlobalAction(workbenchEditorsAction); hideShowEditorAction = new ToggleEditorsVisibilityAction(window); savePerspectiveAction = new SavePerspectiveAction(window); editActionSetAction = new EditActionSetsAction(window); lockToolBarAction = new LockToolBarAction(window); resetPerspectiveAction = new ResetPerspectiveAction(window); closePerspAction = new ClosePerspectiveAction(window); closeAllPerspsAction = new CloseAllPerspectivesAction(window); backwardHistoryAction = new NavigationHistoryAction(window, false); backwardHistoryAction.setImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_BACK)); backwardHistoryAction.setHoverImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_BACK_HOVER)); backwardHistoryAction.setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED)); backwardHistoryAction.setActionDefinitionId(backwardHistoryActionDefId); keyBindingService.registerGlobalAction(backwardHistoryAction); forwardHistoryAction = new NavigationHistoryAction(window, true); forwardHistoryAction.setImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD)); forwardHistoryAction.setHoverImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_HOVER)); forwardHistoryAction.setDisabledImageDescriptor( sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED)); forwardHistoryAction.setActionDefinitionId(forwardHistoryActionDefId); keyBindingService.registerGlobalAction(forwardHistoryAction); revertAction = createGlobalAction(IWorkbenchActionConstants.REVERT, "file", false); //$NON-NLS-1$ refreshAction = createGlobalAction(IWorkbenchActionConstants.REFRESH, "file", false); //$NON-NLS-1$ propertiesAction = createGlobalAction(IWorkbenchActionConstants.PROPERTIES, "file", false); //$NON-NLS-1$ moveAction = createGlobalAction(IWorkbenchActionConstants.MOVE, "edit", false); //$NON-NLS-1$ renameAction = createGlobalAction(IWorkbenchActionConstants.RENAME, "edit", false); //$NON-NLS-1$ goIntoAction = createGlobalAction(IWorkbenchActionConstants.GO_INTO, "navigate", false); //$NON-NLS-1$ backAction = createGlobalAction(IWorkbenchActionConstants.BACK, "navigate", true); //$NON-NLS-1$ forwardAction = createGlobalAction(IWorkbenchActionConstants.FORWARD, "navigate", true); //$NON-NLS-1$ upAction = createGlobalAction(IWorkbenchActionConstants.UP, "navigate", true); //$NON-NLS-1$ nextAction = createGlobalAction(IWorkbenchActionConstants.NEXT, "navigate", true); //$NON-NLS-1$ nextAction.setImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_NEXT_NAV)); previousAction = createGlobalAction(IWorkbenchActionConstants.PREVIOUS, "navigate", true); //$NON-NLS-1$ previousAction.setImageDescriptor( WorkbenchImages.getImageDescriptor( IWorkbenchGraphicConstants.IMG_CTOOL_PREVIOUS_NAV)); buildProjectAction = createGlobalAction(IWorkbenchActionConstants.BUILD_PROJECT, "project", false); //$NON-NLS-1$ rebuildProjectAction = createGlobalAction(IWorkbenchActionConstants.REBUILD_PROJECT, "project", false); //$NON-NLS-1$ openProjectAction = createGlobalAction(IWorkbenchActionConstants.OPEN_PROJECT, "project", false); //$NON-NLS-1$ closeProjectAction = createGlobalAction(IWorkbenchActionConstants.CLOSE_PROJECT, "project", false); //$NON-NLS-1$ } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/89367d793e5e563c84ffe78274bc12ad95dd473c/WorkbenchActionBuilder.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchActionBuilder.java |
this.listeners = new CopyOnWriteArrayList(); | this.listenersInDispatchThread = new CopyOnWriteArrayList<ListenerInterface>(); this.listenersNotInDispatchThread = new CopyOnWriteArrayList<ListenerInterface>(); | private ListenerSupportInvocationHandler(Class listenerInterface) { this.listenerInterface = listenerInterface; this.listeners = new CopyOnWriteArrayList(); } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
public void addListener(Object listener) { | public void addListener(ListenerInterface listener) { | public void addListener(Object listener) { if (checkListener(listener)) { // Okay, add listener listeners.add(listener); } } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
listeners.add(listener); | if (listener.fireInEventDispathThread()) { listenersInDispatchThread.add(listener); } else { listenersNotInDispatchThread.add(listener); } | public void addListener(Object listener) { if (checkListener(listener)) { // Okay, add listener listeners.add(listener); } } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
if (listeners.isEmpty()) { | if (listenersInDispatchThread.isEmpty() && listenersNotInDispatchThread.isEmpty()) { | public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { if (listeners.isEmpty()) { // No listeners, skip return null; } // LOG.warn("Deligating to " + listeners.size() // + " listeners. Method: " + method); // Create runner if (!suspended) { Runnable runner = new Runnable() { public void run() { for (Object listener: listeners) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e.getCause()); // Also log original exception LOG.verbose(e); } } } }; // FIXME in server mode we don't need this in // EventQueue.isDispatchThread()! // Addition: In servermode you should not use the event // listening stuff. Or refactor? if (!awtAvailable || EventQueue.isDispatchThread()) { // NO awt system ? do not put in swing thread // Already in swing thread ? also don't wrap runner.run(); } else { // Put runner in swingthread SwingUtilities.invokeLater(runner); } } return null; } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { if (listeners.isEmpty()) { // No listeners, skip return null; } // LOG.warn("Deligating to " + listeners.size() // + " listeners. Method: " + method); // Create runner if (!suspended) { Runnable runner = new Runnable() { public void run() { for (Object listener: listeners) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e.getCause()); // Also log original exception LOG.verbose(e); } } } }; // FIXME in server mode we don't need this in // EventQueue.isDispatchThread()! // Addition: In servermode you should not use the event // listening stuff. Or refactor? if (!awtAvailable || EventQueue.isDispatchThread()) { // NO awt system ? do not put in swing thread // Already in swing thread ? also don't wrap runner.run(); } else { // Put runner in swingthread SwingUtilities.invokeLater(runner); } } return null; } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
||
for (Object listener: listeners) { | for (ListenerInterface listener : listenersInDispatchThread) { | public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { if (listeners.isEmpty()) { // No listeners, skip return null; } // LOG.warn("Deligating to " + listeners.size() // + " listeners. Method: " + method); // Create runner if (!suspended) { Runnable runner = new Runnable() { public void run() { for (Object listener: listeners) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e.getCause()); // Also log original exception LOG.verbose(e); } } } }; // FIXME in server mode we don't need this in // EventQueue.isDispatchThread()! // Addition: In servermode you should not use the event // listening stuff. Or refactor? if (!awtAvailable || EventQueue.isDispatchThread()) { // NO awt system ? do not put in swing thread // Already in swing thread ? also don't wrap runner.run(); } else { // Put runner in swingthread SwingUtilities.invokeLater(runner); } } return null; } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
+ listener.getClass().getName() + "'", e); | + listener.getClass().getName() + "'", e); | public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { if (listeners.isEmpty()) { // No listeners, skip return null; } // LOG.warn("Deligating to " + listeners.size() // + " listeners. Method: " + method); // Create runner if (!suspended) { Runnable runner = new Runnable() { public void run() { for (Object listener: listeners) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e.getCause()); // Also log original exception LOG.verbose(e); } } } }; // FIXME in server mode we don't need this in // EventQueue.isDispatchThread()! // Addition: In servermode you should not use the event // listening stuff. Or refactor? if (!awtAvailable || EventQueue.isDispatchThread()) { // NO awt system ? do not put in swing thread // Already in swing thread ? also don't wrap runner.run(); } else { // Put runner in swingthread SwingUtilities.invokeLater(runner); } } return null; } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
+ listener.getClass().getName() + "'", e); | + listener.getClass().getName() + "'", e); | public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { if (listeners.isEmpty()) { // No listeners, skip return null; } // LOG.warn("Deligating to " + listeners.size() // + " listeners. Method: " + method); // Create runner if (!suspended) { Runnable runner = new Runnable() { public void run() { for (Object listener: listeners) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e.getCause()); // Also log original exception LOG.verbose(e); } } } }; // FIXME in server mode we don't need this in // EventQueue.isDispatchThread()! // Addition: In servermode you should not use the event // listening stuff. Or refactor? if (!awtAvailable || EventQueue.isDispatchThread()) { // NO awt system ? do not put in swing thread // Already in swing thread ? also don't wrap runner.run(); } else { // Put runner in swingthread SwingUtilities.invokeLater(runner); } } return null; } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
+ listener.getClass().getName() + "'", e.getCause()); | + listener.getClass().getName() + "'", e.getCause()); | public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { if (listeners.isEmpty()) { // No listeners, skip return null; } // LOG.warn("Deligating to " + listeners.size() // + " listeners. Method: " + method); // Create runner if (!suspended) { Runnable runner = new Runnable() { public void run() { for (Object listener: listeners) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e.getCause()); // Also log original exception LOG.verbose(e); } } } }; // FIXME in server mode we don't need this in // EventQueue.isDispatchThread()! // Addition: In servermode you should not use the event // listening stuff. Or refactor? if (!awtAvailable || EventQueue.isDispatchThread()) { // NO awt system ? do not put in swing thread // Already in swing thread ? also don't wrap runner.run(); } else { // Put runner in swingthread SwingUtilities.invokeLater(runner); } } return null; } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
for (ListenerInterface listener : listenersNotInDispatchThread) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error("Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error("Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG .error("Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e .getCause()); LOG.verbose(e); } } | public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { if (listeners.isEmpty()) { // No listeners, skip return null; } // LOG.warn("Deligating to " + listeners.size() // + " listeners. Method: " + method); // Create runner if (!suspended) { Runnable runner = new Runnable() { public void run() { for (Object listener: listeners) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e.getCause()); // Also log original exception LOG.verbose(e); } } } }; // FIXME in server mode we don't need this in // EventQueue.isDispatchThread()! // Addition: In servermode you should not use the event // listening stuff. Or refactor? if (!awtAvailable || EventQueue.isDispatchThread()) { // NO awt system ? do not put in swing thread // Already in swing thread ? also don't wrap runner.run(); } else { // Put runner in swingthread SwingUtilities.invokeLater(runner); } } return null; } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
|
for (Object listener: listeners) { | for (ListenerInterface listener : listenersInDispatchThread) { | public void run() { for (Object listener: listeners) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e.getCause()); // Also log original exception LOG.verbose(e); } } } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
+ listener.getClass().getName() + "'", e); | + listener.getClass().getName() + "'", e); | public void run() { for (Object listener: listeners) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e.getCause()); // Also log original exception LOG.verbose(e); } } } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
+ listener.getClass().getName() + "'", e); | + listener.getClass().getName() + "'", e); | public void run() { for (Object listener: listeners) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e.getCause()); // Also log original exception LOG.verbose(e); } } } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
+ listener.getClass().getName() + "'", e.getCause()); | + listener.getClass().getName() + "'", e.getCause()); | public void run() { for (Object listener: listeners) { try { method.invoke(listener, args); } catch (IllegalArgumentException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (IllegalAccessException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e); } catch (InvocationTargetException e) { LOG.error( "Received an exception from listener '" + listener + "', class '" + listener.getClass().getName() + "'", e.getCause()); // Also log original exception LOG.verbose(e); } } } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
listeners.clear(); | listenersInDispatchThread.clear(); listenersNotInDispatchThread.clear(); | public void removeAllListeners() { listeners.clear(); } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
public void removeListener(Object listener) { | public void removeListener(ListenerInterface listener) { | public void removeListener(Object listener) { if (checkListener(listener)) { // Okay, remove listener listeners.remove(listener); } } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
listeners.remove(listener); | if (listener.fireInEventDispathThread()) { listenersInDispatchThread.remove(listener); } else { listenersNotInDispatchThread.remove(listener); } | public void removeListener(Object listener) { if (checkListener(listener)) { // Okay, remove listener listeners.remove(listener); } } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/5e02adc216a5e874559c0e9881d81ec39d41c9bd/ListenerSupportFactory.java/clean/src/main/de/dal33t/powerfolder/event/ListenerSupportFactory.java |
int msgList[] = StringUtil.split(messages, ",", -1); | long msgList[] = StringUtil.split(messages, ",", -1L); | private String _deleteMessages(HttpServletRequest req) { try { String messages = ParamUtil.getString(req, "messages"); int msgList[] = StringUtil.split(messages, ",", -1); String userId = PortalUtil.getUserId(req); String password = PortalUtil.getUserPassword(req); MailUtil.deleteMessages(userId, password, msgList); } catch (Exception e) { } return null; } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/0439a0c32cabd776e788b39ffb360612e0f117eb/MailboxAction.java/clean/portal-ejb/src/com/liferay/portlet/mailbox/action/MailboxAction.java |
jMe.put("id", me.getMsgNum()); | jMe.put("id", me.getMsgUID()); | private String _getPreviewHeaders(HttpServletRequest req) { JSONObject jsonObj = new JSONObject(); try { String userId = PortalUtil.getUserId(req); String password = PortalUtil.getUserPassword(req); String folderId = ParamUtil.getString(req, "folderId"); MailUtil.setCurrentFolder(userId, password, folderId); List list = MailUtil.getEnvelopes(userId); JSONArray meArray = new JSONArray(); for (int i = 0; i < list.size(); i++) { MailEnvelope me = (MailEnvelope)list.get(i); JSONObject jMe = new JSONObject(); jMe.put("id", me.getMsgNum()); jMe.put("email", me.getEmail()); jMe.put("subject", me.getSubject()); jMe.put("date", me.getDate().toString()); meArray.put(jMe); } jsonObj.put("headers", meArray); } catch (Exception e) { } return jsonObj.toString(); } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/0439a0c32cabd776e788b39ffb360612e0f117eb/MailboxAction.java/clean/portal-ejb/src/com/liferay/portlet/mailbox/action/MailboxAction.java |
int msgList[] = StringUtil.split(messages, ",", -1); | long msgList[] = StringUtil.split(messages, ",", -1L); | private String _moveMessages(HttpServletRequest req) { try { String userId = PortalUtil.getUserId(req); String password = PortalUtil.getUserPassword(req); String messages = ParamUtil.getString(req, "messages"); String toFolder = ParamUtil.getString(req, "folderId"); int msgList[] = StringUtil.split(messages, ",", -1); MailUtil.moveMessages(userId, password, msgList, toFolder); } catch (Exception e) { } return null; } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/0439a0c32cabd776e788b39ffb360612e0f117eb/MailboxAction.java/clean/portal-ejb/src/com/liferay/portlet/mailbox/action/MailboxAction.java |
portletURL.setParameter("order_id", order.getOrderId()); | portletURL.setParameter("orderId", order.getOrderId()); | public static String getPayPalReturnURL( PortletURL portletURL, ShoppingOrder order) { portletURL.setParameter( "struts_action", "/shopping/checkout"); portletURL.setParameter(Constants.CMD, Constants.VIEW); portletURL.setParameter("order_id", order.getOrderId()); return portletURL.toString(); } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f50330eba6c1a1fd6ffe7fce92a806c125da6a18/ShoppingUtil.java/clean/portal-ejb/src/com/liferay/portlet/shopping/util/ShoppingUtil.java |
boolean changed= false; | boolean offsetsInitialized= false; boolean offsetsChanged= false; | public boolean updateMarker(IMarker marker, IDocument document, Position position) { if (position == null) return true; if (position.isDeleted()) return false; boolean changed= false; int markerStart= MarkerUtilities.getCharStart(marker); int markerEnd= MarkerUtilities.getCharEnd(marker); if (markerStart != -1 && markerEnd != -1) { int offset= position.getOffset(); if (markerStart != offset) { MarkerUtilities.setCharStart(marker, offset); changed= true; } offset += position.getLength(); if (markerEnd != offset) { MarkerUtilities.setCharEnd(marker, offset); changed= true; } } if (changed && MarkerUtilities.getLineNumber(marker) != -1) { try { // marker line numbers are 1-based MarkerUtilities.setLineNumber(marker, document.getLineOfOffset(position.getOffset()) + 1); } catch (BadLocationException x) { } } return true; } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/d93c396e967ccc4bc1c4a484810017c0785dfd49/BasicMarkerUpdater.java/buggy/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/BasicMarkerUpdater.java |
changed= true; | offsetsChanged= true; | public boolean updateMarker(IMarker marker, IDocument document, Position position) { if (position == null) return true; if (position.isDeleted()) return false; boolean changed= false; int markerStart= MarkerUtilities.getCharStart(marker); int markerEnd= MarkerUtilities.getCharEnd(marker); if (markerStart != -1 && markerEnd != -1) { int offset= position.getOffset(); if (markerStart != offset) { MarkerUtilities.setCharStart(marker, offset); changed= true; } offset += position.getLength(); if (markerEnd != offset) { MarkerUtilities.setCharEnd(marker, offset); changed= true; } } if (changed && MarkerUtilities.getLineNumber(marker) != -1) { try { // marker line numbers are 1-based MarkerUtilities.setLineNumber(marker, document.getLineOfOffset(position.getOffset()) + 1); } catch (BadLocationException x) { } } return true; } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/d93c396e967ccc4bc1c4a484810017c0785dfd49/BasicMarkerUpdater.java/buggy/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/BasicMarkerUpdater.java |
changed= true; | offsetsChanged= true; | public boolean updateMarker(IMarker marker, IDocument document, Position position) { if (position == null) return true; if (position.isDeleted()) return false; boolean changed= false; int markerStart= MarkerUtilities.getCharStart(marker); int markerEnd= MarkerUtilities.getCharEnd(marker); if (markerStart != -1 && markerEnd != -1) { int offset= position.getOffset(); if (markerStart != offset) { MarkerUtilities.setCharStart(marker, offset); changed= true; } offset += position.getLength(); if (markerEnd != offset) { MarkerUtilities.setCharEnd(marker, offset); changed= true; } } if (changed && MarkerUtilities.getLineNumber(marker) != -1) { try { // marker line numbers are 1-based MarkerUtilities.setLineNumber(marker, document.getLineOfOffset(position.getOffset()) + 1); } catch (BadLocationException x) { } } return true; } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/d93c396e967ccc4bc1c4a484810017c0785dfd49/BasicMarkerUpdater.java/buggy/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/BasicMarkerUpdater.java |
if (changed && MarkerUtilities.getLineNumber(marker) != -1) { | if (!offsetsInitialized || (offsetsChanged && MarkerUtilities.getLineNumber(marker) != -1)) { | public boolean updateMarker(IMarker marker, IDocument document, Position position) { if (position == null) return true; if (position.isDeleted()) return false; boolean changed= false; int markerStart= MarkerUtilities.getCharStart(marker); int markerEnd= MarkerUtilities.getCharEnd(marker); if (markerStart != -1 && markerEnd != -1) { int offset= position.getOffset(); if (markerStart != offset) { MarkerUtilities.setCharStart(marker, offset); changed= true; } offset += position.getLength(); if (markerEnd != offset) { MarkerUtilities.setCharEnd(marker, offset); changed= true; } } if (changed && MarkerUtilities.getLineNumber(marker) != -1) { try { // marker line numbers are 1-based MarkerUtilities.setLineNumber(marker, document.getLineOfOffset(position.getOffset()) + 1); } catch (BadLocationException x) { } } return true; } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/d93c396e967ccc4bc1c4a484810017c0785dfd49/BasicMarkerUpdater.java/buggy/bundles/org.eclipse.ui/Eclipse UI Text Editor/org/eclipse/ui/texteditor/BasicMarkerUpdater.java |
Asserts.notNull(type, "type shouldn't be null."); | assert type != null : "type shouldn't be null."; | private IRubyObject defaultObjectUnmarshal(IRubyObject proc) throws IOException { RubySymbol className = (RubySymbol) unmarshalObject(); // ... FIXME: handle if class doesn't exist ... RubyClass type = (RubyClass) runtime.getClasses().getClassFromPath(className.asSymbol()); Asserts.notNull(type, "type shouldn't be null."); IRubyObject result = new RubyObject(runtime, type); registerLinkTarget(result); for (int i = 0, count = unmarshalInt(); i < count; i++) { result.setInstanceVariable(unmarshalObject().asSymbol(), unmarshalObject(proc)); } return result; } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/b72a2862ae5b2f01f9a767ef2ce248fd785857c4/UnmarshalStream.java/buggy/src/org/jruby/runtime/marshal/UnmarshalStream.java |
if (ProgressManager.getInstance().getRootElements(false).length == 0) { | if (ProgressManager.getInstance().getRootElements(Policy.DEBUG_SHOW_SYSTEM_JOBS).length == 0) { | void handleDetailsButtonSelect() { Shell shell = getShell(); Point shellSize = shell.getSize(); Composite composite = (Composite) getDialogArea(); if (viewer != null) { viewer.getControl().dispose(); viewer = null; composite.layout(); shell.setSize(shellSize.x, shellSize.y - viewerHeight); detailsButton.setText(ProgressMessages .getString("ProgressMonitorJobsDialog.DetailsTitle")); //$NON-NLS-1$ } else { //Abort if there are no jobs visible if (ProgressManager.getInstance().getRootElements(false).length == 0) { detailsButton.setEnabled(false); return; } viewer = new NewProgressViewer(viewerComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); viewer.setUseHashlookup(true); viewer.setSorter(new ViewerSorter() { /* * (non-Javadoc) * * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, * java.lang.Object, java.lang.Object) */ public int compare(Viewer testViewer, Object e1, Object e2) { return ((Comparable) e1).compareTo(e2); } }); ProgressTreeContentProvider provider = new ProgressTreeContentProvider( viewer, true); viewer.setContentProvider(provider); viewer.setInput(provider); viewer.setLabelProvider(new ProgressLabelProvider()); GridData viewerData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); int heightHint = convertHeightInCharsToPixels(10); viewerData.heightHint = heightHint; viewer.getControl().setLayoutData(viewerData); Point size = viewer.getControl().computeSize( viewerComposite.getBounds().width, heightHint); viewer.getControl().setSize(size); viewerComposite.layout(); viewer.getControl().setVisible(true); viewerHeight = viewer.getControl().getBounds().height; detailsButton.setText(ProgressMessages .getString("ProgressMonitorJobsDialog.HideTitle")); //$NON-NLS-1$ shell.setSize(shellSize.x, shellSize.y + viewerHeight); } } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/5131f101b267d5bee08ae1ed9a25ab22ccd38982/ProgressMonitorJobsDialog.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java |
viewer, true); | viewer, !Policy.DEBUG_SHOW_SYSTEM_JOBS); | void handleDetailsButtonSelect() { Shell shell = getShell(); Point shellSize = shell.getSize(); Composite composite = (Composite) getDialogArea(); if (viewer != null) { viewer.getControl().dispose(); viewer = null; composite.layout(); shell.setSize(shellSize.x, shellSize.y - viewerHeight); detailsButton.setText(ProgressMessages .getString("ProgressMonitorJobsDialog.DetailsTitle")); //$NON-NLS-1$ } else { //Abort if there are no jobs visible if (ProgressManager.getInstance().getRootElements(false).length == 0) { detailsButton.setEnabled(false); return; } viewer = new NewProgressViewer(viewerComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); viewer.setUseHashlookup(true); viewer.setSorter(new ViewerSorter() { /* * (non-Javadoc) * * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, * java.lang.Object, java.lang.Object) */ public int compare(Viewer testViewer, Object e1, Object e2) { return ((Comparable) e1).compareTo(e2); } }); ProgressTreeContentProvider provider = new ProgressTreeContentProvider( viewer, true); viewer.setContentProvider(provider); viewer.setInput(provider); viewer.setLabelProvider(new ProgressLabelProvider()); GridData viewerData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); int heightHint = convertHeightInCharsToPixels(10); viewerData.heightHint = heightHint; viewer.getControl().setLayoutData(viewerData); Point size = viewer.getControl().computeSize( viewerComposite.getBounds().width, heightHint); viewer.getControl().setSize(size); viewerComposite.layout(); viewer.getControl().setVisible(true); viewerHeight = viewer.getControl().getBounds().height; detailsButton.setText(ProgressMessages .getString("ProgressMonitorJobsDialog.HideTitle")); //$NON-NLS-1$ shell.setSize(shellSize.x, shellSize.y + viewerHeight); } } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/5131f101b267d5bee08ae1ed9a25ab22ccd38982/ProgressMonitorJobsDialog.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressMonitorJobsDialog.java |
sb.append("import java.util.HashSet;"); | private void _createHBM(Entity entity) throws IOException { List pkList = entity.getPKList(); List columnList = entity.getColumnList(); StringBuffer sb = new StringBuffer(); // Package sb.append("package " + _packagePath + ".service.persistence;"); // Imports sb.append("import " + _packagePath + ".model." + entity.getName() + ";"); sb.append("import java.util.Date;"); sb.append("import java.util.HashSet;"); sb.append("import java.util.Set;"); // Class declaration sb.append("public class " + entity.getName() + "HBM extends " + entity.getName() + "{"); // Empty constructor sb.append("protected " + entity.getName() + "HBM() {"); sb.append("}"); // Getter and setter methods for (int i = 0; i < columnList.size(); i++) { EntityColumn col = (EntityColumn)columnList.get(i); if (col.isCollection()) { sb.append("protected Set get" + col.getMethodName() + "() {"); sb.append("if (_" + col.getName() + " == null) {"); sb.append("_" + col.getName() + " = new HashSet();"); sb.append("}"); sb.append("return _" + col.getName() + ";"); sb.append("}"); sb.append("protected void set" + col.getMethodName() + "(Set " + col.getName() + ") {"); sb.append("_" + col.getName() + " = " + col.getName() + ";"); sb.append("}"); } } // Fields for (int i = 0; i < columnList.size(); i++) { EntityColumn col = (EntityColumn)columnList.get(i); if (col.isCollection()) { sb.append("private Set _" + col.getName() + ";"); } } // Class close brace sb.append("}"); // Write file File modelFile = new File(_outputPath + "/service/persistence/" + entity.getName() + "HBM.java"); writeFile(modelFile, sb.toString()); } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/5272ab30592a88344bf4f66910f1de0732e33f30/ServiceBuilder.java/buggy/portal-ejb/src/com/liferay/portal/tools/ServiceBuilder.java |
|
sb.append("if (_" + col.getName() + " == null) {"); sb.append("_" + col.getName() + " = new HashSet();"); sb.append("}"); | private void _createHBM(Entity entity) throws IOException { List pkList = entity.getPKList(); List columnList = entity.getColumnList(); StringBuffer sb = new StringBuffer(); // Package sb.append("package " + _packagePath + ".service.persistence;"); // Imports sb.append("import " + _packagePath + ".model." + entity.getName() + ";"); sb.append("import java.util.Date;"); sb.append("import java.util.HashSet;"); sb.append("import java.util.Set;"); // Class declaration sb.append("public class " + entity.getName() + "HBM extends " + entity.getName() + "{"); // Empty constructor sb.append("protected " + entity.getName() + "HBM() {"); sb.append("}"); // Getter and setter methods for (int i = 0; i < columnList.size(); i++) { EntityColumn col = (EntityColumn)columnList.get(i); if (col.isCollection()) { sb.append("protected Set get" + col.getMethodName() + "() {"); sb.append("if (_" + col.getName() + " == null) {"); sb.append("_" + col.getName() + " = new HashSet();"); sb.append("}"); sb.append("return _" + col.getName() + ";"); sb.append("}"); sb.append("protected void set" + col.getMethodName() + "(Set " + col.getName() + ") {"); sb.append("_" + col.getName() + " = " + col.getName() + ";"); sb.append("}"); } } // Fields for (int i = 0; i < columnList.size(); i++) { EntityColumn col = (EntityColumn)columnList.get(i); if (col.isCollection()) { sb.append("private Set _" + col.getName() + ";"); } } // Class close brace sb.append("}"); // Write file File modelFile = new File(_outputPath + "/service/persistence/" + entity.getName() + "HBM.java"); writeFile(modelFile, sb.toString()); } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/5272ab30592a88344bf4f66910f1de0732e33f30/ServiceBuilder.java/buggy/portal-ejb/src/com/liferay/portal/tools/ServiceBuilder.java |
|
else if (col.isCollection()) { sb.append(entity.getVarName() + "HBM.set" + col.getMethodName() + "(new HashSet());"); } | private void _createPersistence(Entity entity) throws IOException { List pkList = entity.getPKList(); List columnList = entity.getColumnList(); List finderList = entity.getFinderList(); String pkClassName = entity.getPKClassName(); String pkVarName = entity.getPKVarName(); StringBuffer sb = new StringBuffer(); // Package sb.append("package " + _packagePath + ".service.persistence;"); // Imports sb.append("import com.liferay.portal.PortalException;"); sb.append("import com.liferay.portal.SystemException;"); sb.append("import com.liferay.portal.service.persistence.BasePersistence;"); sb.append("import com.liferay.portal.spring.hibernate.HibernateUtil;"); sb.append("import com.liferay.util.StringPool;"); sb.append("import com.liferay.util.dao.hibernate.OrderByComparator;"); sb.append("import com.liferay.util.dao.hibernate.QueryPos;"); sb.append("import com.liferay.util.dao.hibernate.QueryUtil;"); sb.append("import java.util.ArrayList;"); sb.append("import java.util.Collection;"); sb.append("import java.util.Collections;"); sb.append("import java.util.Date;"); sb.append("import java.util.HashSet;"); sb.append("import java.util.Iterator;"); sb.append("import java.util.List;"); sb.append("import java.util.Set;"); sb.append("import org.apache.commons.logging.Log;"); sb.append("import org.apache.commons.logging.LogFactory;"); sb.append("import org.hibernate.Hibernate;"); sb.append("import org.hibernate.HibernateException;"); sb.append("import org.hibernate.ObjectNotFoundException;"); sb.append("import org.hibernate.Query;"); sb.append("import org.hibernate.Session;"); sb.append("import org.hibernate.SQLQuery;"); sb.append("import " + _packagePath + "." + _getNoSuchEntityException(entity) + "Exception;"); // Class declaration sb.append("public class " + entity.getName() + "Persistence extends BasePersistence {"); // Create method sb.append("public " + _packagePath + ".model." + entity.getName() + " create(" + entity.getPKClassName() + " " + pkVarName + ") {"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = new " + entity.getName() + "HBM();"); sb.append(entity.getVarName() + "HBM.setNew(true);"); sb.append(entity.getVarName() + "HBM.setPrimaryKey(" + pkVarName + ");"); sb.append("return " + entity.getName() + "HBMUtil.model(" + entity.getVarName() + "HBM);"); sb.append("}"); // Remove method sb.append("public " + _packagePath + ".model." + entity.getName() + " remove(" + pkClassName + " " + pkVarName + ") throws " + _getNoSuchEntityException(entity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, " + pkVarName + ");"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + " + pkVarName + ".toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + " + pkVarName + ".toString());"); sb.append("}"); sb.append("session.delete(" + entity.getVarName() + "HBM);"); sb.append("session.flush();"); sb.append("return " + entity.getName() + "HBMUtil.model(" + entity.getVarName() + "HBM);"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // Update method sb.append("public " + _packagePath + ".model." + entity.getName() + " update(" + _packagePath + ".model." + entity.getName() + " " + entity.getVarName() + ") throws SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("if (" + entity.getVarName() + ".isNew() || " + entity.getVarName() + ".isModified()) {"); sb.append("session = openSession();"); sb.append("if (" + entity.getVarName() + ".isNew()) {"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = new " + entity.getName() + "HBM();"); for (int i = 0; i < columnList.size(); i++) { EntityColumn col = (EntityColumn)columnList.get(i); if (!col.isCollection() && col.getEJBName() == null) { sb.append(entity.getVarName() + "HBM.set" + col.getMethodName() + "(" + entity.getVarName() + ".get" + col.getMethodName() + "());"); } } sb.append("session.save(" + entity.getVarName() + "HBM);"); sb.append("session.flush();"); sb.append("}"); sb.append("else {"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, " + entity.getVarName() + ".getPrimaryKey());"); sb.append("if (" + entity.getVarName() + "HBM != null) {"); for (int i = 0; i < columnList.size(); i++) { EntityColumn col = (EntityColumn)columnList.get(i); if (!col.isPrimary() && !col.isCollection() && col.getEJBName() == null) { sb.append(entity.getVarName() + "HBM.set" + col.getMethodName() + "(" + entity.getVarName() + ".get" + col.getMethodName() + "());"); } } sb.append("session.flush();"); sb.append("}"); sb.append("else {"); sb.append(entity.getVarName() + "HBM = new " + entity.getName() + "HBM();"); for (int i = 0; i < columnList.size(); i++) { EntityColumn col = (EntityColumn)columnList.get(i); if (!col.isCollection() && col.getEJBName() == null) { sb.append(entity.getVarName() + "HBM.set" + col.getMethodName() + "(" + entity.getVarName() + ".get" + col.getMethodName() + "());"); } } sb.append("session.save(" + entity.getVarName() + "HBM);"); sb.append("session.flush();"); sb.append("}"); sb.append("}"); /* for (int i = 0; i < columnList.size(); i++) { EntityColumn col = (EntityColumn)columnList.get(i); if (!col.isCollection() && col.getEJBName() != null) { sb.append("try {"); sb.append(entity.getVarName() + "EJB.set" + col.getMethodName() + "(" + col.getEJBName() + "HomeUtil.get" + col.getEJBName() + "Home().findByPrimaryKey(" + entity.getVarName() + ".get" + col.getMethodName() + "().getPrimaryKey()));"); sb.append("}"); sb.append("catch (FinderException fe) {"); sb.append("fe.printStackTrace();"); sb.append("}"); sb.append("catch (NamingException ne) {"); sb.append("ne.printStackTrace();"); sb.append("}"); } } */ sb.append(entity.getVarName() + ".setNew(false);"); sb.append(entity.getVarName() + ".setModified(false);"); sb.append("}"); sb.append("return " + entity.getVarName() + ";"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // Relationship methods for (int i = 0; i < columnList.size(); i++) { EntityColumn col = (EntityColumn)columnList.get(i); if ((col.isCollection()) && (col.isMappingManyToMany() || col.isMappingOneToMany())) { Entity tempEntity = getEntity(col.getEJBName()); EntityOrder tempOrder = tempEntity.getOrder(); EntityColumn tempCol = tempEntity.getColumnByMappingTable(col.getMappingTable()); // getUsers(String pk) sb.append("public List get" + tempEntity.getNames() + "(" + entity.getPKClassName() + " pk) throws " + _getNoSuchEntityException(entity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append("StringBuffer query = new StringBuffer();"); sb.append("query.append(\"SELECT " + tempEntity.getVarName() + "HBM FROM \");"); sb.append("query.append(" + entity.getPackagePath() + ".service.persistence." + entity.getName() + "HBM.class.getName());"); sb.append("query.append(\" " + entity.getVarName() + "HBM \");"); sb.append("query.append(\"JOIN " + entity.getVarName() + "HBM." + col.getName() + " AS " + tempEntity.getVarName() + "HBM \");"); sb.append("query.append(\"WHERE " + entity.getVarName() + "HBM." + pkVarName + " = ? \");"); if (tempOrder != null) { List tempOrderList = tempOrder.getColumns(); sb.append("query.append(\"ORDER BY \");"); for (int j = 0; j < tempOrderList.size(); j++) { EntityColumn tempOrderCol = (EntityColumn)tempOrderList.get(j); sb.append("query.append(\"" + tempEntity.getVarName() + "HBM." + tempOrderCol.getDBName() + " " + (tempOrderCol.isOrderByAscending() ? "ASC" : "DESC") + "\")"); if ((j + 1) != tempOrderList.size()) { sb.append(".append(\", \");"); } else { sb.append(";"); } } } sb.append("Query q = session.createQuery(query.toString());"); sb.append("q.set" + pkClassName + "(0, pk);"); sb.append("Iterator itr = q.list().iterator();"); sb.append("List list = new ArrayList();"); sb.append("while (itr.hasNext()) {"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)itr.next();"); sb.append("list.add(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBMUtil.model(" + tempEntity.getVarName() + "HBM));"); sb.append("}"); sb.append("return list;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // getUsers(String pk, int begin, int end) sb.append("public List get" + tempEntity.getNames() + "(" + entity.getPKClassName() + " pk, int begin, int end) throws " + _getNoSuchEntityException(entity) + "Exception, SystemException {"); sb.append("return get" + tempEntity.getNames() + "(pk, begin, end, null);"); sb.append("}"); // getUsers(String pk, int begin, int end, OrderByComparator obc) sb.append("public List get" + tempEntity.getNames() + "(" + entity.getPKClassName() + " pk, int begin, int end, OrderByComparator obc) throws " + _getNoSuchEntityException(entity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append("StringBuffer query = new StringBuffer();"); sb.append("query.append(\"SELECT " + tempEntity.getVarName() + "HBM FROM \");"); sb.append("query.append(" + entity.getPackagePath() + ".service.persistence." + entity.getName() + "HBM.class.getName());"); sb.append("query.append(\" " + entity.getVarName() + "HBM \");"); sb.append("query.append(\"JOIN " + entity.getVarName() + "HBM." + col.getName() + " AS " + tempEntity.getVarName() + "HBM \");"); sb.append("query.append(\"WHERE " + entity.getVarName() + "HBM." + pkVarName + " = ? \");"); sb.append("if (obc != null) {"); sb.append("query.append(\"ORDER BY \" + obc.getOrderBy());"); sb.append("}"); if (tempOrder != null) { List tempOrderList = tempOrder.getColumns(); sb.append("else {"); sb.append("query.append(\"ORDER BY \");"); for (int j = 0; j < tempOrderList.size(); j++) { EntityColumn tempOrderCol = (EntityColumn)tempOrderList.get(j); sb.append("query.append(\"" + tempEntity.getVarName() + "HBM." + tempOrderCol.getDBName() + " " + (tempOrderCol.isOrderByAscending() ? "ASC" : "DESC") + "\")"); if ((j + 1) != tempOrderList.size()) { sb.append(".append(\", \");"); } else { sb.append(";"); } } sb.append("}"); } sb.append("Query q = session.createQuery(query.toString());"); sb.append("q.set" + pkClassName + "(0, pk);"); sb.append("List list = new ArrayList();"); sb.append("Iterator itr = QueryUtil.iterate(q, getDialect(), begin, end);"); sb.append("while (itr.hasNext()) {"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)itr.next();"); sb.append("list.add(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBMUtil.model(" + tempEntity.getVarName() + "HBM));"); sb.append("}"); sb.append("return list;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // getUsersSize(String pk) sb.append("public int get" + tempEntity.getNames() + "Size(" + entity.getPKClassName() + " pk) throws SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append("StringBuffer query = new StringBuffer();"); sb.append("query.append(\"SELECT COUNT(*) FROM \");"); sb.append("query.append(" + entity.getPackagePath() + ".service.persistence." + entity.getName() + "HBM.class.getName());"); sb.append("query.append(\" " + entity.getVarName() + "HBM \");"); sb.append("query.append(\"JOIN " + entity.getVarName() + "HBM." + col.getName() + " AS " + tempEntity.getVarName() + "HBM \");"); sb.append("query.append(\"WHERE " + entity.getVarName() + "HBM." + pkVarName + " = ? \");"); sb.append("Query q = session.createQuery(query.toString());"); sb.append("q.set" + pkClassName + "(0, pk);"); sb.append("Iterator itr = q.iterate();"); sb.append("if (itr.hasNext()) {"); sb.append("Integer count = (Integer)itr.next();"); sb.append("if (count != null) {"); sb.append("return count.intValue();"); sb.append("}"); sb.append("}"); sb.append("return 0;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // setUsers(String pk, String[] pks) sb.append("public void set" + tempEntity.getNames() + "(" + entity.getPKClassName() + " pk, " + tempEntity.getPKClassName() + "[] pks) throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append("Set " + col.getName() + "Set = new HashSet();"); sb.append("for (int i = 0; pks != null && i < pks.length; i++) {"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, pks[i]);"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + pks[i].toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + pks[i].toString());"); sb.append("}"); sb.append(col.getName() + "Set.add(" + tempEntity.getVarName() + "HBM);"); sb.append("}"); sb.append(entity.getVarName() + "HBM.set" + col.getMethodName() + "(" + col.getName() + "Set);"); sb.append("session.flush();"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // setUsers(String pk, List pks) sb.append("public void set" + tempEntity.getNames() + "(" + entity.getPKClassName() + " pk, List " + col.getName() + ") throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append("Set " + col.getName() + "Set = new HashSet();"); sb.append("Iterator itr = " + col.getName() + ".iterator();"); sb.append("while (itr.hasNext()) {"); sb.append(tempEntity.getPackagePath() + ".model." + tempEntity.getName() + " " + tempEntity.getVarName() + " = (" + tempEntity.getPackagePath() + ".model." + tempEntity.getName() + ")itr.next();"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, " + tempEntity.getVarName() + ".getPrimaryKey());"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("}"); sb.append(col.getName() + "Set.add(" + tempEntity.getVarName() + "HBM);"); sb.append("}"); sb.append(entity.getVarName() + "HBM.set" + col.getMethodName() + "(" + col.getName() + "Set);"); sb.append("session.flush();"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // addUser(String pk, String userPK) sb.append("public boolean add" + tempEntity.getName() + "(" + entity.getPKClassName() + " pk, " + tempEntity.getPKClassName() + " " + tempEntity.getVarName() + "PK) throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = null;"); sb.append(tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, " + tempEntity.getVarName() + "PK);"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + "PK.toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + "PK.toString());"); sb.append("}"); sb.append("boolean value = " + entity.getVarName() + "HBM.get" + col.getMethodName() + "().add(" + tempEntity.getVarName() + "HBM);"); sb.append("session.flush();"); sb.append("return value;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // addUser(String pk, User user) sb.append("public boolean add" + tempEntity.getName() + "(" + entity.getPKClassName() + " pk, " + tempEntity.getPackagePath() + ".model." + tempEntity.getName() + " " + tempEntity.getVarName() + ") throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = null;"); sb.append(tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, " + tempEntity.getVarName() + ".getPrimaryKey());"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("}"); sb.append("boolean value = " + entity.getVarName() + "HBM.get" + col.getMethodName() + "().add(" + tempEntity.getVarName() + "HBM);"); sb.append("session.flush();"); sb.append("return value;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // addUsers(String pk, String[] userPKs) sb.append("public boolean add" + tempEntity.getNames() + "(" + entity.getPKClassName() + " pk, " + tempEntity.getPKClassName() + "[] " + tempEntity.getVarName() + "PKs) throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append("boolean value = false;"); sb.append("for (int i = 0; i < " + tempEntity.getVarName() + "PKs.length; i++) {"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = null;"); sb.append(tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, " + tempEntity.getVarName() + "PKs[i]);"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + "PKs[i].toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + "PKs[i].toString());"); sb.append("}"); sb.append("if (" + entity.getVarName() + "HBM.get" + col.getMethodName() + "().add(" + tempEntity.getVarName() + "HBM)) {"); sb.append("value = true;"); sb.append("}"); sb.append("}"); sb.append("session.flush();"); sb.append("return value;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // addUsers(String pk, List userPKs) sb.append("public boolean add" + tempEntity.getNames() + "(" + entity.getPKClassName() + " pk, List " + tempEntity.getVarNames() + ") throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append("boolean value = false;"); sb.append("for (int i = 0; i < " + tempEntity.getVarNames() + ".size(); i++) {"); sb.append(tempEntity.getPackagePath() + ".model." + tempEntity.getName() + " " + tempEntity.getVarName() + " = (" + tempEntity.getPackagePath() + ".model." + tempEntity.getName() + ")" + tempEntity.getVarNames() + ".get(i);"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, " + tempEntity.getVarName() + ".getPrimaryKey());"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("}"); sb.append("if (" + entity.getVarName() + "HBM.get" + col.getMethodName() + "().add(" + tempEntity.getVarName() + "HBM)) {"); sb.append("value = true;"); sb.append("}"); sb.append("}"); sb.append("session.flush();"); sb.append("return value;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // clearUsers(String pk) sb.append("public void clear" + tempEntity.getNames() + "(" + entity.getPKClassName() + " pk) throws " + _getNoSuchEntityException(entity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append(entity.getVarName() + "HBM.get" + col.getMethodName() + "().clear();"); sb.append("session.flush();"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // containsUser(String pk, String userPK) if (col.isMappingManyToMany()) { sb.append("public static final String SQL_CONTAINS" + tempEntity.getName().toUpperCase() + " = \"SELECT COUNT(*) AS COUNT_VALUE FROM " + col.getMappingTable() + " WHERE " + entity.getPKVarName() + " = ? AND " + tempEntity.getPKVarName() + " = ?\";"); sb.append("public boolean contains" + tempEntity.getName() + "(" + entity.getPKClassName() + " pk, " + tempEntity.getPKClassName() + " " + tempEntity.getVarName() + "PK) throws SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append("SQLQuery q = session.createSQLQuery(SQL_CONTAINS" + tempEntity.getName().toUpperCase() + ");"); sb.append("q.addScalar(HibernateUtil.getCountColumnName(), Hibernate.INTEGER);"); sb.append("QueryPos qPos = QueryPos.getInstance(q);"); sb.append("qPos.add(pk);"); sb.append("qPos.add(" + tempEntity.getVarName() + "PK);"); sb.append("Iterator itr = q.list().iterator();"); sb.append("if (itr.hasNext()) {"); sb.append("Integer count = (Integer)itr.next();"); sb.append("if ((count != null) && (count.intValue() > 0)) {"); sb.append("return true;"); sb.append("}"); sb.append("}"); sb.append("return false;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); } /*sb.append("public boolean contains" + tempEntity.getName() + "(" + entity.getPKClassName() + " pk, " + tempEntity.getPKClassName() + " " + tempEntity.getVarName() + "PK) throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = null;"); sb.append(tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, " + tempEntity.getVarName() + "PK);"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + "PK.toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + "PK.toString());"); sb.append("}"); sb.append("Collection c = " + entity.getVarName() + "HBM.get" + col.getMethodName() + "();"); sb.append("return c.contains(" + tempEntity.getVarName() + "HBM);"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}");*/ // containsUser(String pk, User user) /*sb.append("public boolean contains" + tempEntity.getName() + "(" + entity.getPKClassName() + " pk, " + tempEntity.getPackagePath() + ".model." + tempEntity.getName() + " " + tempEntity.getVarName() + ") throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = null;"); sb.append(tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, " + tempEntity.getVarName() + ".getPrimaryKey());"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("}"); sb.append("Collection c = " + entity.getVarName() + "HBM.get" + col.getMethodName() + "();"); sb.append("return c.contains(" + tempEntity.getVarName() + "HBM);"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}");*/ // containsUsers(String pk) if (col.isMappingManyToMany()) { sb.append("public static final String SQL_CONTAINS" + tempEntity.getName().toUpperCase() + "S = \"SELECT COUNT(*) AS COUNT_VALUE FROM " + col.getMappingTable() + " WHERE " + entity.getPKVarName() + " = ?\";"); sb.append("public boolean contains" + tempEntity.getName() + "s(" + entity.getPKClassName() + " pk) throws SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append("SQLQuery q = session.createSQLQuery(SQL_CONTAINS" + tempEntity.getName().toUpperCase() + "S);"); sb.append("q.addScalar(HibernateUtil.getCountColumnName(), Hibernate.INTEGER);"); sb.append("QueryPos qPos = QueryPos.getInstance(q);"); sb.append("qPos.add(pk);"); sb.append("Iterator itr = q.list().iterator();"); sb.append("if (itr.hasNext()) {"); sb.append("Integer count = (Integer)itr.next();"); sb.append("if ((count != null) && (count.intValue() > 0)) {"); sb.append("return true;"); sb.append("}"); sb.append("}"); sb.append("return false;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); } // removeUser(String pk, String userPK) sb.append("public boolean remove" + tempEntity.getName() + "(" + entity.getPKClassName() + " pk, " + tempEntity.getPKClassName() + " " + tempEntity.getVarName() + "PK) throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = null;"); sb.append(tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, " + tempEntity.getVarName() + "PK);"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + "PK.toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + "PK.toString());"); sb.append("}"); sb.append("boolean value = " + entity.getVarName() + "HBM.get" + col.getMethodName() + "().remove(" + tempEntity.getVarName() + "HBM);"); sb.append("session.flush();"); sb.append("return value;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // removeUser(String pk, User user) sb.append("public boolean remove" + tempEntity.getName() + "(" + entity.getPKClassName() + " pk, " + tempEntity.getPackagePath() + ".model." + tempEntity.getName() + " " + tempEntity.getVarName() + ") throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = null;"); sb.append(tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, " + tempEntity.getVarName() + ".getPrimaryKey());"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("}"); sb.append("boolean value = " + entity.getVarName() + "HBM.get" + col.getMethodName() + "().remove(" + tempEntity.getVarName() + "HBM);"); sb.append("session.flush();"); sb.append("return value;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // removeUsers(String pk, String[] userPKs) sb.append("public boolean remove" + tempEntity.getNames() + "(" + entity.getPKClassName() + " pk, " + tempEntity.getPKClassName() + "[] " + tempEntity.getVarName() + "PKs) throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append("boolean value = false;"); sb.append("for (int i = 0; i < " + tempEntity.getVarName() + "PKs.length; i++) {"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = null;"); sb.append(tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, " + tempEntity.getVarName() + "PKs[i]);"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + "PKs[i].toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + "PKs[i].toString());"); sb.append("}"); sb.append("if (" + entity.getVarName() + "HBM.get" + col.getMethodName() + "().remove(" + tempEntity.getVarName() + "HBM)) {"); sb.append("value = true;"); sb.append("}"); sb.append("}"); sb.append("session.flush();"); sb.append("return value;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // removeUsers(String pk, List users) sb.append("public boolean remove" + tempEntity.getNames() + "(" + entity.getPKClassName() + " pk, List " + tempEntity.getVarNames() + ") throws " + _getNoSuchEntityException(entity) + "Exception, " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, pk);"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + pk.toString());"); sb.append("}"); sb.append("boolean value = false;"); sb.append("for (int i = 0; i < " + tempEntity.getVarNames() + ".size(); i++) {"); sb.append(tempEntity.getPackagePath() + ".model." + tempEntity.getName() + " " + tempEntity.getVarName() + " = (" + tempEntity.getPackagePath() + ".model." + tempEntity.getName() + ")" + tempEntity.getVarNames() + ".get(i);"); sb.append(tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM " + tempEntity.getVarName() + "HBM = (" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM)session.get(" + tempEntity.getPackagePath() + ".service.persistence." + tempEntity.getName() + "HBM.class, " + tempEntity.getVarName() + ".getPrimaryKey());"); sb.append("if (" + tempEntity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("throw new " + tempEntity.getPackagePath() + "." + _getNoSuchEntityException(tempEntity) + "Exception(\"No " + tempEntity.getName() + " exists with the primary key \" + " + tempEntity.getVarName() + ".getPrimaryKey().toString());"); sb.append("}"); sb.append("if (" + entity.getVarName() + "HBM.get" + col.getMethodName() + "().remove(" + tempEntity.getVarName() + "HBM)) {"); sb.append("value = true;"); sb.append("}"); sb.append("}"); sb.append("session.flush();"); sb.append("return value;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); } } // Finder methods sb.append("public " + _packagePath + ".model." + entity.getName() + " findByPrimaryKey(" + pkClassName + " " + pkVarName + ") throws " + _getNoSuchEntityException(entity) + "Exception, SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)session.get(" + entity.getName() + "HBM.class, " + pkVarName + ");"); sb.append("if (" + entity.getVarName() + "HBM == null) {"); sb.append("_log.warn(\"No " + entity.getName() + " exists with the primary key \" + " + pkVarName + ".toString());"); sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(\"No " + entity.getName() + " exists with the primary key \" + " + pkVarName + ".toString());"); sb.append("}"); sb.append("return " + entity.getName() + "HBMUtil.model(" + entity.getVarName() + "HBM);"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); for (int i = 0; i < finderList.size(); i++) { EntityFinder finder = (EntityFinder)finderList.get(i); List finderColsList = finder.getColumns(); // Regular finder sb.append("public " + (finder.isCollection() ? "List" : _packagePath + ".model." + entity.getName()) + " findBy" + finder.getName() + "("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append(col.getType() + " " + col.getName()); if ((j + 1) != finderColsList.size()) { sb.append(", "); } } if (finder.isCollection()) { sb.append(") throws SystemException {"); } else { sb.append(") throws " + _getNoSuchEntityException(entity) + "Exception, SystemException {"); } sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append("StringBuffer query = new StringBuffer();"); sb.append("query.append(\"FROM " + entity.getTable() + " IN CLASS " + _packagePath + ".service.persistence." + entity.getName() + "HBM WHERE \");"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append("query.append(\"" + col.getDBName() + " " + col.getComparator() + " ?\");"); if ((j + 1) != finderColsList.size()) { sb.append("query.append(\" AND \");"); } else if (Validator.isNull(finder.getWhere())) { sb.append("query.append(\" \");"); } else { sb.append("query.append(\" AND " + finder.getWhere() + " \");"); } } EntityOrder order = entity.getOrder(); if (order != null) { List orderList = order.getColumns(); sb.append("query.append(\"ORDER BY \");"); for (int j = 0; j < orderList.size(); j++) { EntityColumn col = (EntityColumn)orderList.get(j); sb.append("query.append(\"" + col.getDBName() + " " + (col.isOrderByAscending() ? "ASC" : "DESC") + "\")"); if ((j + 1) != orderList.size()) { sb.append(".append(\", \");"); } else { sb.append(";"); } } } sb.append("Query q = session.createQuery(query.toString());"); sb.append("int queryPos = 0;"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); String colType = col.getType(); String colObjType = colType; if (col.isPrimitiveType()) { if (colType.equals("boolean")) { colObjType = "Boolean"; } else if (colType.equals("double")) { colObjType = "Double"; } else if (colType.equals("float")) { colObjType = "Float"; } else if (colType.equals("int")) { colObjType = "Integer"; } else if (colType.equals("long")) { colObjType = "Long"; } else if (colType.equals("short")) { colObjType = "Short"; } } sb.append("q.set" + colObjType + "(queryPos++, " + col.getName()); if (colType.equals("Boolean")) { sb.append(".booleanValue()"); } else if (colType.equals("Double")) { sb.append(".doubleValue()"); } else if (colType.equals("Float")) { sb.append(".floatValue()"); } else if (colType.equals("Integer")) { sb.append(".intValue()"); } else if (colType.equals("Long")) { sb.append(".longValue()"); } else if (colType.equals("Short")) { sb.append(".shortValue()"); } sb.append(");"); } sb.append("Iterator itr = q.list().iterator();"); if (finder.isCollection()) { sb.append("List list = new ArrayList();"); sb.append("while (itr.hasNext()) {"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)itr.next();"); sb.append("list.add(" + entity.getName() + "HBMUtil.model(" + entity.getVarName() + "HBM));"); sb.append("}"); sb.append("return list;"); } else { sb.append("if (!itr.hasNext()) {"); sb.append("String msg = \"No " + entity.getName() + " exists with the key \";"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); if (j == 0) { sb.append("msg += StringPool.OPEN_CURLY_BRACE;"); } sb.append("msg += \"" + col.getName() + "=\";"); sb.append("msg += " + col.getName() + ";"); if ((j + 1) != finderColsList.size()) { sb.append("msg += \", \";"); } if ((j + 1) == finderColsList.size()) { sb.append("msg += StringPool.CLOSE_CURLY_BRACE;"); } } sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(msg);"); sb.append("}"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)itr.next();"); sb.append("return " + entity.getName() + "HBMUtil.model(" + entity.getVarName() + "HBM);"); } sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // Scrollable finder if (finder.isCollection()) { sb.append("public List findBy" + finder.getName() + "("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append(col.getType() + " " + col.getName() + ", "); } sb.append("int begin, int end) throws SystemException {"); sb.append("return findBy" + finder.getName() + "("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append("" + col.getName() + ", "); } sb.append("begin, end, null);"); sb.append("}"); sb.append("public List findBy" + finder.getName() + "("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append(col.getType() + " " + col.getName() + ", "); } sb.append("int begin, int end, OrderByComparator obc) throws SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append("StringBuffer query = new StringBuffer();"); sb.append("query.append(\"FROM " + entity.getTable() + " IN CLASS " + _packagePath + ".service.persistence." + entity.getName() + "HBM WHERE \");"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append("query.append(\"" + col.getDBName() + " " + col.getComparator() + " ?\");"); if ((j + 1) != finderColsList.size()) { sb.append("query.append(\" AND \");"); } else if (Validator.isNull(finder.getWhere())) { sb.append("query.append(\" \");"); } else { sb.append("query.append(\" AND " + finder.getWhere() + " \");"); } } sb.append("if (obc != null) {"); sb.append("query.append(\"ORDER BY \" + obc.getOrderBy());"); sb.append("}"); if (order != null) { List orderList = order.getColumns(); sb.append("else {"); sb.append("query.append(\"ORDER BY \");"); for (int j = 0; j < orderList.size(); j++) { EntityColumn col = (EntityColumn)orderList.get(j); sb.append("query.append(\"" + col.getDBName() + " " + (col.isOrderByAscending() ? "ASC" : "DESC") + "\")"); if ((j + 1) != orderList.size()) { sb.append(".append(\", \");"); } else { sb.append(";"); } } sb.append("}"); } sb.append("Query q = session.createQuery(query.toString());"); sb.append("int queryPos = 0;"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); String colType = col.getType(); String colObjType = colType; if (col.isPrimitiveType()) { if (colType.equals("boolean")) { colObjType = "Boolean"; } else if (colType.equals("double")) { colObjType = "Double"; } else if (colType.equals("float")) { colObjType = "Float"; } else if (colType.equals("int")) { colObjType = "Integer"; } else if (colType.equals("long")) { colObjType = "Long"; } else if (colType.equals("short")) { colObjType = "Short"; } } sb.append("q.set" + colObjType + "(queryPos++, " + col.getName()); if (colType.equals("Boolean")) { sb.append(".booleanValue()"); } else if (colType.equals("Double")) { sb.append(".doubleValue()"); } else if (colType.equals("Float")) { sb.append(".floatValue()"); } else if (colType.equals("Integer")) { sb.append(".intValue()"); } else if (colType.equals("Long")) { sb.append(".longValue()"); } else if (colType.equals("Short")) { sb.append(".shortValue()"); } sb.append(");"); } sb.append("List list = new ArrayList();"); sb.append("Iterator itr = QueryUtil.iterate(q, getDialect(), begin, end);"); sb.append("while (itr.hasNext()) {"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)itr.next();"); sb.append("list.add(" + entity.getName() + "HBMUtil.model(" + entity.getVarName() + "HBM));"); sb.append("}"); sb.append("return list;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); sb.append("public " + _packagePath + ".model." + entity.getName() + " findBy" + finder.getName() + "_First("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append(col.getType() + " " + col.getName() + ", "); } sb.append("OrderByComparator obc) throws " + _getNoSuchEntityException(entity) + "Exception, SystemException {"); sb.append("List list = findBy" + finder.getName() + "("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append("" + col.getName() + ", "); } sb.append("0, 1, obc);"); sb.append("if (list.size() == 0) {"); sb.append("String msg = \"No " + entity.getName() + " exists with the key \";"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); if (j == 0) { sb.append("msg += StringPool.OPEN_CURLY_BRACE;"); } sb.append("msg += \"" + col.getName() + "=\";"); sb.append("msg += " + col.getName() + ";"); if ((j + 1) != finderColsList.size()) { sb.append("msg += \", \";"); } if ((j + 1) == finderColsList.size()) { sb.append("msg += StringPool.CLOSE_CURLY_BRACE;"); } } sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(msg);"); sb.append("}"); sb.append("else {"); sb.append("return (" + _packagePath + ".model." + entity.getName() + ")list.get(0);"); sb.append("}"); sb.append("}"); sb.append("public " + _packagePath + ".model." + entity.getName() + " findBy" + finder.getName() + "_Last("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append(col.getType() + " " + col.getName() + ", "); } sb.append("OrderByComparator obc) throws " + _getNoSuchEntityException(entity) + "Exception, SystemException {"); sb.append("int count = countBy" + finder.getName() + "("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append("" + col.getName()); if ((j + 1) != finderColsList.size()) { sb.append(", "); } } sb.append(");"); sb.append("List list = findBy" + finder.getName() + "("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append("" + col.getName() + ", "); } sb.append("count - 1, count, obc);"); sb.append("if (list.size() == 0) {"); sb.append("String msg = \"No " + entity.getName() + " exists with the key \";"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); if (j == 0) { sb.append("msg += StringPool.OPEN_CURLY_BRACE;"); } sb.append("msg += \"" + col.getName() + "=\";"); sb.append("msg += " + col.getName() + ";"); if ((j + 1) != finderColsList.size()) { sb.append("msg += \", \";"); } if ((j + 1) == finderColsList.size()) { sb.append("msg += StringPool.CLOSE_CURLY_BRACE;"); } } sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(msg);"); sb.append("}"); sb.append("else {"); sb.append("return (" + _packagePath + ".model." + entity.getName() + ")list.get(0);"); sb.append("}"); sb.append("}"); sb.append("public " + _packagePath + ".model." + entity.getName() + "[] findBy" + finder.getName() + "_PrevAndNext(" + pkClassName + " " + pkVarName + ", "); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append(col.getType() + " " + col.getName() + ", "); } sb.append("OrderByComparator obc) throws " + _getNoSuchEntityException(entity) + "Exception, SystemException {"); sb.append(_packagePath + ".model." + entity.getName() + " " + entity.getVarName() + " = findByPrimaryKey(" + pkVarName + ");"); sb.append("int count = countBy" + finder.getName() + "("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append("" + col.getName()); if ((j + 1) != finderColsList.size()) { sb.append(", "); } } sb.append(");"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append("StringBuffer query = new StringBuffer();"); sb.append("query.append(\"FROM " + entity.getTable() + " IN CLASS " + _packagePath + ".service.persistence." + entity.getName() + "HBM WHERE \");"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append("query.append(\"" + col.getDBName() + " " + col.getComparator() + " ?\");"); if ((j + 1) != finderColsList.size()) { sb.append("query.append(\" AND \");"); } else if (Validator.isNull(finder.getWhere())) { sb.append("query.append(\" \");"); } else { sb.append("query.append(\" AND " + finder.getWhere() + " \");"); } } sb.append("if (obc != null) {"); sb.append("query.append(\"ORDER BY \" + obc.getOrderBy());"); sb.append("}"); if (order != null) { List orderList = order.getColumns(); sb.append("else {"); sb.append("query.append(\"ORDER BY \");"); for (int j = 0; j < orderList.size(); j++) { EntityColumn col = (EntityColumn)orderList.get(j); sb.append("query.append(\"" + col.getDBName() + " " + (col.isOrderByAscending() ? "ASC" : "DESC") + "\")"); if ((j + 1) != orderList.size()) { sb.append(".append(\", \");"); } else { sb.append(";"); } } sb.append("}"); } sb.append("Query q = session.createQuery(query.toString());"); sb.append("int queryPos = 0;"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); String colType = col.getType(); String colObjType = colType; if (col.isPrimitiveType()) { if (colType.equals("boolean")) { colObjType = "Boolean"; } else if (colType.equals("double")) { colObjType = "Double"; } else if (colType.equals("float")) { colObjType = "Float"; } else if (colType.equals("int")) { colObjType = "Integer"; } else if (colType.equals("long")) { colObjType = "Long"; } else if (colType.equals("short")) { colObjType = "Short"; } } sb.append("q.set" + colObjType + "(queryPos++, " + col.getName()); if (colType.equals("Boolean")) { sb.append(".booleanValue()"); } else if (colType.equals("Double")) { sb.append(".doubleValue()"); } else if (colType.equals("Float")) { sb.append(".floatValue()"); } else if (colType.equals("Integer")) { sb.append(".intValue()"); } else if (colType.equals("Long")) { sb.append(".longValue()"); } else if (colType.equals("Short")) { sb.append(".shortValue()"); } sb.append(");"); } sb.append("Object[] objArray = QueryUtil.getPrevAndNext(q, count, obc, " + entity.getVarName() + ", " + entity.getName() + "HBMUtil.getInstance());"); sb.append(_packagePath + ".model." + entity.getName() + "[] array = new " + _packagePath + ".model." + entity.getName() + "[3];"); sb.append("array[0] = (" + _packagePath + ".model." + entity.getName() + ")objArray[0];"); sb.append("array[1] = (" + _packagePath + ".model." + entity.getName() + ")objArray[1];"); sb.append("array[2] = (" + _packagePath + ".model." + entity.getName() + ")objArray[2];"); sb.append("return array;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); } } sb.append("public List findAll() throws SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append("StringBuffer query = new StringBuffer();"); sb.append("query.append(\"FROM " + entity.getTable() + " IN CLASS " + _packagePath + ".service.persistence." + entity.getName() + "HBM \");"); EntityOrder order = entity.getOrder(); if (order != null) { List orderList = order.getColumns(); sb.append("query.append(\"ORDER BY \");"); for (int j = 0; j < orderList.size(); j++) { EntityColumn col = (EntityColumn)orderList.get(j); sb.append("query.append(\"" + col.getDBName() + " " + (col.isOrderByAscending() ? "ASC" : "DESC") + "\")"); if ((j + 1) != orderList.size()) { sb.append(".append(\", \");"); } else { sb.append(";"); } } } sb.append("Query q = session.createQuery(query.toString());"); sb.append("Iterator itr = q.iterate();"); sb.append("List list = new ArrayList();"); sb.append("while (itr.hasNext()) {"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)itr.next();"); sb.append("list.add(" + entity.getName() + "HBMUtil.model(" + entity.getVarName() + "HBM));"); sb.append("}"); sb.append("return list;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); // Remove by methods for (int i = 0; i < finderList.size(); i++) { EntityFinder finder = (EntityFinder)finderList.get(i); List finderColsList = finder.getColumns(); sb.append("public void removeBy" + finder.getName() + "("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append(col.getType() + " " + col.getName()); if ((j + 1) != finderColsList.size()) { sb.append(", "); } } if (finder.isCollection()) { sb.append(") throws SystemException {"); } else { sb.append(") throws " + _getNoSuchEntityException(entity) + "Exception, SystemException {"); } sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append("StringBuffer query = new StringBuffer();"); sb.append("query.append(\"FROM " + entity.getTable() + " IN CLASS " + _packagePath + ".service.persistence." + entity.getName() + "HBM WHERE \");"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append("query.append(\"" + col.getDBName() + " " + col.getComparator() + " ?\");"); if ((j + 1) != finderColsList.size()) { sb.append("query.append(\" AND \");"); } else if (Validator.isNull(finder.getWhere())) { sb.append("query.append(\" \");"); } else { sb.append("query.append(\" AND " + finder.getWhere() + " \");"); } } if (order != null) { List orderList = order.getColumns(); sb.append("query.append(\"ORDER BY \");"); for (int j = 0; j < orderList.size(); j++) { EntityColumn col = (EntityColumn)orderList.get(j); sb.append("query.append(\"" + col.getDBName() + " " + (col.isOrderByAscending() ? "ASC" : "DESC") + "\")"); if ((j + 1) != orderList.size()) { sb.append(".append(\", \");"); } else { sb.append(";"); } } } sb.append("Query q = session.createQuery(query.toString());"); sb.append("int queryPos = 0;"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); String colType = col.getType(); String colObjType = colType; if (col.isPrimitiveType()) { if (colType.equals("boolean")) { colObjType = "Boolean"; } else if (colType.equals("double")) { colObjType = "Double"; } else if (colType.equals("float")) { colObjType = "Float"; } else if (colType.equals("int")) { colObjType = "Integer"; } else if (colType.equals("long")) { colObjType = "Long"; } else if (colType.equals("short")) { colObjType = "Short"; } } sb.append("q.set" + colObjType + "(queryPos++, " + col.getName()); if (colType.equals("Boolean")) { sb.append(".booleanValue()"); } else if (colType.equals("Double")) { sb.append(".doubleValue()"); } else if (colType.equals("Float")) { sb.append(".floatValue()"); } else if (colType.equals("Integer")) { sb.append(".intValue()"); } else if (colType.equals("Long")) { sb.append(".longValue()"); } else if (colType.equals("Short")) { sb.append(".shortValue()"); } sb.append(");"); } sb.append("Iterator itr = q.list().iterator();"); sb.append("while (itr.hasNext()) {"); sb.append(entity.getName() + "HBM " + entity.getVarName() + "HBM = (" + entity.getName() + "HBM)itr.next();"); sb.append("session.delete(" + entity.getVarName() + "HBM);"); sb.append("}"); sb.append("session.flush();"); sb.append("}"); sb.append("catch (HibernateException he) {"); if (finder.isCollection()) { sb.append("throw new SystemException(he);"); } else { sb.append("if (he instanceof ObjectNotFoundException) {"); sb.append("String msg = \"No " + entity.getName() + " exists with the key \";"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); if (j == 0) { sb.append("msg += StringPool.OPEN_CURLY_BRACE;"); } sb.append("msg += \"" + col.getName() + "=\";"); sb.append("msg += " + col.getName() + ";"); if ((j + 1) != finderColsList.size()) { sb.append("msg += \", \";"); } if ((j + 1) == finderColsList.size()) { sb.append("msg += StringPool.CLOSE_CURLY_BRACE;"); } } sb.append("throw new " + _getNoSuchEntityException(entity) + "Exception(msg);"); sb.append("}"); sb.append("else {"); sb.append("throw new SystemException(he);"); sb.append("}"); } sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); } // Count by methods for (int i = 0; i < finderList.size(); i++) { EntityFinder finder = (EntityFinder)finderList.get(i); List finderColsList = finder.getColumns(); sb.append("public int countBy" + finder.getName() + "("); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append(col.getType() + " " + col.getName()); if ((j + 1) != finderColsList.size()) { sb.append(", "); } } sb.append(") throws SystemException {"); sb.append("Session session = null;"); sb.append("try {"); sb.append("session = openSession();"); sb.append("StringBuffer query = new StringBuffer();"); sb.append("query.append(\"SELECT COUNT(*) \");"); sb.append("query.append(\"FROM " + entity.getTable() + " IN CLASS " + _packagePath + ".service.persistence." + entity.getName() + "HBM WHERE \");"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); sb.append("query.append(\"" + col.getDBName() + " " + col.getComparator() + " ?\");"); if ((j + 1) != finderColsList.size()) { sb.append("query.append(\" AND \");"); } else if (Validator.isNull(finder.getWhere())) { sb.append("query.append(\" \");"); } else { sb.append("query.append(\" AND " + finder.getWhere() + " \");"); } } sb.append("Query q = session.createQuery(query.toString());"); sb.append("int queryPos = 0;"); for (int j = 0; j < finderColsList.size(); j++) { EntityColumn col = (EntityColumn)finderColsList.get(j); String colType = col.getType(); String colObjType = colType; if (col.isPrimitiveType()) { if (colType.equals("boolean")) { colObjType = "Boolean"; } else if (colType.equals("double")) { colObjType = "Double"; } else if (colType.equals("float")) { colObjType = "Float"; } else if (colType.equals("int")) { colObjType = "Integer"; } else if (colType.equals("long")) { colObjType = "Long"; } else if (colType.equals("short")) { colObjType = "Short"; } } sb.append("q.set" + colObjType + "(queryPos++, " + col.getName()); if (colType.equals("Boolean")) { sb.append(".booleanValue()"); } else if (colType.equals("Double")) { sb.append(".doubleValue()"); } else if (colType.equals("Float")) { sb.append(".floatValue()"); } else if (colType.equals("Integer")) { sb.append(".intValue()"); } else if (colType.equals("Long")) { sb.append(".longValue()"); } else if (colType.equals("Short")) { sb.append(".shortValue()"); } sb.append(");"); } sb.append("Iterator itr = q.list().iterator();"); sb.append("if (itr.hasNext()) {"); sb.append("Integer count = (Integer)itr.next();"); sb.append("if (count != null) {"); sb.append("return count.intValue();"); sb.append("}"); sb.append("}"); sb.append("return 0;"); sb.append("}"); sb.append("catch (HibernateException he) {"); sb.append("throw new SystemException(he);"); sb.append("}"); sb.append("finally {"); sb.append("closeSession(session);"); sb.append("}"); sb.append("}"); } // Fields sb.append("private static Log _log = LogFactory.getLog(" + entity.getName() + "Persistence.class);"); // Class close brace sb.append("}"); // Write file File ejbFile = new File(_outputPath + "/service/persistence/" + entity.getName() + "Persistence.java"); writeFile(ejbFile, sb.toString()); } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/5272ab30592a88344bf4f66910f1de0732e33f30/ServiceBuilder.java/buggy/portal-ejb/src/com/liferay/portal/tools/ServiceBuilder.java |
|
preview.dispose(); | preview.dispose(); | private void clearPreviews() { for (Iterator i = previewSet.iterator(); i.hasNext();) { IPresentationPreview preview = (IPresentationPreview) i.next(); try { preview.dispose(); } catch (RuntimeException e) { WorkbenchPlugin.log(RESOURCE_BUNDLE.getString("errorDisposePreviewLog"), StatusUtil.newStatus(IStatus.ERROR, e.getMessage(), e)); //$NON-NLS-1$ } } previewSet.clear(); } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/ecb04eea5d62126494445fc68a862be7c2074997/ColorsAndFontsPreferencePage.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java |
public void dispose() { super.dispose(); clearPreviews(); colorRegistry.dispose(); fontRegistry.dispose(); } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/ecb04eea5d62126494445fc68a862be7c2074997/ColorsAndFontsPreferencePage.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java |
||
ITheme theme = new ITheme() { public void addPropertyChangeListener(IPropertyChangeListener listener) { currentTheme.addPropertyChangeListener(listener); } public void removePropertyChangeListener(IPropertyChangeListener listener) { currentTheme.removePropertyChangeListener(listener); } public String getId() { return currentTheme.getId(); } public String getLabel() { return currentTheme.getLabel(); } public ColorRegistry getColorRegistry() { return colorRegistry; } public FontRegistry getFontRegistry() { return fontRegistry; } public void dispose() { } public String getString(String themeKey) { return currentTheme.getString(themeKey); } public Set keySet() { return currentTheme.keySet(); } public int getInt(String themeKey) { return currentTheme.getInt(themeKey); } public boolean getBoolean(String themeKey) { return currentTheme.getBoolean(themeKey); } }; | ITheme theme = getCascadingTheme(); | private void updateCategorySelection(String categoryId) { Object [] defintions; String key = categoryId; ThemeElementCategory category = null; if (categoryId == null) { key = "uncategorized"; //$NON-NLS-1$ } else { int idx = Arrays.binarySearch(themeRegistry.getCategories(), categoryId, IThemeRegistry.ID_COMPARATOR); if (idx == -1) categoryId = null; else category = themeRegistry.getCategories()[idx]; } lastCategory = key; defintions = (Object []) categoryMap.get(key); if (defintions == null) { ArrayList list = new ArrayList(); ColorDefinition[] colorDefinitions = themeRegistry.getColors(); for (int i = 0; i < colorDefinitions.length; i++) { if (!colorDefinitions[i].isEditable()) continue; String catId = colorDefinitions[i].getCategoryId(); if ((catId == null && categoryId == null) || (catId != null && categoryId != null && categoryId.equals(catId))) { list.add(colorDefinitions[i]); } } FontDefinition[] fontDefinitions = themeRegistry.getFonts(); for (int i = 0; i < fontDefinitions.length; i++) { if (!fontDefinitions[i].isEditable()) continue; String catId = fontDefinitions[i].getCategoryId(); if ((catId == null && categoryId == null) || (catId != null && categoryId != null && categoryId.equals(catId))) { list.add(fontDefinitions[i]); } } defintions = new Object[list.size()]; list.toArray(defintions); categoryMap.put(key, defintions); } presentationList.setInput(defintions); Composite previewControl = (Composite) previewMap.get(key); if (previewControl == null) { if (category != null) { try { IPresentationPreview preview = category.createPreview(); if (preview != null) { previewControl = new Composite(previewComposite, SWT.NONE); previewControl.setLayout(new FillLayout()); myApplyDialogFont(previewControl); ITheme theme = new ITheme() { public void addPropertyChangeListener(IPropertyChangeListener listener) { // TODO confirm currentTheme.addPropertyChangeListener(listener); } public void removePropertyChangeListener(IPropertyChangeListener listener) { // TODO confirm currentTheme.removePropertyChangeListener(listener); } public String getId() { return currentTheme.getId(); } public String getLabel() { return currentTheme.getLabel(); } public ColorRegistry getColorRegistry() { return colorRegistry; } public FontRegistry getFontRegistry() { return fontRegistry; } public void dispose() { // TODO: confirm } public String getString(String themeKey) { return currentTheme.getString(themeKey); } public Set keySet() { return currentTheme.keySet(); } public int getInt(String themeKey) { return currentTheme.getInt(themeKey); } public boolean getBoolean(String themeKey) { return currentTheme.getBoolean(themeKey); } }; preview.createControl(previewControl, theme); previewSet.add(preview); } } catch (CoreException e) { previewControl = new Composite(previewComposite, SWT.NONE); previewControl.setLayout(new FillLayout()); myApplyDialogFont(previewControl); Text error = new Text(previewControl, SWT.WRAP | SWT.READ_ONLY); error.setText(RESOURCE_BUNDLE.getString("errorCreatingPreview")); //$NON-NLS-1$ WorkbenchPlugin.log(RESOURCE_BUNDLE.getString("errorCreatePreviewLog"), StatusUtil.newStatus(IStatus.ERROR, e.getMessage(), e)); //$NON-NLS-1$ } } } if (previewControl == null) { previewControl = getDefaultPreviewControl(); } previewMap.put(key, previewControl); stackLayout.topControl = previewControl; previewComposite.layout(); } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/ecb04eea5d62126494445fc68a862be7c2074997/ColorsAndFontsPreferencePage.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage.java |
if (node.isFriend() || node.isSupernode() | if (node.isFriend() || (node.isSupernode() && !offlineTooLong) | private void buildReconnectionQueue() { // Process only valid nodes Member[] nodes = getValidNodes(); int nBefore = reconnectionQueue.size(); synchronized (reconnectionQueue) { reconnectionQueue.clear(); // Offline limit time, all nodes before this time are not getting // reconnected Date offlineLimitTime = new Date(System.currentTimeMillis() - Constants.MAX_NODE_OFFLINE_TIME); for (int i = 0; i < nodes.length; i++) { Member node = nodes[i]; if (node.isConnected() || node.isMySelf()) { // not process already connected nodes continue; } if (getController().isLanOnly() && !node.isOnLAN()) { // in lanOnly mode we don't want strangers continue; } // Check if node was offline too long Date lastConnectTime = node.getLastNetworkConnectTime(); boolean offlineTooLong = true; offlineTooLong = lastConnectTime != null ? lastConnectTime .before(offlineLimitTime) : true; // If node is interesting if (node.isInteresting()) { // Always add friends and supernodes to reconnect queue if (node.isFriend() || node.isSupernode() || (!node.receivedWrongIdentity() && !offlineTooLong)) { reconnectionQueue.add(node); } } } // Lately connect first Collections.sort(reconnectionQueue, MemberComparator.BY_RECONNECTION_PRIORITY); if (logVerbose) { log().verbose( "Freshly filled reconnection queue with " + reconnectionQueue.size() + " nodes, " + nBefore + " were in queue before"); } if (getController().isVerbose()) { Debug.writeNodeListCSV(reconnectionQueue, "ReconnectionQueue.csv"); } if (reconnectionQueue.size() > 200) { log().warn("Reconnection queue contains more than 200 nodes"); } // Notify threads if (!reconnectionQueue.isEmpty()) { reconnectionQueue.notify(); } } } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/7192ad1dd27e087f666e5cc30d7aa1a1c4b96e5b/NodeManager.java/buggy/src/main/de/dal33t/powerfolder/net/NodeManager.java |
log().warn( | log().info( | private boolean loadNodesFrom(String filename) { File nodesFile = new File(Controller.getMiscFilesLocation(), filename); if (!nodesFile.exists()) { // Try harder in local base nodesFile = new File(filename); } if (!nodesFile.exists()) { log().warn( "Unable to load nodes, file not found " + nodesFile.getAbsolutePath()); return false; } try { NodeList nodeList = new NodeList(); nodeList.load(nodesFile); log().warn( "Loaded " + nodeList.getNodeList().size() + " nodes from " + nodesFile.getAbsolutePath()); queueNewNodes(nodeList.getNodeList().toArray(new MemberInfo[0])); for (MemberInfo friend : nodeList.getFriendsSet()) { Member node = friend.getNode(getController(), true); node.setFriend(true); if (!this.friends.contains(node) && !node.isMySelf()) { this.friends.add(node); } } return !nodeList.getNodeList().isEmpty(); } catch (IOException e) { log().warn( "Unable to load nodes from file '" + filename + "'. " + e.getMessage()); log().verbose(e); } catch (ClassCastException e) { log().warn( "Illegal format of supernodes files '" + filename + "', deleted"); log().verbose(e); nodesFile.delete(); } catch (ClassNotFoundException e) { log().warn( "Illegal format of supernodes files '" + filename + "', deleted"); log().verbose(e); nodesFile.delete(); } return false; } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/7192ad1dd27e087f666e5cc30d7aa1a1c4b96e5b/NodeManager.java/buggy/src/main/de/dal33t/powerfolder/net/NodeManager.java |
q.setCacheable(true); | q.setCacheable(false); | public int getGroupsSize(String pk) throws SystemException { Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(_SQL_GETGROUPSSIZE); q.setCacheable(true); q.addScalar(HibernateUtil.getCountColumnName(), Hibernate.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(pk); Iterator itr = q.list().iterator(); if (itr.hasNext()) { Long count = (Long)itr.next(); if (count != null) { return count.intValue(); } } return 0; } catch (HibernateException he) { throw new SystemException(he); } finally { closeSession(session); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/c87a9e5474551de7510843e3bbf71a043bcf1043/RolePersistence.java/buggy/portal-ejb/src/com/liferay/portal/service/persistence/RolePersistence.java |
q.setCacheable(true); | q.setCacheable(false); | public int getPermissionsSize(String pk) throws SystemException { Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(_SQL_GETPERMISSIONSSIZE); q.setCacheable(true); q.addScalar(HibernateUtil.getCountColumnName(), Hibernate.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(pk); Iterator itr = q.list().iterator(); if (itr.hasNext()) { Long count = (Long)itr.next(); if (count != null) { return count.intValue(); } } return 0; } catch (HibernateException he) { throw new SystemException(he); } finally { closeSession(session); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/c87a9e5474551de7510843e3bbf71a043bcf1043/RolePersistence.java/buggy/portal-ejb/src/com/liferay/portal/service/persistence/RolePersistence.java |
q.setCacheable(true); | q.setCacheable(false); | public int getUsersSize(String pk) throws SystemException { Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(_SQL_GETUSERSSIZE); q.setCacheable(true); q.addScalar(HibernateUtil.getCountColumnName(), Hibernate.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(pk); Iterator itr = q.list().iterator(); if (itr.hasNext()) { Long count = (Long)itr.next(); if (count != null) { return count.intValue(); } } return 0; } catch (HibernateException he) { throw new SystemException(he); } finally { closeSession(session); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/c87a9e5474551de7510843e3bbf71a043bcf1043/RolePersistence.java/buggy/portal-ejb/src/com/liferay/portal/service/persistence/RolePersistence.java |
IPersistentMap set = new PersistentHybridMap(1001); | IPersistentMap set = new PersistentHashtableMap(1001); | static public void main(String args[]){ if(args.length != 1) System.err.println("Usage: RBTree n"); int n = Integer.parseInt(args[0]); Integer[] ints = new Integer[n]; for(int i = 0; i < ints.length; i++) { ints[i] = new Integer(i); } Collections.shuffle(Arrays.asList(ints)); //force the ListMap class loading now PersistentListMap.EMPTY.add(1).add(2).add(3); System.out.println("Building set"); IPersistentMap set = new PersistentHybridMap(1001); //IMap set = new HashtableMap(1001); //IMap set = new ListMap(); //IMap set = new ArrayMap(); //IMap set = new RBTree();// for(int i = 0; i < ints.length; i++)// {// Integer anInt = ints[i];// set = set.add(anInt);// } long startTime = System.nanoTime(); for(int i = 0; i < ints.length; i++) { Integer anInt = ints[i]; set = set.put(anInt, anInt); } //System.out.println("_count = " + set.count());// System.out.println("_count = " + set._count + ", min: " + set.minKey() + ", max: " + set.maxKey()// + ", depth: " + set.depth()); Iterator it = set.iterator(); while(it.hasNext()) { IMapEntry o = (IMapEntry) it.next(); if(!set.contains(o.key())) System.err.println("Can't find: " + o); //else if(n < 2000) // System.out.print(o.key().toString() + ","); } for(int i = 0; i < ints.length/2; i++) { Integer anInt = ints[i]; set = set.remove(anInt); } long estimatedTime = System.nanoTime() - startTime; System.out.println(); System.out.println("_count = " + set.count() + ", time: " + estimatedTime/10000); System.out.println("Building ht"); Hashtable ht = new Hashtable(1001); startTime = System.nanoTime();// for(int i = 0; i < ints.length; i++)// {// Integer anInt = ints[i];// ht.put(anInt,null);// } for(int i = 0; i < ints.length; i++) { Integer anInt = ints[i]; ht.put(anInt, anInt); } //System.out.println("size = " + ht.size()); it = ht.entrySet().iterator(); while(it.hasNext()) { Map.Entry o = (Map.Entry) it.next(); if(!ht.containsKey(o.getKey())) System.err.println("Can't find: " + o); //else if(n < 2000) // System.out.print(o.toString() + ","); } for(int i = 0; i < ints.length/2; i++) { Integer anInt = ints[i]; ht.remove(anInt); } estimatedTime = System.nanoTime() - startTime; System.out.println(); System.out.println("size = " + ht.size() + ", time: " + estimatedTime/10000);// System.out.println("_count = " + set._count + ", min: " + set.minKey() + ", max: " + set.maxKey()// + ", depth: " + set.depth());} | 52334 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52334/3e18fcb60b00f869f74b112af5b5d90b9a9edba0/PersistentTree.java/clean/src/org/clojure/runtime/PersistentTree.java |
noEmailInIdAccount.replaceAll("[ \t\r\n]",""); | noEmailInIdAccount.replaceAll("[\t\r\n]",""); | private void checkAddParticipant(ParameterParser params, SessionState state) { // get the participants to be added int i; Vector pList = new Vector(); String invalidEmailInIdAccountString = ServerConfigurationService.getString("invalidEmailInIdAccountString", null); //accept noEmailInIdAccounts and/or emailInIdAccount account names String noEmailInIdAccounts = ""; String emailInIdAccounts = ""; //check that there is something with which to work noEmailInIdAccounts = StringUtil.trimToNull((params.getString("noEmailInIdAccount"))); emailInIdAccounts = StringUtil.trimToNull(params.getString("emailInIdAccount")); state.setAttribute("noEmailInIdAccountValue", noEmailInIdAccounts); state.setAttribute("emailInIdAccountValue", emailInIdAccounts); //if there is no uniquname or emailInIdAccount entered if (noEmailInIdAccounts == null && emailInIdAccounts == null) { addAlert(state, rb.getString("java.guest")); state.setAttribute(STATE_TEMPLATE_INDEX, "5"); return; } String at = "@"; if (noEmailInIdAccounts != null) { // adding noEmailInIdAccounts String[] noEmailInIdAccountArray = noEmailInIdAccounts.replaceAll(",","\r\n").split("\r\n"); for (i = 0; i < noEmailInIdAccountArray.length; i++) { String noEmailInIdAccount = StringUtil.trimToNull(noEmailInIdAccountArray[i]); //if there is some text, try to use it noEmailInIdAccount.replaceAll("[ \t\r\n]",""); if(noEmailInIdAccount != null) { //automaticially add emailInIdAccount account Participant participant = new Participant(); try { User u = UserDirectoryService.getUserByEid(noEmailInIdAccount); participant.name = u.getDisplayName(); participant.uniqname = noEmailInIdAccount; pList.add(participant); } catch (UserNotDefinedException e) { addAlert(state, noEmailInIdAccount + " "+rb.getString("java.username")+" "); } } } } // noEmailInIdAccounts if (emailInIdAccounts != null) { String[] emailInIdAccountArray = emailInIdAccounts.split("\r\n"); for (i = 0; i < emailInIdAccountArray.length; i++) { String emailInIdAccount = emailInIdAccountArray[i]; //if there is some text, try to use it emailInIdAccount.replaceAll("[ \t\r\n]",""); //remove the trailing dots and empty space while (emailInIdAccount.endsWith(".") || emailInIdAccount.endsWith(" ")) { emailInIdAccount = emailInIdAccount.substring(0, emailInIdAccount.length() -1); } if(emailInIdAccount != null && emailInIdAccount.length() > 0) { String[] parts = emailInIdAccount.split(at); if(emailInIdAccount.indexOf(at) == -1 ) { // must be a valid email address addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")); } else if((parts.length != 2) || (parts[0].length() == 0)) { // must have both id and address part addAlert(state, emailInIdAccount + " "+rb.getString("java.notemailid")); } else if (!Validator.checkEmailLocal(parts[0])) { addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress") + INVALID_EMAIL); } else if (invalidEmailInIdAccountString != null && emailInIdAccount.indexOf(invalidEmailInIdAccountString) != -1) { // wrong string inside emailInIdAccount id addAlert(state, emailInIdAccount + " "+rb.getString("java.emailaddress")+" "); } else { Participant participant = new Participant(); try { // if the emailInIdAccount user already exists User u = UserDirectoryService.getUserByEid(emailInIdAccount); participant.name = u.getDisplayName(); participant.uniqname = emailInIdAccount; pList.add(participant); } catch (UserNotDefinedException e) { // if the emailInIdAccount user is not in the system yet participant.name = emailInIdAccount; participant.uniqname = emailInIdAccount; // TODO: what would the UDS case this name to? -ggolden pList.add(participant); } } } // if } // } // emailInIdAccounts boolean same_role = true; if (params.getString("same_role") == null) { addAlert(state, rb.getString("java.roletype")+" "); } else { same_role = params.getString("same_role").equals("true")?true:false; state.setAttribute("form_same_role", new Boolean(same_role)); } if (state.getAttribute(STATE_MESSAGE) != null) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); } else { if (same_role) { state.setAttribute(STATE_TEMPLATE_INDEX, "19"); } else { state.setAttribute(STATE_TEMPLATE_INDEX, "20"); } } // remove duplicate or existing user from participant list pList=removeDuplicateParticipants(pList, state); pList=removeExistingParticipants(pList, state); state.setAttribute(STATE_ADD_PARTICIPANTS, pList); // if the add participant list is empty after above removal, stay in the current page if (pList.size() == 0) { state.setAttribute(STATE_TEMPLATE_INDEX, "5"); addAlert(state, rb.getString("java.guest")); } return; } // checkAddParticipant | 54846 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54846/34811a961d9639b83b7470f9bab99381a5817e3f/SiteAction.java/clean/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java |
String noEmailInIdAccount = StringUtil.trimToNull(noEmailInIdAccountArray[i].replaceAll("[ \t\r\n]","")); | String noEmailInIdAccount = StringUtil.trimToNull(noEmailInIdAccountArray[i].replaceAll("[\t\r\n]","")); | public void doAdd_participant(RunData data) { SessionState state = ((JetspeedRunData)data).getPortletSessionState (((JetspeedRunData)data).getJs_peid ()); String siteTitle = getStateSite(state).getTitle(); Hashtable selectedRoles = (Hashtable) state.getAttribute(STATE_SELECTED_PARTICIPANT_ROLES); int i; //accept noEmailInIdAccounts and/or emailInIdAccount account names String emailInIdAccountName = ServerConfigurationService.getString("emailInIdAccountName", ""); String noEmailInIdAccounts = null; String emailInIdAccounts = null; if (state.getAttribute("noEmailInIdAccountValue") != null) { noEmailInIdAccounts = (String) state.getAttribute("noEmailInIdAccountValue"); } if (state.getAttribute("emailInIdAccountValue") != null) { emailInIdAccounts = (String) state.getAttribute("emailInIdAccountValue"); } boolean notify = false; if (state.getAttribute("form_selectedNotify") != null) { notify = ((Boolean) state.getAttribute("form_selectedNotify")).booleanValue(); } boolean same_role = ((Boolean) state.getAttribute("form_same_role")).booleanValue(); String pw = null; String notAddedNames = null; String notAddedEmailInIdAccounts = null; Vector addedNames = new Vector(); if (noEmailInIdAccounts != null) { // adding noEmailInIdAccounts String[] noEmailInIdAccountArray = noEmailInIdAccounts.replaceAll(",","\r\n").split("\r\n"); for (i = 0; i < noEmailInIdAccountArray.length; i++) { String noEmailInIdAccount = StringUtil.trimToNull(noEmailInIdAccountArray[i].replaceAll("[ \t\r\n]","")); if(noEmailInIdAccount != null) { // get role String role = null; if (same_role) { // if all added participants have a same role role = (String) state.getAttribute("form_selectedRole"); } else { // if all added participants have different role role = (String) selectedRoles.get(noEmailInIdAccount); } if (addUserRealm(state, noEmailInIdAccount, role)) { // successfully added addedNames.add(noEmailInIdAccount); // send notification if (notify) { String emailId = null; String userName = null; try { User u = UserDirectoryService.getUserByEid(noEmailInIdAccount); emailId = u.getEmail(); userName = u.getDisplayName(); } catch (UserNotDefinedException e) { M_log.warn("cannot find user " + noEmailInIdAccount + ". "); } // send notification email notifyAddedParticipant(false, emailId, userName, siteTitle); } } else { notAddedNames=notAddedNames.concat(noEmailInIdAccount); } } } } // noEmailInIdAccounts Vector addedEmailInIdAccounts = new Vector(); if (emailInIdAccounts != null) { String[] emailInIdAccountArray = emailInIdAccounts.split("\r\n"); for (i = 0; i < emailInIdAccountArray.length; i++) { String emailInIdAccount = StringUtil.trimToNull(emailInIdAccountArray[i].replaceAll("[ \t\r\n]","")); // remove the trailing dots and empty space while (emailInIdAccount.endsWith(".") || emailInIdAccount.endsWith(" ")) { emailInIdAccount = emailInIdAccount.substring(0, emailInIdAccount.length() -1); } if(emailInIdAccount != null) { try { UserDirectoryService.getUserByEid(emailInIdAccount); } catch (UserNotDefinedException e) { //if there is no such user yet, add the user try { UserEdit uEdit = UserDirectoryService.addUser(null, emailInIdAccount); //set email address uEdit.setEmail(emailInIdAccount); // set the guest user type uEdit.setType("guest"); // set password to a positive random number Random generator = new Random(System.currentTimeMillis()); Integer num = new Integer(generator.nextInt(Integer.MAX_VALUE)); if (num.intValue() < 0) num = new Integer(num.intValue() *-1); pw = num.toString(); uEdit.setPassword(pw); // and save UserDirectoryService.commitEdit(uEdit); boolean notifyNewUserEmail = (ServerConfigurationService.getString("notifyNewUserEmail", Boolean.TRUE.toString())).equalsIgnoreCase(Boolean.TRUE.toString()); if (notifyNewUserEmail) { notifyNewUserEmail(uEdit.getId(), uEdit.getEmail(), pw, siteTitle); } } catch(UserIdInvalidException ee) { addAlert(state, emailInIdAccountName + " id " + emailInIdAccount + " "+rb.getString("java.isinval") ); M_log.warn("doAdd_participant: UserDirectoryService addUser exception " + e.getMessage()); } catch(UserAlreadyDefinedException ee) { addAlert(state, "The " + emailInIdAccountName + " " + emailInIdAccount + " " + rb.getString("java.beenused")); M_log.warn("doAdd_participant: UserDirectoryService addUser exception " + e.getMessage()); } catch(UserPermissionException ee) { addAlert(state, rb.getString("java.haveadd")+ " " + emailInIdAccount); M_log.warn("doAdd_participant: UserDirectoryService addUser exception " + e.getMessage()); } } // add role if user exists if (state.getAttribute(STATE_MESSAGE) == null) { // get role String role = null; if (same_role) { // if all added participants have a same role role = (String) state.getAttribute("form_selectedRole"); } else { // if all added participants have different role role = (String) selectedRoles.get(emailInIdAccount); } // add property role to the emailInIdAccount account if (addUserRealm(state, emailInIdAccount, role)) { // emailInIdAccount account has been added successfully addedEmailInIdAccounts.add(emailInIdAccount); // send notification if (notify) { // send notification email notifyAddedParticipant(true, emailInIdAccount, emailInIdAccount, siteTitle); } } else { notAddedEmailInIdAccounts = notAddedEmailInIdAccounts.concat(emailInIdAccount + "\n"); } } else { notAddedEmailInIdAccounts = notAddedEmailInIdAccounts.concat(emailInIdAccount + "\n"); } } // if } // } // emailInIdAccounts if (!(addedNames.size() == 0 && addedEmailInIdAccounts.size() == 0) && (notAddedNames != null || notAddedEmailInIdAccounts != null)) { // at lease one noEmailInIdAccount account or a emailInIdAccount account added addAlert(state, rb.getString("java.allusers")); } if (notAddedNames == null && notAddedEmailInIdAccounts == null) { // all account has been added successfully removeAddParticipantContext(state); } else { state.setAttribute("noEmailInIdAccountValue", notAddedNames); state.setAttribute("emailInIdAccountValue", notAddedEmailInIdAccounts); } if (state.getAttribute(STATE_MESSAGE) != null) { state.setAttribute(STATE_TEMPLATE_INDEX, "22"); } else { state.setAttribute(STATE_TEMPLATE_INDEX, "12"); } return; } // doAdd_participant | 54846 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54846/34811a961d9639b83b7470f9bab99381a5817e3f/SiteAction.java/clean/site-manage-tool/tool/src/java/org/sakaiproject/site/tool/SiteAction.java |
setModified(true); | public void setAltShipping(int altShipping) { if (altShipping != _altShipping) { _altShipping = altShipping; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingCartModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingCartModel.java |
|
setModified(true); | public void setCartId(String cartId) { if (((cartId == null) && (_cartId != null)) || ((cartId != null) && (_cartId == null)) || ((cartId != null) && (_cartId != null) && !cartId.equals(_cartId))) { if (!XSS_ALLOW_CARTID) { cartId = XSSUtil.strip(cartId); } _cartId = cartId; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingCartModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingCartModel.java |
|
setModified(true); | public void setCompanyId(String companyId) { if (((companyId == null) && (_companyId != null)) || ((companyId != null) && (_companyId == null)) || ((companyId != null) && (_companyId != null) && !companyId.equals(_companyId))) { if (!XSS_ALLOW_COMPANYID) { companyId = XSSUtil.strip(companyId); } _companyId = companyId; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingCartModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingCartModel.java |
|
setModified(true); | public void setCouponIds(String couponIds) { if (((couponIds == null) && (_couponIds != null)) || ((couponIds != null) && (_couponIds == null)) || ((couponIds != null) && (_couponIds != null) && !couponIds.equals(_couponIds))) { if (!XSS_ALLOW_COUPONIDS) { couponIds = XSSUtil.strip(couponIds); } _couponIds = couponIds; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingCartModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingCartModel.java |
|
setModified(true); | public void setCreateDate(Date createDate) { if (((createDate == null) && (_createDate != null)) || ((createDate != null) && (_createDate == null)) || ((createDate != null) && (_createDate != null) && !createDate.equals(_createDate))) { _createDate = createDate; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingCartModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingCartModel.java |
|
setModified(true); | public void setGroupId(String groupId) { if (((groupId == null) && (_groupId != null)) || ((groupId != null) && (_groupId == null)) || ((groupId != null) && (_groupId != null) && !groupId.equals(_groupId))) { if (!XSS_ALLOW_GROUPID) { groupId = XSSUtil.strip(groupId); } _groupId = groupId; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingCartModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingCartModel.java |
|
setModified(true); | public void setInsure(boolean insure) { if (insure != _insure) { _insure = insure; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingCartModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingCartModel.java |
|
setModified(true); | public void setItemIds(String itemIds) { if (((itemIds == null) && (_itemIds != null)) || ((itemIds != null) && (_itemIds == null)) || ((itemIds != null) && (_itemIds != null) && !itemIds.equals(_itemIds))) { if (!XSS_ALLOW_ITEMIDS) { itemIds = XSSUtil.strip(itemIds); } _itemIds = itemIds; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingCartModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingCartModel.java |
|
setModified(true); | public void setModifiedDate(Date modifiedDate) { if (((modifiedDate == null) && (_modifiedDate != null)) || ((modifiedDate != null) && (_modifiedDate == null)) || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate.equals(_modifiedDate))) { _modifiedDate = modifiedDate; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingCartModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingCartModel.java |
|
setModified(true); | public void setUserId(String userId) { if (((userId == null) && (_userId != null)) || ((userId != null) && (_userId == null)) || ((userId != null) && (_userId != null) && !userId.equals(_userId))) { if (!XSS_ALLOW_USERID) { userId = XSSUtil.strip(userId); } _userId = userId; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingCartModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingCartModel.java |
|
setModified(true); | public void setUserName(String userName) { if (((userName == null) && (_userName != null)) || ((userName != null) && (_userName == null)) || ((userName != null) && (_userName != null) && !userName.equals(_userName))) { if (!XSS_ALLOW_USERNAME) { userName = XSSUtil.strip(userName); } _userName = userName; setModified(true); } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/f4d6afc6707f57fd84bf6b624f0c119657b0a766/ShoppingCartModel.java/clean/portal-ejb/src/com/liferay/portlet/shopping/model/ShoppingCartModel.java |
|
if (options.hasOption("p")) { System.err.println(options.getOption("p")); | if (commandLine.hasOption("p")) { | public static void startPowerFolder(String[] args) { // Command line parsing Options options = new Options(); options .addOption( "c", "config", true, "<config file>. Sets the configuration file to start. Default: PowerFolder.config"); options.addOption("t", "tester", false, "Enables tester mode. Will check for new development version"); options.addOption("m", "minimized", false, "Start PowerFolder minimized"); options.addOption("s", "server", false, "Start PowerFolder as server/supernode. GUI will be disabled"); options .addOption("d", "dns", true, "<ip/dns>. Sets the dns/ip to listen to. May also be an dyndns address"); options.addOption("h", "help", false, "Displays this help"); options.addOption("n", "nick", true, "<nickname> Sets the nickname"); options.addOption("k", "kill", false, "Shutsdown a running PowerFolder instance"); options.addOption("l", "log", false, "Displays logging information on console"); options .addOption( "f", "langfile", true, "<path\\file> Sets the language file to use (e.g. \"--langfile c:\\powerfolder\\translation\\translation_XX.properties\", forces PowerFolder to load this file as language file)"); options .addOption( "g", "language", true, "<language> Sets the language to use (e.g. \"--language de\", sets language to german)"); options.addOption("p", "createfolder", true, "<createfolder> Creates a new PowerFolder"); CommandLineParser parser = new PosixParser(); CommandLine commandLine; try { // parse the command line arguments commandLine = parser.parse(options, args); } catch (ParseException exp) { // oops, something went wrong System.err.println("Start failed. Reason: " + exp.getMessage()); // automatically generate the help statement HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("PowerFolder", options); return; } // Enable console logging if wanted (--log) Logger.setEnabledConsoleLogging(commandLine.hasOption("l")); if (commandLine.hasOption("s")) { // Server mode, supress debug output on console Logger.setExcludeConsoleLogLevel(Logger.DEBUG); } if (commandLine.hasOption("h")) { // Show help HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("PowerFolder", options); return; } if (commandLine.hasOption("k")) { if (!RemoteCommandManager.hasRunningInstance()) { System.err.println("PowerFolder not running"); } else { System.out.println("Stopping PowerFolder"); // Send quit command RemoteCommandManager.sendCommand(RemoteCommandManager.QUIT); } // stop return; } // set language from commandline to preferences if (commandLine.hasOption("g")) { Preferences.userNodeForPackage(Translation.class).put("locale", commandLine.getOptionValue("g")); } // The controller // Replace this line, when all calls to getInstance are removed Controller controller = Controller.createController(); String[] files = commandLine.getArgs(); // Parsing of command line completed // Try to start the controller always, if no file is in commandline // If commandline is filled with files to open, check if there is a // running instance before boolean startController = (files.length == 0) || (files.length > 0 && !RemoteCommandManager.hasRunningInstance()); try { LOG.info("PowerFolder v" + Controller.PROGRAM_VERSION); // Start controller if (startController) { controller.startConfig(commandLine); } // Send remote command if there a files in commandline if (files.length > 0) { // Parse filenames and build remote command StringBuffer openFilesRCommand = new StringBuffer( RemoteCommandManager.OPEN); for (int i = 0; i < files.length; i++) { openFilesRCommand.append(files[i]); // FIXME: Add ; separator ? } // Send remote command to running PowerFolder instance RemoteCommandManager.sendCommand(openFilesRCommand.toString()); } if (options.hasOption("p")) { System.err.println(options.getOption("p")); RemoteCommandManager.sendCommand(RemoteCommandManager.MAKEFOLDER + commandLine.getOptionValue("p")); } } catch (Throwable t) { LOG.error(t); return; } // Started if (startController) { System.out.println("------------ PowerFolder " + Controller.PROGRAM_VERSION + " started ------------"); } // Not go into console mode if ui is open if (!startController) { return; } if (controller.isUIEnabled()) { boolean restartRequested = false; do { // Go into restart loop while (controller.isStarted() || controller.isShuttingDown()) { try { Thread.sleep(2000); } catch (InterruptedException e) { LOG.warn(e); return; } } restartRequested = controller.isRestartRequested(); if (restartRequested) { Map<Thread, StackTraceElement[]> threads = Thread .getAllStackTraces(); for (Thread thread : threads.keySet()) { if (thread.getName().startsWith("PoolThread") || thread.getName().startsWith("Reconnector") || thread.getName().startsWith("ConHandler")) { thread.interrupt(); } } System.gc(); LOG.warn("Restarting controller"); controller = Controller.createController(); // Start controller controller.startConfig(commandLine); } } while (restartRequested); // Exit return; } // Console mode comes here ... // Add shutdown hook LOG.verbose("Adding shutdown hook"); final Controller con = controller; Runtime.getRuntime().addShutdownHook( new Thread("Shutdown hook for PowerFolder") { public void run() { // Shut down controller on VM exit con.shutdown(); } }); if (controller == null) { // Stop return; } // Console loop BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while (controller.isStarted()) { try { String line = in.readLine(); if (line == null) { line = ""; } line = line.toLowerCase(); if (line.startsWith("x")) { // x pressed, exit controller.exit(0); } else if (line.startsWith("connect ")) { String conStr = line.substring(8); try { controller.connect(conStr); } catch (ConnectionException e) { LOG.error("Unable to connect to " + conStr); } } else if (line.startsWith("c ")) { String conStr = line.substring(2); try { controller.connect(conStr); } catch (ConnectionException e) { LOG.error("Unable to connect to " + conStr); } } else if (line.startsWith("ul ")) { String ulimit = line.substring(3); try { controller.getTransferManager().setAllowedUploadCPSForWAN( (long) Double.parseDouble(ulimit) * 1024); } catch (NumberFormatException e) { LOG.error("Unable to parse new upload limit bandwidth " + ulimit); } } else if (line.startsWith("r")) { // write report controller.writeDebugReport(); System.out.println(controller.getDebugReport()); } // Sleep a bit, if commands are comming in too fast // on linux background processing Thread.sleep(200); } catch (IOException e) { LOG.error(e); break; } catch (InterruptedException e) { LOG.error(e); break; } } } | 51438 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51438/90bb441a258d075ba21535a3d214ff6b5194113c/PowerFolder.java/clean/src/main/de/dal33t/powerfolder/PowerFolder.java |
ActionRequestImpl reqImpl = (ActionRequestImpl)req; ActionResponseImpl resImpl = (ActionResponseImpl)res; | actionReqImpl = (ActionRequestImpl)req; actionResImpl = (ActionResponseImpl)res; | private void _invoke( PortletRequest req, PortletResponse res, boolean action) throws IOException, PortletException { if (_portletConfig.isWARFile()) { String path = StringPool.SLASH + _portletConfig.getPortletName() + "/invoke"; RequestDispatcher rd = _portletCtx.getServletContext().getRequestDispatcher(path); HttpServletRequest httpReq = null; HttpServletResponse httpRes = null; if (action) { ActionRequestImpl reqImpl = (ActionRequestImpl)req; ActionResponseImpl resImpl = (ActionResponseImpl)res; httpReq = reqImpl.getHttpServletRequest(); httpRes = resImpl.getHttpServletResponse(); } else { RenderRequestImpl reqImpl = (RenderRequestImpl)req; RenderResponseImpl resImpl = (RenderResponseImpl)res; httpReq = reqImpl.getHttpServletRequest(); httpRes = resImpl.getHttpServletResponse(); } httpReq.setAttribute(WebKeys.JAVAX_PORTLET_PORTLET, _portlet); try { rd.include(httpReq, httpRes); } catch (ServletException se) { Throwable cause = se.getRootCause(); if (cause instanceof PortletException) { throw (PortletException)cause; } throw new PortletException(cause); } } else { if (action) { ActionRequest actionReq = (ActionRequest)req; ActionResponse actionRes = (ActionResponse)res; _portlet.processAction(actionReq, actionRes); } else { RenderRequest renderReq = (RenderRequest)req; RenderResponse renderRes = (RenderResponse)res; _portlet.render(renderReq, renderRes); } } } | 57692 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57692/42e50ccc98fbe9828f2c9204202bbbe54641cf09/CachePortlet.java/buggy/portal-ejb/src/com/liferay/portlet/CachePortlet.java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.