_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q176400
SQLiteAppender.computeReferenceMask
test
private static short computeReferenceMask(ILoggingEvent event) { short mask = 0; int mdcPropSize = 0; if (event.getMDCPropertyMap() != null) { mdcPropSize = event.getMDCPropertyMap().keySet().size(); } int contextPropSize = 0; if (event.getLoggerContextVO().getPropertyMap() != null) { ...
java
{ "resource": "" }
q176401
SQLiteAppender.mergePropertyMaps
test
private Map<String, String> mergePropertyMaps(ILoggingEvent event) { Map<String, String> mergedMap = new HashMap<String, String>(); // we add the context properties first, then the event properties, since // we consider that event-specific properties should have priority over // context-wide properties....
java
{ "resource": "" }
q176402
SQLiteAppender.insertException
test
private void insertException(SQLiteStatement stmt, String txt, short i, long eventId) throws SQLException { stmt.bindLong(1, eventId); stmt.bindLong(2, i); stmt.bindString(3, txt); stmt.executeInsert(); }
java
{ "resource": "" }
q176403
ElementSelector.getPrefixMatchLength
test
public int getPrefixMatchLength(ElementPath p) { if (p == null) { return 0; } int lSize = this.partList.size(); int rSize = p.partList.size(); // no match possible for empty sets if ((lSize == 0) || (rSize == 0)) { return 0; } int minLen = (lSize <= rSize) ? lSize : rSize;...
java
{ "resource": "" }
q176404
StatusBase.getEffectiveLevel
test
public synchronized int getEffectiveLevel() { int result = level; int effLevel; Iterator it = iterator(); Status s; while (it.hasNext()) { s = (Status) it.next(); effLevel = s.getEffectiveLevel(); if (effLevel > result) { result = effLevel; } } return result;...
java
{ "resource": "" }
q176405
PropertySetter.setProperty
test
public void setProperty(String name, String value) { if (value == null) { return; } name = Introspector.decapitalize(name); PropertyDescriptor prop = getPropertyDescriptor(name); if (prop == null) { addWarn("No such property [" + name + "] in " + objClass.getName() + "."); } else ...
java
{ "resource": "" }
q176406
PropertySetter.isUnequivocallyInstantiable
test
private boolean isUnequivocallyInstantiable(Class<?> clazz) { if (clazz.isInterface()) { return false; } // checking for constructors would be more elegant, but in // classes without any declared constructors, Class.getConstructor() // returns null. Object o; try { o = clazz.getD...
java
{ "resource": "" }
q176407
CopyOnInheritThreadLocal.childValue
test
@Override protected HashMap<String, String> childValue( HashMap<String, String> parentValue) { if (parentValue == null) { return null; } else { return new HashMap<String, String>(parentValue); } }
java
{ "resource": "" }
q176408
IncludeAction.processInclude
test
@Override protected void processInclude(InterpretationContext ic, URL url) throws JoranException { InputStream in = openURL(url); try { if (in != null) { // add URL to watch list in case the "scan" flag is true, in // which case this URL is periodically checked for changes Conf...
java
{ "resource": "" }
q176409
IncludeAction.openURL
test
private InputStream openURL(URL url) { try { return url.openStream(); } catch (IOException e) { optionalWarning("Failed to open [" + url.toString() + "]", e); return null; } }
java
{ "resource": "" }
q176410
IncludeAction.trimHeadAndTail
test
private void trimHeadAndTail(SaxEventRecorder recorder) { List<SaxEvent> saxEventList = recorder.getSaxEventList(); if (saxEventList.size() == 0) { return; } boolean includedTagFound = false; boolean configTagFound = false; // find opening element SaxEvent first = saxEventList.get(0)...
java
{ "resource": "" }
q176411
ServerSocketReceiver.shouldStart
test
protected boolean shouldStart() { ServerSocket serverSocket = null; try { serverSocket = getServerSocketFactory().createServerSocket( getPort(), getBacklog(), getInetAddress()); ServerListener<RemoteAppenderClient> listener = createServerListener(serverSocket); runner = c...
java
{ "resource": "" }
q176412
AlgoliaException.isTransient
test
public boolean isTransient() { Throwable cause = getCause(); if (cause == null) { return isServerError(statusCode); } else if (cause instanceof AlgoliaException) { return ((AlgoliaException)cause).isTransient(); } else if (cause instanceof IOException) { ...
java
{ "resource": "" }
q176413
PlacesClient.setDefaultHosts
test
private void setDefaultHosts() { List<String> fallbackHosts = Arrays.asList( "places-1.algolianet.com", "places-2.algolianet.com", "places-3.algolianet.com" ); Collections.shuffle(fallbackHosts); List<String> hosts = new ArrayList<>(fallba...
java
{ "resource": "" }
q176414
MirroredIndex.ensureLocalIndex
test
private synchronized void ensureLocalIndex() { if (localIndex == null) { localIndex = new LocalIndex(getClient().getRootDataDir().getAbsolutePath(), getClient().getApplicationID(), getRawIndexName()); } }
java
{ "resource": "" }
q176415
MirroredIndex.sync
test
public void sync() { if (getDataSelectionQueries().length == 0) { throw new IllegalStateException("Cannot sync with empty data selection queries"); } synchronized (this) { if (syncing) return; syncing = true; } getClient().l...
java
{ "resource": "" }
q176416
MirroredIndex.syncIfNeeded
test
public void syncIfNeeded() { long currentDate = System.currentTimeMillis(); if (currentDate - mirrorSettings.getLastSyncDate().getTime() > delayBetweenSyncs || mirrorSettings.getQueriesModificationDate().compareTo(mirrorSettings.getLastSyncDate()) > 0) { sync(); } }
java
{ "resource": "" }
q176417
Index.waitTask
test
public JSONObject waitTask(String taskID, long timeToWait) throws AlgoliaException { try { while (true) { JSONObject obj = client.getRequest("/1/indexes/" + encodedIndexName + "/task/" + URLEncoder.encode(taskID, "UTF-8"), /* urlParameters: */ null, false, /* requestOptions: */ null)...
java
{ "resource": "" }
q176418
OfflineClient.listIndexesOfflineSync
test
private JSONObject listIndexesOfflineSync() throws AlgoliaException { try { final String rootDataPath = getRootDataDir().getAbsolutePath(); final File appDir = getAppDir(); final File[] directories = appDir.listFiles(new FileFilter() { @Override ...
java
{ "resource": "" }
q176419
AbstractClient._toCharArray
test
private static String _toCharArray(InputStream stream) throws IOException { InputStreamReader is = new InputStreamReader(stream, "UTF-8"); StringBuilder builder = new StringBuilder(); char[] buf = new char[1000]; int l = 0; while (l >= 0) { builder.append(buf, 0, l); ...
java
{ "resource": "" }
q176420
AbstractClient._toByteArray
test
private static byte[] _toByteArray(InputStream stream) throws AlgoliaException { ByteArrayOutputStream out = new ByteArrayOutputStream(); int read; byte[] buffer = new byte[1024]; try { while ((read = stream.read(buffer, 0, buffer.length)) != -1) { out.write(...
java
{ "resource": "" }
q176421
AbstractClient.consumeQuietly
test
private static void consumeQuietly(final HttpURLConnection connection) { try { int read = 0; while (read != -1) { read = connection.getInputStream().read(); } connection.getInputStream().close(); read = 0; while (read != -1)...
java
{ "resource": "" }
q176422
AbstractClient.hostsThatAreUp
test
private List<String> hostsThatAreUp(List<String> hosts) { List<String> upHosts = new ArrayList<>(); for (String host : hosts) { if (isUpOrCouldBeRetried(host)) { upHosts.add(host); } } return upHosts.isEmpty() ? hosts : upHosts; }
java
{ "resource": "" }
q176423
PlacesQuery.setType
test
public @NonNull PlacesQuery setType(Type type) { if (type == null) { set(KEY_TYPE, null); } else { switch (type) { case CITY: set(KEY_TYPE, "city"); break; case COUNTRY: set(KEY_TYPE, "cou...
java
{ "resource": "" }
q176424
BrowseIterator.start
test
public void start() { if (started) { throw new IllegalStateException(); } started = true; request = index.browseAsync(query, requestOptions, completionHandler); }
java
{ "resource": "" }
q176425
ExpiringCache.put
test
public V put(K key, V value) { V previous = null; synchronized (this) { long timeout = System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(expirationTimeout, expirationTimeUnit); final Pair<V, Long> previousPair = lruCache.put(key, new Pair<>(value, timeout)); ...
java
{ "resource": "" }
q176426
ExpiringCache.get
test
synchronized public V get(K key) { final Pair<V, Long> cachePair = lruCache.get(key); if (cachePair != null && cachePair.first != null) { if (cachePair.second > System.currentTimeMillis()) { return cachePair.first; } else { lruCache.remove(key); ...
java
{ "resource": "" }
q176427
ThreadSpawner.awaitCompletion
test
public void awaitCompletion() { for (Thread thread : threads) { try { thread.join(); } catch (InterruptedException e) { throw rethrow(e); } } if (caughtException != null) { throw rethrow(caughtException); } ...
java
{ "resource": "" }
q176428
VersionUtils.versionCompare
test
public static int versionCompare(String firstVersionString, String secondVersionString) { String[] firstVersion = parseVersionString(firstVersionString); String[] secondVersion = parseVersionString(secondVersionString); int i = 0; // set index to first non-equal ordinal or length of sho...
java
{ "resource": "" }
q176429
ExceptionReporter.report
test
public static void report(String testId, Throwable cause) { if (cause == null) { LOGGER.fatal("Can't call report with a null exception"); return; } long exceptionCount = FAILURE_ID.incrementAndGet(); if (exceptionCount > MAX_EXCEPTION_COUNT) { LOGGER...
java
{ "resource": "" }
q176430
FileUtils.copyDirectory
test
public static void copyDirectory(File src, File target) { checkNotNull(src, "src can't be null"); checkNotNull(target, "target can't be null"); File[] files = src.listFiles(); if (files == null) { return; } for (File srcFile : files) { if (srcFil...
java
{ "resource": "" }
q176431
SimulatorProperties.init
test
public SimulatorProperties init(File file) { if (file == null) { // if no file is explicitly given, we look in the working directory file = new File(getUserDir(), PROPERTIES_FILE_NAME); if (!file.exists()) { LOGGER.info(format("Found no %s in working directory...
java
{ "resource": "" }
q176432
ReflectionUtils.getStaticFieldValue
test
public static <E> E getStaticFieldValue(Class clazz, String fieldName, Class fieldType) { Field field = getField(clazz, fieldName, fieldType); if (field == null) { throw new ReflectionException(format("Field %s.%s is not found", clazz.getName(), fieldName)); } field.setAcces...
java
{ "resource": "" }
q176433
ReflectionUtils.getMethodByName
test
public static Method getMethodByName(Class clazz, String methodName) { for (Method method : clazz.getDeclaredMethods()) { if (method.getName().equals(methodName)) { return method; } } return null; }
java
{ "resource": "" }
q176434
FormatUtils.formatPercentage
test
public static String formatPercentage(long value, long baseValue) { double percentage = (baseValue > 0 ? (ONE_HUNDRED * value) / baseValue : 0); return formatDouble(percentage, PERCENTAGE_FORMAT_LENGTH); }
java
{ "resource": "" }
q176435
FormatUtils.formatDouble
test
public static String formatDouble(double number, int length) { return padLeft(format(Locale.US, "%,.2f", number), length); }
java
{ "resource": "" }
q176436
FormatUtils.formatLong
test
public static String formatLong(long number, int length) { return padLeft(format(Locale.US, "%,d", number), length); }
java
{ "resource": "" }
q176437
JsonProtocol.readJsonSyntaxChar
test
protected void readJsonSyntaxChar(byte[] b) throws IOException { byte ch = reader.read(); if (ch != b[0]) { throw new ProtocolException("Unexpected character:" + (char) ch); } }
java
{ "resource": "" }
q176438
JsonProtocol.hexVal
test
private static byte hexVal(byte ch) throws IOException { if ((ch >= '0') && (ch <= '9')) { return (byte) ((char) ch - '0'); } else if ((ch >= 'a') && (ch <= 'f')) { return (byte) ((char) ch - 'a' + 10); } else { throw new ProtocolException("Expected hex charac...
java
{ "resource": "" }
q176439
JsonProtocol.writeJsonString
test
private void writeJsonString(byte[] b) throws IOException { context.write(); transport.write(QUOTE); int len = b.length; for (int i = 0; i < len; i++) { if ((b[i] & 0x00FF) >= 0x30) { if (b[i] == BACKSLASH[0]) { transport.write(BACKSLASH); ...
java
{ "resource": "" }
q176440
JsonProtocol.writeJsonInteger
test
private void writeJsonInteger(long num) throws IOException { context.write(); String str = Long.toString(num); boolean escapeNum = context.escapeNum(); if (escapeNum) { transport.write(QUOTE); } try { byte[] buf = str.getBytes("UTF-8"); ...
java
{ "resource": "" }
q176441
JsonProtocol.writeJsonDouble
test
private void writeJsonDouble(double num) throws IOException { context.write(); String str = Double.toString(num); boolean special = false; switch (str.charAt(0)) { case 'N': // NaN case 'I': // Infinity special = true; break; ...
java
{ "resource": "" }
q176442
JsonProtocol.readJsonString
test
private ByteString readJsonString(boolean skipContext) throws IOException { Buffer buffer = new Buffer(); ArrayList<Character> codeunits = new ArrayList<>(); if (!skipContext) { context.read(); } readJsonSyntaxChar(QUOTE); while (true) { ...
java
{ "resource": "" }
q176443
JsonProtocol.readJsonNumericChars
test
private String readJsonNumericChars() throws IOException { StringBuilder strbld = new StringBuilder(); while (true) { byte ch = reader.peek(); if (!isJsonNumeric(ch)) { break; } strbld.append((char) reader.read()); } return ...
java
{ "resource": "" }
q176444
JsonProtocol.readJsonInteger
test
private long readJsonInteger() throws IOException { context.read(); if (context.escapeNum()) { readJsonSyntaxChar(QUOTE); } String str = readJsonNumericChars(); if (context.escapeNum()) { readJsonSyntaxChar(QUOTE); } try { retur...
java
{ "resource": "" }
q176445
JsonProtocol.readJsonDouble
test
private double readJsonDouble() throws IOException { context.read(); if (reader.peek() == QUOTE[0]) { ByteString str = readJsonString(true); double dub = Double.valueOf(str.utf8()); if (!context.escapeNum() && !Double.isNaN(dub) && !Double.isInfini...
java
{ "resource": "" }
q176446
JsonProtocol.readJsonBase64
test
private ByteString readJsonBase64() throws IOException { ByteString str = readJsonString(false); return ByteString.decodeBase64(str.utf8()); }
java
{ "resource": "" }
q176447
ClientBase.execute
test
protected final Object execute(MethodCall<?> methodCall) throws Exception { if (!running.get()) { throw new IllegalStateException("Cannot write to a closed service client"); } try { return invokeRequest(methodCall); } catch (ServerException e) { throw...
java
{ "resource": "" }
q176448
ClientBase.invokeRequest
test
final Object invokeRequest(MethodCall<?> call) throws Exception { boolean isOneWay = call.callTypeId == TMessageType.ONEWAY; int sid = seqId.incrementAndGet(); protocol.writeMessageBegin(call.name, call.callTypeId, sid); call.send(protocol); protocol.writeMessageEnd(); p...
java
{ "resource": "" }
q176449
AsyncClientBase.enqueue
test
protected void enqueue(MethodCall<?> methodCall) { if (!running.get()) { throw new IllegalStateException("Cannot write to a closed service client"); } if (!pendingCalls.offer(methodCall)) { // This should never happen with an unbounded queue throw new Illegal...
java
{ "resource": "" }
q176450
PlatformUtils.getResourceFromFSPath
test
public static IFile getResourceFromFSPath(String location) { return Activator.getDefault().getWorkspace(). getRoot().getFileForLocation(new Path(location)); }
java
{ "resource": "" }
q176451
PlatformUtils.updateDecoration
test
public static void updateDecoration() { final IWorkbench workbench = Activator.getDefault().getWorkbench(); workbench.getDisplay().syncExec(new Runnable() { public void run() { IDecoratorManager manager = workbench.getDecoratorManager(); manager.update(GuvnorD...
java
{ "resource": "" }
q176452
PlatformUtils.refreshRepositoryView
test
public static void refreshRepositoryView() { IWorkbenchWindow activeWindow = Activator.getDefault(). getWorkbench().getActiveWorkbenchWindow(); // If there is no active workbench window, then there can be no Repository view if (activeWindow == null) { ...
java
{ "resource": "" }
q176453
PlatformUtils.getResourceHistoryView
test
public static ResourceHistoryView getResourceHistoryView() throws Exception { IWorkbenchWindow activeWindow = Activator.getDefault(). getWorkbench().getActiveWorkbenchWindow(); // If there is no active workbench window, then there can be no Repository History ...
java
{ "resource": "" }
q176454
PlatformUtils.openEditor
test
public static void openEditor(String contents, String name) { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IStorage storage = new StringStorage(contents, name); IStorageEditorInput input = new StringInput(storage); IWorkbenchPage page = window.getActive...
java
{ "resource": "" }
q176455
PlatformUtils.reportAuthenticationFailure
test
public static void reportAuthenticationFailure() { Display display = PlatformUI.getWorkbench().getDisplay(); display.asyncExec(new Runnable() { public void run() { Display display = Display.getCurrent(); Shell shell = display.getActiveShell(); ...
java
{ "resource": "" }
q176456
PlatformUtils.promptForAuthentication
test
public AuthPromptResults promptForAuthentication(final String server) { Display display = PlatformUI.getWorkbench().getDisplay(); AuthPromptRunnable op = new AuthPromptRunnable(server); display.syncExec(op); return op.getResults(); }
java
{ "resource": "" }
q176457
KieNavigatorView.createDefaultPage
test
private Control createDefaultPage(FormToolkit kit) { Form form = kit.createForm(book); Composite body = form.getBody(); GridLayout layout = new GridLayout(2, false); body.setLayout(layout); Link hlink = new Link(body, SWT.NONE); hlink.setText("<a>Use the Servers View to create a new server...</a>"); hlin...
java
{ "resource": "" }
q176458
KieNavigatorView.startThread
test
protected void startThread() { if (animationActive) return; stopAnimation = false; final Display display = treeViewer == null ? Display.getDefault() : treeViewer.getControl().getDisplay(); final int SLEEP = 200; final Runnable[] animator = new Runnable[1]; animator[0] = new Runnable() { public void ...
java
{ "resource": "" }
q176459
PropertyBehavior.setIsKeepAllAlive
test
public void setIsKeepAllAlive(boolean isKeepAllAlive) { Element child = getFirstChild(root, childNames); boolean isAlreadyKeepAllAlive = false; if (isDAVElement(child, "keepalive")) //$NON-NLS-1$ isAlreadyKeepAllAlive = "*".equals(getFirstText(child)); //$NON-NLS-1$ if (isKee...
java
{ "resource": "" }
q176460
PropertyBehavior.setIsOmit
test
public void setIsOmit(boolean isOmit) { Element child = getFirstChild(root, childNames); boolean isAlreadyOmit = isDAVElement(child, "omit"); //$NON-NLS-1$ if (isOmit) { if (!isAlreadyOmit) { if (child != null) root.removeChild(child); ...
java
{ "resource": "" }
q176461
ActiveLock.setOwner
test
public Owner setOwner() { Element owner = setChild(root, "owner", childNames, false); //$NON-NLS-1$ Owner result = null; try { result = new Owner(owner); } catch (MalformedElementException e) { Assert.isTrue(false, Policy.bind("assert.internalError")); //$NON-NLS-...
java
{ "resource": "" }
q176462
ConditionTerm.addConditionFactor
test
public void addConditionFactor(ConditionFactor factor) throws WebDAVException { if (conditionFactors.contains(factor)) throw new WebDAVException(IResponse.SC_BAD_REQUEST, Policy.bind("error.parseDuplicateEntry")); //$NON-NLS-1$ conditionFactors.addElement(factor); }
java
{ "resource": "" }
q176463
ConditionTerm.create
test
public static ConditionTerm create(StreamTokenizer tokenizer) throws WebDAVException { ConditionTerm term = new ConditionTerm(); try { int token = tokenizer.ttype; if (token == '(') token = tokenizer.nextToken(); else throw new WebDAVEx...
java
{ "resource": "" }
q176464
ConditionTerm.matches
test
public boolean matches(ConditionTerm conditionTerm) { int numberOfItemsToMatch = 0; boolean match = true; Enumeration factors = getConditionFactors(); while (match && factors.hasMoreElements()) { ConditionFactor factor = (ConditionFactor) factors.nextElement(); if...
java
{ "resource": "" }
q176465
DSLAdapter.getDSLContent
test
public static Reader getDSLContent(String ruleSource, IResource input) throws CoreException { String dslFileName = findDSLConfigName( ruleSource, input ); if (dslFileName == null) { return null; } IResource res = findDSLResource( input, dslFileName ); if (res instance...
java
{ "resource": "" }
q176466
DSLAdapter.loadConfig
test
private void loadConfig(IFile input) { IResource res = findDSLResource( input, dslConfigName ); if (res instanceof IFile) { IFile dslConf = (IFile) res; if (dslConf.exists()) { InputStream stream = null; try { stream = dslConf.g...
java
{ "resource": "" }
q176467
DSLAdapter.readConfig
test
void readConfig(InputStream stream) throws IOException, CoreException { DSLTokenizedMappingFile file = new DSLTokenizedMappingFile(); file.parseAndLoad(new InputStreamReader(stream)); DSLMapping grammar = file.getMapping(); List<DSLMappingEntry> conditions = grammar.getEntries( DSLMappi...
java
{ "resource": "" }
q176468
RuleHelperActionDelegate.getMenu
test
public Menu getMenu(Control parent) { setMenu( new Menu( parent ) ); final Shell shell = parent.getShell(); addProjectWizard( menu, shell ); addRuleWizard( menu, shell ); addDSLWizard( menu, shell ); ...
java
{ "resource": "" }
q176469
MultiStatus.addResponse
test
public ResponseBody addResponse() { Element response = addChild(root, "response", childNames, true); //$NON-NLS-1$ try { return new ResponseBody(response); } catch (MalformedElementException e) { Assert.isTrue(false, Policy.bind("assert.internalError")); //$NON-NLS-1$ ...
java
{ "resource": "" }
q176470
HrefSet.addHref
test
public void addHref(String href) { String encodedHref = encodeHref(href); if (isDuplicate(encodedHref)) return; appendChild(root, "href", encodedHref); //$NON-NLS-1$ }
java
{ "resource": "" }
q176471
HrefSet.insertHrefBefore
test
public void insertHrefBefore(String newHref, String refHref) { String refHrefEncoded = encodeHref(refHref); String newHrefEncoded = encodeHref(newHref); if (isDuplicate(newHrefEncoded)) return; Element child = getFirstChild(root, "href"); //$NON-NLS-1$ while (child !=...
java
{ "resource": "" }
q176472
HrefSet.removeHref
test
public void removeHref(String href) { String encodedHref = encodeHref(href); Element child = getFirstChild(root, "href"); //$NON-NLS-1$ while (child != null) { if (encodedHref.equals(getFirstText(child))) { root.removeChild(child); return; ...
java
{ "resource": "" }
q176473
ResponseBody.addPropStat
test
public PropStat addPropStat() { Element firstHref = getFirstChild(root, "href"); //$NON-NLS-1$ Assert.isTrue(firstHref == null || getNextSibling(firstHref, new String[] {"href", "status"}) == null); //$NON-NLS-1$ //$NON-NLS-2$ Element element = addChild(root, "propstat", fgNamesPropStat, false);...
java
{ "resource": "" }
q176474
ResponseBody.getHref
test
public String getHref() throws MalformedElementException { String href = getChildText(root, "href", true); //$NON-NLS-1$ ensureNotNull(Policy.bind("ensure.missingHrefElmt"), href); //$NON-NLS-1$ return decodeHref(href); }
java
{ "resource": "" }
q176475
ResponseBody.getStatus
test
public String getStatus() throws MalformedElementException { Element status = getFirstChild(root, "status"); //$NON-NLS-1$ ensureNotNull(Policy.bind("ensure.missingStatusElmt"), status); //$NON-NLS-1$ return getFirstText(status); }
java
{ "resource": "" }
q176476
DebugUtil.getStackFrame
test
public static IJavaStackFrame getStackFrame(IValue value) throws CoreException { IStatusHandler handler = getStackFrameProvider(); if (handler != null) { IJavaStackFrame stackFrame = (IJavaStackFrame) handler .handleStatus(fgNeedStackFrame, value); ...
java
{ "resource": "" }
q176477
RuleCompletionProcessor.isSubtypeOf
test
private boolean isSubtypeOf(String class1, String class2) { if (class1 == null || class2 == null) { return false; } class1 = convertToNonPrimitiveClass(class1); class2 = convertToNonPrimitiveClass(class2); // TODO add code to take primi...
java
{ "resource": "" }
q176478
RuleCompletionProcessor.containsProposal
test
public static boolean containsProposal(final Collection<ICompletionProposal> proposals, String newProposal) { for (ICompletionProposal prop : proposals) { String displayString = prop.getDisplayString(); String[] existings = displayString.split(" "); if (existings.length == 0)...
java
{ "resource": "" }
q176479
ElementEditor.cloneNode
test
public static Node cloneNode(Document document, Node node) { Node nodeClone = null; switch (node.getNodeType()) { case Node.ELEMENT_NODE : { nodeClone = document.createElement(((Element) node).getTagName()); NamedNodeMap namedNodeMap ...
java
{ "resource": "" }
q176480
RequestInputStream.reset
test
public void reset() throws IOException { if (file == null) { ((ByteArrayInputStream) is).reset(); } else { if (fos != null) { while (skip(4096) > 0); fos.close(); fos = null; if (length == -1) { l...
java
{ "resource": "" }
q176481
AbstractRuleEditor.createActions
test
protected void createActions() { super.createActions(); IAction a = new TextOperationAction(RuleEditorMessages .getResourceBundle(), "ContentAssistProposal.", this, ISourceViewer.CONTENTASSIST_PROPOSALS); a .setActionDefinitionId(ITextEditorAction...
java
{ "resource": "" }
q176482
GraphicalVertex.addConnection
test
public void addConnection(Connection conn) { if ( conn == null || conn.getSource() == conn.getTarget() ) { throw new IllegalArgumentException(); } if ( conn.getSource() == this ) { sourceConnections.add( conn ); firePropertyChange( SOURCE_CONNECTIONS_PROP, ...
java
{ "resource": "" }
q176483
GraphicalVertex.getPropertyValue
test
public Object getPropertyValue(Object propertyId) { if ( XPOS_PROP.equals( propertyId ) ) { return Integer.toString( location.x ); } if ( YPOS_PROP.equals( propertyId ) ) { return Integer.toString( location.y ); } if ( HEIGHT_PROP.equals( propertyId ) ) { ...
java
{ "resource": "" }
q176484
GraphicalVertex.removeConnection
test
public void removeConnection(Connection conn) { if ( conn == null ) { throw new IllegalArgumentException(); } if ( conn.getSource() == this ) { sourceConnections.remove( conn ); firePropertyChange( SOURCE_CONNECTIONS_PROP, null,...
java
{ "resource": "" }
q176485
GraphicalVertex.setLocation
test
public void setLocation(Point newLocation) { if ( newLocation == null ) { throw new IllegalArgumentException(); } location.setLocation( newLocation ); firePropertyChange( LOCATION_PROP, null, location ); }
java
{ "resource": "" }
q176486
GraphicalVertex.setPropertyValue
test
public void setPropertyValue(Object propertyId, Object value) { if ( XPOS_PROP.equals( propertyId ) ) { int x = Integer.parseInt( (String) value ); setLocation( new Point( x, location.y ) ); } else if ( YPOS_PRO...
java
{ "resource": "" }
q176487
GraphicalVertex.setSize
test
public void setSize(Dimension newSize) { if ( newSize != null ) { size.setSize( newSize ); firePropertyChange( SIZE_PROP, null, size ); } }
java
{ "resource": "" }
q176488
GraphicalVertex.dumpConstraints
test
public static String dumpConstraints(final Constraint[] constraints) { if ( constraints == null ) { return null; } final StringBuffer buffer = new StringBuffer(); for ( int i = 0, length = constraints.length; i < length; i++ ) { buffer.append( constraints[i].toStr...
java
{ "resource": "" }
q176489
SupportedLock.addLockEntry
test
public LockEntry addLockEntry() { Element lockentry = addChild(root, "lockentry", childNames, false); //$NON-NLS-1$ Element locktype = appendChild(lockentry, "locktype"); //$NON-NLS-1$ appendChild(locktype, "write"); //$NON-NLS-1$ LockEntry result = null; try { resu...
java
{ "resource": "" }
q176490
ReteGraph.addChild
test
public boolean addChild(BaseVertex vertex) { if ( vertex != null && vertices.add( vertex ) ) { firePropertyChange( PROP_CHILD_ADDED, null, vertex ); return true; } return false; }
java
{ "resource": "" }
q176491
ReteGraph.removeChild
test
public boolean removeChild(BaseVertex vertex) { if ( vertex != null && vertices.remove( vertex ) ) { firePropertyChange( PROP_CHILD_REMOVED, null, vertex ); return true; } return false; }
java
{ "resource": "" }
q176492
DroolsEclipsePlugin.start
test
public void start(BundleContext context) throws Exception { super.start( context ); IPreferenceStore preferenceStore = getPreferenceStore(); useCachePreference = preferenceStore.getBoolean( IDroolsConstants.CACHE_PARSED_RULES ); preferenceStore.addPropertyChangeListener( new IPropertyCha...
java
{ "resource": "" }
q176493
DroolsEclipsePlugin.stop
test
public void stop(BundleContext context) throws Exception { super.stop( context ); plugin = null; resourceBundle = null; parsedRules = null; compiledRules = null; processInfos = null; processInfosById = null; for (Color color: colors.values()) { ...
java
{ "resource": "" }
q176494
DroolsEclipsePlugin.getResourceString
test
public static String getResourceString(String key) { ResourceBundle bundle = DroolsEclipsePlugin.getDefault().getResourceBundle(); try { return (bundle != null) ? bundle.getString( key ) : key; } catch ( MissingResourceException e ) { return key; } }
java
{ "resource": "" }
q176495
DroolsEclipsePlugin.getResourceBundle
test
public ResourceBundle getResourceBundle() { try { if ( resourceBundle == null ) resourceBundle = ResourceBundle.getBundle( "droolsIDE.DroolsIDEPluginResources" ); } catch ( MissingResourceException x ) { resourceBundle = null; } return resourceBundle; }
java
{ "resource": "" }
q176496
DroolsEclipsePlugin.getRuleBuilderFormColors
test
public FormColors getRuleBuilderFormColors(Display display) { if ( ruleBuilderFormColors == null ) { ruleBuilderFormColors = new FormColors( display ); ruleBuilderFormColors.markShared(); } return ruleBuilderFormColors; }
java
{ "resource": "" }
q176497
DateTime.setDateTime
test
public void setDateTime(String date) { String[] patterns = {RFC_1123_PATTERN, ISO_8601_UTC_PATTERN, ISO_8601_UTC_MILLIS_PATTERN, ISO_8601_PATTERN, ISO_8601_MILLIS_PATTERN, RFC_850_PATTERN, ASCTIME_PATTERN}; for (int i = 0; i < patterns.length; i++) { if (setDateTime(date, patterns[i])) ...
java
{ "resource": "" }
q176498
DateTime.setDateTime
test
protected boolean setDateTime(String date, String pattern) { boolean dateChanged = true; dateFormat.applyPattern(pattern); try { setDateTime(dateFormat.parse(date)); } catch (ParseException e) { dateChanged = false; } return dateChanged; }
java
{ "resource": "" }
q176499
Activator.error
test
public static IStatus error(final String message, final Throwable thr) { return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, thr); }
java
{ "resource": "" }