rem
stringlengths
1
53.3k
add
stringlengths
0
80.5k
context
stringlengths
6
326k
meta
stringlengths
141
403
input_ids
list
attention_mask
list
labels
list
Object next = currentList.getMarker((IMarker) removes .next());
Object next = currentList.getMarker((IMarker) removes.next());
private Collection getExistingMarkers(Collection existingMarkers) { if (existingMarkers.isEmpty()) return Util.EMPTY_COLLECTION; Collection toRemove = new ArrayList(); MarkerList currentList = getCurrentMarkers(); Iterator removes = existingMarkers.iterator(); while (removes.hasNext()) { Object next = currentList.getMarker((IMarker) removes .next()); if (next != null) toRemove.add(next); } return toRemove; }
58148 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58148/ac93e585e66a8d0138f6693f6f22903cbc8af321/MarkerView.java/clean/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/internal/MarkerView.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 3196, 202, 1152, 2200, 336, 9895, 21644, 12, 2532, 2062, 21644, 13, 288, 1082, 202, 430, 261, 11711, 21644, 18, 291, 1921, 10756, 9506, 202, 2463, 3564, 18, 13625, 67, 25964, 31, 1082, 202, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 3196, 202, 1152, 2200, 336, 9895, 21644, 12, 2532, 2062, 21644, 13, 288, 1082, 202, 430, 261, 11711, 21644, 18, 291, 1921, 10756, 9506, 202, 2463, 3564, 18, 13625, 67, 25964, 31, 1082, 202, 25...
settings.setString(Session.SETTING_TIMEZONE, "US/Eastern");
settings.setString(Session.SETTING_TIMEZONE, " US/Eastern ");
public void testSettingsWithoutStartEndDayWithTimeZone() throws Exception { SessionSettings settings = new SessionSettings(); settings.setString(Session.SETTING_TIMEZONE, "US/Eastern"); settings.setString(Session.SETTING_START_TIME, "01:00:00"); settings.setString(Session.SETTING_END_TIME, "15:00:00"); SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET"); SessionSchedule schedule = new SessionSchedule(settings, sessionID); TimeZone tz = TimeZone.getTimeZone("US/Eastern"); doIsSessionTimeTest(schedule, false, 2002, 5, 5, 0, 59, 0, tz); doIsSessionTimeTest(schedule, true, 2002, 7, 5, 14, 30, 0, tz); doIsSessionTimeTest(schedule, false, 2003, 5, 5, 16, 30, 0, tz); }
52211 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52211/12051425dd8a2de5b2c7181dc007d4b8a4504dbb/SessionScheduleTest.java/clean/test/quickfix/SessionScheduleTest.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 1842, 2628, 8073, 1685, 1638, 4245, 1190, 16760, 1435, 1216, 1185, 288, 3639, 3877, 2628, 1947, 273, 394, 3877, 2628, 5621, 3639, 1947, 18, 542, 780, 12, 2157, 18, 1090, 12239, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 1842, 2628, 8073, 1685, 1638, 4245, 1190, 16760, 1435, 1216, 1185, 288, 3639, 3877, 2628, 1947, 273, 394, 3877, 2628, 5621, 3639, 1947, 18, 542, 780, 12, 2157, 18, 1090, 12239, ...
((AMQSession) consumerSession).declareExchangeSynch("amq.direct", "direct");
public void testAcknowledgePerConsumer() throws Exception { Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test"); Session consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE); Queue queue = new AMQQueue("Q1", "Q1", false, true); Queue queue2 = new AMQQueue("Q2", "Q2", false, true); MessageConsumer consumer = consumerSession.createConsumer(queue); MessageConsumer consumer2 = consumerSession.createConsumer(queue2); //force synch to ensure the consumer has resulted in a bound queue ((AMQSession) consumerSession).declareExchangeSynch("amq.direct", "direct"); Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "/test"); Session producerSession = con2.createSession(false, Session.CLIENT_ACKNOWLEDGE); MessageProducer producer = producerSession.createProducer(queue); MessageProducer producer2 = producerSession.createProducer(queue2); producer.send(producerSession.createTextMessage("msg1")); producer2.send(producerSession.createTextMessage("msg2")); con2.close(); _logger.info("Starting connection"); con.start(); TextMessage tm2 = (TextMessage) consumer2.receive(); assertNotNull(tm2); assertEquals("msg2",tm2.getText()); tm2.acknowledge(); consumerSession.recover(); TextMessage tm1 = (TextMessage) consumer.receive(2000); assertNotNull(tm1); assertEquals("msg1",tm1.getText()); con.close(); }
45585 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/45585/d07480d43ef288fc231e8b6d41c4650af2307d22/RecoverTest.java/clean/qpid/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 1842, 11931, 14390, 2173, 5869, 1435, 1216, 1185, 565, 288, 3639, 4050, 356, 273, 394, 16549, 1952, 2932, 3489, 2207, 30, 21, 3113, 315, 18908, 3113, 315, 18908, 3113, 315, 13230...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 1842, 11931, 14390, 2173, 5869, 1435, 1216, 1185, 565, 288, 3639, 4050, 356, 273, 394, 16549, 1952, 2932, 3489, 2207, 30, 21, 3113, 315, 18908, 3113, 315, 18908, 3113, 315, 13230...
if (slotListeners.size() > 0) {
if (slotListeners.size() > 0) {
public ShapeGraphic createInstance(org.cougaar.core.qos.frame.Frame frame) { try { ShapeContainer cloned = (ShapeContainer) this.clone(); if (frame != null) cloned.setFrame(frame); cloned.setPrototype(false); cloned.shapePrototype = (shapePrototype != null ? ((RectangularShape) shapePrototype.clone()) : null); cloned.shape = cloned.createShape(); org.cougaar.core.qos.frame.Frame parent = getFrame(); if (cloned.predicate != null && parent != null) cloned.predicate = new FramePredicate(cloned.predicate, (String) parent.getValue("name")); cloned.frameChildren = new HashSet(); cloned.shapeLayout = (shapeLayout != null ? shapeLayout.cloneSelf() : null); cloned.children = new ArrayList(); // clone children ShapeGraphic child,clonedChild; for (Iterator ii=children.iterator(); ii.hasNext();) { child = (ShapeGraphic) ii.next(); clonedChild = child.createInstance(child.frame); clonedChild.setParent(cloned); cloned.children.add(clonedChild); } cloned.layoutChildren(); cloned.prototypes = new HashMap(); // clone prototypes String key; for (Iterator ii=prototypes.keySet().iterator(); ii.hasNext();) { key = (String) ii.next(); child = (ShapeGraphic) prototypes.get(key); clonedChild = child.createInstance(child.frame); clonedChild.setPrototype(true); clonedChild.setParent(cloned); cloned.prototypes.put(key, clonedChild); } // clone slot change listeners if (slotListeners.size() > 0) { cloned.slotListeners = new ArrayList(); for (Iterator ii=slotListeners.iterator(); ii.hasNext();) { cloned.addSlotListener(((SlotChangeListener)ii.next()).cloneInstance()); } } cloned.validateListeners(); return cloned; } catch (CloneNotSupportedException ee) { ee.printStackTrace(); } return null; }
7173 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/7173/0b5a2fb99eb98589d8a9af0a6dd19d7236b37220/ShapeContainer.java/buggy/qos/src/org/cougaar/core/qos/frame/visualizer/ShapeContainer.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 12383, 29459, 20075, 12, 3341, 18, 2894, 637, 69, 297, 18, 3644, 18, 23557, 18, 3789, 18, 3219, 2623, 13, 288, 3639, 775, 288, 5411, 12383, 2170, 13027, 273, 261, 8500, 2170, 13, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 12383, 29459, 20075, 12, 3341, 18, 2894, 637, 69, 297, 18, 3644, 18, 23557, 18, 3789, 18, 3219, 2623, 13, 288, 3639, 775, 288, 5411, 12383, 2170, 13027, 273, 261, 8500, 2170, 13, ...
Utility.showSetNames(log," ", new UnicodeSet(s2).removeAll(s1), false, false, Default.ucd);
Utility.showSetNames(log," ", new UnicodeSet(s2).removeAll(s1), false, false, Default.ucd());
static void showDifferences(PrintWriter log, UnicodeSet s1, String name1, UnicodeSet s2, String name2, boolean both) { if (!s1.equals(s2)) { log.println(); log.println("In " + name1 + ", but NOT " + name2); Utility.showSetNames(log," ", new UnicodeSet(s1).removeAll(s2), false, false, Default.ucd); log.println(); log.println("NOT in " + name1 + ", but in " + name2); Utility.showSetNames(log," ", new UnicodeSet(s2).removeAll(s1), false, false, Default.ucd); log.println(); if (both) { log.println("In both " + name1 + " AND " + name2); Utility.showSetNames(log," ", new UnicodeSet(s2).retainAll(s1), false, false, Default.ucd); log.println(); } } }
5620 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5620/d1ef79fafdbbeaaf4dcbaa9d3c534754c217d955/VerifyUCD.java/clean/tools/unicodetools/com/ibm/text/UCD/VerifyUCD.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 760, 918, 2405, 10428, 2980, 12, 5108, 2289, 613, 16, 9633, 694, 272, 21, 16, 514, 508, 21, 16, 9633, 694, 272, 22, 16, 514, 508, 22, 16, 1250, 3937, 13, 288, 3639, 309, 16051, 87, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 760, 918, 2405, 10428, 2980, 12, 5108, 2289, 613, 16, 9633, 694, 272, 21, 16, 514, 508, 21, 16, 9633, 694, 272, 22, 16, 514, 508, 22, 16, 1250, 3937, 13, 288, 3639, 309, 16051, 87, ...
state.serviceList = (ServiceList) result;
state.bag = (CategoryBag) result;
public void invoke(Object result) { state.serviceList = (ServiceList) result; Vector serviceKeys = new Vector(); for (Iterator it = state.serviceList.getServiceInfos().getServiceInfoVector().iterator(); it.hasNext(); ) { org.uddi4j.response.ServiceInfo si = (org.uddi4j.response.ServiceInfo) it.next(); serviceKeys.add(si.getServiceKey()); if (log.isDebugEnabled()) { log.debug("[findAllServices]ServiceName : " + si.getNameString()); } } if (!serviceKeys.isEmpty()) { createServiceInfos(serviceKeys, state.step4, state.proxy); } else { if (log.isDebugEnabled()) { log.debug("No services were found "); } state.step4.invoke(Collections.EMPTY_LIST); }}};
14011 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/14011/b6383a4b72133d864e1c41a6f45fcd077066b34f/UDDI4JRegistryQueryServiceComponent.java/clean/servicediscovery/src/org/cougaar/servicediscovery/service/UDDI4JRegistryQueryServiceComponent.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 4356, 12, 921, 563, 13, 288, 3639, 919, 18, 22551, 273, 261, 4457, 5013, 13, 563, 31, 3639, 5589, 1156, 2396, 273, 394, 5589, 5621, 3639, 364, 261, 3198, 518, 273, 919, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 4356, 12, 921, 563, 13, 288, 3639, 919, 18, 22551, 273, 261, 4457, 5013, 13, 563, 31, 3639, 5589, 1156, 2396, 273, 394, 5589, 5621, 3639, 364, 261, 3198, 518, 273, 919, ...
listeners = manager.getListeners();
listeners = manager.getChangeListeners();
public void testListenersRemoved() { int numListenersBefore = 0; int numListenersDuring = 0; int numListenersAfter = 0; TaskListManager manager = MylarTaskListPlugin.getTaskListManager(); List<ITaskActivityListener> listeners = manager.getListeners(); numListenersBefore = listeners.size(); // open a task in editor// cat1task1.setForceSyncOpen(true); TaskListUiUtil.openEditor(cat1task1, false);// cat1task1.openTaskInEditor(false);// cat1task2.setForceSyncOpen(true);// cat1task2.openTaskInEditor(false); TaskListUiUtil.openEditor(cat1task2, false); listeners = manager.getListeners(); numListenersDuring = listeners.size(); assertEquals(numListenersDuring, numListenersBefore + 2); MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors( false); listeners = manager.getListeners(); numListenersAfter = listeners.size(); assertEquals(numListenersBefore, numListenersAfter); }
51989 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51989/ab0859060cb7a33aa8fa21ea563a8f906eff1914/TaskListUiTest.java/clean/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListUiTest.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 1842, 5583, 10026, 1435, 288, 202, 202, 474, 818, 5583, 4649, 273, 374, 31, 202, 202, 474, 818, 5583, 26424, 273, 374, 31, 202, 202, 474, 818, 5583, 4436, 273, 374, 31, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 1842, 5583, 10026, 1435, 288, 202, 202, 474, 818, 5583, 4649, 273, 374, 31, 202, 202, 474, 818, 5583, 26424, 273, 374, 31, 202, 202, 474, 818, 5583, 4436, 273, 374, 31, ...
serialVersionOnStream = 1; }
startTimeMode = WALL_TIME; endTimeMode = WALL_TIME; serialVersionOnStream = 2; }
private void readObject(java.io.ObjectInputStream input) throws java.io.IOException, ClassNotFoundException { input.defaultReadObject(); if (serialVersionOnStream == 0) { // initialize the new fields to default values. dstSavings = 60 * 60 * 1000; endMode = DOW_IN_MONTH_MODE; startMode = DOW_IN_MONTH_MODE; serialVersionOnStream = 1; } else { int length = input.readInt(); byte[] byteArray = new byte[length]; input.read(byteArray, 0, length); if (length >= 4) { // Lets hope that Sun does extensions to the serialized // form in a sane manner. startDay = byteArray[0]; startDayOfWeek = byteArray[1]; endDay = byteArray[2]; endDayOfWeek = byteArray[3]; } } }
5916 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5916/b40a8f897bc0d4a113dc2f0244f92bb48f94f5de/SimpleTimeZone.java/buggy/libjava/java/util/SimpleTimeZone.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 3238, 918, 17362, 12, 6290, 18, 1594, 18, 921, 4348, 810, 13, 565, 1216, 2252, 18, 1594, 18, 14106, 16, 10403, 225, 288, 565, 810, 18, 1886, 1994, 921, 5621, 565, 309, 261, 8818, 1444, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 3238, 918, 17362, 12, 6290, 18, 1594, 18, 921, 4348, 810, 13, 565, 1216, 2252, 18, 1594, 18, 14106, 16, 10403, 225, 288, 565, 810, 18, 1886, 1994, 921, 5621, 565, 309, 261, 8818, 1444, ...
double data[]; data = context.popNumberOperands(2); context.operands.push(new Double(data[0] * data[1]));
Object data[]; data = context.popOperands(1); if (! (data[0] instanceof java.awt.Font)) { throw new PainterException("setfont: wrong arguments"); } java.awt.Font fn=(java.awt.Font)data[0]; System.out.println("Fonthoehe:"+fn.getSize2D()); /** * @todo two times the same? */ context.pencil.graphics.setFont( fn); context.pencil.state.font=fn;
public void execute(PAContext context) throws PainterException { double data[]; data = context.popNumberOperands(2); context.operands.push(new Double(data[0] * data[1])); }
6653 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/6653/4beebbe053e6880f34d1244b354a06ee42d3aa30/PAContext.java/buggy/src/com/lowagie/text/pdf/codec/postscript/PAContext.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 4202, 1071, 918, 1836, 12, 4066, 1042, 819, 13, 1216, 453, 11606, 503, 288, 3639, 1645, 501, 8526, 31, 3639, 501, 273, 819, 18, 5120, 1854, 3542, 5708, 12, 22, 1769, 3639, 819, 18, 4063, 570...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 4202, 1071, 918, 1836, 12, 4066, 1042, 819, 13, 1216, 453, 11606, 503, 288, 3639, 1645, 501, 8526, 31, 3639, 501, 273, 819, 18, 5120, 1854, 3542, 5708, 12, 22, 1769, 3639, 819, 18, 4063, 570...
int planeBytes = DataTools.bytesToInt(bytes, pt, 4, littleEndian);
int planeBytes = DataTools.bytesToInt(bytes, pt, 4, little);
private void handlePixmap(int opcode) throws FormatException { if (DEBUG) System.out.println("PictReader.handlePixmap(" + opcode + ")"); int pixelSize; int compCount; // handle 9A variation if (opcode == PICT_9A) { // this is the only opcode that holds 16, 24, and 32 bit data // read the pixmap (9A) pt += 4; int version = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; // read the bounding box int tlY = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int tlX = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int brY = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int brX = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; pt += 2; // reserved int packType = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int packSize = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int hRes = DataTools.bytesToInt(bytes, pt, 4, littleEndian); pt += 4; int vRes = DataTools.bytesToInt(bytes, pt, 4, littleEndian); pt += 4; int pixelType = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; pixelSize = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; compCount = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int compSize = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int planeBytes = DataTools.bytesToInt(bytes, pt, 4, littleEndian); pt += 4; int pmTable = DataTools.bytesToInt(bytes, pt, 4, littleEndian); pt += 4; pt += 4; // reserved width = brX - tlX; height = brY - tlY; if (pixelSize != compCount) pixelSize = compCount; // rowBytes doesn't exist, so set it to its logical value switch (pixelSize) { case 32: rowBytes = width * compCount; break; case 16: rowBytes = width * 2; break; default: throw new FormatException("Sorry, vector data not supported."); } } else { rowBytes &= 0x3fff; // mask off flags int tlY = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int tlX = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int brY = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int brX = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; // unnecessary data pt += 18; pixelSize = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; compCount = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; // unnecessary data pt += 14; // read the lookup table pt += 2; int id = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int flags = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; int count = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; count++; lookup = new short[3][count]; for (int i=0; i<count; i++) { int index = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; if ((flags & 0x8000) != 0) index = i; lookup[0][index] = DataTools.bytesToShort(bytes, pt, 2, littleEndian); pt += 2; lookup[1][index] = DataTools.bytesToShort(bytes, pt, 2, littleEndian); pt += 2; lookup[2][index] = DataTools.bytesToShort(bytes, pt, 2, littleEndian); pt += 2; } width = brX - tlX; height = brY - tlY; } // skip over two rectangles pt += 16; int mode = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; if (opcode == PICT_BITSRGN || opcode == PICT_PACKBITSRGN) { int x = DataTools.bytesToInt(bytes, pt, 2, littleEndian); pt += 2; } handlePixmap(rowBytes, pixelSize, compCount); }
55415 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/55415/4cf4a7ff76a166988d770aa51d298fa2f84c9e2c/PictReader.java/buggy/loci/formats/PictReader.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 3238, 918, 1640, 21816, 1458, 12, 474, 11396, 13, 1216, 4077, 503, 288, 565, 309, 261, 9394, 13, 2332, 18, 659, 18, 8222, 2932, 52, 933, 2514, 18, 4110, 21816, 1458, 2932, 397, 11396, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 3238, 918, 1640, 21816, 1458, 12, 474, 11396, 13, 1216, 4077, 503, 288, 565, 309, 261, 9394, 13, 2332, 18, 659, 18, 8222, 2932, 52, 933, 2514, 18, 4110, 21816, 1458, 2932, 397, 11396, 3...
logger.debug("getting the parameter "+name);
public Object getParameter(String name) { if (parameterCache.containsKey(name)) { return parameterCache.get(name); } // end of if (parameterCache.containsKey(name)) NodeList nList = evalNodeList(config, "parameter[name/text()="+ dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { logger.debug("getting the parameter "+name); Node n = nList.item(0); if (n instanceof Element) { Object r = XMLParameter.getParameter((Element)n); parameterCache.put(name, r); return r; } } else { logger.debug("THE NODE LIST IS NULL for parameter "+name); } // not a parameter, try parameterRef nList = evalNodeList(config, "parameterRef[text()="+dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { Node n = nList.item(0); if (n instanceof Element) { SimpleXLink sl = new SimpleXLink(docBuilder, (Element)n); try { Element e = sl.retrieve(); parameterCache.put(name, e); return e; } catch (Exception e) { logger.error("can't get paramterRef for "+name, e); } // end of try-catch } } logger.warn("can't find paramter for "+name); //can't find that name??? return null; }
52623 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52623/107cbea8e016357ff8ac7691c533aef0ee25bf7a/XMLDataSet.java/clean/src/edu/sc/seis/fissuresUtil/xml/XMLDataSet.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 1033, 5575, 12, 780, 508, 13, 288, 3639, 309, 261, 6775, 1649, 18, 12298, 653, 12, 529, 3719, 288, 5411, 327, 1569, 1649, 18, 588, 12, 529, 1769, 3639, 289, 368, 679, 434, 309, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 1033, 5575, 12, 780, 508, 13, 288, 3639, 309, 261, 6775, 1649, 18, 12298, 653, 12, 529, 3719, 288, 5411, 327, 1569, 1649, 18, 588, 12, 529, 1769, 3639, 289, 368, 679, 434, 309, ...
this.parent = on.getParent();
this.parent = on;
private void findParent(ArrayList children) { if (children == null) return; for (int i = 0; i < children.size(); i++) { OutlineNode on = (OutlineNode) children.get(i); if (on.getIFile().equals(changedFile)) { this.parent = on.getParent(); this.position = i; return; } else { findParent(on.getChildren()); } if (parent != null) return; } }
48893 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/48893/b4523fb581766c61833df2f58139cd91b2c7fc6a/FullTexParser.java/buggy/source/net/sourceforge/texlipse/texparser/FullTexParser.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 1104, 3054, 12, 19558, 2325, 13, 288, 3639, 309, 261, 5906, 422, 446, 13, 5411, 327, 31, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 2325, 18, 1467, 5621, 277, 27245, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 1104, 3054, 12, 19558, 2325, 13, 288, 3639, 309, 261, 5906, 422, 446, 13, 5411, 327, 31, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 2325, 18, 1467, 5621, 277, 27245, ...
try { cl.getConstructor(EMPTY_CLASS_ARRAY); return true; } catch (NoSuchMethodException e) { return false;
try { cl.getConstructor(EMPTY_CLASS_ARRAY); return true; } catch (NoSuchMethodException e) { return false; }
protected static boolean checkNoArgsConstructor(Class cl) { try { cl.getConstructor(EMPTY_CLASS_ARRAY); return true; } catch (NoSuchMethodException e) { return false; } }
50951 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50951/5e6860c26fe200ecc080f3ddc3de5b5afad88243/MOP.java/clean/src/org/objectweb/proactive/core/mop/MOP.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 4750, 760, 1250, 866, 2279, 2615, 6293, 12, 797, 927, 13, 288, 565, 775, 288, 1377, 927, 18, 588, 6293, 12, 13625, 67, 5237, 67, 8552, 1769, 1377, 327, 638, 31, 565, 289, 1044, 261, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 4750, 760, 1250, 866, 2279, 2615, 6293, 12, 797, 927, 13, 288, 565, 775, 288, 1377, 927, 18, 588, 6293, 12, 13625, 67, 5237, 67, 8552, 1769, 1377, 327, 638, 31, 565, 289, 1044, 261, 2...
{ boolean erg; int count; erg = mReSessionFinished1.isMatch(fOutput); count = mReSessionFinished1.getAllMatches(fOutput).length; if( erg || (count > 0) ) return(true);
{ boolean erg; int count;
private boolean hasSessionTerminated(String fOutput) { boolean erg; int count; erg = mReSessionFinished1.isMatch(fOutput); count = mReSessionFinished1.getAllMatches(fOutput).length; if( erg || (count > 0) ) return(true); erg = mReSessionFinished2.isMatch(fOutput); count = mReSessionFinished2.getAllMatches(fOutput).length; if( erg || (count > 0) ) return(true); return(false); }
48756 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/48756/4179c9f6d0a36bc8b8ca5cdef30d4178930114cd/PerlDB.java/buggy/org.epic.debug/src/org/epic/debug/PerlDB.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1875, 202, 1152, 1250, 711, 2157, 21888, 12, 780, 284, 1447, 13, 1082, 202, 95, 9506, 202, 6494, 6445, 75, 31, 9506, 202, 474, 1056, 31, 6862, 1082, 202, 18639, 273, 225, 312, 426, 2157, 105...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1875, 202, 1152, 1250, 711, 2157, 21888, 12, 780, 284, 1447, 13, 1082, 202, 95, 9506, 202, 6494, 6445, 75, 31, 9506, 202, 474, 1056, 31, 6862, 1082, 202, 18639, 273, 225, 312, 426, 2157, 105...
ILabelEventHandler eh = ( ILabelEventHandler ) getInstance( ( LabelHandle ) labelDesign .getHandle( ) );
ILabelEventHandler eh = getEventHandler( labelDesign, context );
public static void handleOnCreate( LabelContent content, ExecutionContext context ) { try { ReportItemDesign labelDesign = ( ReportItemDesign ) content .getGenerateBy( ); ILabelInstance label = new LabelInstance( content, context ); if ( handleJS( label, labelDesign.getOnCreate( ), context ) .didRun( ) ) return; ILabelEventHandler eh = ( ILabelEventHandler ) getInstance( ( LabelHandle ) labelDesign .getHandle( ) ); if ( eh != null ) eh.onCreate( label, context.getReportContext( ) ); } catch ( Exception e ) { log.log( Level.WARNING, e.getMessage( ), e ); } }
46013 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46013/c0422a1db84842d1e332663c3d4c7e2a8109aca8/LabelScriptExecutor.java/clean/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/script/internal/LabelScriptExecutor.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 760, 918, 1640, 1398, 1684, 12, 5287, 1350, 913, 16, 1082, 202, 3210, 1042, 819, 262, 202, 95, 202, 202, 698, 202, 202, 95, 1082, 202, 4820, 1180, 15478, 1433, 15478, 273, 261...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 760, 918, 1640, 1398, 1684, 12, 5287, 1350, 913, 16, 1082, 202, 3210, 1042, 819, 262, 202, 95, 202, 202, 698, 202, 202, 95, 1082, 202, 4820, 1180, 15478, 1433, 15478, 273, 261...
.setDeveloperConnection( appendPath( parentScm.getDeveloperConnection(), child.getArtifactId(), childPathAdjustment, appendPaths ) );
.setDeveloperConnection( appendPath( parentScm.getDeveloperConnection(), child.getArtifactId(), childPathAdjustment, appendPaths ) );
private void assembleScmInheritance( Model child, Model parent, String childPathAdjustment, boolean appendPaths ) { if ( parent.getScm() != null ) { Scm parentScm = parent.getScm(); Scm childScm = child.getScm(); if ( childScm == null ) { childScm = new Scm(); child.setScm( childScm ); } if ( StringUtils.isEmpty( childScm.getConnection() ) && !StringUtils.isEmpty( parentScm.getConnection() ) ) { childScm.setConnection( appendPath( parentScm.getConnection(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); } if ( StringUtils.isEmpty( childScm.getDeveloperConnection() ) && !StringUtils.isEmpty( parentScm.getDeveloperConnection() ) ) { childScm .setDeveloperConnection( appendPath( parentScm.getDeveloperConnection(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); } if ( StringUtils.isEmpty( childScm.getUrl() ) && !StringUtils.isEmpty( parentScm.getUrl() ) ) { childScm.setUrl( appendPath( parentScm.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); } } }
48791 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/48791/ad38e46b4b6bbc3fb214b07966cc42877ecec536/DefaultModelInheritanceAssembler.java/buggy/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 19540, 1541, 81, 28255, 12, 3164, 1151, 16, 3164, 982, 16, 514, 1151, 743, 19985, 16, 1250, 714, 4466, 262, 565, 288, 3639, 309, 261, 982, 18, 588, 1541, 81, 1435, 480, 446, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 19540, 1541, 81, 28255, 12, 3164, 1151, 16, 3164, 982, 16, 514, 1151, 743, 19985, 16, 1250, 714, 4466, 262, 565, 288, 3639, 309, 261, 982, 18, 588, 1541, 81, 1435, 480, 446, ...
if( value instanceof Integer )
int parentValue = getColorValue( parentHandle.getProperty( name ) ); if( intValue != parentValue )
protected Object getDistinctColorProperty( DesignElementHandle handle, DesignElementHandle parentHandle, String name ) { Object value; Object parentValue; value = handle.getProperty( name ); parentValue = parentHandle.getProperty( name ); boolean canInherit = StyleDesign.canInherit( name ); int intValue = getColorValue( value ); if( value != null && ( !canInherit || intValue != getColorValue( parentValue ) ) && ( canInherit || intValue != getColorValue( StyleDesign.getDefaultValue( name ) ) ) ) { if( value instanceof Integer ) { return StringUtil.toRgbText( intValue ); } return value; } return null; }
5230 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5230/e29ffc4317fc1dab71e811072bd49e7d35a106d8/EngineIRVisitor.java/clean/engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/parser/EngineIRVisitor.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1117, 1033, 2343, 376, 7694, 2957, 1396, 12, 29703, 1046, 3259, 1640, 16, 29703, 1046, 3259, 982, 3259, 16, 514, 508, 262, 202, 95, 202, 202, 921, 460, 31, 202, 202, 921, 982, 620,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1117, 1033, 2343, 376, 7694, 2957, 1396, 12, 29703, 1046, 3259, 1640, 16, 29703, 1046, 3259, 982, 3259, 16, 514, 508, 262, 202, 95, 202, 202, 921, 460, 31, 202, 202, 921, 982, 620,...
RubyInteger depth = RubyFixnum.newFixnum(runtime, depthLimit);
RubyInteger depth = runtime.newFixnum(depthLimit);
private void userMarshal(IRubyObject value) throws IOException { out.write('u'); dumpObject(RubySymbol.newSymbol(runtime, value.getMetaClass().getName())); RubyInteger depth = RubyFixnum.newFixnum(runtime, depthLimit); RubyString marshaled = (RubyString) value.callMethod("_dump", depth); dumpString(marshaled.getValue()); }
47134 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/47134/870e1da9b41bfdbae259e1fc5f18fc8b76686998/MarshalStream.java/buggy/src/org/jruby/runtime/marshal/MarshalStream.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 729, 8105, 12, 7937, 10340, 921, 460, 13, 1216, 1860, 288, 3639, 596, 18, 2626, 2668, 89, 8284, 3639, 4657, 921, 12, 54, 10340, 5335, 18, 2704, 5335, 12, 9448, 16, 460, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 729, 8105, 12, 7937, 10340, 921, 460, 13, 1216, 1860, 288, 3639, 596, 18, 2626, 2668, 89, 8284, 3639, 4657, 921, 12, 54, 10340, 5335, 18, 2704, 5335, 12, 9448, 16, 460, 18, ...
" FROM " + table);
" FROM " + table);
private static void toXml(String table, String export, Connection connection, PrintWriter out) { ResultSet results; try { PreparedStatement prepStmt = connection.prepareStatement("SELECT * " + " FROM " + table); results = prepStmt.executeQuery(); toXml(export, results, out); } catch (SQLException e) { Logger.warn("Problems with query", e); } }
6853 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/6853/e6fbe7cf95e0d25c08ce2982da0aa38ac1ff28f2/XMLSnipExport.java/clean/src/org/snipsnap/snip/XMLSnipExport.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 3238, 760, 918, 358, 4432, 12, 780, 1014, 16, 514, 3359, 16, 4050, 1459, 16, 14071, 596, 13, 288, 565, 10842, 1686, 31, 565, 775, 288, 1377, 16913, 13237, 8952, 273, 1459, 18, 9366, 340...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 3238, 760, 918, 358, 4432, 12, 780, 1014, 16, 514, 3359, 16, 4050, 1459, 16, 14071, 596, 13, 288, 565, 10842, 1686, 31, 565, 775, 288, 1377, 16913, 13237, 8952, 273, 1459, 18, 9366, 340...
public int ReceiveIntegerR(int siz) throws SQLException { int n = 0; try { for (int i = 0 ; i < siz ; i++) { int b = pg_input.read(); if (b < 0) throw new PSQLException("postgresql.stream.eof"); n = b | (n << 8); } } catch (IOException e) { throw new PSQLException("postgresql.stream.ioerror",e); } return n; }
45534 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/45534/45b5d792afa60ae24d57cdceaaec0e03cf6abb2a/PG_Stream.java/clean/src/interfaces/jdbc/org/postgresql/PG_Stream.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 509, 17046, 4522, 54, 12, 474, 272, 452, 13, 1216, 6483, 225, 288, 565, 509, 290, 273, 374, 31, 3639, 775, 1377, 288, 202, 1884, 261, 474, 277, 273, 374, 274, 277, 411, 272, 452...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 509, 17046, 4522, 54, 12, 474, 272, 452, 13, 1216, 6483, 225, 288, 565, 509, 290, 273, 374, 31, 3639, 775, 1377, 288, 202, 1884, 261, 474, 277, 273, 374, 274, 277, 411, 272, 452...
boolean needsActivation = theFunction.requiresActivation() || (cx.isGeneratingDebugChanged() && cx.isGeneratingDebug());
generateFunctionICode(Context cx, Scriptable scope, FunctionNode theFunction, Object securityDomain) { itsFunctionList = (Vector) theFunction.getProp(Node.FUNCTION_PROP); if (itsFunctionList != null) generateNestedFunctions(scope, cx, securityDomain); Object[] regExpLiterals = null; Vector regexps = (Vector)theFunction.getProp(Node.REGEXP_PROP); if (regexps != null) regExpLiterals = generateRegExpLiterals(cx, scope, regexps); VariableTable varTable = theFunction.getVariableTable(); boolean needsActivation = theFunction.requiresActivation() || (cx.isGeneratingDebugChanged() && cx.isGeneratingDebug()); generateICodeFromTree(theFunction.getLastChild(), varTable, needsActivation, securityDomain); itsData.itsName = theFunction.getFunctionName(); itsData.itsSourceFile = (String) theFunction.getProp( Node.SOURCENAME_PROP); itsData.itsSource = (String)theFunction.getProp(Node.SOURCE_PROP); itsData.itsNestedFunctions = itsNestedFunctions; itsData.itsRegExpLiterals = regExpLiterals; if (Context.printICode) dumpICode(itsData); String[] argNames = itsVariableTable.getAllNames(); short argCount = (short)itsVariableTable.getParameterCount(); InterpretedFunction result = new InterpretedFunction(cx, itsData, argNames, argCount); if (cx.debugger != null) { cx.debugger.handleCompilationDone(cx, result, debugSource); } return result; }
19042 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/19042/7428722e07fb7aeade46073089cc157f1f3e68dd/Interpreter.java/clean/src/org/mozilla/javascript/Interpreter.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 2103, 2083, 45, 1085, 12, 1042, 9494, 16, 22780, 2146, 16, 12900, 4284, 907, 326, 2083, 16, 1033, 4373, 3748, 13, 565, 288, 3639, 2097, 2083, 682, 273, 261, 5018, 13, 326, 2083, 18, 588...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 2103, 2083, 45, 1085, 12, 1042, 9494, 16, 22780, 2146, 16, 12900, 4284, 907, 326, 2083, 16, 1033, 4373, 3748, 13, 565, 288, 3639, 2097, 2083, 682, 273, 261, 5018, 13, 326, 2083, 18, 588...
if (descriptor != null) { return ((WorkingSetManager) manager).getElementAdapter(
if (descriptor == null || !descriptor.isElementAdapterClassLoaded()) return objects; return ((WorkingSetManager) manager).getElementAdapter(
public IAdaptable[] adaptElements(IAdaptable[] objects) { IWorkingSetManager manager = getManager(); if (manager instanceof WorkingSetManager) { WorkingSetDescriptor descriptor = getDescriptor(null); if (descriptor != null) { return ((WorkingSetManager) manager).getElementAdapter( descriptor).adaptElements(this, objects); } } return objects; }
56152 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/56152/76bca2eb20ef3ae0657a216bd3ce1b430362d7f5/WorkingSet.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 467, 13716, 429, 8526, 5855, 3471, 12, 45, 13716, 429, 8526, 2184, 13, 288, 202, 202, 45, 14836, 694, 1318, 3301, 273, 14154, 5621, 202, 202, 430, 261, 4181, 1276, 22732, 694, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 467, 13716, 429, 8526, 5855, 3471, 12, 45, 13716, 429, 8526, 2184, 13, 288, 202, 202, 45, 14836, 694, 1318, 3301, 273, 14154, 5621, 202, 202, 430, 261, 4181, 1276, 22732, 694, ...
public Map completeStatus(Map statuses, String path, boolean descend) { // iterate all paths, // move matched to a special array String relativePath = path.substring(myRootPath.length()); relativePath = PathUtil.removeLeadingSlash(relativePath); Collection remoteMatches = new LinkedList(); for(Iterator remotePaths = myRemoteStatuses.keySet().iterator(); remotePaths.hasNext();) { String remotePath = (String) remotePaths.next(); if (remotePath.startsWith(relativePath)) { String name = remotePath.substring(relativePath.length()); name = PathUtil.removeLeadingSlash(name); if (name.indexOf('/') < 0) { // it is a direct child of path, add only if there is a status or nothing. if ((statuses.containsKey(name) && statuses.get(name) != null) || !statuses.containsKey(name)) { remoteMatches.add(remotePath); } } else if (descend) { // check that it is not child of existing direct child. String head = PathUtil.head(name); if (!statuses.containsKey(head)) { remoteMatches.add(remotePath); } } } } DebugLog.log("COMPLETING STATUS FOR " + path + " : " + statuses.keySet()); DebugLog.log("REMOTE MATCHED ENTRIES " + remoteMatches); for(Iterator remotePaths = remoteMatches.iterator(); remotePaths.hasNext();) { String remotePath = (String) remotePaths.next(); String name = remotePath.substring(relativePath.length()); name = PathUtil.removeLeadingSlash(name); RemoteSVNStatus remoteStatus = (RemoteSVNStatus) myRemoteStatuses.remove(remotePath); if (remoteStatus == null) { continue; } SVNStatus svnStatus = (SVNStatus) statuses.get(name); if (svnStatus != null) { svnStatus.setRemoteStatus(remoteStatus.myRevision, remoteStatus.myPropertiesStatus, remoteStatus.myContentsStatus); } else { svnStatus = new SVNStatus(PathUtil.removeLeadingSlash(PathUtil.append(path, name)), 0, 0, -1, -1, remoteStatus.myRevision, remoteStatus.myContentsStatus, remoteStatus.myPropertiesStatus, remoteStatus.isAddedWithHistory, false, remoteStatus.isDirectory, null); statuses.put(name, svnStatus); } } return statuses; }
2776 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/2776/e542a7b97ff75f9b09fa49a767ceec5203f3229b/SVNStatusEditor.java/buggy/javasvn/src/org/tmatesoft/svn/core/internal/SVNStatusEditor.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1071, 863, 6226, 1482, 12, 863, 21655, 16, 780, 803, 16, 1075, 790, 464, 742, 409, 15329, 759, 18793, 454, 4481, 16, 759, 81, 1527, 351, 505, 329, 869, 345, 705, 649, 1126, 780, 11626, 743, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1071, 863, 6226, 1482, 12, 863, 21655, 16, 780, 803, 16, 1075, 790, 464, 742, 409, 15329, 759, 18793, 454, 4481, 16, 759, 81, 1527, 351, 505, 329, 869, 345, 705, 649, 1126, 780, 11626, 743, ...
this.cacheDir = cacheDir;
ArchiveManager(int maxHandlers, long maxCachedData, long maxArchiveSize, long maxArchivedFileSize, int maxCachedElements, File cacheDir, RandomSource random) { maxArchiveHandlers = maxHandlers; archiveHandlers = new LRUHashtable(); cachedElements = new LRUHashtable(); this.maxCachedElements = maxCachedElements; this.maxCachedData = maxCachedData; this.cacheDir = cacheDir; storedData = new LRUHashtable(); this.maxArchiveSize = maxArchiveSize; this.maxArchivedFileSize = maxArchivedFileSize; this.random = random; }
50653 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50653/ae3ccb61c1609ac123f2a825e60ff11564556df6/ArchiveManager.java/buggy/src/freenet/client/ArchiveManager.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 7465, 1318, 12, 474, 943, 6919, 16, 1525, 943, 9839, 751, 16, 1525, 943, 7465, 1225, 16, 1525, 943, 12269, 2950, 15100, 16, 509, 943, 9839, 3471, 16, 1387, 19946, 16, 8072, 1830, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 7465, 1318, 12, 474, 943, 6919, 16, 1525, 943, 9839, 751, 16, 1525, 943, 7465, 1225, 16, 1525, 943, 12269, 2950, 15100, 16, 509, 943, 9839, 3471, 16, 1387, 19946, 16, 8072, 1830, 2...
else {
else if (ServerDetector.isWebSphere()) {
public static String getServerId() { ServerDetector sd = _instance; if (sd._serverId == null) { if (ServerDetector.isJBoss()) { sd._serverId = "jboss"; } else if (ServerDetector.isJetty()) { sd._serverId = "jetty"; } else if (ServerDetector.isOC4J()) { sd._serverId = "oc4j"; } else if (ServerDetector.isOrion()) { sd._serverId = "orion"; } else if (ServerDetector.isResin()) { sd._serverId = "resin"; } else if (ServerDetector.isTomcat()) { sd._serverId = "tomcat"; } else if (ServerDetector.isWebLogic()) { sd._serverId = "weblogic"; } else { sd._serverId = "websphere"; } } return sd._serverId; }
53908 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53908/b5cc9c4eaf4897f51730cc777f5af4a427b25232/ServerDetector.java/buggy/portal-shared/src/com/liferay/portal/shared/util/ServerDetector.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 760, 514, 11543, 548, 1435, 288, 202, 202, 2081, 12594, 8349, 273, 389, 1336, 31, 202, 202, 430, 261, 6427, 6315, 3567, 548, 422, 446, 13, 288, 1082, 202, 430, 261, 2081, 1259...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 760, 514, 11543, 548, 1435, 288, 202, 202, 2081, 12594, 8349, 273, 389, 1336, 31, 202, 202, 430, 261, 6427, 6315, 3567, 548, 422, 446, 13, 288, 1082, 202, 430, 261, 2081, 1259...
if ( ca.getShadowColor( ) != null )
if ( !isDimension3D( ) )
protected void renderBackground( IPrimitiveRenderer ipr, Plot p ) throws ChartException { // PLOT BLOCK STUFF super.renderBackground( ipr, p ); final ChartWithAxes cwa = (ChartWithAxes) getModel( ); final PlotWithAxes pwa = (PlotWithAxes) getComputations( ); // PLOT CLIENT AREA final ClientArea ca = p.getClientArea( ); Bounds bo = pwa.getPlotBounds( ); final RectangleRenderEvent rre = (RectangleRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), RectangleRenderEvent.class ); // render client area shadow if ( ca.getShadowColor( ) != null ) { rre.setBounds( bo.translateInstance( 3, 3 ) ); rre.setBackground( ca.getShadowColor( ) ); ipr.fillRectangle( rre ); } // render client area rre.setBounds( bo ); rre.setOutline( ca.getOutline( ) ); rre.setBackground( ca.getBackground( ) ); ipr.fillRectangle( rre ); // NOW THAT THE AXES HAVE BEEN COMPUTED, FILL THE INTERNAL PLOT AREA double dSeriesThickness = pwa.getSeriesThickness( ); double[] daX = { bo.getLeft( ) - dSeriesThickness, bo.getLeft( ) + bo.getWidth( ) - dSeriesThickness }; double[] daY = { bo.getTop( ) + bo.getHeight( ) + dSeriesThickness, bo.getTop( ) + dSeriesThickness }; final AllAxes aax = pwa.getAxes( ); AutoScale scPrimaryBase = null; AutoScale scPrimaryOrthogonal = null; AutoScale scAncillaryBase = null; double dXStart = 0; double dYStart = 0; double dZStart = 0; double dXEnd = 0; double dYEnd = 0; double dZEnd = 0; int baseTickCount = 0; int ancillaryTickCount = 0; int orthogonalTickCount = 0; double xStep = 0; double yStep = 0; double zStep = 0; if ( isDimension3D( ) ) { scPrimaryBase = aax.getPrimaryBase( ).getScale( ); scPrimaryOrthogonal = aax.getPrimaryOrthogonal( ).getScale( ); scAncillaryBase = aax.getAncillaryBase( ).getScale( ); dXStart = scPrimaryBase.getStart( ); dYStart = scPrimaryOrthogonal.getStart( ); dZStart = scAncillaryBase.getStart( ); dXEnd = scPrimaryBase.getEnd( ); dYEnd = scPrimaryOrthogonal.getEnd( ); dZEnd = scAncillaryBase.getEnd( ); baseTickCount = scPrimaryBase.getTickCordinates( ).length; ancillaryTickCount = scAncillaryBase.getTickCordinates( ).length; orthogonalTickCount = scPrimaryOrthogonal.getTickCordinates( ).length; xStep = scPrimaryBase.getUnitSize( ); yStep = scPrimaryOrthogonal.getUnitSize( ); zStep = scAncillaryBase.getUnitSize( ); } if ( pwa.getDimension( ) == IConstants.TWO_5_D ) { Location[] loa = null; // DRAW THE LEFT WALL if ( cwa.getWallFill( ) == null ) { renderPlane( ipr, StructureSource.createPlot( p ), new Location[]{ LocationImpl.create( daX[0], daY[0] ), LocationImpl.create( daX[0], daY[1] ) }, ca.getBackground( ), ca.getOutline( ), cwa.getDimension( ), dSeriesThickness, false ); } else { loa = new Location[4]; loa[0] = LocationImpl.create( daX[0], daY[0] ); loa[1] = LocationImpl.create( daX[0], daY[1] ); loa[2] = LocationImpl.create( daX[0] + dSeriesThickness, daY[1] - dSeriesThickness ); loa[3] = LocationImpl.create( daX[0] + dSeriesThickness, daY[0] - dSeriesThickness ); final PolygonRenderEvent pre = (PolygonRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), PolygonRenderEvent.class ); pre.setPoints( loa ); pre.setBackground( cwa.getWallFill( ) ); pre.setOutline( ca.getOutline( ) ); ipr.fillPolygon( pre ); ipr.drawPolygon( pre ); } // DRAW THE FLOOR if ( cwa.getFloorFill( ) == null ) { renderPlane( ipr, StructureSource.createPlot( p ), new Location[]{ LocationImpl.create( daX[0], daY[0] ), LocationImpl.create( daX[1], daY[0] ) }, ca.getBackground( ), ca.getOutline( ), cwa.getDimension( ), dSeriesThickness, false ); } else { if ( loa == null ) { loa = new Location[4]; } loa[0] = LocationImpl.create( daX[0], daY[0] ); loa[1] = LocationImpl.create( daX[1], daY[0] ); loa[2] = LocationImpl.create( daX[1] + dSeriesThickness, daY[0] - dSeriesThickness ); loa[3] = LocationImpl.create( daX[0] + dSeriesThickness, daY[0] - dSeriesThickness ); final PolygonRenderEvent pre = (PolygonRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), PolygonRenderEvent.class ); pre.setPoints( loa ); pre.setBackground( cwa.getFloorFill( ) ); pre.setOutline( ca.getOutline( ) ); ipr.fillPolygon( pre ); ipr.drawPolygon( pre ); } } else if ( pwa.getDimension( ) == IConstants.THREE_D ) { Location3D[] loa = null; final Polygon3DRenderEvent pre = (Polygon3DRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), Polygon3DRenderEvent.class ); pre.setDoubleSided( true ); // DRAW THE WALL if ( ( cwa.getWallFill( ) instanceof ColorDefinition && ( (ColorDefinition) cwa.getWallFill( ) ).getTransparency( ) > 0 ) || ( !( cwa.getWallFill( ) instanceof ColorDefinition ) && cwa.getWallFill( ) != null ) ) { loa = new Location3D[4]; // Left Wall loa[0] = Location3DImpl.create( dXStart, dYStart, dZStart ); loa[1] = Location3DImpl.create( dXStart, dYEnd, dZStart ); loa[2] = Location3DImpl.create( dXStart, dYEnd, dZEnd ); loa[3] = Location3DImpl.create( dXStart, dYStart, dZEnd ); pre.setPoints3D( loa ); pre.setBackground( cwa.getWallFill( ) ); pre.setDoubleSided( true ); pre.setOutline( ca.getOutline( ) ); getDeferredCache( ).addPlane( pre, PrimitiveRenderEvent.DRAW | PrimitiveRenderEvent.FILL ); // // split to small planes to render. // for ( int i = 0; i < orthogonalTickCount - 1; i++ ) // { // for ( int j = 0; j < ancillaryTickCount - 1; j++ ) // { // loa[0] = Location3DImpl.create( dXStart, dYStart // + yStep // * i, dZStart + zStep * j ); // loa[1] = Location3DImpl.create( dXStart, dYStart // + ( i + 1 ) // * yStep, dZStart + j * zStep ); // loa[2] = Location3DImpl.create( dXStart, dYStart // + ( i + 1 ) // * yStep, dZStart + ( j + 1 ) * zStep ); // loa[3] = Location3DImpl.create( dXStart, dYStart // + i // * yStep, dZStart + ( j + 1 ) * zStep ); // pre.setPoints3D( loa ); // pre.setBackground( cwa.getWallFill( ) ); // pre.setOutline( ca.getOutline( ) ); // getDeferredCache( ).addPlane( pre, // PrimitiveRenderEvent.DRAW // | PrimitiveRenderEvent.FILL ); // } // } leftWallFill = true; // Right Wall loa[0] = Location3DImpl.create( dXStart, dYStart, dZStart ); loa[1] = Location3DImpl.create( dXEnd, dYStart, dZStart ); loa[2] = Location3DImpl.create( dXEnd, dYEnd, dZStart ); loa[3] = Location3DImpl.create( dXStart, dYEnd, dZStart ); pre.setPoints3D( loa ); pre.setBackground( cwa.getWallFill( ) ); pre.setDoubleSided( true ); pre.setOutline( ca.getOutline( ) ); getDeferredCache( ).addPlane( pre, PrimitiveRenderEvent.DRAW | PrimitiveRenderEvent.FILL ); // // split to small planes to render. // for ( int i = 0; i < orthogonalTickCount - 1; i++ ) // { // for ( int j = 0; j < baseTickCount - 1; j++ ) // { // loa[0] = Location3DImpl.create( dXStart + j * xStep, // dYStart + i * yStep, // dZStart ); // loa[1] = Location3DImpl.create( dXStart // + ( j + 1 ) // * xStep, dYStart + i * yStep, dZStart ); // loa[2] = Location3DImpl.create( dXStart // + ( j + 1 ) // * xStep, dYStart + ( i + 1 ) * yStep, dZStart ); // loa[3] = Location3DImpl.create( dXStart + j * xStep, // dYStart + ( i + 1 ) * yStep, // dZStart ); // pre.setPoints3D( loa ); // pre.setBackground( cwa.getWallFill( ) ); // pre.setOutline( ca.getOutline( ) ); // getDeferredCache( ).addPlane( pre, // PrimitiveRenderEvent.DRAW // | PrimitiveRenderEvent.FILL ); // } // } rightWallFill = true; } // DRAW THE FLOOR if ( ( cwa.getFloorFill( ) instanceof ColorDefinition && ( (ColorDefinition) cwa.getFloorFill( ) ).getTransparency( ) > 0 ) || ( !( cwa.getFloorFill( ) instanceof ColorDefinition ) && cwa.getFloorFill( ) != null ) ) { if ( loa == null ) { loa = new Location3D[4]; } loa[0] = Location3DImpl.create( dXStart, dYStart, dZStart ); loa[1] = Location3DImpl.create( dXStart, dYStart, dZEnd ); loa[2] = Location3DImpl.create( dXEnd, dYStart, dZEnd ); loa[3] = Location3DImpl.create( dXEnd, dYStart, dZStart ); pre.setPoints3D( loa ); pre.setBackground( cwa.getFloorFill( ) ); pre.setDoubleSided( true ); pre.setOutline( ca.getOutline( ) ); getDeferredCache( ).addPlane( pre, PrimitiveRenderEvent.DRAW | PrimitiveRenderEvent.FILL ); // // split to small planes to render. // for ( int i = 0; i < baseTickCount - 1; i++ ) // { // for ( int j = 0; j < ancillaryTickCount - 1; j++ ) // { // loa[0] = Location3DImpl.create( dXStart + i * xStep, // dYStart, // dZStart + j * zStep ); // loa[1] = Location3DImpl.create( dXStart + i * xStep, // dYStart, // dZStart + ( j + 1 ) * zStep ); // loa[2] = Location3DImpl.create( dXStart // + ( i + 1 ) // * xStep, dYStart, dZStart + ( j + 1 ) * zStep ); // loa[3] = Location3DImpl.create( dXStart // + ( i + 1 ) // * xStep, dYStart, dZStart + j * zStep ); // pre.setPoints3D( loa ); // pre.setBackground( cwa.getFloorFill( ) ); // pre.setOutline( ca.getOutline( ) ); // getDeferredCache( ).addPlane( pre, // PrimitiveRenderEvent.DRAW // | PrimitiveRenderEvent.FILL ); // } // } floorFill = true; } } // SETUP AXIS ARRAY final OneAxis[] oaxa = new OneAxis[2 + aax.getOverlayCount( ) + ( aax.getAncillaryBase( ) != null ? 1 : 0 )]; oaxa[0] = aax.getPrimaryBase( ); oaxa[1] = aax.getPrimaryOrthogonal( ); for ( int i = 0; i < aax.getOverlayCount( ); i++ ) { oaxa[2 + i] = aax.getOverlay( i ); } if ( aax.getAncillaryBase( ) != null ) { oaxa[2 + aax.getOverlayCount( )] = aax.getAncillaryBase( ); } // RENDER MARKER RANGES (MARKER LINES ARE DRAWN LATER) renderMarkerRanges( oaxa, bo ); // RENDER GRID LINES (MAJOR=DONE; MINOR=DONE) double x = 0, y = 0, vnext = 0; LineAttributes lia; LineRenderEvent lre; final Insets insCA = aax.getInsets( ); // RENDER MINOR GRID LINES FIRST int iCount; Grid g; double[] doaMinor = null; for ( int i = 0; i < oaxa.length; i++ ) { g = oaxa[i].getGrid( ); iCount = g.getMinorCountPerMajor( ); lia = oaxa[i].getGrid( ).getLineAttributes( IConstants.MINOR ); if ( lia == null || !lia.isSetStyle( ) || !lia.isVisible( ) ) { continue; } if ( iCount <= 0 ) { throw new ChartException( ChartEnginePlugin.ID, ChartException.RENDERING, "exception.cannot.split.major", //$NON-NLS-1$ new Object[]{ new Integer( iCount ) }, Messages.getResourceBundle( getRunTimeContext( ).getULocale( ) ) ); } AutoScale sc = oaxa[i].getScale( ); doaMinor = sc.getMinorCoordinates( iCount ); if ( isDimension3D( ) ) { Line3DRenderEvent lre3d = (Line3DRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), Line3DRenderEvent.class ); lre3d.setLineAttributes( lia ); switch ( oaxa[i].getAxisType( ) ) { case IConstants.BASE_AXIS : double[] xa = scPrimaryBase.getTickCordinates( ); if ( floorFill ) { for ( int k = 0; k < xa.length - 1; k++ ) { for ( int j = 0; j < doaMinor.length - 1; j++ ) { for ( int n = 0; n < ancillaryTickCount - 1; n++ ) { if ( xa[k] + doaMinor[j] >= xa[k + 1] ) { // if current minor tick exceed the // range of current unit, skip continue; } lre3d.setStart3D( Location3DImpl.create( xa[k] + doaMinor[j], dYStart, dZStart + n * zStep ) ); lre3d.setEnd3D( Location3DImpl.create( xa[k] + doaMinor[j], dYStart, dZStart + ( n + 1 ) * zStep ) ); getDeferredCache( ).addLine( lre3d ); } } } } if ( rightWallFill ) { for ( int k = 0; k < xa.length - 1; k++ ) { for ( int j = 0; j < doaMinor.length - 1; j++ ) { for ( int n = 0; n < orthogonalTickCount - 1; n++ ) { if ( xa[k] + doaMinor[j] >= xa[k + 1] ) { // if current minor tick exceed the // range of current unit, skip continue; } lre3d.setStart3D( Location3DImpl.create( xa[k] + doaMinor[j], dYStart + n * yStep, dZStart ) ); lre3d.setEnd3D( Location3DImpl.create( xa[k] + doaMinor[j], dYStart + ( n + 1 ) * yStep, dZStart ) ); getDeferredCache( ).addLine( lre3d ); } } } } break; case IConstants.ORTHOGONAL_AXIS : double[] ya = scPrimaryOrthogonal.getTickCordinates( ); if ( leftWallFill ) { for ( int k = 0; k < ya.length - 1; k++ ) { for ( int j = 0; j < doaMinor.length - 1; j++ ) { for ( int n = 0; n < ancillaryTickCount - 1; n++ ) { if ( ya[k] + doaMinor[j] >= ya[k + 1] ) { // if current minor tick exceed the // range of current unit, skip continue; } lre3d.setStart3D( Location3DImpl.create( dXStart, ya[k] + doaMinor[j], dZStart + n * zStep ) ); lre3d.setEnd3D( Location3DImpl.create( dXStart, ya[k] + doaMinor[j], dZStart + ( n + 1 ) * zStep ) ); getDeferredCache( ).addLine( lre3d ); } } } } if ( rightWallFill ) { for ( int k = 0; k < ya.length - 1; k++ ) { for ( int j = 0; j < doaMinor.length - 1; j++ ) { for ( int n = 0; n < baseTickCount - 1; n++ ) { if ( ya[k] + doaMinor[j] >= ya[k + 1] ) { // if current minor tick exceed the // range of current unit, skip continue; } lre3d.setStart3D( Location3DImpl.create( dXStart + n * xStep, ya[k] + doaMinor[j], dZStart ) ); lre3d.setEnd3D( Location3DImpl.create( dXStart + ( n + 1 ) * xStep, ya[k] + doaMinor[j], dZStart ) ); getDeferredCache( ).addLine( lre3d ); } } } } break; case IConstants.ANCILLARY_AXIS : double[] za = scAncillaryBase.getTickCordinates( ); if ( leftWallFill ) { for ( int k = 0; k < za.length - 1; k++ ) { for ( int j = 0; j < doaMinor.length - 1; j++ ) { for ( int n = 0; n < orthogonalTickCount - 1; n++ ) { if ( za[k] + doaMinor[j] >= za[k + 1] ) { // if current minor tick exceed the // range of current unit, skip continue; } lre3d.setStart3D( Location3DImpl.create( dXStart, dYStart + n * yStep, za[k] + doaMinor[j] ) ); lre3d.setEnd3D( Location3DImpl.create( dXStart, dYStart + ( n + 1 ) * yStep, za[k] + doaMinor[j] ) ); getDeferredCache( ).addLine( lre3d ); } } } } if ( floorFill ) { for ( int k = 0; k < za.length - 1; k++ ) { for ( int j = 0; j < doaMinor.length - 1; j++ ) { for ( int n = 0; n < baseTickCount - 1; n++ ) { if ( za[k] + doaMinor[j] >= za[k + 1] ) { // if current minor tick exceed the // range of current unit, skip continue; } lre3d.setStart3D( Location3DImpl.create( dXStart + n * xStep, dYStart, za[k] + doaMinor[j] ) ); lre3d.setEnd3D( Location3DImpl.create( dXStart + ( n + 1 ) * xStep, dYStart, za[k] + doaMinor[j] ) ); getDeferredCache( ).addLine( lre3d ); } } } } break; default : break; } } else if ( oaxa[i].getOrientation( ) == IConstants.HORIZONTAL ) { int iDirection = sc.getDirection( ) == IConstants.BACKWARD ? -1 : 1; double[] da = sc.getTickCordinates( ); double dY2 = bo.getTop( ) + 1, dY1 = bo.getTop( ) + bo.getHeight( ) - 2; if ( pwa.getDimension( ) == IConstants.TWO_5_D ) { for ( int j = 0; j < da.length - 1; j++ ) { x = da[j]; for ( int k = 0; k < doaMinor.length; k++ ) { if ( ( iDirection == 1 && x + doaMinor[k] >= da[j + 1] ) || ( iDirection == -1 && x - doaMinor[k] <= da[j + 1] ) ) { // if current minor tick exceed the // range of current unit, skip continue; } lre = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), LineRenderEvent.class ); lre.setLineAttributes( lia ); lre.setStart( LocationImpl.create( x + iDirection * doaMinor[k], dY1 + pwa.getSeriesThickness( ) ) ); lre.setEnd( LocationImpl.create( x + iDirection * doaMinor[k] + pwa.getSeriesThickness( ), dY1 ) ); ipr.drawLine( lre ); } } } for ( int j = 0; j < da.length - 1; j++ ) { x = da[j]; vnext = da[j + 1]; if ( pwa.getDimension( ) == IConstants.TWO_5_D ) { x += pwa.getSeriesThickness( ); vnext += pwa.getSeriesThickness( ); } for ( int k = 0; k < doaMinor.length; k++ ) { if ( ( iDirection == 1 && x + doaMinor[k] >= vnext ) || ( iDirection == -1 && x - doaMinor[k] <= vnext ) ) { // if current minor tick exceed the // range of current unit, skip continue; } lre = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), LineRenderEvent.class ); lre.setLineAttributes( lia ); lre.setStart( LocationImpl.create( x + iDirection * doaMinor[k], dY1 ) ); lre.setEnd( LocationImpl.create( x + iDirection * doaMinor[k], dY2 ) ); ipr.drawLine( lre ); } } } else if ( oaxa[i].getOrientation( ) == IConstants.VERTICAL ) { int iDirection = sc.getDirection( ) != IConstants.FORWARD ? -1 : 1; double[] da = sc.getTickCordinates( ); double dX1 = bo.getLeft( ) + 1, dX2 = bo.getLeft( ) + bo.getWidth( ) - 2; if ( pwa.getDimension( ) == IConstants.TWO_5_D ) { for ( int j = 0; j < da.length - 1; j++ ) { y = da[j] - pwa.getSeriesThickness( ); vnext = da[j + 1] - pwa.getSeriesThickness( ); for ( int k = 0; k < doaMinor.length; k++ ) { if ( ( iDirection == 1 && y + doaMinor[k] >= vnext ) || ( iDirection == -1 && y - doaMinor[k] <= vnext ) ) { // if current minor tick exceed the // range of current unit, skip continue; } lre = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), LineRenderEvent.class ); lre.setLineAttributes( lia ); lre.setStart( LocationImpl.create( dX1, y + iDirection * doaMinor[k] ) ); lre.setEnd( LocationImpl.create( dX1 - pwa.getSeriesThickness( ), y + iDirection * doaMinor[k] + pwa.getSeriesThickness( ) ) ); ipr.drawLine( lre ); } } } for ( int j = 0; j < da.length - 1; j++ ) { y = da[j]; vnext = da[j + 1]; if ( pwa.getDimension( ) == IConstants.TWO_5_D ) { y -= pwa.getSeriesThickness( ); vnext -= pwa.getSeriesThickness( ); } for ( int k = 0; k < doaMinor.length; k++ ) { if ( ( iDirection == 1 && y + doaMinor[k] >= vnext ) || ( iDirection == -1 && y - doaMinor[k] <= vnext ) ) { // if current minor tick exceed the // range of current unit, skip continue; } lre = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), LineRenderEvent.class ); lre.setLineAttributes( lia ); lre.setStart( LocationImpl.create( dX1, y + iDirection * doaMinor[k] ) ); lre.setEnd( LocationImpl.create( dX2, y + iDirection * doaMinor[k] ) ); ipr.drawLine( lre ); } } } } // RENDER MAJOR GRID LINES NEXT for ( int i = 0; i < oaxa.length; i++ ) { lia = oaxa[i].getGrid( ).getLineAttributes( IConstants.MAJOR ); if ( lia == null || !lia.isSetStyle( ) || !lia.isVisible( ) ) // GRID // LINE // UNDEFINED { continue; } AutoScale sc = oaxa[i].getScale( ); if ( isDimension3D( ) ) { Line3DRenderEvent lre3d = (Line3DRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), Line3DRenderEvent.class ); lre3d.setLineAttributes( lia ); switch ( oaxa[i].getAxisType( ) ) { case IConstants.BASE_AXIS : double[] xa = scPrimaryBase.getTickCordinates( ); if ( floorFill ) { for ( int k = 0; k < xa.length; k++ ) { for ( int j = 0; j < ancillaryTickCount - 1; j++ ) { lre3d.setStart3D( Location3DImpl.create( xa[k], dYStart, dZStart + j * zStep ) ); lre3d.setEnd3D( Location3DImpl.create( xa[k], dYStart, dZStart + ( j + 1 ) * zStep ) ); getDeferredCache( ).addLine( lre3d ); } } } if ( rightWallFill ) { for ( int k = 0; k < xa.length; k++ ) { for ( int j = 0; j < orthogonalTickCount - 1; j++ ) { lre3d.setStart3D( Location3DImpl.create( xa[k], dYStart + j * yStep, dZStart ) ); lre3d.setEnd3D( Location3DImpl.create( xa[k], dYStart + ( j + 1 ) * yStep, dZStart ) ); getDeferredCache( ).addLine( lre3d ); } } } break; case IConstants.ORTHOGONAL_AXIS : double[] ya = scPrimaryOrthogonal.getTickCordinates( ); if ( leftWallFill ) { for ( int k = 0; k < ya.length; k++ ) { for ( int j = 0; j < ancillaryTickCount - 1; j++ ) { lre3d.setStart3D( Location3DImpl.create( dXStart, ya[k], dZStart + j * zStep ) ); lre3d.setEnd3D( Location3DImpl.create( dXStart, ya[k], dZStart + ( j + 1 ) * zStep ) ); getDeferredCache( ).addLine( lre3d ); } } } if ( rightWallFill ) { for ( int k = 0; k < ya.length; k++ ) { for ( int j = 0; j < baseTickCount - 1; j++ ) { lre3d.setStart3D( Location3DImpl.create( dXStart + j * xStep, ya[k], dZStart ) ); lre3d.setEnd3D( Location3DImpl.create( dXStart + ( j + 1 ) * xStep, ya[k], dZStart ) ); getDeferredCache( ).addLine( lre3d ); } } } break; case IConstants.ANCILLARY_AXIS : double[] za = scAncillaryBase.getTickCordinates( ); if ( leftWallFill ) { for ( int k = 0; k < za.length; k++ ) { for ( int j = 0; j < orthogonalTickCount - 1; j++ ) { lre3d.setStart3D( Location3DImpl.create( dXStart, dYStart + j * yStep, za[k] ) ); lre3d.setEnd3D( Location3DImpl.create( dXStart, dYStart + ( j + 1 ) * yStep, za[k] ) ); getDeferredCache( ).addLine( lre3d ); } } } if ( floorFill ) { for ( int k = 0; k < za.length; k++ ) { for ( int j = 0; j < baseTickCount - 1; j++ ) { lre3d.setStart3D( Location3DImpl.create( dXStart + j * xStep, dYStart, za[k] ) ); lre3d.setEnd3D( Location3DImpl.create( dXStart + ( j + 1 ) * xStep, dYStart, za[k] ) ); getDeferredCache( ).addLine( lre3d ); } } } break; default : break; } } else if ( oaxa[i].getOrientation( ) == IConstants.HORIZONTAL ) { double[] da = sc.getTickCordinates( ); double dY2 = bo.getTop( ) + 1, dY1 = bo.getTop( ) + bo.getHeight( ) - 2; if ( pwa.getDimension( ) == IConstants.TWO_5_D ) { for ( int j = 0; j < da.length; j++ ) { if ( j == 0 && insCA.getBottom( ) < lia.getThickness( ) ) continue; if ( j == da.length - 1 && insCA.getTop( ) < lia.getThickness( ) ) continue; x = da[j]; lre = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), LineRenderEvent.class ); lre.setLineAttributes( lia ); lre.setStart( LocationImpl.create( x, dY1 + pwa.getSeriesThickness( ) ) ); lre.setEnd( LocationImpl.create( x + pwa.getSeriesThickness( ), dY1 ) ); ipr.drawLine( lre ); } } for ( int j = 0; j < da.length; j++ ) { if ( j == 0 && insCA.getBottom( ) < lia.getThickness( ) ) continue; if ( j == da.length - 1 && insCA.getTop( ) < lia.getThickness( ) ) continue; x = da[j]; if ( pwa.getDimension( ) == IConstants.TWO_5_D ) { x += pwa.getSeriesThickness( ); } lre = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), LineRenderEvent.class ); lre.setLineAttributes( lia ); lre.setStart( LocationImpl.create( x, dY1 ) ); lre.setEnd( LocationImpl.create( x, dY2 ) ); ipr.drawLine( lre ); } } else if ( oaxa[i].getOrientation( ) == IConstants.VERTICAL ) { double[] da = sc.getTickCordinates( ); double dX1 = bo.getLeft( ) + 1, dX2 = bo.getLeft( ) + bo.getWidth( ) - 2; if ( pwa.getDimension( ) == IConstants.TWO_5_D ) { for ( int j = 0; j < da.length; j++ ) { if ( j == 0 && insCA.getLeft( ) < lia.getThickness( ) ) continue; if ( j == da.length - 1 && insCA.getRight( ) < lia.getThickness( ) ) continue; y = ( da[j] - pwa.getSeriesThickness( ) ); lre = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), LineRenderEvent.class ); lre.setLineAttributes( lia ); lre.setStart( LocationImpl.create( dX1, y ) ); lre.setEnd( LocationImpl.create( dX1 - pwa.getSeriesThickness( ), y + pwa.getSeriesThickness( ) ) ); ipr.drawLine( lre ); } } for ( int j = 0; j < da.length; j++ ) { if ( j == 0 && insCA.getLeft( ) < lia.getThickness( ) ) continue; if ( j == da.length - 1 && insCA.getRight( ) < lia.getThickness( ) ) continue; y = da[j]; if ( pwa.getDimension( ) == IConstants.TWO_5_D ) { y -= pwa.getSeriesThickness( ); } lre = (LineRenderEvent) ( (EventObjectCache) ipr ).getEventObject( StructureSource.createPlot( p ), LineRenderEvent.class ); lre.setLineAttributes( lia ); lre.setStart( LocationImpl.create( dX1, y ) ); lre.setEnd( LocationImpl.create( dX2, y ) ); ipr.drawLine( lre ); } } } if ( p.getClientArea( ).getOutline( ).isVisible( ) ) { rre.setBounds( bo ); ipr.drawRectangle( rre ); } }
12803 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/12803/b519e4383cecd09cf3b985f0606d63c755bdfa59/AxesRenderer.java/buggy/chart/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/render/AxesRenderer.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1117, 918, 1743, 8199, 12, 467, 9840, 6747, 277, 683, 16, 15211, 293, 262, 1082, 202, 15069, 14804, 503, 202, 95, 202, 202, 759, 453, 1502, 56, 14073, 2347, 57, 2246, 202, 202, 956...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1117, 918, 1743, 8199, 12, 467, 9840, 6747, 277, 683, 16, 15211, 293, 262, 1082, 202, 15069, 14804, 503, 202, 95, 202, 202, 759, 453, 1502, 56, 14073, 2347, 57, 2246, 202, 202, 956...
strRet.append("(");
strRet.append('(');
public String toString() { StringBuffer strRet = new StringBuffer(); strRet.append("("); strRet.append("##any:uri="); strRet.append(fURI); strRet.append(')'); if (fPosition >= 0) { strRet.append ( " (Pos:" + Integer.toString(fPosition) + ")" ); } return strRet.toString(); }
6373 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/6373/b414bd5a51a69161c61ffcd585bdb76ec3eff180/CMAny.java/clean/src/org/apache/xerces/impl/dtd/models/CMAny.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 514, 1762, 1435, 565, 288, 3639, 6674, 609, 7055, 273, 394, 6674, 5621, 3639, 609, 7055, 18, 6923, 2668, 2668, 1769, 3639, 609, 7055, 18, 6923, 2932, 1189, 2273, 30, 1650, 1546, 176...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 514, 1762, 1435, 565, 288, 3639, 6674, 609, 7055, 273, 394, 6674, 5621, 3639, 609, 7055, 18, 6923, 2668, 2668, 1769, 3639, 609, 7055, 18, 6923, 2932, 1189, 2273, 30, 1650, 1546, 176...
public synchronized void doStartup() throws ServletException { if(isSetup == true) { return; } survprops = new java.util.Properties(); if(cldrHome == null) { cldrHome = System.getProperty("catalina.home"); if(cldrHome == null) { busted("no $(catalina.home) set - please use it or set a servlet parameter cldr.home"); return; } File homeFile = new File(cldrHome, "cldr"); if(!homeFile.isDirectory()) { busted("$(catalina.home)/cldr isn't working as a CLDR home. Not a directory: " + homeFile.getAbsolutePath()); return; } cldrHome = homeFile.getAbsolutePath(); } try { java.io.FileInputStream is = new java.io.FileInputStream(new java.io.File(cldrHome, "cldr.properties")); survprops.load(is); is.close(); } catch(java.io.IOException ioe) { /*throw new UnavailableException*/ logger.log(Level.SEVERE, "Couldn't load cldr.properties file from '" + cldrHome + "/cldr.properties': ",ioe); busted("Couldn't load cldr.properties file from '" + cldrHome + "/cldr.properties': " + ioe.toString()); /* .initCause(ioe);*/ return; }vetdata = survprops.getProperty("CLDR_VET_DATA", cldrHome+"/vetdata"); // dir for vetted dataif(!new File(vetdata).isDirectory()) { busted("CLDR_VET_DATA isn't a directory: " + vetdata); return;}if(false && (loggingHandler == null)) { // TODO: switch? Java docs seem to be broken.. following doesn't work. try { loggingHandler = new java.util.logging.FileHandler(vetdata + "/"+LOGFILE,0,1,true); loggingHandler.setFormatter(new java.util.logging.SimpleFormatter()); logger.addHandler(loggingHandler); logger.setUseParentHandlers(false); } catch(Throwable ioe){ busted("Couldn't add log handler for logfile (" + vetdata+"/"+LOGFILE +"): " + ioe.toString()); return; }}vap = survprops.getProperty("CLDR_VAP"); // Vet Access Passwordif((vap==null)||(vap.length()==0)) { /*throw new UnavailableException*/ busted("No vetting password set. (CLDR_VAP in cldr.properties)"); return;}vetweb = survprops.getProperty("CLDR_VET_WEB",cldrHome+"/vetdata"); // dir for web datacldrLoad = survprops.getProperty("CLDR_LOAD_ALL"); // preload all locales?fileBase = survprops.getProperty("CLDR_COMMON",cldrHome+"/common") + "/main"; // not static - may change lagerspecialMessage = survprops.getProperty("CLDR_MESSAGE"); // not static - may change lagerspecialHeader = survprops.getProperty("CLDR_HEADER"); // not static - may change lagerif(!new File(fileBase).isDirectory()) { busted("CLDR_COMMON isn't a directory: " + fileBase); return;}if(!new File(vetweb).isDirectory()) { busted("CLDR_VET_WEB isn't a directory: " + vetweb); return;}File cacheDir = new File(cldrHome, "cache");logger.info("Cache Dir: " + cacheDir.getAbsolutePath() + " - creating and emptying..");CachingEntityResolver.setCacheDir(cacheDir.getAbsolutePath());CachingEntityResolver.createAndEmptyCacheDir();isSetup = true;int status = 0;logger.info(" ------------------ " + new Date().toString() + " ---------------");if(isBusted != null) { return; // couldn't write the log}logger.info("SurveyTool starting up. root=" + new File(cldrHome).getAbsolutePath());if ((specialMessage!=null)&&(specialMessage.length()>0)) { logger.warning("SurveyTool with CLDR_MESSAGE: " + specialMessage); busted("message: " + specialMessage);}SurveyMain m = new SurveyMain();/* if(!m.reg.read()) { busted("Couldn't load user registry [at least put an empty file there] - exiting"); return; } */if(!readWarnings()) { // already busted return;}doStartupDB();logger.info("SurveyTool ready for requests. Memory in use: " + usedK());}
27800 /local/tlutelli/issta_data/temp/all_java2context/java/2006_temp/2006/27800/987d93326a02b930bea8e57abc8be9fe5788dc48/SurveyMain.java/clean/tools/java/org/unicode/cldr/web/SurveyMain.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1071, 22043, 6459, 2896, 22178, 1435, 15069, 4745, 503, 95, 430, 12, 291, 7365, 631, 3767, 15329, 2463, 31, 97, 10050, 90, 9693, 33, 2704, 6290, 18, 1367, 18, 2297, 5621, 430, 12, 830, 3069, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1071, 22043, 6459, 2896, 22178, 1435, 15069, 4745, 503, 95, 430, 12, 291, 7365, 631, 3767, 15329, 2463, 31, 97, 10050, 90, 9693, 33, 2704, 6290, 18, 1367, 18, 2297, 5621, 430, 12, 830, 3069, ...
setAttribute("tabindex", newValue);
setAttribute("tabindex", newValue);
public void setTabIndex(int newValue) { setAttribute("tabindex", newValue); }
46079 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46079/a0ba982304fe9f3700209293da4d2533e292e5d2/WMLInputElementImpl.java/buggy/src/org/apache/wml/dom/WMLInputElementImpl.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 444, 5661, 1016, 12, 474, 6129, 13, 288, 202, 542, 1499, 2932, 7032, 1615, 3113, 6129, 1769, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 444, 5661, 1016, 12, 474, 6129, 13, 288, 202, 542, 1499, 2932, 7032, 1615, 3113, 6129, 1769, 565, 289, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
public ViewerHTMLActionHandler( IReportDocument document, long page, Locale locale, boolean isEmbeddable, boolean isRtl )
public ViewerHTMLActionHandler( )
public ViewerHTMLActionHandler( IReportDocument document, long page, Locale locale, boolean isEmbeddable, boolean isRtl ) { this.document = document; this.page = page; this.locale = locale; this.isEmbeddable = isEmbeddable; this.isRtl = isRtl; }
5230 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5230/234773c56b5a7d9caae202ae7449b7c510e5d9b2/ViewerHTMLActionHandler.java/clean/viewer/org.eclipse.birt.report.viewer/birt/WEB-INF/classes/org/eclipse/birt/report/service/ViewerHTMLActionHandler.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 4441, 264, 4870, 1803, 1503, 12, 467, 4820, 2519, 1668, 16, 1525, 1363, 16, 1082, 202, 3916, 2573, 16, 1250, 353, 9538, 17394, 16, 1250, 353, 54, 6172, 262, 202, 95, 202, 202,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 4441, 264, 4870, 1803, 1503, 12, 467, 4820, 2519, 1668, 16, 1525, 1363, 16, 1082, 202, 3916, 2573, 16, 1250, 353, 9538, 17394, 16, 1250, 353, 54, 6172, 262, 202, 95, 202, 202,...
for (int i = 0; i < m_dependencies.length; i++) { m_dependencies[i].stop(); } }
for (int i = 0; i < m_dependencies.length; i++) { m_dependencies[i].stop(); } }
public void stop() { for (int i = 0; i < m_dependencies.length; i++) { m_dependencies[i].stop(); } }
45948 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/45948/ade5d36d9bda6dfac49dec23cf83e543691726ab/DependencyHandler.java/buggy/ipojo/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 2132, 1435, 288, 202, 202, 1884, 261, 474, 277, 273, 374, 31, 277, 411, 312, 67, 11037, 18, 2469, 31, 277, 27245, 288, 312, 67, 11037, 63, 77, 8009, 5681, 5621, 289, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 2132, 1435, 288, 202, 202, 1884, 261, 474, 277, 273, 374, 31, 277, 411, 312, 67, 11037, 18, 2469, 31, 277, 27245, 288, 312, 67, 11037, 63, 77, 8009, 5681, 5621, 289, 20...
log.debug("storeSnmpCollection: routedest is: "+ routedest == null ? "null" : routedest+"; IP_ROUTE_DEST: "+IpRouteTableEntry.IP_ROUTE_DEST);
log.debug("storeSnmpCollection: routedest is: "+ (routedest == null ? "null" : routedest)+"; IP_ROUTE_DEST: "+IpRouteTableEntry.IP_ROUTE_DEST);
private void storeSnmpCollection(Connection dbConn, Timestamp now) throws SQLException, UnknownHostException { Category log = ThreadCategory.getInstance(getClass()); Iterator ite = null; int nodeid = m_node.getNodeId(); if (m_snmpcoll.hasIpNetToMediaTable()) { ite = m_snmpcoll.getIpNetToMediaTable() .getEntries().iterator(); if (log.isDebugEnabled()) log .debug("store: saving IpNetToMediaTable to atinterface table in DB"); // the AtInterfaces used by LinkableNode where to save info java.util.List<AtInterface> atInterfaces = new java.util.ArrayList<AtInterface>(); while (ite.hasNext()) { IpNetToMediaTableEntry ent = (IpNetToMediaTableEntry) ite .next(); int ifindex = ent .getInt32(IpNetToMediaTableEntry.INTM_INDEX); InetAddress ipaddress = ent .getIPAddress(IpNetToMediaTableEntry.INTM_NETADDR); if (ipaddress.isLoopbackAddress() || ipaddress.getHostAddress().equals("0.0.0.0")) { log.warn("store: invalid ip " + ipaddress.getHostAddress()); continue; } String physAddr = ent .getHexString(IpNetToMediaTableEntry.INTM_PHYSADDR); if (physAddr.equals("000000000000") || physAddr.equalsIgnoreCase("ffffffffffff")) { log.warn("store: invalid mac address " + physAddr + " for ip " + ipaddress.getHostAddress()); continue; } if (log.isDebugEnabled()) log.debug("store: trying save info for ipaddr " + ipaddress.getHostName() + " mac address " + physAddr + " found on ifindex " + ifindex); // get an At interface but without setting mac address AtInterface at = getNodeidIfindexFromIp(dbConn, ipaddress); if (at == null) { log.warn("getNodeidIfindexFromIp: no nodeid found for ipaddress " + ipaddress + "."); continue; //TODO here is a good place for autodiscovery } //set the mac address at.setMacAddress(physAddr); // add At Inteface to list of valid interfaces atInterfaces.add(at); // Save in DB DbAtInterfaceEntry atInterfaceEntry = DbAtInterfaceEntry.get( dbConn, at.getNodeId(), ipaddress.getHostAddress()); if (atInterfaceEntry == null) { atInterfaceEntry = DbAtInterfaceEntry.create(at.getNodeId(), ipaddress.getHostAddress()); } // update object atInterfaceEntry.updateAtPhysAddr(physAddr); atInterfaceEntry.updateSourceNodeId(nodeid); atInterfaceEntry.updateIfIndex(ifindex); atInterfaceEntry.updateStatus(DbAtInterfaceEntry.STATUS_ACTIVE); atInterfaceEntry.set_lastpolltime(now); // store object in database atInterfaceEntry.store(dbConn); } // set AtInterfaces in LinkableNode m_node.setAtInterfaces(atInterfaces); } if (m_snmpcoll.hasCdpCacheTable()) { if (log.isDebugEnabled()) log .debug("store: saving CdpCacheTable into SnmpLinkableNode"); java.util.List<CdpInterface> cdpInterfaces = new java.util.ArrayList<CdpInterface>(); ite = m_snmpcoll.getCdpCacheTable() .getEntries().iterator(); while (ite.hasNext()) { CdpCacheTableEntry cdpEntry = (CdpCacheTableEntry) ite.next(); int cdpAddrType = cdpEntry.getInt32(CdpCacheTableEntry.CDP_ADDRESS_TYPE); if (cdpAddrType != 1) continue; String cdptargetipaddress = cdpEntry.getHexString(CdpCacheTableEntry.CDP_ADDRESS); if (log.isDebugEnabled()) log.debug(" cdp ip address octet string is " + cdptargetipaddress); long ipAddr = Long.parseLong(cdptargetipaddress, 16); byte[] bytes = new byte[4]; bytes[3] = (byte) (ipAddr & 0xff); bytes[2] = (byte) ((ipAddr >> 8) & 0xff); bytes[1] = (byte) ((ipAddr >> 16) & 0xff); bytes[0] = (byte) ((ipAddr >> 24) & 0xff); InetAddress cdpTargetIpAddr = InetAddress.getByAddress(bytes); if (log.isDebugEnabled()) log.debug(" cdp ip address after parsing is " + cdpTargetIpAddr.getHostAddress()); int cdpIfIndex = cdpEntry.getInt32(CdpCacheTableEntry.CDP_IFINDEX); if (log.isDebugEnabled()) log.debug(" cdp ifindex is " + cdpIfIndex); String cdpTargetDevicePort = cdpEntry.getDisplayString(CdpCacheTableEntry.CDP_DEVICEPORT); if (log.isDebugEnabled()) log.debug(" cdp Target device port name is " + cdpTargetDevicePort); CdpInterface cdpIface = new CdpInterface(cdpIfIndex); int targetCdpNodeId = getNodeidFromIp(dbConn, cdpTargetIpAddr); cdpIface.setCdpTargetNodeId(targetCdpNodeId); cdpIface.setCdpTargetIpAddr(cdpTargetIpAddr); int cdpTargetIfindex = getIfIndexByName( dbConn, targetCdpNodeId, cdpTargetDevicePort); if (targetCdpNodeId == -1 || cdpTargetIfindex == -1) { log.warn("No nodeid found: cdp interface not added to Linkable Snmp Node"); //TODO Good place for autodiscovery } else { cdpIface.setCdpTargetIfIndex(cdpTargetIfindex); cdpInterfaces.add(cdpIface); } } m_node.setCdpInterfaces(cdpInterfaces); } if (m_snmpcoll.hasRouteTable()) { java.util.List<RouterInterface> routeInterfaces = new java.util.ArrayList<RouterInterface>(); ite = m_snmpcoll.getIpRouteTable().getEntries() .iterator(); if (log.isDebugEnabled()) log .debug("store: saving ipRouteTable to iprouteinterface table in DB"); while (ite.hasNext()) { IpRouteTableEntry ent = (IpRouteTableEntry) ite.next(); InetAddress routedest = ent.getIPAddress(IpRouteTableEntry.IP_ROUTE_DEST); log.debug("storeSnmpCollection: routedest is: "+ routedest == null ? "null" : routedest+"; IP_ROUTE_DEST: "+IpRouteTableEntry.IP_ROUTE_DEST); InetAddress routemask = ent.getIPAddress(IpRouteTableEntry.IP_ROUTE_MASK); log.debug("storeSnmpCollection: routemask is: "+ routemask == null ? "null" : routemask+"; IP_ROUTE_MASK: "+IpRouteTableEntry.IP_ROUTE_MASK); InetAddress nexthop = ent.getIPAddress(IpRouteTableEntry.IP_ROUTE_NXTHOP); log.debug("storeSnmpCollection: nexthop is: "+ nexthop == null ? "null" : nexthop+"; IP_ROUTE_NXTHOP: "+IpRouteTableEntry.IP_ROUTE_NXTHOP); int ifindex = ent.getInt32(IpRouteTableEntry.IP_ROUTE_IFINDEX); log.debug("storeSnmpCollection: ifindex is: "+ ifindex == null ? "null" : ifindex+"; IP_ROUTE_IFINDEX: "+IpRouteTableEntry.IP_ROUTE_IFINDEX); int routemetric1 = ent.getInt32(IpRouteTableEntry.IP_ROUTE_METRIC1); log.debug("storeSnmpCollection: routemetric1 is: "+ routemetric1 == null ? "null" : routemetric1+"; IP_ROUTE_METRIC1: "+IpRouteTableEntry.IP_ROUTE_METRIC1); int routemetric2 = ent.getInt32(IpRouteTableEntry.IP_ROUTE_METRIC2); log.debug("storeSnmpCollection: routemetric2 is: "+ routemetric2 == null ? "null" : routemetric2+"; IP_ROUTE_METRIC2: "+IpRouteTableEntry.IP_ROUTE_METRIC2); int routemetric3 =ent.getInt32(IpRouteTableEntry.IP_ROUTE_METRIC3); log.debug("storeSnmpCollection: routemetric3 is: "+ routemetric3 == null ? "null" : routemetric3+"; IP_ROUTE_METRIC3: "+IpRouteTableEntry.IP_ROUTE_METRIC3); int routemetric4 = ent.getInt32(IpRouteTableEntry.IP_ROUTE_METRIC4); log.debug("storeSnmpCollection: routemetric4 is: "+ routemetric4 == null ? "null" : routemetric4+"; IP_ROUTE_METRIC4: "+IpRouteTableEntry.IP_ROUTE_METRIC4); int routemetric5 = ent.getInt32(IpRouteTableEntry.IP_ROUTE_METRIC5); log.debug("storeSnmpCollection: routemetric5 is: "+ routemetric5 == null ? "null" : routemetric5+"; IP_ROUTE_METRIC5: "+IpRouteTableEntry.IP_ROUTE_METRIC5); int routetype = ent.getInt32(IpRouteTableEntry.IP_ROUTE_TYPE); log.debug("storeSnmpCollection: routetype is: "+ routetype == null ? "null" : routetype+"; IP_ROUTE_TYPE: "+IpRouteTableEntry.IP_ROUTE_TYPE); int routeproto = ent.getInt32(IpRouteTableEntry.IP_ROUTE_PROTO); log.debug("storeSnmpCollection: routeproto is: "+ routeproto == null ? "null" : routeproto+"; IP_ROUTE_PROTO: "+IpRouteTableEntry.IP_ROUTE_PROTO); // info used for Discovery Link RouterInterface routeIface = new RouterInterface(ifindex); routeIface.setMetric(routemetric1); routeIface.setNextHop(nexthop); int nodeParentId = getNodeidFromIp(dbConn,nexthop); if (nodeParentId == -1) { //TODO here is a good point for autodiscovery log.warn("store: No nodeid found for next hop " + nexthop + " Skipping ip route interface add to Linkable Snmp Node"); } else { routeIface.setNodeparentid(nodeParentId); routeIface.setSnmpiftype(getSnmpIfType(dbConn, nodeid, ifindex)); routeInterfaces.add(routeIface); } // save info to DB DbIpRouteInterfaceEntry iprouteInterfaceEntry = DbIpRouteInterfaceEntry .get(dbConn, nodeid, routedest.getHostAddress()); if (iprouteInterfaceEntry == null) { // Create a new entry iprouteInterfaceEntry = DbIpRouteInterfaceEntry.create( m_node.getNodeId(), routedest.getHostAddress()); } // update object iprouteInterfaceEntry.updateRouteMask(routemask.getHostAddress()); iprouteInterfaceEntry.updateRouteNextHop(nexthop.getHostAddress()); iprouteInterfaceEntry.updateIfIndex(ifindex); if (routemetric1 != -1) iprouteInterfaceEntry.updateRouteMetric1(routemetric1); if (routemetric2 != -1) iprouteInterfaceEntry.updateRouteMetric2(routemetric2); if (routemetric3 != -1) iprouteInterfaceEntry.updateRouteMetric3(routemetric3); if (routemetric4 != -1) iprouteInterfaceEntry.updateRouteMetric4(routemetric4); if (routemetric5 != -1) iprouteInterfaceEntry.updateRouteMetric5(routemetric5); if (routetype != -1) iprouteInterfaceEntry.updateRouteType(routetype); if (routeproto != -1) iprouteInterfaceEntry.updateRouteProto(routeproto); iprouteInterfaceEntry .updateStatus(DbAtInterfaceEntry.STATUS_ACTIVE); iprouteInterfaceEntry.set_lastpolltime(now); // store object in database iprouteInterfaceEntry.store(dbConn); } m_node.setRouteInterfaces(routeInterfaces); } // STARTS loop on vlans if (m_snmpcoll.hasVlanTable()) { if (log.isDebugEnabled()) log .debug("store: saving SnmpVlanCollection in DB"); ite = m_snmpcoll.getSnmpVlanCollections() .iterator(); while (ite.hasNext()) { SnmpVlanCollection snmpVlanColl = (SnmpVlanCollection) ite .next(); String vlanindex = snmpVlanColl.getVlanIndex(); int vlan = Integer.parseInt(vlanindex); String vlanname = snmpVlanColl.getVlanName(); if (log.isDebugEnabled()) log .debug("store: parsing VLAN " + vlanindex + " VLAN_NAME " + vlanname); if (snmpVlanColl.hasDot1dBase()) { if (log.isDebugEnabled()) log .debug("store: saving Dot1dBaseGroup in stpnode table"); Dot1dBaseGroup dod1db = (Dot1dBaseGroup) snmpVlanColl.getDot1dBase(); String baseBridgeAddress = dod1db.getBridgeAddress(); int basenumports = dod1db.getNumberOfPorts(); int bridgetype = dod1db.getBridgeType(); if (baseBridgeAddress == "000000000000") { log.warn("store: base bridge address " + baseBridgeAddress + " is invalid for ipaddress " ); } else { m_node.addBridgeIdentifier(baseBridgeAddress,vlanindex); DbStpNodeEntry dbStpNodeEntry = DbStpNodeEntry.get(dbConn, m_node.getNodeId(), vlan); if (dbStpNodeEntry == null) { // Create a new entry dbStpNodeEntry = DbStpNodeEntry.create(m_node .getNodeId(), vlan); } // update object dbStpNodeEntry.updateBaseBridgeAddress(baseBridgeAddress); dbStpNodeEntry.updateBaseNumPorts(basenumports); dbStpNodeEntry.updateBaseType(bridgetype); dbStpNodeEntry.updateBaseVlanName(vlanname); if (snmpVlanColl.hasDot1dStp()) { if (log.isDebugEnabled()) log .debug("store: adding Dot1dStpGroup in stpnode table"); Dot1dStpGroup dod1stp = (Dot1dStpGroup) snmpVlanColl .getDot1dStp(); int protospec = dod1stp.getStpProtocolSpecification(); int stppriority = dod1stp.getStpPriority(); String stpDesignatedRoot = dod1stp.getStpDesignatedRoot(); int stprootcost = dod1stp.getStpRootCost(); int stprootport = dod1stp.getStpRootPort(); if (stpDesignatedRoot != "0000000000000000") { m_node.setVlanStpRoot(vlanindex,stpDesignatedRoot); } dbStpNodeEntry.updateStpProtocolSpecification(protospec); dbStpNodeEntry.updateStpPriority(stppriority); dbStpNodeEntry.updateStpDesignatedRoot(stpDesignatedRoot); dbStpNodeEntry.updateStpRootCost(stprootcost); dbStpNodeEntry.updateStpRootPort(stprootport); } // store object in database dbStpNodeEntry.updateStatus(DbStpNodeEntry.STATUS_ACTIVE); dbStpNodeEntry.set_lastpolltime(now); dbStpNodeEntry.store(dbConn); if (snmpVlanColl.hasDot1dBasePortTable()) { Iterator sub_ite = snmpVlanColl.getDot1dBasePortTable() .getEntries().iterator(); if (log.isDebugEnabled()) log .debug("store: saving Dot1dBasePortTable in stpinterface table"); while (sub_ite.hasNext()) { Dot1dBasePortTableEntry dot1dbaseptentry = (Dot1dBasePortTableEntry) sub_ite .next(); int baseport = dot1dbaseptentry.getInt32(Dot1dBasePortTableEntry.BASE_PORT); int ifindex = dot1dbaseptentry.getInt32(Dot1dBasePortTableEntry.BASE_IFINDEX); m_node.setIfIndexBridgePort(ifindex,baseport); DbStpInterfaceEntry dbStpIntEntry = DbStpInterfaceEntry .get(dbConn, m_node.getNodeId(), baseport, vlan); if (dbStpIntEntry == null) { // Create a new entry dbStpIntEntry = DbStpInterfaceEntry.create( m_node.getNodeId(), baseport, vlan); } dbStpIntEntry.updateIfIndex(ifindex); dbStpIntEntry .updateStatus(DbStpNodeEntry.STATUS_ACTIVE); dbStpIntEntry.set_lastpolltime(now); dbStpIntEntry.store(dbConn); } } if (snmpVlanColl.hasDot1dStpPortTable()) { if (log.isDebugEnabled()) log .debug(" store: adding Dot1dStpPortTable in stpinterface table"); Iterator sub_ite = snmpVlanColl.getDot1dStpPortTable() .getEntries().iterator(); while (sub_ite.hasNext()) { Dot1dStpPortTableEntry dot1dstpptentry = (Dot1dStpPortTableEntry) sub_ite .next(); int stpport = dot1dstpptentry.getInt32(Dot1dStpPortTableEntry.STP_PORT); DbStpInterfaceEntry dbStpIntEntry = DbStpInterfaceEntry .get(dbConn, m_node.getNodeId(), stpport, vlan); if (dbStpIntEntry == null) { // Cannot create the object becouse must exists the dot1dbase // object!!!!! log .warn("store StpInterface: when storing STP info" + " for bridge node with nodeid " + m_node.getNodeId() + " bridgeport number " + stpport + " and vlan index " + vlanindex + " info not found in database, ERROR skipping....."); } else { int stpportstate = dot1dstpptentry .getInt32(Dot1dStpPortTableEntry.STP_PORT_STATE); int stpportpathcost = dot1dstpptentry .getInt32(Dot1dStpPortTableEntry.STP_PORT_PATH_COST); String stpPortDesignatedBridge = dot1dstpptentry .getHexString(Dot1dStpPortTableEntry.STP_PORT_DESIGNATED_BRIDGE); String stpPortDesignatedRoot = dot1dstpptentry .getHexString(Dot1dStpPortTableEntry.STP_PORT_DESIGNATED_ROOT); int stpportdesignatedcost = dot1dstpptentry .getInt32(Dot1dStpPortTableEntry.STP_PORT_DESIGNATED_COST); String stpPortDesignatedPort = dot1dstpptentry .getHexString(Dot1dStpPortTableEntry.STP_PORT_DESIGNATED_PORT); if (stpPortDesignatedBridge.equals("0000000000000000")) { log.warn("storeSnmpCollection: designated bridge is invalid not adding to discoveryLink"); } else if (stpPortDesignatedPort.equals("0000")) { log.warn("storeSnmpCollection: designated port is invalid not adding to discoveryLink"); } else { BridgeStpInterface stpIface = new BridgeStpInterface(stpport,vlanindex); stpIface.setStpPortDesignatedBridge(stpPortDesignatedBridge); stpIface.setStpPortDesignatedPort(stpPortDesignatedPort); m_node.addStpInterface(stpIface); } dbStpIntEntry.updateStpPortState(stpportstate); dbStpIntEntry.updateStpPortPathCost(stpportpathcost); dbStpIntEntry.updateStpportDesignatedBridge(stpPortDesignatedBridge); dbStpIntEntry.updateStpportDesignatedRoot(stpPortDesignatedRoot); dbStpIntEntry.updateStpPortDesignatedCost(stpportdesignatedcost); dbStpIntEntry.updateStpportDesignatedPort(stpPortDesignatedPort); dbStpIntEntry.updateStatus(DbStpNodeEntry.STATUS_ACTIVE); dbStpIntEntry.set_lastpolltime(now); dbStpIntEntry.store(dbConn); } } } if (snmpVlanColl.hasDot1dTpFdbTable()) { if (log.isDebugEnabled()) log .debug("store: parsing Dot1dTpFdbTable"); Iterator subite = snmpVlanColl.getDot1dFdbTable() .getEntries().iterator(); while (subite.hasNext()) { Dot1dTpFdbTableEntry dot1dfdbentry = (Dot1dTpFdbTableEntry) subite .next(); String curMacAddress = dot1dfdbentry .getHexString(Dot1dTpFdbTableEntry.FDB_ADDRESS); int fdbport = dot1dfdbentry.getInt32(Dot1dTpFdbTableEntry.FDB_PORT); if (fdbport == 0) { if (log.isDebugEnabled()) log.debug("populateBridge: macaddress " + curMacAddress + " learned on invalid port " + fdbport + " . Skipping"); continue; } int curfdbstatus = dot1dfdbentry.getInt32(Dot1dTpFdbTableEntry.FDB_STATUS); if (curfdbstatus == SNMP_DOT1D_FDB_STATUS_LEARNED) { m_node.addMacAddress(fdbport, curMacAddress, vlanindex); if (log.isDebugEnabled()) log .debug("storeSnmpCollection: found learned mac address " + curMacAddress + " on bridge port " + fdbport + " for VLAN " + snmpVlanColl.getVlanIndex()); } if (curfdbstatus == SNMP_DOT1D_FDB_STATUS_SELF) { m_node.addBridgeIdentifier(curMacAddress); if (log.isDebugEnabled()) log .debug("storeSnmpCollection: found bridge identifier " + curMacAddress + " for VLAN " + snmpVlanColl.getVlanIndex() + " and bridge port " + fdbport); } if (curfdbstatus == SNMP_DOT1D_FDB_STATUS_INVALID) { if (log.isDebugEnabled()) log.debug("storeSnmpCollection: macaddress " + curMacAddress + " has INVALID status on port " + fdbport + " . Skipping"); continue; } if (curfdbstatus == SNMP_DOT1D_FDB_STATUS_MGMT) { if (log.isDebugEnabled()) log.debug("storeSnmpCollection: macaddress " + curMacAddress + " has MGMT status on port " + fdbport + " . Skipping"); continue; } if (curfdbstatus == SNMP_DOT1D_FDB_STATUS_OTHER) { if (log.isDebugEnabled()) log.debug("storeSnmpCollection: macaddress " + curMacAddress + " has OTHER status on port " + fdbport + " . Skipping"); continue; } } } //now adding bridge identifier mac addresses of switch from snmpinterface setBridgeIdentifierFromSnmpInterface(dbConn); } } } } update(dbConn, now); }
47678 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/47678/1d69554b5dbe6b097367af5d9ca68a47f42dbeff/DbEventWriter.java/clean/opennms-services/src/main/java/org/opennms/netmgt/linkd/DbEventWriter.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1152, 918, 1707, 10461, 1291, 2532, 12, 1952, 30795, 16, 8159, 2037, 13, 1216, 6483, 16, 1082, 202, 4874, 29776, 288, 202, 202, 4457, 613, 273, 4884, 4457, 18, 588, 1442, 12, 588, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1152, 918, 1707, 10461, 1291, 2532, 12, 1952, 30795, 16, 8159, 2037, 13, 1216, 6483, 16, 1082, 202, 4874, 29776, 288, 202, 202, 4457, 613, 273, 4884, 4457, 18, 588, 1442, 12, 588, ...
m_log.warn("Maximum connection limit reached."); m_writer.send(530, "connection.limit", null);
log.warn("Maximum connection limit reached."); writer.send(530, "connection.limit", null);
public void run() { InetAddress clientAddr = m_request.getRemoteAddress(); IConnectionManager conManager = m_fconfig.getConnectionManager(); try { // write log message String hostAddress = clientAddr.getHostAddress(); m_log.info("Open connection - " + hostAddress); // notify ftp statistics IFtpStatistics ftpStat = (IFtpStatistics)m_fconfig.getFtpStatistics(); ftpStat.setOpenConnection(this); // call Ftplet.onConnect() method boolean isSkipped = false; Ftplet ftpletContainer = m_fconfig.getFtpletContainer(); FtpletEnum ftpletRet = ftpletContainer.onConnect(m_request, m_writer); if(ftpletRet == FtpletEnum.RET_SKIP) { isSkipped = true; } else if(ftpletRet == FtpletEnum.RET_DISCONNECT) { conManager.closeConnection(this); return; } if(!isSkipped) { // IP permission check IIpRestrictor ipRestrictor = m_fconfig.getIpRestrictor(); if( !ipRestrictor.hasPermission(clientAddr) ) { m_log.warn("No permission to access from " + hostAddress); m_writer.send(530, "ip.restricted", null); return; } // connection limit check int maxConnections = conManager.getMaxConnections(); if(ftpStat.getCurrentConnectionNumber() > maxConnections) { m_log.warn("Maximum connection limit reached."); m_writer.send(530, "connection.limit", null); return; } // everything is fine - go ahead m_writer.send(220, null, null); } m_reader = new BufferedReader(new InputStreamReader(m_controlSocket.getInputStream(), "UTF-8")); do { notifyObserver(); String commandLine = m_reader.readLine(); // test command line if(commandLine == null) { break; } commandLine = commandLine.trim(); if(commandLine.equals("")) { continue; } // parse and check permission m_request.parse(commandLine); if(!hasPermission()) { m_writer.send(530, "permission", null); continue; } // execute command service(m_request, m_writer); } while(!m_isConnectionClosed); } catch(SocketException ex) { // socket closed - no need to do anything } catch(Exception ex) { m_log.warn("RequestHandler.run()", ex); } finally { // close all resources if not done already if(!m_isConnectionClosed) { conManager.closeConnection(this); } } }
48500 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/48500/f8bdbb2dab0d67be139dd05d6110e466306c8868/RequestHandler.java/clean/src/java/org/apache/ftpserver/RequestHandler.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 1086, 1435, 288, 7734, 14218, 1004, 3178, 273, 312, 67, 2293, 18, 588, 5169, 1887, 5621, 3639, 467, 1952, 1318, 356, 1318, 273, 312, 67, 74, 1425, 18, 588, 1952, 1318, 5621, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 1086, 1435, 288, 7734, 14218, 1004, 3178, 273, 312, 67, 2293, 18, 588, 5169, 1887, 5621, 3639, 467, 1952, 1318, 356, 1318, 273, 312, 67, 74, 1425, 18, 588, 1952, 1318, 5621, ...
tr.x = next_x; tr.y = vr.y;
public static String layoutCompoundLabel(JComponent c, FontMetrics fm, String text, Icon i, int vert_a, int hor_i, int vert_text_pos, int hor_text_pos, Rectangle vr, Rectangle ir, Rectangle tr, int gap) { // view rect 'vr' already ok, // we need to compute ir (icon rect) and tr (text-rect) int next_x = vr.x; int next_y = vr.y; ir.height = ir.width = ir.y = ir.x = 0; if (i != null) { ir.x = vr.x; ir.y = vr.y; ir.width = i.getIconWidth(); ir.height = i.getIconWidth(); next_x += gap + i.getIconWidth(); next_y += gap + i.getIconHeight(); } tr.x = next_x; tr.y = vr.y; // + (vr.height/2); tr.width = fm.stringWidth(text); tr.height = fm.getHeight(); // + fm.getAscent()/2; return text; }
25337 /local/tlutelli/issta_data/temp/all_java2context/java/2006_temp/2006/25337/a969e4b30bfe4dfbec01c97d2652768b3b2da81f/SwingUtilities.java/buggy/libjava/javax/swing/SwingUtilities.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 760, 514, 3511, 16835, 2224, 12, 46, 1841, 276, 16, 4766, 5411, 10063, 5653, 10940, 16, 4766, 6647, 514, 977, 16, 4766, 6647, 16011, 277, 16, 4766, 6647, 509, 3173, 67, 69, 16, 47...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 760, 514, 3511, 16835, 2224, 12, 46, 1841, 276, 16, 4766, 5411, 10063, 5653, 10940, 16, 4766, 6647, 514, 977, 16, 4766, 6647, 16011, 277, 16, 4766, 6647, 509, 3173, 67, 69, 16, 47...
EventDispatcher eventDispatcher, List goals, String baseDirectory )
EventDispatcher eventDispatcher, List goals, String baseDirectory, ProfileManager globalProfileManager )
public DefaultMavenExecutionRequest( ArtifactRepository localRepository, Settings settings, EventDispatcher eventDispatcher, List goals, String baseDirectory ) { this.localRepository = localRepository; this.settings = settings; this.goals = goals; this.eventDispatcher = eventDispatcher; this.baseDirectory = baseDirectory; }
47050 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/47050/fe5a91b0d626193d59db343dd9d5e582d0ef289b/DefaultMavenExecutionRequest.java/buggy/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 2989, 49, 7638, 3210, 691, 12, 14022, 3305, 1191, 3305, 16, 8709, 1947, 16, 29159, 31153, 17556, 16, 987, 1960, 1031, 16, 514, 1026, 2853, 16, 11357, 1318, 2552, 4029, 1318, 262, 56...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 2989, 49, 7638, 3210, 691, 12, 14022, 3305, 1191, 3305, 16, 8709, 1947, 16, 29159, 31153, 17556, 16, 987, 1960, 1031, 16, 514, 1026, 2853, 16, 11357, 1318, 2552, 4029, 1318, 262, 56...
ruby_class.setConstant((RubyId)node.nd_cname(), module); module.setClassPath(ruby_class, ((RubyId)node.nd_cname()).toName());
ruby.getRubyClass().setConstant((RubyId)node.nd_cname(), module); module.setClassPath(ruby.getRubyClass(), ((RubyId)node.nd_cname()).toName());
public RubyObject eval(RubyObject self, NODE n) { NODE node = n; RubyObject cond = null; RubyObject[] args = null; RubyObject value = null; RubyObject result = null; RubyModule rubyClass = null; // int state; // RubyOriginalMethods rom = getRuby().getOriginalMethods(); while (true) { if (node == null) { return getRuby().getNil(); } switch (node.nd_type()) { case NODE_BLOCK: while (node.nd_next() != null) { eval(self, node.nd_head()); node = node.nd_next(); } node = node.nd_head(); break; case NODE_POSTEXE: // rb_f_END(); node.nd_set_type(NODE_NIL); /* exec just once */ return getRuby().getNil(); /* begin .. end without clauses */ case NODE_BEGIN: node = node.nd_body(); break; /* nodes for speed-up(default match) */ case NODE_MATCH: //return rom.rb_reg_match2(node.nd_head().nd_lit()); return getRuby().getNil(); /* nodes for speed-up(literal match) */ case NODE_MATCH2: //return rom.rb_reg_match(eval(node.nd_recv()), eval(node.nd_value())); return getRuby().getNil(); /* nodes for speed-up(literal match) */ case NODE_MATCH3: //VALUE r = eval(node.nd_recv()); //VALUE l = eval(node.nd_value()); //if (r instanceof RubyString) { // return rom.rb_reg_match(l, r); //} else { // return rom.rb_funcall(r, match, 1, l); //} return getRuby().getNil(); /* node for speed-up(top-level loop for -n/-p) */ case NODE_OPT_N: while (true) { try { // while (!rb_gets().isNil() false) { // HACK +++ if (true) { // HACK --- try { eval(self, node.nd_body()); } catch (RedoException rExcptn) { } } break; } catch (NextException nExcptn) { } catch (BreakException bExcptn) { break; } } return getRuby().getNil(); case NODE_SELF: return self; case NODE_NIL: return getRuby().getNil(); case NODE_TRUE: return getRuby().getTrue(); case NODE_FALSE: return getRuby().getFalse(); case NODE_IF: // ruby_sourceline = node.nd_line(); cond = eval(self, node.nd_cond()); if (cond.isTrue()) { node = node.nd_body(); } else { node = node.nd_else(); } break; case NODE_WHEN: while (node != null) { NODE tag; if (node.nd_type() != NODE_WHEN) { break; } tag = node.nd_head(); while (tag != null) {/* if (trace_func) { call_trace_func("line", tag->nd_file, nd_line(tag), self, ruby_frame->last_func, ruby_frame->last_class); }*/ // ruby_sourcefile = tag.nd_file; // ruby_sourceline = tag.nd_line(); if (tag.nd_head().nd_type() == NODE_WHEN) { RubyObject obj = eval(self, tag.nd_head().nd_head()); if (!(obj instanceof RubyArray)) { obj = RubyArray.m_newArray(getRuby(), obj); } for (int i = 0; i < ((RubyArray)obj).length(); i++) { if (((RubyArray)obj).entry(i).isTrue()) { node = node.nd_body(); break; } } tag = tag.nd_next(); continue; } if (eval(self, tag.nd_head()).isTrue()) { node = node.nd_body(); break; } tag = tag.nd_next(); } node = node.nd_next(); } return getRuby().getNil(); case NODE_CASE: RubyObject obj = eval(self, node.nd_head()); node = node.nd_body(); while (node != null) { NODE tag; if (node.nd_type() != NODE_WHEN) { break; } tag = node.nd_head(); while (tag != null) {/* if (trace_func) { call_trace_func("line", tag->nd_file, nd_line(tag), self, ruby_frame->last_func, ruby_frame->last_class); } ruby_sourcefile = tag->nd_file; ruby_sourceline = nd_line(tag);*/ if (tag.nd_head().nd_type() == NODE_WHEN) { RubyObject obj2 = eval(self, tag.nd_head().nd_head()); if (!(obj2 instanceof RubyArray)) { obj2 = RubyArray.m_newArray(getRuby(), obj2); } for (int i = 0; i < ((RubyArray)obj).length(); i++) { RubyObject eqq = ((RubyArray)obj2).entry(i).funcall(getRuby().intern("==="), obj); if (eqq.isTrue()) { node = node.nd_body(); break; } } tag = tag.nd_next(); continue; } if (eval(self, tag.nd_head()).funcall(getRuby().intern("==="), obj).isTrue()) { node = node.nd_body(); break; } tag = tag.nd_next(); } node = node.nd_next(); } return getRuby().getNil(); case NODE_WHILE: while (eval(self, node.nd_cond()).isTrue()) { while (true) { try { eval(self, node.nd_body()); break; } catch (RedoException rExcptn) { } catch (NextException nExcptn) { break; } catch (BreakException bExcptn) { return getRuby().getNil(); } } } return getRuby().getNil(); case NODE_UNTIL: while (eval(self, node.nd_cond()).isFalse()) { while (true) { try { eval(self, node.nd_body()); break; } catch (RedoException rExcptn) { } catch (NextException nExcptn) { break; } catch (BreakException bExcptn) { return getRuby().getNil(); } } } return getRuby().getNil(); case NODE_BLOCK_PASS: //return block_pass(node); return null; case NODE_ITER: case NODE_FOR: rubyBlock.push(node.nd_var(), node.nd_body(), self); rubyIter.push(Iter.ITER_PRE); while (true) { try { if (node.nd_type() == NODE_ITER) { result = eval(self, node.nd_iter()); } else { // String file = // int line = rubyBlock.flags &= ~RubyBlock.BLOCK_D_SCOPE; RubyBlock tmpBlock = beginCallargs(); RubyObject recv = eval(self, node.nd_iter()); endCallArgs(tmpBlock); // = file; // = line; result = recv.getRubyClass().call(recv, ruby.intern("each"), null, 0); } break; } catch (RetryException rExcptn) { } catch (ReturnException rExcptn) { result = rExcptn.getReturnValue(); break; } catch (BreakException bExcptn) { result = ruby.getNil(); break; } } rubyIter.pop(); rubyBlock.pop(); return result; case NODE_BREAK: throw new BreakException(); case NODE_NEXT: throw new NextException(); case NODE_REDO: throw new RedoException(); case NODE_RETRY: throw new RetryException(); case NODE_RESTARGS: result = eval(self, node.nd_head()); if (!(result instanceof RubyArray)) { result = obj = RubyArray.m_newArray(getRuby(), result); } return result; case NODE_YIELD: if (node.nd_stts() != null) { result = eval(self, node.nd_stts()); if (node.nd_stts().nd_type() == NODE_RESTARGS && ((RubyArray)result).length() == 1) { result = ((RubyArray)result).entry(0); } } else { result = ruby.getNil(); } return yield0(result, null, null, false); case NODE_RESCUE:/* retry_entry: { volatile VALUE e_info = ruby_errinfo; PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { result = rb_eval(self, node->nd_head); } POP_TAG(); if (state == TAG_RAISE) { NODE * volatile resq = node->nd_resq; ruby_sourceline = nd_line(node); while (resq) { if (handle_rescue(self, resq)) { state = 0; PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { result = rb_eval(self, resq->nd_body); } POP_TAG(); if (state == TAG_RETRY) { state = 0; ruby_errinfo = Qnil; goto retry_entry; } if (state != TAG_RAISE) { ruby_errinfo = e_info; } break; } resq = resq->nd_head; /* next rescue */ /** } * } * else if (node->nd_else) { /* else clause given *//* if (!state) { /* no exception raised *//* result = rb_eval(self, node->nd_else); } } if (state) JUMP_TAG(state); } break;*/ case NODE_ENSURE:/* PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { result = eval(node.nd_head()); } POP_TAG(); if (node.nd_ensr()) { VALUE retval = prot_tag->retval; /* save retval *//* VALUE errinfo = ruby_errinfo; rb_eval(self, node->nd_ensr); return_value(retval); ruby_errinfo = errinfo; } if (state) JUMP_TAG(state); break;*/ case NODE_AND: cond = eval(self, node.nd_1st()); if (cond.isFalse()) { return cond; } node = node.nd_2nd(); break; case NODE_OR: cond = eval(self, node.nd_1st()); if (cond.isTrue()) { return cond; } node = node.nd_2nd(); break; case NODE_NOT: return RubyBoolean.m_newBoolean(getRuby(), eval(self, node.nd_1st()).isFalse()); case NODE_DOT2: case NODE_DOT3: result = RubyRange.m_newRange(getRuby(), eval(self, node.nd_beg()), eval(self, node.nd_end()), node.nd_type() == NODE_DOT3); if (node.nd_state() != 0) { return result; } if (node.nd_beg().nd_type() == NODE_LIT && (node.nd_beg().nd_lit() instanceof RubyFixnum) && node.nd_end().nd_type() == NODE_LIT && (node.nd_end().nd_lit() instanceof RubyFixnum)) { node.nd_set_type(NODE_LIT); node.nd_lit(result); } else { node.nd_state(1L); } return result; case NODE_FLIP2: /* like AWK */ /*if (ruby_scope->local_vars == 0) { rb_bug("unexpected local variable"); }*/ if (ruby.getRubyScope().getLocalVars(node.nd_cnt()).isFalse()) { if (eval(self, node.nd_beg()).isTrue()) { ruby.getRubyScope().setLocalVars(node.nd_cnt(), eval(self, node.nd_end()).isTrue() ? ruby.getFalse() : ruby.getTrue()); result = ruby.getTrue(); } else { result = ruby.getFalse(); } } else { if (eval(self, node.nd_end()).isTrue()) { ruby.getRubyScope().setLocalVars(node.nd_cnt(), ruby.getFalse()); } result = ruby.getTrue(); } return result; case NODE_FLIP3: /* like SED */ /*if (ruby_scope->local_vars == 0) { rb_bug("unexpected local variable"); }*/ if (ruby.getRubyScope().getLocalVars(node.nd_cnt()).isFalse()) { result = eval(self, node.nd_beg()).isTrue() ? ruby.getFalse() : ruby.getTrue(); ruby.getRubyScope().setLocalVars(node.nd_cnt(), result); } else { if (eval(self, node.nd_end()).isTrue()) { ruby.getRubyScope().setLocalVars(node.nd_cnt(), ruby.getFalse()); } result = ruby.getTrue(); } return result; case NODE_RETURN: if (node.nd_stts() != null) { result = eval(self, node.nd_stts()); } else { result = ruby.getNil(); } throw new ReturnException(result); case NODE_ARGSCAT: return ((RubyArray)eval(self, node.nd_head())).m_concat(eval(self, node.nd_body())); case NODE_ARGSPUSH: return ((RubyArray)eval(self, node.nd_head()).m_dup()).push(eval(self, node.nd_body())); case NODE_CALL: // TMP_PROTECT; RubyBlock tmpBlock = beginCallargs(); RubyObject recv = eval(self, node.nd_recv()); args = setupArgs(self, node.nd_args()); endCallArgs(tmpBlock); return recv.getRubyClass().call(recv, (RubyId)node.nd_mid(), args, 0); case NODE_FCALL: // TMP_PROTECT; tmpBlock = beginCallargs(); args = setupArgs(self, node.nd_args()); endCallArgs(tmpBlock); return self.getRubyClass().call(self, (RubyId)node.nd_mid(), args, 1); case NODE_VCALL: return self.getRubyClass().call(self, (RubyId)node.nd_mid(), null, 2); case NODE_SUPER: case NODE_ZSUPER: // TMP_PROTECT; if (getRubyFrame().getLastClass() == null) { throw new RubyNameException("superclass method '" + rubyFrame.getLastFunc().toName() + "' disabled"); } if (node.nd_type() == NODE_ZSUPER) { List argsList = getRubyFrame().getArgs(); args = (RubyObject[])argsList.toArray(new RubyObject[argsList.size()]); } else { tmpBlock = beginCallargs(); args = setupArgs(self, node.nd_args()); endCallArgs(tmpBlock); } rubyIter.push(rubyIter.getIter() != Iter.ITER_NOT ? Iter.ITER_PRE : Iter.ITER_NOT); result = getRubyFrame().getLastClass().getSuperClass().call(rubyFrame.getSelf(), rubyFrame.getLastFunc(), args, 3); rubyIter.pop(); return result; case NODE_SCOPE: NODE saved_cref = null; Frame frame = getRubyFrame(); frame.setTmp(getRubyFrame()); rubyFrame = frame; ruby.getRubyScope().push(); if (node.nd_rval() != null) { saved_cref = ruby_cref; ruby_cref = (NODE)node.nd_rval(); getRubyFrame().setCbase(node.nd_rval()); } if (node.nd_tbl() != null) { List tmp = Collections.nCopies(node.nd_tbl()[0].intValue() + 1, ruby.getNil()); ShiftableList vars = new ShiftableList(new ArrayList(tmp)); vars.set(0, (VALUE)node); vars.shift(1); getRuby().getRubyScope().setLocalVars(vars); getRuby().getRubyScope().setLocalTbl(node.nd_tbl()); } else { getRuby().getRubyScope().setLocalVars(null); getRuby().getRubyScope().setLocalTbl(null); } result = eval(self, node.nd_next()); ruby.getRubyScope().pop(); rubyFrame = frame.getTmp(); if (saved_cref != null) { ruby_cref = saved_cref; } return result; case NODE_OP_ASGN1: // TMP_PROTECT; recv = eval(self, node.nd_recv()); NODE rval = node.nd_args().nd_head(); args = setupArgs(self, node.nd_args().nd_next()); ArrayList argsList = new ArrayList(Arrays.asList(args)); argsList.remove(args.length - 1); RubyObject val = recv.funcall(getRuby().intern("[]"), (RubyObject[])argsList.toArray(new RubyObject[argsList.size()])); switch (node.nd_mid().intValue()) { case 0: /* OR */ if (val.isTrue()) { return val; } val = eval(self, rval); break; case 1: /* AND */ if (val.isFalse()) { return val; } val = eval(self, rval); break; default: val = val.funcall((RubyId)node.nd_mid(), eval(self, rval)); } args[args.length - 1] = val; return recv.funcall(getRuby().intern("[]="), args); case NODE_OP_ASGN2: ID id = node.nd_next().nd_vid(); recv = eval(self, node.nd_recv()); val = recv.funcall((RubyId)id, (RubyObject[])null); switch (node.nd_next().nd_mid().intValue()) { case 0: /* OR */ if (val.isTrue()) { return val; } val = eval(self, node.nd_value()); break; case 1: /* AND */ if (val.isFalse()) { return val; } val = eval(self, node.nd_value()); break; default: val = val.funcall((RubyId)node.nd_mid(), eval(self, node.nd_value())); } // HACK +++ val = recv.funcall((RubyId)node.nd_next().nd_aid(), val); // HACK --- return val; case NODE_OP_ASGN_AND: cond = eval(self, node.nd_head()); if (cond.isFalse()) { return cond; } node = node.nd_value(); break; case NODE_OP_ASGN_OR: cond = eval(self, node.nd_head()); if ((node.nd_aid() != null && !self.isInstanceVarDefined((RubyId)node.nd_aid())) || cond.isFalse()) { node = node.nd_value(); break; } return cond; case NODE_MASGN: return massign(self, node, eval(self, node.nd_value()), false); case NODE_LASGN: // if (ruby.ruby_scope.local_vars == null) { // rb_bug("unexpected local variable assignment"); // } result = eval(self, node.nd_value()); getRuby().getRubyScope().setLocalVars(node.nd_cnt(), result); return result; case NODE_DASGN: result = eval(self, node.nd_value()); RubyVarmap.assign(ruby, (RubyId)node.nd_vid(), result); return result; case NODE_DASGN_CURR: result = eval(self, node.nd_value()); RubyVarmap.assignCurrent(ruby, (RubyId)node.nd_vid(), result); return result; case NODE_GASGN: result = eval(self, node.nd_value()); ((RubyGlobalEntry)node.nd_entry()).set(result); return result; case NODE_IASGN: result = eval(self, node.nd_value()); self.setInstanceVar((RubyId)node.nd_vid(), result); return result; case NODE_CDECL: if (ruby_class == null) { throw new RubyTypeException("no class/module to define constant"); } result = eval(self, node.nd_value()); ruby_class.setConstant((RubyId)node.nd_vid(), result); return result; case NODE_CVDECL: if (ruby_cbase == null) { throw new RubyTypeException("no class/module to define class variable"); } result = eval(self, node.nd_value()); if (ruby_cbase.isSingleton()) { ruby_cbase.getInstanceVar("__attached__").getClassVarSingleton().declareClassVar((RubyId)node.nd_vid(), result); return result; } ruby_cbase.declareClassVar((RubyId)node.nd_vid(), result); return result; case NODE_CVASGN: result = eval(self, node.nd_value()); self.getClassVarSingleton().setClassVar((RubyId)node.nd_vid(), result); return result; case NODE_LVAR: //if (getRuby().ruby_scope.local_vars == null) { // rb_bug("unexpected local variable"); // } return (RubyObject)getRuby().getRubyScope().getLocalVars(node.nd_cnt()); case NODE_DVAR: return getDynamicVars().getRef((RubyId)node.nd_vid()); case NODE_GVAR: return ((RubyGlobalEntry)node.nd_entry()).get(); case NODE_IVAR: return self.getInstanceVar((RubyId)node.nd_vid()); case NODE_CONST: return getConstant((NODE)getRubyFrame().getCbase(), (RubyId)node.nd_vid(), self); case NODE_CVAR: /* normal method */ if (ruby_cbase == null) { return self.getRubyClass().getClassVar((RubyId)node.nd_vid()); } if (!ruby_cbase.isSingleton()) { return ruby_cbase.getClassVar((RubyId)node.nd_vid()); } return ruby_cbase.getInstanceVar("__attached__").getClassVarSingleton().getClassVar((RubyId)node.nd_vid()); case NODE_CVAR2: /* singleton method */ return self.getClassVarSingleton().getClassVar((RubyId)node.nd_vid()); case NODE_BLOCK_ARG: if (ruby.getRubyScope().getLocalVars() == null) { throw new RuntimeException("BUG: unexpected block argument"); } if (isBlockGiven()) { result = getRuby().getNil(); // Create Proc object ruby.getRubyScope().setLocalVars(node.nd_cnt(), result); return result; } else { return getRuby().getNil(); } case NODE_COLON2: value = eval(self, node.nd_head()); if (value instanceof RubyModule) { return ((RubyModule)value).getConstant((RubyId)node.nd_mid()); } else { return value.funcall((RubyId)node.nd_mid()); } case NODE_COLON3: return getRuby().getClasses().getObjectClass().getConstant((RubyId)node.nd_mid()); case NODE_NTH_REF: // return rom.rb_reg_nth_match(node.nd_nth(), MATCH_DATA); return null; case NODE_BACK_REF: /*switch ((char)node.nd_nth()) { case '&': return rom.rb_reg_last_match(MATCH_DATA); case '`': return rom.rb_reg_match_pre(MATCH_DATA); case '\'': return rom.rb_reg_match_post(MATCH_DATA); case '+': return rom.rb_reg_match_last(MATCH_DATA); default: rom.rb_bug("unexpected back-ref"); }*/ case NODE_HASH: RubyHash hash = RubyHash.m_newHash(ruby); NODE list = node.nd_head(); while(list != null) { RubyObject key = eval(self, list.nd_head()); list = list.nd_next(); if (list == null) { // HACK +++ throw new RubyArgumentException("odd number list for Hash"); // HACK --- } value = eval(self, list.nd_head()); hash.m_aset(key, value); list = list.nd_next(); } return hash; case NODE_ZARRAY: /* zero length list */ return RubyArray.m_newArray(getRuby()); case NODE_ARRAY: ArrayList ary = new ArrayList(node.nd_alen()); for (; node != null ; node = node.nd_next()) { ary.add(eval(self, node.nd_head())); } return RubyArray.m_newArray(getRuby(), ary); case NODE_STR: return ((RubyObject)node.nd_lit()).m_to_s(); case NODE_DSTR: case NODE_DXSTR: case NODE_DREGX: case NODE_DREGX_ONCE:/* NODE list = node.nd_next(); RubyString str = RubyString.m_newString(getRuby(), (RubyObject)node.nd_lit()); RubyString str2; while (list != null) { if (list.nd_head() != null) { switch (list.nd_head().nd_type()) { case NODE_STR: str2 = (RubyString)list.nd_head().nd_lit(); break; case NODE_EVSTR: result = ruby_errinfo; ruby_errinfo = Qnil; ruby_sourceline = nd_line(node); ruby_in_eval++; list.nd_head(compile(list.nd_head().nd_lit(), ruby_sourcefile,ruby_sourceline)); ruby_eval_tree = 0; ruby_in_eval--; if (ruby_nerrs > 0) { compile_error("string expansion"); } if (!NIL_P(result)) ruby_errinfo = result; /* fall through *//* default: str2 = (RubyString)rom.rb_obj_as_string(eval(list.nd_head())); break; } str.append(str2); str.infectObject(str2); } list = list.nd_next(); } switch (node.nd_type()) { case NODE_DREGX: return rom.rb_reg_new(str.getString(), str.getString().length(), node.nd_cflag()); case NODE_DREGX_ONCE: /* regexp expand once *//* VALUE result = rom.rb_reg_new(str.getString(), str.getString().length(), node.nd_cflag()); node.nd_set_type(NODE_LIT); node.nd_lit(result); return result; case NODE_DXSTR: return rom.rb_funcall(this, '`', 1, str); default: return str; }*/ return null; case NODE_XSTR: return self.funcall(getRuby().intern("`"), (RubyObject)node.nd_lit()); case NODE_LIT: return (RubyObject)node.nd_lit(); case NODE_ATTRSET: if (getRubyFrame().getArgs().size() != 1) { throw new RubyArgumentException("wrong # of arguments(" + rubyFrame.getArgs().size() + "for 1)"); } return self.setInstanceVar((RubyId)node.nd_vid(), (RubyObject)rubyFrame.getArgs().get(0)); case NODE_DEFN: if (node.nd_defn() != null) { int noex; if (ruby_class == null) { throw new RubyTypeException("no class to add method"); } //if (ruby_class == getRuby().getObjectClass() && node.nd_mid() == init) { // rom.rb_warn("redefining Object#initialize may cause infinite loop"); //} //if (node.nd_mid() == __id__ || node.nd_mid() == __send__) { // rom.rb_warn("redefining `%s' may cause serious problem", ((RubyId)node.nd_mid()).toName()); //} // ruby_class.setFrozen(true); SearchMethodResult smr = ruby_class.searchMethod((RubyId)node.nd_mid()); NODE body = smr.getBody(); RubyObject origin = smr.getOrigin(); if (body != null){ // if (ruby_verbose.isTrue() && ruby_class == origin && body.nd_cnt() == 0) { // rom.rb_warning("discarding old %s", ((RubyId)node.nd_mid()).toName()); // } // if (node.nd_noex() != 0) { /* toplevel */ /* should upgrade to rb_warn() if no super was called inside? */ // rom.rb_warning("overriding global function `%s'", ((RubyId)node.nd_mid()).toName()); // } } if (isScope(SCOPE_PRIVATE) || node.nd_mid().equals(ruby.intern("initialize"))) { noex = NOEX_PRIVATE; } else if (isScope(SCOPE_PROTECTED)) { noex = NOEX_PROTECTED; } else if (ruby_class == getRuby().getClasses().getObjectClass()) { noex = node.nd_noex(); } else { noex = NOEX_PUBLIC; } if (body != null && origin == ruby_class && (body.nd_noex() & NOEX_UNDEF) != 0) { noex |= NOEX_UNDEF; } NODE defn = node.nd_defn().copyNodeScope(ruby_cref); ruby_class.addMethod((RubyId)node.nd_mid(), defn, noex); // rb_clear_cache_by_id(node.nd_mid()); if (actMethodScope == SCOPE_MODFUNC) { ruby_class.getSingletonClass().addMethod((RubyId)node.nd_mid(), defn, NOEX_PUBLIC); ruby_class.funcall(getRuby().intern("singleton_method_added"), ((RubyId)node.nd_mid()).toSymbol()); } if (ruby_class.isSingleton()) { ruby_class.getInstanceVar("__attached__").funcall(getRuby().intern("singleton_method_added"), ((RubyId)node.nd_mid()).toSymbol()); } else { ruby_class.funcall(getRuby().intern("method_added"), ((RubyId)node.nd_mid()).toSymbol()); } } return getRuby().getNil(); case NODE_DEFS: if (node.nd_defn() != null) { recv = eval(self, node.nd_recv()); if (getRuby().getSecurityLevel() >= 4 && !recv.isTaint()) { throw new RubySecurityException("Insecure; can't define singleton method"); } /*if (FIXNUM_P(recv) || SYMBOL_P(recv)) { rb_raise(rb_eTypeError, "can't define singleton method \"%s\" for %s", rb_id2name(node.nd_mid()), rb_class2name(CLASS_OF(recv))); }*/ // not needed in jruby if (recv.isFrozen()) { throw new RubyFrozenException("object"); } rubyClass = recv.getSingletonClass(); NODE body = (NODE)rubyClass.getMethods().get((RubyId)node.nd_mid()); if (body != null) { if (getRuby().getSecurityLevel() >= 4) { throw new RubySecurityException("redefining method prohibited"); } /*if (RTEST(ruby_verbose)) { rb_warning("redefine %s", rb_id2name(node.nd_mid())); }*/ } NODE defn = node.nd_defn().copyNodeScope(ruby_cref); defn.nd_rval(ruby_cref); rubyClass.addMethod((RubyId)node.nd_mid(), defn, NOEX_PUBLIC | (body != null ? body.nd_noex() & NOEX_UNDEF : 0)); // rb_clear_cache_by_id(node.nd_mid()); recv.funcall(getRuby().intern("singleton_method_added"), ((RubyId)node.nd_mid()).toSymbol()); } return getRuby().getNil(); case NODE_UNDEF: if (ruby_class == null) { throw new RubyTypeException("no class to undef method"); } ruby_class.undef((RubyId)node.nd_mid()); return getRuby().getNil(); case NODE_ALIAS: if (ruby_class == null) { throw new RubyTypeException("no class to make alias"); } ruby_class.aliasMethod((RubyId)node.nd_new(), (RubyId)node.nd_old()); ruby_class.funcall(getRuby().intern("method_added"), ((RubyId)node.nd_mid()).toSymbol()); return getRuby().getNil(); case NODE_VALIAS: RubyGlobalEntry.getGlobalEntry((RubyId)node.nd_old()).alias((RubyId)node.nd_new()); return getRuby().getNil(); case NODE_CLASS: RubyModule superClass; if (ruby_class == null) { throw new RubyTypeException("no outer class/module"); } if (node.nd_super() != null) { superClass = getSuperClass(self, node.nd_super()); } else { superClass = null; } rubyClass = null; // if ((ruby_class == getRuby().getObjectClass()) && rb_autoload_defined(node.nd_cname())) { // rb_autoload_load(node.nd_cname()); // } if (ruby_class.isConstantDefined((RubyId)node.nd_cname())) { rubyClass = (RubyClass)ruby_class.getConstant((RubyId)node.nd_cname()); } if (rubyClass != null) { if (!rubyClass.isClass()) { throw new RubyTypeException(((RubyId)node.nd_cname()).toName() + " is not a class"); } if (superClass != null) { RubyModule tmp = rubyClass.getSuperClass(); if (tmp.isSingleton()) { tmp = tmp.getSuperClass(); } while (tmp.isIncluded()) { tmp = tmp.getSuperClass(); } if (tmp != superClass) { superClass = tmp; //goto override_class; if (superClass == null) { superClass = getRuby().getClasses().getObjectClass(); } rubyClass = getRuby().defineClassId((RubyId)node.nd_cname(), (RubyClass)superClass); ruby_class.setConstant((RubyId)node.nd_cname(), rubyClass); rubyClass.setClassPath((RubyClass)ruby_class, ((RubyId)node.nd_cname()).toName()); // end goto } } if (getRuby().getSecurityLevel() >= 4) { throw new RubySecurityException("extending class prohibited"); } // rb_clear_cache(); } else { //override_class: if (superClass == null) { superClass = getRuby().getClasses().getObjectClass(); } rubyClass = getRuby().defineClassId((RubyId)node.nd_cname(), (RubyClass)superClass); ruby_class.setConstant((RubyId)node.nd_cname(), rubyClass); rubyClass.setClassPath((RubyClass)ruby_class, ((RubyId)node.nd_cname()).toName()); } if (ruby_wrapper != null) { rubyClass.getSingletonClass().includeModule(ruby_wrapper); rubyClass.includeModule(ruby_wrapper); } return setupModule(rubyClass, node.nd_body()); case NODE_MODULE: if (ruby_class == null) { throw new RubyTypeException("no outer class/module"); } RubyModule module = null; if ((ruby_class == getRuby().getClasses().getObjectClass()) && getRuby().isAutoloadDefined((RubyId)node.nd_cname())) { // getRuby().rb_autoload_load(node.nd_cname()); } if (ruby_class.isConstantDefined((RubyId)node.nd_cname())) { module = (RubyModule)ruby_class.getConstant((RubyId)node.nd_cname()); } if (module != null) { if (!(module instanceof RubyModule)) { throw new RubyTypeException(((RubyId)node.nd_cname()).toName() + " is not a module"); } if (getRuby().getSecurityLevel() >= 4) { throw new RubySecurityException("extending module prohibited"); } } else { module = getRuby().defineModuleId((RubyId)node.nd_cname()); ruby_class.setConstant((RubyId)node.nd_cname(), module); module.setClassPath(ruby_class, ((RubyId)node.nd_cname()).toName()); } if (ruby_wrapper != null) { module.getSingletonClass().includeModule(ruby_wrapper); module.includeModule(ruby_wrapper); } return setupModule(module, node.nd_body()); case NODE_SCLASS: rubyClass = (RubyClass)eval(self, node.nd_recv()); if (rubyClass.isSpecialConst()) { throw new RubyTypeException("no virtual class for " + rubyClass.getRubyClass().toName()); } if (getRuby().getSecurityLevel() >= 4 && !rubyClass.isTaint()) { throw new RubySecurityException("Insecure: can't extend object"); } if (rubyClass.getRubyClass().isSingleton()) { // rb_clear_cache(); } rubyClass = rubyClass.getSingletonClass(); if (ruby_wrapper != null) { rubyClass.getSingletonClass().includeModule(ruby_wrapper); rubyClass.includeModule(ruby_wrapper); } return setupModule(rubyClass, node.nd_body()); case NODE_DEFINED: // String buf; // String desc = is_defined(self, node.nd_head(), buf); // // if (desc) { // result = rb_str_new2(desc); // } else { // result = Qnil; // } case NODE_NEWLINE: // ruby_sourcefile = node.nd_file; // ruby_sourceline = node.nd_nth(); // if (trace_func) { // call_trace_func("line", ruby_sourcefile, ruby_sourceline, self, // ruby_frame.last_func(), // ruby_frame.last_class()); // } node = node.nd_next(); break; default: // rom.rb_bug("unknown node type %d", nd_type(node)); } } }
48072 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/48072/a2024bddc1b8e83f4e8075d2080935c221a833fe/RubyInterpreter.java/clean/org/jruby/interpreter/RubyInterpreter.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 19817, 921, 5302, 12, 54, 10340, 921, 365, 16, 11922, 290, 13, 288, 3639, 11922, 756, 273, 290, 31, 7734, 19817, 921, 6941, 273, 446, 31, 3639, 19817, 921, 8526, 833, 273, 446, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 19817, 921, 5302, 12, 54, 10340, 921, 365, 16, 11922, 290, 13, 288, 3639, 11922, 756, 273, 290, 31, 7734, 19817, 921, 6941, 273, 446, 31, 3639, 19817, 921, 8526, 833, 273, 446, 31...
test.assertEquals("142277.07", result);
test.assertEquals("142,277.07", result);
protected void defineFunctions() { // first char: p=Property, m=Method, i=Infix, P=Prefix // 2nd: // ARRAY FUNCTIONS if (false) define(new FunDefBase("SetToArray", "SetToArray(<Set>[, <Set>]...[, <Numeric Expression>])", "Converts one or more sets to an array for use in a user-if (false) defined function.", "fa*")); // // DIMENSION FUNCTIONS define(new FunDefBase("Dimension", "<Hierarchy>.Dimension", "Returns the dimension that contains a specified hierarchy.", "pdh") { public Object evaluate(Evaluator evaluator, Exp[] args) { Hierarchy hierarchy = getHierarchyArg(evaluator, args, 0, true); return hierarchy.getDimension(); } }); //??Had to add this to get <Hierarchy>.Dimension to work? define(new FunDefBase("Dimension", "<Dimension>.Dimension", "Returns the dimension that contains a specified hierarchy.", "pdd") { public Object evaluate(Evaluator evaluator, Exp[] args) { Dimension dimension = getDimensionArg(evaluator, args, 0, true); return dimension; } public void testDimensionHierarchy(FoodMartTestCase test) { String s = test.executeExpr("[Time].Dimension.Name"); test.assertEquals("Time", s); } }); define(new FunDefBase("Dimension", "<Level>.Dimension", "Returns the dimension that contains a specified level.", "pdl") { public Object evaluate(Evaluator evaluator, Exp[] args) { Level level = getLevelArg(evaluator, args, 0, true); return level.getDimension(); } public void testLevelDimension(FoodMartTestCase test) { String s = test.executeExpr("[Time].[Year].Dimension"); test.assertEquals("[Time]", s); } }); define(new FunDefBase("Dimension", "<Member>.Dimension", "Returns the dimension that contains a specified member.", "pdm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); return member.getDimension(); } public void testMemberDimension(FoodMartTestCase test) { String s = test.executeExpr( "[Time].[1997].[Q2].Dimension"); test.assertEquals("[Time]", s); } }); define(new FunDefBase("Dimensions", "Dimensions(<Numeric Expression>)", "Returns the dimension whose zero-based position within the cube is specified by a numeric expression.", "fdn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Cube cube = evaluator.getCube(); Dimension[] dimensions = cube.getDimensions(); int n = getIntArg(evaluator, args, 0); if ((n > dimensions.length) || (n < 1)) { throw newEvalException( this, "Index '" + n + "' out of bounds"); } return dimensions[n - 1]; } public void testDimensionsNumeric(FoodMartTestCase test) { String s = test.executeExpr("Dimensions(2).Name"); test.assertEquals("Store", s); } }); define(new FunDefBase("Dimensions", "Dimensions(<String Expression>)", "Returns the dimension whose name is specified by a string.", "fdS") { public Object evaluate(Evaluator evaluator, Exp[] args) { String defValue = "Default Value"; String s = getStringArg(evaluator, args, 0, defValue); if (s.indexOf("[") == -1) { s = Util.quoteMdxIdentifier(s); } OlapElement o = lookupCompound(evaluator.getSchemaReader(), evaluator.getCube(), explode(s), false, Category.Dimension); if (o instanceof Dimension) { return (Dimension) o; } else if (o == null) { throw newEvalException(this, "Dimension '" + s + "' not found"); } else { throw newEvalException(this, "Dimensions(" + s + ") found " + o); } } public void testDimensionsString(FoodMartTestCase test) { String s = test.executeExpr( "Dimensions(\"Store\").UniqueName"); test.assertEquals("[Store]", s); } }); // // HIERARCHY FUNCTIONS define(new FunDefBase("Hierarchy", "<Level>.Hierarchy", "Returns a level's hierarchy.", "phl") { public Object evaluate(Evaluator evaluator, Exp[] args) { Level level = getLevelArg(evaluator, args, 0, true); return level.getHierarchy(); } }); define(new FunDefBase("Hierarchy", "<Member>.Hierarchy", "Returns a member's hierarchy.", "phm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); return member.getHierarchy(); } public void testTime(FoodMartTestCase test) { String s = test.executeExpr( "[Time].[1997].[Q1].[1].Hierarchy"); test.assertEquals("[Time]", s); } public void testBasic9(FoodMartTestCase test) { String s = test.executeExpr( "[Gender].[All Gender].[F].Hierarchy"); test.assertEquals("[Gender]", s); } public void testFirstInLevel9(FoodMartTestCase test) { String s = test.executeExpr( "[Education Level].[All Education Levels].[Bachelors Degree].Hierarchy"); test.assertEquals("[Education Level]", s); } public void testHierarchyAll(FoodMartTestCase test) { String s = test.executeExpr( "[Gender].[All Gender].Hierarchy"); test.assertEquals("[Gender]", s); } public void testHierarchyNull(FoodMartTestCase test) { String s = test.executeExpr( "[Gender].[All Gender].Parent.Hierarchy"); test.assertEquals("[Gender]", s); // MSOLAP gives "#ERR" } }); // // LEVEL FUNCTIONS define(new FunDefBase("Level", "<Member>.Level", "Returns a member's level.", "plm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); return member.getLevel(); } public void testMemberLevel(FoodMartTestCase test) { String s = test.executeExpr( "[Time].[1997].[Q1].[1].Level.UniqueName"); test.assertEquals("[Time].[Month]", s); } }); define(new FunDefBase("Levels", "<Hierarchy>.Levels(<Numeric Expression>)", "Returns the level whose position in a hierarchy is specified by a numeric expression.", "mlhn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Hierarchy hierarchy = getHierarchyArg(evaluator, args, 0, true); Level[] levels = hierarchy.getLevels(); int n = getIntArg(evaluator, args, 1); if ((n > levels.length) || (n < 1)) { throw newEvalException( this, "Index '" + n + "' out of bounds"); } return levels[n - 1]; } public void testLevelsNumeric(FoodMartTestCase test) { String s = test.executeExpr("[Time].Levels(2).Name"); test.assertEquals("Quarter", s); } public void testLevelsTooSmall(FoodMartTestCase test) { test.assertExprThrows( "[Time].Levels(0).Name", "Index '0' out of bounds"); } public void testLevelsTooLarge(FoodMartTestCase test) { test.assertExprThrows( "[Time].Levels(8).Name", "Index '8' out of bounds"); } }); define(new FunDefBase("Levels", "Levels(<String Expression>)", "Returns the level whose name is specified by a string expression.", "flS") { public Object evaluate(Evaluator evaluator, Exp[] args) { String s = getStringArg(evaluator, args, 0, null); Cube cube = evaluator.getCube(); OlapElement o = null; if (s.startsWith("[")) { o = lookupCompound(evaluator.getSchemaReader(), cube, explode(s), false, Category.Level); } else { // lookupCompound barfs if "s" doesn't have matching // brackets, so don't even try o = null; } if (o instanceof Level) { return (Level) o; } else if (o == null) { throw newEvalException(this, "Level '" + s + "' not found"); } else { throw newEvalException(this, "Levels('" + s + "') found " + o); } } public void testLevelsString(FoodMartTestCase test) { String s = test.executeExpr( "Levels(\"[Time].[Year]\").UniqueName"); test.assertEquals("[Time].[Year]", s); } public void testLevelsStringFail(FoodMartTestCase test) { test.assertExprThrows( "Levels(\"nonexistent\").UniqueName", "Level 'nonexistent' not found"); } }); // // LOGICAL FUNCTIONS define(new FunDefBase("IsEmpty", "IsEmpty(<Value Expression>)", "Determines if an expression evaluates to the empty cell value.", "fbS")); define(new FunDefBase("IsEmpty", "IsEmpty(<Value Expression>)", "Determines if an expression evaluates to the empty cell value.", "fbn")); // // MEMBER FUNCTIONS // if (false) define(new FunDefBase("Ancestor", "Ancestor(<Member>, <Level>)", "Returns the ancestor of a member at a specified level.", "fm*"); define(new FunDefBase("Ancestor", "Ancestor(<Member>, <Level>)", "Returns the ancestor of a member at a specified level.", "fmml") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, false); Level level = getLevelArg(evaluator, args, 1, false); if (member.getHierarchy() != level.getHierarchy()) { throw newEvalException( this, "member '" + member + "' is not in the same hierarchy as level '" + level + "'"); } if (member.getLevel().equals(level)) { return member; } Member[] members = member.getAncestorMembers(); for (int i = 0; i < members.length; i++) { if (members[i].getLevel().equals(level)) return members[i]; } return member.getHierarchy().getNullMember(); // not found } public void testAncestor(FoodMartTestCase test) { Member member = test.executeAxis( "Ancestor([Store].[USA].[CA].[Los Angeles],[Store Country])"); test.assertEquals("USA", member.getName()); } public void testAncestorHigher(FoodMartTestCase test) { Member member = test.executeAxis( "Ancestor([Store].[USA],[Store].[Store City])"); test.assertNull(member); // MSOLAP returns null } public void testAncestorSameLevel(FoodMartTestCase test) { Member member = test.executeAxis( "Ancestor([Store].[Canada],[Store].[Store Country])"); test.assertEquals("Canada", member.getName()); } public void testAncestorWrongHierarchy(FoodMartTestCase test) { // MSOLAP gives error "Formula error - dimensions are not // valid (they do not match) - in the Ancestor function" test.assertAxisThrows( "Ancestor([Gender].[M],[Store].[Store Country])", "member '[Gender].[All Gender].[M]' is not in the same hierarchy as level '[Store].[Store Country]'"); } public void testAncestorAllLevel(FoodMartTestCase test) { Member member = test.executeAxis( "Ancestor([Store].[USA].[CA],[Store].Levels(1))"); test.assertTrue(member.isAll()); } }); define(new FunDefBase("ClosingPeriod", "ClosingPeriod([<Level>[, <Member>]])", "Returns the last sibling among the descendants of a member at a level.", "fm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Cube cube = evaluator.getCube(); Dimension timeDimension = cube.getYearLevel().getDimension(); Member member = evaluator.getContext(timeDimension); Level level = member.getLevel().getChildLevel(); return openClosingPeriod(evaluator, this, member, level); } public void testClosingPeriodNoArgs(FoodMartTestCase test) { // MSOLAP returns [1997].[Q4], because [Time].CurrentMember = // [1997]. Member member = test.executeAxis("ClosingPeriod()"); test.assertEquals("[Time].[1997].[Q4]", member.getUniqueName()); } }); define(new FunDefBase("ClosingPeriod", "ClosingPeriod([<Level>[, <Member>]])", "Returns the last sibling among the descendants of a member at a level.", "fml") { public Object evaluate(Evaluator evaluator, Exp[] args) { Cube cube = evaluator.getCube(); Dimension timeDimension = cube.getYearLevel().getDimension(); Member member = evaluator.getContext(timeDimension); Level level = getLevelArg(evaluator, args, 0, true); return openClosingPeriod(evaluator, this, member, level); } public void testClosingPeriodLevel(FoodMartTestCase test) { Member member = test.executeAxis( "ClosingPeriod([Month])"); test.assertEquals("[Time].[1997].[Q4].[12]", member.getUniqueName()); } public void testClosingPeriodLevelNotInTimeFails(FoodMartTestCase test) { test.assertAxisThrows( "ClosingPeriod([Store].[Store City])", "member '[Time].[1997]' must be in same hierarchy as level '[Store].[Store City]'"); } }); define(new FunDefBase("ClosingPeriod", "ClosingPeriod([<Level>[, <Member>]])", "Returns the last sibling among the descendants of a member at a level.", "fmm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); Level level = member.getLevel().getChildLevel(); return openClosingPeriod(evaluator, this, member, level); } public void testClosingPeriodMember(FoodMartTestCase test) { Member member = test.executeAxis( "ClosingPeriod([USA])"); test.assertEquals("WA", member.getName()); } }); define(new FunDefBase("ClosingPeriod", "ClosingPeriod([<Level>[, <Member>]])", "Returns the last sibling among the descendants of a member at a level.", "fmlm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Level level = getLevelArg(evaluator, args, 0, true); Member member = getMemberArg(evaluator, args, 1, true); return openClosingPeriod(evaluator, this, member, level); } public void testClosingPeriod(FoodMartTestCase test) { Member member = test.executeAxis( "ClosingPeriod([Month],[1997])"); test.assertEquals("[Time].[1997].[Q4].[12]", member.getUniqueName()); } public void testClosingPeriodBelow(FoodMartTestCase test) { Member member = test.executeAxis( "ClosingPeriod([Quarter],[1997].[Q3].[8])"); test.assertNull(member); } }); define(new FunDefBase("Cousin", "Cousin(<Member1>, <Member2>)", "Returns the member with the same relative position under a member as the member specified.", "fmmm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member1 = getMemberArg(evaluator, args, 0, true); Member member2 = getMemberArg(evaluator, args, 1, true); Member cousin = cousin(evaluator.getSchemaReader(), member1, member2); if (cousin == null) { cousin = member1.getHierarchy().getNullMember(); } return cousin; } private Member cousin(SchemaReader schemaReader, Member member1, Member member2) { if (member1.getHierarchy() != member2.getHierarchy()) { throw newEvalException( this, "Members '" + member1 + "' and '" + member2 + "' are not compatible as cousins"); } if (member1.getLevel().getDepth() < member2.getLevel().getDepth()) { return null; } return cousin2(schemaReader, member1, member2); } private Member cousin2(SchemaReader schemaReader, Member member1, Member member2) { if (member1.getLevel() == member2.getLevel()) { return member2; } Member uncle = cousin2(schemaReader, member1.getParentMember(), member2); if (uncle == null) { return null; } int ordinal = Util.getMemberOrdinalInParent(schemaReader, member1); Member[] cousins = schemaReader.getMemberChildren(uncle); if (cousins.length < ordinal) { return null; } return cousins[ordinal]; } public void testCousin1(FoodMartTestCase test) { Member member = test.executeAxis( "Cousin([1997].[Q4],[1998])"); test.assertEquals("[Time].[1998].[Q4]", member.getUniqueName()); } public void testCousin2(FoodMartTestCase test) { Member member = test.executeAxis( "Cousin([1997].[Q4].[12],[1998].[Q1])"); test.assertEquals("[Time].[1998].[Q1].[3]", member.getUniqueName()); } public void testCousinOverrun(FoodMartTestCase test) { Member member = test.executeAxis( "Cousin([Customers].[USA].[CA].[San Jose], [Customers].[USA].[OR])"); // CA has more cities than OR test.assertNull(member); } public void testCousinThreeDown(FoodMartTestCase test) { Member member = test.executeAxis( "Cousin([Customers].[USA].[CA].[Berkeley].[Alma Shelton], [Customers].[Mexico])"); // Alma Shelton is the 3rd child // of the 4th child (Berkeley) // of the 1st child (CA) // of USA test.assertEquals("[Customers].[All Customers].[Mexico].[DF].[Tixapan].[Albert Clouse]", member.getUniqueName()); } public void testCousinSameLevel(FoodMartTestCase test) { Member member = test.executeAxis( "Cousin([Gender].[M], [Gender].[F])"); test.assertEquals("F", member.getName()); } public void testCousinHigherLevel(FoodMartTestCase test) { Member member = test.executeAxis( "Cousin([Time].[1997], [Time].[1998].[Q1])"); test.assertNull(member); } public void testCousinWrongHierarchy(FoodMartTestCase test) { test.assertAxisThrows( "Cousin([Time].[1997], [Gender].[M])", "Members '[Time].[1997]' and '[Gender].[All Gender].[M]' are not compatible as cousins"); } }); define(new FunDefBase("CurrentMember", "<Dimension>.CurrentMember", "Returns the current member along a dimension during an iteration.", "pmd") { public Object evaluate(Evaluator evaluator, Exp[] args) { Dimension dimension = getDimensionArg(evaluator, args, 0, true); return evaluator.getContext(dimension); } public void testCurrentMemberFromSlicer(FoodMartTestCase test) { Result result = test.runQuery( "with member [Measures].[Foo] as '[Gender].CurrentMember.Name'" + nl + "select {[Measures].[Foo]} on columns" + nl + "from Sales where ([Gender].[F])"); test.assertEquals("F", result.getCell(new int[] {0}).getValue()); } public void testCurrentMemberFromDefaultMember(FoodMartTestCase test) { Result result = test.runQuery( "with member [Measures].[Foo] as '[Time].CurrentMember.Name'" + nl + "select {[Measures].[Foo]} on columns" + nl + "from Sales"); test.assertEquals("1997", result.getCell(new int[] {0}).getValue()); } public void testCurrentMemberFromAxis(FoodMartTestCase test) { Result result = test.runQuery( "with member [Measures].[Foo] as '[Gender].CurrentMember.Name || [Marital Status].CurrentMember.Name'" + nl + "select {[Measures].[Foo]} on columns," + nl + " CrossJoin({[Gender].children}, {[Marital Status].children}) on rows" + nl + "from Sales"); test.assertEquals("FM", result.getCell(new int[] {0,0}).getValue()); } /** * When evaluating a calculated member, MSOLAP regards that * calculated member as the current member of that dimension, so it * cycles in this case. But I disagree; it is the previous current * member, before the calculated member was expanded. */ public void testCurrentMemberInCalcMember(FoodMartTestCase test) { Result result = test.runQuery( "with member [Measures].[Foo] as '[Measures].CurrentMember.Name'" + nl + "select {[Measures].[Foo]} on columns" + nl + "from Sales"); test.assertEquals("Unit Sales", result.getCell(new int[] {0}).getValue()); } }); define(new FunDefBase("DefaultMember", "<Dimension>.DefaultMember", "Returns the default member of a dimension.", "pmd") { public Object evaluate(Evaluator evaluator, Exp[] args) { Dimension dimension = getDimensionArg(evaluator, args, 0, true); return dimension.getHierarchy().getDefaultMember(); } public void testDimensionDefaultMember(FoodMartTestCase test) { Member member = test.executeAxis( "[Measures].DefaultMember"); test.assertEquals("Unit Sales", member.getName()); } }); define(new FunDefBase("FirstChild", "<Member>.FirstChild", "Returns the first child of a member.", "pmm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); Member[] children = evaluator.getSchemaReader().getMemberChildren(member); if (children.length == 0) { return member.getHierarchy().getNullMember(); } else { return children[0]; } } public void testFirstChildFirstInLevel(FoodMartTestCase test) { Member member = test.executeAxis( "[Time].[1997].[Q4].FirstChild"); test.assertEquals("10", member.getName()); } public void testFirstChildAll(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[All Gender].FirstChild"); test.assertEquals("F", member.getName()); } public void testFirstChildOfChildless(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[All Gender].[F].FirstChild"); test.assertNull(member); } }); define(new FunDefBase("FirstSibling", "<Member>.FirstSibling", "Returns the first child of the parent of a member.", "pmm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); Member parent = member.getParentMember(); Member[] children; if (parent == null) { if (member.isNull()) { return member; } children = evaluator.getSchemaReader().getHierarchyRootMembers(member.getHierarchy()); } else { children = evaluator.getSchemaReader().getMemberChildren(parent); } return children[0]; } public void testFirstSiblingFirstInLevel(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[F].FirstSibling"); test.assertEquals("F", member.getName()); } public void testFirstSiblingLastInLevel(FoodMartTestCase test) { Member member = test.executeAxis( "[Time].[1997].[Q4].FirstSibling"); test.assertEquals("Q1", member.getName()); } public void testFirstSiblingAll(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[All Gender].FirstSibling"); test.assertTrue(member.isAll()); } public void testFirstSiblingRoot(FoodMartTestCase test) { // The [Measures] hierarchy does not have an 'all' member, so // [Unit Sales] does not have a parent. Member member = test.executeAxis( "[Measures].[Store Sales].FirstSibling"); test.assertEquals("Unit Sales", member.getName()); } public void testFirstSiblingNull(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[F].FirstChild.FirstSibling"); test.assertNull(member); } }); if (false) define(new FunDefBase("Item", "<Tuple>.Item(<Numeric Expression>)", "Returns a member from a tuple.", "mm*")); define(new FunkResolver( "Lag", "<Member>.Lag(<Numeric Expression>)", "Returns a member further along the specified member's dimension.", new String[]{"mmmn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); int n = getIntArg(evaluator, args, 1); return evaluator.getSchemaReader().getLeadMember(member, -n); } public void testLag(FoodMartTestCase test) { Member member = test.executeAxis( "[Time].[1997].[Q4].[12].Lag(4)"); test.assertEquals("8", member.getName()); } public void testLagFirstInLevel(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[F].Lag(1)"); test.assertNull(member); } public void testLagAll(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].DefaultMember.Lag(2)"); test.assertNull(member); } public void testLagRoot(FoodMartTestCase test) { Member member = test.executeAxis( "[Time].[1998].Lag(1)"); test.assertEquals("1997", member.getName()); } public void testLagRootTooFar(FoodMartTestCase test) { Member member = test.executeAxis("[Time].[1998].Lag(2)"); test.assertNull(member); } })); define(new FunDefBase("LastChild", "<Member>.LastChild", "Returns the last child of a member.", "pmm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); Member[] children = evaluator.getSchemaReader().getMemberChildren(member); if (children.length == 0) { return member.getHierarchy().getNullMember(); } else { return children[children.length - 1]; } } public void testLastChild(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].LastChild"); test.assertEquals("M", member.getName()); } public void testLastChildLastInLevel(FoodMartTestCase test) { Member member = test.executeAxis( "[Time].[1997].[Q4].LastChild"); test.assertEquals("12", member.getName()); } public void testLastChildAll(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[All Gender].LastChild"); test.assertEquals("M", member.getName()); } public void testLastChildOfChildless(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[M].LastChild"); test.assertNull(member); } }); define(new FunDefBase("LastSibling", "<Member>.LastSibling", "Returns the last child of the parent of a member.", "pmm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); Member parent = member.getParentMember(); Member[] children; if (parent == null) { if (member.isNull()) { return member; } children = evaluator.getSchemaReader().getHierarchyRootMembers(member.getHierarchy()); } else { children = evaluator.getSchemaReader().getMemberChildren(parent); } return children[children.length - 1]; } public void testLastSibling(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[F].LastSibling"); test.assertEquals("M", member.getName()); } public void testLastSiblingFirstInLevel(FoodMartTestCase test) { Member member = test.executeAxis( "[Time].[1997].[Q1].LastSibling"); test.assertEquals("Q4", member.getName()); } public void testLastSiblingAll(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[All Gender].LastSibling"); test.assertTrue(member.isAll()); } public void testLastSiblingRoot(FoodMartTestCase test) { // The [Time] hierarchy does not have an 'all' member, so // [1997], [1998] do not have parents. Member member = test.executeAxis( "[Time].[1998].LastSibling"); test.assertEquals("1998", member.getName()); } public void testLastSiblingNull(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[F].FirstChild.LastSibling"); test.assertNull(member); } }); define(new FunkResolver( "Lead", "<Member>.Lead(<Numeric Expression>)", "Returns a member further along the specified member's dimension.", new String[]{"mmmn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); int n = getIntArg(evaluator, args, 1); return evaluator.getSchemaReader().getLeadMember(member, n); } public void testLead(FoodMartTestCase test) { Member member = test.executeAxis( "[Time].[1997].[Q2].[4].Lead(4)"); test.assertEquals("8", member.getName()); } public void testLeadNegative(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[M].Lead(-1)"); test.assertEquals("F", member.getName()); } public void testLeadLastInLevel(FoodMartTestCase test) { Member member = test.executeAxis( "[Gender].[M].Lead(3)"); test.assertNull(member); } })); define(new FunDefBase("Members", "Members(<String Expression>)", "Returns the member whose name is specified by a string expression.", "fmS")); define(new FunDefBase( "NextMember", "<Member>.NextMember", "Returns the next member in the level that contains a specified member.", "pmm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); return evaluator.getSchemaReader().getLeadMember(member, +1); } public void testBasic2(FoodMartTestCase test) { Result result = test.runQuery( "select {[Gender].[F].NextMember} ON COLUMNS from Sales"); test.assertTrue(result.getAxes()[0].positions[0].members[0].getName().equals("M")); } public void testFirstInLevel2(FoodMartTestCase test) { Result result = test.runQuery( "select {[Gender].[M].NextMember} ON COLUMNS from Sales"); test.assertTrue(result.getAxes()[0].positions.length == 0); } public void testAll2(FoodMartTestCase test) { Result result = test.runQuery( "select {[Gender].PrevMember} ON COLUMNS from Sales"); // previous to [Gender].[All] is null, so no members are returned test.assertTrue(result.getAxes()[0].positions.length == 0); } }); if (false) define(new FunDefBase("OpeningPeriod", "OpeningPeriod([<Level>[, <Member>]])", "Returns the first sibling among the descendants of a member at a level.", "fm*")); if (false) define(new FunDefBase("ParallelPeriod", "ParallelPeriod([<Level>[, <Numeric Expression>[, <Member>]]])", "Returns a member from a prior period in the same relative position as a specified member.", "fm*")); define(new FunDefBase("Parent", "<Member>.Parent", "Returns the parent of a member.", "pmm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); Member parent = member.getParentMember(); if (parent == null || !evaluator.getSchemaReader().getRole().canAccess(parent)) { parent = member.getHierarchy().getNullMember(); } return parent; } public void testBasic5(FoodMartTestCase test) { Result result = test.runQuery( "select{ [Product].[All Products].[Drink].Parent} on columns from Sales"); test.assertTrue(result.getAxes()[0].positions[0].members[0].getName().equals("All Products")); } public void testFirstInLevel5(FoodMartTestCase test) { Result result = test.runQuery( "select {[Time].[1997].[Q2].[4].Parent} on columns,{[Gender].[M]} on rows from Sales"); test.assertTrue(result.getAxes()[0].positions[0].members[0].getName().equals("Q2")); } public void testAll5(FoodMartTestCase test) { Result result = test.runQuery( "select {[Time].[1997].[Q2].Parent} on columns,{[Gender].[M]} on rows from Sales"); // previous to [Gender].[All] is null, so no members are returned test.assertTrue(result.getAxes()[0].positions[0].members[0].getName().equals("1997")); } }); define(new FunDefBase("PrevMember", "<Member>.PrevMember", "Returns the previous member in the level that contains a specified member.", "pmm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); return evaluator.getSchemaReader().getLeadMember(member, -1); } public void testBasic(FoodMartTestCase test) { Result result = test.runQuery( "select {[Gender].[M].PrevMember} ON COLUMNS from Sales"); test.assertTrue(result.getAxes()[0].positions[0].members[0].getName().equals("F")); } public void testFirstInLevel(FoodMartTestCase test) { Result result = test.runQuery( "select {[Gender].[F].PrevMember} ON COLUMNS from Sales"); test.assertTrue(result.getAxes()[0].positions.length == 0); } public void testAll(FoodMartTestCase test) { Result result = test.runQuery( "select {[Gender].PrevMember} ON COLUMNS from Sales"); // previous to [Gender].[All] is null, so no members are returned test.assertTrue(result.getAxes()[0].positions.length == 0); } }); if (false) define(new FunDefBase("ValidMeasure", "ValidMeasure(<Tuple>)", "Returns a valid measure in a virtual cube by forcing inapplicable dimensions to their top level.", "fm*")); // // NUMERIC FUNCTIONS define(new FunkResolver("Aggregate", "Aggregate(<Set>[, <Numeric Expression>])", "Returns a calculated value using the appropriate aggregate function, based on the context of the query.", new String[] {"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); String aggregator = (String) evaluator.getProperty(Property.PROPERTY_AGGREGATION_TYPE); if (aggregator == null) { throw newEvalException(null, "Could not find an aggregator in the current evaluation context"); } return aggregate(evaluator.push(), aggregator, members, exp); } public void testAggregate(FoodMartTestCase test) { test.runQueryCheckResult( "WITH MEMBER [Store].[CA plus OR] AS 'AGGREGATE({[Store].[USA].[CA], [Store].[USA].[OR]})'" + nl + "SELECT {[Measures].[Unit Sales], [Measures].[Store Sales]} ON COLUMNS," + nl + " {[Store].[USA].[CA], [Store].[USA].[OR], [Store].[CA plus OR]} ON ROWS" + nl + "FROM Sales" + nl + "WHERE ([1997].[Q1])", "Axis #0:" + nl + "{[Time].[1997].[Q1]}" + nl + "Axis #1:" + nl + "{[Measures].[Unit Sales]}" + nl + "{[Measures].[Store Sales]}" + nl + "Axis #2:" + nl + "{[Store].[All Stores].[USA].[CA]}" + nl + "{[Store].[All Stores].[USA].[OR]}" + nl + "{[Store].[CA plus OR]}" + nl + "Row #0: 16,890" + nl + "Row #0: 36,175.20" + nl + "Row #1: 19,287" + nl + "Row #1: 40,170.29" + nl + "Row #2: 36177.0" + nl + "Row #2: 76345.48999999999" + nl); } public void testAggregate2(FoodMartTestCase test) { test.runQueryCheckResult( "WITH" + nl + " MEMBER [Time].[1st Half Sales] AS 'Aggregate({Time.[1997].[Q1], Time.[1997].[Q2]})'" + nl + " MEMBER [Time].[2nd Half Sales] AS 'Aggregate({Time.[1997].[Q3], Time.[1997].[Q4]})'" + nl + " MEMBER [Time].[Difference] AS 'Time.[2nd Half Sales] - Time.[1st Half Sales]'" + nl + "SELECT" + nl + " { [Store].[Store State].Members} ON COLUMNS," + nl + " { Time.[1st Half Sales], Time.[2nd Half Sales], Time.[Difference]} ON ROWS" + nl + "FROM Sales" + nl + "WHERE [Measures].[Store Sales]", "Axis #0:" + nl + "{[Measures].[Store Sales]}" + nl + "Axis #1:" + nl + "{[Store].[All Stores].[Canada].[BC]}" + nl + "{[Store].[All Stores].[Mexico].[DF]}" + nl + "{[Store].[All Stores].[Mexico].[Guerrero]}" + nl + "{[Store].[All Stores].[Mexico].[Jalisco]}" + nl + "{[Store].[All Stores].[Mexico].[Veracruz]}" + nl + "{[Store].[All Stores].[Mexico].[Yucatan]}" + nl + "{[Store].[All Stores].[Mexico].[Zacatecas]}" + nl + "{[Store].[All Stores].[USA].[CA]}" + nl + "{[Store].[All Stores].[USA].[OR]}" + nl + "{[Store].[All Stores].[USA].[WA]}" + nl + "Axis #2:" + nl + "{[Time].[1st Half Sales]}" + nl + "{[Time].[2nd Half Sales]}" + nl + "{[Time].[Difference]}" + nl + "Row #0: (null)" + nl + "Row #0: (null)" + nl + "Row #0: (null)" + nl + "Row #0: (null)" + nl + "Row #0: (null)" + nl + "Row #0: (null)" + nl + "Row #0: (null)" + nl + "Row #0: 74571.95" + nl + "Row #0: 71943.17" + nl + "Row #0: 125779.5" + nl + "Row #1: (null)" + nl + "Row #1: (null)" + nl + "Row #1: (null)" + nl + "Row #1: (null)" + nl + "Row #1: (null)" + nl + "Row #1: (null)" + nl + "Row #1: (null)" + nl + "Row #1: 84595.89" + nl + "Row #1: 70333.9" + nl + "Row #1: 138013.72" + nl + "Row #2: 0.0" + nl + "Row #2: 0.0" + nl + "Row #2: 0.0" + nl + "Row #2: 0.0" + nl + "Row #2: 0.0" + nl + "Row #2: 0.0" + nl + "Row #2: 0.0" + nl + "Row #2: 10023.940000000002" + nl + "Row #2: -1609.270000000004" + nl + "Row #2: 12234.220000000001" + nl); } public void testAggregateToSimulateCompoundSlicer(FoodMartTestCase test) { test.runQueryCheckResult( "WITH MEMBER [Time].[1997 H1] as 'Aggregate({[Time].[1997].[Q1], [Time].[1997].[Q2]})'" + nl + " MEMBER [Education Level].[College or higher] as 'Aggregate({[Education Level].[Bachelors Degree], [Education Level].[Graduate Degree]})'" + nl + "SELECT {[Measures].[Unit Sales], [Measures].[Store Sales]} on columns," + nl + " {[Product].children} on rows" + nl + "FROM [Sales]" + nl + "WHERE ([Time].[1997 H1], [Education Level].[College or higher], [Gender].[F])", "Axis #0:" + nl + "{[Time].[1997 H1], [Education Level].[College or higher], [Gender].[All Gender].[F]}" + nl + "Axis #1:" + nl + "{[Measures].[Unit Sales]}" + nl + "{[Measures].[Store Sales]}" + nl + "Axis #2:" + nl + "{[Product].[All Products].[Drink]}" + nl + "{[Product].[All Products].[Food]}" + nl + "{[Product].[All Products].[Non-Consumable]}" + nl + "Row #0: 2233.0" + nl + "Row #0: 4508.93" + nl + "Row #1: 18154.0" + nl + "Row #1: 38608.69" + nl + "Row #2: 4941.0" + nl + "Row #2: 10662.2" + nl); } })); define(new FunkResolver( "Avg", "Avg(<Set>[, <Numeric Expression>])", "Returns the average value of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return avg(evaluator.push(), members, exp); } public void testAvg(FoodMartTestCase test) { String result = test.executeExpr( "AVG({[Store].[All Stores].[USA].children},[Measures].[Store Sales])"); test.assertEquals("188412.71", result); } //todo: testAvgWithNulls })); define(new FunkResolver( "Correlation", "Correlation(<Set>, <Numeric Expression>[, <Numeric Expression>])", "Returns the correlation of two series evaluated over a set.", new String[]{"fnxn","fnxnn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp1 = (ExpBase) getArg(evaluator, args, 1); ExpBase exp2 = (ExpBase) getArg(evaluator, args, 2, valueFunCall); return correlation(evaluator.push(), members, exp1, exp2); } public void testCorrelation(FoodMartTestCase test) { String result = test.executeExpr("Correlation({[Store].[All Stores].[USA].children}, [Measures].[Unit Sales], [Measures].[Store Sales])"); test.assertEquals("0.9999063938016924", result); } })); define(new FunkResolver( "Count", "Count(<Set>[, EXCLUDEEMPTY | INCLUDEEMPTY])", "Returns the number of tuples in a set, empty cells included unless the optional EXCLUDEEMPTY flag is used.", new String[]{"fnx", "fnxy"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); String empties = getLiteralArg(args, 1, "INCLUDEEMPTY", new String[] {"INCLUDEEMPTY", "EXCLUDEEMPTY"}, null); final boolean includeEmpty = empties.equals("INCLUDEEMPTY"); return count(members, includeEmpty); } public void testCount(FoodMartTestCase test) { String result = test.executeExpr( "count({[Promotion Media].[Media Type].members})"); test.assertEquals("14.0", result); } //todo: testCountNull, testCountNoExp })); define(new FunkResolver( "Covariance", "Covariance(<Set>, <Numeric Expression>[, <Numeric Expression>])", "Returns the covariance of two series evaluated over a set (biased).", new String[]{"fnxn","fnxnn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp1 = (ExpBase) getArg(evaluator, args, 1); ExpBase exp2 = (ExpBase) getArg(evaluator, args, 2); return covariance(evaluator.push(), members, exp1, exp2, true); } public void testCovariance(FoodMartTestCase test) { String result = test.executeExpr("Covariance({[Store].[All Stores].[USA].children}, [Measures].[Unit Sales], [Measures].[Store Sales])"); test.assertEquals("1.3557618990466664E9", result); } })); define(new FunkResolver( "CovarianceN", "CovarianceN(<Set>, <Numeric Expression>[, <Numeric Expression>])", "Returns the covariance of two series evaluated over a set (unbiased).", new String[]{"fnxn","fnxnn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp1 = (ExpBase) getArg(evaluator, args, 1); ExpBase exp2 = (ExpBase) getArg(evaluator, args, 2, valueFunCall); return covariance(evaluator.push(), members, exp1, exp2, false); } public void testCovarianceN(FoodMartTestCase test) { String result = test.executeExpr("CovarianceN({[Store].[All Stores].[USA].children}, [Measures].[Unit Sales], [Measures].[Store Sales])"); test.assertEquals("2.0336428485699995E9", result); } })); define(new FunDefBase("IIf", "IIf(<Logical Expression>, <Numeric Expression1>, <Numeric Expression2>)", "Returns one of two numeric values determined by a logical test.", "fnbnn")); if (false) define(new FunDefBase("LinRegIntercept", "LinRegIntercept(<Set>, <Numeric Expression>[, <Numeric Expression>])", "Calculates the linear regression of a set and returns the value of b in the regression line y = ax + b.", "fn*")); if (false) define(new FunDefBase("LinRegPoint", "LinRegPoint(<Numeric Expression>, <Set>, <Numeric Expression>[, <Numeric Expression>])", "Calculates the linear regression of a set and returns the value of y in the regression line y = ax + b.", "fn*")); if (false) define(new FunDefBase("LinRegR2", "LinRegR2(<Set>, <Numeric Expression>[, <Numeric Expression>])", "Calculates the linear regression of a set and returns R2 (the coefficient of determination).", "fn*")); if (false) define(new FunDefBase("LinRegSlope", "LinRegSlope(<Set>, <Numeric Expression>[, <Numeric Expression>])", "Calculates the linear regression of a set and returns the value of a in the regression line y = ax + b.", "fn*")); if (false) define(new FunDefBase("LinRegVariance", "LinRegVariance(<Set>, <Numeric Expression>[, <Numeric Expression>])", "Calculates the linear regression of a set and returns the variance associated with the regression line y = ax + b.", "fn*")); define(new FunkResolver( "Max", "Max(<Set>[, <Numeric Expression>])", "Returns the maximum value of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return max(evaluator.push(), members, exp); } public void testMax(FoodMartTestCase test) { String result = test.executeExpr( "MAX({[Store].[All Stores].[USA].children},[Measures].[Store Sales])"); test.assertEquals("263793.22", result); } })); define(new FunkResolver( "Median", "Median(<Set>[, <Numeric Expression>])", "Returns the median value of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); //todo: ignore nulls, do we need to ignore the vector? return median(evaluator.push(), members, exp); } public void testMedian(FoodMartTestCase test) { String result = test.executeExpr( "MEDIAN({[Store].[All Stores].[USA].children},[Measures].[Store Sales])"); test.assertEquals("159167.84", result); } public void testMedian2(FoodMartTestCase test) { test.runQueryCheckResult( "WITH" + nl + " MEMBER [Time].[1st Half Sales] AS 'Sum({[Time].[1997].[Q1], [Time].[1997].[Q2]})'" + nl + " MEMBER [Time].[2nd Half Sales] AS 'Sum({[Time].[1997].[Q3], [Time].[1997].[Q4]})'" + nl + " MEMBER [Time].[Median] AS 'Median(Time.Members)'" + nl + "SELECT" + nl + " NON EMPTY { [Store].[Store Name].Members} ON COLUMNS," + nl + " { [Time].[1st Half Sales], [Time].[2nd Half Sales], [Time].[Median]} ON ROWS" + nl + "FROM Sales" + nl + "WHERE [Measures].[Store Sales]", "Axis #0:" + nl + "{[Measures].[Store Sales]}" + nl + "Axis #1:" + nl + "{[Store].[All Stores].[USA].[CA].[Beverly Hills].[Store 6]}" + nl + "{[Store].[All Stores].[USA].[CA].[Los Angeles].[Store 7]}" + nl + "{[Store].[All Stores].[USA].[CA].[San Diego].[Store 24]}" + nl + "{[Store].[All Stores].[USA].[CA].[San Francisco].[Store 14]}" + nl + "{[Store].[All Stores].[USA].[OR].[Portland].[Store 11]}" + nl + "{[Store].[All Stores].[USA].[OR].[Salem].[Store 13]}" + nl + "{[Store].[All Stores].[USA].[WA].[Bellingham].[Store 2]}" + nl + "{[Store].[All Stores].[USA].[WA].[Bremerton].[Store 3]}" + nl + "{[Store].[All Stores].[USA].[WA].[Seattle].[Store 15]}" + nl + "{[Store].[All Stores].[USA].[WA].[Spokane].[Store 16]}" + nl + "{[Store].[All Stores].[USA].[WA].[Tacoma].[Store 17]}" + nl + "{[Store].[All Stores].[USA].[WA].[Walla Walla].[Store 22]}" + nl + "{[Store].[All Stores].[USA].[WA].[Yakima].[Store 23]}" + nl + "Axis #2:" + nl + "{[Time].[1st Half Sales]}" + nl + "{[Time].[2nd Half Sales]}" + nl + "{[Time].[Median]}" + nl + "Row #0: 20801.04" + nl + "Row #0: 25421.41" + nl + "Row #0: 26275.11" + nl + "Row #0: 2074.3900000000003" + nl + "Row #0: 28519.18" + nl + "Row #0: 43423.990000000005" + nl + "Row #0: 2140.99" + nl + "Row #0: 25502.08" + nl + "Row #0: 25293.5" + nl + "Row #0: 23265.53" + nl + "Row #0: 34926.91" + nl + "Row #0: 2159.6" + nl + "Row #0: 12490.89" + nl + "Row #1: 24949.199999999997" + nl + "Row #1: 29123.87" + nl + "Row #1: 28156.03" + nl + "Row #1: 2366.79" + nl + "Row #1: 26539.61" + nl + "Row #1: 43794.28999999999" + nl + "Row #1: 2598.24" + nl + "Row #1: 27394.22" + nl + "Row #1: 27350.57" + nl + "Row #1: 26368.93" + nl + "Row #1: 39917.05" + nl + "Row #1: 2546.37" + nl + "Row #1: 11838.34" + nl + "Row #2: 4577.35" + nl + "Row #2: 5211.38" + nl + "Row #2: 4722.87" + nl + "Row #2: 398.24" + nl + "Row #2: 5039.5" + nl + "Row #2: 7374.59" + nl + "Row #2: 410.22" + nl + "Row #2: 4924.04" + nl + "Row #2: 4569.13" + nl + "Row #2: 4511.68" + nl + "Row #2: 6630.91" + nl + "Row #2: 419.51" + nl + "Row #2: 2169.48" + nl); } })); define(new FunkResolver( "Min", "Min(<Set>[, <Numeric Expression>])", "Returns the minimum value of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return min(evaluator.push(), members, exp); } public void testMin(FoodMartTestCase test) { String result = test.executeExpr( "MIN({[Store].[All Stores].[USA].children},[Measures].[Store Sales])"); test.assertEquals("142277.07", result); } })); define(new FunDefBase("Ordinal", "<Level>.Ordinal", "Returns the zero-based ordinal value associated with a level.", "pnl")); if (false) define(new FunDefBase("Rank", "Rank(<Tuple>, <Set>)", "Returns the one-based rank of a tuple in a set.", "fn*")); define(new FunkResolver( "Stddev", "Stddev(<Set>[, <Numeric Expression>])", "Alias for Stdev.", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return stdev(evaluator.push(), members, exp, false); } })); define(new FunkResolver( "Stdev", "Stdev(<Set>[, <Numeric Expression>])", "Returns the standard deviation of a numeric expression evaluated over a set (unbiased).", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return stdev(evaluator.push(), members, exp, false); } public void testStdev(FoodMartTestCase test) { String result = test.executeExpr( "STDEV({[Store].[All Stores].[USA].children},[Measures].[Store Sales])"); test.assertEquals("65825.4547549297", result); } })); define(new FunkResolver( "StddevP", "StddevP(<Set>[, <Numeric Expression>])", "Alias for StdevP.", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return stdev(evaluator.push(), members, exp, true); } })); define(new FunkResolver( "StdevP", "StdevP(<Set>[, <Numeric Expression>])", "Returns the standard deviation of a numeric expression evaluated over a set (biased).", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return stdev(evaluator.push(), members, exp, true); } public void testStdevP(FoodMartTestCase test) { String result = test.executeExpr( "STDEVP({[Store].[All Stores].[USA].children},[Measures].[Store Sales])"); test.assertEquals("53746.25874541283", result); } })); define(new FunkResolver( "Sum", "Sum(<Set>[, <Numeric Expression>])", "Returns the sum of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return sum(evaluator.push(), members, exp); } public void testSumNoExp(FoodMartTestCase test) { String result = test.executeExpr( "SUM({[Promotion Media].[Media Type].members})"); test.assertEquals("266773.0", result); } })); define(new FunDefBase("Value", "<Measure>.Value", "Returns the value of a measure.", "pnm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); return member.evaluateScalar(evaluator); } }); define(new FunDefBase("_Value", "_Value(<Tuple>)", "Returns the value of the current measure within the context of a tuple.", "fvt") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member[] members = getTupleArg(evaluator, args, 0); Evaluator evaluator2 = evaluator.push(members); return evaluator2.evaluateCurrent(); } }); define(new FunDefBase("_Value", "_Value()", "Returns the value of the current measure.", "fv") { public Object evaluate(Evaluator evaluator, Exp[] args) { return evaluator.evaluateCurrent(); } }); // _Value is a pseudo-function which evaluates a tuple to a number. // It needs a custom resolver. if (false) define(new ResolverBase("_Value", null, null, FunDef.TypeParentheses) { public FunDef resolve(Exp[] args, int[] conversionCount) { if (args.length == 1 && args[0].getType() == Category.Tuple) { return new ValueFunDef(new int[] {Category.Tuple}); } for (int i = 0; i < args.length; i++) { Exp arg = args[i]; if (!canConvert(arg, Category.Member, conversionCount)) { return null; } } int[] argTypes = new int[args.length]; for (int i = 0; i < argTypes.length; i++) { argTypes[i] = Category.Member; } return new ValueFunDef(argTypes); } }); define(new FunkResolver( "Var", "Var(<Set>[, <Numeric Expression>])", "Returns the variance of a numeric expression evaluated over a set (unbiased).", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return var(evaluator.push(), members, exp, false); } public void testVar(FoodMartTestCase test) { String result = test.executeExpr( "VAR({[Store].[All Stores].[USA].children},[Measures].[Store Sales])"); test.assertEquals("4.332990493693297E9", result); } })); define(new FunkResolver( "Variance", "Variance(<Set>[, <Numeric Expression>])", "Alias for Var.", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return var(evaluator.push(), members, exp, false); } })); define(new FunkResolver( "VarianceP", "VarianceP(<Set>[, <Numeric Expression>])", "Alias for VarP.", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return var(evaluator.push(), members, exp, true); } })); define(new FunkResolver( "VarP", "VarP(<Set>[, <Numeric Expression>])", "Returns the variance of a numeric expression evaluated over a set (biased).", new String[]{"fnx", "fnxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 1, valueFunCall); return var(evaluator.push(), members, exp, true); } public void testVarP(FoodMartTestCase test) { String result = test.executeExpr( "VARP({[Store].[All Stores].[USA].children},[Measures].[Store Sales])"); test.assertEquals("2.888660329128865E9", result); } })); // // SET FUNCTIONS if (false) define(new FunDefBase("AddCalculatedMembers", "AddCalculatedMembers(<Set>)", "Adds calculated members to a set.", "fx*")); define(new FunkResolver( "BottomCount", "BottomCount(<Set>, <Count>[, <Numeric Expression>])", "Returns a specified number of items from the bottom of a set, optionally ordering the set first.", new String[]{"fxxnn", "fxxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector set = (Vector) getArg(evaluator, args, 0); int n = getIntArg(evaluator, args, 1); ExpBase exp = (ExpBase) getArg(evaluator, args, 2, null); if (exp != null) { boolean desc = false, brk = true; sort(evaluator, set, exp, desc, brk); } if (n < set.size()) { set.setSize(n); } return set; } public void testBottomCount(FoodMartTestCase test) { test.assertAxisReturns("BottomCount({[Promotion Media].[Media Type].members}, 2, [Measures].[Unit Sales])", "[Promotion Media].[All Media].[Radio]" + nl + "[Promotion Media].[All Media].[Sunday Paper, Radio, TV]"); } //todo: test unordered })); define(new FunkResolver( "BottomPercent", "BottomPercent(<Set>, <Percentage>, <Numeric Expression>)", "Sorts a set and returns the bottom N elements whose cumulative total is at least a specified percentage.", new String[]{"fxxnn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 2); Double n = getDoubleArg(evaluator, args, 1); return topOrBottom(evaluator.push(), members, exp, false, true, n.doubleValue()); } public void testBottomPercent(FoodMartTestCase test) { test.assertAxisReturns("BottomPercent({[Promotion Media].[Media Type].members}, 1, [Measures].[Unit Sales])", "[Promotion Media].[All Media].[Radio]" + nl + "[Promotion Media].[All Media].[Sunday Paper, Radio, TV]"); } //todo: test precision })); define(new FunkResolver( "BottomSum", "BottomSum(<Set>, <Value>, <Numeric Expression>)", "Sorts a set and returns the bottom N elements whose cumulative total is at least a specified value.", new String[]{"fxxnn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 2); Double n = getDoubleArg(evaluator, args, 1); return topOrBottom(evaluator.push(), members, exp, false, false, n.doubleValue()); } public void testBottomSum(FoodMartTestCase test) { test.assertAxisReturns("BottomSum({[Promotion Media].[Media Type].members}, 5000, [Measures].[Unit Sales])", "[Promotion Media].[All Media].[Radio]" + nl + "[Promotion Media].[All Media].[Sunday Paper, Radio, TV]"); } })); define(new FunDefBase("Children", "<Member>.Children", "Returns the children of a member.", "pxm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); Member[] children = evaluator.getSchemaReader().getMemberChildren(member); return toVector(children); } }); define(new FunDefBase("Crossjoin", "Crossjoin(<Set1>, <Set2>)", "Returns the cross product of two sets.", "fxxx") { public Hierarchy getHierarchy(Exp[] args) { // CROSSJOIN(<Set1>,<Set2>) has Hierarchy [Hie1] x [Hie2], which we // can't represent, so we return null. return null; } public Object evaluate(Evaluator evaluator, Exp[] args) { Vector set0 = (Vector) getArg(evaluator, args, 0), set1 = (Vector) getArg(evaluator, args, 1); if (set0.isEmpty() || set1.isEmpty()) { return emptyVector; } int arity0 = 1, arity1 = 1; if (set0.elementAt(0) instanceof Member[]) { arity0 = ((Member[]) set0.elementAt(0)).length; } if (set1.elementAt(0) instanceof Member[]) { arity1 = ((Member[]) set1.elementAt(0)).length; } Vector result = new Vector(); if (arity0 == 1 && arity1 == 1) { // Simpler routine if we know neither side is an array. for (int i = 0, m = set0.size(); i < m; i++) { Member o0 = (Member) set0.elementAt(i); for (int j = 0, n = set1.size(); j < n; j++) { Member o1 = (Member) set1.elementAt(j); result.addElement(new Member[]{o0, o1}); } } } else { // More complex routine if one or both sides are arrays // (probably the product of nested CrossJoins). Member[] row = new Member[arity0 + arity1]; for (int i = 0, m = set0.size(); i < m; i++) { int x = 0; Object o0 = set0.elementAt(i); if (o0 instanceof Member) { row[x++] = (Member) o0; } else { assertTrue(o0 instanceof Member[]); final Member[] members = (Member[]) o0; for (int k = 0; k < members.length; k++) { row[x++] = members[k]; } } for (int j = 0, n = set1.size(); j < n; j++) { Object o1 = set1.elementAt(j); if (o1 instanceof Member) { row[x++] = (Member) o1; } else { assertTrue(o1 instanceof Member[]); final Member[] members = (Member[]) o1; for (int k = 0; k < members.length; k++) { row[x++] = members[k]; } } result.addElement(row.clone()); x = arity0; } } } return result; } public void testCrossjoinNested(FoodMartTestCase test) { test.assertAxisReturns( " CrossJoin(" + nl + " CrossJoin(" + nl + " [Gender].members," + nl + " [Marital Status].members)," + nl + " {[Store], [Store].children})", "{[Gender].[All Gender], [Marital Status].[All Marital Status], [Store].[All Stores]}" + nl + "{[Gender].[All Gender], [Marital Status].[All Marital Status], [Store].[All Stores].[Canada]}" + nl + "{[Gender].[All Gender], [Marital Status].[All Marital Status], [Store].[All Stores].[Mexico]}" + nl + "{[Gender].[All Gender], [Marital Status].[All Marital Status], [Store].[All Stores].[USA]}" + nl + "{[Gender].[All Gender], [Marital Status].[All Marital Status].[M], [Store].[All Stores]}" + nl + "{[Gender].[All Gender], [Marital Status].[All Marital Status].[M], [Store].[All Stores].[Canada]}" + nl + "{[Gender].[All Gender], [Marital Status].[All Marital Status].[M], [Store].[All Stores].[Mexico]}" + nl + "{[Gender].[All Gender], [Marital Status].[All Marital Status].[M], [Store].[All Stores].[USA]}" + nl + "{[Gender].[All Gender], [Marital Status].[All Marital Status].[S], [Store].[All Stores]}" + nl + "{[Gender].[All Gender], [Marital Status].[All Marital Status].[S], [Store].[All Stores].[Canada]}" + nl + "{[Gender].[All Gender], [Marital Status].[All Marital Status].[S], [Store].[All Stores].[Mexico]}" + nl + "{[Gender].[All Gender], [Marital Status].[All Marital Status].[S], [Store].[All Stores].[USA]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status], [Store].[All Stores]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status], [Store].[All Stores].[Canada]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status], [Store].[All Stores].[Mexico]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status], [Store].[All Stores].[USA]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status].[M], [Store].[All Stores]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status].[M], [Store].[All Stores].[Canada]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status].[M], [Store].[All Stores].[Mexico]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status].[M], [Store].[All Stores].[USA]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status].[S], [Store].[All Stores]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status].[S], [Store].[All Stores].[Canada]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status].[S], [Store].[All Stores].[Mexico]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status].[S], [Store].[All Stores].[USA]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status], [Store].[All Stores]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status], [Store].[All Stores].[Canada]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status], [Store].[All Stores].[Mexico]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status], [Store].[All Stores].[USA]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[M], [Store].[All Stores]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[M], [Store].[All Stores].[Canada]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[M], [Store].[All Stores].[Mexico]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[M], [Store].[All Stores].[USA]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[S], [Store].[All Stores]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[S], [Store].[All Stores].[Canada]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[S], [Store].[All Stores].[Mexico]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[S], [Store].[All Stores].[USA]}"); } }); define(new MultiResolver( "Descendants", "Descendants(<Member>, <Level>[, <Desc_flag>])", "Returns the set of descendants of a member at a specified level, optionally including or excluding descendants in other levels.", new String[]{"fxml", "fxmls"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { String descFlag = getLiteralArg(args, 2, "SELF", new String[] {"SELF","AFTER","BEFORE","BEFORE_AND_AFTER","SELF_AND_AFTER","SELF_AND_BEFORE","SELF_BEFORE_AFTER","LEAVES"}, dummyFunDef); if (!descFlag.equals("SELF")) { throw newEvalException(null, "SELF is the only value of Desc_flag currently supported"); } return new FunDefBase(dummyFunDef) { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); Level level = getLevelArg(evaluator, args, 1, true); if (member.getLevel().getDepth() > level.getDepth()) { return new Member[0]; } // Expand member to its children, until we get to the right // level. We assume that all children are in the same // level. final SchemaReader schemaReader = evaluator.getSchemaReader(); Member[] children = {member}; while (children.length > 0 && children[0].getLevel().getDepth() < level.getDepth()) { children = schemaReader.getMemberChildren(children); } return toVector(children); } }; }}); if (false) define(new FunDefBase("Distinct", "Distinct(<Set>)", "Eliminates duplicate tuples from a set.", "fxx")); define(new FunkResolver("DrilldownLevel", "DrilldownLevel(<Set>[, <Level>]) or DrilldownLevel(<Set>, , <Index>)", "Drills down the members of a set, at a specified level, to one level below. Alternatively, drills down on a specified dimension in the set.", new String[]{"fxx", "fxxl"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { //todo add fssl functionality Vector set0 = (Vector) getArg(evaluator, args, 0); int[] depthArray = new int[set0.size()]; Vector drilledSet = new Vector(); for (int i = 0, m = set0.size(); i < m; i++) { Member member = (Member) set0.elementAt(i); depthArray[i] = member.getDepth(); // Object o0 = set0.elementAt(i); // depthVector.addElement(new Object[] {o0}); } Arrays.sort(depthArray); int maxDepth = depthArray[depthArray.length - 1]; for (int i = 0, m = set0.size(); i < m; i++) { Member member = (Member) set0.elementAt(i); drilledSet.addElement(member); if (member.getDepth() == maxDepth) { Member[] childMembers = evaluator.getSchemaReader().getMemberChildren(member); for (int j = 0; j < childMembers.length; j++) { drilledSet.addElement(childMembers[j]); } } } return drilledSet; } } )); if (false) define(new FunDefBase("DrilldownLevelBottom", "DrilldownLevelBottom(<Set>, <Count>[, [<Level>][, <Numeric Expression>]])", "Drills down the bottom N members of a set, at a specified level, to one level below.", "fx*")); if (false) define(new FunDefBase("DrilldownLevelTop", "DrilldownLevelTop(<Set>, <Count>[, [<Level>][, <Numeric Expression>]])", "Drills down the top N members of a set, at a specified level, to one level below.", "fx*")); if (false) define(new FunDefBase("DrilldownMember", "DrilldownMember(<Set1>, <Set2>[, RECURSIVE])", "Drills down the members in a set that are present in a second specified set.", "fx*")); if (false) define(new FunDefBase("DrilldownMemberBottom", "DrilldownMemberBottom(<Set1>, <Set2>, <Count>[, [<Numeric Expression>][, RECURSIVE]])", "Like DrilldownMember except that it includes only the bottom N children.", "fx*")); if (false) define(new FunDefBase("DrilldownMemberTop", "DrilldownMemberTop(<Set1>, <Set2>, <Count>[, [<Numeric Expression>][, RECURSIVE]])", "Like DrilldownMember except that it includes only the top N children.", "fx*")); if (false) define(new FunDefBase("DrillupLevel", "DrillupLevel(<Set>[, <Level>])", "Drills up the members of a set that are below a specified level.", "fx*")); if (false) define(new FunDefBase("DrillupMember", "DrillupMember(<Set1>, <Set2>)", "Drills up the members in a set that are present in a second specified set.", "fx*")); define(new FunkResolver( "Except", "Except(<Set1>, <Set2>[, ALL])", "Finds the difference between two sets, optionally retaining duplicates.", new String[]{"fxxx", "fxxxs"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { // todo: implement ALL HashSet set2 = toHashSet((Vector) getArg(evaluator, args, 1)); Vector set1 = (Vector) getArg(evaluator, args, 0); Vector result = new Vector(); for (int i = 0, count = set1.size(); i < count; i++) { Object o = set1.elementAt(i); if (!set2.contains(o)) { result.addElement(o); } } return result; } })); if (false) define(new FunDefBase("Extract", "Extract(<Set>, <Dimension>[, <Dimension>...])", "Returns a set of tuples from extracted dimension elements. The opposite of Crossjoin.", "fx*")); define(new FunDefBase("Filter", "Filter(<Set>, <Search Condition>)", "Returns the set resulting from filtering a set based on a search condition.", "fxxb") { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); Exp exp = args[1]; Vector result = new Vector(); Evaluator evaluator2 = evaluator.push(); for (int i = 0, count = members.size(); i < count; i++) { Object o = members.elementAt(i); if (o instanceof Member) { evaluator2.setContext((Member) o); } else if (o instanceof Member[]) { evaluator2.setContext((Member[]) o); } else { throw Util.newInternal( "unexpected type in set: " + o.getClass()); } Boolean b = (Boolean) exp.evaluateScalar(evaluator2); if (b.booleanValue()) { result.add(o); } } return result; } /** * Make sure that slicer is in force when expression is applied * on axis, E.g. select filter([Customers].members, [Unit Sales] > 100) * from sales where ([Time].[1998]) **/ public void testFilterWithSlicer(FoodMartTestCase test) { Result result = test.execute( "select {[Measures].[Unit Sales]} on columns," + nl + " filter([Customers].[USA].children," + nl + " [Measures].[Unit Sales] > 20000) on rows" + nl + "from Sales" + nl + "where ([Time].[1997].[Q1])"); Axis rows = result.getAxes()[1]; // if slicer were ignored, there would be 3 rows test.assertEquals(1, rows.positions.length); Cell cell = result.getCell(new int[] {0,0}); test.assertEquals("30,114", cell.getFormattedValue()); } public void testFilterCompound(FoodMartTestCase test) { Result result = test.execute( "select {[Measures].[Unit Sales]} on columns," + nl + " Filter(" + nl + " CrossJoin(" + nl + " [Gender].Children," + nl + " [Customers].[USA].Children)," + nl + " [Measures].[Unit Sales] > 9500) on rows" + nl + "from Sales" + nl + "where ([Time].[1997].[Q1])"); Position[] rows = result.getAxes()[1].positions; test.assertTrue(rows.length == 3); test.assertEquals("F", rows[0].members[0].getName()); test.assertEquals("WA", rows[0].members[1].getName()); test.assertEquals("M", rows[1].members[0].getName()); test.assertEquals("OR", rows[1].members[1].getName()); test.assertEquals("M", rows[2].members[0].getName()); test.assertEquals("WA", rows[2].members[1].getName()); } }); if (false) define(new FunDefBase("Generate", "Generate(<Set1>, <Set2>[, ALL])", "Applies a set to each member of another set and joins the resulting sets by union.", "fx*")); if (false) define(new FunDefBase("Head", "Head(<Set>[, < Numeric Expression >])", "Returns the first specified number of elements in a set.", "fx*")); define(new MultiResolver( "Hierarchize", "Hierarchize(<Set>[, POST])", "Orders the members of a set in a hierarchy.", new String[] {"fxx", "fxxy"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { String order = getLiteralArg(args, 1, "PRE", new String[] {"PRE", "POST"}, dummyFunDef); final boolean post = order.equals("POST"); return new FunDefBase(dummyFunDef) { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); hierarchize(members, post); return members; } }; } public void testHierarchize(FoodMartTestCase test) { test.assertAxisReturns( "Hierarchize(" + nl + " {[Product].[All Products], " + " [Product].[Food]," + nl + " [Product].[Drink]," + nl + " [Product].[Non-Consumable]," + nl + " [Product].[Food].[Eggs]," + nl + " [Product].[Drink].[Dairy]})", "[Product].[All Products]" + nl + "[Product].[All Products].[Drink]" + nl + "[Product].[All Products].[Drink].[Dairy]" + nl + "[Product].[All Products].[Food]" + nl + "[Product].[All Products].[Food].[Eggs]" + nl + "[Product].[All Products].[Non-Consumable]"); } public void testHierarchizePost(FoodMartTestCase test) { test.assertAxisReturns( "Hierarchize(" + nl + " {[Product].[All Products], " + " [Product].[Food]," + nl + " [Product].[Food].[Eggs]," + nl + " [Product].[Drink].[Dairy]}," + nl + " POST)", "[Product].[All Products].[Drink].[Dairy]" + nl + "[Product].[All Products].[Food].[Eggs]" + nl + "[Product].[All Products].[Food]" + nl + "[Product].[All Products]"); } public void testHierarchizeCrossJoinPre(FoodMartTestCase test) { test.assertAxisReturns( "Hierarchize(" + nl + " CrossJoin(" + nl + " {[Product].[All Products], " + " [Product].[Food]," + nl + " [Product].[Food].[Eggs]," + nl + " [Product].[Drink].[Dairy]}," + nl + " [Gender].MEMBERS)," + nl + " PRE)", "{[Product].[All Products], [Gender].[All Gender]}" + nl + "{[Product].[All Products], [Gender].[All Gender].[F]}" + nl + "{[Product].[All Products], [Gender].[All Gender].[M]}" + nl + "{[Product].[All Products].[Drink].[Dairy], [Gender].[All Gender]}" + nl + "{[Product].[All Products].[Drink].[Dairy], [Gender].[All Gender].[F]}" + nl + "{[Product].[All Products].[Drink].[Dairy], [Gender].[All Gender].[M]}" + nl + "{[Product].[All Products].[Food], [Gender].[All Gender]}" + nl + "{[Product].[All Products].[Food], [Gender].[All Gender].[F]}" + nl + "{[Product].[All Products].[Food], [Gender].[All Gender].[M]}" + nl + "{[Product].[All Products].[Food].[Eggs], [Gender].[All Gender]}" + nl + "{[Product].[All Products].[Food].[Eggs], [Gender].[All Gender].[F]}" + nl + "{[Product].[All Products].[Food].[Eggs], [Gender].[All Gender].[M]}"); } public void testHierarchizeCrossJoinPost(FoodMartTestCase test) { test.assertAxisReturns( "Hierarchize(" + nl + " CrossJoin(" + nl + " {[Product].[All Products], " + " [Product].[Food]," + nl + " [Product].[Food].[Eggs]," + nl + " [Product].[Drink].[Dairy]}," + nl + " [Gender].MEMBERS)," + nl + " POST)", "{[Product].[All Products].[Drink].[Dairy], [Gender].[All Gender].[F]}" + nl + "{[Product].[All Products].[Drink].[Dairy], [Gender].[All Gender].[M]}" + nl + "{[Product].[All Products].[Drink].[Dairy], [Gender].[All Gender]}" + nl + "{[Product].[All Products].[Food].[Eggs], [Gender].[All Gender].[F]}" + nl + "{[Product].[All Products].[Food].[Eggs], [Gender].[All Gender].[M]}" + nl + "{[Product].[All Products].[Food].[Eggs], [Gender].[All Gender]}" + nl + "{[Product].[All Products].[Food], [Gender].[All Gender].[F]}" + nl + "{[Product].[All Products].[Food], [Gender].[All Gender].[M]}" + nl + "{[Product].[All Products].[Food], [Gender].[All Gender]}" + nl + "{[Product].[All Products], [Gender].[All Gender].[F]}" + nl + "{[Product].[All Products], [Gender].[All Gender].[M]}" + nl + "{[Product].[All Products], [Gender].[All Gender]}"); } }); if (false) define(new FunDefBase("Intersect", "Intersect(<Set1>, <Set2>[, ALL])", "Returns the intersection of two input sets, optionally retaining duplicates.", "fx*")); if (false) define(new FunDefBase("LastPeriods", "LastPeriods(<Index>[, <Member>])", "Returns a set of members prior to and including a specified member.", "fx*")); define(new FunDefBase("Members", "<Dimension>.Members", "Returns the set of all members in a dimension.", "pxd") { public Object evaluate(Evaluator evaluator, Exp[] args) { Dimension dimension = (Dimension) getArg(evaluator, args, 0); Hierarchy hierarchy = dimension.getHierarchy(); return addMembers(evaluator.getSchemaReader(), new Vector(), hierarchy); } }); define(new FunDefBase("Members", "<Hierarchy>.Members", "Returns the set of all members in a hierarchy.", "pxh") { public Object evaluate(Evaluator evaluator, Exp[] args) { Hierarchy hierarchy = (Hierarchy) getArg(evaluator, args, 0); return addMembers(evaluator.getSchemaReader(), new Vector(), hierarchy); } }); define(new FunDefBase("Members", "<Level>.Members", "Returns the set of all members in a level.", "pxl") { public Object evaluate(Evaluator evaluator, Exp[] args) { Level level = (Level) getArg(evaluator, args, 0); return toVector(evaluator.getSchemaReader().getLevelMembers(level)); } }); define(new FunkResolver( "Mtd", "Mtd([<Member>])", "A shortcut function for the PeriodsToDate function that specifies the level to be Month.", new String[]{"fx", "fxm"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { return new Vector(periodsToDate( evaluator, evaluator.getCube().getMonthLevel(), getMemberArg(evaluator, args, 0, false))); } })); define(new MultiResolver( "Order", "Order(<Set>, <Value Expression>[, ASC | DESC | BASC | BDESC])", "Arranges members of a set, optionally preserving or breaking the hierarchy.", new String[]{"fxxvy", "fxxv"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { String order = getLiteralArg(args, 2, "ASC", new String[] {"ASC","DESC","BASC","BDESC"}, dummyFunDef); final boolean desc = order.equals("DESC") || order.equals("BDESC"); final boolean brk = order.equals("BASC") || order.equals("BDESC"); return new FunDefBase(dummyFunDef) { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArgNoEval(args, 1); sort(evaluator, members, exp, desc, brk); return members; } }; } public void testOrder(FoodMartTestCase test) { test.runQueryCheckResult( "select {[Measures].[Unit Sales]} on columns," + nl + " order({" + nl + " [Product].[All Products].[Drink]," + nl + " [Product].[All Products].[Drink].[Beverages]," + nl + " [Product].[All Products].[Drink].[Dairy]," + nl + " [Product].[All Products].[Food]," + nl + " [Product].[All Products].[Food].[Baked Goods]," + nl + " [Product].[All Products].[Food].[Eggs]," + nl + " [Product].[All Products]}," + nl + " [Measures].[Unit Sales]) on rows" + nl + "from Sales", "Axis #0:" + nl + "{}" + nl + "Axis #1:" + nl + "{[Measures].[Unit Sales]}" + nl + "Axis #2:" + nl + "{[Product].[All Products]}" + nl + "{[Product].[All Products].[Drink]}" + nl + "{[Product].[All Products].[Drink].[Dairy]}" + nl + "{[Product].[All Products].[Drink].[Beverages]}" + nl + "{[Product].[All Products].[Food]}" + nl + "{[Product].[All Products].[Food].[Eggs]}" + nl + "{[Product].[All Products].[Food].[Baked Goods]}" + nl + "Row #0: 266,773" + nl + "Row #1: 24,597" + nl + "Row #2: 4,186" + nl + "Row #3: 13,573" + nl + "Row #4: 191,940" + nl + "Row #5: 4,132" + nl + "Row #6: 7,870" + nl); } public void testOrderParentsMissing(FoodMartTestCase test) { // Paradoxically, [Alcoholic Beverages] comes before // [Eggs] even though it has a larger value, because // its parent [Drink] has a smaller value than [Food]. test.runQueryCheckResult( "select {[Measures].[Unit Sales]} on columns," + " order({" + nl + " [Product].[All Products].[Drink].[Alcoholic Beverages]," + nl + " [Product].[All Products].[Food].[Eggs]}," + nl + " [Measures].[Unit Sales], ASC) on rows" + nl + "from Sales", "Axis #0:" + nl + "{}" + nl + "Axis #1:" + nl + "{[Measures].[Unit Sales]}" + nl + "Axis #2:" + nl + "{[Product].[All Products].[Drink].[Alcoholic Beverages]}" + nl + "{[Product].[All Products].[Food].[Eggs]}" + nl + "Row #0: 6,838" + nl + "Row #1: 4,132" + nl); } public void testOrderCrossJoinBreak(FoodMartTestCase test) { test.runQueryCheckResult( "select {[Measures].[Unit Sales]} on columns," + nl + " Order(" + nl + " CrossJoin(" + nl + " [Gender].children," + nl + " [Marital Status].children)," + nl + " [Measures].[Unit Sales]," + nl + " BDESC) on rows" + nl + "from Sales" + nl + "where [Time].[1997].[Q1]", "Axis #0:" + nl + "{[Time].[1997].[Q1]}" + nl + "Axis #1:" + nl + "{[Measures].[Unit Sales]}" + nl + "Axis #2:" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status].[M]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[S]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[M]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status].[S]}" + nl + "Row #0: 17,097" + nl + "Row #1: 16,845" + nl + "Row #2: 16,536" + nl + "Row #3: 15,813" + nl); } public void testOrderCrossJoin(FoodMartTestCase test) { // Note: // 1. [Alcoholic Beverages] collates before [Eggs] and // [Seafood] because its parent, [Drink], is less // than [Food] // 2. [Seattle] generally sorts after [CA] and [OR] // because invisible parent [WA] is greater. test.runQueryCheckResult( "select CrossJoin(" + nl + " {[Time].[1997]," + nl + " [Time].[1997].[Q1]}," + nl + " {[Measures].[Unit Sales]}) on columns," + nl + " Order(" + nl + " CrossJoin( " + nl + " {[Product].[All Products].[Food].[Eggs]," + nl + " [Product].[All Products].[Food].[Seafood]," + nl + " [Product].[All Products].[Drink].[Alcoholic Beverages]}," + nl + " {[Store].[USA].[WA].[Seattle]," + nl + " [Store].[USA].[CA]," + nl + " [Store].[USA].[OR]})," + nl + " ([Time].[1997].[Q1], [Measures].[Unit Sales])," + nl + " ASC) on rows" + nl + "from Sales", "Axis #0:" + nl + "{}" + nl + "Axis #1:" + nl + "{[Time].[1997], [Measures].[Unit Sales]}" + nl + "{[Time].[1997].[Q1], [Measures].[Unit Sales]}" + nl + "Axis #2:" + nl + "{[Product].[All Products].[Drink].[Alcoholic Beverages], [Store].[All Stores].[USA].[OR]}" + nl + "{[Product].[All Products].[Drink].[Alcoholic Beverages], [Store].[All Stores].[USA].[CA]}" + nl + "{[Product].[All Products].[Drink].[Alcoholic Beverages], [Store].[All Stores].[USA].[WA].[Seattle]}" + nl + "{[Product].[All Products].[Food].[Seafood], [Store].[All Stores].[USA].[CA]}" + nl + "{[Product].[All Products].[Food].[Seafood], [Store].[All Stores].[USA].[OR]}" + nl + "{[Product].[All Products].[Food].[Seafood], [Store].[All Stores].[USA].[WA].[Seattle]}" + nl + "{[Product].[All Products].[Food].[Eggs], [Store].[All Stores].[USA].[CA]}" + nl + "{[Product].[All Products].[Food].[Eggs], [Store].[All Stores].[USA].[OR]}" + nl + "{[Product].[All Products].[Food].[Eggs], [Store].[All Stores].[USA].[WA].[Seattle]}" + nl + "Row #0: 1,680" + nl + "Row #0: 393" + nl + "Row #1: 1,936" + nl + "Row #1: 431" + nl + "Row #2: 635" + nl + "Row #2: 142" + nl + "Row #3: 441" + nl + "Row #3: 91" + nl + "Row #4: 451" + nl + "Row #4: 107" + nl + "Row #5: 217" + nl + "Row #5: 44" + nl + "Row #6: 1,116" + nl + "Row #6: 240" + nl + "Row #7: 1,119" + nl + "Row #7: 251" + nl + "Row #8: 373" + nl + "Row #8: 57" + nl); } public void testOrderHierarchicalDesc(FoodMartTestCase test) { test.assertAxisReturns( "Order(" + nl + " {[Product].[All Products], " + " [Product].[Food]," + nl + " [Product].[Drink]," + nl + " [Product].[Non-Consumable]," + nl + " [Product].[Food].[Eggs]," + nl + " [Product].[Drink].[Dairy]}," + nl + " [Measures].[Unit Sales]," + nl + " DESC)", "[Product].[All Products]" + nl + "[Product].[All Products].[Food]" + nl + "[Product].[All Products].[Food].[Eggs]" + nl + "[Product].[All Products].[Non-Consumable]" + nl + "[Product].[All Products].[Drink]" + nl + "[Product].[All Products].[Drink].[Dairy]"); } public void testOrderCrossJoinDesc(FoodMartTestCase test) { test.assertAxisReturns( "Order(" + nl + " CrossJoin(" + nl + " {[Gender].[M], [Gender].[F]}," + nl + " {[Product].[All Products], " + " [Product].[Food]," + nl + " [Product].[Drink]," + nl + " [Product].[Non-Consumable]," + nl + " [Product].[Food].[Eggs]," + nl + " [Product].[Drink].[Dairy]})," + nl + " [Measures].[Unit Sales]," + nl + " DESC)", "{[Gender].[All Gender].[M], [Product].[All Products]}" + nl + "{[Gender].[All Gender].[M], [Product].[All Products].[Food]}" + nl + "{[Gender].[All Gender].[M], [Product].[All Products].[Food].[Eggs]}" + nl + "{[Gender].[All Gender].[M], [Product].[All Products].[Non-Consumable]}" + nl + "{[Gender].[All Gender].[M], [Product].[All Products].[Drink]}" + nl + "{[Gender].[All Gender].[M], [Product].[All Products].[Drink].[Dairy]}" + nl + "{[Gender].[All Gender].[F], [Product].[All Products]}" + nl + "{[Gender].[All Gender].[F], [Product].[All Products].[Food]}" + nl + "{[Gender].[All Gender].[F], [Product].[All Products].[Food].[Eggs]}" + nl + "{[Gender].[All Gender].[F], [Product].[All Products].[Non-Consumable]}" + nl + "{[Gender].[All Gender].[F], [Product].[All Products].[Drink]}" + nl + "{[Gender].[All Gender].[F], [Product].[All Products].[Drink].[Dairy]}"); } public void testOrderBug656802(FoodMartTestCase test) { // Note: // 1. [Alcoholic Beverages] collates before [Eggs] and // [Seafood] because its parent, [Drink], is less // than [Food] // 2. [Seattle] generally sorts after [CA] and [OR] // because invisible parent [WA] is greater. test.runQueryCheckResult( "select {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} ON columns, " + nl + "Order(" + nl + " ToggleDrillState(" + nl + " {([Promotion Media].[All Media], [Product].[All Products])}," + nl + " {[Product].[All Products]} ), " + nl + " [Measures].[Unit Sales], DESC) ON rows " + nl + "from [Sales] where ([Time].[1997])", "Axis #0:" + nl + "{[Time].[1997]}" + nl + "Axis #1:" + nl + "{[Measures].[Unit Sales]}" + nl + "{[Measures].[Store Cost]}" + nl + "{[Measures].[Store Sales]}" + nl + "Axis #2:" + nl + "{[Promotion Media].[All Media], [Product].[All Products]}" + nl + "{[Promotion Media].[All Media], [Product].[All Products].[Food]}" + nl + "{[Promotion Media].[All Media], [Product].[All Products].[Non-Consumable]}" + nl + "{[Promotion Media].[All Media], [Product].[All Products].[Drink]}" + nl + "Row #0: 266,773" + nl + "Row #0: 225,627.23" + nl + "Row #0: 565,238.13" + nl + "Row #1: 191,940" + nl + "Row #1: 163,270.72" + nl + "Row #1: 409,035.59" + nl + "Row #2: 50,236" + nl + "Row #2: 42,879.28" + nl + "Row #2: 107,366.33" + nl + "Row #3: 24,597" + nl + "Row #3: 19,477.23" + nl + "Row #3: 48,836.21" + nl); } }); define(new FunkResolver( "PeriodsToDate", "PeriodsToDate([<Level>[, <Member>]])", "Returns a set of periods (members) from a specified level starting with the first period and ending with a specified member.", new String[]{"fx", "fxl", "fxlm"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Level level = getLevelArg(evaluator, args, 0, false); Member member = getMemberArg(evaluator, args, 1, false); return new Vector(periodsToDate(evaluator, level, member)); } })); define(new FunkResolver( "Qtd", "Qtd([<Member>])", "A shortcut function for the PeriodsToDate function that specifies the level to be Quarter.", new String[]{"fx", "fxm"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { return new Vector(periodsToDate( evaluator, evaluator.getCube().getQuarterLevel(), getMemberArg(evaluator, args, 0, false))); } })); if (false) define(new FunDefBase("StripCalculatedMembers", "StripCalculatedMembers(<Set>)", "Removes calculated members from a set.", "fx*")); define(new FunDefBase("StrToSet", "StrToSet(<String Expression>)", "Constructs a set from a string expression.", "fxS") { public void unparse(Exp[] args, PrintWriter pw, ElementCallback callback) { if (callback.isPlatoMdx()) { // omit extra args (they're for us, not Plato) super.unparse(new Exp[]{args[0]}, pw, callback); } else { super.unparse(args, pw, callback); } } public Hierarchy getHierarchy(Exp[] args) { // StrToSet(s, <Hie1>, ... <HieN>) is of type [Hie1] x ... x [HieN]; // so, for example, So StrToTuple("[Time].[1997]", [Time]) is of type // [Time]. But if n > 1, we cannot represent the compound type, and we // return null. return (args.length == 2) ? (Hierarchy) args[1] : null; } }); if (false) define(new FunDefBase("Subset", "Subset(<Set>, <Start>[, <Count>])", "Returns a subset of elements from a set.", "fx*")); if (false) define(new FunDefBase("Tail", "Tail(<Set>[, <Count>])", "Returns a subset from the end of a set.", "fx*")); define(new FunkResolver( "ToggleDrillState", "ToggleDrillState(<Set1>, <Set2>[, RECURSIVE])", "Toggles the drill state of members. This function is a combination of DrillupMember and DrilldownMember.", new String[]{"fxxx", "fxxx#"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector v0 = (Vector) getArg(evaluator, args, 0), v1 = (Vector) getArg(evaluator, args, 1); if (args.length > 2) { throw Util.newInternal( "ToggleDrillState(RECURSIVE) not supported"); } if (v1.isEmpty()) { return v0; } if (v0.isEmpty()) { return v0; } HashSet set1 = toHashSet(v1); Vector result = new Vector(); int i = 0, n = v0.size(); while (i < n) { Object o = v0.elementAt(i++); result.addElement(o); Member m = null; int k = -1; if (o instanceof Member) { if (!set1.contains(o)) { continue; } m = (Member) o; k = -1; } else { Util.assertTrue(o instanceof Member[]); Member[] members = (Member[]) o; for (int j = 0; j < members.length; j++) { Member member = members[j]; if (set1.contains(member)) { k = j; m = member; break; } } if (k == -1) { continue; } } boolean isDrilledDown = false; if (i < n) { Object next = v0.elementAt(i); Member nextMember = (k < 0) ? (Member) next : ((Member[]) next)[k]; boolean strict = true; if (isAncestorOf(m, nextMember, strict)) { isDrilledDown = true; } } if (isDrilledDown) { // skip descendants of this member do { Object next = v0.elementAt(i); Member nextMember = (k < 0) ? (Member) next : ((Member[]) next)[k]; boolean strict = true; if (isAncestorOf(m, nextMember, strict)) { i++; } else { break; } } while (i < n); } else { Member[] children = evaluator.getSchemaReader().getMemberChildren(m); for (int j = 0; j < children.length; j++) { if (k < 0) { result.addElement(children[j]); } else { Member[] members = (Member[]) ((Member[]) o).clone(); members[k] = children[j]; result.addElement(members); } } } } return result; } public void testToggleDrillState(FoodMartTestCase test) { test.assertAxisReturns("ToggleDrillState({[Customers].[USA],[Customers].[Canada]},{[Customers].[USA],[Customers].[USA].[CA]})", "[Customers].[All Customers].[USA]" + nl + "[Customers].[All Customers].[USA].[CA]" + nl + "[Customers].[All Customers].[USA].[OR]" + nl + "[Customers].[All Customers].[USA].[WA]" + nl + "[Customers].[All Customers].[Canada]"); } public void testToggleDrillState2(FoodMartTestCase test) { test.assertAxisReturns("ToggleDrillState([Product].[Product Department].members, {[Product].[All Products].[Food].[Snack Foods]})", "[Product].[All Products].[Drink].[Alcoholic Beverages]" + nl + "[Product].[All Products].[Drink].[Beverages]" + nl + "[Product].[All Products].[Drink].[Dairy]" + nl + "[Product].[All Products].[Food].[Baked Goods]" + nl + "[Product].[All Products].[Food].[Baking Goods]" + nl + "[Product].[All Products].[Food].[Breakfast Foods]" + nl + "[Product].[All Products].[Food].[Canned Foods]" + nl + "[Product].[All Products].[Food].[Canned Products]" + nl + "[Product].[All Products].[Food].[Dairy]" + nl + "[Product].[All Products].[Food].[Deli]" + nl + "[Product].[All Products].[Food].[Eggs]" + nl + "[Product].[All Products].[Food].[Frozen Foods]" + nl + "[Product].[All Products].[Food].[Meat]" + nl + "[Product].[All Products].[Food].[Produce]" + nl + "[Product].[All Products].[Food].[Seafood]" + nl + "[Product].[All Products].[Food].[Snack Foods]" + nl + "[Product].[All Products].[Food].[Snack Foods].[Snack Foods]" + nl + "[Product].[All Products].[Food].[Snacks]" + nl + "[Product].[All Products].[Food].[Starchy Foods]" + nl + "[Product].[All Products].[Non-Consumable].[Carousel]" + nl + "[Product].[All Products].[Non-Consumable].[Checkout]" + nl + "[Product].[All Products].[Non-Consumable].[Health and Hygiene]" + nl + "[Product].[All Products].[Non-Consumable].[Household]" + nl + "[Product].[All Products].[Non-Consumable].[Periodicals]"); } public void testToggleDrillState3(FoodMartTestCase test) { test.assertAxisReturns( "ToggleDrillState(" + "{[Time].[1997].[Q1]," + " [Time].[1997].[Q2]," + " [Time].[1997].[Q2].[4]," + " [Time].[1997].[Q2].[6]," + " [Time].[1997].[Q3]}," + "{[Time].[1997].[Q2]})", "[Time].[1997].[Q1]" + nl + "[Time].[1997].[Q2]" + nl + "[Time].[1997].[Q3]"); } // bug 634860 public void testToggleDrillStateTuple(FoodMartTestCase test) { test.assertAxisReturns( "ToggleDrillState(" + nl + "{([Store].[All Stores].[USA].[CA]," + " [Product].[All Products].[Drink].[Alcoholic Beverages])," + nl + " ([Store].[All Stores].[USA]," + " [Product].[All Products].[Drink])}," + nl + "{[Store].[All stores].[USA].[CA]})", "{[Store].[All Stores].[USA].[CA], [Product].[All Products].[Drink].[Alcoholic Beverages]}" + nl + "{[Store].[All Stores].[USA].[CA].[Beverly Hills], [Product].[All Products].[Drink].[Alcoholic Beverages]}" + nl + "{[Store].[All Stores].[USA].[CA].[Los Angeles], [Product].[All Products].[Drink].[Alcoholic Beverages]}" + nl + "{[Store].[All Stores].[USA].[CA].[San Diego], [Product].[All Products].[Drink].[Alcoholic Beverages]}" + nl + "{[Store].[All Stores].[USA].[CA].[San Francisco], [Product].[All Products].[Drink].[Alcoholic Beverages]}" + nl + "{[Store].[All Stores].[USA], [Product].[All Products].[Drink]}"); } })); define(new FunkResolver( "TopCount", "TopCount(<Set>, <Count>[, <Numeric Expression>])", "Returns a specified number of items from the top of a set, optionally ordering the set first.", new String[]{"fxxnn", "fxxn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector set = (Vector) getArg(evaluator, args, 0); int n = getIntArg(evaluator, args, 1); ExpBase exp = (ExpBase) getArg(evaluator, args, 2, null); if (exp != null) { boolean desc = true, brk = true; sort(evaluator, set, exp, desc, brk); } if (n < set.size()) { set.setSize(n); } return set; } public void testTopCount(FoodMartTestCase test) { test.assertAxisReturns("TopCount({[Promotion Media].[Media Type].members}, 2, [Measures].[Unit Sales])", "[Promotion Media].[All Media].[No Media]" + nl + "[Promotion Media].[All Media].[Daily Paper, Radio, TV]"); } })); define(new FunkResolver( "TopPercent", "TopPercent(<Set>, <Percentage>, <Numeric Expression>)", "Sorts a set and returns the top N elements whose cumulative total is at least a specified percentage.", new String[]{"fxxnn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 2); Double n = getDoubleArg(evaluator, args, 1); return topOrBottom(evaluator.push(), members, exp, true, true, n.doubleValue()); } public void testTopPercent(FoodMartTestCase test) { test.assertAxisReturns("TopPercent({[Promotion Media].[Media Type].members}, 70, [Measures].[Unit Sales])", "[Promotion Media].[All Media].[No Media]"); } //todo: test precision })); define(new FunkResolver( "TopSum", "TopSum(<Set>, <Value>, <Numeric Expression>)", "Sorts a set and returns the top N elements whose cumulative total is at least a specified value.", new String[]{"fxxnn"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector members = (Vector) getArg(evaluator, args, 0); ExpBase exp = (ExpBase) getArg(evaluator, args, 2); Double n = getDoubleArg(evaluator, args, 1); return topOrBottom(evaluator.push(), members, exp, true, false, n.doubleValue()); } public void testTopSum(FoodMartTestCase test) { test.assertAxisReturns("TopSum({[Promotion Media].[Media Type].members}, 200000, [Measures].[Unit Sales])", "[Promotion Media].[All Media].[No Media]" + nl + "[Promotion Media].[All Media].[Daily Paper, Radio, TV]"); } })); define(new MultiResolver( "Union", "Union(<Set1>, <Set2>[, ALL])", "Returns the union of two sets, optionally retaining duplicates.", new String[] {"fxxx", "fxxxy"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { String allString = getLiteralArg(args, 2, "DISTINCT", new String[] {"ALL", "DISTINCT"}, dummyFunDef); final boolean all = allString.equalsIgnoreCase("ALL"); checkCompatible(args[0], args[1], dummyFunDef); return new FunDefBase(dummyFunDef) { public Object evaluate(Evaluator evaluator, Exp[] args) { Vector left = (Vector) getArg(evaluator, args, 0), right = (Vector) getArg(evaluator, args, 1); if (all) { if (left == null || left.isEmpty()) { return right; } add(left, right); return left; } else { HashSet added = new HashSet(); Vector result = new Vector(); addUnique(result, left, added); addUnique(result, right, added); return result; } } }; } public void testUnionAll(FoodMartTestCase test) { test.assertAxisReturns("Union({[Gender].[M]}, {[Gender].[F]}, ALL)", "[Gender].[All Gender].[M]" + nl + "[Gender].[All Gender].[F]"); // order is preserved } public void testUnion(FoodMartTestCase test) { test.assertAxisReturns("Union({[Store].[USA], [Store].[USA], [Store].[USA].[OR]}, {[Store].[USA].[CA], [Store].[USA]})", "[Store].[All Stores].[USA]" + nl + "[Store].[All Stores].[USA].[OR]" + nl + "[Store].[All Stores].[USA].[CA]"); } public void testUnionEmptyBoth(FoodMartTestCase test) { test.assertAxisReturns("Union({}, {})", ""); } public void testUnionEmptyRight(FoodMartTestCase test) { test.assertAxisReturns("Union({[Gender].[M]}, {})", "[Gender].[All Gender].[M]"); } public void testUnionTuple(FoodMartTestCase test) { test.assertAxisReturns( "Union({" + " ([Gender].[M], [Marital Status].[S])," + " ([Gender].[F], [Marital Status].[S])" + "}, {" + " ([Gender].[M], [Marital Status].[M])," + " ([Gender].[M], [Marital Status].[S])" + "})", "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[S]}" + nl + "{[Gender].[All Gender].[F], [Marital Status].[All Marital Status].[S]}" + nl + "{[Gender].[All Gender].[M], [Marital Status].[All Marital Status].[M]}"); } public void testUnionQuery(FoodMartTestCase test) { Result result = test.runQuery( "select {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} on columns," + nl + " Hierarchize( " + nl + " Union(" + nl + " Crossjoin(" + nl + " Crossjoin([Gender].[All Gender].children," + nl + " [Marital Status].[All Marital Status].children )," + nl + " Crossjoin([Customers].[All Customers].children," + nl + " [Product].[All Products].children ) ) ," + nl + " Crossjoin( {([Gender].[All Gender].[M], [Marital Status].[All Marital Status].[M] )}," + nl + " Crossjoin(" + nl + " [Customers].[All Customers].[USA].children," + nl + " [Product].[All Products].children ) ) )) on rows" +nl + "from Sales where ([Time].[1997])"); final Axis rowsAxis = result.getAxes()[1]; test.assertEquals(45, rowsAxis.positions.length); } }); if (false) define(new FunDefBase("VisualTotals", "VisualTotals(<Set>, <Pattern>)", "Dynamically totals child members specified in a set using a pattern for the total label in the result set.", "fx*")); define(new FunkResolver( "Wtd", "Wtd([<Member>])", "A shortcut function for the PeriodsToDate function that specifies the level to be Week.", new String[]{"fx", "fxm"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { return new Vector(periodsToDate( evaluator, evaluator.getCube().getWeekLevel(), getMemberArg(evaluator, args, 0, false))); } })); define(new FunkResolver( "Ytd", "Ytd([<Member>])", "A shortcut function for the PeriodsToDate function that specifies the level to be Year.", new String[]{"fx", "fxm"}, new FunkBase() { public Object evaluate(Evaluator evaluator, Exp[] args) { return new Vector(periodsToDate( evaluator, evaluator.getCube().getYearLevel(), getMemberArg(evaluator, args, 0, false))); } })); define(new FunDefBase( ":", "<Member>:<Member>", "Infix colon operator returns the set of members between a given pair of members.", "ixmm") { // implement FunDef public Object evaluate(Evaluator evaluator, Exp[] args) { final Member member0 = getMemberArg(evaluator, args, 0, true); final Member member1 = getMemberArg(evaluator, args, 1, true); if (member0.isNull() || member1.isNull()) { return emptyVector; } if (member0.getLevel() != member1.getLevel()) { throw newEvalException(this, "Members must belong to the same level"); } return new Vector(FunUtil.memberRange(evaluator, member0, member1)); } public void testRange(FoodMartTestCase test) { test.assertAxisReturns("[Time].[1997].[Q1].[2] : [Time].[1997].[Q2].[5]", "[Time].[1997].[Q1].[2]" + nl + "[Time].[1997].[Q1].[3]" + nl + "[Time].[1997].[Q2].[4]" + nl + "[Time].[1997].[Q2].[5]"); // not parents } /** * Large dimensions use a different member reader, therefore need to * be tested separately. */ public void testRangeLarge(FoodMartTestCase test) { test.assertAxisReturns("[Customers].[USA].[CA].[San Francisco] : [Customers].[USA].[WA].[Bellingham]", "[Customers].[All Customers].[USA].[CA].[San Francisco]" + nl + "[Customers].[All Customers].[USA].[CA].[San Gabriel]" + nl + "[Customers].[All Customers].[USA].[CA].[San Jose]" + nl + "[Customers].[All Customers].[USA].[CA].[Santa Cruz]" + nl + "[Customers].[All Customers].[USA].[CA].[Santa Monica]" + nl + "[Customers].[All Customers].[USA].[CA].[Spring Valley]" + nl + "[Customers].[All Customers].[USA].[CA].[Torrance]" + nl + "[Customers].[All Customers].[USA].[CA].[West Covina]" + nl + "[Customers].[All Customers].[USA].[CA].[Woodland Hills]" + nl + "[Customers].[All Customers].[USA].[OR].[Albany]" + nl + "[Customers].[All Customers].[USA].[OR].[Beaverton]" + nl + "[Customers].[All Customers].[USA].[OR].[Corvallis]" + nl + "[Customers].[All Customers].[USA].[OR].[Lake Oswego]" + nl + "[Customers].[All Customers].[USA].[OR].[Lebanon]" + nl + "[Customers].[All Customers].[USA].[OR].[Milwaukie]" + nl + "[Customers].[All Customers].[USA].[OR].[Oregon City]" + nl + "[Customers].[All Customers].[USA].[OR].[Portland]" + nl + "[Customers].[All Customers].[USA].[OR].[Salem]" + nl + "[Customers].[All Customers].[USA].[OR].[W. Linn]" + nl + "[Customers].[All Customers].[USA].[OR].[Woodburn]" + nl + "[Customers].[All Customers].[USA].[WA].[Anacortes]" + nl + "[Customers].[All Customers].[USA].[WA].[Ballard]" + nl + "[Customers].[All Customers].[USA].[WA].[Bellingham]"); } public void testRangeStartEqualsEnd(FoodMartTestCase test) { test.assertAxisReturns("[Time].[1997].[Q3].[7] : [Time].[1997].[Q3].[7]", "[Time].[1997].[Q3].[7]"); } public void testRangeStartEqualsEndLarge(FoodMartTestCase test) { test.assertAxisReturns("[Customers].[USA].[CA] : [Customers].[USA].[CA]", "[Customers].[All Customers].[USA].[CA]"); } public void testRangeEndBeforeStart(FoodMartTestCase test) { test.assertAxisReturns("[Time].[1997].[Q3].[7] : [Time].[1997].[Q2].[5]", "[Time].[1997].[Q2].[5]" + nl + "[Time].[1997].[Q2].[6]" + nl + "[Time].[1997].[Q3].[7]"); // same as if reversed } public void testRangeEndBeforeStartLarge(FoodMartTestCase test) { test.assertAxisReturns("[Customers].[USA].[WA] : [Customers].[USA].[CA]", "[Customers].[All Customers].[USA].[CA]" + nl + "[Customers].[All Customers].[USA].[OR]" + nl + "[Customers].[All Customers].[USA].[WA]"); } public void testRangeBetweenDifferentLevelsIsError(FoodMartTestCase test) { test.assertAxisThrows("[Time].[1997].[Q2] : [Time].[1997].[Q2].[5]", "Members must belong to the same level"); } public void testRangeBoundedByAll(FoodMartTestCase test) { test.assertAxisReturns("[Gender] : [Gender]", "[Gender].[All Gender]"); } public void testRangeBoundedByAllLarge(FoodMartTestCase test) { test.assertAxisReturns("[Customers].DefaultMember : [Customers]", "[Customers].[All Customers]"); } public void testRangeBoundedByNull(FoodMartTestCase test) { test.assertAxisReturns("[Gender].[F] : [Gender].[M].NextMember", ""); } public void testRangeBoundedByNullLarge(FoodMartTestCase test) { test.assertAxisReturns("[Customers].PrevMember : [Customers].[USA].[OR]", ""); } }); // special resolver for the "{...}" operator define(new ResolverBase( "{}", "{<Member> [, <Member>]...}", "Brace operator constructs a set.", FunDef.TypeBraces) { protected FunDef resolve(Exp[] args, int[] conversionCount) { int[] parameterTypes = new int[args.length]; for (int i = 0; i < args.length; i++) { if (canConvert( args[i], Category.Member, conversionCount)) { parameterTypes[i] = Category.Member; continue; } if (canConvert( args[i], Category.Set, conversionCount)) { parameterTypes[i] = Category.Set; continue; } if (canConvert( args[i], Category.Tuple, conversionCount)) { parameterTypes[i] = Category.Tuple; continue; } return null; } return new SetFunDef(this, syntacticType, parameterTypes); } public void testSetContainingLevelFails(FoodMartTestCase test) { test.assertAxisThrows( "[Store].[Store City]", "no function matches signature '{<Level>}'"); } }); // // STRING FUNCTIONS define(new FunDefBase("IIf", "IIf(<Logical Expression>, <String Expression1>, <String Expression2>)", "Returns one of two string values determined by a logical test.", "fSbSS") { public Object evaluate(Evaluator evaluator, Exp[] args) { boolean logical = getBooleanArg(evaluator, args, 0); return getStringArg(evaluator, args, logical ? 1 : 2, null); } public void testIIf(FoodMartTestCase test) { String s = test.executeExpr( "IIf(([Measures].[Unit Sales],[Product].[Drink].[Alcoholic Beverages].[Beer and Wine]) > 100, \"Yes\",\"No\")"); test.assertEquals("Yes", s); } }); define(new FunDefBase("Name", "<Dimension>.Name", "Returns the name of a dimension.", "pSd") { public Object evaluate(Evaluator evaluator, Exp[] args) { Dimension dimension = getDimensionArg(evaluator, args, 0, true); return dimension.getName(); } public void testDimensionName(FoodMartTestCase test) { String s = test.executeExpr("[Time].[1997].Dimension.Name"); test.assertEquals("Time", s); } }); define(new FunDefBase("Name", "<Hierarchy>.Name", "Returns the name of a hierarchy.", "pSh") { public Object evaluate(Evaluator evaluator, Exp[] args) { Hierarchy hierarchy = getHierarchyArg(evaluator, args, 0, true); return hierarchy.getName(); } public void testHierarchyName(FoodMartTestCase test) { String s = test.executeExpr( "[Time].[1997].Hierarchy.Name"); test.assertEquals("Time", s); } }); define(new FunDefBase("Name", "<Level>.Name", "Returns the name of a level.", "pSl") { public Object evaluate(Evaluator evaluator, Exp[] args) { Level level = getLevelArg(evaluator, args, 0, true); return level.getName(); } public void testLevelName(FoodMartTestCase test) { String s = test.executeExpr("[Time].[1997].Level.Name"); test.assertEquals("Year", s); } }); define(new FunDefBase("Name", "<Member>.Name", "Returns the name of a member.", "pSm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); return member.getName(); } public void testMemberName(FoodMartTestCase test) { String s = test.executeExpr("[Time].[1997].Name"); test.assertEquals("1997", s); } }); define(new FunDefBase("SetToStr", "SetToStr(<Set>)", "Constructs a string from a set.", "fSx")); define(new FunDefBase("TupleToStr", "TupleToStr(<Tuple>)", "Constructs a string from a tuple.", "fSt")); define(new FunDefBase("UniqueName", "<Dimension>.UniqueName", "Returns the unique name of a dimension.", "pSd") { public Object evaluate(Evaluator evaluator, Exp[] args) { Dimension dimension = getDimensionArg(evaluator, args, 0, true); return dimension.getUniqueName(); } public void testDimensionUniqueName(FoodMartTestCase test) { String s = test.executeExpr( "[Gender].DefaultMember.Dimension.UniqueName"); test.assertEquals("[Gender]", s); } }); define(new FunDefBase("UniqueName", "<Hierarchy>.UniqueName", "Returns the unique name of a hierarchy.", "pSh") { public Object evaluate(Evaluator evaluator, Exp[] args) { Hierarchy hierarchy = getHierarchyArg(evaluator, args, 0, true); return hierarchy.getUniqueName(); } public void testHierarchyUniqueName(FoodMartTestCase test) { String s = test.executeExpr( "[Gender].DefaultMember.Hierarchy.UniqueName"); test.assertEquals("[Gender]", s); } }); define(new FunDefBase("UniqueName", "<Level>.UniqueName", "Returns the unique name of a level.", "pSl") { public Object evaluate(Evaluator evaluator, Exp[] args) { Level level = getLevelArg(evaluator, args, 0, true); return level.getUniqueName(); } public void testLevelUniqueName(FoodMartTestCase test) { String s = test.executeExpr( "[Gender].DefaultMember.Level.UniqueName"); test.assertEquals("[Gender].[(All)]", s); } }); define(new FunDefBase("UniqueName", "<Member>.UniqueName", "Returns the unique name of a member.", "pSm") { public Object evaluate(Evaluator evaluator, Exp[] args) { Member member = getMemberArg(evaluator, args, 0, true); return member.getUniqueName(); } public void testMemberUniqueName(FoodMartTestCase test) { String s = test.executeExpr( "[Gender].DefaultMember.UniqueName"); test.assertEquals("[Gender].[All Gender]", s); } public void testMemberUniqueNameOfNull(FoodMartTestCase test) { String s = test.executeExpr( "[Measures].[Unit Sales].FirstChild.UniqueName"); test.assertEquals("[Measures].[#Null]", s); // MSOLAP gives "" here } }); // // TUPLE FUNCTIONS define(new FunDefBase("Current", "<Set>.Current", "Returns the current tuple from a set during an iteration.", "ptx")); if (false) define(new FunDefBase("Item", "<Set>.Item(<String Expression>[, <String Expression>...] | <Index>)", "Returns a tuple from a set.", "mt*")); define(new FunDefBase("StrToTuple", "StrToTuple(<String Expression>)", "Constructs a tuple from a string.", "ftS") { public void unparse(Exp[] args, PrintWriter pw, ElementCallback callback) { if (callback.isPlatoMdx()) { // omit extra args (they're for us, not Plato) super.unparse(new Exp[]{args[0]}, pw, callback); } else { super.unparse(args, pw, callback); } } public Hierarchy getHierarchy(Exp[] args) { // StrToTuple(s, <Hie1>, ... <HieN>) is of type [Hie1] x // ... x [HieN]; so, for example, So // StrToTuple("[Time].[1997]", [Time]) is of type [Time]. // But if n > 1, we cannot represent the compound type, and // we return null. return (args.length == 2) ? (Hierarchy) args[1] : null; } }); // special resolver for "()" define(new ResolverBase("()", null, null, FunDef.TypeParentheses) { public FunDef resolve(Exp[] args, int[] conversionCount) { // Compare with TupleFunDef.getReturnType(). For example, // ([Gender].members) is a set, // ([Gender].[M]) is a member, // (1 + 2) is a numeric, // but // ([Gender].[M], [Marital Status].[S]) is a tuple. if (args.length == 1) { return new ParenthesesFunDef(args[0].getType()); } else { return new TupleFunDef(ExpBase.getTypes(args)); } } }); // // GENERIC VALUE FUNCTIONS define(new ResolverBase( "CoalesceEmpty", "CoalesceEmpty(<Value Expression>[, <Value Expression>]...)", "Coalesces an empty cell value to a different value. All of the expressions must be of the same type (number or string).", FunDef.TypeFunction) { protected FunDef resolve(Exp[] args, int[] conversionCount) { if (args.length < 1) { return null; } final int[] types = {Category.Numeric, Category.String}; for (int j = 0; j < types.length; j++) { int type = types[j]; int matchingArgs = 0; conversionCount[0] = 0; for (int i = 0; i < args.length; i++) { if (canConvert(args[i], type, conversionCount)) { matchingArgs++; } } if (matchingArgs == args.length) { return new FunDefBase( this, FunDef.TypeFunction, type, ExpBase.getTypes(args)); } } return null; } }); define(new ResolverBase( "_CaseTest", "Case When <Logical Expression> Then <Expression> [...] [Else <Expression>] End", "Evaluates various conditions, and returns the corresponding expression for the first which evaluates to true.", FunDef.TypeCase) { protected FunDef resolve(Exp[] args, int[] conversionCount) { if (args.length < 1) { return null; } int j = 0, clauseCount = args.length / 2, mismatchingArgs = 0; int returnType = args[1].getType(); for (int i = 0; i < clauseCount; i++) { if (!canConvert(args[j++], Category.Logical, conversionCount)) { mismatchingArgs++; } if (!canConvert(args[j++], returnType, conversionCount)) { mismatchingArgs++; } } if (j < args.length) { if (!canConvert(args[j++], returnType, conversionCount)) { mismatchingArgs++; } } Util.assertTrue(j == args.length); if (mismatchingArgs == 0) { return new FunDefBase( this, FunDef.TypeFunction, returnType, ExpBase.getTypes(args)) { // implement FunDef public Object evaluate(Evaluator evaluator, Exp[] args) { return evaluateCaseTest(evaluator, args); } }; } else { return null; } } Object evaluateCaseTest(Evaluator evaluator, Exp[] args) { int clauseCount = args.length / 2, j = 0; for (int i = 0; i < clauseCount; i++) { boolean logical = getBooleanArg(evaluator, args, j++); if (logical) { return getArg(evaluator, args, j); } else { j++; } } if (j < args.length) { return getArg(evaluator, args, j); // ELSE } else { return null; } } public void testCaseTestMatch(FoodMartTestCase test) { String s = test.executeExpr( "CASE WHEN 1=0 THEN \"first\" WHEN 1=1 THEN \"second\" WHEN 1=2 THEN \"third\" ELSE \"fourth\" END"); test.assertEquals("second", s); } public void testCaseTestMatchElse(FoodMartTestCase test) { String s = test.executeExpr( "CASE WHEN 1=0 THEN \"first\" ELSE \"fourth\" END"); test.assertEquals("fourth", s); } public void testCaseTestMatchNoElse(FoodMartTestCase test) { String s = test.executeExpr( "CASE WHEN 1=0 THEN \"first\" END"); test.assertEquals("(null)", s); } }); define(new ResolverBase( "_CaseMatch", "Case <Expression> When <Expression> Then <Expression> [...] [Else <Expression>] End", "Evaluates various expressions, and returns the corresponding expression for the first which matches a particular value.", FunDef.TypeCase) { protected FunDef resolve(Exp[] args, int[] conversionCount) { if (args.length < 3) { return null; } int valueType = args[0].getType(); int returnType = args[2].getType(); int j = 0, clauseCount = (args.length - 1) / 2, mismatchingArgs = 0; if (!canConvert(args[j++], valueType, conversionCount)) { mismatchingArgs++; } for (int i = 0; i < clauseCount; i++) { if (!canConvert(args[j++], valueType, conversionCount)) { mismatchingArgs++; } if (!canConvert(args[j++], returnType, conversionCount)) { mismatchingArgs++; } } if (j < args.length) { if (!canConvert(args[j++], returnType, conversionCount)) { mismatchingArgs++; } } Util.assertTrue(j == args.length); if (mismatchingArgs == 0) { return new FunDefBase( this, FunDef.TypeFunction, returnType, ExpBase.getTypes(args)) { // implement FunDef public Object evaluate(Evaluator evaluator, Exp[] args) { return evaluateCaseMatch(evaluator, args); } }; } else { return null; } } Object evaluateCaseMatch(Evaluator evaluator, Exp[] args) { int clauseCount = (args.length - 1)/ 2, j = 0; Object value = getArg(evaluator, args, j++); for (int i = 0; i < clauseCount; i++) { Object match = getArg(evaluator, args, j++); if (match.equals(value)) { return getArg(evaluator, args, j); } else { j++; } } if (j < args.length) { return getArg(evaluator, args, j); // ELSE } else { return null; } } public void testCaseMatch(FoodMartTestCase test) { String s = test.executeExpr( "CASE 2 WHEN 1 THEN \"first\" WHEN 2 THEN \"second\" WHEN 3 THEN \"third\" ELSE \"fourth\" END"); test.assertEquals("second", s); } public void testCaseMatchElse(FoodMartTestCase test) { String s = test.executeExpr( "CASE 7 WHEN 1 THEN \"first\" ELSE \"fourth\" END"); test.assertEquals("fourth", s); } public void testCaseMatchNoElse(FoodMartTestCase test) { String s = test.executeExpr( "CASE 8 WHEN 0 THEN \"first\" END"); test.assertEquals("(null)", s); } }); define(new ResolverBase( "Properties", "<Member>.Properties(<String Expression>)", "Returns the value of a member property.", FunDef.TypeMethod) { public FunDef resolve(Exp[] args, int[] conversionCount) { final int[] argTypes = new int[]{Category.Member, Category.String}; if (args.length != 2 || args[0].getType() != Category.Member || args[1].getType() != Category.String) { return null; } int returnType; if (args[1] instanceof Literal) { String propertyName = (String) ((Literal) args[1]).getValue(); Hierarchy hierarchy = args[0].getHierarchy(); Level[] levels = hierarchy.getLevels(); Property property = lookupProperty( levels[levels.length - 1], propertyName); if (property == null) { // we'll likely get a runtime error returnType = Category.Value; } else { switch (property.getType()) { case Property.TYPE_BOOLEAN: returnType = Category.Logical; break; case Property.TYPE_NUMERIC: returnType = Category.Numeric; break; case Property.TYPE_STRING: returnType = Category.String; break; default: throw Util.newInternal("Unknown property type " + property.getType()); } } } else { returnType = Category.Value; } return new PropertiesFunDef(name, signature, description, syntacticType, returnType, argTypes); } public void testPropertiesExpr(FoodMartTestCase test) { String s = test.executeExpr( "[Store].[USA].[CA].[Beverly Hills].[Store 6].Properties(\"Store Type\")"); test.assertEquals("Gourmet Supermarket", s); } /** Tests that non-existent property throws an error. **/ public void testPropertiesNonExistent(FoodMartTestCase test) { test.assertExprThrows( "[Store].[USA].[CA].[Beverly Hills].[Store 6].Properties(\"Foo\")", "Property 'Foo' is not valid for"); } public void testPropertiesFilter(FoodMartTestCase test) { Result result = test.execute( "SELECT { [Store Sales] } ON COLUMNS," + nl + " TOPCOUNT( Filter( [Store].[Store Name].Members," + nl + " [Store].CurrentMember.Properties(\"Store Type\") = \"Supermarket\" )," + nl + " 10, [Store Sales]) ON ROWS" + nl + "FROM [Sales]"); test.assertEquals(8, result.getAxes()[1].positions.length); } public void testPropertyInCalculatedMember(FoodMartTestCase test) { Result result = test.execute( "WITH MEMBER [Measures].[Store Sales per Sqft]" + nl + "AS '[Measures].[Store Sales] / " + " [Store].CurrentMember.Properties(\"Store Sqft\")'" + nl + "SELECT " + nl + " {[Measures].[Unit Sales], [Measures].[Store Sales per Sqft]} ON COLUMNS," + nl + " {[Store].[Store Name].members} ON ROWS" + nl + "FROM Sales"); Member member; Cell cell; member = result.getAxes()[1].positions[17].members[0]; test.assertEquals("[Store].[All Stores].[USA].[WA].[Bellingham].[Store 2]", member.getUniqueName()); cell = result.getCell(new int[] {0,17}); test.assertEquals("2,237", cell.getFormattedValue()); cell = result.getCell(new int[] {1,17}); test.assertEquals("0.16802205204566403", cell.getFormattedValue()); member = result.getAxes()[1].positions[3].members[0]; test.assertEquals("[Store].[All Stores].[Mexico].[DF].[San Andres].[Store 21]", member.getUniqueName()); cell = result.getCell(new int[] {0,3}); test.assertEquals("(null)", cell.getFormattedValue()); cell = result.getCell(new int[] {1,3}); test.assertEquals("NaN", cell.getFormattedValue()); } }); // // PARAMETER FUNCTIONS define(new MultiResolver("Parameter", "Parameter(<Name>, <Type>, <DefaultValue>, <Description>)", "Returns default value of parameter.", new String[] { "fS#yS#", "fs#yS", // Parameter(string const, symbol, string[, string const]): string "fn#yn#", "fn#yn", // Parameter(string const, symbol, numeric[, string const]): numeric "fm#hm#", "fm#hm", // Parameter(string const, hierarchy constant, member[, string const]): member }) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { String parameterName; if (args[0] instanceof Literal && args[0].getType() == Category.String) { parameterName = (String) ((Literal) args[0]).getValue(); } else { throw newEvalException(dummyFunDef, "Parameter name must be a string constant"); } Exp typeArg = args[1]; Hierarchy hierarchy; int type; switch (typeArg.getType()) { case Category.Hierarchy: case Category.Dimension: hierarchy = typeArg.getHierarchy(); if (hierarchy == null || !isConstantHierarchy(typeArg)) { throw newEvalException(dummyFunDef, "Invalid hierarchy for parameter '" + parameterName + "'"); } type = Category.Member; break; case Category.Symbol: hierarchy = null; String s = (String) ((Literal) typeArg).getValue(); if (s.equalsIgnoreCase("NUMERIC")) { type = Category.Numeric; break; } else if (s.equalsIgnoreCase("STRING")) { type = Category.String; break; } // fall through and throw error default: // Error is internal because the function call has already been // type-checked. throw newEvalException(dummyFunDef, "Invalid type for parameter '" + parameterName + "'; expecting NUMERIC, STRING or a hierarchy"); } Exp exp = args[2]; if (exp.getType() != type) { String typeName = Category.instance.getName(type).toUpperCase(); throw newEvalException(dummyFunDef, "Default value of parameter '" + parameterName + "' is inconsistent with its type, " + typeName); } if (type == Category.Member) { Hierarchy expHierarchy = exp.getHierarchy(); if (expHierarchy != hierarchy) { throw newEvalException(dummyFunDef, "Default value of parameter '" + parameterName + "' must belong to the hierarchy " + hierarchy); } } String parameterDescription = null; if (args.length > 3) { if (args[3] instanceof Literal && args[3].getType() == Category.String) { parameterDescription = (String) ((Literal) args[3]).getValue(); } else { throw newEvalException(dummyFunDef, "Description of parameter '" + parameterName + "' must be a string constant"); } } return new ParameterFunDef(dummyFunDef, parameterName, hierarchy, type, exp, parameterDescription); } }); define(new MultiResolver("ParamRef", "ParamRef(<Name>)", "Returns current value of parameter. If it's null, returns default.", new String[] {"fv#"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { String parameterName; if (args[0] instanceof Literal && args[0].getType() == Category.String) { parameterName = (String) ((Literal) args[0]).getValue(); } else { throw newEvalException(dummyFunDef, "Parameter name must be a string constant"); } return new ParameterFunDef(dummyFunDef, parameterName, null, Category.Unknown, null, null); } }); // // OPERATORS define(new FunDefBase("+", "<Numeric Expression> + <Numeric Expression>", "Adds two numbers.", "innn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Double o0 = getDoubleArg(evaluator, args, 0), o1 = getDoubleArg(evaluator, args, 1); return new Double(o0.doubleValue() + o1.doubleValue()); } public void testPlus(FoodMartTestCase test) { String s = test.executeExpr("1+2"); test.assertEquals("3.0", s); } }); define(new FunDefBase("-", "<Numeric Expression> - <Numeric Expression>", "Subtracts two numbers.", "innn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Double o0 = getDoubleArg(evaluator, args, 0), o1 = getDoubleArg(evaluator, args, 1); return new Double(o0.doubleValue() - o1.doubleValue()); } public void testMinus(FoodMartTestCase test) { String s = test.executeExpr("1-3"); test.assertEquals("-2.0", s); } public void testMinusAssociativity(FoodMartTestCase test) { String s = test.executeExpr("11-7-5"); // right-associative would give 11-(7-5) = 9, which is wrong test.assertEquals("-1.0", s); } }); define(new FunDefBase("*", "<Numeric Expression> * <Numeric Expression>", "Multiplies two numbers.", "innn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Double o0 = getDoubleArg(evaluator, args, 0), o1 = getDoubleArg(evaluator, args, 1); return new Double(o0.doubleValue() * o1.doubleValue()); } public void testMultiply(FoodMartTestCase test) { String s = test.executeExpr("4*7"); test.assertEquals("28.0", s); } public void testMultiplyPrecedence(FoodMartTestCase test) { String s = test.executeExpr("3 + 4 * 5 + 6"); test.assertEquals("29.0", s); } }); define(new FunDefBase("/", "<Numeric Expression> / <Numeric Expression>", "Divides two numbers.", "innn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Double o0 = getDoubleArg(evaluator, args, 0), o1 = getDoubleArg(evaluator, args, 1); Double result = new Double(o0.doubleValue() / o1.doubleValue()); return result; } // todo: use this, via reflection public double evaluate(double d1, double d2) { return d1 / d2; } public void testDivide(FoodMartTestCase test) { String s = test.executeExpr("10 / 5"); test.assertEquals("2.0", s); } public void testDivideByZero(FoodMartTestCase test) { String s = test.executeExpr("-3 / (2 - 2)"); test.assertEquals("-Infinity", s); } public void testDividePrecedence(FoodMartTestCase test) { String s = test.executeExpr("24 / 4 / 2 * 10 - -1"); test.assertEquals("31.0", s); } }); define(new FunDefBase("-", "- <Numeric Expression>", "Returns the negative of a number.", "Pnn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Double o0 = getDoubleArg(evaluator, args, 0); return new Double(- o0.doubleValue()); } public void testUnaryMinus(FoodMartTestCase test) { String s = test.executeExpr("-3"); test.assertEquals("-3.0", s); } public void testUnaryMinusMember(FoodMartTestCase test) { String s = test.executeExpr("- ([Measures].[Unit Sales],[Gender].[F])"); test.assertEquals("-131558.0", s); } public void testUnaryMinusPrecedence(FoodMartTestCase test) { String s = test.executeExpr("1 - -10.5 * 2 -3"); test.assertEquals("19.0", s); } }); define(new FunDefBase("||", "<String Expression> || <String Expression>", "Concatenates two strings.", "iSSS") { public Object evaluate(Evaluator evaluator, Exp[] args) { String o0 = getStringArg(evaluator, args, 0, null), o1 = getStringArg(evaluator, args, 1, null); return o0 + o1; } public void testStringConcat(FoodMartTestCase test) { String s = test.executeExpr(" \"foo\" || \"bar\" "); test.assertEquals("foobar", s); } public void testStringConcat2(FoodMartTestCase test) { String s = test.executeExpr(" \"foo\" || [Gender].[M].Name || \"\" "); test.assertEquals("fooM", s); } }); define(new FunDefBase("AND", "<Logical Expression> AND <Logical Expression>", "Returns the conjunction of two conditions.", "ibbb") { public Object evaluate(Evaluator evaluator, Exp[] args) { return toBoolean( getBooleanArg(evaluator, args, 0) && getBooleanArg(evaluator, args, 1)); } public void testAnd(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 1=1 AND 2=2 "); test.assertEquals("true", s); } public void testAnd2(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 1=1 AND 2=0 "); test.assertEquals("false", s); } }); define(new FunDefBase("OR", "<Logical Expression> OR <Logical Expression>", "Returns the disjunction of two conditions.", "ibbb") { public Object evaluate(Evaluator evaluator, Exp[] args) { // Only evaluate 2nd if first is false. return toBoolean( getBooleanArg(evaluator, args, 0) || getBooleanArg(evaluator, args, 1)); } public void testOr(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 1=0 OR 2=0 "); test.assertEquals("false", s); } public void testOr2(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 1=0 OR 0=0 "); test.assertEquals("true", s); } public void testOrAssociativity1(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 1=1 AND 1=0 OR 1=1 "); // Would give 'false' if OR were stronger than AND (wrong!) test.assertEquals("true", s); } public void testOrAssociativity2(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 1=1 OR 1=0 AND 1=1 "); // Would give 'false' if OR were stronger than AND (wrong!) test.assertEquals("true", s); } public void testOrAssociativity3(FoodMartTestCase test) { String s = test.executeBooleanExpr(" (1=0 OR 1=1) AND 1=1 "); test.assertEquals("true", s); } }); define(new FunDefBase("XOR", "<Logical Expression> XOR <Logical Expression>", "Returns whether two conditions are mutually exclusive.", "ibbb") { public Object evaluate(Evaluator evaluator, Exp[] args) { final boolean b0 = getBooleanArg(evaluator, args, 0); final boolean b1 = getBooleanArg(evaluator, args, 1); return toBoolean(b0 != b1); } public void testXor(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 1=1 XOR 2=2 "); test.assertEquals("false", s); } public void testXorAssociativity(FoodMartTestCase test) { // Would give 'false' if XOR were stronger than AND (wrong!) String s = test.executeBooleanExpr(" 1 = 1 AND 1 = 1 XOR 1 = 0 "); test.assertEquals("true", s); } }); define(new FunDefBase("NOT", "NOT <Logical Expression>", "Returns the negation of a condition.", "Pbb") { public Object evaluate(Evaluator evaluator, Exp[] args) { return toBoolean(!getBooleanArg(evaluator, args, 0)); } public void testNot(FoodMartTestCase test) { String s = test.executeBooleanExpr(" NOT 1=1 "); test.assertEquals("false", s); } public void testNotNot(FoodMartTestCase test) { String s = test.executeBooleanExpr(" NOT NOT 1=1 "); test.assertEquals("true", s); } public void testNotAssociativity(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 1=1 AND NOT 1=1 OR NOT 1=1 AND 1=1 "); test.assertEquals("false", s); } }); define(new FunDefBase("=", "<String Expression> = <String Expression>", "Returns whether two expressions are equal.", "ibSS") { public Object evaluate(Evaluator evaluator, Exp[] args) { String o0 = getStringArg(evaluator, args, 0, null), o1 = getStringArg(evaluator, args, 1, null); return toBoolean(o0.equals(o1)); } public void testStringEquals(FoodMartTestCase test) { String s = test.executeBooleanExpr(" \"foo\" = \"bar\" "); test.assertEquals("false", s); } public void testStringEqualsAssociativity(FoodMartTestCase test) { String s = test.executeBooleanExpr(" \"foo\" = \"fo\" || \"o\" "); test.assertEquals("true", s); } public void testStringEqualsEmpty(FoodMartTestCase test) { String s = test.executeBooleanExpr(" \"\" = \"\" "); test.assertEquals("true", s); } }); define(new FunDefBase("=", "<Numeric Expression> = <Numeric Expression>", "Returns whether two expressions are equal.", "ibnn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Double o0 = getDoubleArg(evaluator, args, 0), o1 = getDoubleArg(evaluator, args, 1); return toBoolean(o0.equals(o1)); } public void testEq(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 1.0 = 1 "); test.assertEquals("true", s); } }); define(new FunDefBase("<>", "<String Expression> <> <String Expression>", "Returns whether two expressions are not equal.", "ibSS") { public Object evaluate(Evaluator evaluator, Exp[] args) { String o0 = getStringArg(evaluator, args, 0, null), o1 = getStringArg(evaluator, args, 1, null); return toBoolean(!o0.equals(o1)); } public void testStringNe(FoodMartTestCase test) { String s = test.executeBooleanExpr(" \"foo\" <> \"bar\" "); test.assertEquals("true", s); } }); define(new FunDefBase("<>", "<Numeric Expression> <> <Numeric Expression>", "Returns whether two expressions are not equal.", "ibnn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Double o0 = getDoubleArg(evaluator, args, 0), o1 = getDoubleArg(evaluator, args, 1); return toBoolean(!o0.equals(o1)); } public void testNe(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 2 <> 1.0 + 1.0 "); test.assertEquals("false", s); } public void testNeInfinity(FoodMartTestCase test) { String s = test.executeBooleanExpr("(1 / 0) <> (1 / 0)"); // Infinity does not equal itself test.assertEquals("false", s); } }); define(new FunDefBase("<", "<Numeric Expression> < <Numeric Expression>", "Returns whether an expression is less than another.", "ibnn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Double o0 = getDoubleArg(evaluator, args, 0), o1 = getDoubleArg(evaluator, args, 1); return toBoolean(o0.compareTo(o1) < 0); } public void testLt(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 2 < 1.0 + 1.0 "); test.assertEquals("false", s); } }); define(new FunDefBase("<=", "<Numeric Expression> <= <Numeric Expression>", "Returns whether an expression is less than or equal to another.", "ibnn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Double o0 = getDoubleArg(evaluator, args, 0), o1 = getDoubleArg(evaluator, args, 1); return toBoolean(o0.compareTo(o1) <= 0); } public void testLe(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 2 <= 1.0 + 1.0 "); test.assertEquals("true", s); } }); define(new FunDefBase(">", "<Numeric Expression> > <Numeric Expression>", "Returns whether an expression is greater than another.", "ibnn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Double o0 = getDoubleArg(evaluator, args, 0), o1 = getDoubleArg(evaluator, args, 1); return toBoolean(o0.compareTo(o1) > 0); } public void testGt(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 2 > 1.0 + 1.0 "); test.assertEquals("false", s); } }); define(new FunDefBase(">=", "<Numeric Expression> >= <Numeric Expression>", "Returns whether an expression is greater than or equal to another.", "ibnn") { public Object evaluate(Evaluator evaluator, Exp[] args) { Double o0 = getDoubleArg(evaluator, args, 0), o1 = getDoubleArg(evaluator, args, 1); return toBoolean(o0.compareTo(o1) >= 0); } public void testGe(FoodMartTestCase test) { String s = test.executeBooleanExpr(" 2 > 1.0 + 1.0 "); test.assertEquals("false", s); } }); }
51263 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51263/9cdd89dca2920fdda7be6513ed3b73ff3e366a53/BuiltinFunTable.java/buggy/src/main/mondrian/olap/fun/BuiltinFunTable.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1117, 918, 4426, 7503, 1435, 288, 202, 202, 759, 1122, 1149, 30, 293, 33, 1396, 16, 312, 33, 1305, 16, 277, 33, 382, 904, 16, 453, 33, 2244, 202, 202, 759, 576, 4880, 30, 202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1117, 918, 4426, 7503, 1435, 288, 202, 202, 759, 1122, 1149, 30, 293, 33, 1396, 16, 312, 33, 1305, 16, 277, 33, 382, 904, 16, 453, 33, 2244, 202, 202, 759, 576, 4880, 30, 202, ...
theCanvas.stopProcessing();
theCanvas.dispose();
public void run() { // System.out.println("In Invoke"); theCanvas.stopProcessing(); theFrame.remove(theCanvas); theFrame.removeNotify(); theCanvas.removeNotify(); theFrame=null; theCanvas=null; }
45946 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/45946/f0445ca48036fe8e714977bcd30248b97aa4e8ea/JSVGMemoryLeakTest.java/buggy/test-sources/org/apache/batik/swing/JSVGMemoryLeakTest.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1171, 1071, 918, 1086, 1435, 288, 10792, 368, 2332, 18, 659, 18, 8222, 2932, 382, 14373, 8863, 10792, 326, 12971, 18, 2251, 4150, 5621, 10792, 326, 3219, 18, 4479, 12, 5787, 12971, 1769, 10792, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1171, 1071, 918, 1086, 1435, 288, 10792, 368, 2332, 18, 659, 18, 8222, 2932, 382, 14373, 8863, 10792, 326, 12971, 18, 2251, 4150, 5621, 10792, 326, 3219, 18, 4479, 12, 5787, 12971, 1769, 10792, ...
if (index<0 || index>getSize()) index=getSize();
if (index<0 || index > getSize() - 1) index=getSize() - 1;
public void removeElement(int index) { updating=true; try { if (index<0 || index>getSize()) index=getSize(); String[] newItems = new String[getSize()-1]; String old = combo.getItem(index); System.arraycopy(combo.getItems(), 0, newItems,0, index); if (newItems.length > 0) System.arraycopy(combo.getItems(), index, newItems,index-1, getSize()-index); combo.setItems(newItems); fireChangeEvent(IChangeEvent.REMOVE, old, null, index); } finally{ updating=false; } }
58148 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58148/b0897c0759e8ab36ba4700744bbf1f110f0a044e/ComboUpdatableCollection.java/clean/bundles/org.eclipse.jface.databinding/src/org/eclipse/jface/databinding/internal/swt/ComboUpdatableCollection.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 22015, 12, 474, 770, 13, 288, 202, 202, 5533, 1776, 33, 3767, 31, 9506, 202, 698, 288, 1082, 202, 430, 261, 1615, 32, 20, 747, 770, 34, 588, 1225, 10756, 9506, 202, 161...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 22015, 12, 474, 770, 13, 288, 202, 202, 5533, 1776, 33, 3767, 31, 9506, 202, 698, 288, 1082, 202, 430, 261, 1615, 32, 20, 747, 770, 34, 588, 1225, 10756, 9506, 202, 161...
return pane; }
return pane; }
public PartPane getPane() { return pane;}
56152 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/56152/8d60afdb91e0f186e6c20fde9d4843c10516e942/PartSite.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1071, 6393, 8485, 1689, 8806, 1435, 288, 202, 2463, 13618, 31, 97, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1071, 6393, 8485, 1689, 8806, 1435, 288, 202, 2463, 13618, 31, 97, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); assertEquals(DATE_STAMP_2, task.getLastSyncDateStamp());
assertEquals(RepositoryTaskSyncState.INCOMING, task.getSyncState());
public void testIncomingToSynchronized() { // When not forced, tasks with incoming state should remain in incoming state if // if new data has same date stamp as old data. AbstractRepositoryTask task = primeTaskAndRepository(RepositoryTaskSyncState.INCOMING, RepositoryTaskSyncState.SYNCHRONIZED); assertEquals(DATE_STAMP_1, task.getLastSyncDateStamp()); TasksUiPlugin.getSynchronizationManager().updateOfflineState(task, newData, false); assertEquals(RepositoryTaskSyncState.INCOMING, task.getSyncState()); assertEquals(DATE_STAMP_1, task.getLastSyncDateStamp()); // Test forced (should move to synced state if new data has same date stamp) task = primeTaskAndRepository(RepositoryTaskSyncState.INCOMING, RepositoryTaskSyncState.SYNCHRONIZED); assertEquals(DATE_STAMP_1, task.getLastSyncDateStamp()); TasksUiPlugin.getSynchronizationManager().updateOfflineState(task, newData, true); assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); assertEquals(DATE_STAMP_1, task.getLastSyncDateStamp()); // Test forced with remote incoming task = primeTaskAndRepository(RepositoryTaskSyncState.INCOMING, RepositoryTaskSyncState.INCOMING); assertEquals(DATE_STAMP_1, task.getLastSyncDateStamp()); TasksUiPlugin.getSynchronizationManager().updateOfflineState(task, newData, true); assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); assertEquals(DATE_STAMP_2, task.getLastSyncDateStamp()); }
51989 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51989/0e8ba06ed4bb8378432720f6ce194ca3bbe4b9e1/RepositoryTaskSynchronizationTest.java/buggy/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositoryTaskSynchronizationTest.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 1842, 20370, 774, 55, 15666, 1435, 288, 202, 202, 759, 5203, 486, 13852, 16, 4592, 598, 6935, 919, 1410, 7232, 316, 6935, 919, 309, 202, 202, 759, 309, 394, 501, 711, 196...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 1842, 20370, 774, 55, 15666, 1435, 288, 202, 202, 759, 5203, 486, 13852, 16, 4592, 598, 6935, 919, 1410, 7232, 316, 6935, 919, 309, 202, 202, 759, 309, 394, 501, 711, 196...
public boolean willNotMove (ObjectReference object) {
public boolean willNotMove(ObjectReference object) {
public boolean willNotMove (ObjectReference object) { return (SS.hi && !Space.isInSpace(SS.SS0, object)) || (!SS.hi && !Space.isInSpace(SS.SS1, object)); }
49871 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/49871/57a34fa3e6e607d84b46e06082997a4771a25a85/SSTraceLocal.java/clean/MMTk/src/org/mmtk/plan/semispace/SSTraceLocal.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 1250, 903, 1248, 7607, 12, 22101, 733, 13, 288, 565, 327, 261, 1260, 18, 12266, 597, 401, 3819, 18, 291, 382, 3819, 12, 1260, 18, 1260, 20, 16, 733, 3719, 4202, 747, 16051, 1260, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 1250, 903, 1248, 7607, 12, 22101, 733, 13, 288, 565, 327, 261, 1260, 18, 12266, 597, 401, 3819, 18, 291, 382, 3819, 12, 1260, 18, 1260, 20, 16, 733, 3719, 4202, 747, 16051, 1260, ...
return buffer._isLineVisible(line,index);
try { buffer.readLock(); return buffer._isLineVisible(line,index); } finally { buffer.readUnlock(); }
public final boolean isLineVisible(int line) { return buffer._isLineVisible(line,index); } //}}}
8690 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/8690/f060ff246d3d6f951799da71bcc89970ef4b5fcc/FoldVisibilityManager.java/clean/org/gjt/sp/jedit/textarea/FoldVisibilityManager.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 727, 1250, 353, 1670, 6207, 12, 474, 980, 13, 202, 95, 202, 202, 2463, 1613, 6315, 291, 1670, 6207, 12, 1369, 16, 1615, 1769, 202, 97, 368, 9090, 97, 2, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 727, 1250, 353, 1670, 6207, 12, 474, 980, 13, 202, 95, 202, 202, 2463, 1613, 6315, 291, 1670, 6207, 12, 1369, 16, 1615, 1769, 202, 97, 368, 9090, 97, 2, -100, -100, -100, -1...
for (ClientSession session : sessionManager.getSessions(user.getUsername())) {
for (ClientSession session : sessionManager.getSessions(username)) {
public Collection<Presence> getPresences(User user) { if (user == null) { return null; } List<Presence> presences = new ArrayList<Presence>(); for (ClientSession session : sessionManager.getSessions(user.getUsername())) { presences.add(session.getPresence()); } return Collections.unmodifiableCollection(presences); }
6161 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/6161/9237751d2d6dca3ec1664db1fe7bf10cb3a777ba/PresenceManagerImpl.java/clean/src/java/org/jivesoftware/messenger/spi/PresenceManagerImpl.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 2200, 32, 22590, 34, 1689, 455, 2369, 12, 1299, 729, 13, 288, 3639, 309, 261, 1355, 422, 446, 13, 288, 5411, 327, 446, 31, 3639, 289, 3639, 987, 32, 22590, 34, 4075, 2369, 273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 2200, 32, 22590, 34, 1689, 455, 2369, 12, 1299, 729, 13, 288, 3639, 309, 261, 1355, 422, 446, 13, 288, 5411, 327, 446, 31, 3639, 289, 3639, 987, 32, 22590, 34, 4075, 2369, 273, ...
List remoteArtifactRepositories = project.getRemoteArtifactRepositories();
List remoteRepositories = new ArrayList(); remoteRepositories.addAll( project.getRemoteArtifactRepositories() ); remoteRepositories.addAll( project.getPluginArtifactRepositories() );
private void ensurePluginContainerIsComplete( PluginDescriptor pluginDescriptor, PlexusContainer pluginContainer, MavenProject project, MavenSession session ) throws PluginConfigurationException, ComponentLookupException { // if the plugin's already been used once, don't re-do this step... // otherwise, we have to finish resolving the plugin's classpath and start the container. if ( pluginDescriptor.getArtifacts() != null && pluginDescriptor.getArtifacts().size() == 1 ) { // TODO: this is a little shady... Artifact pluginArtifact = (Artifact) pluginDescriptor.getArtifacts().get( 0 ); ArtifactResolver artifactResolver = null; MavenProjectBuilder mavenProjectBuilder = null; ArtifactFactory artifactFactory = null; try { artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE ); mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE ); artifactFactory = (ArtifactFactory) container.lookup( ArtifactFactory.ROLE ); MavenMetadataSource metadataSource = new MavenMetadataSource( artifactResolver, mavenProjectBuilder, artifactFactory ); List remoteArtifactRepositories = project.getRemoteArtifactRepositories(); ArtifactRepository localRepository = session.getLocalRepository(); Set dependencies = metadataSource.retrieve( pluginArtifact, localRepository, remoteArtifactRepositories ); ArtifactResolutionResult result = artifactResolver.resolveTransitively( dependencies, pluginArtifact, localRepository, remoteArtifactRepositories, metadataSource, artifactFilter ); Set resolved = result.getArtifacts(); for ( Iterator it = resolved.iterator(); it.hasNext(); ) { Artifact artifact = (Artifact) it.next(); if ( artifact != pluginArtifact ) { pluginContainer.addJarResource( artifact.getFile() ); } } pluginDescriptor.setClassRealm( pluginContainer.getContainerRealm() ); // TODO: this is probably overkill as it is rarely used - can we use a mojo tag to signal this will be // used or check its configuration? Also, when it is used, perhaps it is more effecient to resolve // everything at once and apply the exclusion filter when constructing the plugin container above. // Check this out with yourkit ArtifactFilter distroProvidedFilter = new InversionArtifactFilter( artifactFilter ); ArtifactResolutionResult distroProvidedResult = artifactResolver .resolveTransitively( dependencies, pluginArtifact, localRepository, remoteArtifactRepositories, metadataSource, distroProvidedFilter ); Set distroProvided = distroProvidedResult.getArtifacts(); List unfilteredArtifactList = new ArrayList( resolved.size() + distroProvided.size() ); unfilteredArtifactList.addAll( resolved ); unfilteredArtifactList.addAll( distroProvided ); pluginDescriptor.setArtifacts( unfilteredArtifactList ); } catch ( ArtifactResolutionException e ) { throw new PluginConfigurationException( "Cannot resolve plugin dependencies", e ); } catch ( PlexusContainerException e ) { throw new PluginConfigurationException( "Cannot start plugin container", e ); } catch ( ArtifactMetadataRetrievalException e ) { throw new PluginConfigurationException( "Cannot resolve plugin dependencies", e ); } finally { if ( artifactFactory != null ) { releaseComponent( artifactFactory ); } if ( artifactResolver != null ) { releaseComponent( artifactResolver ); } if ( mavenProjectBuilder != null ) { releaseComponent( mavenProjectBuilder ); } } } }
50542 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50542/b796b7635a9d2b785e01f84b405696f9fa494981/DefaultPluginManager.java/buggy/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 3387, 3773, 2170, 2520, 6322, 12, 6258, 3187, 1909, 3187, 16, 453, 4149, 407, 2170, 1909, 2170, 16, 4766, 5375, 17176, 4109, 1984, 16, 17176, 2157, 1339, 262, 3639, 1216, 6258, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 3387, 3773, 2170, 2520, 6322, 12, 6258, 3187, 1909, 3187, 16, 453, 4149, 407, 2170, 1909, 2170, 16, 4766, 5375, 17176, 4109, 1984, 16, 17176, 2157, 1339, 262, 3639, 1216, 6258, ...
if (elementIndex == -1) { switchGrammar(fGrammarNameSpaceIndex);
if(elementIndex == -1 && element.uri == StringPool.EMPTY_STRING) { boolean success = switchGrammar(element.uri); if(success) { fGrammarNameSpaceIndex = element.uri; elementIndex = fGrammar.getElementDeclIndex(element.localpart, TOP_LEVEL_SCOPE); }
private void validateElementAndAttributes(QName element, XMLAttrList attrList) throws Exception { if ((fGrammarIsSchemaGrammar && fElementDepth >= 0 && fValidationFlagStack[fElementDepth] != 0 )|| (fGrammar == null && !fValidating && !fNamespacesEnabled) ) { fCurrentElementIndex = -1; fCurrentContentSpecType = -1; fInElementContent = false; if (fAttrListHandle != -1) { fAttrList.endAttrList(); int index = fAttrList.getFirstAttr(fAttrListHandle); while (index != -1) { if (fStringPool.equalNames(fAttrList.getAttrName(index), fXMLLang)) { fDocumentScanner.checkXMLLangAttributeValue(fAttrList.getAttValue(index)); break; } index = fAttrList.getNextAttr(index); } } return; } int elementIndex = -1; int contentSpecType = -1; boolean skipThisOne = false; boolean laxThisOne = false; if ( fGrammarIsSchemaGrammar && fElementDepth > -1 && fContentLeafStack[fElementDepth] != null ) { ContentLeafNameTypeVector cv = fContentLeafStack[fElementDepth]; QName[] fElemMap = cv.leafNames; for (int i=0; i<cv.leafCount; i++) { int type = cv.leafTypes[i] ; //System.out.println("******* see a ANY_OTHER_SKIP, "+type+","+element+","+fElemMap[i]+"\n*******"); if (type == XMLContentSpec.CONTENTSPECNODE_LEAF) { if (fElemMap[i].uri==element.uri && fElemMap[i].localpart == element.localpart) break; } else if (type == XMLContentSpec.CONTENTSPECNODE_ANY) { break; } else if (type == XMLContentSpec.CONTENTSPECNODE_ANY_NS) { if (element.uri == fElemMap[i].uri) { break; } } else if (type == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER) { if (fElemMap[i].uri != element.uri) { break; } } else if (type == XMLContentSpec.CONTENTSPECNODE_ANY_SKIP) { skipThisOne = true; break; } else if (type == XMLContentSpec.CONTENTSPECNODE_ANY_NS_SKIP) { if (element.uri == fElemMap[i].uri) { skipThisOne = true; break; } } else if (type == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER_SKIP) { if (fElemMap[i].uri != element.uri) { skipThisOne = true; break; } } else if (type == XMLContentSpec.CONTENTSPECNODE_ANY_LAX) { laxThisOne = true; break; } else if (type == XMLContentSpec.CONTENTSPECNODE_ANY_NS_LAX) { if (element.uri == fElemMap[i].uri) { laxThisOne = true; break; } } else if (type == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER_LAX) { if (fElemMap[i].uri != element.uri) { laxThisOne = true; break; } } } } if (skipThisOne) { fNeedValidationOff = true; } else { //REVISIT: is this the right place to check on if the Schema has changed? if ( fNamespacesEnabled && fValidating && element.uri != fGrammarNameSpaceIndex && element.uri != StringPool.EMPTY_STRING) { fGrammarNameSpaceIndex = element.uri; boolean success = switchGrammar(fGrammarNameSpaceIndex); if (!success && !laxThisOne) { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Grammar with uri 2: " + fStringPool.toString(fGrammarNameSpaceIndex) + " , can not be found"); } } if ( fGrammar != null ) { if (DEBUG_SCHEMA_VALIDATION) { System.out.println("*******Lookup element: uri: " + fStringPool.toString(element.uri)+ " localpart: '" + fStringPool.toString(element.localpart) +"' and scope : " + fCurrentScope+"\n"); } elementIndex = fGrammar.getElementDeclIndex(element,fCurrentScope); if (elementIndex == -1 ) { elementIndex = fGrammar.getElementDeclIndex(element, TOP_LEVEL_SCOPE); } if (elementIndex == -1) { // if validating based on a Schema, try to resolve the element again by searching in its type's ancestor types if (fGrammarIsSchemaGrammar && fCurrentElementIndex != -1) { TraverseSchema.ComplexTypeInfo baseTypeInfo = null; baseTypeInfo = ((SchemaGrammar)fGrammar).getElementComplexTypeInfo(fCurrentElementIndex); int aGrammarNSIndex = fGrammarNameSpaceIndex; while (baseTypeInfo != null) { elementIndex = fGrammar.getElementDeclIndex(element, baseTypeInfo.scopeDefined); if (elementIndex > -1 ) { //System.out.println("found element index for " + fStringPool.toString(element.localpart)); // update the current Grammar NS index if resolving element succeed. fGrammarNameSpaceIndex = aGrammarNSIndex; break; } baseTypeInfo = baseTypeInfo.baseComplexTypeInfo; if (baseTypeInfo != null) { String baseTName = baseTypeInfo.typeName; if (!baseTName.startsWith("#")) { int comma = baseTName.indexOf(','); aGrammarNSIndex = fStringPool.addSymbol(baseTName.substring(0,comma).trim()); if (aGrammarNSIndex != fGrammarNameSpaceIndex) { if ( !switchGrammar(aGrammarNSIndex) ) { break; //exit the loop in this case } } } } } if (elementIndex == -1) { switchGrammar(fGrammarNameSpaceIndex); } } //if still can't resolve it, try TOP_LEVEL_SCOPE AGAIN /****/ if ( element.uri == StringPool.EMPTY_STRING && elementIndex == -1 && fNamespacesScope != null && fNamespacesScope.getNamespaceForPrefix(StringPool.EMPTY_STRING) != StringPool.EMPTY_STRING ) { elementIndex = fGrammar.getElementDeclIndex(element.localpart, TOP_LEVEL_SCOPE); // REVISIT: // this is a hack to handle the situation where namespace prefix "" is bound to nothing, and there // is a "noNamespaceSchemaLocation" specified, and element element.uri = StringPool.EMPTY_STRING; } /****/ /****/ if (elementIndex == -1) { if (laxThisOne) { fNeedValidationOff = true; } else if (DEBUG_SCHEMA_VALIDATION) System.out.println("!!! can not find elementDecl in the grammar, " + " the element localpart: " + element.localpart + "["+fStringPool.toString(element.localpart) +"]" + " the element uri: " + element.uri + "["+fStringPool.toString(element.uri) +"]" + " and the current enclosing scope: " + fCurrentScope ); } /****/ } if (DEBUG_SCHEMA_VALIDATION) { fGrammar.getElementDecl(elementIndex, fTempElementDecl); System.out.println("elementIndex: " + elementIndex+" \n and itsName : '" + fStringPool.toString(fTempElementDecl.name.localpart) +"' \n its ContentType:" + fTempElementDecl.type +"\n its ContentSpecIndex : " + fTempElementDecl.contentSpecIndex +"\n"+ " and the current enclosing scope: " + fCurrentScope); } } contentSpecType = getContentSpecType(elementIndex); if (fGrammarIsSchemaGrammar && elementIndex != -1) { // handle "xsi:type" right here if (fXsiTypeAttValue > -1) { String xsiType = fStringPool.toString(fXsiTypeAttValue); int colonP = xsiType.indexOf(":"); String prefix = ""; String localpart = xsiType; if (colonP > -1) { prefix = xsiType.substring(0,colonP); localpart = xsiType.substring(colonP+1); } String uri = ""; int uriIndex = StringPool.EMPTY_STRING; if (fNamespacesScope != null) { uriIndex = fNamespacesScope.getNamespaceForPrefix(fStringPool.addSymbol(prefix)); if (uriIndex > 0) { uri = fStringPool.toString(uriIndex); if (uriIndex != fGrammarNameSpaceIndex) { fGrammarNameSpaceIndex = fCurrentSchemaURI = uriIndex; boolean success = switchGrammar(fCurrentSchemaURI); if (!success && !fNeedValidationOff) { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Grammar with uri 3: " + fStringPool.toString(fCurrentSchemaURI) + " , can not be found"); } } } } Hashtable complexRegistry = ((SchemaGrammar)fGrammar).getComplexTypeRegistry(); DatatypeValidatorFactoryImpl dataTypeReg = ((SchemaGrammar)fGrammar).getDatatypeRegistry(); if (complexRegistry==null || dataTypeReg == null) { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, fErrorReporter.getLocator().getSystemId() +" line"+fErrorReporter.getLocator().getLineNumber() +", canot resolve xsi:type = " + xsiType+" ---2"); } else { TraverseSchema.ComplexTypeInfo typeInfo = (TraverseSchema.ComplexTypeInfo) complexRegistry.get(uri+","+localpart); if (typeInfo==null) { if (uri.length() == 0 || uri.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA) ) { fXsiTypeValidator = dataTypeReg.getDatatypeValidator(localpart); } else fXsiTypeValidator = dataTypeReg.getDatatypeValidator(uri+","+localpart); if ( fXsiTypeValidator == null ) reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "unresolved type : "+uri+","+localpart +" found in xsi:type handling"); else { // make sure the new type is related to the // type of the expected element XMLElementDecl tempElementDecl = new XMLElementDecl(); fGrammar.getElementDecl(elementIndex, tempElementDecl); DatatypeValidator ancestorValidator = tempElementDecl.datatypeValidator; DatatypeValidator tempVal = fXsiTypeValidator; for(; tempVal != null; tempVal = tempVal.getBaseValidator()) // WARNING!!! Comparison by reference. if(tempVal == ancestorValidator) break; if(tempVal == null) { // now if ancestorValidator is a union, then we must // look through its members to see whether we derive from any of them. if(ancestorValidator instanceof UnionDatatypeValidator) { // fXsiTypeValidator must derive from one of its members... Vector subUnionMemberDV = ((UnionDatatypeValidator)ancestorValidator).getBaseValidators(); int subUnionSize = subUnionMemberDV.size(); boolean found = false; for (int i=0; i<subUnionSize && !found; i++) { DatatypeValidator dTempSub = (DatatypeValidator)subUnionMemberDV.elementAt(i); DatatypeValidator dTemp = fXsiTypeValidator; for(; dTemp != null; dTemp = dTemp.getBaseValidator()) { // WARNING!!! This uses comparison by reference andTemp is thus inherently suspect! if(dTempSub == dTemp) { found = true; break; } } } if(!found) { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Type : "+uri+","+localpart +" does not derive from the type of element " + fStringPool.toString(tempElementDecl.name.localpart)); } } else { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Type : "+uri+","+localpart +" does not derive from the type of element " + fStringPool.toString(tempElementDecl.name.localpart)); } } else { // check if element has block set if((((SchemaGrammar)fGrammar).getElementDeclBlockSet(elementIndex) & SchemaSymbols.RESTRICTION) != 0) { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Element " + fStringPool.toString(tempElementDecl.name.localpart) + "does not permit substitution by a type such as "+uri+","+localpart); } } } } else { // // The type must not be abstract // if (typeInfo.isAbstractType()) { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Abstract type " + xsiType + " should not be used in xsi:type"); } // now we look at whether there is a type // relation and whether the type (and element) allow themselves to be substituted for. TraverseSchema.ComplexTypeInfo tempType = typeInfo; TraverseSchema.ComplexTypeInfo destType = ((SchemaGrammar)fGrammar).getElementComplexTypeInfo(elementIndex); for(; tempType != null && destType != null; tempType = tempType.baseComplexTypeInfo) { if(tempType.typeName.equals(destType.typeName)) break; } if(tempType == null) { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Type : "+uri+","+localpart +" does not derive from the type " + destType.typeName); } else if (destType == null) { // TO BE DONE: // if the original type is a simple type, check derivation ok. } else if (typeInfo != destType) { // now check whether the element or typeInfo's baseType blocks us. int derivationMethod = typeInfo.derivedBy; if((((SchemaGrammar)fGrammar).getElementDeclBlockSet(elementIndex) & derivationMethod) != 0) { XMLElementDecl tempElementDecl = new XMLElementDecl(); fGrammar.getElementDecl(elementIndex, tempElementDecl); reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Element " + fStringPool.toString(tempElementDecl.name.localpart) + " does not permit xsi:type substitution in the manner required by type "+uri+","+localpart); } else if ((typeInfo.baseComplexTypeInfo.blockSet & derivationMethod) != 0) { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Type " + typeInfo.baseComplexTypeInfo.typeName + " does not permit other types, such as " +uri+","+localpart + " to be substituted for itself using xsi:type"); } } elementIndex = typeInfo.templateElementIndex; } } fXsiTypeAttValue = -1; } else { // // xsi:type was not specified... // If the corresponding type is abstract, detect an error // TraverseSchema.ComplexTypeInfo typeInfo = ((SchemaGrammar) fGrammar).getElementComplexTypeInfo(elementIndex); if (typeInfo != null && typeInfo.isAbstractType()) { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Element " + fStringPool.toString(element.rawname) + " is declared with a type that is abstract. Use xsi:type to specify a non-abstract type"); } } // // Check whether this element is abstract. If so, an error // int miscFlags = ((SchemaGrammar) fGrammar).getElementDeclMiscFlags(elementIndex); if ((miscFlags & SchemaSymbols.ABSTRACT) != 0) { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "A member of abstract element " + fStringPool.toString(element.rawname) + "'s substitution group must be specified"); } if (fNil && (miscFlags & SchemaSymbols.NILLABLE) == 0 ) { fNil = false; reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "xsi:nil must not be specified for the element "+ fStringPool.toString(element.rawname)+ " with {nillable} equals 'false'"); } //Change the current scope to be the one defined by this element. fCurrentScope = ((SchemaGrammar) fGrammar).getElementDefinedScope(elementIndex); // here need to check if we need to switch Grammar by asking SchemaGrammar whether // this element actually is of a type in another Schema. String anotherSchemaURI = ((SchemaGrammar)fGrammar).getElementFromAnotherSchemaURI(elementIndex); if (anotherSchemaURI != null) { //before switch Grammar, set the elementIndex to be the template elementIndex of its type // but if the content type is empty, we don't bother switching the grammar. if (contentSpecType != -1 && contentSpecType != XMLElementDecl.TYPE_EMPTY ) { TraverseSchema.ComplexTypeInfo typeInfo = ((SchemaGrammar) fGrammar).getElementComplexTypeInfo(elementIndex); if (typeInfo != null) { elementIndex = typeInfo.templateElementIndex; } // now switch the grammar fGrammarNameSpaceIndex = fCurrentSchemaURI = fStringPool.addSymbol(anotherSchemaURI); boolean success = switchGrammar(fCurrentSchemaURI); if (!success && !fNeedValidationOff) { reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Grammar with uri 4: " + fStringPool.toString(fCurrentSchemaURI) + " , can not be found"); } } } } // since the elementIndex could change since last time we query the content type, so do it again. contentSpecType = getContentSpecType(elementIndex); if (contentSpecType == -1 && fValidating && !fNeedValidationOff ) { reportRecoverableXMLError(XMLMessages.MSG_ELEMENT_NOT_DECLARED, XMLMessages.VC_ELEMENT_VALID, element.rawname); } if (fGrammar != null && fGrammarIsSchemaGrammar && elementIndex != -1) { fAttrListHandle = addDefaultAttributes(elementIndex, attrList, fAttrListHandle, fValidating, fStandaloneReader != -1); } if (fAttrListHandle != -1) { fAttrList.endAttrList(); } if (DEBUG_PRINT_ATTRIBUTES) { String elementStr = fStringPool.toString(element.rawname); System.out.print("startElement: <" + elementStr); if (fAttrListHandle != -1) { int index = attrList.getFirstAttr(fAttrListHandle); while (index != -1) { System.out.print(" " + fStringPool.toString(attrList.getAttrName(index)) + "=\"" + fStringPool.toString(attrList.getAttValue(index)) + "\""); index = attrList.getNextAttr(index); } } System.out.println(">"); } // REVISIT: Validation. Do we need to recheck for the xml:lang // attribute? It was already checked above -- perhaps // this is to check values that are defaulted in? If // so, this check could move to the attribute decl // callback so we can check the default value before // it is used. if (fAttrListHandle != -1 && !fNeedValidationOff ) { int index = fAttrList.getFirstAttr(fAttrListHandle); while (index != -1) { int attrNameIndex = attrList.getAttrName(index); if (fStringPool.equalNames(attrNameIndex, fXMLLang)) { fDocumentScanner.checkXMLLangAttributeValue(attrList.getAttValue(index)); // break; } // here, we validate every "user-defined" attributes int _xmlns = fStringPool.addSymbol("xmlns"); if (attrNameIndex != _xmlns && attrList.getAttrPrefix(index) != _xmlns) if (fGrammar != null) { fTempQName.setValues(attrList.getAttrPrefix(index), attrList.getAttrLocalpart(index), attrList.getAttrName(index), attrList.getAttrURI(index) ); int attDefIndex = getAttDefByElementIndex(elementIndex, fTempQName); if (fTempQName.uri != fXsiURI) if (attDefIndex == -1 ) { if (fValidating) { // REVISIT - cache the elem/attr tuple so that we only give // this error once for each unique occurrence Object[] args = { fStringPool.toString(element.rawname), fStringPool.toString(attrList.getAttrName(index))}; /*****/ fAttrNameLocator = getLocatorImpl(fAttrNameLocator); fErrorReporter.reportError(fAttrNameLocator, XMLMessages.XML_DOMAIN, XMLMessages.MSG_ATTRIBUTE_NOT_DECLARED, XMLMessages.VC_ATTRIBUTE_VALUE_TYPE, args, XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR); /******/ } } else { fGrammar.getAttributeDecl(attDefIndex, fTempAttDecl); int attributeType = attributeTypeName(fTempAttDecl); attrList.setAttType(index, attributeType); if (fValidating) { if (fGrammarIsDTDGrammar) { int normalizedValue = validateDTDattribute(element, attrList.getAttValue(index), fTempAttDecl); attrList.setAttValue(index, normalizedValue); } // check to see if this attribute matched an attribute wildcard else if ( fGrammarIsSchemaGrammar && (fTempAttDecl.type == XMLAttributeDecl.TYPE_ANY_ANY ||fTempAttDecl.type == XMLAttributeDecl.TYPE_ANY_LIST ||fTempAttDecl.type == XMLAttributeDecl.TYPE_ANY_OTHER) ) { if ((fTempAttDecl.defaultType & XMLAttributeDecl.PROCESSCONTENTS_SKIP) > 0) { // attribute should just be bypassed, } else if ( (fTempAttDecl.defaultType & XMLAttributeDecl.PROCESSCONTENTS_STRICT) > 0 || (fTempAttDecl.defaultType & XMLAttributeDecl.PROCESSCONTENTS_LAX) > 0) { boolean reportError = false; boolean processContentStrict = (fTempAttDecl.defaultType & XMLAttributeDecl.PROCESSCONTENTS_STRICT) > 0; // ??? REVISIT: can't tell whether it's a local attribute // or a global one with empty namespace //if (fTempQName.uri == StringPool.EMPTY_STRING) { // if (processContentStrict) { // reportError = true; // } //} else { { Grammar aGrammar = fGrammarResolver.getGrammar(fStringPool.toString(fTempQName.uri)); if (aGrammar == null || !(aGrammar instanceof SchemaGrammar) ) { if (processContentStrict) { reportError = true; } } else { SchemaGrammar sGrammar = (SchemaGrammar) aGrammar; Hashtable attRegistry = sGrammar.getAttributeDeclRegistry(); if (attRegistry == null) { if (processContentStrict) { reportError = true; } } else { XMLAttributeDecl attDecl = (XMLAttributeDecl) attRegistry.get(fStringPool.toString(fTempQName.localpart)); if (attDecl == null) { if (processContentStrict) { reportError = true; } } else { DatatypeValidator attDV = attDecl.datatypeValidator; if (attDV == null) { if (processContentStrict) { reportError = true; } } else { try { String unTrimValue = fStringPool.toString(attrList.getAttValue(index)); String value = unTrimValue.trim(); if (attDV instanceof IDDatatypeValidator) { this.fStoreIDRef.setDatatypeObject( attDV.validate( value, null ) ); } if (attDV instanceof IDREFDatatypeValidator) { attDV.validate(value, null ); } else { fWhiteSpace = attDV.getWSFacet(); if (fWhiteSpace == DatatypeValidator.REPLACE) { //CDATA attDV.validate(unTrimValue, null ); } else { // normalize int normalizedValue = fStringPool.addString(value); attrList.setAttValue(index,normalizedValue ); if (attDV instanceof NOTATIONDatatypeValidator && value !=null) { value=bindNotationURI(value); } attDV.validate(value, null ); } } } catch (InvalidDatatypeValueException idve) { fErrorReporter.reportError(fErrorReporter.getLocator(), SchemaMessageProvider.SCHEMA_DOMAIN, SchemaMessageProvider.DatatypeError, SchemaMessageProvider.MSG_NONE, new Object [] { idve.getMessage()}, XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR); } } } } } } if (reportError) { Object[] args = { fStringPool.toString(element.rawname), "ANY---"+fStringPool.toString(attrList.getAttrName(index))}; fAttrNameLocator = getLocatorImpl(fAttrNameLocator); fErrorReporter.reportError(fAttrNameLocator, XMLMessages.XML_DOMAIN, XMLMessages.MSG_ATTRIBUTE_NOT_DECLARED, XMLMessages.VC_ATTRIBUTE_VALUE_TYPE, args, XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR); } } } else if (fTempAttDecl.datatypeValidator == null) { Object[] args = { fStringPool.toString(element.rawname), fStringPool.toString(attrList.getAttrName(index))}; System.out.println("[Error] Datatypevalidator for attribute " + fStringPool.toString(attrList.getAttrName(index)) + " not found in element type " + fStringPool.toString(element.rawname)); /****/ fAttrNameLocator = getLocatorImpl(fAttrNameLocator); fErrorReporter.reportError(fAttrNameLocator, XMLMessages.XML_DOMAIN, XMLMessages.MSG_ATTRIBUTE_NOT_DECLARED, XMLMessages.VC_ATTRIBUTE_VALUE_TYPE, args, XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR); /****/ } else { try { String unTrimValue = fStringPool.toString(attrList.getAttValue(index)); String value = unTrimValue.trim(); DatatypeValidator tempDV = fTempAttDecl.datatypeValidator; // if "fixed" is specified, then get the fixed string, // and compare over value space if ((fTempAttDecl.defaultType & XMLAttributeDecl.DEFAULT_TYPE_FIXED) > 0 && tempDV.compare(value, fTempAttDecl.defaultValue) != 0) { Object[] args = { fStringPool.toString(element.rawname), fStringPool.toString(attrList.getAttrName(index)), unTrimValue, fTempAttDecl.defaultValue}; fErrorReporter.reportError( fErrorReporter.getLocator(), XMLMessages.XML_DOMAIN, XMLMessages.MSG_FIXED_ATTVALUE_INVALID, XMLMessages.VC_FIXED_ATTRIBUTE_DEFAULT, args, XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR); } if (tempDV instanceof IDDatatypeValidator) { this.fStoreIDRef.setDatatypeObject( tempDV.validate( value, null ) ); } else if (tempDV instanceof IDREFDatatypeValidator) { tempDV.validate(value, null ); } else { fWhiteSpace = tempDV.getWSFacet(); if (fWhiteSpace == DatatypeValidator.REPLACE) { //CDATA tempDV.validate(unTrimValue, null ); } else { // normalize int normalizedValue = fStringPool.addString(value); attrList.setAttValue(index,normalizedValue ); if (tempDV instanceof NOTATIONDatatypeValidator && value !=null) { value=bindNotationURI(value); } tempDV.validate(value, null ); } } } catch (InvalidDatatypeValueException idve) { fErrorReporter.reportError(fErrorReporter.getLocator(), SchemaMessageProvider.SCHEMA_DOMAIN, SchemaMessageProvider.DatatypeError, SchemaMessageProvider.MSG_NONE, new Object [] { idve.getMessage()}, XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR); } } } // end of if (fValidating) } // end of if (attDefIndex == -1) else }// end of if (fGrammar != null) index = fAttrList.getNextAttr(index); } } } if (fAttrListHandle != -1) { int index = attrList.getFirstAttr(fAttrListHandle); while (index != -1) { int attName = attrList.getAttrName(index); if (!fStringPool.equalNames(attName, fNamespacesPrefix)) { int attPrefix = attrList.getAttrPrefix(index); if (attPrefix != fNamespacesPrefix) { if (attPrefix != -1) { int uri = fNamespacesScope.getNamespaceForPrefix(attPrefix); if (uri == StringPool.EMPTY_STRING) { Object[] args = { fStringPool.toString(attPrefix)}; fErrorReporter.reportError(fErrorReporter.getLocator(), XMLMessages.XMLNS_DOMAIN, XMLMessages.MSG_PREFIX_DECLARED, XMLMessages.NC_PREFIX_DECLARED, args, XMLErrorReporter.ERRORTYPE_RECOVERABLE_ERROR); } attrList.setAttrURI(index, uri); } } } index = attrList.getNextAttr(index); } } fCurrentElementIndex = elementIndex; fCurrentContentSpecType = contentSpecType; if (fValidating && contentSpecType == XMLElementDecl.TYPE_SIMPLE) { fBufferDatatype = true; fDatatypeBuffer.setLength(0); } fInElementContent = (contentSpecType == XMLElementDecl.TYPE_CHILDREN); } // validateElementAndAttributes(QName,XMLAttrList)
6373 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/6373/ac35bd7d451db928c418946bb9ff6df624371b17/XMLValidator.java/buggy/src/org/apache/xerces/validators/common/XMLValidator.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 565, 3238, 918, 1954, 1046, 1876, 2498, 12, 13688, 930, 16, 4766, 2868, 3167, 3843, 682, 1604, 682, 13, 565, 1216, 1185, 288, 1377, 309, 14015, 74, 18576, 2520, 3078, 18576, 597, 284, 1046, 61...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 565, 3238, 918, 1954, 1046, 1876, 2498, 12, 13688, 930, 16, 4766, 2868, 3167, 3843, 682, 1604, 682, 13, 565, 1216, 1185, 288, 1377, 309, 14015, 74, 18576, 2520, 3078, 18576, 597, 284, 1046, 61...
addClasspathArchive(new File(matcher.group(1)).getPath());
String path = matcher.group(1); if (path.indexOf(':') == -1) { path = "/" + path; } addClasspathArchive(new File(path).getPath());
public void addRuntimeLib() { String fileName = String.class.getResource("String.class").toExternalForm(); Matcher matcher = Pattern.compile("jar:file:/(.*)!.*").matcher(fileName); if (matcher.matches()) { addClasspathArchive(new File(matcher.group(1)).getPath()); fireClasspathChanged(false); } }
8090 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/8090/75b02f8634973f7f8de76b46472e99dc7e4950e8/BrowserConfig.java/buggy/jclasslib/src/org/gjt/jclasslib/browser/config/BrowserConfig.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 527, 5576, 5664, 1435, 288, 3639, 514, 3968, 273, 514, 18, 1106, 18, 588, 1420, 2932, 780, 18, 1106, 20387, 869, 6841, 1204, 5621, 3639, 9757, 4546, 273, 6830, 18, 11100, 2932,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 527, 5576, 5664, 1435, 288, 3639, 514, 3968, 273, 514, 18, 1106, 18, 588, 1420, 2932, 780, 18, 1106, 20387, 869, 6841, 1204, 5621, 3639, 9757, 4546, 273, 6830, 18, 11100, 2932,...
try { libPathURLs.add(new URL(Locator.encodeURI(element.toURL().toString()))); } catch (UnsupportedEncodingException ex) { throw new MalformedURLException(ex.toString()); }
libPathURLs.add(Locator.fileToURL(element));
private void addPath(String path, boolean getJars, List libPathURLs) throws MalformedURLException { StringTokenizer tokenizer = new StringTokenizer(path, File.pathSeparator); while(tokenizer.hasMoreElements()) { String elementName = tokenizer.nextToken(); File element = new File(elementName); if (elementName.indexOf("%") != -1 && !element.exists()) { continue; } if (getJars && element.isDirectory()) { // add any jars in the directory URL[] dirURLs = Locator.getLocationURLs(element); for (int j = 0; j < dirURLs.length; ++j) { libPathURLs.add(dirURLs[j]); } } try { libPathURLs.add(new URL(Locator.encodeURI(element.toURL().toString()))); } catch (UnsupportedEncodingException ex) { throw new MalformedURLException(ex.toString()); } } }
506 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/506/bce9fe013a8838393971f990e13f8fc38404a629/Launcher.java/buggy/src/main/org/apache/tools/ant/launch/Launcher.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 25505, 12, 780, 589, 16, 1250, 9285, 5913, 16, 987, 2561, 743, 15749, 13, 5411, 1216, 20710, 288, 3639, 16370, 10123, 273, 394, 16370, 12, 803, 16, 1387, 18, 803, 6581, 1769, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 25505, 12, 780, 589, 16, 1250, 9285, 5913, 16, 987, 2561, 743, 15749, 13, 5411, 1216, 20710, 288, 3639, 16370, 10123, 273, 394, 16370, 12, 803, 16, 1387, 18, 803, 6581, 1769, ...
first = 0;
public void onStartBinding(PlugletStreamInfo streamInfo) { bb = new byte[streamInfo.getLength()]; total = 0; first = 0; }
7555 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/7555/701adb53ebc028dc703c1074d472d19dec2ab46e/PDFView.java/buggy/java/plugins/examples/pdf/PDFView.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 603, 1685, 5250, 12, 1749, 637, 1810, 1228, 966, 1407, 966, 13, 288, 202, 9897, 273, 394, 1160, 63, 3256, 966, 18, 588, 1782, 1435, 15533, 202, 4963, 273, 374, 31, 202, 282, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 603, 1685, 5250, 12, 1749, 637, 1810, 1228, 966, 1407, 966, 13, 288, 202, 9897, 273, 394, 1160, 63, 3256, 966, 18, 588, 1782, 1435, 15533, 202, 4963, 273, 374, 31, 202, 282, ...
shouldInsertARK();
private Node(Config config, RandomSource random) throws NodeInitException { // Easy stuff arkPutter = new MyARKInserter(); startupTime = System.currentTimeMillis(); throttleWindow = new ThrottleWindowManager(2.0); alerts = new UserAlertManager(); recentlyCompletedIDs = new LRUQueue(); this.config = config; this.random = random; cachedPubKeys = new LRUHashtable(); lm = new LocationManager(random); try { localhostAddress = InetAddress.getByName("127.0.0.1"); } catch (UnknownHostException e3) { // Does not do a reverse lookup, so this is impossible throw new Error(e3); } ipDetector = new IPAddressDetector(10*1000, this); requestSenders = new HashMap(); transferringRequestSenders = new HashMap(); insertSenders = new HashMap(); runningUIDs = new HashSet(); ps = new PacketSender(this); // FIXME maybe these should persist? They need to be private though, so after the node/peers split. (bug 51). decrementAtMax = random.nextDouble() <= DECREMENT_AT_MAX_PROB; decrementAtMin = random.nextDouble() <= DECREMENT_AT_MIN_PROB; bootID = random.nextLong(); throttledPacketSendAverage = new TimeDecayingRunningAverage(1, 60000 /* should be significantly longer than a typical transfer */, 0, Long.MAX_VALUE); // Setup node-specific configuration SubConfig nodeConfig = new SubConfig("node", config); // IP address override nodeConfig.register("ipAddressOverride", "", 0, true, "IP address override", "IP address override (not usually needed)", new StringCallback() { public String get() { if(overrideIPAddress == null) return ""; else return Peer.getHostName(overrideIPAddress); } public void set(String val) throws InvalidConfigValueException { // FIXME do we need to tell anyone? if(val.length() == 0) { // Set to null overrideIPAddress = null; lastIPAddress = null; shouldInsertARK(); return; } InetAddress addr; try { addr = InetAddress.getByName(val); shouldInsertARK(); } catch (UnknownHostException e) { throw new InvalidConfigValueException("Unknown host: "+e.getMessage()); } overrideIPAddress = addr; lastIPAddress = null; shouldInsertARK(); } }); String ipOverrideString = nodeConfig.getString("ipAddressOverride"); if(ipOverrideString.length() == 0) overrideIPAddress = null; else { try { overrideIPAddress = InetAddress.getByName(ipOverrideString); } catch (UnknownHostException e) { String msg = "Unknown host: "+ipOverrideString+" in config: "+e.getMessage(); Logger.error(this, msg); System.err.println(msg+" but starting up anyway with no IP override"); overrideIPAddress = null; } } // Determine the port number nodeConfig.register("listenPort", -1 /* means random */, 1, true, "FNP port number (UDP)", "UDP port for node-to-node communications (Freenet Node Protocol)", new IntCallback() { public int get() { return portNumber; } public void set(int val) throws InvalidConfigValueException { // FIXME implement on the fly listenPort changing // Note that this sort of thing should be the exception rather than the rule!!!! String msg = "Switching listenPort on the fly not yet supported!"; Logger.error(this, msg); throw new InvalidConfigValueException(msg); } }); int port=-1; try{ port=nodeConfig.getInt("listenPort"); }catch (Exception e){ Logger.error(this, "Caught "+e, e); System.err.println(e); e.printStackTrace(); port=-1; } UdpSocketManager u = null; if(port > 65535) { throw new NodeInitException(EXIT_IMPOSSIBLE_USM_PORT, "Impossible port number: "+port); } else if(port == -1) { // Pick a random port for(int i=0;i<200000;i++) { int portNo = 1024 + random.nextInt(65535-1024); try { u = new UdpSocketManager(portNo); port = u.getPortNumber(); break; } catch (SocketException e) { Logger.normal(this, "Could not use port: "+portNo+": "+e, e); System.err.println("Could not use port: "+portNo+": "+e); e.printStackTrace(); continue; } } if(u == null) throw new NodeInitException(EXIT_NO_AVAILABLE_UDP_PORTS, "Could not find an available UDP port number for FNP (none specified)"); } else { try { u = new UdpSocketManager(port); } catch (SocketException e) { throw new NodeInitException(EXIT_IMPOSSIBLE_USM_PORT, "Could not bind to port: "+port+" (node already running?)"); } } usm = u; System.out.println("Port number: "+port); portNumber = port; Logger.normal(Node.class, "Creating node..."); // Bandwidth limit // FIXME These should not be static !!!! Need a context object for BT for bwlimiting. // See bug 77 nodeConfig.register("outputBandwidthLimit", "15K", 3, false, "Output bandwidth limit", "Hard output bandwidth limit (bytes/sec); the node should almost never exceed this", new IntCallback() { public int get() { return BlockTransmitter.getHardBandwidthLimit(); } public void set(int val) throws InvalidConfigValueException { BlockTransmitter.setHardBandwidthLimit(val); } }); int obwLimit = nodeConfig.getInt("outputBandwidthLimit"); BlockTransmitter.setHardBandwidthLimit(obwLimit); // FIXME add an averaging/long-term/soft bandwidth limit. (bug 76) // There is already untested support for this in BlockTransmitter. // No long-term limit for now. BlockTransmitter.setSoftBandwidthLimit(0, 0); // SwapRequestInterval nodeConfig.register("swapRequestSendInterval", 2000, 4, true, "Swap request send interval (ms)", "Interval between swap attempting to send swap requests in milliseconds. Leave this alone!", new IntCallback() { public int get() { return swapInterval.fixedInterval; } public void set(int val) throws InvalidConfigValueException { swapInterval.set(val); } }); swapInterval = new StaticSwapRequestInterval(nodeConfig.getInt("swapRequestSendInterval")); // Testnet. // Cannot be enabled/disabled on the fly. // If enabled, forces certain other config options. if((testnetHandler = TestnetHandler.maybeCreate(this, config)) != null) { String msg = "WARNING: ENABLING TESTNET CODE! This WILL seriously jeopardize your anonymity!"; Logger.error(this, msg); System.err.println(msg); testnetEnabled = true; if(logConfigHandler.getFileLoggerHook() == null) { System.err.println("Forcing logging enabled (essential for testnet)"); logConfigHandler.forceEnableLogging(); } int x = Logger.globalGetThreshold(); if(!(x == Logger.MINOR || x == Logger.DEBUG)) { System.err.println("Forcing log threshold to MINOR for testnet, was "+x); Logger.globalSetThreshold(Logger.MINOR); } if(logConfigHandler.getMaxZippedLogFiles() < TESTNET_MIN_MAX_ZIPPED_LOGFILES) { System.err.println("Forcing max zipped logfiles space to 256MB for testnet"); try { logConfigHandler.setMaxZippedLogFiles(TESTNET_MIN_MAX_ZIPPED_LOGFILES_STRING); } catch (InvalidConfigValueException e) { throw new Error("Impossible: "+e); } } } else { String s = "Testnet mode DISABLED. You may have some level of anonymity. :)\n"+ "Note that while we no longer have explicit back-doors enabled, this version of Freenet is still a very early alpha, and may well have numerous bugs and design flaws.\n"+ "In particular: YOU ARE WIDE OPEN TO YOUR IMMEDIATE DARKNET PEERS! They can eavesdrop on your requests with relatively little difficulty at present (correlation attacks etc)."; Logger.normal(this, s); System.err.println(s); testnetEnabled = false; FileLoggerHook flh = logConfigHandler.getFileLoggerHook(); if(flh != null) flh.deleteAllOldLogFiles(); } if(wasTestnet != testnetEnabled) { Logger.error(this, "Switched from testnet mode to non-testnet mode or vice versa! Regenerating pubkey, privkey, and deleting logs."); this.myCryptoGroup = Global.DSAgroupBigA; this.myPrivKey = new DSAPrivateKey(myCryptoGroup, random); this.myPubKey = new DSAPublicKey(myCryptoGroup, myPrivKey); } // Directory for node-related files other than store nodeConfig.register("nodeDir", ".", 6, true, "Node directory", "Name of directory to put node-related files e.g. peers list in", new StringCallback() { public String get() { return nodeDir.getPath(); } public void set(String val) throws InvalidConfigValueException { if(nodeDir.equals(new File(val))) return; // FIXME throw new InvalidConfigValueException("Moving node directory on the fly not supported at present"); } }); nodeDir = new File(nodeConfig.getString("nodeDir")); if(!((nodeDir.exists() && nodeDir.isDirectory()) || (nodeDir.mkdir()))) { String msg = "Could not find or create datastore directory"; throw new NodeInitException(EXIT_BAD_NODE_DIR, msg); } // After we have set up testnet and IP address, load the node file try { // FIXME should take file directly? readNodeFile(new File(nodeDir, "node-"+portNumber).getPath(), random); } catch (IOException e) { try { readNodeFile(new File("node-"+portNumber+".bak").getPath(), random); } catch (IOException e1) { initNodeFileSettings(random); } } // Then read the peers peers = new PeerManager(this, new File(nodeDir, "peers-"+portNumber).getPath()); peers.writePeers(); peers.checkEmpty(); nodePinger = new NodePinger(this); usm.setDispatcher(dispatcher=new NodeDispatcher(this)); usm.setLowLevelFilter(packetMangler = new FNPPacketMangler(this)); // Temp files nodeConfig.register("tempDir", new File(nodeDir, "temp-"+portNumber).toString(), 6, true, "Temp files directory", "Name of directory to put temporary files in", new StringCallback() { public String get() { return tempDir.getPath(); } public void set(String val) throws InvalidConfigValueException { if(tempDir.equals(new File(val))) return; // FIXME throw new InvalidConfigValueException("Moving temp directory on the fly not supported at present"); } }); tempDir = new File(nodeConfig.getString("tempDir")); if(!((tempDir.exists() && tempDir.isDirectory()) || (tempDir.mkdir()))) { String msg = "Could not find or create temporary directory"; throw new NodeInitException(EXIT_BAD_TEMP_DIR, msg); } try { tempFilenameGenerator = new FilenameGenerator(random, true, tempDir, "temp-"); } catch (IOException e) { String msg = "Could not find or create temporary directory (filename generator)"; throw new NodeInitException(EXIT_BAD_TEMP_DIR, msg); } tempBucketFactory = new PaddedEphemerallyEncryptedBucketFactory(new TempBucketFactory(tempFilenameGenerator), random, 1024); // Persistent temp files nodeConfig.register("persistentTempDir", new File(nodeDir, "persistent-temp-"+portNumber).toString(), 7, true, "Persistent temp files directory", "Name of directory to put persistent temp files in", new StringCallback() { public String get() { return persistentTempBucketFactory.getDir().toString(); } public void set(String val) throws InvalidConfigValueException { if(!get().equals(val)) return; // FIXME throw new InvalidConfigValueException("Moving persistent temp directory on the fly not supported at present"); } }); try { persistentTempBucketFactory = new PersistentTempBucketFactory(new File(nodeConfig.getString("persistentTempDir")), "freenet-temp-", random); } catch (IOException e2) { String msg = "Could not find or create persistent temporary directory"; throw new NodeInitException(EXIT_BAD_TEMP_DIR, msg); } // Datastore nodeConfig.register("storeSize", "1G", 8, false, "Store size in bytes", "Store size in bytes", new LongCallback() { public long get() { return maxStoreKeys * sizePerKey; } public void set(long storeSize) throws InvalidConfigValueException { if(storeSize < 0 || storeSize < (32 * 1024 * 1024)) throw new InvalidConfigValueException("Invalid store size"); long newMaxStoreKeys = storeSize / sizePerKey; if(newMaxStoreKeys == maxStoreKeys) return; // Update each datastore maxStoreKeys = newMaxStoreKeys; chkDatastore.setMaxKeys(maxStoreKeys); sskDatastore.setMaxKeys(maxStoreKeys); pubKeyDatastore.setMaxKeys(maxStoreKeys); } }); long storeSize = nodeConfig.getLong("storeSize"); if(/*storeSize < 0 || */storeSize < (32 * 1024 * 1024)) { // totally arbitrary minimum! throw new NodeInitException(EXIT_INVALID_STORE_SIZE, "Invalid store size"); } maxStoreKeys = storeSize / sizePerKey; nodeConfig.register("storeDir", ".", 9, true, "Store directory", "Name of directory to put store files in", new StringCallback() { public String get() { return storeDir.getPath(); } public void set(String val) throws InvalidConfigValueException { if(storeDir.equals(new File(val))) return; // FIXME throw new InvalidConfigValueException("Moving datastore on the fly not supported at present"); } }); storeDir = new File(nodeConfig.getString("storeDir")); if(!((storeDir.exists() && storeDir.isDirectory()) || (storeDir.mkdir()))) { String msg = "Could not find or create datastore directory"; throw new NodeInitException(EXIT_STORE_OTHER, msg); } try { chkDatastore = new BerkeleyDBFreenetStore(storeDir.getPath()+File.separator+"store-"+portNumber, maxStoreKeys, 32768, CHKBlock.TOTAL_HEADERS_LENGTH); sskDatastore = new BerkeleyDBFreenetStore(storeDir.getPath()+File.separator+"sskstore-"+portNumber, maxStoreKeys, 1024, SSKBlock.TOTAL_HEADERS_LENGTH); pubKeyDatastore = new BerkeleyDBFreenetStore(storeDir.getPath()+File.separator+"pubkeystore-"+portNumber, maxStoreKeys, DSAPublicKey.PADDED_SIZE, 0); } catch (FileNotFoundException e1) { String msg = "Could not open datastore: "+e1; Logger.error(this, msg, e1); System.err.println(msg); throw new NodeInitException(EXIT_STORE_FILE_NOT_FOUND, msg); } catch (IOException e1) { String msg = "Could not open datastore: "+e1; Logger.error(this, msg, e1); System.err.println(msg); throw new NodeInitException(EXIT_STORE_IOEXCEPTION, msg); } catch (Exception e1) { String msg = "Could not open datastore: "+e1; Logger.error(this, msg, e1); System.err.println(msg); throw new NodeInitException(EXIT_STORE_OTHER, msg); } // Downloads directory nodeConfig.register("downloadsDir", "downloads", 10, false, "Default download directory", "The directory to save downloaded files into by default", new StringCallback() { public String get() { return downloadDir.getPath(); } public void set(String val) throws InvalidConfigValueException { if(downloadDir.equals(new File(val))) return; File f = new File(val); if(!((f.exists() && f.isDirectory()) || (f.mkdir()))) { throw new InvalidConfigValueException("Could not find or create directory"); } downloadDir = new File(val); } }); String val = nodeConfig.getString("downloadsDir"); downloadDir = new File(val); if(!((downloadDir.exists() && downloadDir.isDirectory()) || (downloadDir.mkdir()))) { throw new NodeInitException(EXIT_BAD_DOWNLOADS_DIR, "Could not find or create default downloads directory"); } // Name nodeConfig.register("name", myName, 11, false, "Node name for darknet", "Node name; you may want to set this to something descriptive if running on darknet e.g. Fred Blogg's Node; it is visible to any connecting node", new NodeNameCallback(this)); nodeNameUserAlert = new MeaningfulNodeNameUserAlert(); myName = nodeConfig.getString("name"); nodeConfig.finishedInitialization(); writeNodeFile(); // FIXME make all the below arbitrary constants configurable! archiveManager = new ArchiveManager(MAX_ARCHIVE_HANDLERS, MAX_CACHED_ARCHIVE_DATA, MAX_ARCHIVE_SIZE, MAX_ARCHIVED_FILE_SIZE, MAX_CACHED_ELEMENTS, random, tempFilenameGenerator); chkRequestThrottle = new MyRequestThrottle(throttleWindow, 5000, "CHK Request"); chkRequestStarter = new RequestStarter(this, chkRequestThrottle, "CHK Request starter ("+portNumber+")"); chkFetchScheduler = new ClientRequestScheduler(false, false, random, chkRequestStarter, this); chkRequestStarter.setScheduler(chkFetchScheduler); chkRequestStarter.start(); //insertThrottle = new ChainedRequestThrottle(10000, 2.0F, requestThrottle); // FIXME reenable the above chkInsertThrottle = new MyRequestThrottle(throttleWindow, 10000, "CHK Insert"); chkInsertStarter = new RequestStarter(this, chkInsertThrottle, "CHK Insert starter ("+portNumber+")"); chkPutScheduler = new ClientRequestScheduler(true, false, random, chkInsertStarter, this); chkInsertStarter.setScheduler(chkPutScheduler); chkInsertStarter.start(); sskRequestThrottle = new MyRequestThrottle(throttleWindow, 5000, "SSK Request"); sskRequestStarter = new RequestStarter(this, sskRequestThrottle, "SSK Request starter ("+portNumber+")"); sskFetchScheduler = new ClientRequestScheduler(false, true, random, sskRequestStarter, this); sskRequestStarter.setScheduler(sskFetchScheduler); sskRequestStarter.start(); //insertThrottle = new ChainedRequestThrottle(10000, 2.0F, requestThrottle); // FIXME reenable the above sskInsertThrottle = new MyRequestThrottle(throttleWindow, 10000, "SSK Insert"); sskInsertStarter = new RequestStarter(this, sskInsertThrottle, "SSK Insert starter ("+portNumber+")"); sskPutScheduler = new ClientRequestScheduler(true, true, random, sskInsertStarter, this); sskInsertStarter.setScheduler(sskPutScheduler); sskInsertStarter.start(); uskManager = new USKManager(this); // And finally, Initialize the plugin manager pluginManager = new PluginManager(this); }
8026 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/8026/abec2415122554ac43604ade3bfe3c5a42b56bdf/Node.java/buggy/src/freenet/node/Node.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 2029, 12, 809, 642, 16, 8072, 1830, 2744, 13, 1216, 2029, 2570, 503, 288, 377, 202, 377, 202, 759, 29442, 10769, 377, 202, 1313, 6426, 387, 273, 394, 8005, 9584, 382, 550, 387, 56...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 2029, 12, 809, 642, 16, 8072, 1830, 2744, 13, 1216, 2029, 2570, 503, 288, 377, 202, 377, 202, 759, 29442, 10769, 377, 202, 1313, 6426, 387, 273, 394, 8005, 9584, 382, 550, 387, 56...
if (actionList == null) { return null; } else { List retList = new ArrayList(); Iterator iter = actionList.iterator(); while (iter.hasNext()) { retList.add(iter.next()); } return retList; } }
if (actionList == null || actionList.isEmpty()) { return Collections.emptyList(); } else { return new ArrayList(actionList); } }
public List getActionList() { // Make defensive copy if (actionList == null) { return null; } else { List retList = new ArrayList(); Iterator iter = actionList.iterator(); while (iter.hasNext()) { retList.add(iter.next()); } return retList; } }
4176 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/4176/fe5f20fa44d68ce7951814937ffb71bd01982fb2/Association.java/buggy/src/jdic/src/share/classes/org/jdesktop/jdic/filetypes/Association.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 987, 12473, 682, 1435, 288, 3639, 368, 4344, 1652, 14315, 1610, 3639, 309, 261, 1128, 682, 422, 446, 13, 288, 5411, 327, 446, 31, 3639, 289, 469, 288, 5411, 987, 325, 682, 273, 39...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 987, 12473, 682, 1435, 288, 3639, 368, 4344, 1652, 14315, 1610, 3639, 309, 261, 1128, 682, 422, 446, 13, 288, 5411, 327, 446, 31, 3639, 289, 469, 288, 5411, 987, 325, 682, 273, 39...
int nodeId, String resource, String attribute);
String resourceParent, String resource, String attribute);
public String getRelativePathForAttribute(String resourceType, int nodeId, String resource, String attribute);
48885 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/48885/54a096d0955c91ed7c9011de68ec960fd6cfde1c/GraphModel.java/buggy/opennms-webapp/src/main/java/org/opennms/web/graph/GraphModel.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 514, 26986, 1290, 1499, 12, 780, 14110, 16, 5411, 509, 11507, 16, 514, 1058, 16, 514, 1566, 1769, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 514, 26986, 1290, 1499, 12, 780, 14110, 16, 5411, 509, 11507, 16, 514, 1058, 16, 514, 1566, 1769, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -1...
Item current = getItem(x, y); if (current != null) { Item next = getNextItem(current, true); showItem(next == null ? current : next); return next; } return null; }
Item current = getItem(x, y); if (current != null) { Item next = getNextItem(current, true); showItem(next == null ? current : next); return next; } return null; }
public Item scrollDown(int x, int y) { Item current = getItem(x, y); if (current != null) { Item next = getNextItem(current, true); showItem(next == null ? current : next); return next; } return null; }
58148 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58148/7dea322b00f8363f209617dc36ba0b47497db00d/AbstractTreeViewer.java/buggy/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 4342, 5532, 4164, 12, 474, 619, 16, 509, 677, 13, 288, 3639, 4342, 783, 273, 8143, 12, 92, 16, 677, 1769, 3639, 309, 261, 2972, 480, 446, 13, 288, 5411, 4342, 1024, 273, 6927, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 4342, 5532, 4164, 12, 474, 619, 16, 509, 677, 13, 288, 3639, 4342, 783, 273, 8143, 12, 92, 16, 677, 1769, 3639, 309, 261, 2972, 480, 446, 13, 288, 5411, 4342, 1024, 273, 6927, 1...
rotation = computeRotation((double[])null, 0,
rotation = computeRotation(null, 0,
protected ProxyGraphicsNode buildStartMarkerProxy() { ExtendedPathIterator iter = getExtShape().getExtendedPathIterator(); // Get initial point on the path double coords[] = new double[7]; int segType = 0; if (iter.isDone()) { return null; } segType = iter.currentSegment(coords); if (segType != iter.SEG_MOVETO) { return null; } iter.next(); Point2D markerPosition = new Point2D.Double(coords[0], coords[1]); // If the marker's orient property is NaN, // the slope needs to be computed double rotation = startMarker.getOrient(); if (Double.isNaN(rotation)) { if (!iter.isDone()) { double next[] = new double[7]; int nextSegType = 0; nextSegType = iter.currentSegment(next); if(nextSegType == PathIterator.SEG_CLOSE){ nextSegType = PathIterator.SEG_LINETO; next[0] = coords[0]; next[1] = coords[1]; } rotation = computeRotation((double[])null, 0, // no previous seg. coords, segType, // segment ending on start point next, nextSegType); // segment out of start point } } // Now, compute the marker's proxy transform AffineTransform markerTxf = computeMarkerTransform(startMarker, markerPosition, rotation); ProxyGraphicsNode gn = new ProxyGraphicsNode(); gn.setSource(startMarker.getMarkerNode()); gn.setTransform(markerTxf); return gn; }
45946 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/45946/37794489f7dedd0c74c1b7ae67e92cf8d877b256/MarkerShapePainter.java/buggy/sources/org/apache/batik/gvt/MarkerShapePainter.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 4750, 7659, 17558, 907, 1361, 1685, 7078, 3886, 1435, 288, 3639, 14094, 743, 3198, 1400, 273, 336, 2482, 8500, 7675, 588, 11456, 743, 3198, 5621, 3639, 368, 968, 2172, 1634, 603, 326, 589, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 4750, 7659, 17558, 907, 1361, 1685, 7078, 3886, 1435, 288, 3639, 14094, 743, 3198, 1400, 273, 336, 2482, 8500, 7675, 588, 11456, 743, 3198, 5621, 3639, 368, 968, 2172, 1634, 603, 326, 589, ...
mUsername = user; mPassword = pass; if (pass == null) mPassword = sDEFAULTPASSWORD; mUrl = soapUrl;
mUsername = user; mPassword = pass; if (pass == null) mPassword = sDEFAULTPASSWORD; mUrl = soapUrl;
public WikiSoapUtil(String soapUrl, String user, String pass) throws ServiceException { mUsername = user; mPassword = pass; if (pass == null) mPassword = sDEFAULTPASSWORD; mUrl = soapUrl; if (mUrl == null) { Server s = Provisioning.getInstance().getLocalServer(); mUrl = URLUtil.getMailURL(s, ZimbraServlet.USER_SERVICE_URI, false); mUploadUrl = URLUtil.getMailURL(s, "/service/upload", false); } else { int end = mUrl.length() - 1; if (mUrl.charAt(end) == '/') end--; int index = mUrl.lastIndexOf('/', end); mUploadUrl = mUrl.substring(0, index) + "/upload"; } }
6965 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/6965/035f0987be458b8c5fa4dc337f8c8c1665722ba5/WikiUtil.java/buggy/ZimbraServer/src/java/com/zimbra/cs/wiki/WikiUtil.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 3196, 202, 482, 28268, 20601, 1304, 12, 780, 9930, 1489, 16, 514, 729, 16, 514, 1342, 13, 1216, 16489, 288, 1082, 202, 81, 8575, 273, 729, 31, 1082, 202, 81, 3913, 273, 1342, 31, 1082, 202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 3196, 202, 482, 28268, 20601, 1304, 12, 780, 9930, 1489, 16, 514, 729, 16, 514, 1342, 13, 1216, 16489, 288, 1082, 202, 81, 8575, 273, 729, 31, 1082, 202, 81, 3913, 273, 1342, 31, 1082, 202, ...
} else {
} else if(prev != null && i.compareTo(prev) < 0) {
public synchronized void update(UpdatableSortedLinkedListItem i) { Logger.minor(this, "Update("+i+") on "+this); if(i.compareTo(list.tail()) == 0) return; if(i.compareTo(list.tail()) > 0) { list.remove(i); list.push(i); return; } if(i.compareTo(list.head()) < 0) { list.remove(i); list.unshift(i); return; } if(list.head() == list.tail()) { Logger.error(this, "Only 1 element: "+list.head()+" and updating "+i+" on "+this, new Exception("error")); add(i); return; } // Forwards or backwards? UpdatableSortedLinkedListItem next = (UpdatableSortedLinkedListItem) list.next(i); UpdatableSortedLinkedListItem prev = (UpdatableSortedLinkedListItem) list.prev(i); if(next == null || prev == null) { Logger.error(this, "next="+next+" prev="+prev+" for update("+i+") on "+this, new Exception("error")); return; } if(next.compareTo(i) > 0 && prev.compareTo(i) < 0) return; // already exactly where it should be if(next != null && i.compareTo(next) > 0) { // i > next while(true) { prev = next; next = (UpdatableSortedLinkedListItem) list.next(next); if(next == null) { throw new NullPointerException("impossible - we checked"); } if(i.compareTo(next) < 0 && i.compareTo(prev) > 0) { list.remove(i); list.insertNext(prev, i); return; } } } else { // i < next while(true) { next = prev; prev = (UpdatableSortedLinkedListItem) list.prev(prev); if(next == null) { throw new NullPointerException("impossible - we checked"); } if(i.compareTo(next) < 0 && i.compareTo(prev) > 0) { list.remove(i); list.insertNext(prev, i); return; } } } }
8026 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/8026/8707969864a8fc5c76b305d6a9b5438889fcb044/UpdatableSortedLinkedList.java/clean/src/freenet/support/UpdatableSortedLinkedList.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 3852, 918, 1089, 12, 1211, 3404, 429, 11739, 13174, 13575, 277, 13, 288, 3639, 4242, 18, 17364, 12, 2211, 16, 315, 1891, 2932, 15, 77, 15, 7923, 603, 13773, 2211, 1769, 3639, 309, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 3852, 918, 1089, 12, 1211, 3404, 429, 11739, 13174, 13575, 277, 13, 288, 3639, 4242, 18, 17364, 12, 2211, 16, 315, 1891, 2932, 15, 77, 15, 7923, 603, 13773, 2211, 1769, 3639, 309, ...
{ }
{ this(SwingConstants.TOP, WRAP_TAB_LAYOUT); }
public JTabbedPane() { }
25352 /local/tlutelli/issta_data/temp/all_java2context/java/2006_temp/2006/25352/14511e3ad21013e92c6399b2bd2ec09a8263e33a/JTabbedPane.java/clean/libjava/javax/swing/JTabbedPane.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 804, 5661, 2992, 8485, 1435, 565, 288, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 804, 5661, 2992, 8485, 1435, 565, 288, 565, 289, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,...
case ROIAgt.RESIZING:
case ROIAgt.RESIZING:
public void mouseReleased(MouseEvent e) { dragging = false; moving = false; switch (state) { case ROIAgt.CONSTRUCTING: if (!pressed) saveROI(); break; case ROIAgt.MOVING: case ROIAgt.RESIZING: if (currentShape != null) saveShape(); } pressed = false; }
55464 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/55464/136981255a811ff12b29c8657594b0388f36e74b/DrawingCanvasMng.java/clean/SRC/org/openmicroscopy/shoola/agents/roi/canvas/DrawingCanvasMng.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 7644, 26363, 12, 9186, 1133, 425, 13, 565, 288, 3639, 25434, 273, 629, 31, 3639, 12499, 273, 629, 31, 3639, 1620, 261, 2019, 13, 288, 5411, 648, 6525, 45, 2577, 88, 18, 26935...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 7644, 26363, 12, 9186, 1133, 425, 13, 565, 288, 3639, 25434, 273, 629, 31, 3639, 12499, 273, 629, 31, 3639, 1620, 261, 2019, 13, 288, 5411, 648, 6525, 45, 2577, 88, 18, 26935...
IRCHandler.addIRCHandler("JOIN", NickHandler.class);
IRCHandler.addIRCHandler("JOIN", JoinHandler.class);
public static void install() throws SecurityException, NoSuchMethodException { IRCHandler.addIRCHandler("JOIN", NickHandler.class); }
12111 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/12111/d98553878223402af99e19f2ab1337fe0c0808a3/JoinHandler.java/clean/disinfobot/org/wikimedia/infobot/irchandlers/JoinHandler.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 760, 918, 3799, 1435, 1216, 17780, 16, 15959, 288, 202, 202, 30240, 1503, 18, 1289, 30240, 1503, 2932, 18800, 3113, 423, 1200, 1503, 18, 1106, 1769, 202, 97, 2, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 760, 918, 3799, 1435, 1216, 17780, 16, 15959, 288, 202, 202, 30240, 1503, 18, 1289, 30240, 1503, 2932, 18800, 3113, 423, 1200, 1503, 18, 1106, 1769, 202, 97, 2, -100, -100, -100...
artifact.getArtifactId() + ": updating metadata due to status of '" + status + "'" );
projectArtifact.getArtifactId() + ": updating metadata due to status of '" + status + "'" );
private Model findModelFromRepository( Artifact artifact, List remoteArtifactRepositories, ArtifactRepository localRepository ) throws ProjectBuildingException { MavenProject project = getCachedProject( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() ); Model model; if ( project == null ) { // TODO: can't assume artifact is a POM try { artifactResolver.resolve( artifact, remoteArtifactRepositories, localRepository ); File file = artifact.getFile(); model = readModel( file ); String downloadUrl = null; ArtifactStatus status = ArtifactStatus.NONE; DistributionManagement distributionManagement = model.getDistributionManagement(); if ( distributionManagement != null ) { downloadUrl = distributionManagement.getDownloadUrl(); status = ArtifactStatus.valueOf( distributionManagement.getStatus() ); } // TODO: configurable actions dependant on status if ( !artifact.isSnapshot() && status.compareTo( ArtifactStatus.DEPLOYED ) < 0 ) { // use default policy (enabled, daily update, warn on bad checksum) ArtifactRepositoryPolicy policy = new ArtifactRepositoryPolicy(); // TODO: re-enable [MNG-798/865] policy.setUpdatePolicy( ArtifactRepositoryPolicy.UPDATE_POLICY_NEVER ); if ( policy.checkOutOfDate( new Date( file.lastModified() ) ) ) { getLogger().info( artifact.getArtifactId() + ": updating metadata due to status of '" + status + "'" ); try { artifact.setResolved( false ); artifactResolver.resolveAlways( artifact, remoteArtifactRepositories, localRepository ); } catch ( ArtifactResolutionException e ) { getLogger().warn( "Error updating POM - using existing version" ); getLogger().debug( "Cause", e ); } } } // TODO: this is gross. Would like to give it the whole model, but maven-artifact shouldn't depend on that // Can a maven-core implementation of the Artifact interface store it, and be used in the exceptions? if ( downloadUrl != null ) { artifact.setDownloadUrl( downloadUrl ); } else { artifact.setDownloadUrl( model.getUrl() ); } } catch ( ArtifactResolutionException e ) { // TODO: a not found would be better vs other errors // only not found should have the below behaviour// throw new ProjectBuildingException( "Unable to find the POM in the repository", e ); getLogger().warn( "\n ***** Using defaults for missing POM " + artifact.getId() + " *****\n" ); model = new Model(); model.setModelVersion( "4.0.0" ); model.setArtifactId( artifact.getArtifactId() ); model.setGroupId( artifact.getGroupId() ); model.setVersion( artifact.getVersion() ); // TODO: not correct in some instances model.setPackaging( artifact.getType() ); model.setDistributionManagement( new DistributionManagement() ); model.getDistributionManagement().setStatus( ArtifactStatus.GENERATED.toString() );/* TODO: we should only do this if we can verify the existence of the JAR itself File file = artifact.getFile(); file.getParentFile().mkdirs(); FileWriter writer = null; try { writer = new FileWriter( file ); MavenXpp3Writer w = new MavenXpp3Writer(); w.write( writer, model ); } catch ( IOException ioe ) { getLogger().warn( "Attempted to write out a temporary generated POM, but failed", ioe ); } finally { IOUtil.close( writer ); }*/ } } else { model = project.getModel(); } return model; }
1315 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1315/22adefde141571f142f6026eed66ad5ea99c8f5c/DefaultMavenProjectBuilder.java/buggy/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 3164, 1104, 1488, 1265, 3305, 12, 14022, 6462, 16, 987, 2632, 7581, 18429, 16, 4766, 6647, 14022, 3305, 1191, 3305, 262, 3639, 1216, 5420, 16713, 503, 565, 288, 3639, 17176, 4109, 198...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 3164, 1104, 1488, 1265, 3305, 12, 14022, 6462, 16, 987, 2632, 7581, 18429, 16, 4766, 6647, 14022, 3305, 1191, 3305, 262, 3639, 1216, 5420, 16713, 503, 565, 288, 3639, 17176, 4109, 198...
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
55636 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/55636/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/clean/components/server/src/ome/security/BasicSecuritySystem.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 12589, 3790, 1435, 565, 288, 202, 202, 2042, 4446, 1191, 4446, 273, 261, 2042, 4446, 13, 9033, 18, 588, 4446, 1179, 5621, 202, 202, 1285, 989, 277, 2016, 273, 9033, 18, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 12589, 3790, 1435, 565, 288, 202, 202, 2042, 4446, 1191, 4446, 273, 261, 2042, 4446, 13, 9033, 18, 588, 4446, 1179, 5621, 202, 202, 1285, 989, 277, 2016, 273, 9033, 18, 5...
if (limit != -1 && resultList.size() >= limit) { return resultList; }
if (limit != -1 && resultList.size() >= limit) { return resultList; }
private List findMarkers(IResource[] resources, int depth, int limit, IProgressMonitor mon, boolean ignoreExceptions) throws CoreException { if (resources == null) { return Collections.EMPTY_LIST; } List resultList = new ArrayList(resources.length * 2); // Optimization: if a type appears in the selectedTypes list along with all of its // subtypes, then combine these in a single search. // List of types that haven't been replaced by one of their supertypes HashSet typesToSearch = new HashSet(selectedTypes.size()); // List of types that appeared in selectedTypes along with all of their subtypes HashSet includeAllSubtypes = new HashSet(selectedTypes.size()); typesToSearch.addAll(selectedTypes); Iterator iter = selectedTypes.iterator(); while (iter.hasNext()) { MarkerType type = (MarkerType) iter.next(); Collection subtypes = Arrays.asList(type.getAllSubTypes()); if (selectedTypes.containsAll(subtypes)) { typesToSearch.removeAll(subtypes); includeAllSubtypes.add(type); } } mon .beginTask( Messages.getString("MarkerFilter.searching"), typesToSearch.size() * resources.length); //$NON-NLS-1$ // Use this hash set to determine if there are any resources in the // list that appear along with their parent. HashSet resourcesToSearch = new HashSet(); // Insert all the resources into the hashset for (int idx = 0; idx < resources.length; idx++) { IResource next = resources[idx]; if (!next.exists()) { continue; } if (resourcesToSearch.contains(next)) { mon.worked(typesToSearch.size()); } else { resourcesToSearch.add(next); } } // Iterate through all the selected resources for (int resourceIdx = 0; resourceIdx < resources.length; resourceIdx++) { iter = typesToSearch.iterator(); IResource resource = resources[resourceIdx]; // Skip resources that don't exist if (!resource.isAccessible()) { continue; } if (depth == IResource.DEPTH_INFINITE) { // Determine if any parent of this resource is also in our filter IResource parent = resource.getParent(); boolean found = false; while (parent != null) { if (resourcesToSearch.contains(parent)) { found = true; } parent = parent.getParent(); } // If a parent of this resource is also in the filter, we can skip it // because we'll pick up its markers when we search the parent. if (found) { continue; } } // Iterate through all the marker types while (iter.hasNext()) { MarkerType markerType = (MarkerType) iter.next(); // Only search for subtypes of the marker if we found all of its // subtypes in the filter criteria. IMarker[] markers = resource.findMarkers(markerType.getId(), includeAllSubtypes.contains(markerType), depth); mon.worked(1); for (int idx = 0; idx < markers.length; idx++) { ConcreteMarker marker; try { marker = MarkerList.createMarker(markers[idx]); } catch (CoreException e) { if (ignoreExceptions) { continue; } else { throw e; } } if (limit != -1 && resultList.size() >= limit) { return resultList; } if (selectMarker(marker)) { resultList.add(marker); } } } } mon.done(); return resultList; }
56152 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/56152/1ceb585b9b16047c6c580984b0c9962c41a22ba6/MarkerFilter.java/buggy/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/internal/MarkerFilter.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 987, 1104, 21644, 12, 45, 1420, 8526, 2703, 16, 509, 3598, 16, 509, 1800, 16, 5411, 467, 5491, 7187, 6921, 16, 1250, 2305, 11416, 13, 5411, 1216, 30015, 288, 3639, 309, 261, 4683, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 987, 1104, 21644, 12, 45, 1420, 8526, 2703, 16, 509, 3598, 16, 509, 1800, 16, 5411, 467, 5491, 7187, 6921, 16, 1250, 2305, 11416, 13, 5411, 1216, 30015, 288, 3639, 309, 261, 4683, ...
GrouperLog.debug(LOG, s, msg);
protected void canCREATE(GrouperSession s, Stem ns, Subject subj) throws InsufficientPrivilegeException { boolean can = false; Privilege priv = NamingPrivilege.CREATE; String msg = "canCREATE: "; if (PrivilegeResolver.getInstance().hasPriv(s, ns, subj, priv)) { msg += "CREATE"; can = true; } if (can == false) { throw new InsufficientPrivilegeException( s.getSubject().getId() + " does not have " + priv + " on '" + ns.getName() + "'" ); } GrouperLog.debug(LOG, s, msg); } // protected void canCREATE(s, ns, subj)
5235 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5235/11170f2a782492e4c1e43aa1adabfc484a62c9f3/PrivilegeResolver.java/clean/grouper/src/grouper/edu/internet2/middleware/grouper/PrivilegeResolver.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 4750, 918, 848, 9344, 12, 1114, 264, 2157, 272, 16, 348, 874, 3153, 16, 9912, 15333, 13, 565, 1216, 225, 22085, 11339, 24308, 503, 225, 288, 565, 1250, 282, 848, 282, 273, 629, 31, 565,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 4750, 918, 848, 9344, 12, 1114, 264, 2157, 272, 16, 348, 874, 3153, 16, 9912, 15333, 13, 565, 1216, 225, 22085, 11339, 24308, 503, 225, 288, 565, 1250, 282, 848, 282, 273, 629, 31, 565,...
super( ValueType.FLOAT_TYPE,
super( ValueType.PFLOAT_TYPE,
private FloatLessEvaluator() { super( ValueType.FLOAT_TYPE, Operator.LESS ); }
6736 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/6736/c2b43d4f7850c45869b2d8334e4abf2cb52ca708/FloatFactory.java/buggy/drools-core/src/main/java/org/drools/base/evaluators/FloatFactory.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 540, 3238, 5450, 15313, 15876, 1435, 288, 5411, 2240, 12, 31718, 18, 52, 15640, 67, 2399, 16, 10402, 11097, 18, 26005, 11272, 3639, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 540, 3238, 5450, 15313, 15876, 1435, 288, 5411, 2240, 12, 31718, 18, 52, 15640, 67, 2399, 16, 10402, 11097, 18, 26005, 11272, 3639, 289, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, ...
public static Message createTestRequest(Key Key, long id, int htl) {
public static final Message createTestRequest(Key Key, long id, int htl) {
public static Message createTestRequest(Key Key, long id, int htl) { Message msg = new Message(testRequest); msg.set(UID, id); msg.set(FREENET_ROUTING_KEY, Key); msg.set(HTL, htl); return msg; }
51738 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51738/d69dceaa72feee5ece14b8de951841aa9b614188/DMT.java/clean/src/freenet/io/comm/DMT.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 760, 727, 2350, 752, 4709, 691, 12, 653, 1929, 16, 1525, 612, 16, 509, 366, 6172, 13, 288, 3639, 2350, 1234, 273, 394, 2350, 12, 3813, 691, 1769, 3639, 1234, 18, 542, 12, 3060, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 760, 727, 2350, 752, 4709, 691, 12, 653, 1929, 16, 1525, 612, 16, 509, 366, 6172, 13, 288, 3639, 2350, 1234, 273, 394, 2350, 12, 3813, 691, 1769, 3639, 1234, 18, 542, 12, 3060, ...
if (!isRosterItem(jid) && !getUsername().equals(jid.getNode())) {
if (!isRosterItem(jid) && !userJID.equals(jid)) {
private Map<JID,List<Group>> getSharedUsers(Collection<Group> sharedGroups) { // Get the users to process from the shared groups. Users that belong to different groups // will have one entry in the map associated with all the groups Map<JID,List<Group>> sharedGroupUsers = new HashMap<JID,List<Group>>(); for (Group group : sharedGroups) { // Get all the users that should be in this roster Collection<JID> users = rosterManager.getSharedUsersForRoster(group, this); // Add the users of the group to the general list of users to process for (JID jid : users) { // Add the user to the answer if the user doesn't belong to the personal roster // (since we have already added the user to the answer) if (!isRosterItem(jid) && !getUsername().equals(jid.getNode())) { List<Group> groups = sharedGroupUsers.get(jid); if (groups == null) { groups = new ArrayList<Group>(); sharedGroupUsers.put(jid, groups); } groups.add(group); } } } return sharedGroupUsers; }
51636 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51636/1613deb8c2fcf8f8f868ba23c76076228a2f7605/Roster.java/buggy/src/java/org/jivesoftware/wildfire/roster/Roster.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 1635, 32, 46, 734, 16, 682, 32, 1114, 9778, 23427, 6588, 12, 2532, 32, 1114, 34, 5116, 3621, 13, 288, 3639, 368, 968, 326, 3677, 358, 1207, 628, 326, 5116, 3252, 18, 12109, 716, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 1635, 32, 46, 734, 16, 682, 32, 1114, 9778, 23427, 6588, 12, 2532, 32, 1114, 34, 5116, 3621, 13, 288, 3639, 368, 968, 326, 3677, 358, 1207, 628, 326, 5116, 3252, 18, 12109, 716, ...
encoded = true;
void encode() { try { splitfileAlgo.encode(dataBlocks, checkBlocks, CHKBlock.DATA_LENGTH, blockInsertContext.persistentBucketFactory); // Start the inserts for(int i=0;i<checkBlockInserters.length;i++) { if(checkBlocks[i] != null) { // else already finished on creation checkBlockInserters[i] = new SingleBlockInserter(parent.parent, checkBlocks[i], (short)-1, FreenetURI.EMPTY_CHK_URI, blockInsertContext, this, false, CHKBlock.DATA_LENGTH, i + dataBlocks.length, getCHKOnly, false, false, parent.token); checkBlockInserters[i].schedule(); } else { parent.parent.completedBlock(true); } } // Tell parent only after have started the inserts. // Because of the counting. encoded = true; parent.encodedSegment(this); onEncodedSegment(); } catch (IOException e) { InserterException ex = new InserterException(InserterException.BUCKET_ERROR, e, null); finish(ex); } catch (Throwable t) { Logger.error(this, "Caught "+t+" while encoding "+this, t); InserterException ex = new InserterException(InserterException.INTERNAL_ERROR, t, null); finish(ex); } }
50619 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50619/e6accf6fde724c33588e68c749fd47456ab50691/SplitFileInserterSegment.java/buggy/src/freenet/client/async/SplitFileInserterSegment.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 6459, 2017, 1435, 288, 202, 202, 698, 288, 1082, 202, 4939, 768, 22430, 18, 3015, 12, 892, 6450, 16, 866, 6450, 16, 6469, 47, 1768, 18, 4883, 67, 7096, 16, 1203, 4600, 1042, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 6459, 2017, 1435, 288, 202, 202, 698, 288, 1082, 202, 4939, 768, 22430, 18, 3015, 12, 892, 6450, 16, 866, 6450, 16, 6469, 47, 1768, 18, 4883, 67, 7096, 16, 1203, 4600, 1042, 18, ...
public FontRenderContext (AffineTransform tx, boolean isAntiAliased, boolean usesFractionalMetrics)
protected FontRenderContext()
public FontRenderContext (AffineTransform tx, boolean isAntiAliased, boolean usesFractionalMetrics) { if (tx != null && !tx.isIdentity ()) { this.affineTransform = new AffineTransform (tx); } this.isAntiAliased = isAntiAliased; this.usesFractionalMetrics = usesFractionalMetrics; }
1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/ac47f92e4c558fe929f5cc64f85d3154701fcd9c/FontRenderContext.java/buggy/core/src/classpath/java/java/awt/font/FontRenderContext.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 10063, 3420, 1042, 261, 13785, 558, 4059, 2229, 16, 1250, 353, 14925, 77, 37, 29809, 16, 18701, 1250, 4692, 13724, 287, 5653, 13, 225, 288, 565, 309, 261, 978, 480, 446, 3639, 597, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 10063, 3420, 1042, 261, 13785, 558, 4059, 2229, 16, 1250, 353, 14925, 77, 37, 29809, 16, 18701, 1250, 4692, 13724, 287, 5653, 13, 225, 288, 565, 309, 261, 978, 480, 446, 3639, 597, ...
ph.getLexState() == LexState.EXPR_ARG || ph.getLexState() == LexState.EXPR_CMDARG) { if (cmd_state) { ph.setLexState(LexState.EXPR_CMDARG); } else {
ph.getLexState() == LexState.EXPR_ARG) {
private int yylex() { int c; boolean space_seen = false; boolean cmd_state; kwtable kw; cmd_state = ph.isCommandStart(); ph.setCommandStart(false); retry : for (; ; ) { switch (c = nextc()) { case '\0': // NUL case '\004': // ^D case '\032': // ^Z case -1: //end of script. return 0; // white spaces case ' ': case '\t': case '\f': case '\r': case '\013': // '\v' space_seen = true; continue retry; case '#': // it's a comment while ((c = nextc()) != '\n') { if (c == -1) { return 0; } } // fall through case '\n': switch (ph.getLexState()) { case LexState.EXPR_BEG: case LexState.EXPR_FNAME: case LexState.EXPR_DOT: continue retry; default: break; } ph.setCommandStart(true); ph.setLexState(LexState.EXPR_BEG); return '\n'; case '*': if ((c = nextc()) == '*') { ph.setLexState(LexState.EXPR_BEG); if (nextc() == '=') { yyVal = ph.newId(Token.tPOW); return Token.tOP_ASGN; } pushback(c); return Token.tPOW; } if (c == '=') { yyVal = ph.newId('*'); ph.setLexState(LexState.EXPR_BEG); return Token.tOP_ASGN; } pushback(c); if (IS_ARG() && space_seen && !ISSPACE(c)) { ph.rb_warning("`*' interpreted as argument prefix"); c = Token.tSTAR; } else if (ph.getLexState() == LexState.EXPR_BEG || ph.getLexState() == LexState.EXPR_MID) { c = Token.tSTAR; } else { c = '*'; } ph.setLexState(LexState.EXPR_BEG); return c; case '!': ph.setLexState(LexState.EXPR_BEG); if ((c = nextc()) == '=') { return Token.tNEQ; } if (c == '~') { return Token.tNMATCH; } pushback(c); return '!'; case '=': if (lex_p == 1) { // skip embedded rd document if (lex_curline.startsWith("=begin") && (lex_pend == 6 || ISSPACE(lex_curline.charAt(6)))) { for (; ; ) { lex_p = lex_pend; c = nextc(); if (c == -1) { ph.rb_compile_error("embedded document meets end of file"); return 0; } if (c != '=') { continue; } if (lex_curline.substring(lex_p, lex_p + 3).equals("end") && (lex_p + 3 == lex_pend || ISSPACE(lex_curline.charAt(lex_p + 3)))) { break; } } lex_p = lex_pend; continue retry; } } ph.setLexState(LexState.EXPR_BEG); if ((c = nextc()) == '=') { if ((c = nextc()) == '=') { return Token.tEQQ; } pushback(c); return Token.tEQ; } if (c == '~') { return Token.tMATCH; } else if (c == '>') { return Token.tASSOC; } pushback(c); return '='; case '<': c = nextc(); if (c == '<' && ph.getLexState() != LexState.EXPR_END && ph.getLexState() != LexState.EXPR_ENDARG && ph.getLexState() != LexState.EXPR_CLASS && (!IS_ARG() || space_seen)) { int c2 = nextc(); int indent = 0; if (c2 == '-') { indent = 1; c2 = nextc(); } if (!ISSPACE(c2) && ("\"'`".indexOf(c2) != -1 || is_identchar(c2))) { return here_document(c2, indent); } pushback(c2); } ph.setLexState(LexState.EXPR_BEG); if (c == '=') { if ((c = nextc()) == '>') { return Token.tCMP; } pushback(c); return Token.tLEQ; } if (c == '<') { if (nextc() == '=') { yyVal = ph.newId(Token.tLSHFT); return Token.tOP_ASGN; } pushback(c); return Token.tLSHFT; } pushback(c); return '<'; case '>': ph.setLexState(LexState.EXPR_BEG); if ((c = nextc()) == '=') { return Token.tGEQ; } if (c == '>') { if ((c = nextc()) == '=') { yyVal = ph.newId(Token.tRSHFT); return Token.tOP_ASGN; } pushback(c); return Token.tRSHFT; } pushback(c); return '>'; case '"': return parse_string(c, c, c); case '`': if (ph.getLexState() == LexState.EXPR_FNAME) { return c; } if (ph.getLexState() == LexState.EXPR_DOT) { return c; } return parse_string(c, c, c); case '\'': return parse_qstring(c, 0); case '?': if (ph.getLexState() == LexState.EXPR_END || ph.getLexState() == LexState.EXPR_ENDARG) { ph.setLexState(LexState.EXPR_BEG); return '?'; } c = nextc(); if (c == -1) { /* FIX 1.6.5 */ ph.rb_compile_error("incomplete character syntax"); return 0; } if (IS_ARG() && ISSPACE(c)) { pushback(c); ph.setLexState(LexState.EXPR_BEG); return '?'; } if (c == '\\') { c = read_escape(); } c &= 0xff; yyVal = RubyFixnum.m_newFixnum(ruby, c); ph.setLexState(LexState.EXPR_END); return Token.tINTEGER; case '&': if ((c = nextc()) == '&') { ph.setLexState(LexState.EXPR_BEG); if ((c = nextc()) == '=') { yyVal = ph.newId(Token.tANDOP); return Token.tOP_ASGN; } pushback(c); return Token.tANDOP; } else if (c == '=') { yyVal = ph.newId('&'); ph.setLexState(LexState.EXPR_BEG); return Token.tOP_ASGN; } pushback(c); if (IS_ARG() && space_seen && !ISSPACE(c)) { ph.rb_warning("`&' interpeted as argument prefix"); c = Token.tAMPER; } else if (ph.getLexState() == LexState.EXPR_BEG || ph.getLexState() == LexState.EXPR_MID) { c = Token.tAMPER; } else { c = '&'; } ph.setLexState(LexState.EXPR_BEG); return c; case '|': ph.setLexState(LexState.EXPR_BEG); if ((c = nextc()) == '|') { if ((c = nextc()) == '=') { yyVal = ph.newId(Token.tOROP); return Token.tOP_ASGN; } pushback(c); return Token.tOROP; } else if (c == '=') { yyVal = ph.newId('|'); return Token.tOP_ASGN; } pushback(c); return '|'; case '+': c = nextc(); if (ph.getLexState() == LexState.EXPR_FNAME || ph.getLexState() == LexState.EXPR_DOT) { if (c == '@') { return Token.tUPLUS; } pushback(c); return '+'; } if (c == '=') { ph.setLexState(LexState.EXPR_BEG); yyVal = ph.newId('+'); return Token.tOP_ASGN; } if (ph.getLexState() == LexState.EXPR_BEG || ph.getLexState() == LexState.EXPR_MID || (IS_ARG() && space_seen && !ISSPACE(c))) { if (IS_ARG()) { arg_ambiguous(); } ph.setLexState(LexState.EXPR_BEG); pushback(c); if (Character.isDigit((char) c)) { c = '+'; return start_num(c); } return Token.tUPLUS; } ph.setLexState(LexState.EXPR_BEG); pushback(c); return '+'; case '-': c = nextc(); if (ph.getLexState() == LexState.EXPR_FNAME || ph.getLexState() == LexState.EXPR_DOT) { if (c == '@') { return Token.tUMINUS; } pushback(c); return '-'; } if (c == '=') { ph.setLexState(LexState.EXPR_BEG); yyVal = ph.newId('-'); return Token.tOP_ASGN; } if (ph.getLexState() == LexState.EXPR_BEG || ph.getLexState() == LexState.EXPR_MID || (IS_ARG() && space_seen && !ISSPACE(c))) { if (IS_ARG()) { arg_ambiguous(); } ph.setLexState(LexState.EXPR_BEG); pushback(c); if (Character.isDigit((char) c)) { c = '-'; return start_num(c); } return Token.tUMINUS; } ph.setLexState(LexState.EXPR_BEG); pushback(c); return '-'; case '.': ph.setLexState(LexState.EXPR_BEG); if ((c = nextc()) == '.') { if ((c = nextc()) == '.') { return Token.tDOT3; } pushback(c); return Token.tDOT2; } pushback(c); if (!Character.isDigit((char) c)) { ph.setLexState(LexState.EXPR_DOT); return '.'; } c = '.'; // fall through //start_num: case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': return start_num(c); case ']': case '}': ph.setLexState(LexState.EXPR_END); return c; case ')': if (cond_nest > 0) { cond_stack >>= 1; } ph.setLexState(LexState.EXPR_END); return c; case ':': c = nextc(); if (c == ':') { if (ph.getLexState() == LexState.EXPR_BEG || ph.getLexState() == LexState.EXPR_MID || (IS_ARG() && space_seen)) { ph.setLexState(LexState.EXPR_BEG); return Token.tCOLON3; } ph.setLexState(LexState.EXPR_DOT); return Token.tCOLON2; } pushback(c); if (ph.getLexState() == LexState.EXPR_END || ph.getLexState() == LexState.EXPR_ENDARG || ISSPACE(c)) { ph.setLexState(LexState.EXPR_BEG); return ':'; } ph.setLexState(LexState.EXPR_FNAME); return Token.tSYMBEG; case '/': if (ph.getLexState() == LexState.EXPR_BEG || ph.getLexState() == LexState.EXPR_MID) { return parse_regx('/', '/'); } if ((c = nextc()) == '=') { ph.setLexState(LexState.EXPR_BEG); yyVal = ph.newId('/'); return Token.tOP_ASGN; } pushback(c); if (IS_ARG() && space_seen) { if (!ISSPACE(c)) { arg_ambiguous(); return parse_regx('/', '/'); } } ph.setLexState(LexState.EXPR_BEG); return '/'; case '^': ph.setLexState(LexState.EXPR_BEG); if ((c = nextc()) == '=') { yyVal = ph.newId('^'); return Token.tOP_ASGN; } pushback(c); return '^'; case ',': case ';': // ph.setCommandStart(true); ph.setLexState(LexState.EXPR_BEG); return c; case '~': if (ph.getLexState() == LexState.EXPR_FNAME || ph.getLexState() == LexState.EXPR_DOT) { if ((c = nextc()) != '@') { pushback(c); } } ph.setLexState(LexState.EXPR_BEG); return '~'; case '(': if (cond_nest > 0) { cond_stack = (cond_stack << 1 ) | 0; } // ph.setCommandStart(true); if (ph.getLexState() == LexState.EXPR_BEG || ph.getLexState() == LexState.EXPR_MID) { c = Token.tLPAREN; } else if (space_seen) { if (ph.getLexState() == LexState.EXPR_CMDARG) { c = Token.tLPAREN_ARG; } else if (ph.getLexState() == LexState.EXPR_ARG) { ph.rb_warning(tok() + " (...) interpreted as method call"); c = Token.tLPAREN_ARG; } } ph.setLexState(LexState.EXPR_BEG); return c; case '[': if (ph.getLexState() == LexState.EXPR_FNAME || ph.getLexState() == LexState.EXPR_DOT) { if ((c = nextc()) == ']') { if ((c = nextc()) == '=') { return Token.tASET; } pushback(c); return Token.tAREF; } pushback(c); return '['; } else if (ph.getLexState() == LexState.EXPR_BEG || ph.getLexState() == LexState.EXPR_MID) { c = Token.tLBRACK; } else if (IS_ARG() && space_seen) { c = Token.tLBRACK; } ph.setLexState(LexState.EXPR_BEG); return c; case '{': if (!IS_ARG()) { if (space_seen && ph.getLexState() == LexState.EXPR_ENDARG) { c = Token.tLBRACE_ARG; } if (ph.getLexState() != LexState.EXPR_END && ph.getLexState() != LexState.EXPR_ENDARG) { c = Token.tLBRACE; } } ph.setLexState(LexState.EXPR_BEG); return c; case '\\': c = nextc(); if (c == '\n') { space_seen = true; continue retry; // skip \\n } pushback(c); return '\\'; case '%': quotation : for (; ; ) { if (ph.getLexState() == LexState.EXPR_BEG || ph.getLexState() == LexState.EXPR_MID) { int term; int paren; c = nextc(); if (!Character.isLetterOrDigit((char) c)) { term = c; c = 'Q'; } else { term = nextc(); } if (c == -1 || term == -1) { ph.rb_compile_error("unterminated quoted string meets end of file"); return 0; } paren = term; if (term == '(') { term = ')'; } else if (term == '[') { term = ']'; } else if (term == '{') { term = '}'; } else if (term == '<') { term = '>'; } else { paren = 0; } switch (c) { case 'Q': return parse_string('"', term, paren); case 'q': return parse_qstring(term, paren); case 'w': return parse_quotedwords(term, paren); case 'x': return parse_string('`', term, paren); case 'r': return parse_regx(term, paren); default: yyerror("unknown type of %string"); return 0; } } if ((c = nextc()) == '=') { yyVal = ph.newId('%'); return Token.tOP_ASGN; } if (IS_ARG() && space_seen && !ISSPACE(c)) { pushback(c); continue quotation; } break quotation; } ph.setLexState(LexState.EXPR_BEG); pushback(c); return '%'; case '$': ph.setLexState(LexState.EXPR_END); newtok(); c = nextc(); switch (c) { case '_': // $_: last read line string c = nextc(); if (is_identchar(c)) { tokadd('$'); tokadd('_'); break; } pushback(c); c = '_'; // fall through case '~': // $~: match-data ph.local_cnt(c); // fall through case '*': // $*: argv case '$': // $$: pid case '?': // $?: last status case '!': // $!: error string case '@': // $@: error position case '/': // $/: input record separator case '\\':// $\: output record separator case ';': // $;: field separator case ',': // $,: output field separator case '.': // $.: last read line number case '=': // $=: ignorecase case ':': // $:: load path case '<': // $<: reading filename case '>': // $>: default output handle case '\"':// $": already loaded files tokadd('$'); tokadd(c); tokfix(); yyVal = ruby.intern(tok()); return Token.tGVAR; case '-': tokadd('$'); tokadd(c); c = nextc(); tokadd(c); tokfix(); yyVal = ruby.intern(tok()); /* * xxx shouldn't check if valid option variable */ return Token.tGVAR; case '&': // $&: last match case '`': // $`: string before last match case '\'':// $': string after last match case '+': // $+: string matches last paren. yyVal = nf.newBackRef(c); return Token.tBACK_REF; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': tokadd('$'); while (Character.isDigit((char) c)) { tokadd(c); c = nextc(); } if (is_identchar(c)) { break; } pushback(c); tokfix(); yyVal = nf.newNthRef(Integer.parseInt(tok().substring(1))); return Token.tNTH_REF; default: if (!is_identchar(c)) { pushback(c); return '$'; } case '0': tokadd('$'); } break; case '@': c = nextc(); newtok(); tokadd('@'); if (c == '@') { tokadd('@'); c = nextc(); } if (Character.isDigit((char) c)) { ph.rb_compile_error("`@" + c + "' is not a valid instance variable name"); } if (!is_identchar(c)) { pushback(c); return '@'; } break; default: if (!is_identchar(c) || Character.isDigit((char) c)) { ph.rb_compile_error("Invalid char `\\" + c + "' in expression"); continue retry; } newtok(); break; } break retry; } while (is_identchar(c)) { tokadd(c); /* * if (ismbchar(c)) { * int i, len = mbclen(c)-1; * for (i = 0; i < len; i++) { * c = nextc(); * tokadd(c); * } * } */ c = nextc(); } if ((c == '!' || c == '?') && is_identchar(tok().charAt(0)) && !peek('=')) { tokadd(c); } else { pushback(c); } tokfix(); { int result = 0; switch (tok().charAt(0)) { case '$': ph.setLexState(LexState.EXPR_END); result = Token.tGVAR; break; case '@': ph.setLexState(LexState.EXPR_END); if (tok().charAt(1) == '@') { result = Token.tCVAR; } else { result = Token.tIVAR; } break; default: if (ph.getLexState() != LexState.EXPR_DOT) { // See if it is a reserved word. kw = rb_reserved_word(tok(), toklen()); if (kw != null) { // enum lex_state int state = ph.getLexState(); ph.setLexState(kw.state); if (state == LexState.EXPR_FNAME) { yyVal = ruby.intern(kw.name); } if (kw.id0 == Token.kDO) { if (COND_P()) { return Token.kDO_COND; } if (CMDARG_P() && state != LexState.EXPR_CMDARG) { return Token.kDO_BLOCK; } return Token.kDO; } if (state == LexState.EXPR_BEG) { return kw.id0; } else { if (kw.id0 != kw.id1) { ph.setLexState(LexState.EXPR_BEG); } return kw.id1; } } } if (toklast() == '!' || toklast() == '?') { result = Token.tFID; } else { if (ph.getLexState() == LexState.EXPR_FNAME) { if ((c = nextc()) == '=' && !peek('~') && !peek('>') && (!peek('=') || lex_p + 1 < lex_pend && lex_curline.charAt(lex_p + 1) == '>')) { result = Token.tIDENTIFIER; tokadd(c); } else { pushback(c); } } if (result == 0 && Character.isUpperCase(tok().charAt(0))) { result = Token.tCONSTANT; } else { result = Token.tIDENTIFIER; } } if (ph.getLexState() == LexState.EXPR_BEG || ph.getLexState() == LexState.EXPR_DOT || ph.getLexState() == LexState.EXPR_ARG || ph.getLexState() == LexState.EXPR_CMDARG) { if (cmd_state) { ph.setLexState(LexState.EXPR_CMDARG); } else { ph.setLexState(LexState.EXPR_ARG); } } else { ph.setLexState(LexState.EXPR_END); } } tokfix(); yyVal = /* last_id = */ ruby.intern(tok()); //XXX really overwrite last_id? return result; } }
49687 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/49687/75e51682c6dfb1ff67ffb81cea2dfd23c3e3a9f4/DefaultRubyParser.java/clean/org/jruby/parser/DefaultRubyParser.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 509, 677, 1362, 92, 1435, 288, 3639, 509, 276, 31, 3639, 1250, 3476, 67, 15156, 273, 629, 31, 3639, 1250, 1797, 67, 2019, 31, 3639, 5323, 2121, 5323, 31, 3639, 1797, 67, 2019, 273...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 509, 677, 1362, 92, 1435, 288, 3639, 509, 276, 31, 3639, 1250, 3476, 67, 15156, 273, 629, 31, 3639, 1250, 1797, 67, 2019, 31, 3639, 5323, 2121, 5323, 31, 3639, 1797, 67, 2019, 273...
if (printMessages) System.out.println("----testUnsavedAndUnCompiledChanges-----");
if (printMessages) System.out.println("-----testUnsavedAndUnCompiledChanges-----");
public void testUnsavedAndUnCompiledChanges() throws Exception { if (printMessages) System.out.println("----testUnsavedAndUnCompiledChanges-----"); OpenDefinitionsDocument doc = setupDocument(MONKEYTEST_PASS_TEXT); final File file = new File(_tempDir, "MonkeyTestPass.java"); doc.saveFile(new FileSelector(file)); JUnitTestListener listener = new JUnitTestListener(true); _model.addListener(listener); if (printMessages) System.out.println("before compile"); doc.startCompile(); if (printMessages) System.out.println("after compile"); changeDocumentText(MONKEYTEST_FAIL_TEXT, doc); if (printMessages) System.out.println("after document change"); _runJUnit(doc); if (printMessages) System.out.println("after test"); _model.removeListener(listener); assertEquals("test case should have no errors reported after modifying", 0, _model.getJUnitModel().getJUnitErrorModel().getNumErrors()); doc.saveFile(new FileSelector(file)); listener = new JUnitTestListener(); _model.addListener(listener); assertEquals("test case should have no errors reported after saving", 0, _model.getJUnitModel().getJUnitErrorModel().getNumErrors()); _model.removeListener(listener); }
11192 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/11192/ac147bfd47d7e558bfd3f0afa39ad091a35b6f6f/GlobalModelJUnitTest.java/clean/drjava/src/edu/rice/cs/drjava/model/GlobalModelJUnitTest.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 918, 1842, 984, 14077, 1876, 984, 20733, 7173, 1435, 1216, 1185, 288, 565, 309, 261, 1188, 5058, 13, 2332, 18, 659, 18, 8222, 2932, 13465, 3813, 984, 14077, 1876, 984, 20733, 7173, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 918, 1842, 984, 14077, 1876, 984, 20733, 7173, 1435, 1216, 1185, 288, 565, 309, 261, 1188, 5058, 13, 2332, 18, 659, 18, 8222, 2932, 13465, 3813, 984, 14077, 1876, 984, 20733, 7173, ...
reply.setTo(packet.getFrom()); reply.setFrom(packet.getTo());
reply.setTo(from); reply.setFrom(to);
private void returnErrorToSender(Packet packet) { // TODO Send correct error condition: timeout or not_found depending on the real error try { if (packet instanceof IQ) { IQ reply = new IQ(); reply.setID(((IQ) packet).getID()); reply.setTo(packet.getFrom()); reply.setFrom(packet.getTo()); reply.setChildElement(((IQ) packet).getChildElement().createCopy()); reply.setError(PacketError.Condition.remote_server_not_found); ChannelHandler route = routingTable.getRoute(reply.getTo()); if (route != null) { route.process(reply); } } else if (packet instanceof Presence) { Presence reply = new Presence(); reply.setID(packet.getID()); reply.setTo(packet.getFrom()); reply.setFrom(packet.getTo()); reply.setError(PacketError.Condition.remote_server_not_found); ChannelHandler route = routingTable.getRoute(reply.getTo()); if (route != null) { route.process(reply); } } else if (packet instanceof Message) { Message reply = new Message(); reply.setID(packet.getID()); reply.setTo(packet.getFrom()); reply.setFrom(packet.getTo()); reply.setType(((Message)packet).getType()); reply.setThread(((Message)packet).getThread()); reply.setError(PacketError.Condition.remote_server_not_found); ChannelHandler route = routingTable.getRoute(reply.getTo()); if (route != null) { route.process(reply); } } } catch (UnauthorizedException e) { } catch (Exception e) { Log.warn("Error returning error to sender. Original packet: " + packet, e); } }
6161 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/6161/cdd89c2a0fdce0cab67dbc8ff14b3d4440b2ab3b/OutgoingSessionPromise.java/clean/src/java/org/jivesoftware/wildfire/server/OutgoingSessionPromise.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 327, 668, 774, 12021, 12, 6667, 4414, 13, 288, 3639, 368, 2660, 2479, 3434, 555, 2269, 30, 2021, 578, 486, 67, 7015, 8353, 603, 326, 2863, 555, 3639, 775, 288, 5411, 309, 261...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 327, 668, 774, 12021, 12, 6667, 4414, 13, 288, 3639, 368, 2660, 2479, 3434, 555, 2269, 30, 2021, 578, 486, 67, 7015, 8353, 603, 326, 2863, 555, 3639, 775, 288, 5411, 309, 261...
FileHeader(FileWindow fileWindow) {
public FileHeader(FileWindow fileWindow) {
FileHeader(FileWindow fileWindow) { this.fileWindow = fileWindow; addMouseListener(this); update(); }
19000 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/19000/e4c74a91b5c4165a9c90cde4d7b2ddd72e81af8d/SwingGui.java/buggy/toolsrc/org/mozilla/javascript/tools/debugger/SwingGui.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 1387, 1864, 12, 812, 3829, 585, 3829, 13, 288, 3639, 333, 18, 768, 3829, 273, 585, 3829, 31, 3639, 527, 9186, 2223, 12, 2211, 1769, 3639, 1089, 5621, 565, 289, 2, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 1387, 1864, 12, 812, 3829, 585, 3829, 13, 288, 3639, 333, 18, 768, 3829, 273, 585, 3829, 31, 3639, 527, 9186, 2223, 12, 2211, 1769, 3639, 1089, 5621, 565, 289, 2, -100, -100, -100...
public void mINT() throws RecognitionException { try { ruleNestingLevel++; int _type = INT; int _start = getCharIndex(); int _line = getLine(); int _charPosition = getCharPositionInLine(); int _channel = Token.DEFAULT_CHANNEL; // D:\\workspace\\jboss\\jbossrules\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1329:4: ( ( '-' )? ( '0' .. '9' )+ ) // D:\\workspace\\jboss\\jbossrules\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1329:4: ( '-' )? ( '0' .. '9' )+ { // D:\\workspace\\jboss\\jbossrules\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1329:4: ( '-' )? int alt5=2; int LA5_0 = input.LA(1); if ( (LA5_0=='-') ) { alt5=1; } switch (alt5) { case 1 : // D:\\workspace\\jboss\\jbossrules\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1329:5: '-' { match('-'); if (failed) return ; } break; } // D:\\workspace\\jboss\\jbossrules\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1329:10: ( '0' .. '9' )+ int cnt6=0; loop6: do { int alt6=2; int LA6_0 = input.LA(1); if ( ((LA6_0>='0' && LA6_0<='9')) ) { alt6=1; } switch (alt6) { case 1 : // D:\\workspace\\jboss\\jbossrules\\drools-compiler\\src\\main\\resources\\org\\drools\\lang\\DRL.g:1329:11: '0' .. '9' { matchRange('0','9'); if (failed) return ; } break; default : if ( cnt6 >= 1 ) break loop6; if (backtracking>0) {failed=true; return ;} EarlyExitException eee = new EarlyExitException(6, input); throw eee; } cnt6++; } while (true); } if ( backtracking==0 ) { if ( token==null && ruleNestingLevel==1 ) { emit(_type,_line,_charPosition,_channel,_start,getCharIndex()-1); } } } finally { ruleNestingLevel--; } }
31577 /local/tlutelli/issta_data/temp/all_java3context/java/2006_temp/2006/31577/63bc7036e62ae854cec463d59712c173f74e984c/DRLLexer.java/clean/drools-compiler/src/main/java/org/drools/lang/DRLLexer.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 312, 3217, 1435, 1216, 9539, 288, 3639, 775, 288, 5411, 1720, 50, 10100, 2355, 9904, 31, 5411, 509, 389, 723, 273, 6137, 31, 5411, 509, 389, 1937, 273, 23577, 1016, 5621, 5411,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 312, 3217, 1435, 1216, 9539, 288, 3639, 775, 288, 5411, 1720, 50, 10100, 2355, 9904, 31, 5411, 509, 389, 723, 273, 6137, 31, 5411, 509, 389, 1937, 273, 23577, 1016, 5621, 5411,...
|| IOdaExtendableElementModel.EXTENSION_ID_PROP .equals( propName ) || IExtendedItemModel.EXTENSION_NAME_PROP.equals( propName )
public static void duplicateProperties( DesignElementHandle source, DesignElementHandle destination, boolean onlyFactoryProperty ) { assert source != null; assert destination != null; if ( !( ( source instanceof ReportDesignHandle ) && ( destination instanceof LibraryHandle ) ) ) assert destination.getDefn( ).getName( ).equalsIgnoreCase( source.getDefn( ).getName( ) ); if ( source.getDefn( ).allowsUserProperties( ) ) { PropertyHandle propHandle = source .getPropertyHandle( DesignElement.USER_PROPERTIES_PROP ); Object value = source.getElement( ).getUserProperties( ); Object valueToSet = null; if ( propHandle != null ) { valueToSet = ModelUtil.copyValue( propHandle.getDefn( ), value ); } if ( valueToSet != null ) { Iterator iter = ( (List) valueToSet ).iterator( ); while ( iter.hasNext( ) ) { UserPropertyDefn userPropDefn = (UserPropertyDefn) iter .next( ); destination.getElement( ) .addUserPropertyDefn( userPropDefn ); } } } if ( source.getElement( ) instanceof IExtendableElement ) duplicateExtensionIdentifier( source, destination ); Iterator iter = source.getPropertyIterator( ); while ( iter.hasNext( ) ) { PropertyHandle propHandle = (PropertyHandle) iter.next( ); String propName = propHandle.getDefn( ).getName( ); // Style property and extends property will be removed. // The properties inherited from style or parent will be // flatten to new element. if ( StyledElement.STYLE_PROP.equals( propName ) || DesignElement.EXTENDS_PROP.equals( propName ) || DesignElement.USER_PROPERTIES_PROP.equals( propName ) || IOdaExtendableElementModel.EXTENSION_ID_PROP .equals( propName ) || IExtendedItemModel.EXTENSION_NAME_PROP.equals( propName ) || DesignElement.REF_TEMPLATE_PARAMETER_PROP .equals( propName ) ) continue; ElementPropertyDefn propDefn = destination.getElement( ) .getPropertyDefn( propName ); if ( propDefn == null ) continue; Object value = null; // the special case for the toc, pageBreakAfter and pageBreakBefore // properties on the group element // for toc the default value is the group expression. if ( propHandle.getElement( ) instanceof GroupElement && ( GroupElement.TOC_PROP.equals( propName ) || IStyleModel.PAGE_BREAK_AFTER_PROP .equals( propName ) || IStyleModel.PAGE_BREAK_BEFORE_PROP .equals( propName ) ) ) value = propHandle.getElement( ).getLocalProperty( propHandle.getModule( ), propDefn ); else if ( onlyFactoryProperty ) value = propHandle.getElement( ).getFactoryProperty( propHandle.getModule( ), propDefn ); else if ( Module.IMAGES_PROP.equals( propName ) ) { // Copy the embedded images Iterator images = source.getPropertyHandle( Module.IMAGES_PROP ) .iterator( ); while ( images.hasNext( ) ) { StructureHandle image = (StructureHandle) images.next( ); try { ElementExportUtil.exportStructure( image, (LibraryHandle) destination, false ); } catch ( SemanticException e ) { assert false; } } continue; } else value = propHandle.getElement( ).getStrategy( ) .getPropertyExceptRomDefault( propHandle.getModule( ), propHandle.getElement( ), propDefn ); Object valueToSet = ModelUtil.copyValue( propHandle.getDefn( ), value ); destination.getElement( ).setProperty( propName, valueToSet ); } }
15160 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/15160/13807447c2b92e5c2c0d1067fa8f2de960030f4b/ModelUtil.java/buggy/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/util/ModelUtil.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 760, 918, 6751, 2297, 12, 29703, 1046, 3259, 1084, 16, 1082, 202, 15478, 1046, 3259, 2929, 16, 1250, 1338, 1733, 1396, 262, 202, 95, 202, 202, 11231, 1084, 480, 446, 31, 202, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 760, 918, 6751, 2297, 12, 29703, 1046, 3259, 1084, 16, 1082, 202, 15478, 1046, 3259, 2929, 16, 1250, 1338, 1733, 1396, 262, 202, 95, 202, 202, 11231, 1084, 480, 446, 31, 202, ...
Driver.debug("supportsSchemasInPrivilegeDefinitions false");
if (Driver.logDebug) Driver.debug("supportsSchemasInPrivilegeDefinitions false");
public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { Driver.debug("supportsSchemasInPrivilegeDefinitions false"); return false; }
45454 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/45454/b465f5307f9f5506beb1edbcc0fb56eed7c29c12/DatabaseMetaData.java/buggy/src/interfaces/jdbc/org/postgresql/jdbc2/DatabaseMetaData.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 1250, 6146, 16749, 382, 24308, 7130, 1435, 1216, 6483, 202, 95, 202, 202, 4668, 18, 4148, 2932, 28064, 16749, 382, 24308, 7130, 629, 8863, 202, 202, 2463, 629, 31, 202, 97, 2, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 1250, 6146, 16749, 382, 24308, 7130, 1435, 1216, 6483, 202, 95, 202, 202, 4668, 18, 4148, 2932, 28064, 16749, 382, 24308, 7130, 629, 8863, 202, 202, 2463, 629, 31, 202, 97, 2, ...
Base.LogThis("Stellen der Eintragsanzahl: " + max, true); Base.LogThis("Eintragsanzahl: " + result, true);
new Logger("Stellen der Eintragsanzahl: " + max, true); new Logger("Eintragsanzahl: " + result, true);
private static int parseArraySize(String source) { int error=0; try { error=Integer.parseInt(String.valueOf(source.charAt(0))); } catch (Exception e) { error=4; } if (Define.doDebug() && error > 0) { // Debug-Mode Base.LogThis("Fehlercode: " + error, true); } if (error==0) { String result=""; try{ int max = Integer.parseInt(String.valueOf(source.charAt(1))); for (int i=1; i <= max; i++) { result+=source.charAt(i+1); } if (Define.doDebug>1) { Base.LogThis("Stellen der Eintragsanzahl: " + max, true); Base.LogThis("Eintragsanzahl: " + result, true); } return Integer.parseInt(result); } catch (Exception e) { return -4; } } else { int error_code; switch(error) { case 1: error_code = -1; break; case 2: error_code = -2; break; default: error_code = -5; } return error_code; } }
9165 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/9165/1c981fd0e97d28811f188fbb39e6888035f4a682/Base.java/buggy/ptool/de/partysoke/psagent/util/Base.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1152, 760, 509, 1109, 1076, 1225, 12, 780, 1084, 13, 202, 95, 202, 202, 474, 555, 33, 20, 31, 202, 202, 698, 288, 9506, 202, 1636, 33, 4522, 18, 2670, 1702, 12, 780, 18, 1132, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1152, 760, 509, 1109, 1076, 1225, 12, 780, 1084, 13, 202, 95, 202, 202, 474, 555, 33, 20, 31, 202, 202, 698, 288, 9506, 202, 1636, 33, 4522, 18, 2670, 1702, 12, 780, 18, 1132, ...
trimStart = trimRegion.x + trimRegion.width - trimSize.x - bounds.x ;
public void layout() { cache.flush(); Rectangle trimRegion = getTitleTrimRegion(); Point trimSize = computeTrimSize(); Rectangle bounds = tabFolder.getBounds(); trimStart = bounds.width; Rectangle clientBounds = calculatePageBounds(tabFolder); trimOnTop = trimSize.x <= trimRegion.width && trimSize.y <= trimRegion.height; // Check if we have room for all our topRight controls on the top border if (trimOnTop) { trimStart = trimRegion.x + trimRegion.width - trimSize.x - bounds.x ; align(0, topControls.length, trimRegion); centerArea = clientBounds; return; } // Else we need to place the controls below the title Rectangle currentRect = new Rectangle(clientBounds.x, clientBounds.y, clientBounds.width, 0); int idx = 0; while (idx < topControls.length) { int startOfRow = idx; currentRect.height = 0; int rowWidth = 0; int rowCount = 0; while (idx + rowCount < topControls.length) { Point nextSize = cache.computeSize(idx + rowCount, SWT.DEFAULT, SWT.DEFAULT); rowWidth += nextSize.x; if (rowWidth > clientBounds.width) { break; } currentRect.height = Math.max(currentRect.height, nextSize.y); rowCount++; } if (rowCount > 0) { align(idx, rowCount, currentRect); idx += rowCount; } else { Point size = cache.computeSize(idx, clientBounds.width, SWT.DEFAULT); currentRect.height = size.y; topControls[idx].setBounds(currentRect); idx++; } currentRect.y += currentRect.height; } centerArea = new Rectangle(clientBounds.x, currentRect.y, clientBounds.width, clientBounds.height + clientBounds.y - currentRect.y); }
56152 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/56152/34787673af79351ab1272042781c7391c998a466/TabFolderLayout.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/presentations/TabFolderLayout.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 3511, 1435, 288, 202, 202, 2493, 18, 11330, 5621, 6862, 9506, 202, 19463, 2209, 5165, 273, 10786, 14795, 5165, 5621, 202, 202, 2148, 2209, 1225, 273, 3671, 14795, 1225, 5621,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 3511, 1435, 288, 202, 202, 2493, 18, 11330, 5621, 6862, 9506, 202, 19463, 2209, 5165, 273, 10786, 14795, 5165, 5621, 202, 202, 2148, 2209, 1225, 273, 3671, 14795, 1225, 5621,...
_currentNode = getDocument();
_currentNode = getDocumentRoot(_startNode);
public DTMAxisIterator reset() { _currentNode = getDocument(); m_ancestorsPos = m_ancestors.size()-1; return resetPosition(); }
46591 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46591/8a0ea40ddc59582b7c2084b169f225e4029bee38/DTMDefaultBaseIterators.java/clean/src/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 10696, 5535, 5674, 3198, 2715, 1435, 565, 288, 1377, 389, 2972, 907, 273, 9956, 2375, 24899, 1937, 907, 1769, 5375, 312, 67, 304, 11116, 1616, 273, 312, 67, 304, 11116, 18, 1467, 14...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 10696, 5535, 5674, 3198, 2715, 1435, 565, 288, 1377, 389, 2972, 907, 273, 9956, 2375, 24899, 1937, 907, 1769, 5375, 312, 67, 304, 11116, 1616, 273, 312, 67, 304, 11116, 18, 1467, 14...
public IModuleNameSpace getModuleNameSpace( int nameSpace )
public IModuleNameScope getModuleNameSpace( int nameSpace )
public IModuleNameSpace getModuleNameSpace( int nameSpace ) { assert nameSpace >= 0 && nameSpace < NAME_SPACE_COUNT; return moduleNameSpaces[nameSpace]; }
46013 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46013/b5833a1e367eb18d2954f384e496137a276c1324/Module.java/clean/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/core/Module.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 467, 22542, 3819, 11251, 26857, 12, 509, 508, 3819, 262, 202, 95, 202, 202, 11231, 508, 3819, 1545, 374, 597, 508, 3819, 411, 6048, 67, 6616, 67, 7240, 31, 202, 202, 2463, 978...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 467, 22542, 3819, 11251, 26857, 12, 509, 508, 3819, 262, 202, 95, 202, 202, 11231, 508, 3819, 1545, 374, 597, 508, 3819, 411, 6048, 67, 6616, 67, 7240, 31, 202, 202, 2463, 978...
long beg = RubyNumeric.fix2long(args[0]); long len = RubyNumeric.fix2long(args[1]);
int beg = RubyNumeric.fix2int(args[0]); int len = RubyNumeric.fix2int(args[1]);
public IRubyObject aref(IRubyObject[] args) { int argc = checkArgumentCount(args, 1, 2); if (argc == 2) { long beg = RubyNumeric.fix2long(args[0]); long len = RubyNumeric.fix2long(args[1]); if (beg < 0) { beg += getSize(); } return subseq(beg, len); } if (args[0] instanceof RubyFixnum) { return group(RubyNumeric.fix2long(args[0])); } if (args[0] instanceof RubyBignum) { throw new IndexError(getRuntime(), "index too big"); } if (args[0] instanceof RubyRange) { long[] begLen = ((RubyRange) args[0]).getBeginLength(getSize(), true, false); if (begLen == null) { return getRuntime().getNil(); } return subseq(begLen[0], begLen[1]); } return group(RubyNumeric.num2long(args[0])); }
47134 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/47134/cc20d41e6031b7e9c9ed46676d32e45334ed0d53/RubyMatchData.java/clean/src/org/jruby/RubyMatchData.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 15908, 10340, 921, 854, 74, 12, 7937, 10340, 921, 8526, 833, 13, 288, 3639, 509, 1501, 71, 273, 10788, 1380, 12, 1968, 16, 404, 16, 576, 1769, 3639, 309, 261, 3175, 71, 422, 576, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 15908, 10340, 921, 854, 74, 12, 7937, 10340, 921, 8526, 833, 13, 288, 3639, 509, 1501, 71, 273, 10788, 1380, 12, 1968, 16, 404, 16, 576, 1769, 3639, 309, 261, 3175, 71, 422, 576, ...
String genericLine = line.replaceAll(filePath, "LONG_NAME"); genericLine = genericLine.replaceAll(shortFileName+"\\.", "SHORT_NAME\\.");
protected boolean processSingleLine(String line) { boolean rc = false; // GCC C/C++ compiler invocation int compilerInvocationIndex = -1; for (int cii = 0; cii < compilerInvocation.length; ++cii) { compilerInvocationIndex = line.indexOf(compilerInvocation[cii]); if (compilerInvocationIndex != -1) break; } if (compilerInvocationIndex == -1) return rc; // expecting that compiler invocation is the first token in the line String[] split = line.split("\\s+"); //$NON-NLS-1$ String command = split[0]; // verify that it is compiler invocation int cii2 = -1; for (int cii = 0; cii < compilerInvocation.length; ++cii) { cii2 = command.indexOf(compilerInvocation[cii]); if (cii2 != -1) break; } if (cii2 == -1) { TraceUtil.outputTrace("Error identifying compiler command", line, TraceUtil.EOL); //$NON-NLS-1$ return rc; } // find a file name int extensionsIndex = -1; boolean found = false; String filePath = null; for (int i = 1; i < split.length; ++i) { int k = split[i].lastIndexOf('.'); if (k != -1 && (split[i].length() - k < 5)) { String fileExtension = split[i].substring(k); extensionsIndex = FILE_EXTENSIONS_LIST.indexOf(fileExtension); if (extensionsIndex != -1) { filePath = split[i]; found = true; break; } } }// for (int j = 0; j < FILE_EXTENSIONS.length; ++j) {// if (split[i].endsWith(FILE_EXTENSIONS[j])) {// filePath = split[i];// extensionsIndex = j;// found = true;// break;// }// }// if (found) break; if (!found) { TraceUtil.outputTrace("Error identifying file name :1", line, TraceUtil.EOL); //$NON-NLS-1$ return rc; } // sanity check if (filePath.indexOf(FILE_EXTENSIONS[extensionsIndex]) == -1) { TraceUtil.outputTrace("Error identifying file name :2", line, TraceUtil.EOL); //$NON-NLS-1$ return rc; } if (fUtil != null) { IPath pFilePath = fUtil.getAbsolutePath(filePath); String shortFileName = pFilePath.removeFileExtension().lastSegment(); String genericLine = line.replaceAll(filePath, "LONG_NAME"); //$NON-NLS-1$ genericLine = genericLine.replaceAll(shortFileName+"\\.", "SHORT_NAME\\."); //$NON-NLS-1$ //$NON-NLS-2$ CCommandDSC cmd = fUtil.getNewCCommandDSC(genericLine, extensionsIndex > 0); if (getProject().getLocation().isPrefixOf(pFilePath)) { List cmdList = new ArrayList(); cmdList.add(cmd); Map sc = new HashMap(1); sc.put(ScannerInfoTypes.COMPILER_COMMAND, cmdList); IPath relPath = pFilePath.removeFirstSegments(getProject().getLocation().segmentCount()); IFile file = getProject().getFile(relPath); getCollector().contributeToScannerConfig(file, sc); } // fUtil.addGenericCommandForFile2(longFileName, genericLine); } return rc; }
54911 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54911/6833f73fa5b7cc59db27d91b26dcfc7675c3732c/GCCPerFileBOPConsoleParser.java/clean/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParser.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 4750, 1250, 1207, 5281, 1670, 12, 780, 980, 13, 288, 3639, 1250, 4519, 273, 629, 31, 3639, 368, 611, 6743, 385, 19, 39, 9904, 5274, 9495, 540, 509, 5274, 9267, 1016, 273, 300, 21, 31, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 4750, 1250, 1207, 5281, 1670, 12, 780, 980, 13, 288, 3639, 1250, 4519, 273, 629, 31, 3639, 368, 611, 6743, 385, 19, 39, 9904, 5274, 9495, 540, 509, 5274, 9267, 1016, 273, 300, 21, 31, ...
clientgui.bv.drawMovementData(ce(), cmd);
clientgui.bv.drawMovementData(ce, cmd);
public void keyPressed(KeyEvent ev) { // Are we ignoring events? if ( this.isIgnoringEvents() ) { return; } if (ev.getKeyCode() == KeyEvent.VK_ESCAPE) { clearAllMoves(); } if (ev.getKeyCode() == KeyEvent.VK_BACK_SPACE) { if (client.isMyTurn()) { removeLastStep(); } } if (ev.getKeyCode() == KeyEvent.VK_ENTER && ev.isControlDown()) { if (client.isMyTurn()) { moveTo(cmd); } } if (ev.getKeyCode() == KeyEvent.VK_SHIFT && !shiftheld) { shiftheld = true; if (client.isMyTurn() && client.game.board.lastCursor != null && !client.game.board.lastCursor.equals(client.game.board.selected)) { // switch to turning //clientgui.bv.clearMovementData(); currentMove(client.game.board.lastCursor); clientgui.bv.drawMovementData(ce(), cmd); } } // arrow can also rotate when shift is down if (shiftheld && client.isMyTurn() && (ev.getKeyCode() == KeyEvent.VK_LEFT || ev.getKeyCode() == KeyEvent.VK_RIGHT)) { int curDir = cmd.getFinalFacing(); int dir = curDir; if (ev.getKeyCode() == KeyEvent.VK_LEFT) { dir = (dir + 5) % 6; } else { dir = (dir + 7) % 6; } Coords curPos = cmd.getFinalCoords(); Coords target = curPos.translated(dir); currentMove(target); clientgui.bv.drawMovementData(ce(), cmd); } }
4135 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/4135/46eb279d02c85e76264ab24c5574b4e906ee05ca/MovementDisplay.java/buggy/megamek/src/megamek/client/ui/AWT/MovementDisplay.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 498, 24624, 12, 653, 1133, 2113, 13, 288, 3639, 368, 12520, 732, 14398, 2641, 35, 3639, 309, 261, 333, 18, 291, 21702, 3783, 1435, 262, 288, 5411, 327, 31, 3639, 289, 3639, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 918, 498, 24624, 12, 653, 1133, 2113, 13, 288, 3639, 368, 12520, 732, 14398, 2641, 35, 3639, 309, 261, 333, 18, 291, 21702, 3783, 1435, 262, 288, 5411, 327, 31, 3639, 289, 3639, 3...
args.add (0, compiler); cmdline_len += compiler.length()+1;
args.add(0, compiler); cmdline_len += compiler.length() + 1;
public CompileResult perform (String compiler, ArrayList arguments) { Debug.trace ("starting job " + this.name); // we have some maximum command line length - need to count int cmdline_len = 0; // used to collect the arguments for executing the compiler LinkedList args = new LinkedList(arguments); { Iterator arg_it = args.iterator(); while (arg_it.hasNext ()) cmdline_len += ((String)arg_it.next()).length()+1; } // add compiler in front of arguments args.add (0, compiler); cmdline_len += compiler.length()+1; // construct classpath argument for compiler // - collect all classpaths StringBuffer classpath_sb = new StringBuffer(); Iterator cp_it = this.classpath.iterator(); while (cp_it.hasNext ()) { String cp = (String)cp_it.next(); if (classpath_sb.length() > 0) classpath_sb.append (File.pathSeparatorChar); classpath_sb.append (new File (cp).getAbsolutePath()); } String classpath_str = classpath_sb.toString (); // - add classpath argument to command line if (classpath_str.length() > 0) { args.add ("-classpath"); cmdline_len = cmdline_len + 11; args.add (classpath_str); cmdline_len += classpath_str.length()+1; } // remember how many arguments we have which don't change for the job int common_args_no = args.size(); // remember how long the common command line is int common_args_len = cmdline_len; // used for execution FileExecutor executor = new FileExecutor (); String output[] = new String[2]; // used for displaying the progress bar String jobfiles = ""; int fileno = 0; int last_fileno = 0; // now iterate over all files of this job Iterator file_it = this.files.iterator(); while (file_it.hasNext()) { File f = (File)file_it.next(); String fpath = f.getAbsolutePath(); Debug.trace ("processing "+fpath); // we add the file _first_ to the arguments to have a better // chance to get something done if the command line is almost // MAX_CMDLINE_SIZE or even above fileno++; jobfiles += f.getName() + " "; args.add (fpath); cmdline_len += fpath.length(); // start compilation if maximum command line length reached if (cmdline_len >= MAX_CMDLINE_SIZE) { Debug.trace ("compiling " + jobfiles); // display useful progress bar (avoid showing 100% while still // compiling a lot) this.listener.progress (last_fileno, jobfiles); last_fileno = fileno; String[] full_cmdline = (String[])args.toArray (output); int retval = executor.executeCommand (full_cmdline, output); // update progress bar: compilation of fileno files done this.listener.progress (fileno, jobfiles); if (retval != 0) { CompileResult result = new CompileResult (this.langpack.getString ("CompilePanel.error"), full_cmdline, output[0], output[1]); this.listener.handleCompileError (result); if (! result.isContinue()) return result; } else { // verify that all files have been compiled successfully // I found that sometimes, no error code is returned although // compilation failed. Iterator arg_it = args.listIterator (common_args_no); while (arg_it.hasNext()) { File java_file = new File ((String)arg_it.next()); String basename = java_file.getName(); int dotpos = basename.lastIndexOf ('.'); basename = basename.substring (0, dotpos) + ".class"; File class_file = new File (java_file.getParentFile(), basename); if (! class_file.exists ()) { CompileResult result = new CompileResult (this.langpack.getString ("CompilePanel.error.noclassfile")+java_file.getAbsolutePath(), full_cmdline, output[0], output[1]); this.listener.handleCompileError (result); if (! result.isContinue()) return result; // don't continue any further break; } } } // clean command line: remove files we just compiled for (int i = args.size()-1; i >= common_args_no; i--) { args.removeLast (); } cmdline_len = common_args_len; jobfiles = ""; } } if (cmdline_len > common_args_len) { this.listener.progress (last_fileno, jobfiles); String[] full_cmdline = (String[])args.toArray (output); int retval = executor.executeCommand (full_cmdline, output); this.listener.progress (fileno, jobfiles); if (retval != 0) { CompileResult result = new CompileResult (this.langpack.getString ("CompilePanel.error"), full_cmdline, output[0], output[1]); this.listener.handleCompileError (result); if (! result.isContinue()) return result; } } Debug.trace ("job "+this.name+" done (" + fileno + " files compiled)"); return new CompileResult(); }
46579 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46579/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/CompileWorker.java/buggy/src/lib/com/izforge/izpack/installer/CompileWorker.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 16143, 1253, 3073, 261, 780, 5274, 16, 2407, 1775, 13, 565, 288, 1377, 4015, 18, 5129, 7566, 18526, 1719, 315, 397, 333, 18, 529, 1769, 1377, 368, 732, 1240, 2690, 4207, 1296, 980, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 16143, 1253, 3073, 261, 780, 5274, 16, 2407, 1775, 13, 565, 288, 1377, 4015, 18, 5129, 7566, 18526, 1719, 315, 397, 333, 18, 529, 1769, 1377, 368, 732, 1240, 2690, 4207, 1296, 980, ...
public org.quickfix.field.UnderlyingStrikePrice getUnderlyingStrikePrice() throws FieldNotFound { org.quickfix.field.UnderlyingStrikePrice value = new org.quickfix.field.UnderlyingStrikePrice();
public quickfix.field.UnderlyingStrikePrice getUnderlyingStrikePrice() throws FieldNotFound { quickfix.field.UnderlyingStrikePrice value = new quickfix.field.UnderlyingStrikePrice();
public org.quickfix.field.UnderlyingStrikePrice getUnderlyingStrikePrice() throws FieldNotFound { org.quickfix.field.UnderlyingStrikePrice value = new org.quickfix.field.UnderlyingStrikePrice(); getField(value); return value; }
5926 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5926/fecc27f98261270772ff182a1d4dfd94b5daa73d/SecurityList.java/buggy/src/java/src/quickfix/fix44/SecurityList.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 2358, 18, 19525, 904, 18, 1518, 18, 14655, 6291, 1585, 2547, 5147, 10833, 765, 6291, 1585, 2547, 5147, 1435, 1216, 2286, 2768, 225, 288, 2358, 18, 19525, 904, 18, 1518, 18, 14655, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 2358, 18, 19525, 904, 18, 1518, 18, 14655, 6291, 1585, 2547, 5147, 10833, 765, 6291, 1585, 2547, 5147, 1435, 1216, 2286, 2768, 225, 288, 2358, 18, 19525, 904, 18, 1518, 18, 14655, 6...
System.out.println(((CArrayType)current.getFields()[j].getType()).getDims()[0]);
System.err.println(((CArrayType)current.getFields()[j].getType()).getDims()[0]);
private void createPushPopFunctions(SIRStructure[] structs, FileWriter fw) throws Exception { //create the pop functions for (int i = 0; i < structs.length; i++) { SIRStructure current = structs[i]; //if this type is not passed over a channel, then don't generate the push //pop functions for it... if (!passedTypes.contains(current)) continue; fw.write("inline " + current.getIdent() + " pop" + current.getIdent() + "() {\n"); fw.write("\t" + current.getIdent() + " temp;\n"); for (int j = 0; j < current.getFields().length; j++) { fw.write("\t//" + current.getFields()[j].getType() + "\n"); if (current.getFields()[j].getType().isArrayType()) { System.out.println(((CArrayType)current.getFields()[j].getType()).getDims()); assert false; } else if (current.getFields()[j].getType().isClassType()) { fw.write("\ttemp." + current.getFields()[j].getVariable().getIdent() + " = pop" + current.getFields()[j].getType() + "();\n"); } else { fw.write("\t" + Util.staticNetworkReceivePrefix()); fw.write("temp." + current.getFields()[j].getVariable().getIdent()); fw.write(Util.staticNetworkReceiveSuffix(current.getFields()[j].getType()) + "\n"); } } fw.write("\treturn temp;\n}\n"); //create the pop functions that take a pointer argument //these are more efficent, we use these when we can fw.write("inline void " + RawExecutionCode.structReceiveMethodPrefix + current.getIdent() + "(" + current.getIdent() + "* temp) {\n"); for (int j = 0; j < current.getFields().length; j++) { if (current.getFields()[j].getType().isArrayType()) { assert false; } else if (current.getFields()[j].getType().isClassType()) { //if this is struct field, call the struct's popPointer method fw.write("\t" + RawExecutionCode.structReceiveMethodPrefix + current.getFields()[j].getType() + "(&temp->" + current.getFields()[j].getVariable().getIdent() + ");\n"); } else { fw.write("\t" + Util.staticNetworkReceivePrefix()); fw.write("temp->" + current.getFields()[j].getVariable().getIdent()); fw.write(Util.staticNetworkReceiveSuffix(current.getFields()[j].getType()) + "\n"); } } fw.write("}\n"); //create the push functions fw.write("inline void push" + current.getIdent() + "(" + current.getIdent() + "* temp) {\n"); for (int j = 0; j < current.getFields().length; j++) { //if this field is a struct type, use its method to push the field if (current.getFields()[j].getType().isArrayType()) { System.out.println(((CArrayType)current.getFields()[j].getType()).getDims()[0]); assert false; } else if (current.getFields()[j].getType().isClassType()) { fw.write("push" + current.getFields()[j].getType() + "(&temp->" + current.getFields()[j].getVariable().getIdent() + ");\n"); } else { fw.write("\t" + Util.staticNetworkSendPrefix(current.getFields()[j].getType())); fw.write("temp->" + current.getFields()[j].getVariable().getIdent()); fw.write(Util.staticNetworkSendSuffix() + ";\n"); } } fw.write("}\n"); } }
47772 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/47772/d0151b67d7afbe8a7de9ed43f62980f0135f7047/StructureIncludeFile.java/clean/streams/src/at/dms/kjc/raw/StructureIncludeFile.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 752, 7621, 7049, 7503, 12, 2320, 54, 6999, 8526, 8179, 16, 4766, 3639, 24639, 7600, 13, 1216, 1185, 565, 288, 5411, 368, 2640, 326, 1843, 4186, 3639, 364, 261, 474, 277, 273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 918, 752, 7621, 7049, 7503, 12, 2320, 54, 6999, 8526, 8179, 16, 4766, 3639, 24639, 7600, 13, 1216, 1185, 565, 288, 5411, 368, 2640, 326, 1843, 4186, 3639, 364, 261, 474, 277, 273, ...
if (!isTimeSet)
if (! isTimeSet)
protected void complete() { if (!isTimeSet) computeTime(); if (!areFieldsSet) computeFields(); }
50763 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50763/c65f6a6914005749230b8f31c6890448761cd6f4/Calendar.java/clean/core/src/classpath/java/java/util/Calendar.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 4750, 918, 3912, 1435, 225, 288, 202, 202, 430, 16051, 291, 950, 694, 13, 1082, 202, 9200, 950, 5621, 202, 202, 430, 16051, 834, 2314, 694, 13, 1082, 202, 9200, 2314, 5621, 202, 97, 2, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 4750, 918, 3912, 1435, 225, 288, 202, 202, 430, 16051, 291, 950, 694, 13, 1082, 202, 9200, 950, 5621, 202, 202, 430, 16051, 834, 2314, 694, 13, 1082, 202, 9200, 2314, 5621, 202, 97, 2, ...
e.printStackTrace();
re.initCause(e);
void setToNull(Object obj, Method setter){ RuntimeException re = new RuntimeException("Error trying to set to null"); try { setter.invoke(obj,new Object[]{null}); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); throw re; } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); throw re; } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); throw re; } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/2bc67970abd041b6cb8e0252d02a6e27f304bec4/HierarchyBrowsingImpl.java/buggy/components/server/src/org/openmicroscopy/omero/logic/HierarchyBrowsingImpl.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 918, 19892, 2041, 12, 921, 1081, 16, 2985, 7794, 15329, 3639, 3235, 283, 273, 394, 3235, 2932, 668, 8374, 358, 444, 358, 446, 8863, 540, 775, 288, 5411, 7794, 18, 14407, 12, 2603, 16, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 918, 19892, 2041, 12, 921, 1081, 16, 2985, 7794, 15329, 3639, 3235, 283, 273, 394, 3235, 2932, 668, 8374, 358, 444, 358, 446, 8863, 540, 775, 288, 5411, 7794, 18, 14407, 12, 2603, 16, 2...
connector.updateOfflineState(task, newData, true);
TasksUiPlugin.getSynchronizationManager().updateOfflineState(connector, task, newData, true);
public void testOutgoingToSynchronized() { // Forced AbstractRepositoryTask task = primeTaskAndRepository(RepositoryTaskSyncState.OUTGOING, RepositoryTaskSyncState.SYNCHRONIZED); assertEquals(DATE_STAMP_1, task.getLastModifiedDateStamp()); connector.updateOfflineState(task, newData, true); assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); assertEquals(DATE_STAMP_1, task.getLastModifiedDateStamp()); // Forced with Incoming (user submits a report) task = primeTaskAndRepository(RepositoryTaskSyncState.OUTGOING, RepositoryTaskSyncState.INCOMING); task.setTaskData(null); assertEquals(DATE_STAMP_1, task.getLastModifiedDateStamp()); connector.updateOfflineState(task, newData, true); assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState()); assertEquals(DATE_STAMP_2, task.getLastModifiedDateStamp()); }
51989 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51989/0e9216c5160dcb4bbfc03d2e326a3e5f9aa0e1cf/RepositoryTaskSynchronizationTest.java/clean/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositoryTaskSynchronizationTest.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 1842, 24866, 774, 55, 15666, 1435, 288, 202, 202, 759, 2457, 3263, 202, 202, 7469, 3305, 2174, 1562, 273, 17014, 2174, 1876, 3305, 12, 3305, 2174, 4047, 1119, 18, 5069, 163...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 1842, 24866, 774, 55, 15666, 1435, 288, 202, 202, 759, 2457, 3263, 202, 202, 7469, 3305, 2174, 1562, 273, 17014, 2174, 1876, 3305, 12, 3305, 2174, 4047, 1119, 18, 5069, 163...
return this.immediate; }
return this.immediate; }
public boolean isImmediate() { return this.immediate; }
45298 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/45298/addcb75d5d86d9b1fd628d84d22b74cfc41f078e/RubyObject.java/buggy/org/jruby/RubyObject.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 1250, 353, 22651, 1435, 288, 3639, 327, 333, 18, 381, 6785, 31, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 1250, 353, 22651, 1435, 288, 3639, 327, 333, 18, 381, 6785, 31, 565, 289, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -1...
int inIdx, outIdx, trailingIdx; double tempReal;
public TA_RetCode ROCP(int startIdx, int endIdx, double inReal[], int optInTimePeriod, MInteger outBegIdx, MInteger outNbElement, double outReal[]) { int inIdx, outIdx, trailingIdx; double tempReal; if (startIdx < 0) return TA_RetCode.TA_OUT_OF_RANGE_START_INDEX; if ((endIdx < 0) || (endIdx < startIdx)) return TA_RetCode.TA_OUT_OF_RANGE_END_INDEX; if ((int) optInTimePeriod == (Integer.MIN_VALUE )) optInTimePeriod = 10; else if (((int) optInTimePeriod < 1) || ((int) optInTimePeriod > 100000)) return TA_RetCode.TA_BAD_PARAM; if (startIdx < optInTimePeriod) startIdx = optInTimePeriod; if (startIdx > endIdx) { outBegIdx.value = 0; outNbElement.value = 0; return TA_RetCode.TA_SUCCESS; } outIdx = 0; inIdx = startIdx; trailingIdx = startIdx - optInTimePeriod; while (inIdx <= endIdx) { tempReal = inReal[trailingIdx++]; if (tempReal != 0.0) outReal[outIdx++] = (inReal[inIdx] - tempReal) / tempReal; else outReal[outIdx++] = 0.0; inIdx++; } outNbElement.value = outIdx; outBegIdx.value = startIdx; return TA_RetCode.TA_SUCCESS; }
7231 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/7231/5df8081f2a7211016256c0f481213a987e02947a/Core.java/clean/ta-lib/java/src/TA/Lib/Core.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 399, 37, 67, 7055, 1085, 6525, 4258, 12, 474, 27108, 16, 509, 679, 4223, 16, 1645, 316, 6955, 63, 6487, 1082, 202, 474, 2153, 382, 26540, 16, 490, 4522, 596, 24059, 4223, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 399, 37, 67, 7055, 1085, 6525, 4258, 12, 474, 27108, 16, 509, 679, 4223, 16, 1645, 316, 6955, 63, 6487, 1082, 202, 474, 2153, 382, 26540, 16, 490, 4522, 596, 24059, 4223, 16, ...
protected final void replaceContainer(CompoundText container) {
protected final void replaceContainer(CompoundText container) { checkConsitency();
protected final void replaceContainer(CompoundText container) { if (container == null) { content = new StringBuffer(getContent()); hidden(); } else { if (content != null) { length = content.length(); content = null; } shown(); } this.container = container; }
54405 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54405/b75c6542a14ac86726ff3a51497b6e68ff993ed1/Text.java/clean/trunk/TEF/src/editortest/view/Text.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1117, 727, 918, 1453, 2170, 12, 16835, 1528, 1478, 13, 288, 9506, 202, 430, 261, 3782, 422, 446, 13, 288, 1082, 202, 1745, 273, 394, 6674, 12, 588, 1350, 10663, 1082, 202, 6345, 56...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 1117, 727, 918, 1453, 2170, 12, 16835, 1528, 1478, 13, 288, 9506, 202, 430, 261, 3782, 422, 446, 13, 288, 1082, 202, 1745, 273, 394, 6674, 12, 588, 1350, 10663, 1082, 202, 6345, 56...
public JSLFrame editPatch(IPatch p)
public JSLFrame editPatch(Patch p)
public JSLFrame editPatch(IPatch p) { return super.editPatch(p); }
7591 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/7591/8de9e9d107eb8c0487bbadf2f24d3a5cc9bc1add/YamahaDX7IIAdditionalVoiceSingleDriver.java/buggy/JSynthLib/synthdrivers/YamahaDX7II/YamahaDX7IIAdditionalVoiceSingleDriver.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 804, 4559, 3219, 3874, 7332, 12, 2579, 505, 293, 13, 202, 95, 202, 202, 2463, 2240, 18, 4619, 7332, 12, 84, 1769, 202, 97, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 804, 4559, 3219, 3874, 7332, 12, 2579, 505, 293, 13, 202, 95, 202, 202, 2463, 2240, 18, 4619, 7332, 12, 84, 1769, 202, 97, 2, -100, -100, -100, -100, -100, -100, -100, -100, ...
prepareManagementBean(request, ExecutionYear.readCurrentExecutionYear());
prepareManagementBean(request, ExecutionYear.readCurrentExecutionYear());
public ActionForward createVigilantGroup(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { VigilantGroupBean beanWithName = (VigilantGroupBean) RenderUtils.getViewState( "createVigilantGroup.block1").getMetaObject().getObject(); VigilantGroupBean beanWithFirstPeriod = (VigilantGroupBean) RenderUtils.getViewState( "createVigilantGroup.block2").getMetaObject().getObject(); VigilantGroupBean beanWithSecondPeriod = (VigilantGroupBean) RenderUtils.getViewState( "createVigilantGroup.block3").getMetaObject().getObject(); Object[] args = { beanWithName.getName(), beanWithName.getUnit(), beanWithName.getConvokeStrategy(), beanWithFirstPeriod.getBeginFirstUnavailablePeriod(), beanWithFirstPeriod.getEndFirstUnavailablePeriod(), beanWithSecondPeriod.getBeginSecondUnavailablePeriod(), beanWithSecondPeriod.getEndSecondUnavailablePeriod() }; executeService(request, "CreateVigilantGroup", args); prepareManagementBean(request, ExecutionYear.readCurrentExecutionYear()); return mapping.findForward("manageVigilantGroups"); }
2645 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/2645/bf038d353ac7538e5827d426ae8c0c090973ac6b/VigilantGroupManagement.java/clean/src/net/sourceforge/fenixedu/presentationTier/Action/vigilancy/VigilantGroupManagement.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 4382, 8514, 752, 58, 360, 330, 970, 1114, 12, 1803, 3233, 2874, 16, 4382, 1204, 646, 16, 5411, 9984, 590, 16, 12446, 766, 13, 1216, 1185, 288, 3639, 776, 360, 330, 970, 1114, 3381...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 4382, 8514, 752, 58, 360, 330, 970, 1114, 12, 1803, 3233, 2874, 16, 4382, 1204, 646, 16, 5411, 9984, 590, 16, 12446, 766, 13, 1216, 1185, 288, 3639, 776, 360, 330, 970, 1114, 3381...
JMenu menu = (JMenu) GUITreeLoader.elementStack.get(GUITreeLoader.elementStack.size() - 2); menu.add(this);
((JMenu) GUITreeLoader.elementStack.get(GUITreeLoader.elementStack.size() - 2)).add(this);
public void startSetup(AttributeList atts) { // this lets us test what we read from file Vector testVector = new Vector() ; // get the menu's title and set it String title = atts.getValue(A_TEXT); setText(title); // we start out disabled setEnabled(false); // Add us to our parent menu. JMenu menu = (JMenu) GUITreeLoader.elementStack.get(GUITreeLoader.elementStack.size() - 2); menu.add(this); // grab some preferences Preferences prefs = (Preferences) GUITreeLoader.reg.get(GUITreeComponentRegistry.PREFERENCES); // set size of Recent Files list currentRecentFilesListSize = ((PreferenceInt)prefs.getPreference(Preferences.RECENT_FILES_LIST_SIZE)).cur; // Try to load the frameInfoList from disk // TBD [srk] rename RECENT_FILES_FILE to FRAME_INFO_LIST_FILE Object obj = ReadObjectFromFile(Outliner.RECENT_FILES_FILE); // we need to make sure we have a Vector // we used to use an ArrayList for frameInfoList, // but now we use a Vector // anything else is just ignored // if we were able to read something ... if (obj != null) { // if we have a Vector ... if (testVector.getClass().isInstance(obj)) { // set the var frameInfoList = (Vector)obj ; // remove any duplicate entries // saves youngest, removes oldest StanVectorTools.removeDupesHeadside(frameInfoList) ; } // end if we have a Vector // else we don't have a Vector else { // start a fresh list frameInfoList = null ; } // end else we don't have a vector // else we couldn't read anything } else { frameInfoList = null; } //end else int filSize = ((PreferenceInt)prefs.getPreference(Preferences.FRAME_INFO_LIST_SIZE)).def ; // testing wipeout frameInfoList = null ; // if frameInfoList is null ... if (frameInfoList == null) { // start a new frameInfoList frameInfoList = new Vector(); // else we're non-null } else { // if we're too large ... if (frameInfoList.size() > filSize) { // trim back StanVectorTools.trimSizeSaveTail(frameInfoList, filSize) ; } // end if we're too large } // end if-else // apply our display settings // this also populates the menu correctly applyDisplaySettings() ; } // end methor startSetup
49473 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/49473/8779cdb98eb677d6cfddacf5bd9d3b772489fa4c/RecentFilesList.java/buggy/outliner/src/com/organic/maynard/outliner/RecentFilesList.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 787, 7365, 12, 1499, 682, 15687, 13, 288, 202, 202, 759, 333, 14557, 584, 1842, 4121, 732, 855, 628, 585, 202, 202, 5018, 1842, 5018, 273, 394, 5589, 1435, 274, 202, 202,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 918, 787, 7365, 12, 1499, 682, 15687, 13, 288, 202, 202, 759, 333, 14557, 584, 1842, 4121, 732, 855, 628, 585, 202, 202, 5018, 1842, 5018, 273, 394, 5589, 1435, 274, 202, 202,...
String newname = text.getText(); if (renameJob(name, repdir, newname)) { ti.setText(newname); } text.dispose();
text.dispose();
public void focusLost(FocusEvent arg0) { // Focus is lost: connect to repository and change name. String newname = text.getText(); if (renameJob(name, repdir, newname)) { ti.setText(newname); } text.dispose(); }
58146 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58146/19cb297a8d9a862529b82769e5fc6ae9f2f48e1a/RepositoryExplorerDialog.java/clean/kettle/src/be/ibridge/kettle/repository/dialog/RepositoryExplorerDialog.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 4697, 202, 482, 918, 7155, 19024, 12, 9233, 1133, 1501, 20, 13, 4697, 202, 95, 6862, 202, 759, 478, 4560, 353, 13557, 30, 3077, 358, 3352, 471, 2549, 508, 18, 6862, 202, 780, 26722, 273, 977...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 4697, 202, 482, 918, 7155, 19024, 12, 9233, 1133, 1501, 20, 13, 4697, 202, 95, 6862, 202, 759, 478, 4560, 353, 13557, 30, 3077, 358, 3352, 471, 2549, 508, 18, 6862, 202, 780, 26722, 273, 977...
else if( name.equals(Constants.DOM_NAMESPACE_DECLARATIONS) || name.equals(Constants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equals(SEND_PSVI)
else if( name.equalsIgnoreCase(Constants.DOM_NAMESPACE_DECLARATIONS) || name.equalsIgnoreCase(Constants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equalsIgnoreCase(SEND_PSVI)
public boolean canSetParameter(String name, Object value) { if (value == null){ //if null, the returned value is true. //REVISIT: I dont like this --- even for unrecognized parameter it would //return 'true'. I think it should return false in that case. // Application will be surprised to find that setParameter throws not //recognized exception when canSetParameter returns 'true' Then what is the use //of having canSetParameter ??? - nb. return true ; } if( value instanceof Boolean ){ //features whose parameter value can be set either 'true' or 'false' // or they accept any boolean value -- so we just need to check that // its a boolean value.. if (name.equals(Constants.DOM_COMMENTS) || name.equals(Constants.DOM_DATATYPE_NORMALIZATION) || name.equals(Constants.DOM_CDATA_SECTIONS) || name.equals(Constants.DOM_ENTITIES) || name.equals(Constants.DOM_SPLIT_CDATA) || name.equals(Constants.DOM_NAMESPACES) || name.equals(Constants.DOM_VALIDATE) || name.equals(Constants.DOM_WELLFORMED) || name.equals(Constants.DOM_INFOSET) ) { return true ; }//features whose parameter value can not be set to 'true' else if ( name.equals(Constants.DOM_NORMALIZE_CHARACTERS) || name.equals(Constants.DOM_CANONICAL_FORM) || name.equals(Constants.DOM_VALIDATE_IF_SCHEMA) || name.equals(Constants.DOM_CHECK_CHAR_NORMALIZATION) ) { return (value.equals(Boolean.TRUE)) ? false : true; }//features whose parameter value can not be set to 'false' else if( name.equals(Constants.DOM_NAMESPACE_DECLARATIONS) || name.equals(Constants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equals(SEND_PSVI) ) { return (value.equals(Boolean.TRUE)) ? true : false; }// if name is not among the above listed above -- its not recognized. return false else { return false ; } } else if (name.equals(Constants.DOM_ERROR_HANDLER)) { return (value instanceof DOMErrorHandler) ? true : false ; } else if (name.equals(Constants.DOM_RESOURCE_RESOLVER)) { return (value instanceof LSResourceResolver) ? true : false ; } else if (name.equals(Constants.DOM_SCHEMA_LOCATION)) { return (value instanceof String) ? true : false ; } else if (name.equals(Constants.DOM_SCHEMA_TYPE)) { // REVISIT: should null value be supported? //as of now we are only supporting W3C XML Schema return ( (value instanceof String) && value.equals(Constants.NS_XMLSCHEMA) ) ? true : false ; } else if (name.equals(SYMBOL_TABLE)){ // Xerces Symbol Table return (value instanceof SymbolTable) ? true : false ; } else if (name.equals (GRAMMAR_POOL)){ return (value instanceof XMLGrammarPool) ? true : false ; } else { //false if the parameter is not recognized or the requested value is not supported. return false ; } } //canSetParameter
1831 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1831/533ebf030a7b0e9b294007b8c69adbacd68acc35/DOMConfigurationImpl.java/clean/src/org/apache/xerces/dom/DOMConfigurationImpl.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 1250, 848, 694, 1662, 12, 780, 508, 16, 1033, 460, 13, 288, 3639, 309, 261, 1132, 422, 446, 15329, 5411, 368, 430, 446, 16, 326, 2106, 460, 353, 638, 18, 5411, 368, 862, 267...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 1250, 848, 694, 1662, 12, 780, 508, 16, 1033, 460, 13, 288, 3639, 309, 261, 1132, 422, 446, 15329, 5411, 368, 430, 446, 16, 326, 2106, 460, 353, 638, 18, 5411, 368, 862, 267...
rfa.setFile("src/test/output/test.log");
rfa.setFile(Constants.TEST_DIR_PREFIX + "output/test.log");
public void testRename() throws Exception { RollingFileAppender rfa = new RollingFileAppender(); rfa.setLayout(layout); rfa.setContext(context); rfa.setFile("src/test/output/test.log"); // rollover by the second String datePattern = "yyyy-MM-dd_HH_mm_ss"; SimpleDateFormat sdf = new SimpleDateFormat(datePattern); String[] filenames = new String[2]; TimeBasedRollingPolicy tbrp = new TimeBasedRollingPolicy(); tbrp.setFileNamePattern("src/test/output/test-%d{" + datePattern + "}"); //tbrp.setActiveFileName("src/test/output/test.log"); tbrp.setContext(context); tbrp.setParent(rfa); tbrp.start(); rfa.setRollingPolicy(tbrp); rfa.start(); //StatusPrinter.print(context.getStatusManager()); Calendar cal = Calendar.getInstance(); rfa.doAppend("Hello 0"); DelayerUtil.delayUntilNextSecond(50); rfa.doAppend("Hello 1"); filenames[0] = "src/test/output/test-" + sdf.format(cal.getTime()); filenames[1] = "src/test/output/test.log"; for (int i = 0; i < filenames.length; i++) { //System.out.println("before i=" + i); assertTrue(Compare.compare(filenames[i], "src/test/witness/rolling/renaming." + i)); //System.out.println("post i=" + i); } }
45777 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/45777/9bd8f1bd2c318517068244dc23c1f941119f40ec/RenamingTest.java/buggy/logback-core/src/test/java/ch/qos/logback/core/rolling/RenamingTest.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 918, 1842, 16019, 1435, 1216, 1185, 288, 565, 29495, 812, 17302, 436, 507, 273, 394, 29495, 812, 17302, 5621, 565, 436, 507, 18, 542, 3744, 12, 6741, 1769, 565, 436, 507, 18, 542, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 282, 1071, 918, 1842, 16019, 1435, 1216, 1185, 288, 565, 29495, 812, 17302, 436, 507, 273, 394, 29495, 812, 17302, 5621, 565, 436, 507, 18, 542, 3744, 12, 6741, 1769, 565, 436, 507, 18, 542, ...
WriterLogger imcms = null ;
WriterLogger imcms = null;
public ApplicationServer() throws IOException { System.setSecurityManager(new RMISecurityManager()) ; log = Log.getLog("server") ; // Set up logfiles WriterLogger imcms = null ; try { String mainlog = Prefs.get("Log.Main", CONFIG_FILE) ; imcms = new WriterLogger(new java.io.BufferedWriter(new java.io.FileWriter(mainlog,true)),Log.INFO,Log.WARNING,LOGINTERVAL,LOGSIZE) ; } catch (NullPointerException ex) { log.log(Log.NOTICE, "Failed to find and setup Log.Main (the main log) in "+CONFIG_FILE) ; } WriterLogger error = null ; try { String errorlog = Prefs.get("Log.Error", CONFIG_FILE) ; error = new WriterLogger(new java.io.BufferedWriter(new java.io.FileWriter(errorlog,true)),Log.WARNING,Log.WARNING,LOGINTERVAL,LOGSIZE) ; } catch (NullPointerException ex) { log.log(Log.NOTICE, "Failed to find and setup Log.Error (the error log) in "+CONFIG_FILE) ; } log.addLogListener(imcms) ; log.addLogListener(error) ; // get list of servers StringTokenizer st = null ; try { String servers = Prefs.get("Servers", CONFIG_FILE) ; st = new StringTokenizer(servers, " ,") ; remoteObjects = new UnicastRemoteObject[st.countTokens()] ; log.log(Log.INFO,""+remoteObjects.length+" Server"+(remoteObjects.length==1?": ":"s: ")+servers, null) ; } catch (IOException ex) { log.log(Log.EMERGENCY, "Unable to load properties from "+CONFIG_FILE, ex) ; throw ex ; } catch (NullPointerException ex) { log.log(Log.EMERGENCY, "Unable to load properties from "+CONFIG_FILE, ex) ; throw ex ; } int port ; try { port = Integer.parseInt(Prefs.get("RMIPort",CONFIG_FILE)) ; } catch (NumberFormatException ex) { port = 1099 ; } catch (IOException ex) { port = 1099 ; } catch (NullPointerException ex) { port = 1099 ; } log.log(Log.INFO, "Starting rmiregistry on port "+port) ; try { reg = LocateRegistry.createRegistry(port) ; } catch (RemoteException ex) { log.log(Log.EMERGENCY, "Failed to start RMI-registry.", ex) ; throw ex ; } for ( int i=0 ; st.hasMoreTokens() ; ++i ) { String servername = st.nextToken() ; log.log(Log.INFO, "Reading properties for server "+servername, null) ; Properties serverprops = null ; try { String serverpropsfile = Prefs.get(servername+".properties", CONFIG_FILE) ; serverprops = Prefs.getProperties(serverpropsfile) ; } catch (IOException ex) { log.log(Log.CRITICAL, "Unable to load properties for server "+servername, ex) ; continue ; } // Find out what class this object is supposed to be of. String classname = serverprops.getProperty("Class") ; try { // Load the class Class objClass = Class.forName(classname) ; // Let's find the constructor that takes an "InetPoolManager" and a Properties. Constructor objConstructor = objClass.getConstructor(new Class[] {InetPoolManager.class, Properties.class}) ; // Invoke Constructor(InetPoolManager, Properties) on class remoteObjects[i] = (UnicastRemoteObject)objConstructor.newInstance(new Object[] {new InetPoolManager(serverprops), serverprops} ) ; // Bind object to rmi-registry reg.bind(servername,remoteObjects[i]) ; } catch (ClassNotFoundException ex) { log.log(Log.CRITICAL, "Unable to find class "+classname, ex) ; } catch (ClassCastException ex) { log.log(Log.CRITICAL, "Class "+classname+" is not a subclass of java.rmi.server.UnicastRemoteObject", ex) ; } catch (NoSuchMethodException ex) { log.log(Log.CRITICAL, "Class "+classname+" does not have a compatible constructor "+classname+"(InetPoolManager, Properties)", ex) ; } catch (RemoteException ex) { log.log(Log.CRITICAL, "Failed to bind "+servername+" to local RMI-registry", ex) ; } catch (InstantiationException ex) { log.log(Log.CRITICAL, "Failed to invoke found constructor "+classname+"(InetPoolManager, Properties) on class "+classname, ex) ; } catch (IllegalAccessException ex) { log.log(Log.CRITICAL, "Failed to invoke found constructor "+classname+"(InetPoolManager, Properties) on class "+classname, ex) ; } catch (java.lang.reflect.InvocationTargetException ex) { log.log(Log.CRITICAL, "Failed to invoke found constructor "+classname+"(InetPoolManager, Properties) on class "+classname, ex.getTargetException()) ; } catch (AlreadyBoundException ex) { log.log(Log.CRITICAL, "Failed to bind "+classname+" in RMI-registry. The name "+servername+" is already bound.", ex) ; } catch (java.sql.SQLException ex) { log.log(Log.CRITICAL, "Failed to create connectionpool and datasource for "+servername, ex) ; } } log.log(Log.NOTICE, "ImCMS Daemon "+VERSION,null) ; log.log(Log.NOTICE, "imcmsd started: " + new java.util.Date(), null) ; log.log(Log.NOTICE, "imcmsd running...",null) ; }
8781 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/8781/cbaf8fbf9eeaf7b9db5163cf0496eea1be5ce141/ApplicationServer.java/buggy/server/src/imcode/server/ApplicationServer.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 4257, 2081, 1435, 1216, 1860, 288, 202, 3163, 18, 542, 4368, 1318, 12, 2704, 534, 7492, 4368, 1318, 10756, 274, 202, 1330, 273, 1827, 18, 588, 1343, 2932, 3567, 7923, 274, 202, 759,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 1071, 4257, 2081, 1435, 1216, 1860, 288, 202, 3163, 18, 542, 4368, 1318, 12, 2704, 534, 7492, 4368, 1318, 10756, 274, 202, 1330, 273, 1827, 18, 588, 1343, 2932, 3567, 7923, 274, 202, 759,...
return RubyFixnum.newFixnum(getRuntime(), count);
return getRuntime().newFixnum(count);
public IRubyObject count(IRubyObject[] args) { int argc = checkArgumentCount(args, 1, -1); String[] specs = new String[argc]; for (int i = 0; i < argc; i++) { specs[i] = stringValue(args[i]).getValue(); } String table = setupTable(specs); int count = 0; for (int j = 0; j < getValue().length(); j++) { if (table.indexOf(getValue().charAt(j)) != -1) { count++; } } return RubyFixnum.newFixnum(getRuntime(), count); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/870e1da9b41bfdbae259e1fc5f18fc8b76686998/RubyString.java/clean/src/org/jruby/RubyString.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 15908, 10340, 921, 1056, 12, 7937, 10340, 921, 8526, 833, 13, 288, 202, 202, 474, 1501, 71, 273, 10788, 1380, 12, 1968, 16, 404, 16, 300, 21, 1769, 202, 202, 780, 8526, 10607,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 225, 202, 482, 15908, 10340, 921, 1056, 12, 7937, 10340, 921, 8526, 833, 13, 288, 202, 202, 474, 1501, 71, 273, 10788, 1380, 12, 1968, 16, 404, 16, 300, 21, 1769, 202, 202, 780, 8526, 10607,...
if ( ! knownChain) newStruc.addChain(nc);
*/
private Structure getStructureRanges(int pos , Structure s ) throws StructureException{ Structure newStruc = new StructureImpl(); // check if the alignment has an object detail "region" for this // if yes = restrict the used structure... Annotation[] objects = alignment.getObjects(); Annotation object = objects[pos]; if ( object.containsProperty("details")){ List details = (List) object.getProperty("details"); newStruc.setPDBCode(s.getPDBCode()); newStruc.setHeader(s.getHeader()); for ( int det = 0 ; det< details.size();det++) { Annotation detanno = (Annotation) details.get(det); String property = (String)detanno.getProperty("property"); if ( property.equals("region")){ String detail = (String) detanno.getProperty("detail"); // split up the structure and add the region to the new structure... int cpos = detail.indexOf(":"); String chainId = " "; if ( cpos > 0) { chainId = detail.substring(0,cpos); detail = detail.substring(cpos+1,detail.length()); } else { detail = detail.substring(1,detail.length()); } System.out.println(detail + " " + cpos + " " + chainId); String[] spl = detail.split("-"); if ( spl.length != 2) continue; String start = spl[0]; String end = spl[1]; System.out.println("start " + start + " end " + end); Chain c = s.getChainByPDB(chainId); Group[] groups = c.getGroupsByPDB(start,end); Chain nc = new ChainImpl (); nc.setName(chainId); boolean knownChain = false; try { nc = newStruc.findChain(chainId); knownChain = true; } catch (Exception e){} for (int g=0;g<groups.length;g++){ Group gr = groups[g]; nc.addGroup(gr); } if ( ! knownChain) newStruc.addChain(nc); } } } if (newStruc.size() > 0){ return newStruc; } else return null; }
52521 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52521/204b10b1100446b304f6d263d5522d1aeb8e212e/StructureAlignment.java/clean/src/org/biojava/spice/StructureAlignment.java
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 13348, 18730, 9932, 12, 474, 949, 269, 13348, 272, 262, 1216, 13348, 503, 95, 7734, 13348, 394, 1585, 5286, 273, 394, 13348, 2828, 5621, 7734, 368, 866, 309, 326, 8710, 711, 392, 73...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 377, 3238, 13348, 18730, 9932, 12, 474, 949, 269, 13348, 272, 262, 1216, 13348, 503, 95, 7734, 13348, 394, 1585, 5286, 273, 394, 13348, 2828, 5621, 7734, 368, 866, 309, 326, 8710, 711, 392, 73...