_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q13300
ConnectionFactory.getConnection
train
public static Connection getConnection(final String jndiName) throws FactoryException { Validate.notBlank(jndiName, "The validated character sequence 'jndiName' is null or empty"); // no need for defensive copies of Strings try { return DataSourceFactory.getDataSource(...
java
{ "resource": "" }
q13301
QueryRequest.query
train
public static QueryRequest query(String key, Object value) { return QueryRequest.create().addParameter(key, value); }
java
{ "resource": "" }
q13302
QueryRequest.addParameter
train
public QueryRequest addParameter(String key, Object value) { if (parameters.get(key) == null) { parameters.put(key, Sets.newHashSet(value)); } else { parameters.get(key).add(value); } return this; }
java
{ "resource": "" }
q13303
DefaultJPADao.analyzeParamMap
train
@SuppressWarnings({ "rawtypes", "unchecked" }) private Predicate[] analyzeParamMap(CriteriaBuilder criteriaBuilder, Root from, Map<String, Object> param) { List<Predicate> predicates = new ArrayList<Predicate>(); for (Map.Entry<String, Object> entry : param.entrySet()) { String key = en...
java
{ "resource": "" }
q13304
JdbcTarget.batchImport
train
private void batchImport() { m_jdbcTemplate.batchUpdate(createInsertQuery(), new BatchPreparedStatementSetter() { public void setValues( PreparedStatement ps, int i) ...
java
{ "resource": "" }
q13305
JdbcTarget.createInsertQuery
train
private String createInsertQuery() { StringBuilder query = new StringBuilder(); query.append("insert into ").append(m_tableName) .append("(").append(m_propertyNames[0]); for (int i = 1; i < m_propertyNames.length; i++) { query.append(",").append(m_propertyNames[i...
java
{ "resource": "" }
q13306
AccessorUtils.findMethodWithAnnotation
train
public static <T extends Annotation> Method findMethodWithAnnotation(Class<?> clazz, Class<T> annotationType) { Method annotatedMethod = null; for (Method method : clazz.getDeclaredMethods()) { T annotation = AnnotationUtils.findAnnotation(method, annotationType); if (annotation ...
java
{ "resource": "" }
q13307
AccessorUtils.invokeMethod
train
public static Object invokeMethod(Object object, Method method, Object... args) throws Throwable { try { return method.invoke(object, args); } catch (InvocationTargetException e) { throw e.getTargetException(); } }
java
{ "resource": "" }
q13308
AccessorUtils.validateReturnType
train
public static void validateReturnType(Method method, Class<? extends Annotation> annotationType, Class<?> expectedReturnType) { if (!method.getReturnType().equals(expectedReturnType)) { throw new BeanCreationException("Method " + method.getName() + " annotat...
java
{ "resource": "" }
q13309
AccessorUtils.validateArgument
train
public static void validateArgument(Method method, Class<? extends Annotation> annotationType, Class<?> expectedParameterType) { if (method.getParameterTypes().length != 1 || !method.getParameterTypes()[0].equals(expectedParameterType)) { throw new BeanCreatio...
java
{ "resource": "" }
q13310
BinaryPut.getValue
train
protected Object getValue() { Object value = this.value; if (value == null) { this.value = value = fromBinary("value"); } return value; }
java
{ "resource": "" }
q13311
ZooKeeperConfiguration.newCurator
train
public CuratorFramework newCurator() { // Make all of the curator threads daemon threads so they don't block the JVM from terminating. Also label them // with the ensemble they're connecting to, in case someone is trying to sort through a thread dump. ThreadFactory threadFactory = new ThreadFac...
java
{ "resource": "" }
q13312
GenericUtils.getTypeArgument
train
public static Class<?> getTypeArgument(Class<?> clazz, Class<?> interfce) { Map<Type, Type> resolvedTypes = new HashMap<Type, Type>(); Type type = clazz; while (!declaresInterface(getClass(type), interfce)) { if (type instanceof Class) { type = ((Class<?>) type).getGenericSuperclass(); } else { P...
java
{ "resource": "" }
q13313
EntryFactory.assignmentStructure
train
public static List<Entry> assignmentStructure(Assignment assignment) { List<Entry> entryList = new LinkedList<>(); entryList.add(namedObject(DnFactory.assignment(assignment))); entryList.add(namedDescriptiveObject(DnFactory.assignmentProject(assignment), assignment.getProject())); entryL...
java
{ "resource": "" }
q13314
EntryFactory.permissionStructure
train
public static List<Entry> permissionStructure(Permission permission) { List<Entry> entryList = new LinkedList<>(); entryList.add(namedObject(DnFactory.permission(permission))); entryList.add(namedDescriptiveObject(DnFactory.permissionAction(permission), permission.getAction())); entryLis...
java
{ "resource": "" }
q13315
EntryFactory.projectStructure
train
public static List<Entry> projectStructure(Project project) { List<Entry> entryList = new LinkedList<>(); entryList.add(namedObject(DnFactory.project(project))); entryList.addAll(createProjectAttributesEntries(project)); return entryList; }
java
{ "resource": "" }
q13316
EntryFactory.roleStructure
train
public static List<Entry> roleStructure(Role role) { List<Entry> entryList = new LinkedList<>(); entryList.add(namedObject(DnFactory.role(role))); entryList.addAll(createRolePermissionsEntries(role)); entryList.addAll(createRoleSubrolesEntries(role)); return entryList; }
java
{ "resource": "" }
q13317
PlotBoxTLSmall.getBufferedImage
train
public BufferedImage getBufferedImage(int width, int height) { BufferedImage bi = chart.createBufferedImage(width, height); return bi; }
java
{ "resource": "" }
q13318
PlotBoxTLSmall.createChart
train
@SuppressWarnings("deprecation") private JFreeChart createChart(CategoryDataset dataset) { // String s = name; String s = null; String tit = null; String ax = null; // if (first) // tit = title + " (EST)"; // else if (last) // ax = "Time"; tit = this.name; chart = ChartFactory...
java
{ "resource": "" }
q13319
PlotBoxTLSmall.createDataset
train
private CategoryDataset createDataset() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); startTimes = new Long[stl.getPulses().length+1]; startTimes[0] = new Long(0); for( int i = 1 ; i < startTimes.length ; i++ ) { startTimes[i] = stl.getPulses()[i-1]; } durations = new Lo...
java
{ "resource": "" }
q13320
LdapUtils.extractAttributeEmptyCheck
train
public static String extractAttributeEmptyCheck(Entry entry, String attributeType) { Attribute attribute = entry.get(attributeType); Attribute emptyFlagAttribute = entry.get(SchemaConstants.EMPTY_FLAG_ATTRIBUTE); boolean empty = false; try { if (attribute != null) { ...
java
{ "resource": "" }
q13321
LdapUtils.extractAttributeEmptyCheck
train
public static List<String> extractAttributeEmptyCheck(List<Entry> entries, String attributeType) { List<String> result = new LinkedList<String>(); for (Entry e : entries) { result.add(extractAttributeEmptyCheck(e, attributeType)); } return result; }
java
{ "resource": "" }
q13322
LdapUtils.extractAttributeEmptyCheck
train
public static List<String> extractAttributeEmptyCheck(SearchCursor cursor, String attributeType) { List<String> result = new LinkedList<String>(); try { while (cursor.next()) { Entry entry = cursor.getEntry(); result.add(extractAttributeEmptyCheck(entry, attri...
java
{ "resource": "" }
q13323
Diff.createObjectDiffs
train
private void createObjectDiffs() throws EDBException { diff = new HashMap<String, EDBObjectDiff>(); List<EDBObject> tempList = new ArrayList<EDBObject>(); for (EDBObject o : this.endState) { tempList.add(o); } addModifiedOrDeletedObjects(tempList); addNewObje...
java
{ "resource": "" }
q13324
Diff.addModifiedOrDeletedObjects
train
private void addModifiedOrDeletedObjects(List<EDBObject> tempList) { for (EDBObject a : this.startState) { String oid = a.getOID(); EDBObject b = removeIfExist(oid, tempList); ObjectDiff odiff = new ObjectDiff(this.startCommit, this.endCommit, a, b); if (odiff.get...
java
{ "resource": "" }
q13325
Diff.addNewObjects
train
private void addNewObjects(List<EDBObject> tempList) { for (EDBObject b : tempList) { String oid = b.getOID(); ObjectDiff odiff = new ObjectDiff(this.startCommit, this.endCommit, null, b); if (odiff.getDifferenceCount() > 0) { diff.put(oid, odiff); ...
java
{ "resource": "" }
q13326
Diff.removeIfExist
train
private EDBObject removeIfExist(String oid, List<EDBObject> tempList) { Iterator<EDBObject> iterator = tempList.iterator(); while (iterator.hasNext()) { EDBObject obj = iterator.next(); if (obj.getOID().equals(oid)) { iterator.remove(); return obj;...
java
{ "resource": "" }
q13327
RCCConstraintSolver.compareRelation
train
private boolean compareRelation(RCCConstraint first, RCCConstraint second) { boolean existed = false; for (int i = 0; i < first.types.length; i++) { existed = false; for (int j = 0; j < second.types.length; j++) { if(first.types[i] == second.types[j]) existed = true; } if(!exist...
java
{ "resource": "" }
q13328
PersistInterfaceService.runPersistingLogic
train
private void runPersistingLogic(EKBCommit commit, boolean check, UUID expectedContextHeadRevision, boolean headRevisionCheck) throws SanityCheckException, EKBException { String contextId = ContextHolder.get().getCurrentContextId(); try { lockContext(contextId); if (he...
java
{ "resource": "" }
q13329
PersistInterfaceService.performRevertLogic
train
private void performRevertLogic(String revision, UUID expectedContextHeadRevision, boolean expectedHeadCheck) { String contextId = ""; try { EDBCommit commit = edbService.getCommitByRevision(revision); contextId = commit.getContextId(); lockContext(contextId); ...
java
{ "resource": "" }
q13330
PersistInterfaceService.lockContext
train
private void lockContext(String contextId) throws EKBConcurrentException { if (mode == ContextLockingMode.DEACTIVATED) { return; } synchronized (activeWritingContexts) { if (activeWritingContexts.contains(contextId)) { throw new EKBConcurrentException("The...
java
{ "resource": "" }
q13331
PersistInterfaceService.checkForContextHeadRevision
train
private void checkForContextHeadRevision(String contextId, UUID expectedHeadRevision) throws EKBConcurrentException { if (!Objects.equal(edbService.getLastRevisionNumberOfContext(contextId), expectedHeadRevision)) { throw new EKBConcurrentException("The current revision of the context does n...
java
{ "resource": "" }
q13332
PersistInterfaceService.releaseContext
train
private void releaseContext(String contextId) { if (mode == ContextLockingMode.DEACTIVATED) { return; } synchronized (activeWritingContexts) { activeWritingContexts.remove(contextId); } }
java
{ "resource": "" }
q13333
PersistInterfaceService.runEKBPreCommitHooks
train
private void runEKBPreCommitHooks(EKBCommit commit) throws EKBException { for (EKBPreCommitHook hook : preCommitHooks) { try { hook.onPreCommit(commit); } catch (EKBException e) { throw new EKBException("EDBException is thrown in a pre commit hook.", e); ...
java
{ "resource": "" }
q13334
PersistInterfaceService.runEKBPostCommitHooks
train
private void runEKBPostCommitHooks(EKBCommit commit) throws EKBException { for (EKBPostCommitHook hook : postCommitHooks) { try { hook.onPostCommit(commit); } catch (Exception e) { LOGGER.warn("An exception is thrown in a EKB post commit hook.", e); ...
java
{ "resource": "" }
q13335
PersistInterfaceService.runEKBErrorHooks
train
private void runEKBErrorHooks(EKBCommit commit, EKBException exception) { if (exception != null) { for (EKBErrorHook hook : errorHooks) { hook.onError(commit, exception); } throw exception; } }
java
{ "resource": "" }
q13336
PersistInterfaceService.performPersisting
train
private void performPersisting(ConvertedCommit commit, EKBCommit source) throws EKBException { try { EDBCommit ci = edbService.createEDBCommit(commit.getInserts(), commit.getUpdates(), commit.getDeletes()); ci.setDomainId(source.getDomainId()); ci.setConnectorId(source.getCon...
java
{ "resource": "" }
q13337
PersistInterfaceService.convertEDBObjectList
train
private List<String> convertEDBObjectList(List<EDBObject> objects) { List<String> oids = new ArrayList<>(); for (EDBObject object : objects) { oids.add(object.getOID()); } return oids; }
java
{ "resource": "" }
q13338
ModelRegistryService.scanBundleForModels
train
private Set<ModelDescription> scanBundleForModels(Bundle bundle) { Set<ModelDescription> models = new HashSet<ModelDescription>(); if (!shouldSkipBundle(bundle)) { models = loadModelsOfBundle(bundle); } return models; }
java
{ "resource": "" }
q13339
ModelRegistryService.loadModelsOfBundle
train
private Set<ModelDescription> loadModelsOfBundle(Bundle bundle) { Enumeration<URL> classEntries = bundle.findEntries("/", "*.class", true); Set<ModelDescription> models = new HashSet<ModelDescription>(); if (classEntries == null) { LOGGER.debug("Found no classes in the bundle {}", bu...
java
{ "resource": "" }
q13340
ModelRegistryService.isModelClass
train
private boolean isModelClass(String classname, Bundle bundle) { LOGGER.debug("Check if class '{}' is a model class", classname); Class<?> clazz; try { clazz = bundle.loadClass(classname); } catch (ClassNotFoundException e) { LOGGER.warn("Bundle could not load its ...
java
{ "resource": "" }
q13341
ModelRegistryService.extractClassName
train
private String extractClassName(URL classURL) { String path = classURL.getPath(); return path .replaceAll("^/", "") .replaceAll(".class$", "") .replaceAll("\\/", "."); }
java
{ "resource": "" }
q13342
UserFileAccessObject.findAllUsers
train
public List<User> findAllUsers() { List<User> list = new ArrayList<>(); List<String> usernames; try { usernames = readLines(usersFile); } catch (IOException e) { throw new FileBasedRuntimeException(e); } for (String username : usernames) { ...
java
{ "resource": "" }
q13343
Combination.rightmostIndexBelowMax
train
private int rightmostIndexBelowMax() { for (int i = r-1; i>=0; i--) if (index[i] < n - r + i) return i; return -1; }
java
{ "resource": "" }
q13344
MetaCSPLogging.setLevel
train
public static void setLevel(Level l) { for (Logger log : loggers.values()) log.setLevel(l); globalLevel = l; }
java
{ "resource": "" }
q13345
MetaCSPLogging.setLevel
train
public static void setLevel(Class<?> c, Level l) /* throws LoggerNotDefined */ { if (!loggers.containsKey(c)) tempLevels.put(c, l); else loggers.get(c).setLevel(l); //System.out.println("Set level " + l + " for logger " + loggers.get(c).getName()); }
java
{ "resource": "" }
q13346
TimelineVisualizer.setImage
train
public void setImage(BufferedImage im) { icon.setImage(im); if (image == null) { this.image = im; // this.setSize(image.getWidth(), image.getHeight()); int panelX = image.getWidth(); int panelY = image.getHeight(); panel.setSize(panelX, panelY); // Toolkit tk = Toolkit.getDefaultToolkit(...
java
{ "resource": "" }
q13347
AssignmentFileAccessObject.findAllAssignments
train
public List<Assignment> findAllAssignments() { List<Assignment> list = new ArrayList<>(); List<String> assignmentStrings; try { assignmentStrings = readLines(assignmentsFile); } catch (IOException e) { throw new FileBasedRuntimeException(e); } for...
java
{ "resource": "" }
q13348
MapBasedConnPropsBuilder.logValue
train
private static void logValue(final String key, final String value) { // Fortify will report a violation here because of disclosure of potentially confidential information. // However, the configuration keys are not confidential, which makes this a non-issue / false positive. if (LOG.isInfoEnabl...
java
{ "resource": "" }
q13349
MapBasedConnPropsBuilder.logDefault
train
private static void logDefault(final String key, final String defaultValue) { // Fortify will report a violation here because of disclosure of potentially confidential information. // However, neither the configuration keys nor the default propsbuilder values are confidential, which makes // th...
java
{ "resource": "" }
q13350
MapBasedConnPropsBuilder.logDefault
train
@SuppressWarnings({"PMD.UseObjectForClearerAPI"}) // CHECKSTYLE:ON private static void logDefault(final String key, final String invalidValue, final String validationError, final String defaultValue) { ...
java
{ "resource": "" }
q13351
Trajectory.getSequenceNumber
train
public int getSequenceNumber(Coordinate coord) { int minIndex = 0; double minDist = Double.MAX_VALUE; for (int i = 0; i < this.getPositions().length; i++) { if (this.getPositions()[i].distance(coord) < minDist) { minDist = this.getPositions()[i].distance(coord); minIndex = i; } } return minIndex...
java
{ "resource": "" }
q13352
EngineeringObjectEnhancer.enhanceEKBCommit
train
private void enhanceEKBCommit(EKBCommit commit) throws EKBException { LOGGER.debug("Started to enhance the EKBCommit with Engineering Object information"); enhanceCommitInserts(commit); enhanceCommitUpdates(commit); // TODO: OPENENGSB-3357, consider also deletions in the enhancement ...
java
{ "resource": "" }
q13353
EngineeringObjectEnhancer.enhanceCommitUpdates
train
private void enhanceCommitUpdates(EKBCommit commit) throws EKBException { Map<Object, AdvancedModelWrapper> updated = new HashMap<Object, AdvancedModelWrapper>(); List<AdvancedModelWrapper> result = recursiveUpdateEnhancement( convertOpenEngSBModelList(commit.getUpdates()), updated, commit);...
java
{ "resource": "" }
q13354
EngineeringObjectEnhancer.convertOpenEngSBModelList
train
private List<AdvancedModelWrapper> convertOpenEngSBModelList(List<OpenEngSBModel> models) { List<AdvancedModelWrapper> wrappers = new ArrayList<AdvancedModelWrapper>(); for (OpenEngSBModel model : models) { wrappers.add(AdvancedModelWrapper.wrap(model)); } return wrappers; ...
java
{ "resource": "" }
q13355
EngineeringObjectEnhancer.convertSimpleModelWrapperList
train
private List<OpenEngSBModel> convertSimpleModelWrapperList(List<AdvancedModelWrapper> wrappers) { List<OpenEngSBModel> models = new ArrayList<OpenEngSBModel>(); for (AdvancedModelWrapper wrapper : wrappers) { models.add(wrapper.getUnderlyingModel()); } return models; }
java
{ "resource": "" }
q13356
EngineeringObjectEnhancer.recursiveUpdateEnhancement
train
private List<AdvancedModelWrapper> recursiveUpdateEnhancement(List<AdvancedModelWrapper> updates, Map<Object, AdvancedModelWrapper> updated, EKBCommit commit) { List<AdvancedModelWrapper> additionalUpdates = enhanceUpdates(updates, updated, commit); for (AdvancedModelWrapper model : updates)...
java
{ "resource": "" }
q13357
EngineeringObjectEnhancer.enhanceUpdates
train
private List<AdvancedModelWrapper> enhanceUpdates(List<AdvancedModelWrapper> updates, Map<Object, AdvancedModelWrapper> updated, EKBCommit commit) { List<AdvancedModelWrapper> additionalUpdates = new ArrayList<AdvancedModelWrapper>(); for (AdvancedModelWrapper model : updates) { ...
java
{ "resource": "" }
q13358
EngineeringObjectEnhancer.performEOModelUpdate
train
private List<AdvancedModelWrapper> performEOModelUpdate(EngineeringObjectModelWrapper model, EKBCommit commit) { ModelDiff diff = createModelDiff(model.getUnderlyingModel(), model.getCompleteModelOID(), edbService, edbConverter); boolean referencesChanged = diff.isForeignKeyChanged(); ...
java
{ "resource": "" }
q13359
EngineeringObjectEnhancer.updateReferencedModelsByEO
train
private List<AdvancedModelWrapper> updateReferencedModelsByEO(EngineeringObjectModelWrapper model) { List<AdvancedModelWrapper> updates = new ArrayList<AdvancedModelWrapper>(); for (Field field : model.getForeignKeyFields()) { try { AdvancedModelWrapper result = performMerge(...
java
{ "resource": "" }
q13360
EngineeringObjectEnhancer.reloadReferencesAndUpdateEO
train
private void reloadReferencesAndUpdateEO(ModelDiff diff, EngineeringObjectModelWrapper model) { for (ModelDiffEntry entry : diff.getDifferences().values()) { mergeEngineeringObjectWithReferencedModel(entry.getField(), model); } }
java
{ "resource": "" }
q13361
EngineeringObjectEnhancer.getReferenceBasedUpdates
train
private List<AdvancedModelWrapper> getReferenceBasedUpdates(AdvancedModelWrapper model, Map<Object, AdvancedModelWrapper> updated, EKBCommit commit) throws EKBException { List<AdvancedModelWrapper> updates = new ArrayList<AdvancedModelWrapper>(); List<EDBObject> references = model.getModelsR...
java
{ "resource": "" }
q13362
EngineeringObjectEnhancer.updateEOByUpdatedModel
train
private AdvancedModelWrapper updateEOByUpdatedModel(EDBModelObject reference, AdvancedModelWrapper model, Map<Object, AdvancedModelWrapper> updated) { ModelDescription source = model.getModelDescription(); ModelDescription description = reference.getModelDescription(); AdvancedModelW...
java
{ "resource": "" }
q13363
EngineeringObjectEnhancer.enhanceCommitInserts
train
private void enhanceCommitInserts(EKBCommit commit) throws EKBException { for (OpenEngSBModel model : commit.getInserts()) { AdvancedModelWrapper simple = AdvancedModelWrapper.wrap(model); if (simple.isEngineeringObject()) { performInsertEOLogic(simple.toEngineeringObject...
java
{ "resource": "" }
q13364
EngineeringObjectEnhancer.performInsertEOLogic
train
private void performInsertEOLogic(EngineeringObjectModelWrapper model) { for (Field field : model.getForeignKeyFields()) { mergeEngineeringObjectWithReferencedModel(field, model); } }
java
{ "resource": "" }
q13365
EngineeringObjectEnhancer.performMerge
train
private AdvancedModelWrapper performMerge(AdvancedModelWrapper source, AdvancedModelWrapper target) { if (source == null || target == null) { return null; } ModelDescription sourceDesc = source.getModelDescription(); ModelDescription targetDesc = target.getModelDescription();...
java
{ "resource": "" }
q13366
EngineeringObjectEnhancer.mergeEngineeringObjectWithReferencedModel
train
private void mergeEngineeringObjectWithReferencedModel(Field field, EngineeringObjectModelWrapper model) { AdvancedModelWrapper result = performMerge(loadReferencedModel(model, field), model); if (result != null) { model = result.toEngineeringObject(); } }
java
{ "resource": "" }
q13367
ModelUtils.createModel
train
public static <T> T createModel(Class<T> model, List<OpenEngSBModelEntry> entries) { if (!ModelWrapper.isModel(model)) { throw new IllegalArgumentException("The given class is no model"); } try { T instance = model.newInstance(); for (OpenEngSBModelEntry entry...
java
{ "resource": "" }
q13368
ModelUtils.tryToSetValueThroughField
train
private static boolean tryToSetValueThroughField(OpenEngSBModelEntry entry, Object instance) throws IllegalAccessException { try { Field field = instance.getClass().getDeclaredField(entry.getKey()); field.setAccessible(true); field.set(instance, entry.getValue()); ...
java
{ "resource": "" }
q13369
ModelUtils.tryToSetValueThroughSetter
train
private static boolean tryToSetValueThroughSetter(OpenEngSBModelEntry entry, Object instance) throws IllegalAccessException { try { String setterName = getSetterName(entry.getKey()); Method method = instance.getClass().getMethod(setterName, entry.getType()); method.in...
java
{ "resource": "" }
q13370
DestinationUrl.createDestinationUrl
train
public static DestinationUrl createDestinationUrl(String destination) { String[] split = splitDestination(destination); String host = split[0].trim(); String jmsDestination = split[1].trim(); return new DestinationUrl(host, jmsDestination); }
java
{ "resource": "" }
q13371
CollectionUtilsExtended.group
train
public static <K, V> Map<K, List<V>> group(Collection<V> collection, Function<V, K> keyFn) { Map<K, List<V>> map = new HashMap<>(); for (V value : collection) { K key = keyFn.apply(value); if (map.get(key) == null) { map.put(key, new ArrayList<V>()); ...
java
{ "resource": "" }
q13372
IndexBuilder.buildIndex
train
public <T> JdbcIndex<T> buildIndex(Class<T> model) { JdbcIndex<T> index = new JdbcIndex<>(); index.setModelClass(model); index.setName(indexNameTranslator.translate(model)); index.setFields(buildFields(index)); return index; }
java
{ "resource": "" }
q13373
Utils.extractAttributeValueNoEmptyCheck
train
public static String extractAttributeValueNoEmptyCheck(Entry entry, String attributeType) { Attribute attribute = entry.get(attributeType); if (attribute == null) { return null; } try { return attribute.getString(); } catch (LdapInvalidAttributeValueExcept...
java
{ "resource": "" }
q13374
FileComparer.removeSimilarClassesFromFile1
train
public void removeSimilarClassesFromFile1() throws IOException { logging.info("Start reding cs File"); List<String> linescs1 = getFileLinesAsList(csFile1); logging.info("Start reding cs File"); List<String> linescs2 = getFileLinesAsList(csFile2); logging.info("Search classes"); ...
java
{ "resource": "" }
q13375
FileComparer.replaceAbstractClasses
train
public List<String> replaceAbstractClasses(List<String> lines) { List<String> result = new LinkedList<String>(); for (int i = 0; i < lines.size(); i++) { result.add(removeAbstract(lines.get(i))); } return result; }
java
{ "resource": "" }
q13376
FileComparer.getClassName
train
private String getClassName(String line) { String result = line.substring(line.indexOf(CSHARP_CLASS_NAME) + CSHARP_CLASS_NAME.length()); if (result.contains("{")) { result = result.substring(0, result.indexOf("{")); } if (result.contains(":")) { re...
java
{ "resource": "" }
q13377
FileComparer.getFileLinesAsList
train
public List<String> getFileLinesAsList(File f) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader( new DataInputStream(new FileInputStream(f)))); List<String> result = new LinkedList<String>(); String strLine; while ((strLine = br.readLine()) !=...
java
{ "resource": "" }
q13378
FileComparer.removeSimilaritiesAndSaveFiles
train
public static void removeSimilaritiesAndSaveFiles(List<String> filepathes, Log logging, Boolean isWindows) throws IOException { List<File> files = new LinkedList<File>(); for (String path : filepathes) { files.add(new File(path)); } FileComparer fcomparer; ...
java
{ "resource": "" }
q13379
OsgiUtils.getFilterForLocation
train
public static Filter getFilterForLocation(Class<?> clazz, String location, String context) throws IllegalArgumentException { String filter = makeLocationFilterString(location, context); return FilterUtils.makeFilter(clazz, filter); }
java
{ "resource": "" }
q13380
OsgiUtils.getFilterForLocation
train
public static Filter getFilterForLocation(Class<?> clazz, String location) throws IllegalArgumentException { return getFilterForLocation(clazz, location, ContextHolder.get().getCurrentContextId()); }
java
{ "resource": "" }
q13381
OsgiUtils.getFilterForLocation
train
public static Filter getFilterForLocation(String location, String context) throws IllegalArgumentException { String filter = makeLocationFilterString(location, context); try { return FrameworkUtil.createFilter(filter); } catch (InvalidSyntaxException e) { throw new Illega...
java
{ "resource": "" }
q13382
AbstractStandardTransformationOperation.checkInputSize
train
protected void checkInputSize(List<Object> input) throws TransformationOperationException { int inputCount = getOperationInputCount(); int inputSize = input.size(); if (inputCount == -2) { return; } else if (inputCount == -1 && input.size() < 1) { throw new Transf...
java
{ "resource": "" }
q13383
AbstractStandardTransformationOperation.getParameterOrDefault
train
protected String getParameterOrDefault(Map<String, String> parameters, String paramName, String defaultValue) throws TransformationOperationException { return getParameter(parameters, paramName, false, defaultValue); }
java
{ "resource": "" }
q13384
AbstractStandardTransformationOperation.getParameterOrException
train
protected String getParameterOrException(Map<String, String> parameters, String paramName) throws TransformationOperationException { return getParameter(parameters, paramName, true, null); }
java
{ "resource": "" }
q13385
AbstractStandardTransformationOperation.getParameter
train
private String getParameter(Map<String, String> parameters, String paramName, boolean abortOnError, String defaultValue) throws TransformationOperationException { String value = parameters.get(paramName); if (value != null) { return value; } if (abortOnError) { ...
java
{ "resource": "" }
q13386
AbstractStandardTransformationOperation.parseIntString
train
protected Integer parseIntString(String string, boolean abortOnError, int def) throws TransformationOperationException { Integer integer = def; if (string == null) { logger.debug("Given string is empty so the default value is taken."); } try { integer = In...
java
{ "resource": "" }
q13387
AbstractStandardTransformationOperation.generateMatcher
train
protected Matcher generateMatcher(String regex, String valueString) throws TransformationOperationException { if (regex == null) { throw new TransformationOperationException("No regex defined. The step will be skipped."); } try { Pattern pattern = Pattern.compile(...
java
{ "resource": "" }
q13388
JAXBMarshaller.configureJaxbMarshaller
train
protected void configureJaxbMarshaller(javax.xml.bind.Marshaller marshaller) throws PropertyException { marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, m_formatOutput); }
java
{ "resource": "" }
q13389
DefaultConverterStep.getEntryValue
train
public Object getEntryValue(JPAEntry entry) { try { Class<?> typeClass = loadClass(entry.getType()); if (typeClass == null) { return entry.getValue(); } if (typeClass == Character.class) { if (entry.getValue().length() > 1) { ...
java
{ "resource": "" }
q13390
DefaultConverterStep.loadClass
train
private Class<?> loadClass(String className) { try { return EDBUtils.class.getClassLoader().loadClass(className); } catch (ClassNotFoundException e) { LOGGER.debug("Class {} can not be found by the EDB. This object type is not supported by the EDB." + " Maybe the ...
java
{ "resource": "" }
q13391
DefaultConverterStep.invokeValueOf
train
private Object invokeValueOf(Class<?> clazz, String value) throws IllegalAccessException, InvocationTargetException { try { return MethodUtils.invokeExactStaticMethod(clazz, "valueOf", value); } catch (NoSuchMethodException e) { return null; } }
java
{ "resource": "" }
q13392
SpelExpression.getParsedExpression
train
protected synchronized Expression getParsedExpression() { if (parsedExpression == null) { try { parsedExpression = EXPRESSION_PARSER.parseExpression(getExpression()); } catch (ParseException e) { throw new IllegalArgumentException("[" + g...
java
{ "resource": "" }
q13393
VaadinConfirmDialog.show
train
public static VaadinConfirmDialog show(final UI ui, final String windowCaption, final String message, final String okCaption, final String cancelCaption, final Runnable r) { VaadinConfirmDialog d = getFactory().create(windowCaption, message, okCaption, cancelCaption, null...
java
{ "resource": "" }
q13394
VaadinConfirmDialog.show
train
public final void show(final UI ui, final Listener listener, final boolean modal) { confirmListener = listener; center(); setModal(modal); ui.addWindow(this); }
java
{ "resource": "" }
q13395
EKBCommit.addInsert
train
public EKBCommit addInsert(Object insert) { if (insert != null) { checkIfModel(insert); inserts.add((OpenEngSBModel) insert); } return this; }
java
{ "resource": "" }
q13396
EKBCommit.addInserts
train
public EKBCommit addInserts(Collection<?> inserts) { if (inserts != null) { for (Object insert : inserts) { checkIfModel(insert); this.inserts.add((OpenEngSBModel) insert); } } return this; }
java
{ "resource": "" }
q13397
EKBCommit.addUpdate
train
public EKBCommit addUpdate(Object update) { if (update != null) { checkIfModel(update); updates.add((OpenEngSBModel) update); } return this; }
java
{ "resource": "" }
q13398
EKBCommit.addUpdates
train
public EKBCommit addUpdates(Collection<?> updates) { if (updates != null) { for (Object update : updates) { checkIfModel(update); this.updates.add((OpenEngSBModel) update); } } return this; }
java
{ "resource": "" }
q13399
EKBCommit.addDelete
train
public EKBCommit addDelete(Object delete) { if (delete != null) { checkIfModel(delete); deletes.add((OpenEngSBModel) delete); } return this; }
java
{ "resource": "" }