id
int64
1
49k
buggy
stringlengths
34
37.5k
fixed
stringlengths
2
37k
18,401
import sparkjni.jniLink.linkContainers.FunctionSignatureMapper; import sparkjni.jniLink.linkContainers.TypeMapper; import sparkjni.utils.CppSyntax; import sparkjni.utils.JniUtils; import java.util.HashSet; <BUG>import java.util.List; @Value.Immutable</BUG> public abstract class NativeFunctionWrapper { private HashSet<String> jClassObjectsSet = new HashSet<>(); public abstract FunctionSignatureMapper functionSignatureMapper();
import static sparkjni.utils.JniUtils.PASS_BY_VALUE; @Value.Immutable
18,402
} private String generateInitializationStatementForJniPrototype(FunctionSignatureMapper functionSignatureMapper, int variableIndex) { CppBean cppBean = functionSignatureMapper.parameterList().get(variableIndex).cppType(); String cppVariableName = JniUtils.generateCppVariableName(cppBean, "", variableIndex); String arguments = generateConstructorCallerArgsSection(cppBean, variableIndex); <BUG>String args = (arguments == null || arguments.isEmpty()) ? "" : arguments; return String.format("\t%s *%s = new %s(%s);\n", cppBean.getCppClassName(), cppVariableName, cppBean.getCppClassName(), args); </BUG> } private String generateJNIArgumentPrototypeDecl(List<TypeMapper> parameterList) {
String retType = JniUtils.wrapInSharedPtr(cppBean.getCppClassName(), PASS_BY_VALUE); return String.format("\t%s %s = std::make_shared<%s>(%s);\n", retType, cppVariableName, cppBean.getCppClassName(), args);
18,403
callerArgs.append(String.format("%s, ", JniUtils.generateCppVariableName(cppBean, null, idx))); } callerArgs.append(JniUtils.getClassDefObjectVariableName(returnedBean)); callerArgs.append(", jniEnv"); CppBean cppbean = functionSignatureMapper.returnTypeMapper().cppType(); <BUG>String retObjectName = generateFunctionReturnObjectName(cppbean); String retObjFuncCallStmt = String.format("\t%s *%s = %s(%s);\n", cppbean.getCppClassName(), retObjectName, </BUG> functionSignatureMapper.functionNameMapper().cppName(), callerArgs.toString()); String result = String.format("\t%s %s = %s->getJavaObject();\n", "jobject", generateReturnObjectName(cppbean), retObjectName);
String retType = JniUtils.wrapInSharedPtr(cppbean.getCppClassName(), PASS_BY_VALUE); String retObjFuncCallStmt = String.format("\t%s %s = %s(%s);\n", retType, retObjectName,
18,404
SModelReference reference = LanguageAspect.STRUCTURE.get(node.getConceptLanguage()); reference = reference.update(); return node.getModel().getUsedVersion(reference); } public static int getReferenceToNodeVersion(SNode node, SModelReference targetModelReference) { <BUG>if (targetModelReference == null) { //target model reference is nullable in postponed references return -1; }</BUG> return node.getModel().getUsedVersion(targetModelReference);
[DELETED]
18,405
import org.eclipse.jdt.ui.JavaUI; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ToolBarManager; import org.eclipse.jface.internal.text.html.BrowserInformationControl; import org.eclipse.jface.internal.text.html.BrowserInformationControlInput; <BUG>import org.eclipse.jface.internal.text.html.HTMLPrinter; import org.eclipse.jface.text.DefaultInformationControl;</BUG> import org.eclipse.jface.text.IInformationControl; import org.eclipse.jface.text.IInformationControlCreator; import org.eclipse.jface.text.IInputChangedListener;
import org.eclipse.jface.resource.ColorRegistry; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.text.DefaultInformationControl;
18,406
import org.eclipse.jface.text.IInformationControl; import org.eclipse.jface.text.IInformationControlCreator; import org.eclipse.jface.text.IInputChangedListener; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.viewers.ILabelProvider; <BUG>import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display;</BUG> import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PartInitException; import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display;
18,407
import org.eclipse.jface.action.IMenuListener2; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.bindings.keys.IKeyLookup; import org.eclipse.jface.bindings.keys.KeyLookupFactory; <BUG>import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.jface.text.ITextViewerExtension5;</BUG> import org.eclipse.jface.text.IViewportListener; import org.eclipse.jface.text.IWidgetTokenKeeper; import org.eclipse.jface.text.IWidgetTokenKeeperExtension;
import org.eclipse.jface.resource.ColorRegistry; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.text.ITextViewerExtension5;
18,408
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ToolBarManager; import org.eclipse.jface.internal.text.html.BrowserInformationControl; import org.eclipse.jface.internal.text.html.BrowserInformationControlInput; import org.eclipse.jface.internal.text.html.BrowserInput; <BUG>import org.eclipse.jface.internal.text.html.HTMLPrinter; import org.eclipse.jface.resource.JFaceResources;</BUG> import org.eclipse.jface.text.AbstractReusableInformationControlCreator; import org.eclipse.jface.text.DefaultInformationControl; import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.resource.ColorRegistry; import org.eclipse.jface.resource.JFaceResources;
18,409
import org.eclipse.jface.text.IInformationControlExtension4; import org.eclipse.jface.text.IInputChangedListener; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.viewers.ILabelProvider; <BUG>import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.widgets.Display;</BUG> import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.ISharedImages;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display;
18,410
import org.eclipse.core.runtime.ListenerList; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.action.ToolBarManager; import org.eclipse.jface.internal.text.html.HTML2TextReader; <BUG>import org.eclipse.jface.internal.text.html.HTMLPrinter; import org.eclipse.jface.resource.JFaceResources;</BUG> import org.eclipse.jface.text.AbstractInformationControl; import org.eclipse.jface.text.IDelayedInputChangeProvider; import org.eclipse.jface.text.IInformationControlExtension2;
import org.eclipse.jface.resource.ColorRegistry; import org.eclipse.jface.resource.JFaceResources;
18,411
.processIssuesBy(new IValidationIssueProcessor() { @Override public void processIssues(List<Issue> issues, IProgressMonitor monitor) { } }).withParent(detailPaneComposite); <BUG>Control viewerControl = embeddedEditor.getViewer().getControl(); viewerControl.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); viewerControl.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); embeddedEditor.getDocument().setValidationJob(null);</BUG> createTextLayout();
[DELETED]
18,412
final boolean physical, boolean markAsCopy) { final LightVirtualFile virtualFile = new LightVirtualFile(name, fileType, text, modificationStamp); if(fileType instanceof LanguageFileType){ final Language language = ((LanguageFileType)fileType).getLanguage(); <BUG>final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(language); FileViewProvider viewProvider = language.createViewProvider(virtualFile, myManager, physical); </BUG> if (viewProvider == null) viewProvider = new SingleRootFileViewProvider(myManager, virtualFile, physical); if (parserDefinition != null){
final FileViewProviderFactory factory = LanguageFileViewProviders.INSTANCE.forLanguage(language); FileViewProvider viewProvider = factory != null ? factory.createFileViewProvider(virtualFile, language, myManager, physical) : null;
18,413
private FileViewProvider createFileViewProvider(final VirtualFile file) { FileViewProvider viewProvider = null; final FileType fileType = file.getFileType(); if (fileType instanceof LanguageFileType) { final LanguageFileType languageFileType = (LanguageFileType)fileType; <BUG>viewProvider = languageFileType.getLanguage().createViewProvider(file, myManager, true); }</BUG> if (viewProvider == null) viewProvider = new SingleRootFileViewProvider(myManager, file); return viewProvider; }
final FileViewProviderFactory factory = LanguageFileViewProviders.INSTANCE.forLanguage(languageFileType.getLanguage()); viewProvider = factory != null ? factory.createFileViewProvider(file, languageFileType.getLanguage(), myManager, true) : null;
18,414
package org.colorcoding.ibas.bobas.approval; import org.colorcoding.ibas.bobas.bo.IBODocument; <BUG>import org.colorcoding.ibas.bobas.bo.IBODocumentLine; import org.colorcoding.ibas.bobas.bo.IBOReferenced; </BUG> import org.colorcoding.ibas.bobas.bo.IBusinessObject; import org.colorcoding.ibas.bobas.common.ICriteria;
import org.colorcoding.ibas.bobas.bo.IBOTagCanceled; import org.colorcoding.ibas.bobas.bo.IBOTagDeleted;
18,415
package org.colorcoding.ibas.bobas.approval; import java.util.Iterator; import org.colorcoding.ibas.bobas.bo.IBODocument; <BUG>import org.colorcoding.ibas.bobas.bo.IBODocumentLine; import org.colorcoding.ibas.bobas.bo.IBOReferenced; </BUG> import org.colorcoding.ibas.bobas.data.emDocumentStatus; import org.colorcoding.ibas.bobas.data.emYesNo;
import org.colorcoding.ibas.bobas.bo.IBOTagCanceled; import org.colorcoding.ibas.bobas.bo.IBOTagDeleted;
18,416
if (data instanceof IBODocument) { IBODocument docData = (IBODocument) data; if (docData.getDocumentStatus() == emDocumentStatus.Planned) { return false; } <BUG>if (docData.getCanceled() == emYesNo.Yes) { return false; }</BUG> } if (data instanceof IBODocumentLine) {
[DELETED]
18,417
} if (data instanceof IBODocumentLine) { IBODocumentLine lineData = (IBODocumentLine) data; if (lineData.getLineStatus() == emDocumentStatus.Planned) { return false; <BUG>} if (lineData.getCanceled() == emYesNo.Yes) { </BUG> return false; }
return null;
18,418
if (lineData.getCanceled() == emYesNo.Yes) { </BUG> return false; } } <BUG>if (data instanceof IBOReferenced) { IBOReferenced refData = (IBOReferenced) data; if (refData.getDeleted() == emYesNo.Yes) { </BUG> return false;
return null; protected boolean checkDataStatus(IApprovalData data) { if (data.isDeleted()) {
18,419
IBODocumentLine lineItem = (IBODocumentLine) item; if (evt.getPropertyName().equals("DocEntry")) { lineItem.setDocEntry(parentItem.getDocEntry()); } else if (evt.getPropertyName().equals("DocumentStatus")) { lineItem.setLineStatus(parentItem.getDocumentStatus()); <BUG>} else if (evt.getPropertyName().equals("Canceled")) { lineItem.setCanceled(parentItem.getCanceled());</BUG> } else if (evt.getPropertyName().equals("Status")) { lineItem.setStatus(parentItem.getStatus()); }
[DELETED]
18,420
IBODocumentLine lineItem = (IBODocumentLine) item; if (evt.getPropertyName().equals("DocEntry")) { lineItem.setDocEntry(parentItem.getDocEntry()); } else if (evt.getPropertyName().equals("LineStatus")) { lineItem.setLineStatus(parentItem.getLineStatus()); <BUG>} else if (evt.getPropertyName().equals("Canceled")) { lineItem.setCanceled(parentItem.getCanceled());</BUG> } else if (evt.getPropertyName().equals("Status")) { lineItem.setStatus(parentItem.getStatus()); }
} else if (evt.getPropertyName().equals("DocumentStatus")) { lineItem.setLineStatus(parentItem.getDocumentStatus());
18,421
appInfo.free(); return ret; } private static long setupDebugging(VkInstance instance, int flags, VkDebugReportCallbackEXT callback) { VkDebugReportCallbackCreateInfoEXT dbgCreateInfo = VkDebugReportCallbackCreateInfoEXT.calloc() <BUG>.sType(VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) // <- the struct type </BUG> .pNext(NULL) // <- must be NULL .pfnCallback(callback) // <- the actual function pointer (in LWJGL a Closure) .pUserData(NULL) // <- any user data provided to the debug report callback function
.sType(VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT) // <- the struct type
18,422
appInfo.free(); return ret; } private static long setupDebugging(VkInstance instance, int flags, VkDebugReportCallbackEXT callback) { VkDebugReportCallbackCreateInfoEXT dbgCreateInfo = VkDebugReportCallbackCreateInfoEXT.calloc() <BUG>.sType(VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) </BUG> .pNext(NULL) .pfnCallback(callback) .pUserData(NULL)
.sType(VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT)
18,423
return mySandboxSolution.isSelected(); } public void setSandboxSolutionNeeded(boolean needed) { mySandboxSolution.setSelected(needed); } <BUG>public void setProjectPath(String projectPath) { String oldProjectPath = myProjectPath; </BUG> myProjectPath = projectPath; if ((oldProjectPath != null && oldProjectPath.length() > 0) && myLanguageLocation.getText().contains(oldProjectPath)) {
if (myProjectPath != null && myProjectPath.equals(projectPath)) { return; final String oldProjectPath = myProjectPath;
18,424
mySolutionLocationDocListenerEnabled = false; mySolutionLocation.setText(solutionLocation); mySolutionLocationDocListenerEnabled = true; fireChaged(); } <BUG>public void setProjectPath(String projectPath) { String oldProjectPath = myProjectPath; </BUG> myProjectPath = projectPath; if ((oldProjectPath != null && oldProjectPath.length() > 0) && mySolutionLocation.getText().contains(oldProjectPath)) {
if (myProjectPath != null && myProjectPath.equals(projectPath)) { return; final String oldProjectPath = myProjectPath;
18,425
import com.mapzen.android.lost.api.LocationAvailability; import com.mapzen.android.lost.api.LocationCallback; import com.mapzen.android.lost.api.LocationListener; import com.mapzen.android.lost.api.LocationRequest; import com.mapzen.android.lost.api.LocationResult; <BUG>import com.mapzen.android.lost.api.LostApiClient; import android.app.PendingIntent;</BUG> import android.content.Context; import android.location.Location; import android.os.Looper;
import com.mapzen.android.lost.api.PendingResult; import com.mapzen.android.lost.api.Status; import android.app.PendingIntent;
18,426
package com.mapzen.android.lost.internal; import com.mapzen.android.lost.api.LocationAvailability; import com.mapzen.android.lost.api.LocationCallback; import com.mapzen.android.lost.api.LocationListener; import com.mapzen.android.lost.api.LocationRequest; <BUG>import com.mapzen.android.lost.api.LostApiClient; import android.app.PendingIntent;</BUG> import android.app.Service; import android.content.Intent; import android.location.Location;
import com.mapzen.android.lost.api.PendingResult; import com.mapzen.android.lost.api.Status; import android.app.PendingIntent;
18,427
void addListener(LostApiClient client, LocationRequest request, LocationListener listener); void addPendingIntent(LostApiClient client, LocationRequest request, PendingIntent callbackIntent); void addLocationCallback(LostApiClient client, LocationRequest request, LocationCallback callback, Looper looper); <BUG>void removeListener(LostApiClient client, LocationListener listener); void removePendingIntent(LostApiClient client, PendingIntent callbackIntent); void removeLocationCallback(LostApiClient client, LocationCallback callback); </BUG> void reportLocationChanged(Location location);
boolean removeListener(LostApiClient client, LocationListener listener); boolean removePendingIntent(LostApiClient client, PendingIntent callbackIntent); boolean removeLocationCallback(LostApiClient client, LocationCallback callback);
18,428
import com.mapzen.android.lost.api.FusedLocationProviderApi; import com.mapzen.android.lost.api.LocationAvailability; import com.mapzen.android.lost.api.LocationCallback; import com.mapzen.android.lost.api.LocationListener; import com.mapzen.android.lost.api.LocationRequest; <BUG>import com.mapzen.android.lost.api.LostApiClient; import android.app.PendingIntent;</BUG> import android.content.ComponentName; import android.content.Context; import android.content.Intent;
import com.mapzen.android.lost.api.PendingResult; import com.mapzen.android.lost.api.Status; import android.app.PendingIntent;
18,429
package com.mapzen.android.lost.api; import android.app.Activity; import android.app.PendingIntent; import android.content.IntentSender; <BUG>public class Status { public static final int SUCCESS = 0;</BUG> public static final int RESOLUTION_REQUIRED = 6; public static final int INTERRUPTED = 14; public static final int INTERNAL_ERROR = 8;
public class Status implements Result { public static final int SUCCESS = 0;
18,430
import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.sun.source.tree.Tree; import com.sun.source.util.TreePath; import javax.annotation.Nullable; <BUG>final class TreeDifference { private final ImmutableList<OneWayDiff> extraExpectedNodes;</BUG> private final ImmutableList<OneWayDiff> extraActualNodes; private final ImmutableList<TwoWayDiff> differingNodes; TreeDifference() {
private static final String NO_LINE = "[unavailable]"; private final ImmutableList<OneWayDiff> extraExpectedNodes;
18,431
package com.google.testing.compile; <BUG>import static com.google.common.base.Preconditions.checkArgument; import com.sun.source.tree.CompilationUnitTree;</BUG> import com.sun.source.tree.LineMap; import com.sun.source.tree.Tree; import com.sun.source.util.SourcePositions;
import static javax.tools.Diagnostic.NOPOS; import com.sun.source.tree.CompilationUnitTree;
18,432
import org.codehaus.groovy.control.CompilationUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class GroovyTreeParser implements TreeParser { private static final Logger logger = LoggerFactory.getLogger(GroovyTreeParser.class); <BUG>private static final String GROOVY_DEFAULT_INTERFACE = "groovy.lang.GroovyObject"; private static final String JAVA_DEFAULT_OBJECT = "java.lang.Object"; private Map<URI, Set<SymbolInformation>> fileSymbols = Maps.newHashMap(); private Map<String, Set<SymbolInformation>> typeReferences = Maps.newHashMap();</BUG> private final Supplier<CompilationUnit> unitSupplier;
private Indexer indexer = new Indexer();
18,433
if (scriptClass != null) { sourceUnit.getAST().getStatementBlock().getVariableScope().getDeclaredVariables().values().forEach( variable -> { SymbolInformation symbol = getVariableSymbolInformation(scriptClass.getName(), sourceUri, variable); <BUG>addToValueSet(newTypeReferences, variable.getType().getName(), symbol); symbols.add(symbol); }); } newFileSymbols.put(workspaceUriSupplier.get(sourceUri), symbols);</BUG> });
newIndexer.addSymbol(sourceUnit.getSource().getURI(), symbol); if (classes.containsKey(variable.getType().getName())) { newIndexer.addReference(classes.get(variable.getType().getName()), GroovyLocations.createLocation(sourceUri, variable.getType()));
18,434
} if (typeReferences.containsKey(foundSymbol.getName())) { foundReferences.addAll(typeReferences.get(foundSymbol.getName()));</BUG> } <BUG>return foundReferences; }</BUG> @Override public Set<SymbolInformation> getFilteredSymbols(String query) { checkNotNull(query, "query must not be null"); Pattern pattern = getQueryPattern(query);
}); sourceUnit.getAST().getStatementBlock() .visit(new MethodVisitor(newIndexer, sourceUri, sourceUnit.getAST().getScriptClassDummy(), classes, Maps.newHashMap(), Optional.absent(), workspaceUriSupplier));
18,435
<BUG>package com.palantir.ls.server.api; import io.typefox.lsapi.ReferenceParams;</BUG> import io.typefox.lsapi.SymbolInformation; import java.net.URI; import java.util.Map;
import com.google.common.base.Optional; import io.typefox.lsapi.Location; import io.typefox.lsapi.Position; import io.typefox.lsapi.ReferenceParams;
18,436
import java.util.Map; import java.util.Set; public interface TreeParser { void parseAllSymbols(); Map<URI, Set<SymbolInformation>> getFileSymbols(); <BUG>Map<String, Set<SymbolInformation>> getTypeReferences(); Set<SymbolInformation> findReferences(ReferenceParams params); Set<SymbolInformation> getFilteredSymbols(String query);</BUG> }
Map<Location, Set<Location>> getReferences(); Set<Location> findReferences(ReferenceParams params); Optional<Location> gotoDefinition(URI uri, Position position); Set<SymbolInformation> getFilteredSymbols(String query);
18,437
.workspaceSymbolProvider(true) .referencesProvider(true) .completionProvider(new CompletionOptionsBuilder() .resolveProvider(false) .triggerCharacter(".") <BUG>.build()) .build();</BUG> InitializeResult result = new InitializeResultBuilder() .capabilities(capabilities) .build();
.definitionProvider(true)
18,438
package com.palantir.ls.server; import com.palantir.ls.server.api.CompilerWrapper; import com.palantir.ls.server.api.TreeParser; import com.palantir.ls.server.api.WorkspaceCompiler; <BUG>import io.typefox.lsapi.FileEvent; import io.typefox.lsapi.PublishDiagnosticsParams;</BUG> import io.typefox.lsapi.ReferenceParams; import io.typefox.lsapi.SymbolInformation; import io.typefox.lsapi.TextDocumentContentChangeEvent;
import com.google.common.base.Optional; import io.typefox.lsapi.Location; import io.typefox.lsapi.Position; import io.typefox.lsapi.PublishDiagnosticsParams;
18,439
if (second >= 60) { fail("timeout"); } try { if (selenium.isElementPresent( <BUG>"//input[@value='Post New Thread']")) { break;</BUG> } } catch (Exception e) {
"link=M\u00e9ssag\u00e9 Boards T\u00e9st Pag\u00e9")) { break;
18,440
RuntimeVariables.replace( "T\u00e9st M\u00e9ssag\u00e9 to b\u00e9 D\u00e9l\u00e9t\u00e9d")); selenium.type("_19_subject", RuntimeVariables.replace( "T\u00e9st M\u00e9ssag\u00e9 to b\u00e9 D\u00e9l\u00e9t\u00e9d")); <BUG>selenium.typeKeys("_19_textArea", RuntimeVariables.replace( "This m\u00e9ssag\u00e9 will b\u00e9 d\u00e9l\u00e9t\u00e9d!"));</BUG> selenium.type("_19_textArea", RuntimeVariables.replace(
[DELETED]
18,441
for (int second = 0;; second++) { if (second >= 60) { fail("timeout"); } try { <BUG>if (selenium.isElementPresent("//input[@value='Add Category']")) { break;</BUG> } } catch (Exception e) {
if (selenium.isElementPresent( "link=M\u00e9ssag\u00e9 Boards T\u00e9st Pag\u00e9")) { break;
18,442
return false; } @Nullable private static String generateInfo(PsiElement element, PsiElement atPointer) { final DocumentationProvider documentationProvider = DocumentationManager.getProviderFromElement(element, atPointer); <BUG>String info = documentationProvider.getQuickNavigateInfo(element, atPointer); if (info != null) {</BUG> return info; } if (element instanceof PsiFile) {
if (info == null) { info = getQuickNavigateInfo(element); if (info != null) {
18,443
final ItemPresentation presentation = ((NavigationItem)element).getPresentation(); if (presentation != null) { return presentation.getPresentableText(); } } <BUG>return getQuickNavigateInfo(element); }</BUG> @Nullable private static String getQuickNavigateInfo(PsiElement element) { final String name = ElementDescriptionUtil.getElementDescription(element, UsageViewShortNameLocation.INSTANCE);
return null;
18,444
private Table table; private Form form; private FieldFactory fieldFactory; private Class<T> entityClass; private Button commit; <BUG>private Button discard; public BasicCrudView(Class<T> entityClass) {</BUG> this.entityClass = entityClass; setSizeFull(); initContainer();
private Object[] formPropertyIds; private Button addButton; private Button deleteButton; public BasicCrudView(Class<T> entityClass) {
18,445
buildView(); } protected void initFieldFactory() { fieldFactory = new FieldFactory(); } <BUG>public FieldFactory getFieldFactory() { </BUG> return fieldFactory; } protected Table getTable() {
protected FieldFactory getFieldFactory() {
18,446
commit = new Button("Save", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { form.commit(); } <BUG>}); discard = new Button("Cancel", new Button.ClickListener() {</BUG> @Override public void buttonClick(ClickEvent event) { form.discard();
commit.setStyleName(Reindeer.BUTTON_DEFAULT); discard = new Button("Cancel", new Button.ClickListener() {
18,447
protected void initContainer() { container = JPAContainerFactory.make(getEntityClass(), TestLauncherApplication.PERSISTENCE_UNIT); table = new Table(null, container); } <BUG>public JPAContainer<T> getContainer() { </BUG> return container; } @Override
protected JPAContainer<T> getContainer() {
18,448
table.setValue(itemId); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); <BUG>} } else if (action == DELETE) { container.removeItem(target);</BUG> } }
[DELETED]
18,449
public class Invoice { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Temporal(TemporalType.TIMESTAMP) <BUG>private Date date; @ManyToOne</BUG> private Customer customer; @OneToMany(mappedBy = "invoice", cascade=CascadeType.ALL, orphanRemoval=true) private List<InvoiceRow> rows;
private Date date = new Date(); @ManyToOne
18,450
if (connect(isProducer)) { break; } } catch (InvalidSelectorException e) { throw new ConnectionException( <BUG>"Connection to JMS failed. Invalid message selector"); } catch (JMSException | NamingException e) { logger.log(LogLevel.ERROR, "RECONNECTION_EXCEPTION", </BUG> new Object[] { e.toString() });
Messages.getString("CONNECTION_TO_JMS_FAILED_INVALID_MSG_SELECTOR")); //$NON-NLS-1$ logger.log(LogLevel.ERROR, "RECONNECTION_EXCEPTION", //$NON-NLS-1$
18,451
private synchronized void createConnectionNoRetry() throws ConnectionException { if (!isConnectValid()) { try { connect(isProducer); } catch (JMSException e) { <BUG>logger.log(LogLevel.ERROR, "Connection to JMS failed", new Object[] { e.toString() }); throw new ConnectionException( "Connection to JMS failed. Did not try to reconnect as the policy is reconnection policy does not apply here."); }</BUG> }
logger.log(LogLevel.ERROR, "CONNECTION_TO_JMS_FAILED", new Object[] { e.toString() }); //$NON-NLS-1$ Messages.getString("CONNECTION_TO_JMS_FAILED_NO_RECONNECT_AS_RECONNECT_POLICY_DOES_NOT_APPLY")); //$NON-NLS-1$
18,452
boolean res = false; int count = 0; do { try { if(count > 0) { <BUG>logger.log(LogLevel.INFO, "ATTEMPT_TO_RESEND_MESSAGE", new Object[] { count }); </BUG> Thread.sleep(messageRetryDelay); } synchronized (getSession()) {
logger.log(LogLevel.INFO, "ATTEMPT_TO_RESEND_MESSAGE", new Object[] { count }); //$NON-NLS-1$
18,453
getProducer().send(message); res = true; } } catch (JMSException e) { <BUG>logger.log(LogLevel.WARN, "ERROR_DURING_SEND", new Object[] { e.toString() }); logger.log(LogLevel.INFO, "ATTEMPT_TO_RECONNECT"); </BUG> setConnect(null);
logger.log(LogLevel.WARN, "ERROR_DURING_SEND", new Object[] { e.toString() }); //$NON-NLS-1$ logger.log(LogLevel.INFO, "ATTEMPT_TO_RECONNECT"); //$NON-NLS-1$
18,454
import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import com.ibm.streams.operator.Attribute; import com.ibm.streams.operator.StreamSchema; import com.ibm.streams.operator.Type; <BUG>import com.ibm.streams.operator.Type.MetaType; class ConnectionDocumentParser {</BUG> private static final Set<String> supportedSPLTypes = new HashSet<String>(Arrays.asList("int8", "uint8", "int16", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ "uint16", "int32", "uint32", "int64", "float32", "float64", "boolean", "blob", "rstring", "uint64", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ "decimal32", "decimal64", "decimal128", "ustring", "timestamp", "xml")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
import com.ibm.streamsx.messaging.jms.Messages; class ConnectionDocumentParser {
18,455
return msgClass; } private void convertProviderURLPath(File applicationDir) throws ParseConnectionDocumentException { if(!isAMQ()) { if(this.providerURL == null || this.providerURL.trim().length() == 0) { <BUG>throw new ParseConnectionDocumentException("A value must be specified for provider_url attribute in connection document"); }</BUG> try { URL url = new URL(providerURL); if("file".equalsIgnoreCase(url.getProtocol())) { //$NON-NLS-1$
throw new ParseConnectionDocumentException(Messages.getString("PROVIDER_URL_MUST_BE_SPECIFIED_IN_CONN_DOC")); //$NON-NLS-1$
18,456
URL absProviderURL = new URL(url.getProtocol(), url.getHost(), applicationDir.getAbsolutePath() + File.separator + path); this.providerURL = absProviderURL.toExternalForm(); } } } catch (MalformedURLException e) { <BUG>throw new ParseConnectionDocumentException("Invalid provider_url value detected: " + e.getMessage()); }</BUG> } } public void parseAndValidateConnectionDocument(String connectionDocument, String connection, String access,
throw new ParseConnectionDocumentException(Messages.getString("INVALID_PROVIDER_URL", e.getMessage())); //$NON-NLS-1$
18,457
for (int j = 0; j < accessSpecChildNodes.getLength(); j++) { if (accessSpecChildNodes.item(j).getNodeName().equals("destination")) { //$NON-NLS-1$ destIndex = j; } else if (accessSpecChildNodes.item(j).getNodeName().equals("uses_connection")) { //$NON-NLS-1$ if (!connection.equals(accessSpecChildNodes.item(j).getAttributes().getNamedItem("connection") //$NON-NLS-1$ <BUG>.getNodeValue())) { throw new ParseConnectionDocumentException("The value of the connection parameter " + connection + " is not the same as the connection used by access element " + access + " as mentioned in the uses_connection element in connections document");</BUG> }
throw new ParseConnectionDocumentException(Messages.getString("VALUE_OF_CONNECTION_PARAM_NOT_THE_SAME_AS_CONN_USED_BY_ACCESS_ELEMENT", connection, access )); //$NON-NLS-1$
18,458
nativeSchema = access_specification.item(i).getChildNodes().item(nativeSchemaIndex); } break; } } <BUG>if (!accessFound) { throw new ParseConnectionDocumentException("The value of the access parameter " + access + " is not found in the connections document");</BUG> } return nativeSchema;
throw new ParseConnectionDocumentException(Messages.getString("VALUE_OF_ACCESS_PARAM_NOT_FOUND_IN_CONN_DOC", access )); //$NON-NLS-1$
18,459
nativeAttrLength = Integer.parseInt((attrList.item(i).getAttributes().getNamedItem("length") //$NON-NLS-1$ .getNodeValue())); } if ((msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22) && ((streamSchema.getAttribute(nativeAttrName) != null) && (streamSchema <BUG>.getAttribute(nativeAttrName).getType().getMetaType() == Type.MetaType.BLOB))) { throw new ParseConnectionDocumentException(" Blob data type is not supported for message class " + msgClass);</BUG> } Iterator<NativeSchema> it = nativeSchemaObjects.iterator();
throw new ParseConnectionDocumentException(Messages.getString("BLOB_NOT_SUPPORTED_FOR_MSG_CLASS", msgClass)); //$NON-NLS-1$
18,460
throw new ParseConnectionDocumentException(" Blob data type is not supported for message class " + msgClass);</BUG> } Iterator<NativeSchema> it = nativeSchemaObjects.iterator(); while (it.hasNext()) { <BUG>if (it.next().getName().equals(nativeAttrName)) { throw new ParseConnectionDocumentException("Parameter name: " + nativeAttrName + " is appearing more than once In native schema file");</BUG> } }
nativeAttrLength = Integer.parseInt((attrList.item(i).getAttributes().getNamedItem("length") //$NON-NLS-1$ .getNodeValue())); if ((msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22) && ((streamSchema.getAttribute(nativeAttrName) != null) && (streamSchema .getAttribute(nativeAttrName).getType().getMetaType() == Type.MetaType.BLOB))) { throw new ParseConnectionDocumentException(Messages.getString("BLOB_NOT_SUPPORTED_FOR_MSG_CLASS", msgClass)); //$NON-NLS-1$ throw new ParseConnectionDocumentException(Messages.getString("PARAMETER_NOT_UNIQUE_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
18,461
if (msgClass == MessageClass.text) { typesWithLength = new HashSet<String>(Arrays.asList("Bytes")); //$NON-NLS-1$ } Set<String> typesWithoutLength = new HashSet<String>(Arrays.asList("Byte", "Short", "Int", "Long", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ "Float", "Double", "Boolean")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ <BUG>if (typesWithoutLength.contains(nativeAttrType) && nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) { throw new ParseConnectionDocumentException("Length attribute should not be present for parameter: " + nativeAttrName + " In native schema file");</BUG> } if ((nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA)
throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
18,462
if ((nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) && (msgClass == MessageClass.wbe || msgClass == MessageClass.wbe22 || msgClass == MessageClass.xml) && (streamSchema.getAttribute(nativeAttrName) != null) && (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.RSTRING) && (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.USTRING) <BUG>&& (streamSchema.getAttribute(nativeAttrName).getType().getMetaType() != Type.MetaType.BLOB)) { throw new ParseConnectionDocumentException("Length attribute should not be present for parameter: " + nativeAttrName + " In native schema file");</BUG> } if (streamSchema.getAttribute(nativeAttrName) != null) {
throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA", nativeAttrName )); //$NON-NLS-1$
18,463
if (streamSchema.getAttribute(nativeAttrName) != null) { MetaType metaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType(); if (metaType == Type.MetaType.DECIMAL32 || metaType == Type.MetaType.DECIMAL64 || metaType == Type.MetaType.DECIMAL128 || metaType == Type.MetaType.TIMESTAMP) { if (nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) { <BUG>throw new ParseConnectionDocumentException( "Length attribute should not be present for parameter: " + nativeAttrName + " with type " + metaType + " in native schema file.");</BUG> } if (msgClass == MessageClass.bytes) {
Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_WITH_TYPE_IN_NATIVE_SCHEMA", nativeAttrName, metaType )); //$NON-NLS-1$
18,464
nativeAttrLength = -4; } } } if (typesWithLength.contains(nativeAttrType)) { <BUG>if (nativeAttrLength == LENGTH_ABSENT_IN_NATIVE_SCHEMA && msgClass == MessageClass.bytes) { throw new ParseConnectionDocumentException("Length attribute should be present for parameter: " + nativeAttrName + " In native schema file for message class bytes");</BUG> } if ((nativeAttrLength < 0) && nativeAttrLength != LENGTH_ABSENT_IN_NATIVE_SCHEMA) {
throw new ParseConnectionDocumentException(Messages.getString("LENGTH_ATTRIB_SHOULD_NOT_BE_PRESENT_FOR_PARAM_IN_NATIVE_SCHEMA_FOR_MSG_CLASS_BYTES", nativeAttrName )); //$NON-NLS-1$
18,465
if (streamSchema.getAttribute(nativeAttrName) != null) { streamAttrName = streamSchema.getAttribute(nativeAttrName).getName(); streamAttrMetaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType(); if ((msgClass == MessageClass.stream || msgClass == MessageClass.map) && !mapSPLToNativeSchemaDataTypesForOtherMsgClass.get(streamAttrMetaType.getLanguageType()) <BUG>.equals(nativeAttrType)) { throw new ParseConnectionDocumentException("Attribute Name: " + nativeAttrName + " with type:" + nativeAttrType + " in the native schema cannot be mapped with attribute: " + streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG> }
throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$
18,466
+ nativeAttrType + " in the native schema cannot be mapped with attribute: " + streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG> } else if (msgClass == MessageClass.bytes && !mapSPLToNativeSchemaDataTypesForBytes.get(streamAttrMetaType.getLanguageType()).equals( <BUG>nativeAttrType)) { throw new ParseConnectionDocumentException("Attribute Name: " + nativeAttrName + " with type:" + nativeAttrType + " in the native schema cannot be mapped with attribute: " + streamAttrName + " with type : " + streamAttrMetaType.getLanguageType());</BUG> }
if (streamSchema.getAttribute(nativeAttrName) != null) { streamAttrName = streamSchema.getAttribute(nativeAttrName).getName(); streamAttrMetaType = streamSchema.getAttribute(nativeAttrName).getType().getMetaType(); if ((msgClass == MessageClass.stream || msgClass == MessageClass.map) && !mapSPLToNativeSchemaDataTypesForOtherMsgClass.get(streamAttrMetaType.getLanguageType()) .equals(nativeAttrType)) { throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$ throw new ParseConnectionDocumentException(Messages.getString("ATTRIB_WITH_TYPE_IN_NATIVE_SCHEMA_CANNOT_BE_MAPPED_TO_ATTRIB_WITH_TYPE", nativeAttrName, nativeAttrType, streamAttrName, streamAttrMetaType.getLanguageType())); //$NON-NLS-1$
18,467
package com.ibm.streamsx.messaging.i18n; import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; public class Messages { <BUG>private static final String BUNDLE_NAME = "com.ibm.streamsx.messaging.mqtt.MQTTMessages"; //$NON-NLS-1$ </BUG> private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle .getBundle(BUNDLE_NAME); private Messages() {
private static final String BUNDLE_NAME = "com.ibm.streamsx.messaging.i18n.CommonMessages"; //$NON-NLS-1$
18,468
JButton mCancelButton = null; JList mTypeList = null; DefaultListModel mListModel = null; JTable mTable = null; UserMapType mCurType = null; <BUG>DefaultTableModel mTableModel = null; boolean mIsOkay = false; public MapTypeDialog( LWMap pMap) {</BUG> super(); mMap = pMap;
PropertyTableModel mPropertyTableModel = null; JComboBox mTypeEditor = null; int mCount = 0; public MapTypeDialog( LWMap pMap) {
18,469
mRemoveTypeButton.enable( mTypeList.getSelectedIndex() >= 0); } } private void setUserType( UserMapType pType) { if( mCurType != pType) { <BUG>mCurType = pType; }</BUG> } private UserMapType getUserType() { return mCurType;
mPropertyTableModel.setUserType( pType);
18,470
UserMapType type = null; if( obj instanceof UserMapType) { type = (UserMapType) obj; } setUserType( type); <BUG>} updateEnabledStates();</BUG> } public void actionPerformed( ActionEvent pEvent) { Object source = pEvent.getSource();
if( source == mTable) { System.out.println( "table selection."); updateEnabledStates();
18,471
import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import com.appboy.configuration.XmlAppConfigurationProvider; <BUG>import com.appboy.push.AppboyNotificationUtils; public final class AppboyGcmReceiver extends BroadcastReceiver {</BUG> private static final String TAG = String.format("%s.%s", Constants.APPBOY_LOG_TAG_PREFIX, AppboyGcmReceiver.class.getName()); private static final String GCM_RECEIVE_INTENT_ACTION = "com.google.android.c2dm.intent.RECEIVE"; private static final String GCM_REGISTRATION_INTENT_ACTION = "com.google.android.c2dm.intent.REGISTRATION";
import com.appboy.support.AppboyLogger; public final class AppboyGcmReceiver extends BroadcastReceiver {
18,472
private static final String GCM_DELETED_MESSAGES_KEY = "deleted_messages"; private static final String GCM_NUMBER_OF_MESSAGES_DELETED_KEY = "total_deleted"; public static final String CAMPAIGN_ID_KEY = Constants.APPBOY_PUSH_CAMPAIGN_ID_KEY; @Override public void onReceive(Context context, Intent intent) { <BUG>Log.i(TAG, String.format("Received broadcast message. Message: %s", intent.toString())); </BUG> String action = intent.getAction(); if (GCM_REGISTRATION_INTENT_ACTION.equals(action)) { XmlAppConfigurationProvider appConfigurationProvider = new XmlAppConfigurationProvider(context);
AppboyLogger.i(TAG, String.format("Received broadcast message. Message: %s", intent.toString()));
18,473
} else if (Constants.APPBOY_CANCEL_NOTIFICATION_ACTION.equals(action) && intent.hasExtra(Constants.APPBOY_CANCEL_NOTIFICATION_TAG)) { int notificationId = intent.getIntExtra(Constants.APPBOY_CANCEL_NOTIFICATION_TAG, Constants.APPBOY_DEFAULT_NOTIFICATION_ID); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancel(Constants.APPBOY_PUSH_NOTIFICATION_TAG, notificationId); } else { <BUG>Log.w(TAG, String.format("The GCM receiver received a message not sent from Appboy. Ignoring the message.")); </BUG> } } boolean handleRegistrationIntent(Context context, Intent intent) {
AppboyLogger.w(TAG, String.format("The GCM receiver received a message not sent from Appboy. Ignoring the message."));
18,474
Log.e(TAG, "Device does not support GCM."); } else if ("INVALID_PARAMETERS".equals(error)) { Log.e(TAG, "The request sent by the device does not contain the expected parameters. This phone does not " + "currently support GCM."); } else { <BUG>Log.w(TAG, String.format("Received an unrecognised GCM registration error type. Ignoring. Error: %s", error)); </BUG> } } else if (registrationId != null) { Appboy.getInstance(context).registerAppboyPushMessages(registrationId);
AppboyLogger.w(TAG, String.format("Received an unrecognised GCM registration error type. Ignoring. Error: %s", error));
18,475
} else if (registrationId != null) { Appboy.getInstance(context).registerAppboyPushMessages(registrationId); } else if (intent.hasExtra(GCM_UNREGISTERED_KEY)) { Appboy.getInstance(context).unregisterAppboyPushMessages(); } else { <BUG>Log.w(TAG, "The GCM registration message is missing error information, registration id, and unregistration " + </BUG> "confirmation. Ignoring."); return false; }
AppboyLogger.w(TAG, "The GCM registration message is missing error information, registration id, and unregistration " +
18,476
if (GCM_DELETED_MESSAGES_KEY.equals(messageType)) { int totalDeleted = intent.getIntExtra(GCM_NUMBER_OF_MESSAGES_DELETED_KEY, -1); if (totalDeleted == -1) { Log.e(TAG, String.format("Unable to parse GCM message. Intent: %s", intent.toString())); } else { <BUG>Log.i(TAG, String.format("GCM deleted %d messages. Fetch them from Appboy.", totalDeleted)); </BUG> } return false; } else {
AppboyLogger.i(TAG, String.format("GCM deleted %d messages. Fetch them from Appboy.", totalDeleted));
18,477
package com.appboy; import android.content.BroadcastReceiver; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; <BUG>import android.util.Log; import android.content.Context;</BUG> import android.app.Notification; import android.app.NotificationManager; import com.appboy.configuration.XmlAppConfigurationProvider;
import com.appboy.support.AppboyLogger; import android.content.Context;
18,478
} else if (Constants.APPBOY_CANCEL_NOTIFICATION_ACTION.equals(action) && intent.hasExtra(Constants.APPBOY_CANCEL_NOTIFICATION_TAG)) { int notificationId = intent.getIntExtra(Constants.APPBOY_CANCEL_NOTIFICATION_TAG, Constants.APPBOY_DEFAULT_NOTIFICATION_ID); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancel(Constants.APPBOY_PUSH_NOTIFICATION_TAG, notificationId); } else { <BUG>Log.w(TAG, String.format("The ADM receiver received a message not sent from Appboy. Ignoring the message.")); </BUG> } } boolean handleRegistrationIntent(Context context, Intent intent) {
AppboyLogger.w(TAG, String.format("The ADM receiver received a message not sent from Appboy. Ignoring the message."));
18,479
Notification notification = null; IAppboyNotificationFactory appboyNotificationFactory = AppboyNotificationUtils.getActiveNotificationFactory(); try { notification = appboyNotificationFactory.createNotification(appConfigurationProvider, context, admExtras, appboyExtras); } catch(Exception e) { <BUG>Log.e(TAG, "Failed to create notification.", e); </BUG> return false; } if (notification == null) {
AppboyLogger.e(TAG, "Failed to create notification.", e);
18,480
package com.appboy; import android.graphics.Bitmap; import android.graphics.BitmapFactory; <BUG>import android.util.Log; import java.io.InputStream;</BUG> import java.net.MalformedURLException; import java.net.UnknownHostException; public class AppboyImageUtils {
import com.appboy.support.AppboyLogger; import java.io.InputStream;
18,481
public class AppboyImageUtils { private static final String TAG = String.format("%s.%s", Constants.APPBOY_LOG_TAG_PREFIX, AppboyImageUtils.class.getName()); public static final int BASELINE_SCREEN_DPI = 160; public static Bitmap downloadImageBitmap(String imageUrl) { if (imageUrl == null || imageUrl.length() == 0) { <BUG>Log.i(TAG, "Null or empty Url string passed to image bitmap download. Not attempting download."); </BUG> return null; } Bitmap bitmap = null;
AppboyLogger.i(TAG, "Null or empty Url string passed to image bitmap download. Not attempting download.");
18,482
package com.cronutils.model.time.generator; import java.util.Collections; <BUG>import java.util.List; import org.apache.commons.lang3.Validate;</BUG> import com.cronutils.model.field.CronField; import com.cronutils.model.field.expression.FieldExpression; public abstract class FieldValueGenerator {
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
18,483
import java.util.ResourceBundle; import java.util.function.Function;</BUG> class DescriptionStrategyFactory { private DescriptionStrategyFactory() {} public static DescriptionStrategy daysOfWeekInstance(final ResourceBundle bundle, final FieldExpression expression) { <BUG>final Function<Integer, String> nominal = integer -> new DateTime().withDayOfWeek(integer).dayOfWeek().getAsText(bundle.getLocale()); </BUG> NominalDescriptionStrategy dow = new NominalDescriptionStrategy(bundle, nominal, expression); dow.addDescription(fieldExpression -> { if (fieldExpression instanceof On) {
import java.util.function.Function; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.model.field.expression.On; final Function<Integer, String> nominal = integer -> DayOfWeek.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale());
18,484
return dom; } public static DescriptionStrategy monthsInstance(final ResourceBundle bundle, final FieldExpression expression) { return new NominalDescriptionStrategy( bundle, <BUG>integer -> new DateTime().withMonthOfYear(integer).monthOfYear().getAsText(bundle.getLocale()), expression</BUG> ); } public static DescriptionStrategy plainInstance(ResourceBundle bundle, final FieldExpression expression) {
integer -> Month.of(integer).getDisplayName(TextStyle.FULL, bundle.getLocale()), expression
18,485
<BUG>package com.cronutils.model.time.generator; import com.cronutils.mapper.WeekDay;</BUG> import com.cronutils.model.field.CronField; import com.cronutils.model.field.CronFieldName; import com.cronutils.model.field.constraint.FieldConstraintsBuilder;
import java.time.LocalDate; import java.util.Collections; import java.util.List; import java.util.Set; import org.apache.commons.lang3.Validate; import com.cronutils.mapper.WeekDay;
18,486
import com.cronutils.model.field.expression.Between; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.parser.CronParserField; import com.google.common.collect.Lists; import com.google.common.collect.Sets; <BUG>import org.apache.commons.lang3.Validate; import org.joda.time.DateTime; import java.util.Collections; import java.util.List; import java.util.Set;</BUG> class BetweenDayOfWeekValueGenerator extends FieldValueGenerator {
[DELETED]
18,487
<BUG>package com.cronutils.model.time.generator; import com.cronutils.model.field.CronField;</BUG> import com.cronutils.model.field.CronFieldName; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.model.field.expression.On;
import java.time.DayOfWeek; import java.time.LocalDate; import java.util.List; import org.apache.commons.lang3.Validate; import com.cronutils.model.field.CronField;
18,488
import com.cronutils.model.field.CronField;</BUG> import com.cronutils.model.field.CronFieldName; import com.cronutils.model.field.expression.FieldExpression; import com.cronutils.model.field.expression.On; import com.google.common.collect.Lists; <BUG>import org.apache.commons.lang3.Validate; import org.joda.time.DateTime; import java.util.List;</BUG> class OnDayOfMonthValueGenerator extends FieldValueGenerator { private int year;
package com.cronutils.model.time.generator; import java.time.DayOfWeek; import java.time.LocalDate; import java.util.List; import com.cronutils.model.field.CronField;
18,489
class OnDayOfMonthValueGenerator extends FieldValueGenerator { private int year; private int month; public OnDayOfMonthValueGenerator(CronField cronField, int year, int month) { super(cronField); <BUG>Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of month"); this.year = year;</BUG> this.month = month; }
Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()), "CronField does not belong to day of" + " month"); this.year = year;
18,490
package com.cronutils.mapper; public class ConstantsMapper { private ConstantsMapper() {} public static final WeekDay QUARTZ_WEEK_DAY = new WeekDay(2, false); <BUG>public static final WeekDay JODATIME_WEEK_DAY = new WeekDay(1, false); </BUG> public static final WeekDay CRONTAB_WEEK_DAY = new WeekDay(1, true); public static int weekDayMapping(WeekDay source, WeekDay target, int weekday){ return source.mapTo(weekday, target);
public static final WeekDay JAVA8 = new WeekDay(1, false);
18,491
return nextMatch; } catch (NoSuchValueException e) { throw new IllegalArgumentException(e); } } <BUG>DateTime nextClosestMatch(DateTime date) throws NoSuchValueException { </BUG> List<Integer> year = yearsValueGenerator.generateCandidates(date.getYear(), date.getYear()); TimeNode days = null; int lowestMonth = months.getValues().get(0);
ZonedDateTime nextClosestMatch(ZonedDateTime date) throws NoSuchValueException {
18,492
boolean questionMarkSupported = cronDefinition.getFieldDefinition(DAY_OF_WEEK).getConstraints().getSpecialChars().contains(QUESTION_MARK); if(questionMarkSupported){ return new TimeNode( generateDayCandidatesQuestionMarkSupported( <BUG>date.getYear(), date.getMonthOfYear(), </BUG> ((DayOfWeekFieldDefinition) cronDefinition.getFieldDefinition(DAY_OF_WEEK) ).getMondayDoWValue()
date.getYear(), date.getMonthValue(),
18,493
) ); }else{ return new TimeNode( generateDayCandidatesQuestionMarkNotSupported( <BUG>date.getYear(), date.getMonthOfYear(), </BUG> ((DayOfWeekFieldDefinition) cronDefinition.getFieldDefinition(DAY_OF_WEEK) ).getMondayDoWValue()
date.getYear(), date.getMonthValue(),
18,494
} public DateTime lastExecution(DateTime date){ </BUG> Validate.notNull(date); try { <BUG>DateTime previousMatch = previousClosestMatch(date); </BUG> if(previousMatch.equals(date)){ previousMatch = previousClosestMatch(date.minusSeconds(1)); }
public java.time.Duration timeToNextExecution(ZonedDateTime date){ return java.time.Duration.between(date, nextExecution(date)); public ZonedDateTime lastExecution(ZonedDateTime date){ ZonedDateTime previousMatch = previousClosestMatch(date);
18,495
return previousMatch; } catch (NoSuchValueException e) { throw new IllegalArgumentException(e); } } <BUG>public Duration timeFromLastExecution(DateTime date){ return new Interval(lastExecution(date), date).toDuration(); } public boolean isMatch(DateTime date){ </BUG> return nextExecution(lastExecution(date)).equals(date);
[DELETED]
18,496
<BUG>package com.cronutils.model.time.generator; import com.cronutils.model.field.CronField;</BUG> import com.cronutils.model.field.expression.Every; import com.cronutils.model.field.expression.FieldExpression; import com.google.common.annotations.VisibleForTesting;
import java.time.ZonedDateTime; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.cronutils.model.field.CronField;
18,497
import com.cronutils.model.field.CronField;</BUG> import com.cronutils.model.field.expression.Every; import com.cronutils.model.field.expression.FieldExpression; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; <BUG>import org.joda.time.DateTime; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List;</BUG> class EveryFieldValueGenerator extends FieldValueGenerator {
package com.cronutils.model.time.generator; import java.time.ZonedDateTime; import java.util.List; import com.cronutils.model.field.CronField;
18,498
private static final Logger log = LoggerFactory.getLogger(EveryFieldValueGenerator.class); public EveryFieldValueGenerator(CronField cronField) { super(cronField); log.trace(String.format( "processing \"%s\" at %s", <BUG>cronField.getExpression().asString(), DateTime.now() </BUG> )); } @Override
cronField.getExpression().asString(), ZonedDateTime.now()
18,499
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.DigestOutputStream; import java.security.MessageDigest; <BUG>import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Collections; import java.util.List;</BUG> public final class PatchUtils {
import java.text.DateFormat; import java.util.Date; import java.util.List;
18,500
package org.jboss.as.patching.runner; <BUG>import org.jboss.as.boot.DirectoryStructure; import org.jboss.as.patching.LocalPatchInfo;</BUG> import org.jboss.as.patching.PatchInfo; import org.jboss.as.patching.PatchLogger; import org.jboss.as.patching.PatchMessages;
import static org.jboss.as.patching.runner.PatchUtils.generateTimestamp; import org.jboss.as.patching.CommonAttributes; import org.jboss.as.patching.LocalPatchInfo;